Skip to content

Latest commit

 

History

History
161 lines (127 loc) · 7.41 KB

recording-insanity.org

File metadata and controls

161 lines (127 loc) · 7.41 KB

silly little project diary

Intro

This is kinda gonna be like a little day by day record of what shit I’ve done here and etc. probs gonna be pretty unhinged but idc

<2023-11-30 Thu>

Today I started the project. Began to slowly understand how the system works. not much done on the programming end except for slowly implementing some of the cpu instruction functions.

Found a couple helpful resources to help me along and a couple existing projects to help me. Things are looking.... hopeful

TLDR: So like basically so far I’ve started researching the architecture and stuff and begun implementing the CPU starting with the instructions

<2023-12-01 Fri> Day Two

Alright, new day, new me. Todays plan is getting the CPU instruction functions properly implemented and stuff.

Today I started working on the cartridge and MMU stuff while also continuing to implement the CPU. It’s kinda sad how much of my code is kinda plagiarzed but I’m definitely understanding some stuff. Like that the stupid instructions read from memory. Idk why I didn’t make that connection before but hooray.

<2023-12-06 Wed>Day Three

After a small hiatus due to my stupid job I was back at it again.

After a long day of work about more than halfish of the unprefixed CPU instructions have been written and a lot more understanding has been gained. project is looking up and hopefully most of the CPU (excluding the prefixed instructions lmao) should be completed by the next day I work on this.

Also finally started understanding some of the stupid stuff like (HL) vs HL etc

<2023-12-08 Fri>Day Four

Today I finally pretty much finished the unprefixed CPU instructions, it was kinda hard for some of it but honestly it kinda helped quite a lot as it gave me a bit more understanding for some of the stuff I’m doing etc.

The code can definitely be optimized etc and I’ve got like 50 TODO’s to check but the groundwork is looking promising. Hopefully by this time next week the CPU should be like fully finished and I should be moving onto either the memory, PPU or smth else.

<2023-12-13 Wed>Day Five

Today I started to work on some of the other parts of the emulator, that being the MMU, the cartridge and the MBC’s etc. It took quite a while to kind of understand how everything works but I kindddd of get it now

Now I just need to continue implementing the MBC’s and connecting everything together (as well as you know, actually do the prefixed instructions for the CPU)

<2023-12-14 Thu>Day Six

Today was.... a day. I spent about like 3 hours trying to google how the hell to implement the timer before going to the emudev discord where some much smarter people than me helped. So now it’s kinda implemented, needs a couple tweaks and testing but hey, it’s there.

I also managed to start implementing the interrupts properly, it’s pretty basic at the moment and still needs a bit done but it’s a start.

I also worked on some more of the prefixed instructions as that’s like one thing I should really finish. Shouldn’t take that long however as most of the sections are set up pretty similar so it’s pretty easy to copy and paste sections and just like change a word

<2024-01-17 Wed>Day Seven

It’s been..... a very long time since I did work on this, about like a month. But uni was closed over christmas and new year so couldn’t go in and I’ve had work etc etc blah blah blah whatever.

Anyway today I finished the CPU instructions and am currently in the process of “debugging” by which I mean “wondering why nothing is working and working backwards to fix it” but all seems to be going fine, I’m also just gonna make a debugger to test my stuff

<2024-01-24 Wed>Day Eight Part one

Okay so I forgot to record the last session so sorry for that, wasn’t too productive Basically the last time I was working on this I was just getting a basic debugger going and I kinda realized I just absolute fucked everything…

So now I’m scaling back the project, it’s just gonna be a regular gameboy emulator for now, not color. I will attempt color in the future but at the moment there’s too many barely documented things that are tripping me up.

<2024-01-24 Wed>Day Eight Part two

After a long day of trying to figure out shit and rewriting the MMU I figured out the problem I was having was to do with none of them, it was my own stupiditiy 😎

Basically the ROM’s have a jump function so they can you know, jump to the functions they need to run and it uses the next two immediate bytes slapped together as its jump point. My problem… I switched my stupid system to immediately increment the program counter after I loaded the opcode, but my operands were still using pc+1 and pc+2 to load the values, so I was jumping to a way larger value than I wanted, but anyway I fixed it.

So now onto testing and stuff ig

<2024-01-25 Thu>Day Nine

Today was a pretty productive day ngl, finally figured out some of thr problems (and parts where I was being dumb and making myself problems) with stuff and started testing the CPU inststructions with the blargg test roms, as of writing this I have all but 2 done. I am not at all looking forward to doing the one for the interrupts, that’s gonna suck.

But yeah, got a proper debug setup for stuff like gameboy doctor and am busy testing the CPU instructions and fixing as many problems as I can

<2024-01-31 Wed>Day Ten

I finally did it! The CPU instructions all passed!!! I am FRee!!! But like yeah I got it all working, started with test 11 not working because I fucked up my swap instruction (forgot to write the result lmao) and then the instructions thankfully worked without a lot of tinkering, well… Except for the timer, the timer was annoying and bullshit and I hate it. It was a simple fix tho, basically I was passing in m-cycles and forgot to both

  • Have my code actually increase by the cycles rather than one
  • Have my code run through a for loop to increase the timer by 4 t-cycles individually for each m-cycle

but yeah once I figured that out it was all good and working!!

Anyway now onto the PPU (pain)…


Alright so the PPU.... It’s uh, definitely a thing. It’s a really confusing mess I’m ngl so I’ve started a file to take notes of specific parts of it that should help but it’s gonna take a while to get everything working. But I’m gonna take a smarter approach this time, instead of just plunging straight into it I’m gonna take some time to plan things out and make sure I’ve got everything working before I start implementing a lot of important code.

I also moved a couple of things from the MMU into the PPU as I felt it’d be a bit easier to access and utilize them there. The things I moved was the VRAM, as I felt it suited the PPU a bit better, I also moved the OAM for the same reason and the last thing I moved was the LCD section of the IO registers as once again, much nicer to have in the PPU section

But yeah, things seem to be going smoothly 😎

Day ??? <2024-02-16 Fri>

Okay so it’s been… a while, I’ve been working on this quite constantly but progress has been slow. I moved to the PPU and it confused the shit out of me so I spent the like 2 weeks working on other parts, writing a new cool debugger (that’s slow as shit atm) and trying (and failing) to implement the PPU. And so we come to today, after heappssss of debugging and stuff I found a dudes emulator and basically copied his technique and I’ve got stuff displaying! It’s a bit munched atm but I’ll fix it later, I’m just happy I got something up. Now onto the joypad (PPu can be fixed later :3)