Commit graph

204 commits

Author SHA1 Message Date
Daniel Prilik
d6c467a04c a bit of reorg 2017-12-08 17:08:29 -08:00
Daniel Prilik
145a46914a add clang build to windows
At this point in development, MSVC is not generating optimized
code for ANESE, and struggles to hit 60 fups.

Clang makes beautifully performant builds though :D
2017-12-04 09:49:35 -08:00
Daniel Prilik
4d02e57a92 work on background rendering - getting closer!
golly gee whiz what a day.

This morning, I seem to have gotten sprite rendering working.
It's not super _accurate_, but hey, it renders basic stuff okay,
so i'm happy.

Background rendering is proving to be a annoying beast to tackle,
and has been causing me quite a bit of headache. Even now, it's not
working just right, and honestly, i'm running out of energy to try
to debug it today.

I have a feeling that my PPU <-> CPU bridge isn't working super
properly, since I feel as though I _should_ be able to run simple
games using my "draw debug nametable to main screen" hack, but
it still doesn't seem to be the case...

Maybe if I implement sprite-0 hit, it'll finally work...

Anyhoo, yeah. Work's chugging along.

I just want to play supah mario bros before new years hits, is that
so much to ask?
2017-12-03 21:35:16 -08:00
Daniel Prilik
01c6acbe30 split sprite eval and sprite pixel fetch 2017-12-03 14:52:31 -08:00
Daniel Prilik
2918634125 shuffle code around for readability 2017-12-03 14:29:42 -08:00
Daniel Prilik
2f616870aa slight modification to CPU interrupt handling 2017-12-03 13:03:10 -08:00
Daniel Prilik
e1da1e65d3 work on sprite rendering
this isn't going well.

i've decided to forget accuracy for the moment, and to focus on
just getting the damn thing working with simple stuff, like the
Zelda title-screen demo, or Donkey Kong.

But fuck me man, this shit is complicated.

I'm going to bed now, and hopefully, next time I work on this,
i'll be able to get sprite rendering working properly.

hell, maybe i'll just scrap that, and instead focus on rendering
the background properly. I have a feeling that's going to be
a bit easier...

Right now, I really want to give up, and call it quits on this
project, because holy crap am I getting annoyed.
But then I remember that one day soon, everything is going to
work, and all this effort will have been worth it.

I hope that day comes soon.
2017-11-20 01:26:31 -08:00
Daniel Prilik
4a755cdbd6 nametable debug view!
holy moley donkey kong is actually rendering nametables golly gee
whiz that's amazing! I mean, nothing really works yet per-se, but
this is some really great progress!

I could try to make a OAM debug view, but I think i'll hold off on
that for now. Instead, i'll try to actually begin implementing the
core render loop.
2017-11-13 17:58:45 -08:00
Daniel Prilik
4866710da8 Set theme jekyll-theme-minimal 2017-11-12 12:58:40 -08:00
Daniel Prilik
ed2554fb65 move docs to research 2017-11-12 12:48:01 -08:00
Daniel Prilik
49f36bec2a dma rework + iNES debug + fups speedup
lmao I left a sin function in the core loop, and that was slow af.
i took it out and i'm back at 60 fups.
2017-11-05 18:59:51 -08:00
Daniel Prilik
8b78cddbbb clean up DEBUG_PPU + start nametable debug
goddam i really hope things start working once I start implementing
the PPU loop propertly.
2017-11-04 21:55:52 -07:00
Daniel Prilik
e5ee0c606a add interupt lines (for NMI)
I wasn't planning on reworking interrupts today, but one thing led
to another, and... yeah.

All I really wanted to do today was get a Palette Table debug view,
but for some reason, it isn't being populated! I had a suspicion
that maybe implementing interrupts would make something click, but
alas, interrupts are in, and no data is being written to the
palette tables :(

I'm just going to leave it be for now, and hope that as more of the
PPU comes together, it will just start working.
2017-11-04 17:52:54 -07:00
Daniel Prilik
e35d61dc93 render pattern tables in debug window
i'm still not entirely sure how the hell i'm supposed to write the
core render loop, but hey, at least I can see some tiles!

my plan right now is to slap together a couple more debug windows
for the various parts of the PPU's memory map, and get a feel for
how all the graphics are layed out in memory.
2017-11-02 22:23:02 -07:00
Daniel Prilik
fbcf280392 improve test scripts + inconsequential edits 2017-11-01 21:51:51 -07:00
Daniel Prilik
7d722d9132 fix g++ and MSVC warnings + do some cppcheck linting 2017-10-31 17:03:23 -07:00
Daniel Prilik
a9d8f56204 moved ram/rom into nes subdirectory 2017-10-30 20:13:54 -07:00
Daniel Prilik
98fe81f7ef add cmake option for NESTEST builds 2017-10-30 19:20:00 -07:00
Daniel Prilik
8d2b632ded rework DMA 2017-10-30 19:03:56 -07:00
Daniel Prilik
344bbb083e overload operator[] for Memory interface 2017-10-30 18:36:28 -07:00
Daniel Prilik
9b1446e4b2 memory map ppu registers + tweaks to logs 2017-10-29 19:32:50 -07:00
Daniel Prilik
f2a4fe55ee inconsequential changes 2017-10-29 16:41:49 -07:00
Daniel Prilik
d72fb7ffc6 ppu register outline and dma rework 2017-10-29 16:11:10 -07:00
Daniel Prilik
cdec1ad24f small ergonomic change to bitfield 2017-10-29 14:27:46 -07:00
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