+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Menu Compression.
Pages: 1 ... 4 5 [6] 7 8 ... 10
Author Topic: Menu Compression.  (Read 6 times)
ded302
Guest
« Reply #75 on: October 06, 2007, 01:06:35 pm »

If Im in the wrong bank, then how are the banks numbered in a nes rom?
Bobbias
Guest
« Reply #76 on: October 06, 2007, 01:45:50 pm »

To be honest, I don't know, I haven't touched NES or SNES roms aside from playing them on an emulator in about 3 years, lol.
KingMike
Guest
« Reply #77 on: October 06, 2007, 09:35:37 pm »

Quote from: ded302 on October 06, 2007, 01:06:35 pm
If Im in the wrong bank, then how are the banks numbered in a nes rom?

If you're using y0shi's "tracer" to get the address "02/C363", know that his program (for simplicity or whatever other reason) assumes all games use 32KB banks, which is incorrect (16KB is a much more common bank size, but 8KB is also used).
To correctly calculate the bank number, you need to know the game's mapper's bank size (look for NES mapper docs).
It should be 8, 16 or 32 KB.
If it's 32 KB, bank 0 is (with header) ROM 10-800F, bank 1 is 8010-1000F, bank 2 is 10010-1800F...
If it's 16 KB, bank 0 is ROM 10-400F, bank 1 is ROM 4010-800F, bank 2 is ROM 8010-C00F...
If it's 8 KB, bank 0 is ROM 10-200F, bank 1 is ROM 2010-400F, bank 2 is ROM 4010-600F...
ded302
Guest
« Reply #78 on: October 06, 2007, 11:35:43 pm »

Thanks for the info, Ill see what I can do.
ded302
Guest
« Reply #79 on: October 28, 2007, 12:31:13 pm »

Ive been trying to bank swap in Sted using Kingmikes example and have ran into a snag.  When I use the formulas on the address where I put the lda and jsr to bankswap, all I get is an address that is 5 bytes ahead of the 5 byte lda and jsr instructions and cant figure out where to put in the hacked code. I also used Kingmikes expand program on the rom and only expanded the prg banks.
KingMike
Guest
« Reply #80 on: October 28, 2007, 05:07:08 pm »

I'm not quite sure what you mean of "5 bytes ahead of the LDA and JSR instructions".
My only other guess could be...
I have noticed a few games that actually use some kinda mirrored bank number.
Like if they only have 16 banks ($00 to $0F), they'll try to load some higher value, like say swapping bank $14 in. My guess is that there's some kinda wrapping going on, and on the original game, the unused bits would be ignored, so $04 would be loaded (I don't know if STED does this).
I wonder if I should write an update to my program that will allow the user to choose whether to expand at the beginning or near the end of the ROM?
ded302
Guest
« Reply #81 on: October 28, 2007, 11:23:21 pm »

Edit:

I went to the romhacking irc channel and found out from Disch the correct way to use the bankswap routine.

Code:
LDA $#04 #04 is the bank to swap to
JSR $C474
JSR $Hacked Code

When I try putting this into the game the game locks up.
I traced the file and found out that the game locks up like this.

Code:
$BECA:A9 07     LDA #$07                   A:7E X:00 Y:00 P:nvUBdIzc
$BECC:20 74 C4  JSR $C474                  A:07 X:00 Y:00 P:nvUBdIzc
(28 lines skipped)
$BECF:00        BRK                        A:00 X:00 Y:00 P:nvUBdIZc
« Last Edit: October 30, 2007, 03:45:09 pm by ded302 »
KingMike
Guest
« Reply #82 on: October 30, 2007, 05:24:58 pm »

You sure you're continuing your code in the right spot?

The code after the JSR $C474 should return to ($04) * ($4000) + ($BECF % $4000) + $10 = $13EDF if I do my math right.
ded302
Guest
« Reply #83 on: October 30, 2007, 06:40:02 pm »

I was able to do that math problem and got somewhere with it.  The shop price load function runs in the other bank and I get all zeros for shop prices.  Does this mean I have to move the shop price amounts into the other bank and put them after the function?
KingMike
Guest
« Reply #84 on: October 30, 2007, 07:52:43 pm »

Quote from: ded302 on October 30, 2007, 06:40:02 pm
I was able to do that math problem and got somewhere with it.  The shop price load function runs in the other bank and I get all zeros for shop prices.  Does this mean I have to move the shop price amounts into the other bank and put them after the function?
The shop prices need to be in the same bank as the function, if that is what you're saying.
ded302
Guest
« Reply #85 on: October 30, 2007, 08:18:43 pm »

When I moved the routine to another bank I know I need to modify this instruction: LDA $B5E6,Y @ $B640 = #$64. I need to find the shop price data and put it into the same bank with the function.  Also, I'll calculate the start of the shop price data in the new bank and replace $B5E6 with the new number.  I figured this out by looking at a trace log and seeing the instruction LDY $0020 = #$5A before it.  I added 5A to $B5E6 and came up with $B640.
« Last Edit: October 30, 2007, 08:45:23 pm by ded302 »
Tauwasser
Guest
« Reply #86 on: October 31, 2007, 11:34:13 am »

Well, it's going to be in the routine you ported to the other bank, so you can just take a quick look at the assembly and look-up the addresses used and copy the data over to the new bank as well Wink
Besides that, many games with banking already have a function that lets you get a byte from a certain address in a certain bank, so you might either look and decide to move all the data (which is bothersome because mostly you won't have an end address for the data...), or you can just enable your routine to read from another bank... But since it's a Japanese game, you probably want to edit the routine as well as the prices, so it's give or take the same.

cYa,

Tauwasser
ded302
Guest
« Reply #87 on: October 31, 2007, 11:30:54 pm »

Well thanks for the advice and I will try doing that soon.

Edit:
Ive tried to relocate the data and want to ask something.
If I put the data in address 1FEED, would I use this formula:
1FEED - 10 = 1FEDD
1FEDD Mod $4000 = 3EDD
3EDD + $8000 = BEDD
also  in "LDA $B5E6,Y" , B5E6 will be replaced by BEDD.
« Last Edit: November 02, 2007, 01:06:42 am by ded302 »
ded302
Guest
« Reply #88 on: December 07, 2007, 11:41:11 am »

I found a list of 6502 branches and would like to know which of these are less than or greater than?

BPL (Branch on PLus)
BMI (Branch on MInus)
BVC (Branch on oVerflow Clear)
BVS (Branch on oVerflow Set)
BCC (Branch on Carry Clear)
BCS (Branch on Carry Set)
Tauwasser
Guest
« Reply #89 on: December 07, 2007, 03:34:37 pm »

Depends on what you do before that command.

CMP - Compare

Z,C,N = A-M

This instruction compares the contents of the accumulator with another memory held value and sets the zero and carry flags as appropriate.

Processor Status after use:

C    Carry Flag    Set if A >= M
Z    Zero Flag    Set if A = M

So, compare a to some value and then test for carry flag. If carry is set, acumulator is >=, else it's less than immediate/x/whatever.

So,

cmp 0xC9
bcc --> less_than_0xC9

Same thing other way around for greater than.

cYa,

Tauwasser
Pages: 1 ... 4 5 [6] 7 8 ... 10  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC