Created lun. 30 oct. 2023 02:07:18 CET by whygee@f-cpu.org version lun. 13 nov. 2023 23:59:56 CET PRELIMINARY / WORK IN PROGRESS
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 0 | 0 | 0 | 0 | N | CND3 | SRI | SND | ||||||
1 | CND2 | Imm4 | |||||||||||||
1 | IMM8 |
CMPU is the unsigned complementary opcode to the signed CMPS and is directly derived from SUB, except the SND register is not written back.
CMPU subtracts the SND operand from the SRI operand and updates the flags (if not inhibited). This is useful for testing conditions before a jump to skip other instructions or to loop back and repeat code.
Multi-byte comparisons are possible with the help of the PF prefix.
Beware of the order of the operands!
If the condition is valid (or SRI is Imm8), this instruction affects the Carry, Sign and Zero flags.
This is a core operation that supports 3 types of operand for SRI:
; this code loops 42 times: set 0 R1 loop: add 1 R1 cmpu 42 R1 add -2 PC IFNZ ; TODO : multi-byte comparison