Emulating a CPU in C++ #32 (6502) - Test Program Debugging

  Рет қаралды 10,193

Dave Poo

Dave Poo

Күн бұрын

In this video i compile and run the 6502 test program from github written by Klaus2m5 and use it to try and find and fix bugs in the 6502 implementation.
This video is quite long due to the conflicting documenation i found about how the processor status works when it is being pushed to the stack during a break/interrupt.
Links:
Source for this project: github.com/davepoo/6502Emulator
Google Test: github.com/google/googletest
6502 Information: www.obelisk.me.uk/6502/
6502 test program: github.com/Klaus2m5/6502_65C0...
Timestamps
0:00 Klaus2m5 test program
3:24 Compile test program
5:32 Load test program
9:35 Running the test program
11:00 Problem with PHP & BRK
14:50 Updating tests for PHP
21:33 Updating PHP
23:30 Fixing failing PHP test
26:20 Updating PLP test
27:55 Updating PLP
30:17 More PLP tests
32:26 Rerun test program
34:22 Updating BRK tests
35:35 Updating BRK
38:21 Updating RTI
40:45 Conflicting documentation
43:44 Rerun test program
45:08 Setting the interrupt disable flag
47:10 Rerun test program
48:39 Fixing failing BRK test
49:40 To be continued...

Пікірлер: 16
@piwex69
@piwex69 3 жыл бұрын
The usual "The most underrated channel on smart KZbin" goes here!
@orsteinnkristjansson5315
@orsteinnkristjansson5315 6 ай бұрын
Regarding the conflicting Documentation on RTI and the Break Bit, After RTI is called the Break Bit should always be 0, it should however not be cleared by the RTI command. The code that handles the interrupt should clear it before calling RTI (If its 1 when RTI is called you have an improperly handled Interrupt aka irql_not_less_or_equal)
@sawomirbiernacki474
@sawomirbiernacki474 Жыл бұрын
@DavePoo Great video! I'm currently implementing a 6502 emulator and found your video very useful in understanding how to use Klaus2m5 tests. Have you tried running the ones testing interrupts from the same repository? I'm struggling to understand how to connect interrupt signals and was wondering if you know how to run this.
@rufuscable4802
@rufuscable4802 3 жыл бұрын
I used the same test program in mine but with a slight difference in the test case: you can check the program counter in the execution loop; if you get the same PC 5 times in a row, say, you can break out of the loop. If the current PC is the "success if you got here" loop near the end, it's a pass. Otherwise, it's a fail and you've got the address to check the cause. :)
@jorenheit
@jorenheit 3 жыл бұрын
20:10 You could reinterpret_cast the address and dereference it to get the Byte :p
@twobob
@twobob 3 жыл бұрын
You defined BreakFlagBit with one too many 0's, The Perils of not aligning your binary values. Pretty sure it wouldn't actually bit shift your intended value but there again not sure what the behaviour is for that case at all tbh. Hope it helps.
@DavePoo
@DavePoo 3 жыл бұрын
BreakFlagBit = 0b000010000 It's the all new 9-bit break bit flag. Those values are all inlined by the compiler anyway and leading zeros aren't going to do anything. I imagine you can put as many leading zeros on a number as you like as long as the compiler is ok with it. I just tried putting "a lot" of leading zero's in Clang, as i got this error! "fatal error C1064: compiler limit: token overflowed internal buffer"
@twobob
@twobob 3 жыл бұрын
@@DavePoo It was a great series, wish something more incisive came to mind to comment about
@mr_gerber
@mr_gerber 2 жыл бұрын
@@DavePoo I'm not on C++, but C, so it might be different, but I'd consider going for (1
@BR-bk1wn
@BR-bk1wn Жыл бұрын
To me this test does not work I have Linux , I compiled as65 with the file and flags set memory to 0x000A and PC to 0x400 But it doesn't work in the folder I have only the bin and not the .lst file
@velho6298
@velho6298 Жыл бұрын
OR with the same will always zero it out, at 30min mark.
@razor-4eg
@razor-4eg 3 жыл бұрын
But could it run Doom?
@DavePoo
@DavePoo 3 жыл бұрын
Can't everything? Actually no, because you require some kind of video output at least to get Doom working (which even pregnancy tests have now!)
@razor-4eg
@razor-4eg 3 жыл бұрын
@@DavePoo I know, its just a meme)) Nice series btw, good job
@DavePoo
@DavePoo 3 жыл бұрын
I'm pretty sure it's "can it run Crysis" that's the meme, because as we all know, Doom runs on everything. (Also, I've just finished my playthrough of 'Doom Eternal' and it's awesome).
@twobob
@twobob 3 жыл бұрын
@@DavePoo *cough* Virtual framebuffer *ahem* who said that?
Emulating a CPU in C++ #33 (6502) -  More Debugging
20:12
Dave Poo
Рет қаралды 5 М.
I Designed My Own 16-bit CPU
15:46
AstroSam
Рет қаралды 1,8 МЛН
Парковка Пошла Не По Плану 😨
00:12
Глеб Рандалайнен
Рет қаралды 14 МЛН
Что будет с кроссовком?
00:35
Аришнев
Рет қаралды 2,4 МЛН
Não pode Comprar Tudo 5
00:29
DUDU e CAROL
Рет қаралды 82 МЛН
Choose your own adventure - Shaun Lawrence - NDC London 2024
57:30
NDC Conferences
Рет қаралды 503
GeckOS: a Unix-like 6502 operating system | VCFMW 2019
50:29
VCF Midwest
Рет қаралды 80 М.
Should you learn C++ in 2023?
8:06
Dreams of Code
Рет қаралды 50 М.
Software Testing Explained in 100 Seconds
2:16
Fireship
Рет қаралды 273 М.
Unlocking your CPU cores in Python (multiprocessing)
12:16
mCoding
Рет қаралды 286 М.
you can learn assembly FAST with this technique (arm64 breakdown)
12:37
Low Level Learning
Рет қаралды 137 М.
27c3: Reverse Engineering the MOS 6502 CPU (en)
51:57
Christiaan008
Рет қаралды 428 М.
Advanced 6502 Assembly Programming for the Apple II
33:44
Stephen Edwards
Рет қаралды 25 М.
NES Emulator Part #2: The CPU (6502 Implementation)
1:07:12
javidx9
Рет қаралды 408 М.
Парковка Пошла Не По Плану 😨
00:12
Глеб Рандалайнен
Рет қаралды 14 МЛН