diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/factorial.asm | 2 | ||||
-rw-r--r-- | examples/fib.asm | 2 | ||||
-rw-r--r-- | examples/memory-print.asm | 11 |
3 files changed, 6 insertions, 9 deletions
diff --git a/examples/factorial.asm b/examples/factorial.asm index 2d4b6f9..76e80b5 100644 --- a/examples/factorial.asm +++ b/examples/factorial.asm @@ -41,6 +41,6 @@ loopback: push.word 24 push.reg.word 0 gte.word - ;; Jump to `#` + ;; Jump to `loopback` jump.if.byte loopback halt diff --git a/examples/fib.asm b/examples/fib.asm index 85df000..03d9725 100644 --- a/examples/fib.asm +++ b/examples/fib.asm @@ -35,7 +35,7 @@ loopback: push.word 12200160415121876738 push.reg.word 1 gte.word - ;; Jump to `#` + ;; Jump to `loopback` jump.if.byte loopback halt 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 |