Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; PROJECT : TinySBRunTime
- ; AUTHOR : Microsoft
- ; CREATED : 5/16/2016
- ; EDITED : 9/5/2016
- ; ---------------------------------------------------------------------
- SETFPS 60
- dim tlist$(16)
- tlist$(1)="IF"
- tlist$(2)="AND"
- tlist$(3)="FOR"
- tlist$(4)="ENDIF"
- tlist$(5)="DIM"
- tlist$(6)="GOTO"
- tlist$(7)="GOSUB"
- tlist$(8)="DO"
- tlist$(9)="WHILE"
- tlist$(10)="INPUT"
- tlist$(11)="add"
- tlist$(12)="sub"
- tlist$(13)="mult"
- tlist$(14)="div"
- tlist$(15)=" "
- tlist$(16)="="
- dim tokenslist_$(100)
- tokenamount=1
- input$ = "IF 14/2+1-1==7 Then Print hi"
- copyinput$ = input$
- dim ttlist$(5)
- ttlist$(1)="Then"
- ttlist$(2)="IF"
- ttlist$(3)="Print"
- ttlist$(4)="=="
- ttlist$(5)=" "
- dim tokens$(20)
- tokens$()=buildtokenlistfromstring(input$, ttlist$())
- state, comparison = evaluate_expression(tokenslist_$() )
- if state=false then st$="false"
- if state=true then st$="true"
- print "result of " +copyinput$ + " is " + st$
- print comparison
- sync
- waitkey
- waitnokey
- //A Tiny SB TestLoop
- for tx=0 to 127
- for ty=0 to 127
- BGPUT(2, tx, ty, tiles(tx+ty) )
- if mod(tx, 8)=<12 and mod(ty, 2)=0 then BGPUT(3, tx, ty, tiles(tx+ty*2) )
- next ty
- next tx
- Bg3ofX=0
- Bg3ofY=0
- Bg2ofX=0
- Bg2ofY=0
- BGSHOW(3)
- BGSHOW(4)
- main:
- inc Bg3OfY
- inc Bg2OfX
- BGOFS(2, bg2Ofx, 1)
- BGOFS(3, 1, Bg3ofY)
- locate(5, 5)
- color_#("#TRED", "#TGREEN");
- print_string("Hi this is a test");
- color_#("#TYELLOW", "#TTEAL");
- locate(5, 6)
- print_string("Another color test!! WOOO!!")
- locate(5, 7)
- color_#("#TGREEN", "#TMAROON")
- print_string("And just to be cool")
- locate(5, 8)
- color_#("#TNAVY", "#TGRAY")
- print_string("Cool right")
- print "Global Text Background is " +str$(global_textbackground) + "And Global Text Foreground is " +str$(global_textforeground);
- frame_render()
- put("@loop")
- //This might happen after label parsing..
- //put a color command in the stack
- put("COLOR #TRED, #TGREEN");
- //put a locate in the stack
- put("locate 20,7")
- //put a print in the stack
- put("Print hello")
- put("COLOR #TTEAL, #TYELLOW")
- put("locate 20, 9")
- put("Print this is A+ PLUSSER YEAHHH HOOO ")
- //here we're going to try parsing the first loop
- put("goto @loop")
- //Call the Psub to create the label indexes
- find_labels()
- sync
- cls rgb(0,0,0)
- goto main
- do
- if pc>program_stack_size
- locate(9,25)
- print_string( "END OF PROGRAM at " +str$(pc) )
- frame_render() //render the frame including bg/sprite etc
- sync
- waitkey
- waitnokey
- end
- Endif
- frame_render() //render the frame including bg/sprite etc
- parse_command(pc)
- step_() //step the program stack
- sync
- cls rgb(0,0,0)
- loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement