News: 11 March 2016 - Forum Rules

Author Topic: Adventure Island 1 NES - Palette Location Issue  (Read 2997 times)

Supergamerguy

  • Sr. Member
  • ****
  • Posts: 368
  • Studio Ghibli fanatic, lover of all things MegaMan
    • View Profile
    • Supergamerguy's Romhacks
Adventure Island 1 NES - Palette Location Issue
« on: February 13, 2021, 11:17:03 pm »
Hey all, so I've been working on a hack of Adventure Island for the NES, and I am 99% done with it as of now. All that stands in my way are a handful of palettes that I can't locate in the ROM for some reason (I can find them in NES and PPU Memory, but not in the ROM memory where I can permanently change them). Can anybody help me locate them so I can alter them however I need to? All of these palettes are associated with the boss at the end of each stage, both the environment and the boss' head (that changes every time you encounter him).



26 06 36 - Boss Head (the boss' body is tied to the player's sprite palette, so I've already dealt with that)

15 05 35 - Boss Damaged Palette (flashes)


16 26 36 - Foreground (boss 1), 15 26 36 - Foreground (boss 2), 19 29 3A - Foreground (boss 3), 13 23 33 - Foreground (boss 4), 16 26 36 - Foreground (boss 5), 15 25 35 - Foreground (boss 6), 17 27 37 - Foreground (boss 7), 17 27 37 - Foreground (final boss)


23 04 13 - Background (boss 1), 27 07 18 - Background (boss 2), 2C 0B 1B - Background (boss 3), 24 04 14 - Background (boss 4), 27 06 17 - Background (boss 5), 25 05 15 - Background (boss 6), 29 09 18 - Background (boss 7), 21 01 11 - Background (final boss).


Thanks in advance for any help you guys can provide! :thumbsup:

PS - I am using a rom with the following information:
Database match: Adventure Island (USA)
Database: No-Intro: Nintendo Entertainment System (v. 20180803-121122)
File SHA-1: 22EE75B82F4A6412AA6BB940E109704975B95185
File CRC32: B78C09A2
ROM SHA-1: E8EA2DEB2D65FC64F0DC038A2C95CA6CE8CA31B9
ROM CRC32: F8A713BE

Mega Man 7 > 3 > 2 > 9 > Wily Wars (with SRAM hack) > 5 > 6 > 4 > Powered Up > V(GB) > 10 > 1 > The Power Fighters > The Power Battle > IV(GB) > III(GB) > II(GB) > Dr. Wily's Revenge(GB) > Mega Man 8 > Mega Man and Bass > Mega Man (Game Gear) > Mega Man and Bass - Challengers from the Future

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 881
  • I am the baldest romhacker
    • View Profile
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #1 on: February 14, 2021, 01:05:19 am »
Have you tried to set a write breakpoint to the ppu address with color?

Supergamerguy

  • Sr. Member
  • ****
  • Posts: 368
  • Studio Ghibli fanatic, lover of all things MegaMan
    • View Profile
    • Supergamerguy's Romhacks
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #2 on: February 14, 2021, 09:11:37 am »
Have you tried to set a write breakpoint to the ppu address with color?

I've been trying to find it using the debugger for a while now, and I just can't get the debugger to work like I want it to. :D I probably just don't understand a problem in my syntax for my conditional breakpoint. If you guys could either provide a short tutorial on how to find a few color values or give me the locations, that would be great!
Mega Man 7 > 3 > 2 > 9 > Wily Wars (with SRAM hack) > 5 > 6 > 4 > Powered Up > V(GB) > 10 > 1 > The Power Fighters > The Power Battle > IV(GB) > III(GB) > II(GB) > Dr. Wily's Revenge(GB) > Mega Man 8 > Mega Man and Bass > Mega Man (Game Gear) > Mega Man and Bass - Challengers from the Future

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 881
  • I am the baldest romhacker
    • View Profile
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #3 on: February 14, 2021, 09:42:11 am »
Palette is at 3F00-3F1F in PPU Memory. Find out which address you need, also what value you're looking for. Then set a write breakpoint with an additional Write condition W==#00, replacing 00 with your value. Works in FCEUX 2.3.0. Better activate breakpoint right before color is about to be changed, like several frames earlier, or a second at least. Use savestates.

When the game writes something into PPU, it does it via 2007 register. Your breakpoint will trigger at line with STA/STX/STY $2007, depending on which register (A, X or Y) is used to write a value, they can be seen in debugger. After a trigger look for LDA/LDX/LDY instruction nearby (usually above, usually a previous one) which is loading the same value. Code can load a constant value like LDA #$00, or from some address like LDA $0300 = #$00.

If it's loading value from a RAM address, you need to set the same breakpoint to it and play again. In case you can't see where the game loads the value from, start again with using Trace Logger tool, and study several last instructions at the bottom of the log.

If you have troubles, record a video of the whole process so I can tell what's wrong.
« Last Edit: February 14, 2021, 10:56:47 am by Cyneprepou4uk »

bogaabogaa

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #4 on: February 14, 2021, 08:19:57 pm »
I assume you don't understand NES opcode. Is this right? But you need to understand a little of it for this task.

Here you see the bosses palette in the Mesen debugger. Before it will go to the PPU Bus like Cyneprepou described it will go to RAM in this case. It does load from $BABF + and stores at RAM $140 . When you don't know how the ROM is mapped to the CPU bus just right click a address over $8000 and it will show you the byte in as PRG ROM offset. Then add $10 if you like to have the headered NES file offset.   


The head changes Red so the game has some code to mod the colors as you see here.
You like to change the values that been loaded into A Y and X register. The offsets are in the picture so I think you might figure this one out yourself form here on. Mesen can also show you the byte number of the opcode. Just hover over it with the mouse curser.
CV ROM DiscordServer
https://discord.gg/PvFgxRg

Supergamerguy

  • Sr. Member
  • ****
  • Posts: 368
  • Studio Ghibli fanatic, lover of all things MegaMan
    • View Profile
    • Supergamerguy's Romhacks
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #5 on: February 22, 2021, 03:43:42 pm »
I assume you don't understand NES opcode. Is this right? But you need to understand a little of it for this task.

Here you see the bosses palette in the Mesen debugger. Before it will go to the PPU Bus like Cyneprepou described it will go to RAM in this case. It does load from $BABF + and stores at RAM $140 . When you don't know how the ROM is mapped to the CPU bus just right click a address over $8000 and it will show you the byte in as PRG ROM offset. Then add $10 if you like to have the headered NES file offset.   


The head changes Red so the game has some code to mod the colors as you see here.
You like to change the values that been loaded into A Y and X register. The offsets are in the picture so I think you might figure this one out yourself form here on. Mesen can also show you the byte number of the opcode. Just hover over it with the mouse curser.


So I've been able to follow your instructions up until the "View in PRG ROM" part. I then tried opening the debugger and couldn't find the address I was looking for (specifically the one you had highlighted in the first image. Honestly, this is all new territory for me, and I'm not sure how to transition from Memory Tools to the Debugger. :-\
Mega Man 7 > 3 > 2 > 9 > Wily Wars (with SRAM hack) > 5 > 6 > 4 > Powered Up > V(GB) > 10 > 1 > The Power Fighters > The Power Battle > IV(GB) > III(GB) > II(GB) > Dr. Wily's Revenge(GB) > Mega Man 8 > Mega Man and Bass > Mega Man (Game Gear) > Mega Man and Bass - Challengers from the Future

bogaabogaa

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #6 on: February 23, 2021, 07:42:07 pm »
The CPU offset in the memory tool does use the same offsets as the debugger. But you can also set breakpoints in the PRG ROM.

I think you are close. Make sure to use a breakpoint. Right click the address in RAM and set one for write. When it triggers the debugger will break the game stops on the instruction and you are able to navigate from CPU bus to PRG ROM with the right click options. (Since you work on a CN ROM without PRG swapping you can actually always do that)

It comes down to understand memory mapping a little. The green long bar in the mesen debugger on the bottom does visualize that for CPU and PPU bus.
The PRG ROM is basically the nes file without the header.

It is good if you start to use nesdev as a reference guide. You work on a CN ROM
https://wiki.nesdev.com/w/index.php/CNROM

Here a other example how the CPU does map memory with a MMC1 mapper. Just in case you work on a different ROM in the future.
Code: [Select]
Example Mapping MMC1 UNROM:
---------------------------------------------------------
CPU Bus                                    PRG ROM
---------------------------------------------------------
$0000-$0800        2KB internal RAM
$0800-$1fff        Mirrors of RAM
$2000-$2007        Mirrors PPU Register
$     -$3fff        Repeat every 8 bytes   
$4000-$4017        NES APU Register and Controller ($4016-$4017)
$4018-$401F        APU Function (disabled)
$     -$5fff        deverse PRG RAM/ROM MapperRegister
$6000-$7fff        SRAM
$8000-$bfff        Most mappers start there PRG banks here.
                Only one Bank at a Time!
   ||||||||
   |00---------------------------------- $0000
   |||||||
   |01---------------------------------- $4000
   ||||||
   |02---------------------------------- $8000   
   |||||
   |03---------------------------------- $c000
   ||||
   |04--------------------------------- $10000
   |||
   |05--------------------------------- $14000
   ||
   |06--------------------------------- $18000
   |
$c000-ffff                               $1c000 (Always at the end of the CPU bus!)
   |
   |The CPU expects interrupt vectors in a fixed place at the end of the cartridge space.
   |
   |$FFFA-$FFFB = NMI vector
   |$FFFC-$FFFD = Reset vector
   |$FFFE-$FFFF = IRQ/BRK vector
   |
   |----------------------------------- $1ffff


 Good luck  :thumbsup:
CV ROM DiscordServer
https://discord.gg/PvFgxRg

Supergamerguy

  • Sr. Member
  • ****
  • Posts: 368
  • Studio Ghibli fanatic, lover of all things MegaMan
    • View Profile
    • Supergamerguy's Romhacks
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #7 on: March 10, 2021, 03:49:03 pm »
I want to thank both of you (bogaabogaa and Cyneprepou4uk) for attempting to help me. Sadly however, I just can't seem to grasp what I need to do to get to the conclusion you all have described. I've tried every method in this thread, and it either ends in me being overwhelmed and not knowing how to proceed, or a step in the described process doesn't line up with my attempts. In the end, this isn't a huge deal breaker or anything for my Adventure Island hack, it just means players will see some colors left over from the original game that might not line up directly with the aesthetic of my new hack. Since players will probably only see the boss room for a minute or two (compared to the new palettes for levels they will see the entire game, which I did get to work through my simple methods), it shouldn't be a long-lasting problem.
Mega Man 7 > 3 > 2 > 9 > Wily Wars (with SRAM hack) > 5 > 6 > 4 > Powered Up > V(GB) > 10 > 1 > The Power Fighters > The Power Battle > IV(GB) > III(GB) > II(GB) > Dr. Wily's Revenge(GB) > Mega Man 8 > Mega Man and Bass > Mega Man (Game Gear) > Mega Man and Bass - Challengers from the Future

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 881
  • I am the baldest romhacker
    • View Profile
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #8 on: March 10, 2021, 04:20:52 pm »
As I said before, record a video.

Supergamerguy

  • Sr. Member
  • ****
  • Posts: 368
  • Studio Ghibli fanatic, lover of all things MegaMan
    • View Profile
    • Supergamerguy's Romhacks
Re: Adventure Island 1 NES - Palette Location Issue
« Reply #9 on: March 10, 2021, 04:50:12 pm »
As I said before, record a video.

I may eventually, but as of now I'm anxious to release my hack and move on to other projects. Maybe I can try and record a video sometime next week.
Mega Man 7 > 3 > 2 > 9 > Wily Wars (with SRAM hack) > 5 > 6 > 4 > Powered Up > V(GB) > 10 > 1 > The Power Fighters > The Power Battle > IV(GB) > III(GB) > II(GB) > Dr. Wily's Revenge(GB) > Mega Man 8 > Mega Man and Bass > Mega Man (Game Gear) > Mega Man and Bass - Challengers from the Future