A tiny stack-based virtual machine.
The lowest level of programming Pino is on the bytecode level. For this we have a simple assembler like language, inspired by 6502 assembly. Here's an example of computing the first 14 digits of the Fibonacci sequence.
pshb $0 ; (-- 0)
pshb $1 ; (0 -- 0 1)
loop:
ovr ; (0 1 -- 0 1 0)
ovr ; (0 1 0 -- 0 1 0 1)
add ; (0 1 0 1 -- 0 1 1)
dup ; (0 1 1 -- 0 1 1 1)
pshb 233 ; are we at 233?
cmp ;
bne loop ; nope, go back
brk ; end execution
- epic: debugger support [emulator]
- epic: support for strings [vm] [compiler]
- fix: word-width x and y coordinates
- feat: support for for data blocks and variables [compiler]
- feat: support for drawing sprites [vm] [emulator]
- refactor: proper literal handling [scanner]
- refactor: use proper allocators [compiler] [emulator]
- chore: clean up code using Karl's book as guidance [compiler] [emulator]
- feat: proper compiler errors [compiler]
- refactor: rename LIT to PSH and DRP to POP [compiler]
- fix: decimal parsing
- feat: support for drawing basic shapes [vm] [emulator]
- feat: support for comments [compiler]
- feat: support for text output [vm]
- feat: compile program file (assy) into binary (rom) [compiler]
- feat: run rom file [emulator]
Print a character to standard output.
(c --)
c = ascii code for character to print
Begin drawing procedures. Must be called before drawing. End drawing with ENDDRW.
End drawing procedures.
Draw a pixel to the screen using the specified color.
(x y color --)
x = x coordinate y = y coordinate color = color from palette
Draw a line to the screen using specified color.
(x1 y1 x2 y2 color --)
x1 = starting x coordinate y1 = starting y coordinate x2 = ending x coordinate y2 = ending y coordinate color = color from palette
Draw a character with predefined font to the screen.
(char x y color --)
char = ascii code for character being drawn x = x coordinate y = y coordinate color = color from palette
Color palette of 32 colors, in rgba format. The color codes themselves are not used, instead you use the index relative to the base address of 0xFF20.