Commit graph

180 commits

Author SHA1 Message Date
Daniel Prilik
0e0c3c1fd0 fixed longstanding iNES parsing bug 2017-10-29 13:47:10 -07:00
Daniel Prilik
015c2e5277 start work on PPU 2017-10-29 13:13:01 -07:00
Daniel Prilik
bcedecb3a4 move mirroring enum to Cartridge + remove <vector> dep 2017-10-29 12:10:41 -07:00
Daniel Prilik
22b9eac6c6 ppu_mmu + tons of refactoring
I kind of went down a deep rebbit hole.

As I started to implement the ppu_mmu, I realized that I needed to
finish my mapper, and when I did that, I realized that I didn't
fully understand how VRAM worked, and once I figured that out I
realized that to make my life simpler, I had to rework how some
interfaces works.

I could keep going, but you get the point.

But hey, I think the code is a lot more robust now, so that's good!
2017-10-28 21:20:45 -07:00
Daniel Prilik
f5c442cea0 add proper CPU interrupts
honestly, this is just procrastination before I start the PPU.
Golly, that's going to be difficuly, er, that is... fun! Yeah!
It's gonna be so fun! so much fun...
2017-10-28 16:03:19 -07:00
Daniel Prilik
30dc709963 add derived mem-access methods to Memory + drop I from IMemory 2017-10-27 13:17:16 -07:00
Daniel Prilik
78a213c378 proper framerate calculation 2017-10-26 21:56:34 -07:00
Daniel Prilik
27b7ada386 frame limit to 60 fups 2017-10-26 18:08:39 -07:00
Daniel Prilik
6e895dac67 better pixel rendering + proper scaling 2017-10-26 14:11:07 -07:00
Daniel Prilik
a4519a76db building on MSVC 2017-10-26 10:29:37 -07:00
Daniel Prilik
911d36f23f add SDL dependency 2017-10-25 21:17:58 -07:00
Daniel Prilik
f32acdec49 clean addressing mode decoder 2017-10-25 10:00:24 -07:00
Daniel Prilik
8b5576d0ba decouple nestest logging from CPU loop 2017-10-24 22:01:40 -07:00
Daniel Prilik
d0e8d823a8 add ppu docs, add more test roms 2017-10-21 17:33:02 -07:00
Daniel Prilik
aca9593e1a pass official opcodes in nestest 2017-10-21 17:32:39 -07:00
Daniel Prilik
9551996930 more opcodes + addr mode cleanup
I'll tell ya, figuring addressing modes is hard.
I only really understood them today, after something clicked in my head.
The whole point of addressing modes isn't to provide instructions with
the specific data value for their operation, but to provide addresses
at which instructions can read desired data from!

Basically, I was trying to 'dereference' the address in my addressing
mode decoder function, when in reality, all I needed to do was pass
the address down to instructions, and let them dereference it
themselves (on a case-by-case basis)

I'll tell you one thing, this whole project sure has been a learning
experience :)
2017-10-21 00:04:27 -07:00
Daniel Prilik
b0700cd5f9 cpu bugfixes and nestest harness 2017-10-20 14:55:21 -07:00
Daniel Prilik
40c376976c MSVC tweaks 2017-10-20 09:52:32 -07:00
Daniel Prilik
c577cd2c22 switch to lookup based cpu design
Yeah, the fancy way of handling instructions looked annoying to
deal with. Maybe i'll revisit the concept at a later date, but
for now, using a classic instruction lookup table aughta do fine.

In terms of CPU architecture, I think i'm pretty happy with how I
set things up. Sure, there are some parts of the code that i'm not
super happy about, but as a first draft, I think it's not bad. I'm
sure that after implementing more of the 6502, i'll get a better
idea of how to clean up the code.

What's left to do with the CPU?
- Implement the rest of the instructions (duh)
- Implement interruprs (aaaahhh)

And hopefully, once the CPU is passing nestest.nes, I can start
working on the rest of the NES 😄
2017-10-20 00:45:22 -07:00
Daniel Prilik
0528392bf0 switch to cmake 2017-10-18 17:03:52 -07:00
Daniel Prilik
78141f34dc Experimenting with "clever" opcode decoding
Although i've tried to keep away from peeking at the implementations
of other NES emualtors, the few glances I have seen all seem to use
a big, dumb lookup table to decode opcodes (i.e: determine the
instruction and the addressing mode)

I thought that there must be a better way, since after all, the
actual hardware does it quite compactly :)

With the help of http://www.llx.com/~nparker/a2/opcodes.html, I
explored the 6502 ISA and tried to find bit patterns that would
give me a clean, compact way to decode instructions.

Alas, the few exceptions to the rule that I am finding are proving
to be quite annoying to work around...

As such, i'm going to go to bed today, and reconsider this approach
tomorrow.
2017-10-16 23:52:24 -07:00
Daniel Prilik
838afe43f6 add 6502 research + small tweaks 2017-10-16 21:15:26 -07:00
Daniel Prilik
23688a9c10 rename and expand Memory interface 2017-10-16 20:31:55 -07:00
Daniel Prilik
a3884985ba Getting a feeling for how 6502 works
i.e: my current way of encoding opcodes is unsustainable.

I'm just trying to get a feel for how the various addressing modes
work, and how instructions tend to operate.
2017-10-15 19:47:07 -07:00
Daniel Prilik
ee52bd0238 add rough CPU structure 2017-10-15 14:58:39 -07:00
Daniel Prilik
00193f1e0e restructure project files 2017-10-15 11:51:03 -07:00
Daniel Prilik
69a3769046 shorten typedef 2017-10-15 11:07:16 -07:00
Daniel Prilik
4f95b10882 Add System Core Class + CPU Memory Map
Also, added a unified Memory interface.
It's pretty basic (just two read / write methods), but it lets me
do some pretty neat stuff with polymorphism.

Eg: I added a Debug object called Memory_Sniffer, which can wrap
any Memory* compliant object, and it will transparently log all
memory operations going across it! Pretty useful IMHO!
2017-10-14 21:01:27 -07:00
Daniel Prilik
cc2fb482ad add mapper infrastructure 2017-10-13 22:39:08 -07:00
Daniel Prilik
2238090a05 *initial commit
Setting up the project. Also, iNES parsing
2017-10-13 20:18:31 -07:00