News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: 6502d  (Read 2531 times)

joe73ffdq

  • Full Member
  • ***
  • Posts: 197
    • View Profile
6502d
« on: January 08, 2016, 08:16:01 pm »
I was given 6502d by Disch a few months ago, and it works fairly good, but it does not label everything in a rom fully correct. Sometimes things are misread as .DB, and parts of the code layout are labeled incorrectly in the process.

Is there something that works more accurately for producing a fully labeled rom map for NES roms.

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: 6502d
« Reply #1 on: January 08, 2016, 08:35:40 pm »
There's no way for a general disassembler to fully determine what part of the ROM is data and what part is code on its own.  Some 'smart' disassemblers try to trace the program from vectors, using knowledge of whatever mapper the game uses... but that process is imperfect and can get thrown off by jump tables and other jumping techniques... and is restricted by what mappers the disassembler supports.

Another approach is with FCEUX's "code/data logger"... which can be used to map out different parts of the game as code or data as you play it.  You can then take the generated cdl file and theoretically hand it to a disassembler so it knows what to disassemble (or at least, that was bbit's intent when he wrote it), but I don't think he ever made the matching disassembler... and I don't know if any have been made that take advantage of it.


So in short... the answer to your question is "I don't know".   :laugh:   Probably didn't need a whole giant post to say that.

joe73ffdq

  • Full Member
  • ***
  • Posts: 197
    • View Profile
Re: 6502d
« Reply #2 on: January 09, 2016, 07:33:05 am »
Retraced all my paths in DW2 after my hard drive crashed, and I was hoping there was something more complete, but kind of figured that 6502d was as good as it gets. With enough code understanding, anyone could decipher, and make corrections.

Even though I am not familiar with the code layout like FF1, it still saved me a lot of work.

This is the 2nd rom I have dived deep in to, and it has unexpected variations. Thankfully most of this is contained to 10010-1c300.

Maybe FF1 seems easy because of all the documentation, but is it common in other games to have code interdispersed in different banks.

To clarify what I mean here. FF1 magic related stuff is mainly in bank 12, along with bank 15. DW2 uses banks 4-7 and 15 for magic.
« Last Edit: January 09, 2016, 07:44:07 am by joe73ffdq »

Rotwang

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: 6502d
« Reply #3 on: January 09, 2016, 03:49:57 pm »
If you can afford it, IDA Pro is a good disassembler.

joe73ffdq

  • Full Member
  • ***
  • Posts: 197
    • View Profile
Re: 6502d
« Reply #4 on: January 10, 2016, 03:15:42 am »
I might as well ask this here.

How would I go about finding where bank swapping is in DW2. There is 5+ free bank space, and if I can figure out enough of behavior, which mainly runs from $6000-$6028. Adding or improving some things, would enhance the appeal to this clumsy old rpg. I am in the process of learning how to change Item functions. Adding more equipment options for the two spell casters, would leave almost no room for inventory. Making the Jailers Key open all doors, and renaming it, is one thing I want to do. Having only 1 herb to both heal and cure poison is another one.

The other thing I would like to figure out, is to expand item holding from 8 to 11 or 12. I dont recall off hand how much screen space is available. Im not sure what to look for, and there are too many 08's to look through.

Another thing I would like to find better options, is with the RNG. The encounter rate is way too high.

Finding a way to expand past 255 is another one. There is a broken fragment in the enemy data, which could give them up to 2048 HP, if there were instructions given to RAM.


Any ideas as to the best way to find this stuff, would be great. I know I have to start with load and store operations, absolutes and not immediate.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7035
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: 6502d
« Reply #5 on: January 10, 2016, 11:08:18 am »
I might as well ask this here.

How would I go about finding where bank swapping is in DW2.
It's MMC1, so look for a routine that writes to between $E000-FFFF. Just set a write breakpoint for that range in FCEUX and you should get the result instantly. Games I've looked at tended to write to MMC1 at the last address in the range ($FFFF).
"My watch says 30 chickens" Google, 2018

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: 6502d
« Reply #6 on: January 10, 2016, 11:16:26 am »
+1 at KingMike.

Note that MMC1 regs have to be written to 1 bit at a time, so the swap routine will likely look like this:

Code: [Select]
STA $FFFF
LSR A
STA $FFFF
LSR A
STA $FFFF
LSR A
STA $FFFF
LSR A
STA $FFFF

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7035
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: 6502d
« Reply #7 on: January 10, 2016, 11:31:02 am »
Just a note that DW2 is also 256KB, the limit of a "normal" MMC1 mapper.

Though MMC1+512KB is possible, that is a special variant of the mapper (which basically functions as 2 256K ROMs glued together, almost literally in the case of Final Fantasy I+II I imagine :D ).
(Enix themselves had to make that conversion in the localization process for DW3)
"My watch says 30 chickens" Google, 2018