Hey. A lot of stuff has been happening to me over the past 2 weeks. Long story short, I bought a new PC, one that can run Mesen I should add. Yay! This means I can use Mesen now.
Now, I tried setting a breakpoint to the top left of the dialogue box, and I seem to have hit a routine for displaying text on-screen....
Code: Select all
C3BF 8D 06 20 * STA PpuAddr_2006
C3C2 C8 INY
C3C3 B1 00 LDA ($00),Y
C3C5 8D 06 20 * STA PpuAddr_2006
C3C8 C8 INY
C3C9 B1 00 LDA ($00),Y
C3CB 0A ASL A
C3CC 20 F3 C3 JSR $C3F3
C3CF 0A ASL A
C3D0 B1 00 LDA ($00),Y
C3D2 29 3F AND #$3F
C3D4 AA TAX
C3D5 90 01 BCC $C3D8
C3D7 C8 INY
C3D8 B0 01 BCS $C3DB
C3DA C8 INY
C3DB B1 00 LDA ($00),Y
C3DD 8D 07 20 > STA PpuData_2007
C3E0 CA DEX
C3E1 D0 F5 BNE $C3D8
C3E3 C8 INY
C3E4 20 78 C3 JSR $C378
Though I'm not really sure where to go from here lol.
Any ideas?
EDIT: I should probably explain more in-depth what are my questions. Just asking "help plz" isn't going to lead me anywhere, hahahahaha. The instruction that stores the tile to VRAM is that STA PPUDATA instruction, so I googled what that means and found this:
https://www.nesdev.org/wiki/PPU_registe ... ead/write) Knowing know how it gets to know *which* tile to grab, how can I know how it knows *where* to draw the tile? The solution is PPUADDR, ofc. So I read into that too.
https://www.nesdev.org/wiki/PPU_registe ... 006_write) The address I want to change is $2204, since that's where the top left of the tile is being drawn to.
That being said, is PPUADDR little or big endian? The answer is that the write interface is big endian (thanks @Fiskbit on Discord!).
EDIT 2: ANyway, going on with debugging. I set a breakpoint to those two writes to PPUADDR which I annotated with an asterisk (" * ") and it appears like PPUADDR only gets updated in this game's code whenever it needs to go back to the start of a stripe in the windows, so altering one point in this routine should alter the entire game. Right..
Is there a way to add annotations to code I'm tinkering around in? :p Nevermind, seems like I can add some by right-clicking and clicking "Edit Label".
Anyway, here's that same routine again but now with labels:
Code: Select all
StartLocationOfPrintingGfx:
C3BF 8D 06 20 STA PpuAddr_2006
C3C2 C8 INY
C3C3 B1 00 LDA ($00),Y
C3C5 8D 06 20 STA PpuAddr_2006
C3C8 C8 INY
C3C9 B1 00 LDA ($00),Y
C3CB 0A ASL A
C3CC 20 F3 C3 JSR UpdatePPUCTRL
WriteToPPUData:
C3CF 0A ASL A
C3D0 B1 00 LDA ($00),Y
C3D2 29 3F AND #$3F
C3D4 AA TAX
C3D5 90 01 BCC Loop
C3D7 C8 INY
Loop:
C3D8 B0 01 BCS $C3DB
C3DA C8 INY
C3DB B1 00 LDA ($00),Y
C3DD 8D 07 20 STA PpuData_2007
C3E0 CA DEX
C3E1 D0 F5 BNE Loop
C3E3 C8 INY
C3E4 20 78 C3 JSR End
--------UpdatePPUCTRL--------
UpdatePPUCTRL:
C3F3 48 PHA
C3F4 A5 D3 LDA $D3
C3F6 09 04 ORA #$04
C3F8 B0 02 BCS $C3FC
C3FA 29 FB AND #$FB
C3FC 8D 00 20 STA PpuControl_2000
C3FF 85 D3 STA $D3
C401 68 PLA
C402 60 RTS
EDIT 3: I did a little bit more of digging. Seems like the game is storing the address in VRAM in the zero-page CPU addressees $01 and $00 (reversed due to little endianness).
EDIT 4: Typo fixed for clarity.