Emulating a CPU in C++ #28 (6502) - Logical Shift Right

  Рет қаралды 2,861

Dave Poo

Dave Poo

Күн бұрын

Пікірлер: 3
@maxine_q
@maxine_q 3 жыл бұрын
Interesting that it's called Arithmetic Shift Left, but Logical Shift Right, since they're basically doing the same thing (in opposite directions).
@DavePoo
@DavePoo 3 жыл бұрын
Perhaps there are some 6502 aficionados who could answer that here?
@ObsidianJunkie
@ObsidianJunkie 3 жыл бұрын
@@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.
Emulating a CPU in C++ #29 (6502) -  Rotate Left
20:26
Dave Poo
Рет қаралды 2,8 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 122 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,5 МЛН
Emulating a CPU in C++ #32 (6502) -  Test Program Debugging
52:25
Emulating a CPU in C++ #30 (6502) -  Rotate Right
19:54
Dave Poo
Рет қаралды 3 М.
Emulating a CPU in C++ #27 (6502) -  Arithmetic Shift Left
18:57
Where is Rust being used?
11:46
Let's Get Rusty
Рет қаралды 124 М.
WHY IS THE HEAP SO SLOW?
17:53
Core Dumped
Рет қаралды 272 М.
you will never ask about pointers again after watching this video
8:03