Opcodes list
All opcodes are listed here, with time execution (number of cycles) and arguments details.
A argument is either :
- a label
- a constant (cst)
- a variable (var)
- a variable indexed by a constant (var[cst] - notes that myVar[0] is equivalent to myVar)
- a variable indexed by another variable (var[var])
- a variable indexed by another variable and a constant (var[var+cst])
- a value at a specified offset ([index])
Argument usage is described by these code :
roArgX : means a argument accessed read-only (cst, var, var[cst], var[var], [index])
rwArgX : means a argument accessed read/write (var, var[cst], var[var], [index])
| Opcode | Usage | Nb cycles | Description |
| push | push roArg0 | 3 | Push (put) roArg0 on the top of the stack |
| pop | pop rwArg0 | 4 | Pop (remove) value on the top of the stack and store in rwArg0 |
| mov | mov rwArg0, roArg1 | 1 | Copy value of roArg1 in rwArg0 |
| lea | lea rwArg0, roArg1 | 2 | Copy offset of roArg1 in rwArg0 |
| add | add rwArg0, roArg1 | 2 | Add roArg1 with rwArg0 and store in rwArg0 |
| sub | sub rwArg0, roArg1 | 2 | Substract roArg1 to rwArg0 and store in rwArg0 |
| neg | neg rwArg0 | 1 | Reverse (opposite sign) rwArg0 and store in rwArg0 |
| inc | inc rwArg0 | 1 | Increment rwArg0 and store in rwArg0 |
| dec | dec rwArg0 | 1 | Decrement rwArg0 and store in rwArg0 |
| xchg | xchg rwArg0, rwArg1 | 3 | Exchange rwArg0 and rwArg1 values |
| mul | mul rwArg0, rwArg1 | 8 | Multiply rwArg0 and roArg1 and store in rwArg0 |
| div | div rwArg0, rwArg1 | 16 | Divide rwArg0 by roArg1 and store in rwArg0 |
| abs | abs rwArg0 | 2 | Compute the absolute value of rwArg0 and store in rwArg0 |
| round | round rwArg0 | 4 | Round rwArg0 and store in rwArg0 |
| floor | floor rwArg0 | 4 | Compute the integer part of rwArg0 and store in rwArg0 |
| ceil | ceil rwArg0 | 4 | Compute the integer just greater than rwArg0 and store in rwArg0 |
| rand | rand rwArg0 | 3 | Store in rwArg0 a random number in range 0.0 to 1.0 |
| sqrt | sqrt rwArg0 | 20 | Compute the square root of rwArg0 and store in rwArg0 |
| sqr | sqr rwArg0 | 6 | Compute the square of rwArg0 and store in rwArg0 |
| exp | exp rwArg0 | 64 | Compute Euler's number e raised to the power of rwArg0 and store in rwArg0 |
| log | log rwArg0 | 80 | Compute the natural logarithm (base e) of rwArg0 and store in rwArg0 |
| pow | pow rwArg0, roArg1 | 64 | ompute the value of rwArg0 raised to the power of roArg1 and store in rwArg0 |
| cos | cos rwArg0 | 96 | Compute the trigonometric cosine of rwArg0 (measured in degree) and store in rwArg0 |
| sin | sin rwArg0 | 96 | Compute the trigonometric sine of rwArg0 (measured in degree) and store in rwArg0 |
| tan | tan rwArg0 | 128 | Compute the trigonometric tangent of rwArg0 (measured in degree) and store in rwArg0 |
| jmp | jmp label | 1 | Jump to specified label |
| je | je label | 1 | Jump to specified label if last cmp result was equal |
| jne | jne label | 1 | Jump to specified label if last cmp result was not equal |
| jnge | jnge label | 1 | Jump to specified label if last cmp result was not equal and not greater |
| jle | jle label | 1 | Jump to specified label if last cmp result was equal or lower |
| jl | jl label | 1 | Jump to specified label if last cmp result was lower |
| jng | jng label | 1 | Jump to specified label if last cmp result was not greater |
| jg | jg label | 1 | Jump to specified label if last cmp result was greater |
| jnle | jnle label | 1 | Jump to specified label if last cmp result was not equal and not lower |
| jnl | jnl label | 1 | Jump to specified label if last cmp result was not lower |
| call | call label | 4 | Jump to specified label and set push the current position on the stack |
| ret | ret ret roArg0 |
4 | Return to position stored on the top of the stack, and optionnaly pop roArg0 value of the stack |
| cmp | cmp roArg0, roArg1 | 4 | Compare roArg0 and roArg1, and update flags equal, lower and greater |
| drive | drive roArg0 | 40 | Update the wanted direction (degree) |
| speed | speed roArg0 | 40 | Update the wanted speed (m/s) |
| fire | fire roArg0, roArg1 | 200 | Fire a missile in roArg0 direction (degree), at range roArg1 (m) |
| scan | scan rwArg0, roArg1, roArg2 | 200 | Scan in roArg1 direction (degree), with roArg2 precision (degree), and store the result (first bot found) in rwArg0 (m) |
| open | open roArg0, roArg1 | 20 | Open the chan roArg0 for sending radio data, for bot roArg1. If roArg1 = 1 then all bot will receive the message. Reopening a chan previously opened which wasn't close will result in erasing all writed value |
| write | write roArg0, roArg1 | 4 | Write on the chan roArg0 the value roArg1 The chan must have been open before |
| close | close roArg0 | 40 | Close the chan roArg0 and send all data writed since the chan is opened to bots |
| read | read roArg0, rwArg1 | 6 | Try to read a value on the chan roArg0. If a value is read, write it to rwArg1 else rwArg1 is not changed |
