The - operator is used to subtract a number from the value stored in a register, or to subtract the value of one register from another.
When used with 4-bit registers, Mi can be M0 - M15 and can store numbers from 0 to 15.
There are sixteen 4-bit registers.
|
Code Example |
Meaning |
|
M2=M2-3 |
Subtract the integer number 2 from the value stored in 4-bit register M2. |
|
M2=M3-2 |
Subtract the integer number 2 from the value stored in M3 and store the result in 4-bit register M2. |
|
M2=M3-M4 |
Subtract the value stored in M4 from the value stored in M3 and store the result in 4-bit register M2.. |
When used with 8-bit registers, Xi can be X0 - X7 and can store numbers from 0 to 255.
There is a maximum of eight 8-bit registers.
|
Code Example |
Meaning |
|
X4=X4+127 |
Subtract the integer number 127 from the value stored in 8-bit register X4. |
|
X4=X5+127 |
Subtract the integer number 127 from the value stored in X5 and store the result in 8-bit register X4. |
|
X4=X5+X6 |
Subtract the value stored in X6 from the value stored in X5 and store the result in 8-bit register X4. |
Numbers can also be represented in binary or hex format.
|
Code Example |
Meaning |
|
X4=X4-01111111b |
Subtract the binary number 01111111 from the value stored in 8-bit register X4. |
|
M0=M0+0Ah |
Subtract the hex number A from the value stored in M0. |