Implemented a routine which prints out a buffer of characters and use it

All in my assembly/virtual machine!
This commit is contained in:
2023-11-02 23:29:50 +00:00
parent 6dfc4ceaeb
commit 07f64b796d

View File

@@ -11,32 +11,35 @@
mset.byte 2 mset.byte 2
push.reg.word 0 push.reg.word 0
msize mov.word 8
malloc.stack.byte push.reg.word 0
mov.word 1 call print_cptr
push.reg.word 8
mdelete
push.byte '\n'
print.char
halt
;;; print_cptr: Prints pointer to a buffer of characters. Pointer
;;; should be on the stack as a word.
print_cptr:
mov.word 0
push.word 0 push.word 0
mov.word 2 mov.word 1
push.reg.word 0 push.reg.word 0
push.reg.word 2
push.word 1
push.reg.word 0
msize
sub.word
sub.word
mget.stack.byte
mov.byte 24
push.reg.word 1 push.reg.word 1
push.reg.byte 24 mget.stack.byte
push.reg.word 2 print.char
mset.stack.byte push.reg.word 1
push.reg.word 2
push.word 1 push.word 1
plus.word plus.word
mov.word 2 mov.word 1
push.reg.word 2 push.reg.word 1
push.reg.word 0 push.reg.word 0
msize msize
eq.word eq.word
not.byte not.byte
jump.if.byte 17 jump.if.byte *-13
halt ret