Created
May 5, 2012 03:25
-
-
Save cotto/2599368 to your computer and use it in GitHub Desktop.
now with named registers
This file contains hidden or 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
.version 0 | |
.chunk "noop" | |
.constants | |
0 "1..1\n" | |
1 "n" | |
2 "ok 1 or: 9 or 90 = 91\n" | |
.metadata | |
.bytecode | |
.regname ponies = S0 | |
.regname quuxlefruit = I0 | |
.regname quuxlefrut2 = I2 | |
set_imm S0, 0, 0 | |
deref ponies, CONSTS, S0 | |
set_imm I0, 0, 1 | |
print_s I0, ponies, x | |
set_imm I1, 0, 9 | |
set_imm I2, 0, 90 | |
or I2, I2, I1 | |
set_imm I3, 0, 91 | |
sub_i I3, I3, quuxlefrut2 | |
goto_if or_nok, I3 | |
goto or_ok, x | |
or_nok: | |
set_imm S0, 0, 1 | |
deref S0, CONSTS, ponies | |
print_s I0, S0, x | |
or_ok: | |
set_imm S0, 0, 2 | |
deref ponies, CONSTS, S0 | |
print_s quuxlefriut, ponies, x | |
# This code isn't really PASM, but the highlighting works well. | |
# vim: expandtab shiftwidth=4 ft=pasm: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment