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

Author Topic: Finding Level Data in Mega Man 4 (NES)  (Read 611 times)

cschifani

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Finding Level Data in Mega Man 4 (NES)
« on: July 12, 2019, 04:58:12 pm »
I'm trying to pinpoint the locations and extent of the level data in Mega Man 4 for the NES. I've been looking at Matrixz's "Comprehensive Document," which says that the level data is stored between $A000 and $B6FF. It doesn't seem to differentiate between levels, however. How could I determine, for example, where Brightman's stage starts and ends in the ROM? I appreciate any help you might provide.

Cyneprepou4uk

  • Full Member
  • ***
  • Posts: 114
  • Самый лысый ромхакер
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #1 on: July 13, 2019, 03:18:35 am »
Code/Data Logger in fceux emulator will show you which bytes were used in rom file.
I am the baldest romhacker
NES Romhacking Guide

kuja killer

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #2 on: July 13, 2019, 10:04:04 am »
Im just curious, what exactly do you need to edit or know about the level data format, that you can't do in MegaFLE level editor ??

the level editor covers (hopefully) every part of the level data format.

https://www.romhacking.net/utilities/333/

cschifani

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #3 on: July 13, 2019, 11:16:44 am »
Thank you both. I've actually used MegaFLEX, but I can't figure out where the level data is in such a way that I could import a level from one ROM to another (both MM4), or know exactly where one level began and another ended. If you could elaborate on how to do this, I would be most grateful.

kuja killer

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #4 on: July 13, 2019, 10:43:45 pm »
I uhhh, wouldn't attempt to just try and copy-paste a full level into another (only mm3, 4, and 5 are compatible with each other)

But what you would do is just only copy-paste each segment seperately, not all at once.
Like do the "TSA table" block data first, then the Structure table, then the screen data.

Assuming you were to copy like Dust Man mm4 ...to Needle Man mm3
let's actually try that and see what happens ?? The level data format is waaaay down in the document.
just do a find-search for "Level Data" in notepad until you get to where there's a bunch of ========= below it.

Dustman's level data starts at 4A010 hex - Needleman starts at 00A10 hex - Have 2 fceux's open to do this
-------------------------------------
16x16 block data (400 bytes): copy 4A010-4A40F in megaman 4 ROM --- to 1B10 in megaman 3 ROM
pal/block type   (100 bytes): copy 4A410-4A50F in megaman 4 ROM --- to 1F10 in megaman 3 ROM
32x32 block data (400 bytes): copy 4A510-4A90F in megaman 4 ROM --- to 1710 in megaman 3 ROM
Screen data      (800 bytes): copy 4A910-4B10F in megaman 4 ROM --- to  F10 in megaman 3 ROM
Screen Order      (30 bytes): copy 4B510-4B53F in megaman 4 ROM --- to  A10 in megaman 3 ROM
Screen Direction  (10 bytes): copy 4B540-4B54F in megaman 4  ROM --- to  A50 in megaman 3 ROM
Palettes          (40 bytes): copy 4B5A0-4B5DF in megaman 4 ROM --- to  A92 in megaman 3 ROM
Graphic/Tileset (1000 bytes): copy 2D010-2E00F in megaman 4 ROM -- to 52010 in megaman 3 ROM

and there we go. :) some things are not going to be correct like palette animations and boss doors cause the formats are different for each game. i did not actually include those.

Unfortantely this is a whole ton of work as you can see :( You cant just directly copy a whole level over and be done with it, gotta do it "1 piece at a time".
But if you do exactly what i did in this example, and you open Needleman level in MegaFLE, you'll see it's literally PERFECTLY copied ...the screen layouts, block data, all that important stuff.
(not sure why mm won't teleport all the way down, getting stuck at the top)

« Last Edit: July 13, 2019, 11:01:18 pm by kuja killer »

cschifani

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #5 on: July 14, 2019, 10:45:34 am »
This is awesome, and exactly the sort of thing I am interested in doing. Thanks, Kuja! But how do you know where in the ROM each of these things starts, and how long it is? How do you obtain the information that you quoted? In looking at Matrixz's document, it looked like the level data was all the same.....

kuja killer

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #6 on: July 14, 2019, 08:16:04 pm »
well first you know how it says in the mm4 comprehensive document, where each level starts like brightman 40000 hex, diveman 42000 hex, toadman 44000 hex and so on, well i scrolled down to dustman to get the base  being 4A010

Then much later down in the document it stats the start of each one of those sections, so you just add it in with the base
quote from the document:
-------------------------------
Level Data
==========

A000-A3FF : 16x16 Tile Data
  A000-A0FF : Upper-Left 8x8 Tile
  A100-A1FF : Upper-Right 8x8 Tile
  A200-A2FF : Lower-Left 8x8 Tile
  A300-A3FF : Lower-Right 8x8 Tile

  Each 16x16 tile uses a byte in all 4 tables.

A400-A4FF : 16x16 Tile - Palette and Substance Data (Single byte for each entry.)
-------------------------------------
Do like the same thing for the megaman 3 side - though level data format is the same, it's not arranged in the same order.
I opened and looked at the MegaFLE.dat file in notepad which lists the "base" offsets of those sections, scroll down to the Megaman 3 section
-------------------------------------
quote from the megafle.dat file in notepad:
!1B00   /3: TSA Block Tiledata/
!1F00   /4: TSA Block Typedata/
!1700   /5: Structure Data/
!F00   /6: Screen Preset Data/
!A00   /7: Screen Layout/
------------------------------------
have to remember to add +10 because these numbers dont inclue the NES header thhing.
like needleman starts at A10, magnetman 2A10, gemini 4A10, etc etc

cschifani

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #7 on: July 14, 2019, 10:22:40 pm »
The document I got from this site doesn't seem to make any differentiation between the level data. Where did you find the most up-to-date version of Matrixz's comprehensive document?

kuja killer

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #8 on: July 14, 2019, 11:35:38 pm »
uhhhh from here, same as you
https://www.romhacking.net/documents/363/

are you sure you're actually looking all the way down the document ??  :-\ i know it's really freaking huge, but trust me it's there
here's proof:


cschifani

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #9 on: July 15, 2019, 10:35:55 am »
My apologies, Kuja. I did see that. I just don't see how that tells you that Brightman's data starts at 4000, Diveman's at 4200, etc. How can you tell where the levels and stages are differentiated? My sincere apologies for being so daft.

kuja killer

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #10 on: July 15, 2019, 07:00:44 pm »
well i tried to explain all i can... :( this is starting to make me fustrated. i dont know what else to say. earlier in the document it tells you the start of each level

quote:
40010 <-> 4200F - (Bank $20 by $2000)
-------------------------------------
[Brightman Stage Data]
MEMORY AREA: $A000-$BFFF
A000-B6FF : <Level Data> : Brightman

42010 <-> 4400F - (Bank $21 by $2000)
-------------------------------------
[Toadman Stage Data]
MEMORY AREA: $A000-$BFFF
A000-B6FF : <Level Data> : Toadman

cschifani

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: Finding Level Data in Mega Man 4 (NES)
« Reply #11 on: July 15, 2019, 09:15:09 pm »
So it's the "bank" data that tells you where they start and end. I missed that completely in my earlier perusal of the document. I think I understand things now. I deeply appreciate your patience and thoroughness, Kuja; and I apologize for exasperating you.