We're looking for your comments on how to best organize the wiki's content.
Opcodes
From 0x10c Wiki
Opcodes are functions that can perform the most basic tasks in Assembly language. All DCPU-16 programs are made out of many opcodes. Even basic tasks are performed by the CPU performing many opcodes.
Each line of code in DCPU-16 assembly corresponds to one instruction. An instruction is usually made up of one opcode followed by the arguments of the opcode.
Contents |
[edit] List of opcodes
[edit] Version 1.7
These are the opcodes in version 1.7 of the DCPU-16 specification:
[edit] Basic opcodes
- SET - Sets a value
- ADD - Adds values
- SUB - Subtracts values
- MUL - Multiplies unsigned values
- MLI - Multiplies signed values
- DIV - Divides unsigned values
- DVI - Divides signed values
- MOD - Finds modulo (remainder) of unsigned values
- MDI - Finds modulo (remainder) of signed values
- AND - Performs a bitwise AND operation on values
- BOR - Performs a bitwise OR operation on values
- XOR - Performs a bitwise XOR operation on values
- SHR - Performs a right bit shift on unsigned values
- ASR - Performs a right bit shift on signed values
- SHL - Performs a left bit shift on values
- IFB - Performs a bitwise AND operation and checks if nonzero. If check fails, ignores the next instruction
- IFC - Performs a bitwise AND operation and checks if zero. If check fails, ignores the next instruction
- IFE - Checks if two values are equal to each other. If check fails, ignores the next instruction
- IFN - Checks if two values are not equal to each other. If check fails, ignores the next instruction
- IFG - Checks if an unsigned value is greater than another unsigned value. If check fails, ignores the next instruction
- IFA - Checks if a signed value is greater than another signed value. If check fails, ignores the next instruction
- IFL - Checks if an unsigned value is less than another unsigned value. If check fails, ignores the next instruction
- IFU - Checks if a signed value is less than another signed value. If check fails, ignores the next instruction
- ADX - Adds the arguments to
EX - SBX - Subtracts the arguments, then adds
EX - STI - Sets a value, then increments
IandJby 1 - STD - Sets a value, then decrements
IandJby 1
[edit] Special opcodes
- JSR - Jumps to a memory address and pushes the PC register onto the stack
- INT - Software interrupt
- IAG - Fetches interrupt address
- IAS - Sets interrupt address
- RFI - Returns from interrupt routine
- IAQ - Sets or unsets interrupt queueing
- HWN - Fetches number of connected hardware devices
- HWQ - Fetches info about a hardware device
- HWI - Sends interrupt to a hardware device
[edit] Version 1.1
These are the opcodes in version 1.1 of the DCPU-16 specification:
- SET - Sets a value
- ADD - Adds values
- SUB - Subtracts values
- MUL - Multiplies values
- DIV - Divides values
- MOD - Finds modulo (remainder) of values
- SHL - Performs a left bit shift on values
- SHR - Performs a right bit shift on unsigned values
- AND - Performs a bitwise AND operation on values
- BOR - Performs a bitwise OR operation on values
- XOR - Performs a bitwise XOR operation on values
- IFE - Checks if two values are equal to each other
- IFN - Checks if two values are not equal to each other
- IFG - Checks if a value is greater than another value
- IFB - Performs a bitwise AND operation and if zero, ignores the next instruction
- JSR - Jumps to a memory address and pushes the PC register onto the stack
[edit] References
- DCPU-16 specification v1.1 (Copyright 2012 Mojang)
- DCPU-16 specification v1.7 (Copyright 2012 Mojang)
| ||||||||

