shrinking c.asm
[vtuts] / dos1 / a.asm
1         bits 16
2         org 100h
3
4 start:
5         ; call video bios (10h) to set video mode (call 00h), to mode
6         ; 13h (320x200 8bpp).
7         mov ax, 13h     ; call number in ah (0), call argument in al (13h)
8         int 10h         ; call video bios
9
10         ; setup es to access the framebuffer segment (a000h)
11         push word 0a000h
12         pop es
13
14         ; prepare to fill the framebuffer with red (default palette color 4)
15         mov eax, 04040404h      ; value to store each time
16         mov ecx, 16000  ; framebuffer size in 32bit units (320x200/4 = 16000)
17         xor di, di      ; start from offset 0
18         rep stosd       ; repeat (while ecx != 0) the "store string dword" instr.
19
20 .mainloop:
21         in al, 60h      ; read pending scancode from the keyboard port (if any)
22         dec al          ; ESC is 1, so decrement ...
23         jnz .mainloop   ; ... and loop as long as the result was not 0
24
25         ; switch back to text mode (mode 3)
26         mov ax, 3
27         int 10h
28
29         ; return to dos
30         ret