-Operation Codes
-Register Specifiers
-Immediate Operands
-Addressing Modes
-Condition Codes
-Examples
Operation Codes
Below is the complete listing of the WIMP assembly language operation codes."Condition Codes" specifies the operation's effect on the 4 condition codes.
[Register]: You must use the register specifiers.
[Data]: You must specify an operand either by immediate operand or any of the 3 addressing modes.
[Address]: You must use one of the 3 addressing modes.
[Data]: You must specify an operand either by immediate operand or any of the 3 addressing modes.
[Address]: You must use one of the 3 addressing modes.
Op. | Explanation | Syntax | Condition Codes |
LOA | Load data in memory to register | LOA [Register] [Data] | Z,N: Depends |
STO | Store data in register to memory | STO [Register] [Address] | Z,N: Depends |
ADD | Add data to register | ADD [Register] [Data] | All: Depends |
ADC | Add data+carry bit to register | ADC [Register] [Data] | All: Depends |
SUB | Subtract data from register | SUB [Register] [Data] | All: Depends |
SBC | Subtract (data+carry bit) from register | SBC [Register] [Data] | All: Depends |
AND | AND data with register | AND [Register] [Data] | Z,N: Depends C,V:0 |
ORR | OR data with register | ORR [Register] [Data] | Z,N: Depends C,V:0 |
NEQ | XOR data with register | XOR [Register] [Data] | Z,N: Depends C,V:0 |
CMP | Compare register with data (return 0 if equal) | CMP [Register] [Data] | All: Depends |
MOV | Move data from register 1 to register 2 | MOV [Register1] [Register2] | Z,N: Depends |
CLR | Clear register | CLR [Register] | Z:1 N,C,V:0 |
INC | Increment register | INC [Register] | All: Depends |
DEC | Decrement register | DEC [Register] | All: Depends |
ROR | Rotate register right 1 bit via carry | ROR [Register] | All: Depends |
ROL | Rotate register left 1 bit via carry | ROL [Register] | All: Depends |
ASR | Arithmetic shift right 1 bit | ASR [Register] | All: Depends |
ASL | Arithmetic shift left 1 bit | ASL [Register] | All: Depends |
COM | Complement register | COM [Register] | All: Depends |
NEG | NOT register | NEG [Register] | Z,N: Depends C,V:0 |
PSH | Push register onto stack | PSH [Register] | Z,N,C: Depends |
POP | Pop top of stack to register | POP [Register] | Z,N: Depends |
JSR | Jump to subprogram, stack return address You will lose the value of the accumulator in doing this | JSR [Address] | - |
RTS | Return from subprogram (unstack return add.) | RTS | - |
BRN | Unconditional branch to address | BRN [Address] | - |
BZE | Branch if non-zero (Z=0) | BZE [Address] | - |
BNE | Branch if zero (Z=1) | BNE [Address] | - |
BGE | Branch if >= 0 (Z=1 or N=0) | BGE [Address] | - |
BGT | Branch if >0 (Z=0 and N=0) | BGT [Address] | - |
BLE | Branch if <=0 (Z=1 or N=1) | BLE [Address] | - |
BLT | Branch if <0 (N=1 and Z=0) | BLT [Address] | - |
BCC | Branch if carry clear (C=0) | BCC [Address] | - |
BCS | Branch if carry set (C=1) | BCS [Address] | - |
BVC | Branch if overflow clear (V=0) | BVC [Address] | - |
BVS | Branch if overflow set (V=1) | BVS [Address] | - |
OUT | Output register | OUT [Register] | - |
STC | Set carry bit | STC | C:1 |
CLC | Clear carry bit | CLC | C:0 |
EXT | Terminate | EXT | - |
Register Specifiers
Registers can be specified inside the code using register specifiers:
A Accumulator
X Index Register
S Stack Pointer
R1~R4 General Purpose Registers (1~4)
X Index Register
S Stack Pointer
R1~R4 General Purpose Registers (1~4)
Immediate Operands
Immediate operands can be expressed in-code using automatic data converters:
An integer can be expressed as a signed decimal number.
A character can be written inside the symbols //.
See the examples for more detail.A character can be written inside the symbols //.
Addressing Modes
There are 3 types of addressing modes. All addresses take the syntax "[Addressing Mode Specifer] [Address]".
N: Absolute Addressing- This means that the address after the "N" is where the operand required is stored.
I: Indirect Addressing- This means that the location of the address after the "I" contains an address which points to the required operand.
D: Indexed Addressing- This means that the required operand is stored in an address which is the sum of the specified address and the value of the Index Register.
See the examples for more detail.I: Indirect Addressing- This means that the location of the address after the "I" contains an address which points to the required operand.
D: Indexed Addressing- This means that the required operand is stored in an address which is the sum of the specified address and the value of the Index Register.
Condition Codes
There are 4 condition codes:
V: Set to 1 if current operation results in overflow
Z: Set to 1 if current operation results in 0
C: Set to 1 if current operation has a carry out
N: Set to 1 if current operation result in negative value
Z: Set to 1 if current operation results in 0
C: Set to 1 if current operation has a carry out
N: Set to 1 if current operation result in negative value
Examples
LOA A N 150Load the value in location 150 into Accumulator.
ADD A I 160
Add the value in the memory pointed to by the address in location 160 to the value in the Accumulator.
INC X
Increment the value of the Index Register
MOV R1 A
Move the value in the register R1 to the Accumulator.
BRN N 160
Branch to location 160.