Updated the parser to be able to handle the changes made to the ISA.

This commit is contained in:
2023-06-18 00:50:18 -05:00
parent 403439def4
commit 0eaa5527ea
5 changed files with 139 additions and 152 deletions
+9 -7
View File
@@ -1,6 +1,6 @@
.db MAX_MEM 0xFFFF
.db VIDEO_MEM 0xF37F
.db MAX_LENGTH MAX_MEM - MAX_LENGTH
;.db MAX_LENGTH MAX_MEM - MAX_LENGTH
.db MSG "Hello, World!", 0
_start:
@@ -9,7 +9,7 @@ _start:
call strlen
copy r1, MSG
cmp r2, 0
je _end
jz _end
cmp r2, MAX_LENGTH
jg _end
draw_loop:
@@ -18,7 +18,7 @@ draw_loop:
inc r8
dec r2
cmp r2, 0
je _end
jz _end
jmp draw_loop
_end:
jmp _end
@@ -28,12 +28,14 @@ _end:
; Returns: R2 - Contains the length of the string
strlen:
copy r2, 0 ; length
cmp [r1], 0
je end ;The string is zero length
copy byte r4, [r1]
cmp r3, 0
jz end ;The string is zero length
loop:
inc r1
cmp [r1], 0
je end
copy byte r3, [r1]
cmp r3, 0
jz end
inc r2
jmp loop
end:
+3 -4
View File
@@ -4,11 +4,10 @@
.db msg "Hello, world!", 0
.db NOTERM "No terminating byte here"
.db null_byte 0
jmp [r4]
;load r2, label
something_insance:
load r1, unknown_symbol
load byte r1, r3
load r1, 5
.db fun_alright 0x70;does this break?
load r3, r4
@@ -23,6 +22,6 @@ inc r1 ;increment r1
xor r1, r1 ;clear self
pop r3
jmp unknown_symbol
jmp r4
jz unknown_symbol
jmp [r4]
jz [r6]
;And a comment at the end