I started looking into how to make the APU, and boy, let me tell
ya, it's going to be a massive undertaking.
Undoubtedly a fun undertaking, but still...
Since it's a personal goal to get Super Mario Bros 2 running
before new years (after all, that game has won
game-of-the-year i don't even know _how_ many years in a row),
i've decided to just use Blargg's venerable `nes_snd_emu` library
for now.
It took some wrestling, it it's in, and it works!
Almost.
I still don't know why enabling the Frame IRQ kills most games, but
i'll look into that!
Welp, on to bigger and better things!
Namely: MMC1, which will give me Zelda and... Super Mario Bros 2!
HOLY SHIT THE DAY THAT I'VE BEEN WORKING TOWARDS FINALLY CAME!
SUPAH.
MAHRIO.
BROS.
1.
WORKS!
Now, mind you, it's not flawless.
There are some issues I still need to work out, but nevertheless,
IT BLOODY RUNS!
I have a suspicion that it's relying on more accurate timings,
since right now, movement is pretty jank, and the time is ticking
far too quickly...
I'll look into the Frame IRQ now, hopefully that will be the last
piece of the puzzle :)
...
I'M SO HAPPY!
...
PS: I'm writing this from a plane as I fly home from vancouver.
It's pretty rad that I got this working on a plane :D
It happened! IT FINALLY HAPPENED!
I reimplemented how background pixels are rendered, and by golly,
IT SEEMS TO WORK! And you know what that means... DONKEY KONG
FUCKING WORKS. YES!
This is a _huge_ win for me, and i'm super stoked.
Up next, i'm going to look into redoing sprite rendering properly,
and getting the sprite-0 hit working. Hopefully, that will get SMB1
booting (unless it also needs the Frame IRQ implemented...)
WOOT!
golly, aren't I a idiot.
I forgot to add an if statement that prevented nametable fetches
from occuring during vblank, thereby causing the ppu to keep
updating the v register even during vblank (i.e: while the CPU was
doing writes too)
now, the last critical bug is actually just nailing the background
rendering, since once that's in place, all that'll be left to do is
add proper Sprite 0 detection, and a rudimentary APU Frame IRQ, and
BAM, most games should "just work" TM
hurrah! looks like this project will play Super Mario Bros before
the new year after all!
added some 3rd party libs today! man, cmake is pretty complicated,
so it took a while to figure out, but hey, it seems to be working,
so that's good!
I added two libraries:
- `tinyfiledialogs` to handle opening a file-select window (that
varies per platform) in the case that no rom is specified on the
commandline.
- `args` handles parsing and validation of commandline arguments.
As I start to add more and more flags, it's probably a good idea
to set up a more extensible framework to configure ANESE
Oh, and FYI, this is all me procrastinating working on the PPU.
weeeeeeee!! isn't emulation fun?!
goddamit. i misread the spec.
i didn't set the vbl flag if i didn't generate a vbl.
goddamit.
this fixes quite a few issues.
afaik, the major issue with ANESE right now is that the NMI is not
set properly. hopefully, i can hammer out the proper timing soon.
yeah, i'm a bit of a dummy. I was building ANESE in _Debug_ config
with MSVC, and wondering why it was so bloody slow. Well, no shit
it's slow, it's not even being optimized!
I've set all the flags properly now, and have killed the windows
clang portion of the cmake script. Clang is a massive pain in the
ass to set up on windows with visual studio, so finally getting
MSVC to run ANESE properly is awesome.
let's start with the good:
- well, graphics are a *bit* less janky now, since I fixed the bgr
fetch timings a bit. so that's nice.
- I found out that I forgot to emulate a instruction (CLI). (darn
NESTEST didn't ever test that one!)
and, well, that's it. shit's still fucked yo.
as a hail mary, i'm going to look into emulating some basic APU
stuff, hoping that it will magically make the timings align.
also, i'm starting to get a sneaking suspicion that my fancy
operator overloading and template magic shenanigans are breaking
things in very subtle ways. that fucking terrifies me. it's going
to be a massive shitshow to debug if that is the case.
anyhoo, that's where i'm at right now. time to get some dinner :)
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
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?
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.
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.
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.
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.