SAGA/Bytecode Instruction Table
Jump to navigation
Jump to search
Opcode | Instruction | Format | Description |
01 | ALGN | - | Align to next offset unit |
02 | PSHN | - | Push stack (no value) |
03 | POPN | - | Pop stack and discard result |
04 | PSHF | - | Push 0 onto stack |
05 | PSHT | - | Push 1 onto stack |
06 | PUSH | [ w ] | Push immediate onto stack |
08 | PSHD | [ w ] | Push dialogue string index onto stack |
0B | TSTF | [b][ w ] | Test Flag |
0C | GETW | [b][ w ] | Get Word |
0F | MODF | [b][ w ] | Set / Clear Flag |
10 | PUTW | [b][ w ] | Put Word |
13 | MDFP | [b][ w ] | Set / Clear Flag, Pop |
14 | PTWP | [b][ w ] | Put Word, Pop |
17 | GOSB | [b][b][ w ] | Call Subroutine |
18 | CALL | [b][ w ] | Call function |
19 | CALL | [b][ w ] | Call function |
1A | ENTR | [ w ] | Entrypoint |
1B | ? | - | |
1C | EXIT | - | Exit script processing |
1D | JMP | [ w ] | Unconditional jump |
1E | JNZP | [ w ] | Jump if Not Zero, Pop |
1F | JZP | [ w ] | Jump if Zero, Pop |
20 | JNZ | [ w ] | Jump if Not Zero |
21 | JZ | [ w ] | Jump if Zero |
22 | SWCH | [ w ]([ w ][ w ])*n [ w ] | Switch |
24 | RJMP | [ w ][ w ]([ w ][ w ])*n | Random branch |
25 | NEG | - | Negate |
26 | TSTZ | - | Test for zero |
27 | NOT | - | Binary NOT |
28 | ? | [b][ w ] | |
29 | ? | [b][ w ] | |
2A | ? | [b][ w ] | |
2B | ? | [b][ w ] | |
2C | ADD | - | Add |
2D | SUB | - | Subtract |
2E | MULT | - | Multiply |
2F | DIV | - | Divide |
30 | MOD | - | Modulus |
33 | EQU | - | Test Equality |
34 | NEQU | - | Test Inequality |
35 | GRT | - | Test Greater-than |
36 | LST | - | Test Less-than |
37 | GRTE | - | Test Greater-than or Equal |
38 | LSTE | - | Test Less-than or Equal |
3F | SHR | - | Arithmetic Bitshift Right |
40 | SHL | - | Arithmetic Bitshift Left |
41 | AND | - | Binary AND |
42 | OR | - | Binary OR |
43 | XOR | - | Binary XOR |
44 | LAND | - | Logical AND |
45 | LOR | - | Logical OR |
46 | LXOR | - | Logical XOR |
53 | DLGP | [b][ w ][b][ w ] | Play character dialogue |
54 | DLGS | - | Setup dialogue tree |
55 | DLGX | - | Run dialogue tree |
56 | DLGO | [b][b]([ w ]) | Add dialogue tree option |
57 | JMPS | [ w ][ w ][b] | Short jump |