Emulating a CPU in C++ #17 (6502) - BEQ Conditional Branch

  Рет қаралды 4,256

Dave Poo

Dave Poo

Күн бұрын

In this episde i get one of the conditional branch instruction working BEQ - Branch on equal to zero.
Links:
Source for this project: github.com/davepoo/6502Emulator
Google Test: github.com/google/googletest
6502 Information: www.obelisk.me.uk/6502/
Timestamps:
0:00 Intro
3:11 BEQ unit test
9:03 First implementation
10:48 More tests
11:57 Improving implementation
12:30 Cross a page test
15:01 Fixing page cross cycles
21:08 Branch backwards test
23:50 Fixing branch backwards
26:26 No branching test
27:49 Writing a test program
30:55 Closing comments

Пікірлер: 8
@christianlett
@christianlett 3 жыл бұрын
Crossing a page boundary adds two cycles to the base 2 cycles to give a total of 4 cycles, not 5 cycles as you've written here. So it's either 2 (branch unsuccessful), 3 (branch successful), or 4 (branch successful crossing a page boundary) cycles. Apologies if you've fixed this in a later video :)
@M4RC90
@M4RC90 3 жыл бұрын
25:35 It is not defined in the standard that 'char' is always signed. This works with your compiler, it might not with another, or different settings. To make this clear it should be 'signed char' instead. Interesting fact: char, signed char and unsigned char are three distinct types.
@DavePoo
@DavePoo 3 жыл бұрын
Signed is the default if ommited
@M4RC90
@M4RC90 3 жыл бұрын
@@DavePoo not for char, everything else that's true
@starsky51
@starsky51 3 жыл бұрын
Loving the series (so far), Dave. I'm not a serious coder, but watching you chip away at the instruction set is inspirational!
@DavePoo
@DavePoo 3 жыл бұрын
Thanks. I think that was one of the ideas behind doing to this on video (which i said i wasn't going to do in the first video!) was to show that coding is just "chip away at it until it works".
@MatthewWalker0
@MatthewWalker0 3 жыл бұрын
The effects of simulating a state machine (ie. the real hardware) as a single switch statement are becoming more apparent, with all these cycle & PC problems :)
@64jcl
@64jcl 3 жыл бұрын
See you did a couple of errors setting the PC on the reset so a suggestion could be to just define a base variable in your tests and do mem[base] = .. , mem[base+1] , so it becomes easer to move this address around for each test?
Emulating a CPU in C++ #18 (6502) - Conditional Branches
14:52
Basics - 6502 Assembly Crash Course 01
12:49
NesHacker
Рет қаралды 105 М.
GADGETS VS HACKS || Random Useful Tools For your child #hacks #gadgets
00:35
Kitten has a slime in her diaper?! 🙀 #cat #kitten #cute
00:28
Monster dropped gummy bear 👻🤣 #shorts
00:45
Yoeslan
Рет қаралды 10 МЛН
27c3: Reverse Engineering the MOS 6502 CPU (en)
51:57
Christiaan008
Рет қаралды 428 М.
Why You Shouldn't Nest Your Code
8:30
CodeAesthetic
Рет қаралды 2,5 МЛН
How a CPU works and Introduction to Assembler - bin 0x04
11:52
LiveOverflow
Рет қаралды 311 М.
You don't need libraries to write a game engine in C++ | OpenGL | Devlog
2:50
you can learn assembly FAST with this technique (arm64 breakdown)
12:37
Low Level Learning
Рет қаралды 137 М.
What is a stack and how does it work? - 6502 part 5
24:25
Ben Eater
Рет қаралды 727 М.
“Hello, world” from scratch on a 6502 - Part 1
27:25
Ben Eater
Рет қаралды 4,6 МЛН
GADGETS VS HACKS || Random Useful Tools For your child #hacks #gadgets
00:35