Simple graphics language

From ScienceZero
Revision as of 16:17, 14 April 2011 by Bjoern (Talk | contribs)

Jump to: navigation, search

A simple graphics language for microcontrollers

We start with a very simple reverse polish notation interpreter with a preprocessor stage

Sample code:

360 for 1 forward 1 right next

Registers:

0 X
1 Y
2 Angle
3 Scale
4 Colour
5 Pen up/down
6
7

Commands:

Absolute commands
  setpixel      ( x y colour -- )
  readpixel     ( x y -- colour )
  colour        (colour -- )
  goto          (x y -- )
Relative commands:
  penup         ( -- )
  pendown       ( -- )
  forward       ( length -- )
  backward      ( length -- )
  left          ( angle -- )
  right         ( angle -- )
Loops:
 for
 next

Conditionals:

 if
 else
 endif