After the last devlog, I did some cleaning up with the graphics, which included fixing the last scanline not being rendered, and also adding a screen before the ROM is loaded, telling the user which key to press to load the ROM.
I also set up some functions to allow easier access to the I/O registers related to the PPU, such as the x and y scroll and the control flags.
Afterwards, I felt a bit burnt out of the PPU, so I went back to finish off most of the CPU.
This started with implementing the CFL, CPL, CF, CPL, SCF, SLA, SRA, RL, RLA, RLC, RRC, RLCA, and RRCA instructions, most of which are bit rotations, so once I had a few implemented, it got easier to add the rest. This allowed me to pass CPU test ROM 9.
Then, I implemented the rest of the CB prefix instructions, which were all bit related; BIT, RES and SET, which allowed me to pass ROM 10
After those, I implemented some stack pointer related instructions; ADD SP,d and LD HL SP+d, which then allowed me to pass ROM 3
Finally, I added DAA. This one is a bit more unique, as it is designed to convert the result of an add or subtract with binary coded decimal numbers, into a binary coded decimal number. This gets a bit complicated, but I used these resources (Demystifying the GameBoy/SM83’s DAA Instruction and the RGBDS assembler/linker instruction documentation) to implement this properly, allowing me to also pass test ROM 1
With a semi-functioning PPU, and some fixes, I was also able to boot into the copyright screen of Tetris for the first time, although I couldn’t get any further without implementing interrupts. The image below shows that, and my emulator passing all of the previously mentioned test ROMs. The only test ROM I haven’t passed yet is the 2nd one, which also requires interrupts.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.