diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-23 18:38:09 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-23 18:47:57 -0400 |
commit | 729a19a6b7e636a8af3a15f7fe5204cc0d59dbf7 (patch) | |
tree | 9dc5dbacd0576f1aa369e9442f442e6a117865bc /etc/oemu/test-00.s | |
parent | f9a78caefd6f254e854fd6cdf64a8642ccddc34e (diff) |
oasm: Add initial support for labels
A label is like a pin on a map with a number attached to it. OASM keeps track
of a number referred to as the psuedo instruction pointer (PIP). This value is
initially zero by default and is incremented every instruction. The purpose of
this value is to pin a location in the code and mark it to be at a specific address
so that further references to that label would be translated to the previous PIP value
at the time of encountering the label.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'etc/oemu/test-00.s')
-rw-r--r-- | etc/oemu/test-00.s | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/etc/oemu/test-00.s b/etc/oemu/test-00.s index b34c099..1fa7ff1 100644 --- a/etc/oemu/test-00.s +++ b/etc/oemu/test-00.s @@ -1,13 +1,14 @@ -mov x0, #1 ! ~ 0x00000000 -mov x1, #2 ! ~ 0x00000004 -mov x2, #3 ! ~ 0x00000008 - ! X -mov x2, #20 ! ~ 0x0000000C -br x2 ! ~ 0x00000010 -----+ -!!!!!!!!!!!!!! X | -!!!!!!!!!!!!!! X | - ! X | -dec x0 ! ~ 0x00000014 <----+ -inc x1 ! ~ 0x00000018 -add x2, #3 ! ~ 0x0000001C -hlt ! ~ 0x00000020 +mov x0, #1 ! ~ 0x00000000 +mov x1, #2 ! ~ 0x00000004 +mov x2, #3 ! ~ 0x00000008 + ! X +some_label: ! X + mov x2, #20 ! ~ 0x0000000C + br x2 ! ~ 0x00000010 -----+ + !!!!!!!!!!!!!! X | + !!!!!!!!!!!!!! X | + ! X | + dec x0 ! ~ 0x00000014 <----+ + inc x1 ! ~ 0x00000018 + add x2, #3 ! ~ 0x0000001C + hlt ! ~ 0x00000020 |