Pinky

Jamcode

Jamcode is the intermediate language that Pinky compiles to. Pinky players run jamcode.

Structure

Each line is made up of a 4 character instruction code, followed by a space, then optionally instruction data (ex.: jump line number, comment text, integer literal).

Instructions

CodeDescription
nop  do nothing
null push null onto stack
zero push zero integer onto stack
one  push one integer onto stack
lodi load integer onto stack
lods load string onto stack
lodf load procedure onto stack
+    add top two integers
-    subtract top two integers
*    multiply top two integers
/    divide top two integers
*f   multiply top two fixed-point integers
/f   divide top two fixed-point integers
not  perform bitwise not on the top integer
neg  negate top integer
<    leave true on stack if second integer is less than the top
>    leave true on stack if second integer is greater than the top
<=   leave true on stack if second integer is less than or equal to the top
>=   leave true on stack if second integer is greater than or equal to the top
==   leave true on stack if top two integers are equal
!=   leave true on stack if top two integers are not equal
jmp  jump to line
jif  jump to address if top boolean value is true
jz   jump to address
jsr  jump to subroutine
ret  return from subroutine (object may or may not be left on stack)
dup  duplicate object from top of stack
drop drop object from top of stack
seta set attribute
seti set item
setl set local variable
setg set global variable
geta get attribute
geti get item
getl get local variable
getg get global variable
new  push new object of length n
newv push new array of length n
#    comment
eval evaluate native routine then return
mark save instruction pointer to current procedure offset
step push current procedure "step" (call count) onto stack
args expand array onto stack