Upload
syed-owais-ali-chishti
View
303
Download
0
Embed Size (px)
Citation preview
Handling Character display in
graphics mode using BIOS
Who are we?• Syed Owais Ali Chishti• Faisal Usman• Ibrahim Abbasi
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…
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
InitMode PROC mov ah, 0h ; Function mov al, 10h ; 640x350 16 color int 10h retInitMode ENDP
; Modes Page 556
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
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
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
ShowCursor PROC mov ah, 1h mov cx, 0607h
int 10h retShowCursor ENDP
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
GetMetoXY PROC mov ah, 2h ; Move cursor mov dh, 10 ; row mov dl, 20 ; columns mov bh, 0 ; page int 10h retGetMetoXY ENDP
clear PROC mov ax, 0600h mov cx, 0 mov dx, 184Fh mov bh, 0 ; Color int 10h mov dx, 0
call GetMeToXYclear ENDP
PrintString PROC loc:WORD ; Print first Char of string
; Move cursor Ahead ; Loop until null found
retPrintString ENDP
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
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
VerticalLine PROC l0: call PrintPX dec dx ; dx y-axis dec ax ; ax loop value cmp ax, 0 jg l0 retVerticalLine ENDP
HorizontalLine PROC l0: call PrintPX inc cx dec ax cmp ax, 0 jg l0 retHorizontalLine ENDP
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
Square?Circle?
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
Good Resources on Video Service• http://bit.ly/BIOSGraphics001• http://bit.ly/BIOSGraphics002• http://bit.ly/BIOSGraphics003