aboutsummaryrefslogtreecommitdiff
path: root/examples/memory-print.asm
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-04 06:40:05 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-04 06:40:14 +0000
commitdc047fd69bc9005b13d5ead8d798b13e5ae25df6 (patch)
treebf6dd8e60b88e406a41bbb61fe20672918e0fcc5 /examples/memory-print.asm
parente6effcf65434fb3ac12455a07c767d7d8fb9292c (diff)
downloadovm-dc047fd69bc9005b13d5ead8d798b13e5ae25df6.tar.gz
ovm-dc047fd69bc9005b13d5ead8d798b13e5ae25df6.tar.bz2
ovm-dc047fd69bc9005b13d5ead8d798b13e5ae25df6.zip
Fixed up example comments and some assembly
Diffstat (limited to 'examples/memory-print.asm')
-rw-r--r--examples/memory-print.asm11
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/memory-print.asm b/examples/memory-print.asm
index 9a2bb06..cebd6e7 100644
--- a/examples/memory-print.asm
+++ b/examples/memory-print.asm
@@ -22,8 +22,6 @@ main:
;; reserved for library routines as it may be overwritten
push.reg.word 0
mov.word 8
-
- push.reg.word 0
;; Call the routine
call print_cptr
@@ -36,13 +34,12 @@ main:
;;; print_cptr: Prints pointer to a buffer of characters. Pointer
;;; should be on the stack as a word.
print_cptr:
- ;; Save pointer in layout to W[0], P -> W[0]
- mov.word 0
;; iterator I -> W[1]
push.word 0
mov.word 1
;; (W[0])[W[1]] -> P[I]
- push.reg.word 0 ; <-- #
+loopback:
+ push.reg.word 0
push.reg.word 1
mget.stack.byte
print.char
@@ -59,8 +56,8 @@ print_cptr:
msize
eq.word
not.byte
- ;; then go to #
- jump.if.byte *-13
+ ;; then go to `loopback`
+ jump.if.byte loopback
;; else print a newline
push.byte '\n'
print.char