Menu HDMA Colors
thanks to Chickenlump and JLukas
General Information[edit]
Chrono Trigger[edit]
I couldn't find the HDMA color menu in the ROM for the dialog boxes for the locations, I assume it's generated somehow, and not read from a hardcoded table. The menu HDMA colors are in the ROM easily editable, and I was hoping that the dialog boxes would be similar. Sooooo... I found the routines, and cheated the game into reading my own table I created in some freespace. :lee:
First up, the Menu HDMA colors:
Menu HDMA color loading $C2/86DD 08 PHP $C2/86DE 8B PHB $C2/86DF C2 30 REP #$30 $C2/86E1 A2 71 87 LDX #$8771 //8771 = C28771(ROM Address for HDMA Color table for menu) $C2/86E4 A0 E9 9D LDY #$9DE9 //9DE9 = 7E9DE9(RAM Address for HDMA Color Table for menu) $C2/86E7 A9 1F 00 LDA #$001F //1F = 30 bytes to copy $C2/86EA 54 7E C2 MVN 7E C2 The 30 byte table is located at C28771 in the ROM. 02 E8 02 E7 02 E6 02 E5 02 E4 02 E3 02 E2 02 E1 02 E0 82 E1 82 E2 82 E3 82 E4 82 E5 82 E6 82 E7
The first row is the top half of the colors, the second row is the bottom half of the colors. Change the color and direction of the colors. The bytes seem to go as DirectionByte then ColorByte. So if you just want to change the colors only, leave the 02's and 82's alone.
The menu was easy. The dialog boxes, I had to make my own table for. The game generates a table at 7F1538 and copies it to 7F1600. The dialog boxes need both tables, and both are exactly the same. I copied the table in RAM and moved it to some freespace in the ROM.
$FD/D5C5 A2 38 15 LDX #$1538 //First table $FD/D5C8 A0 00 16 LDY #$1600 //Second table $FD/D5CB A9 FF 00 LDA #$00FF $FD/D5CE 54 7F 7F MVN 7F 7F $FD/D5D1 E2 20 SEP #$20 $FD/D5D3 60 RTS At FDD5C5, I changed to 20 79 67 60 This jumps to my modified routine in some freespace. The address for my routine is FD6779. At FD6779, my new code is A2 99 66 A0 38 15 A9 FF 00 54 7F FD A2 99 66 A0 00 16 A9 FF 00 54 7F FD E2 20 60 This loads my custom table from some freespace in the ROM. The new table is right above the new code.
The table address is FD6699. This table you can modify to change the colors of the gradient, the direction of the gradient, etc..
Here is my custom table, pasted at FD6699:
01 A8 01 A8 01 A8 01 A8 01 A8 01 A7 01 A7 01 A7 01 A7 01 A7 01 A6 01 A6 01 A6 01 A6 01 A6 01 A5 01 A5 01 A5 01 A5 01 A5 01 A4 01 A4 01 A4 01 A4 01 A4 01 A3 01 A3 01 A3 01 A3 01 A3 01 A2 01 A2 01 A2 01 A2 01 A2 01 A1 01 A1 01 A1 01 A1 01 A1 81 A0 81 A0 81 A0 81 A0 81 A0 81 A1 81 A1 81 A1 81 A1 81 A1 81 A2 81 A2 81 A2 81 A2 81 A2 81 A3 81 A3 81 A3 81 A3 81 A3 81 A4 81 A4 81 A4 81 A4 81 A4 81 A5 81 A5 81 A5 81 A5 81 A5 81 A6 81 A6 81 A6 81 A6 81 A6 81 A7 81 A7 81 A7 81 A7 81 A7 81 A8 81 A8 81 A8 81 A8 81 A8 81 A9 81 A9 81 A9 81 A9 81 A9
I can't really recommend using this for your hacks just yet, as TF will probably overwrite it. The Menu HDMA table you can overwrite and change without worry though. This is just something I was scratching my head over for awhile, even if I had to cheat to get my own colors on there.
Hmm, I just had a look at this. You're right, the HDMA colors are generated instead of using a table. In fact, the routine is directly above the first table/second table copy routine posted above. After examining the pattern you used for your custom table, I came up with the following. Enter these PAR codes on a fresh, unmodified CT:
FDD55BA8 FDD57BA0 FDD59AA0 FDD5BDA9
Look familiar? :D
FDD55A-FDD57F is the routine for the first color/top half
FDD599-FDD5B2 is the routine for the second color/bottom half
The only part I'm not sure on is what FDD580-FDD598 is doing. It has something to do with how the two colors blend in the middle of the textbox. The value at FDD58C should probably be set to the same value FDD57B and FDD59A are using.
I was pretty sure that's what the whole routine did, but couldn't quite wrap my head around it. I certainly needed some more ASM experience, so I thought I'd come back to this. It's fun changing the way the game works.
The MVN command is quite useful, copying large chunks of data from ROM to RAM, and RAM to RAM.
I suppose they wrote the routine to generate that table to save 255 bytes that would have been taken up by the table, but looking at how much freespace and junk is left in the final ROM, it doesn't appear to have mattered much.
The overworld select minimap also uses a generated table, copied twice in RAM, one after the other. It's quite a huge table. I'll pinpoint it's routine later tonight.
From: Modification