MOV AX,0A000h MOV ES,AX MOV BL,23 MOV AL,320 ; bytes per row MUL BL ; result in AX ADD AX,117 ; offset of pixel at row 23,col 117 is now in AX MOV SI,AX MOV ES:[SI],182 |
0=black, 1=blue, 2=green, 3=cyan, 4=red |
5=magenta (purple), 6=brown, 7=white, 8=gray |
9=light blue, 10=light green, 11=light cyan, 12=light red |
13=light magenta, 14=yellow, 15=intense white |
While it is possible to write directly to video buffer, we can also use interrupt 10h for convenience. Thus INT 10h, function 0Ch writes a graphic pixel: see p.335, ch.16. It is a tradeoff between convenience and speed: direct access to video buffer is faster than the use of interrupts. Note that one of the convenience of interrupts is that it takes care of the differences in different modes.
Exercise Write a program that to draw the Union Jack on the screen, against a gray background.
This has been adapted by Chee from notes by Marsha Berger (1996).