LEGO Mindstorms EV3 |
Parameter types and values for primitives, system calls and subroutine calls are encoded in the callers byte code stream as follows:
opADD8 (ParCode1, ParCode2, ParCodeN)
Bits 76543210 -------- 0Ttxxxxx short format |||||||| |0|||||| constant |||||||| ||0vvvvv positive value ||1vvvvv negative value ||| |1| variable | | | 0iiiii local index | 1iiiii global index | 1ttt-bbb long format ||| ||| 0|| ||| constant ||| ||| |0| ||| value |1| ||| label ||| ||| 1|| ||| variable || ||| 0| ||| local 1| ||| global | ||| 0 ||| value 1 ||| handle ||| 000 Zero terminated string (subject to change) 001 1 bytes to follow (subject to change) 010 2 bytes to follow (subject to change) 011 4 bytes to follow (subject to change) 100 Zero terminated string
For subroutine parameters additional information about no of pars, direction and size are needed and placed in front of the called code\n Parameters MUST be sorted so: largest (4 bytes) parameters is first and smallest (1 byte) is last in the list. OffsetToInstructions -> NoOfPars, ParType1, ParType2, ParTypen
Bits 76543210 -------- io---bbb long format || ||| 1x ||| parameter in x1 ||| parameter out ||| 000 8 bits 001 16 bits 010 32 bits 011 float 100 Zero terminated string (next byte tells allocated size)