This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
forked from hlorenzi/customasm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix hlorenzi#115: add label support within asm blocks
- Loading branch information
Showing
5 changed files
with
249 additions
and
93 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
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,29 @@ | ||
#ruledef { | ||
emit {x: u8} => x | ||
|
||
test => asm | ||
{ | ||
label: | ||
emit $ | ||
label2: | ||
emit $ | ||
emit label | ||
emit label2 | ||
emit $ | ||
} | ||
|
||
nested_test => asm | ||
{ | ||
label: | ||
emit $ | ||
label2: | ||
emit $ | ||
emit label | ||
emit label2 | ||
emit $ | ||
test | ||
} | ||
} | ||
|
||
test ; = 0x00_01_00_01_04 | ||
nested_test ; = 0x05_06_05_06_09_0a_0b_0a_0b_0e |
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,26 @@ | ||
#ruledef { | ||
emit {x: u8} => x | ||
|
||
run => asm | ||
{ | ||
test | ||
emit 0x10 | ||
} | ||
|
||
test => asm | ||
{ | ||
test2 end | ||
test2 end | ||
end: | ||
} | ||
|
||
test2 {l: u32} => asm | ||
{ | ||
emit l | ||
emit end | ||
end: | ||
} | ||
} | ||
|
||
run ; = 0x04_02_04_04_10 | ||
emit $ ; = 0x05 |
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,24 @@ | ||
#ruledef test | ||
{ | ||
ld {x} => | ||
{ | ||
assert(x <= 0x8) | ||
0x11 @ x`16 | ||
} | ||
ld {x} => | ||
{ | ||
assert(x > 0x8) | ||
0x22 @ x`8 | ||
} | ||
|
||
test => asm | ||
{ | ||
label: | ||
ld label | ||
ld label | ||
ld label | ||
} | ||
} | ||
|
||
test ; = 0x110000_110000_110000 |
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,24 @@ | ||
#ruledef test | ||
{ | ||
ld {x} => | ||
{ | ||
assert(x <= 0x8) | ||
0x11 @ x`16 | ||
} | ||
ld {x} => | ||
{ | ||
assert(x > 0x8) | ||
0x22 @ x`8 | ||
} | ||
|
||
test => asm | ||
{ | ||
ld label | ||
ld label | ||
ld label | ||
label: | ||
} | ||
} | ||
|
||
test ; error: failed / error:_:15: converge |