Adds both registers without Carry and stores the value in rA. If the result is 0x0000 then the Z flag is set otherwise reseted. If there was a Carry from the MSB of the result the C flag is set, otherwise cleared.
ADC rA, rB
rA rA + rB + C
0b00000001
C,Z
4
Adds both registers with Carry and stores the value in rA. If the result is 0x0000 then the Z flag is set, otherwise cleared. If there was a Carry from the MSB of the result the C flag is set, otherwise cleared.
SUB rA, rB
Ra rA - rB
0b00000010
C,Z
4
Subtracts rB from rA and stores the result in rA. If the result is 0x0000 then the Z flag is set, otherwise cleared. If the absolute value of rA was smaller than the absolute value of rB then the C flag is set, otherwise cleared.
SBC rA, rB
Ra rA - rB - C
0b00000011
C,Z
4
Subtracts rB plus Carry from rA and stores the result in rA. If the result is 0x0000 then the Z flag is set, otherwise cleared. If the absolute value of rA was smaller than the absolute value of rB plus Carry then the C flag is set, otherwise cleared.
AND rA, rB
rA rA rB
0b00000100
Z
4
Logical AND between rA and rB and the result is stored in rA. If the result is 0x00 then the Z flag is set.
OR rA, rB
rA rA rB
0b00000101
Z
4
Logical OR between rA and rB and the result is stored in rA. If the result is 0x0000 then the Z flag is set.
XOR rA, rB
rA rA rB
0b00000110
Z
4
Exclusive OR between rA and rB and the result is stored in rA. If the result is 0x0000 then the Z flag is set.
NEG rA
rA 0x0000 - rA
0b00000111
Z,C
3
Two's Complement of rA is stored in rA. If the result is 0x0000 then the Z flag is set. The C flag is always set except the result is 0x0000, then the C flag is cleared.
INC rA
rA rA + 1
0b00001000
Z
3
Increments rA and stores the result in rA. If the result is 0x0000 then the Z flag is set. The C flag is never set by this operations, therefore this operation can be used in loops.
DEC rA
rA rA - 1
0b00001001
Z
3
Decrements rA and stores the result in rA. If the result is 0x0000 then the Z flag is set. The C flag is never set by this operations, therefore this operation can be used in loops.
CLR rA
rA rA rA
0b00001010
Z
3
Clears register rA and Z flag is set.
SET rA
rA 0xFFFF
0b00001011
Z
3
Sets register rA to 0xFFFF and clears the Zero flag.
Load high Byte of Immediate into rA. The low Byte of rA is unchanged.
LDIL rA, Immediate Low
rA Immediate Low
0b1001
None
1
Load low Byte of Immediate into rA. The LDIL instruction performs sign extention. This means that the Bit 8 of Immediate is transfered into Bit 16 to 9 of Regiser A. So it is possible to load a signed value -127 with only one instruction.
When we want to laod for example the unsigned value 0xFF, we have to perform the LDIH with 0x00 to override the leaden Fs caused by the sign extention.
LD rA, rB
rA (rB)
0b00010100
None
4
Load
ST rA, rB
(rA) rB
0b00010101
None
4
Store
IN rA, PIN_NR(rB)
rA PIN_NR(rB)
0b00010110
None
4
In from I/O location, whereas the pinnumber is saved in rB.
OUT rA, PIN_NR(rB)
PIN_NR(rB) rA
0b00010111
None
4
Out from I/O location, whereas the pinnumber is saved in rB.
POP rA
SP SP + 1, rA Stack
0b00011000
None
3
Pop register from Stack; The Stack Pointer is pre-incremented by 1 before POP.
PUSH rA
Stack rA, SP SP - 1,
0b00011001
None
3
Push register on stack; The Stack Pointer is post-decremented by one after PUSH.
SPL rA
SP rA
0b00011010
None
3
Stack pointer load. The value for the Stack pointer is saved in Register A