Fixed up example comments and some assembly
This commit is contained in:
@@ -41,6 +41,6 @@ loopback:
|
|||||||
push.word 24
|
push.word 24
|
||||||
push.reg.word 0
|
push.reg.word 0
|
||||||
gte.word
|
gte.word
|
||||||
;; Jump to `#`
|
;; Jump to `loopback`
|
||||||
jump.if.byte loopback
|
jump.if.byte loopback
|
||||||
halt
|
halt
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ loopback:
|
|||||||
push.word 12200160415121876738
|
push.word 12200160415121876738
|
||||||
push.reg.word 1
|
push.reg.word 1
|
||||||
gte.word
|
gte.word
|
||||||
;; Jump to `#`
|
;; Jump to `loopback`
|
||||||
jump.if.byte loopback
|
jump.if.byte loopback
|
||||||
halt
|
halt
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ main:
|
|||||||
;; reserved for library routines as it may be overwritten
|
;; reserved for library routines as it may be overwritten
|
||||||
push.reg.word 0
|
push.reg.word 0
|
||||||
mov.word 8
|
mov.word 8
|
||||||
|
|
||||||
push.reg.word 0
|
|
||||||
;; Call the routine
|
;; Call the routine
|
||||||
call print_cptr
|
call print_cptr
|
||||||
|
|
||||||
@@ -36,13 +34,12 @@ main:
|
|||||||
;;; print_cptr: Prints pointer to a buffer of characters. Pointer
|
;;; print_cptr: Prints pointer to a buffer of characters. Pointer
|
||||||
;;; should be on the stack as a word.
|
;;; should be on the stack as a word.
|
||||||
print_cptr:
|
print_cptr:
|
||||||
;; Save pointer in layout to W[0], P -> W[0]
|
|
||||||
mov.word 0
|
|
||||||
;; iterator I -> W[1]
|
;; iterator I -> W[1]
|
||||||
push.word 0
|
push.word 0
|
||||||
mov.word 1
|
mov.word 1
|
||||||
;; (W[0])[W[1]] -> P[I]
|
;; (W[0])[W[1]] -> P[I]
|
||||||
push.reg.word 0 ; <-- #
|
loopback:
|
||||||
|
push.reg.word 0
|
||||||
push.reg.word 1
|
push.reg.word 1
|
||||||
mget.stack.byte
|
mget.stack.byte
|
||||||
print.char
|
print.char
|
||||||
@@ -59,8 +56,8 @@ print_cptr:
|
|||||||
msize
|
msize
|
||||||
eq.word
|
eq.word
|
||||||
not.byte
|
not.byte
|
||||||
;; then go to #
|
;; then go to `loopback`
|
||||||
jump.if.byte *-13
|
jump.if.byte loopback
|
||||||
;; else print a newline
|
;; else print a newline
|
||||||
push.byte '\n'
|
push.byte '\n'
|
||||||
print.char
|
print.char
|
||||||
|
|||||||
Reference in New Issue
Block a user