Updated the parser to be able to correctly sync via a longjmp. Fixed a few bugs in the tokenizer, like not allowing underscores in symbol / label names and taught it how to detect a label declaration. Fixed the code that gets the register name.

This commit is contained in:
2025-06-26 23:24:03 -05:00
parent 3a5788f4ab
commit 428556a7a1
9 changed files with 141 additions and 63 deletions
+12 -12
View File
@@ -1,22 +1,22 @@
namespace string 67; my string namespace here
namespace text "some string in the middle of nowhere"
namespace text "some string in the middle of nowhere";do you do this?
word FRAMEBUFFER 0x00200500
asciiz Msg "Hello World!"
; fn effectively is an "Append to Namespace" command, ie string + "." + _start
fn _start:
mov FRAMEBUFFER, r32 ; imm, r
fn _start:;do you do this?
mov FRAMEBUFFER, r32; imm, r
mov msg, r1 ; imm, r
call strlen ; result into r2
mov 0, r4 ; counter
loop:
mov byte [r1], r3 ; read char into r3
cmp r3, 0 ; NUL byte?
je end
mov byte r3, [r32] ; Write char to frame buffer
inc r32 ; Next space in framebuffer
inc r4 ; inc counter
inc r1 ; inc pointer to msg
cmp r3, 0; NUL byte?
jz end
mov byte r3, [r32]; Write char to frame buffer
add 1, r32 ; Next space in framebuffer
add 1, r4 ; inc counter
add 1, r1 ; inc pointer to msg
jmp loop
end: ;At the moment this just writes Msg to the framebuffer.
ret
@@ -29,9 +29,9 @@ fn strlen:
loop:
mov byte [r1], r3 ; mov char into r3
cmp r3, 0 ; NUL byte?
je end
inc r1 ; next char
inc r2 ; length++
jz end
add 1, r1 ; next char
add 1, r2 ; length++
jmp loop
end:
ret