bits 16 org 100h start: ; call video bios (10h) to set video mode (call 00h), to mode ; 13h (320x200 8bpp). mov ax, 13h ; call number in ah (0), call argument in al (13h) int 10h ; call video bios ; setup es to access the framebuffer segment (a000h) push word 0a000h pop es ; prepare to fill the framebuffer with red (default palette color 4) mov eax, 04040404h ; value to store each time mov ecx, 16000 ; framebuffer size in 32bit units (320x200/4 = 16000) xor di, di ; start from offset 0 rep stosd ; repeat (while ecx != 0) the "store string dword" instr. .mainloop: in al, 60h ; read pending scancode from the keyboard port (if any) dec al ; ESC is 1, so decrement ... jnz .mainloop ; ... and loop as long as the result was not 0 ; switch back to text mode (mode 3) mov ax, 3 int 10h ; return to dos ret