C-Sheep
 
Crossbow VM Binary File Format Instructions

Home
About C-Sheep
About "The Meadow"
Gallery
Documentation
Publications
Downloads
The crossbow virtual machine is a stack machine. Binary operations on the two topmost elements on the stack will remove them from the stack and place the result of the operation on top of the stack. Unary operations on the topmost element of the stack will replace it with the result of the operation. The following are the most frequently used instructions in any crossbow virtual machine program. The numerical order of instructions might sometimes appear illogical. This is due to the fact that this is a growing system which is still very much in development. In later versions the instruction codes may change. Also this instruction list may be incomplete.

Instruction Opcode Displacement
Level
Displacement
Address
DataEffect
start0xA0---mark the program entry point from which execution begins
load constant0xA1--constant
value
load a constant value onto the top of the stack (push)
load data0xA2**-load a variable from given displacement level and displacement address onto the top of the stack (push)
store data0xA3**-store the top of the stack in a variable at given displacement level and displacement address (pop)
call intrinsic function0xA4-function
code
- / 1.0call/execute the intrinsic function with the given function code
some instructions might need the instruction data value to be set to 1.0
call user function0xA5** parameters call/execute the user-defined function at given displacement level and displacement address with the given number of parameters (which must already have been pushed onto the stack)
unconditional jump0xA6-absolute
address
-jump to the given address
jump if false0xA7-absolute
address
-jump to the given address if the topmost value of the stack is "false"
increment stack address0xA8-elements-increment the current top of the stack by the number of given elements
stop0xA9---stop/end program run/execution
return0xAA-return
value
parametersreturns the program flow from its current function, marking if a return value is located on the stack (true/false) and the number of the function's parameters
no operation0xAB--- 
reset0xAC---resets the programm to its initial state (for restart)
clear top of stack0xAD---remove the topmost value from the stack (pop) - equivalent to decrementing the stack address by 1
decrement stack address0xAE-elements-decrement the current top of the stack by the number of given elements
hold process0xAF---pause program execution (only useful for debugging)
arithmetical negation0xB0---multiplies the topmost value of the stack with -1
raise to power0xB1---raises the second value on the stack to the power of the topmost value
division0xB2---divides the second value on the stack by the topmost value
multiplication0xB3---multiplies the two topmost values on the stack
modulo0xB4---calculates the rest of the division of the second value on the stack by the topmost value
addition0xB5---adds the two topmost values on the stack
subtraction0xB6---subtracts the topmost value on the stack from the second value on the stack
increment by 10xA7---increment the topmost value on the stack by 1
decrement by 10xB8---decrement the topmost value on the stack by 1
compare if equal0xB9---evaluates if the two topmost values on the stack are identical (true/false)
compare if not equal0xBA---evaluates if the two topmost values on the stack are not identical (true/false)
compare if less than0xBB---evaluates if the second value on the stack is less than the topmost value (true/false)
compare if less
than or equal
0xBC---evaluates if the second value on the stack is less than or equal to the topmost value (true/false)
compare if greater than0xBD---evaluates if the second value on the stack is greater than the topmost value (true/false)
compare if greater
than or equal
0xBE---evaluates if the second value on the stack is greater than or equal to the topmost value (true/false)
logical exclusive or0xBF---does a logical exclusive or comparison of the two topmost values on the stack
logical inclusive or0xC0---does a logical inclusive or comparison of the two topmost values on the stack
logical and0xC1---does a logical and evaluation of the two topmost values on the stack
logical negation0xC2---logically inverts the topmost value on the stack
exit0xC3---retrieves the exit status of the program from the top of the stack (should be followed by "stop")
create block
activation record
0xC4---creates a block activation record for non-function blocks

 
www.OpenGl.org

www.lua.org

www.libsdl.org

  http://developer.nvidia.com/object/cg_toolkit.html

developed at the NCCA



© 2006,2007 by Eike Anderson, Steffen Engel & Leigh McLoughlin, NCCA, Bournemouth University