It is currently Thu Dec 13, 2018 5:38 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 27, 2018 3:39 am 
Offline

Joined: Thu Sep 27, 2018 3:27 am
Posts: 2
I want to start off by apologizing if talk of romhacking or disassembles of games here isn't supposed to be a thing, I didn't see any rules relating to it.

I'm using a NESASM rewrite of smbdis to convert Mario 1 to MMC3 for a romhack, and to free up space for bank switching code, I wanted to move the music engine to its own bank since it is entirely self contained, but when I do, I get a number of overflow errors relating to the music header data. None of this should be located outside of the bank, and the bank should not be too large. I've done searches to confirm, and the only references to those words are within the bank.

I'll admit, I'm not too familiar with this stuff, but I was moderately familiar with NESASM due to its use in the Southbird SMB3 disassembly.
Code:
  921  02:A63E                  .db DeathMusHdr-MHD           ;event music
       Overflow error!
  922  02:A63F                  .db GameOverMusHdr-MHD
       Overflow error!
  923  02:A640                  .db VictoryMusHdr-MHD
       Overflow error!
  924  02:A641                  .db WinCastleMusHdr-MHD
       Overflow error!
  925  02:A642                  .db GameOverMusHdr-MHD
       Overflow error!
  926  02:A643                  .db EndOfLevelMusHdr-MHD
       Overflow error!
  927  02:A644                  .db TimeRunningOutHdr-MHD
       Overflow error!
  928  02:A645                  .db SilenceHdr-MHD
       Overflow error!
  930  02:A646                  .db GroundLevelPart1Hdr-MHD   ;area music
       Overflow error!
  931  02:A647                  .db WaterMusHdr-MHD
       Overflow error!
  932  02:A648                  .db UndergroundMusHdr-MHD
       Overflow error!
  933  02:A649                  .db CastleMusHdr-MHD
       Overflow error!
  934  02:A64A                  .db Star_CloudHdr-MHD
       Overflow error!
  935  02:A64B                  .db GroundLevelLeadInHdr-MHD
       Overflow error!
  936  02:A64C                  .db Star_CloudHdr-MHD
       Overflow error!
  937  02:A64D                  .db SilenceHdr-MHD
       Overflow error!
  939  02:A64E                  .db GroundLevelLeadInHdr-MHD  ;ground level music layout
       Overflow error!
  940  02:A64F                  .db GroundLevelPart1Hdr-MHD, GroundLevelPart1Hdr-MHD
       Overflow error!
  941  02:A650                  .db GroundLevelPart2AHdr-MHD, GroundLevelPart2BHdr-MHD, GroundLevelPart2AHdr-MHD, GroundLevelPart2CHdr-MHD
       Overflow error!
  942  02:A651                  .db GroundLevelPart2AHdr-MHD, GroundLevelPart2BHdr-MHD, GroundLevelPart2AHdr-MHD, GroundLevelPart2CHdr-MHD
       Overflow error!
  943  02:A652                  .db GroundLevelPart3AHdr-MHD, GroundLevelPart3BHdr-MHD, GroundLevelPart3AHdr-MHD, GroundLevelLeadInHdr-MHD
       Overflow error!
  944  02:A653                  .db GroundLevelPart1Hdr-MHD, GroundLevelPart1Hdr-MHD
       Overflow error!
  945  02:A654                  .db GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD, GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD
       Overflow error!
  946  02:A655                  .db GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD, GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD
       Overflow error!
  947  02:A656                  .db GroundLevelPart3AHdr-MHD, GroundLevelPart3BHdr-MHD, GroundLevelPart3AHdr-MHD, GroundLevelLeadInHdr-MHD
       Overflow error!
  958  02:A656            TimeRunningOutHdr:    .db $08, LOW(TimeRunOutMusData), HIGH(TimeRunOutMusData), $27, $18
       Internal error[1]!


Top
 Profile  
 
PostPosted: Thu Sep 27, 2018 8:42 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2354
Location: DIGDUG
.db DeathMusHdr-MHD

If this throws an overflow error, then it's probably a value > 255.

If MHD is later in the ROM than DeathMusHdr, then this would be a 16 bit negative number (like fffe).

I can't think of a way of outputting label addresses without a successful assemble.


edit, no wait, that would be a value out of range error.

An overflow error is when the bank goes over $2000 bytes.

Did you put it in a different bank? NESASM is annoyingly finicky about directives having white space before them. Is .bank tabbed out?

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Thu Sep 27, 2018 9:06 pm 
Offline

Joined: Thu Sep 27, 2018 3:27 am
Posts: 2
I moved the entire sound engine to a separate bank, nothing it's looking for is outside of that bank, and it all worked where it was before.

The text to the overflow errors is different from when I've overfilled a bank previously messing around with the SMB3 disassembly. Here's one I got intentionally, for the different error message:
Code:
#[2]   SMB1/PRG/prg007.asm
 3450  07:0004                  .db $30, $50, $50, $70
       Bank overflow, offset > $1FFF!


I'm in over my head, heck.

EDIT: Oh, ok, so MHD is defined as $F90D, so I guess that becomes wrong when I move it to a new bank, the thing is I don't entirely understand what's happening there enough to know what to change it to.

EDIT 2: I figured it out, F90D was where the info was in the original bank, and so it needed to be subtracted from the offset. I replaced the labelled DBs with the raw table from the regular game so it would assemble and then figured out where the new address to subtract would be. It works now, woop woop!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: WedNESday and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group