wrote print.dsa

This commit is contained in:
2025-06-19 01:57:47 +01:00
parent 6b58a17f03
commit 11a107e56d
3 changed files with 48 additions and 46 deletions
+13 -31
View File
@@ -1,36 +1,18 @@
dw string: "this is some random string idk"
dw len: 8
include print "../resources/dsa/print.dsa"
init:
dw stack: 0x10000
ldw stack, bpr
mov bpr, spr
start:
// we use lwi in this case because
// in a generic case 'string' could be a 32 bit addr
db string: "Damn this works pretty well"
lwi string, rg1
push rg1
lwi len, rg1
push rg1
push pcx
jmp start
hlt
dw display: 0x20000
// push variables
push rg1 // string address.
push pcx // return address.
print:
pop ret // return address
pop rg0 // length
pop rg1 // string
ldw display, rg2
loop:
ldw rg1, acc
stw acc, rg2
dec rg0
iadd rg1, 4
iadd rg2, 4
cmp rg0, zero
jge loop
end:
jmp 4, ret
// call
jmp print::print
hlt