Last active
October 30, 2015 08:04
-
-
Save drasive/14efd70140cb08b4b51d to your computer and use it in GitHub Desktop.
TIS-100 solutions (http://www.zachtronics.com/tis-100/, assembler video game).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@0 | |
MOV RIGHT, DOWN | |
@1 | |
MOV UP, LEFT | |
@2 | |
@3 | |
@4 | |
MOV UP, DOWN | |
@5 | |
@6 | |
MOV UP, RIGHT | |
@7 | |
MOV LEFT, RIGHT | |
@8 | |
MOV ANY, DOWN | |
@9 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@0 | |
@1 | |
MOV UP, ACC | |
ADD ACC | |
MOV ACC, DOWN | |
@2 | |
@3 | |
@4 | |
MOV UP, DOWN | |
@5 | |
@6 | |
@7 | |
MOV UP, RIGHT | |
@8 | |
MOV LEFT, DOWN | |
@9 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@0 | |
@1 | |
MOV UP, ACC | |
# Calculate A-B | |
SUB RIGHT | |
MOV ACC, DOWN | |
@2 | |
MOV UP, ACC | |
MOV ACC, LEFT | |
@3 | |
@4 | |
@5 | |
MOV UP, ACC | |
MOV ACC, RIGHT | |
MOV ACC, DOWN | |
@6 | |
MOV LEFT, ACC | |
# Negate A-B > B-A | |
NEG | |
MOV ACC, DOWN | |
@7 | |
@8 | |
MOV UP, DOWN | |
@9 | |
MOV UP, DOWN | |
@10 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@0 | |
MOV UP, DOWN | |
@1 | |
@2 | |
@3 | |
@4 | |
MOV UP, DOWN | |
@5 | |
MOV UP, RIGHT | |
@6 | |
START: | |
MOV LEFT, ACC | |
MOV ACC, RIGHT | |
JGZ EXIT_TRUE | |
MOV 0, DOWN | |
JMP START | |
EXIT_TRUE: | |
MOV 1, DOWN | |
@7 | |
START: | |
MOV LEFT, ACC | |
MOV ACC, RIGHT | |
JEZ EXIT_TRUE | |
MOV 0, DOWN | |
JMP START | |
EXIT_TRUE: | |
MOV 1, DOWN | |
@8 | |
START: | |
MOV LEFT, ACC | |
JLZ EXIT_TRUE | |
MOV 0, DOWN | |
JMP START | |
EXIT_TRUE: | |
MOV 1, DOWN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@0 | |
@1 | |
MOV UP, RIGHT | |
@2 | |
START: MOV UP, ACC | |
JLZ A | |
JGZ B | |
ADD: MOV LEFT, ACC | |
ADD RIGHT | |
MOV ACC, DOWN | |
JMP START | |
A: MOV LEFT, DOWN | |
MOV RIGHT, NIL | |
JMP START | |
B: MOV RIGHT, DOWN | |
MOV LEFT, NIL | |
@3 | |
MOV UP, LEFT | |
@4 | |
@5 | |
@6 | |
MOV UP, DOWN | |
@7 | |
@8 | |
@9 | |
MOV UP, DOWN | |
@10 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment