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