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

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

Dave Poo

Dave Poo

Күн бұрын

In this video i implement all the addressing modes for LSR "Logical Shift Right" instruction, in the 6502 emulator.
Links:
Source for this project: github.com/davepoo/6502Emulator
Google Test: github.com/google/googletest
6502 Information: www.obelisk.me.uk/6502/
Music is from the Arcade version of Toki
0:00 Logical Shift Right
0:30 Shift 1 test
1:40 LSR Accumulator implemented
3:38 Shift carry false test
5:06 Zero Page test
6:25 LSR Zero Page implemented
8:40 Other addressing modes
9:28 Closing comments

Пікірлер: 3
@M4RC90
@M4RC90 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,6 М.
Stable Diffusion in Code (AI Image Generation) - Computerphile
16:56
Computerphile
Рет қаралды 279 М.
Қайрат Нұртас & ИРИНА КАЙРАТОВНА - Түн
03:41
RAKHMONOV ENTERTAINMENT
Рет қаралды 663 М.
Что будет с кроссовком?
00:35
Аришнев
Рет қаралды 2,4 МЛН
Why are Bluescreens Blue?
16:27
Dave's Garage
Рет қаралды 860 М.
Optimising Code - Computerphile
19:43
Computerphile
Рет қаралды 136 М.
Can you solve this Oxford admissions question?
8:18
MindYourDecisions
Рет қаралды 54 М.
NES Emulator Part #2: The CPU (6502 Implementation)
1:07:12
javidx9
Рет қаралды 408 М.
WHY IS THE HEAP SO SLOW?
17:53
Core Dumped
Рет қаралды 155 М.
lvalues and rvalues in C++
14:13
The Cherno
Рет қаралды 296 М.
You don't need libraries to write a game engine in C++ | OpenGL | Devlog
2:50