It is currently Mon Oct 15, 2018 10:50 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Sep 25, 2018 3:36 am 
Offline
User avatar

Joined: Fri Mar 16, 2018 1:52 pm
Posts: 35
Location: Finland
Is there a way to make breakpoint in FCEUX that gets triggered when the game swaps PRG banks? If it is any of help, I believe the game in question uses MMC3 (iNES 004 iirc).


Top
 Profile  
 
PostPosted: Tue Sep 25, 2018 5:19 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20656
Location: NE Indiana, USA (NTSC)
A write breakpoint on $8000-$9FFF will catch all MMC3 bank switching, but this includes CHR bank switching as well.


Top
 Profile  
 
PostPosted: Tue Sep 25, 2018 6:20 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6875
Location: Canada
The debugger doesn't directly have functionality for tracking internal mapper registers, so with something like MMC3 where the internal register gets selected first you can't really do it with a single breakpoint.

However, an execution breakpoint on $8000-FFFF (or any suitable range) with the condition K==#5 will break whenever PRG bank 5 starts executing, that would break on the instruction after the write for that specific bank, for example. (On Mesen you could step backward from here, on FCEUX you'd probably want to start a trace first, then read backward in the trace log from there.)

Another way to do it is keep track of the internal register writes with a Lua script, and have the Lua script call debugger.hitbreakpoint() when it sees the write you want. (Can also do something similar in Mesen, I believe.)


Top
 Profile  
 
PostPosted: Tue Sep 25, 2018 8:32 am 
Offline
User avatar

Joined: Fri Mar 16, 2018 1:52 pm
Posts: 35
Location: Finland
rainwarrior wrote:
Another way to do it is keep track of the internal register writes with a Lua script, and have the Lua script call debugger.hitbreakpoint() when it sees the write you want.


This might be the best option. For now I only want to know when the game swaps PRG banks if at all. CHR bank swaps are usually easier to figure out since they appear on PPU Viewer.

And just to confirm: PRG swapping works as follow:
-first write a value to $8000 that has either 6 or 7 written on the bits 0-2
-write the bank number to $8001
-7 will always swap the bank at $A000-$BFFF
-6 will swap the bank at $8000-$9FFF if the value written to $8000 has the 6th bit cleared. If it's set, the swap is done at $C000-$DFFF


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group