Author
|
Topic: Menu Compression. (Read 5 times)
|
ded302
Guest
|
|
« Reply #90 on: December 08, 2007, 02:35:03 pm » |
|
Thanks for the info, Ill look into the processor flags.
|
|
|
|
ded302
Guest
|
|
« Reply #91 on: December 13, 2007, 12:44:10 am » |
|
When I was doing some tracing with the fceultra tracer I noticed that lines were organized like this.
[03C2BF] $c2bf
What formula was used to convert 3C2BF TO $C2BF ?
|
|
|
|
RedComet
Guest
|
|
« Reply #92 on: December 13, 2007, 08:42:29 am » |
|
I would think $3C2BF is the address in the .NES file and $C2BF is the address in the NES' internal memory.
|
|
|
|
KingMike
Guest
|
|
« Reply #93 on: December 13, 2007, 08:49:54 am » |
|
To convert a ROM address and its corresponding CPU address depends on the mapper.
|
|
|
|
ded302
Guest
|
|
« Reply #94 on: December 13, 2007, 11:38:41 am » |
|
The game Im hacking is a mmc1 game.
Edit: I went to the romhacking irc channel and found out from there
|
|
« Last Edit: December 13, 2007, 12:35:38 pm by ded302 »
|
|
|
|
ded302
Guest
|
|
« Reply #95 on: February 19, 2008, 12:46:59 am » |
|
I have a question about bank swapping. Is it possible to put a bank swap statement in bank 15, that is non swappable,to switch to bank 16 in an expanded rom space? I asked this question because Im trying to modify the text routine to bank swap to bank 16. The asm that loads the text will be located at the address that I got from using the formula that determines where the code will continue in bank 16. I already figured out how the pointers are loaded. On my first try it failed and I ran a trace and saw the bankswap routine being executed but not the code in bank 16. This is a MMC1 game named Shinsenden.
|
|
|
|
KingMike
Guest
|
|
« Reply #96 on: February 19, 2008, 09:07:47 am » |
|
So, you're trying to expand a 256KB MMC1 ROM to 512KB? (16 banks * 16KB bank size in MMC1)
That one's an exception. When expanding an MMC1 ROM from 256K to 512K, you have to copy the entire 256KB, then add another 240KB blank space, then copy the last 16KB of the original ROM. Then you have an additional register that switches which 256KB half of the ROM is "active", and all further bankswaps are relative to that. So, to switch to bank 16, you'd need to write $10 to $A000 (the highest bit of this register controls which 256KB part is selected). This would cause your game to jump from the ROM bank at $3C000 to the ROM bank at $7C000 (thus, you'll need to keep any code changes in this bank updated in both copies). Then write 0 to register $E000 (I think, the normal bankswap register). This will swap in bank 16 (since it's bank 0 relative to the second 256KB). To switch back to the first 256KB, write 0 to $A000.
|
|
|
|
ded302
Guest
|
|
« Reply #97 on: February 19, 2008, 11:30:27 am » |
|
When I put the 5 byte bankswap code in $3C000, I just add $40000 to $3C000 to get $7C000?
|
|
|
|
KingMike
Guest
|
|
« Reply #98 on: February 19, 2008, 12:49:48 pm » |
|
MMC1 registers actually are 5 bits and have to be written one bit at a time, so you have to do something like LDA #$value STA $register LSR A STA $register LSR A STA $register LSR A STA $register LSR A STA $register ;this is where the register change takes effect.
Since that's a lot of code, I'd recommend putting everything but the LDA in a seperate routine, followed by RTS. (I think it was LSR's you need, though it could've been ASL's. I can't remember for sure which direction you needed to write the bits) So then you can just do LDA #$value JSR SwapRoutine Yep, the instant you do the last STA in the code, your position in the ROM will change by $40000. It was kind of a pain to do in Deep Dungeon 3, since I moved a block of text in the fixed bank to use as space for bankswap code, and I adjusted a bunch of code to read that block from a non-fixed bank.
|
|
|
|
ded302
Guest
|
|
« Reply #99 on: February 19, 2008, 05:19:19 pm » |
|
When I expand a 256kb mmc1 rom to 512kb, will I have to do it manually instead of using your rom expander program?
|
|
|
|
KingMike
Guest
|
|
« Reply #100 on: February 19, 2008, 05:41:35 pm » |
|
The ROM expander program SHOULD work. (I know I made an update to detect 256->512KB MMC1 expansion. I can't remember if it was in the version I uploaded.)
|
|
|
|
ded302
Guest
|
|
« Reply #101 on: February 19, 2008, 06:12:55 pm » |
|
I implemented the bankswap routine that writes 10 to $A000 and also found out that I was supposed to use LSR. Is there a different formula I use to determine the location to continue the code at. I put the routine at 3E938 and found the same code at 7E938. Also your rom expander program worked.
|
|
|
|
KingMike
Guest
|
|
« Reply #102 on: February 19, 2008, 07:44:37 pm » |
|
Whatever the offset of the byte following the final STA instruction is, add/subtract (as appropriate) $40000.
|
|
|
|
ded302
Guest
|
|
« Reply #103 on: February 19, 2008, 08:58:35 pm » |
|
I was able to understand your advice. In the text routine, the asm that loaded the text was replaced by a jsr to the code that loaded 10 into the accumulator and wrote that to register a000. I added 40000 to the offset of the byte following the final sta instruction. Then I put the code that loaded the text at the resulting offset and found out from a trace log that those instructions ran. When I try to run the game I find out from a trace log that the that the game is resetting at the instruction BMI $E1F5.
|
|
|
|
ded302
Guest
|
|
« Reply #104 on: February 21, 2008, 12:52:10 pm » |
|
I made another attempt on this. I missed the part where I have to write 00 to E000 after the swap happens when I write 10 to A000. After I write 00 to E000, how do I determine where to put my code in the bank I swapped to?
|
|
|
|
|