refactor & fixed assembler path handling

This commit is contained in:
2025-06-21 04:05:22 +01:00
parent 42c26d4184
commit 528ceddade
17 changed files with 447 additions and 184 deletions
+67
View File
@@ -0,0 +1,67 @@
// lib:
// print.dsa
// usage:
//
// include print "<relative path>""
//
// usage for print:
// push (register containing address of string)
// push pcx
// jmp print::print
//
// usage for reset:
// push pcx
// jmp print::reset
dw display: 0x20000
dw current: 0x20000
// prints the given text to the screen.
print:
push bpr
mov spr, bpr
ldw bpr, rg0, 8
ldw current, rg1
print_loop:
ldb rg0, acc
stb acc, rg1
addi rg0, 1
addi rg1, 1
cmp acc, zero
jne print_loop
jmp end
// return
end:
stw rg1, current
mov bpr, spr
pop bpr
return
// resets the cursor position on the screen
reset:
push bpr
mov spr, bpr
ldw display, rg1
jmp end
clear:
push bpr
mov spr, bpr
// display size = 2000 bytes / 500 words
lli 500 rg0
ldw display, rg1
clear_loop:
dec rg0
stw zero, rg1
addi rg1, 4
cmp rg0, zero
jgt clear_loop
jmp end