Aslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1741.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexe0a9-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=8.200e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexe0a9-2.html.zxx&h^!oOKtext/htmlISO-8859-1gzip@!oWed, 11 Mar 2020 00:01:21 GMT0 0Px&h^y!o 16 color battle palettes

Author Topic: 16 color battle palettes  (Read 1198 times)

Edrin

  • Ymir
  • *
  • Posts: 12
    • View Profile
16 color battle palettes
« on: August 13, 2012, 01:41:34 PM »
I'm working on a patch to allow all 16 colors of the battle palette to be used in battle instead of only 12. The problem I am currently running into is that the 8 bytes following each palette list in battle are used for other miscellaneous sprites throughout battle such as the little finger pointer, damage and healing numerals, etc... What I need to find is where these sprites assign the addresses for the battle palettes or the offsets for the address.

I already have down where the palettes write and rewrite their values in the RAM throughout battle.

Code: [Select]
Loads the palettes to RAM

C1/3E37: A918    LDA #$18
C1/3E39: 8510    STA $10
C1/3E3B: BF0063ED LDA $ED6300,X
C1/3E3F: 99AD81  STA $81AD,Y
C1/3E42: E8      INX
C1/3E43: C8      INY
C1/3E44: C610    DEC $10
C1/3E46: D0F3    BNE $3E3B

Code: [Select]
Writes palette from backup address to the address actually called by the sprites

C1/2DE0: A21800  LDX #$0018   
C1/2DE3: B9AD81  LDA $81AD,Y
C1/2DE6: 99807F  STA $7F80,Y    (set character palette's 1 - 4)
C1/2DE9: C8      INY
C1/2DEA: CA      DEX
C1/2DEB: D0F6    BNE $2DE3

I will eventually change one or both of those #$18's to $20 to copy the full list.

Based on debugging, this is where I have found the application of the palettes to all sprites (Character, Enemy, misc) takes place.

Code: [Select]
C1/0A7B: A2007F  LDX #$7F00     (pay attention to this one!)
C1/0A7E: 8E7243  STX $4372
C1/0A81: A97E    LDA #$7E
C1/0A83: 8D7443  STA $4374
C1/0A86: A20001  LDX #$0100
C1/0A89: 8E7543  STX $4375
C1/0A8C: A980    LDA #$80
C1/0A8E: 8D0B42  STA $420B

I don't fully understand this. $7F00 is obviously the starting address used for the palettes. I have tested this by changing $7F00 to $812D to line up the colors with the backup instance of the character palettes in the RAM, resulting in perfect character sprites and obviously screwed up everything else. Altering 7E also affects all sprites, but doesn't appear to be an offset because I can't get consistent results when altering it.


Regardless of those numbers, there isn't nearly enough information here to determine what values get applied to each value of each sprite palette. But I have been unable to find where this is actually defined in the code. Once I find where the sprites define their offsets to find their correct palettes from the $7F00 starting point loaded from the RAM I ought to be able to either move the character palettes to the backup address or move the misc palettes elsewhere to free up the full $20 bytes for character palettes.

I am admittedly new to SNES hacking and don't know exactly how sprites and graphics are applied to the screen. Anyone have any ideas?

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: 16 color battle palettes
« Reply #1 on: August 13, 2012, 07:16:17 PM »
(the game is FF6j/FF3us, btw.)

Code: [Select]
C1/0A7B: A2007F  LDX #$7F00     (pay attention to this one!)
C1/0A7E: 8E7243  STX $4372
C1/0A81: A97E    LDA #$7E
C1/0A83: 8D7443  STA $4374
C1/0A86: A20001  LDX #$0100
C1/0A89: 8E7543  STX $4375
C1/0A8C: A980    LDA #$80
C1/0A8E: 8D0B42  STA $420B

I don't fully understand this. $7F00 is obviously the starting address used for the palettes. I have tested this by changing $7F00 to $812D to line up the colors with the backup instance of the character palettes in the RAM, resulting in perfect character sprites and obviously screwed up everything else. Altering 7E also affects all sprites, but doesn't appear to be an offset because I can't get consistent results when altering it.

it's setting up a DMA transfer.  see this:

http://web.archive.org/web/20091023152009/http://geocities.com/Qwertie256/attic/snesemu/qsnesdoc.html

7Eh is the bank of the (source) address.