110 likes | 233 Views
Application of Computer Graphics and Animation Using C++ Language. Contents. Interrupts & Registers & DMA & Pointers Plotting Pixel Line / Rectangle / Polygon Circle / Arc Ellipse Fill. Interrupt. It is a request generated by Processor for peripheral devices OR
E N D
Application of Computer Graphics and Animation Using C++ Language.
Contents • Interrupts & Registers & • DMA & Pointers • Plotting Pixel • Line / Rectangle / Polygon • Circle / Arc • Ellipse • Fill
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.
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: 9h VGA: 10h Hard Disk: 13h DOS: 21h Mouse: 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:1 Get Cursor: 3
Registers • Scratch Pads • General Purpose • Temporary data storage • Calculation Purpose • Built in Processor • Address registers • Flags • Parameters & Returns of Interrupts
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
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
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
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
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.
DMA & Pointers • Memory is directly Accessed • Specific Solution • Difficult • Fast • Pointers Used • More Technical / Mathematical