Skip to content

Instantly share code, notes, and snippets.

@MichaelXavier
Created June 9, 2010 05:10
Show Gist options
  • Save MichaelXavier/431083 to your computer and use it in GitHub Desktop.
Save MichaelXavier/431083 to your computer and use it in GitHub Desktop.
ORG $1000
START: ; first instruction of program
green_t EQU 60
yello_t EQU 5
lights EQU $2000
timer EQU $2001
n_ymask EQU %100010 ; EW will be red when NS yellow
n_gmask EQU %100001
e_ymask EQU %010100
e_gmask EQU %001100
MOVE.B #1,D0
green CMPI.B #1,D0
BNE green_e
green_n MOVE.B #n_gmask,lights
JMP green_c
green_e MOVE.B #e_gmask,lights
green_c MOVE.B #green_t,D2
JSR wait
JSR yellow
NOT.B D0
JMP green
wait MOVE.B D2,timer
waitloop CMPI.B #0,timer
BNE waitloop
RTS
yellow CMPI.B #1,D0
BNE yellow_e
yellow_n MOVE.B #n_ymask,lights
JMP yellow_c
yellow_e MOVE.B #e_ymask,lights
yellow_c MOVE.B #yello_t,D2
JSR wait
RTS
END START ; last line of source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment