Massive refactoring to simplify this whole setup. The Token List will be modified in place and reused in the Parser to normalize the list and generate a symbols table. Normalizing the token list will make sure the syntax is valid and the symbols table will have the relative offsets and length of symbol values. At least this is all the plan but one step at a time.

This commit is contained in:
2023-03-06 21:51:36 -06:00
parent 1b246e90bc
commit 5e9e1bdec4
7 changed files with 201 additions and 232 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
.include "/another_test.asm"
.include "./another_test.asm"
.db video_start 0xF37F
.db msg "Hello, world!", 0
@@ -13,12 +13,13 @@ load r1, msg ; Because the lod* instructions can't load an address
;Out: Length in R2
string_length:
loadb r3, [r1] ; Load the byte from the address in R1, into R3
load byte r3, [r1] ; Load the byte from the address in R1, into R3
load r2, 0 ; String length
cmp r3, null_byte ; Is R3 a null byte?
je end
inc r2
start:
inc r1
start:
inc r1 ; next char
loadb r3, [r1] ; Load the next character byte into R3