Interesting that it's called Arithmetic Shift Left, but Logical Shift Right, since they're basically doing the same thing (in opposite directions).
@DavePoo3 жыл бұрын
Perhaps there are some 6502 aficionados who could answer that here?
@ObsidianJunkie3 жыл бұрын
@@DavePoo While they are technically doing the same thing, which is shifting a 0 into either the MSB (for a LSR) or LSB (for an ASL), a logical shift right is "logical" because it doesn't preserve the sign of the value in the register. A signed number is represented in two's compliment form, meaning it is padded with 1's up to the MSB. When you logical shift right a signed number, a 0 gets put in the MSB position and the sign is lost. That's why an Arithmetic Shift Right exists, it preserves the sign of the value. The Arithmetic Shift Left is "arithmetic" because it multiplies the value in the register by 2^N, where N is how many bit positions to the left it is shifted.