Created lun. 30 oct. 2023 18:36:10 CET by whygee@f-cpu.org PRELIMINARY / WORK IN PROGRESS
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | × | SRI | SND | ||||
1 | Imm4 |
SA is one of the 4 optional opcodes using the dedicated "shuffler unit" that performs shifts and rotations. See also SH, RO and RC for the other variations.
SA gets a byte from the SND register, arithmetic-shifts it (preserves the sign bit like a signed division, depending on the value of the SRI operand) and writes it back to SND.
The shift amount from SRI is either a Imm4 or a register, the value is truncated to 4 bits and gives a 1s-complement signed integer. The sign (bit 3) determines the direction of the shift:
This instruction affects the Sign and Zero flags, but not the Carry flag.
This is an optional operation in the "extended opcode" range, which supports only 2 types of operand for SRI, without condition:
SA 3 R1 ; R1 = R1 << 3 SA -3 R1 ; R1 = R1 >>> 3 SA R2 R1 ; R1 arithmetic-shifted depending on the 4 LSB of R2 ; TODO : more numerical examples