prog8/il65/examples/stackvmtest.txt

38 lines
849 B
Plaintext
Raw Normal View History

2018-09-03 13:36:19 +00:00
; source code for a stackvm program
; init memory bytes/words/strings
%memory
0400 01 02 03 04 05 06 07 08 09 22 33 44 55 66
0500 1111 2222 3333 4444
1000 "Hello world!\n"
%end_memory
; init global var table with bytes/words/floats/strings
%variables
main.var1 str "This is main.var1"
main.var2 byte aa
main.var3 word ea44
main.var4 float 3.1415927
2018-09-10 20:39:15 +00:00
main.textcolor byte 0
2018-09-03 13:36:19 +00:00
input.prompt str "Enter a number: "
input.result word 0
%end_variables
; instructions and labels
%instructions
nop
2018-09-10 20:39:15 +00:00
syscall WRITE_MEMSTR w:1000
2018-09-03 13:36:19 +00:00
loop:
2018-09-11 22:51:48 +00:00
inc_var main.textcolor
2018-09-10 20:39:15 +00:00
syscall RANDOM
syscall RANDOM
2018-09-11 22:51:48 +00:00
push_var main.textcolor
2018-09-10 20:39:15 +00:00
syscall GFX_PIXEL
; syscall WRITE_VAR "input.prompt"
; syscall INPUT_VAR "input.result"
; syscall WRITE_VAR "input.result"
; push b:8d
; syscall WRITE_CHAR
2018-09-03 13:36:19 +00:00
jump loop
%end_instructions