prog8/testvm.txt
Irmen de Jong 27e6749533 vm tweaks
2018-03-03 00:07:44 +01:00

35 lines
525 B
Plaintext

; source code for a tinyvm program
%block b1
%vardefs
var byte teller 0
var byte numbertoprint 0
const byte one 1
const byte thousand 1000
const byte space_chr 32
%end_vardefs
%instructions
back:
push teller
push one
add
dup
dup
pop teller
call 1 printnumber
push thousand
cmp_lt
jump_if_true back
return 0
printnumber:
syscall decimalstr_signed
syscall printstr
push space_chr
syscall printchr
return 0
%end_instructions
%subblocks
%end_subblocks
%end_block ;b1