Skip to content

Instantly share code, notes, and snippets.

@jomontanari
Created April 24, 2012 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jomontanari/2478779 to your computer and use it in GitHub Desktop.
Save jomontanari/2478779 to your computer and use it in GitHub Desktop.
Game of life in Assembly (hardcoded stages)
SET A, 0xE041 ; char live cell
SET C, 0x0000 ; char dead cell
SET B, 0x8000 ; top left corner screen
SET Y, 0 ; iterator for animation
:loop
SET Z, state1
JSR draw
SET Z, state2
JSR draw
SET PC, loop
:draw
SET I, 0
:draw_loop
SET X, [screen_placement + I]
IFN [Z], 0
SET [X], A
IFE [Z], 0
SET [X], C
ADD Z, 1
ADD I, 1
IFG 0x09, I
SET PC, draw_loop
SET PC, POP
:screen_placement
DAT 0x8000, 0x8001, 0x8002
DAT 0x8020, 0x8021, 0x8022
DAT 0x8040, 0x8041, 0x8042
:state1
DAT 0, 0, 0
DAT 1, 1, 1
DAT 0, 0, 0
:state2
DAT 0, 1, 0
DAT 0, 1, 0
DAT 0, 1, 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment