|
|
Subscribe / Log in / New account

Some unlikely 2021 predictions

Some unlikely 2021 predictions

Posted Jan 12, 2021 22:43 UTC (Tue) by floppus (guest, #137245)
In reply to: Some unlikely 2021 predictions by Wol
Parent article: Some unlikely 2021 predictions

But the opcode that would correspond to "SLL", despite being undocumented, does have a well-defined function: it multiplies the value by two and adds one. This is fairly well known among Z80 hackers (some people refer to this opcode as "SLIA" for "shift left inverted arithmetic", or "SL1" for "shift left and add 1".)

Sure, you can argue it'd be more parsimonious for the two opcodes to do exactly the same thing, but the undocumented function is occasionally useful to save a byte and four clock cycles.

Whether the undocumented function was intentional or not, who knows... but if it were unintentional, you'd expect that the result would be (x<<1)|(x>>7), or (x<<1)|CF, or (x<<1)|(x&1), or something even weirder, rather than (x<<1)|1.

If you simply want your assembler to emit an SLA opcode whenever you write SLL, that's an issue with the assembler, not the hardware. ;)


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds