Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbad968
commit 436416b
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.version 0 | ||
.chunk "noop" | ||
.constants | ||
0 "1..1\n" | ||
1 "n" | ||
2 "ok 1 deref: CONSTS[3] = 99\n" | ||
3 99 | ||
.metadata | ||
.bytecode | ||
|
||
set_imm S0, 0, 0 | ||
deref S0, CONSTS, S0 | ||
set_imm I0, 0, 1 | ||
print_s I0, S0, x | ||
|
||
set_imm N0, 0, 3 | ||
deref N0, CONSTS, N0 | ||
set_imm N1, 0, 99 | ||
sub_n N0, N0, N1 | ||
|
||
goto_if deref_nok, I3 | ||
goto deref_ok, x | ||
|
||
deref_nok: | ||
set_imm S0, 0, 1 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
deref_ok: | ||
set_imm S0, 0, 2 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
# This code isn't really PASM, but the highlighting works well. | ||
# vim: expandtab shiftwidth=4 ft=pasm: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.version 0 | ||
.chunk "noop" | ||
.constants | ||
0 "1..1\n" | ||
1 "n" | ||
2 "ok 1 set: N0 = 99\n" | ||
3 99 | ||
.metadata | ||
.bytecode | ||
|
||
set_imm S0, 0, 0 | ||
deref S0, CONSTS, S0 | ||
set_imm I0, 0, 1 | ||
print_s I0, S0, x | ||
|
||
set_imm N0, 0, 3 | ||
deref N0, CONSTS, N0 | ||
set N1, N0, x | ||
set_imm N0, 0, 99 | ||
sub_n N0, N0, N1 | ||
|
||
goto_if set_nok, N0 | ||
goto set_ok, x | ||
|
||
set_nok: | ||
set_imm S0, 0, 1 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
set_ok: | ||
set_imm S0, 0, 2 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
# This code isn't really PASM, but the highlighting works well. | ||
# vim: expandtab shiftwidth=4 ft=pasm: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.version 0 | ||
.chunk "noop" | ||
.constants | ||
0 "1..1\n" | ||
1 "n" | ||
2 "ok 1 set_imm: *N0 = 99\n" | ||
3 99 | ||
.metadata | ||
.bytecode | ||
|
||
set_imm S0, 0, 0 | ||
deref S0, CONSTS, S0 | ||
set_imm I0, 0, 1 | ||
print_s I0, S0, x | ||
|
||
set_imm N0, 0, 3 | ||
deref N0, CONSTS, N0 | ||
set_imm N1, 0, 99 | ||
sub_n N0, N0, N1 | ||
|
||
goto_if set_imm_nok, N0 | ||
goto set_imm_ok, x | ||
|
||
set_imm_nok: | ||
set_imm S0, 0, 1 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
set_imm_ok: | ||
set_imm S0, 0, 2 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
# This code isn't really PASM, but the highlighting works well. | ||
# vim: expandtab shiftwidth=4 ft=pasm: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.version 0 | ||
.chunk "noop" | ||
.constants | ||
0 "1..1\n" | ||
1 "n" | ||
2 "ok 1 set_ref: CONSTS[4] = 99\n" | ||
3 99 | ||
4 88 | ||
.metadata | ||
.bytecode | ||
|
||
set_imm S0, 0, 0 | ||
deref S0, CONSTS, S0 | ||
set_imm I0, 0, 1 | ||
print_s I0, S0, x | ||
|
||
set_imm N0, 0, 4 | ||
deref N0, CONSTS, N0 | ||
|
||
set_ref CONSTS, 3, N0 | ||
|
||
set_imm N1, 0, 4 | ||
deref N1, CONSTS, N1 | ||
sub_n N0, N0, N1 | ||
|
||
goto_if set_ref_nok, N0 | ||
goto set_ref_ok, x | ||
|
||
set_ref_nok: | ||
set_imm S0, 0, 1 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
set_ref_ok: | ||
set_imm S0, 0, 2 | ||
deref S0, CONSTS, S0 | ||
print_s I0, S0, x | ||
|
||
# This code isn't really PASM, but the highlighting works well. | ||
# vim: expandtab shiftwidth=4 ft=pasm: |