RosettaCodeData/Task/Count-in-octal/Whitespace/count-in-octal-2.ws
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

33 lines
429 B
Text

push 0
; Increment indefinitely.
0:
push -1 ; Sentinel value so the printer knows when to stop.
copy 1
call 1
push 10
ochr
push 1
add
jump 0
; Get the octal digits on the stack in reverse order.
1:
dup
push 8
mod
swap
push 8
div
push 0
copy 1
sub
jn 1
pop
; Print them.
2:
dup
jn 3 ; Stop at the sentinel.
onum
jump 2
3:
pop
ret