Presentation is loading. Please wait.

Presentation is loading. Please wait.

BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.

Similar presentations


Presentation on theme: "BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language."— Presentation transcript:

1 BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.

2 BY Kamran Yousaf Contents Interrupts & Registers & DMA & Pointers Plotting Pixel Line / Rectangle / Polygon Circle / Arc Ellipse Fill

3 BY Kamran Yousaf Interrupt It is a request generated by Processor for peripheral devices OR by peripheral devices for processor. _____________________________________________ Dos identifies these interrupts by interrupt No. & there are total 256 Interrupts under DOS Windows call these interrupts as API’s. & there are unlimited API’s under Windows. _____________________________________________ Software Interrupts Software requests to hardware (21h). Hardware Interrupts Processor’s request to Hardware (0~6h) BIOS Interrupts Monitors, Keyboards other Basic Hardware.

4 BY Kamran Yousaf Generating an Interrupt The generation of an interrupt requires following things to take care. Interrupt No : To generate or call an interrupt we must first know what is its Interrupt No. Most common Interrupt No’s are as below. Timer: 8h Keyboard: 9hVGA: 10h Hard Disk: 13hDOS: 21hMouse: 33h Service No : It is the no related to a function to be performed by that interrupted device. i.e. different VGA service no’s. Move Cursor: 2 Change Cursor:1Get Cursor: 3

5 BY Kamran Yousaf Registers Scratch Pads General Purpose Temporary data storage Calculation Purpose Built in Processor Address registers Flags Parameters & Returns of Interrupts

6 BY Kamran Yousaf Interrupts & Registers The Parameters of an interrupt called are passed through general purpose registers. AX, BX, CX, DX 2Byte Structure AH-AL, BH-BL, CH-CL, DH-DL Each sharing 1 byte from a register The Data storing and retrieving is dependent AH 8 Bits AL 8 Bits AX 16 Bits Register

7 BY Kamran Yousaf Using Registers in C++ Data Structure like Registers “struct” and “union” “struct” is group of data sturtures “union” is “struct”, and it shares mem Register’s structure is composed of a Union and two structures

8 BY Kamran Yousaf REGS union REGS { struct WORDREGS x; struct BYTEREGS h; }; struct BYTEREGS { unsigned char al, ah, bl, bh; unsigned char cl, ch, dl, dh; }; struct WORDREGS { unsigned int ax, bx, cx, dx; unsigned int si, di, cflag, flags; }; REGS.h.ah (8 Bits) REGS.h.al REGS.x.ax 16 Bits

9 BY Kamran Yousaf Calling Interrupt Int86(int intno, union REGS *inregs, union REGS *outregs); Copies the Register Values from REGS Union to Registers Calls the interrupt Copies the Register Values from Registers to Union

10 BY Kamran Yousaf Rules Better to use Hexadecimal No as interrupt no/ service no. The Service no is placed in ah register always Other registers are used as parameter registers After the calling these registers are used as return registers.

11 BY Kamran Yousaf DMA & Pointers Memory is directly Accessed Specific Solution Difficult Fast Pointers Used More Technical / Mathematical


Download ppt "BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language."

Similar presentations


Ads by Google