Lots of changes and too much dragging my feet on this. But I think this is going in the right direction now.

This commit is contained in:
2025-06-24 23:48:26 -05:00
parent ebfd7cf94c
commit b759589e84
16 changed files with 320 additions and 51 deletions
+37
View File
@@ -0,0 +1,37 @@
namespace string 67; my string namespace here
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
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
jmp loop
end: ;At the moment this just writes Msg to the framebuffer.
ret
; Clobbers r2, r3
; Params: r1 - string pointer
; Returns: r2, string length
fn strlen:
mov 0, r2 ; Set the length to zero
loop:
mov byte [r1], r3 ; mov char into r3
cmp r3, 0 ; NUL byte?
je end
inc r1 ; next char
inc r2 ; length++
jmp loop
end:
ret