Handling character display in graphics mode using bios

21
Handling Character display in graphics mode using BIOS

Transcript of Handling character display in graphics mode using bios

Page 1: Handling character display in graphics mode using bios

Handling Character display in

graphics mode using BIOS

Page 2: Handling character display in graphics mode using bios

Who are we?• Syed Owais Ali Chishti• Faisal Usman• Ibrahim Abbasi

Page 3: Handling character display in graphics mode using bios

Interrupts 10h (Video Service)INT 10h,0 - Set video modeINT 10h,1 - Set cursor typeINT 10h,2 - Set cursor positionINT 10h,3 - Read cursor positionINT 10h,5 - Select active display pageINT 10h,6 - Scroll active page upINT 10h,7 - Scroll active page downINT 10h,8 - Read character and attribute at cursorINT 10h,9 - Write character and attribute at cursorINT 10h,A - Write character at current cursorINT 10h,B - Set color paletteINT 10h,C - Write graphics pixel at coordinate

More…

Page 4: Handling character display in graphics mode using bios

Compiling 16 Bit MASM• Download TaizTextEditor• Unzip on Desktop• Click on loadAsm16.bat in unzipped folder• Click TaizTextEditor.exe to start• To Compiler press F6

• Download: http://bit.ly/TaizTextEditor

Page 5: Handling character display in graphics mode using bios

InitMode PROC mov ah, 0h ; Function mov al, 10h ; 640x350 16 color int 10h retInitMode ENDP

; Modes Page 556

Page 6: Handling character display in graphics mode using bios

PrintChar PROC mov ah, 9h mov al, ‘A’ mov bh, 0 ; Page number mov bl, 0Fh ; Color mov cx, 1 ; Repeat int 10h retPrintChar ENDP

Page 7: Handling character display in graphics mode using bios

ScrollUp PROC mov ah, 6h ; scroll window up mov al, 0 ; entire window mov ch, 0 ; upper left row mov cl, 0 ; upper left column mov dh, 24 ; lower right row mov dl, 79 ; lower right column mov bh, 7 ; attribute for blanked area int 10h retScrollUp ENDP

Page 8: Handling character display in graphics mode using bios

ScrollDown PROC mov ah, 7h ; scroll window down mov al, 0 ; entire window mov ch, 0 ; upper left row mov cl, 0 ; upper left column mov dh, 24 ; lower right row mov dl, 79 ; lower right column mov bh, 7 ; attribute for blanked area int 10h retScrollDown ENDP

Page 9: Handling character display in graphics mode using bios

ShowCursor PROC mov ah, 1h mov cx, 0607h

int 10h retShowCursor ENDP

Page 10: Handling character display in graphics mode using bios

HideCursor PROC mov ah, 3h ; Get Cursor Pos int 10h or ch, 30h ; Illegal Pos mov ah, 1 h ; Set Cursor Pos int 10h retHideCursor ENDP

Page 11: Handling character display in graphics mode using bios

GetMetoXY PROC mov ah, 2h ; Move cursor mov dh, 10 ; row mov dl, 20 ; columns mov bh, 0 ; page int 10h retGetMetoXY ENDP

Page 12: Handling character display in graphics mode using bios

clear PROC mov ax, 0600h mov cx, 0 mov dx, 184Fh mov bh, 0 ; Color int 10h mov dx, 0

call GetMeToXYclear ENDP

Page 13: Handling character display in graphics mode using bios

PrintString PROC loc:WORD ; Print first Char of string

; Move cursor Ahead ; Loop until null found

retPrintString ENDP

Page 14: Handling character display in graphics mode using bios

PrintPX PROC mov ah, 0Ch mov al, 15 ; Color 0-16 mov bh, 0 ; video page mov cx, 10 ; x_coord mov dx, 10 ; y_coord int 10h retPrintPX ENDP

Page 15: Handling character display in graphics mode using bios

ReadPX PROC mov ah, 0Dh mov bh, 0 ; Video Page mov cx, 100 ; x mov dx, 100 ; y int 10h ; result in al 0-15 retReadPX ENDP

Page 16: Handling character display in graphics mode using bios

VerticalLine PROC l0: call PrintPX dec dx ; dx y-axis dec ax ; ax loop value cmp ax, 0 jg l0 retVerticalLine ENDP

Page 17: Handling character display in graphics mode using bios

HorizontalLine PROC l0: call PrintPX inc cx dec ax cmp ax, 0 jg l0 retHorizontalLine ENDP

Page 18: Handling character display in graphics mode using bios

Include soac16.inc.codemain PROC startup mov al, 10h ; 640x350 16 colors call InitMode

mov al, ‘A'call PrintChar mov al, 'B'call PrintChar ; Print in same place - ERROR

mov ah, 4Ch

int 21hmain ENDPEND main

Page 19: Handling character display in graphics mode using bios

Square?Circle?

Page 20: Handling character display in graphics mode using bios

Include soac16.inc

.codemain PROC startup mov al, 10h ; 640x350 16 call InitMode invoke Square, 200, 300, 200 mov ah,4Ch int 21hmain ENDPEND main

Page 21: Handling character display in graphics mode using bios

Good Resources on Video Service• http://bit.ly/BIOSGraphics001• http://bit.ly/BIOSGraphics002• http://bit.ly/BIOSGraphics003