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

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

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 М.
Emulating a CPU in C++ #20 (6502) - Add With Carry Whiteboard
27:03
маленький брат прыгает в бассейн
00:15
GL Show Russian
Рет қаралды 4,2 МЛН
FOUND MONEY 😱 #shorts
00:31
dednahype
Рет қаралды 5 МЛН
顔面水槽がブサイク過ぎるwwwww
00:58
はじめしゃちょー(hajime)
Рет қаралды 106 МЛН
Ауылға қайт! | АСАУ | 2 серия
33:16
Qarapaıym Qanal
Рет қаралды 1,1 МЛН
Emulating a CPU in C++ #32 (6502) -  Test Program Debugging
52:25
Emulating a CPU in C++ #23 (6502) - CMP Immediate
22:10
Dave Poo
Рет қаралды 3,1 М.
Emulating a CPU in C++ #25 (6502) -  Compare X & Compare Y
26:17
Emulating a CPU in C++ #21 (6502) - ADC Absolute
46:18
Dave Poo
Рет қаралды 4,3 М.
GPT-4o Deep Dive & Hidden Abilities you should know about
28:11
Emulating a CPU in C++ #24 (6502) - CMP Addressing Modes
18:02
маленький брат прыгает в бассейн
00:15
GL Show Russian
Рет қаралды 4,2 МЛН