Skip to content

Instantly share code, notes, and snippets.

@rygorous
Created June 6, 2015 09:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rygorous/6f5427c5ca0e6a474f49 to your computer and use it in GitHub Desktop.
Save rygorous/6f5427c5ca0e6a474f49 to your computer and use it in GitHub Desktop.
Loop coding
Making the hot path (in this case, no match) fall-through:
--- before ---
mov up,down
mov up,down
# check 4
l:mov up,acc
sub 4
jez z
mov 0,right
jmp t
z:mov 1,right
t:add 4
mov acc,down
jmp l
--- after ---
mov up,down
mov up,down
jmp l
# check 4
f:mov 0,right
t:add 4
mov acc,down
l:mov up,acc
sub 4
jnz f
mov 1,right
jmp t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment