mirror of
https://github.com/irmen/prog8.git
synced 2024-12-01 15:52:54 +00:00
40 lines
610 B
Plaintext
40 lines
610 B
Plaintext
; source code for a tinyvm program
|
|
%block b1
|
|
%vardefs
|
|
var word teller 0
|
|
var word numbertoprint 0
|
|
const byte one 1
|
|
const word thousand 1000
|
|
const byte space_chr 32
|
|
const word screenstart 1024
|
|
%end_vardefs
|
|
|
|
%instructions
|
|
back:
|
|
push teller
|
|
push one
|
|
add
|
|
dup
|
|
dup
|
|
dup
|
|
push screenstart
|
|
swap
|
|
syscall memwrite_word
|
|
pop teller
|
|
call 1 printnumber
|
|
push thousand
|
|
cmp_lt
|
|
jump_if_true back
|
|
return 0
|
|
printnumber:
|
|
syscall decimalstr_unsigned
|
|
syscall printstr
|
|
push space_chr
|
|
syscall printchr
|
|
return 0
|
|
%end_instructions
|
|
|
|
%subblocks
|
|
%end_subblocks
|
|
%end_block ;b1
|