Remix.run Logo
RetroTechie 10 months ago

Z80 has a Shift Right Arithmetic (SRA) instruction. From Zilog Z80 User Manual:

"An arithmetic shift right 1 bit position is performed on the contents of operand m. The contents of bit 0 are copied to the Carry flag and the previous contents of bit 7 remain unchanged. Bit 0 is the least-significant bit."

So if value was used as signed integer, that's a sign-preserving /2 (and easy to expand to 16 or more bits).

Z80 also has a SLA, which does shift all bits.