Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2014 12:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/0fc9264b8f3f4111e0f1 to your computer and use it in GitHub Desktop.
23 Bytes for Munching Squares
ORG 100h
SECTION .text
mov al, 13h ; b0 13 ah == 0 taken from program start conditions
int 10h ; cd 10 call the BIOS video interrupt
les bx, [bx] ; c4 1d program start conditions make this a short way to get es == 0a000
mov bx, 320 ; bb 40 01 == db 0bh 40h 01h
drawloop:
db 0f0h ; 0f add ax, si == db 01h 0f0h
stosb ; aa write data to screen, increment si/di
cwd ; 99 dx = 0
mov ax, cx ; 89 f8 load pixel address
div bx ; f7 f3 ax = di / 320, dx = di % 320
xor ax, dx ; 31 d0 munching square pattern
loop drawloop - 1 ; e2 f4
inc si ; 46 next frame
jmp drawloop - 1 ; eb f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment