Language…
10 users online: Aeon, dacin, DashGamer, DixyNL, drkrdnk, GRIMMKIN, JezJitzu, Nemesis1407,  Segment1Zone2, toady - Guests: 238 - Bots: 330
Users: 64,795 (2,376 active)
Latest user: mathew

Super Mario All-Stars disassembly: Documenting & data discoveries

This is it. We've finally arrived at the exciting part of the disassembly: Documenting! There are a lot of things to be discovered. By documenting SMAS, we will lay the foundation of SMAS hacking, because we will have actual data soon and we can build stuff around it.

If you happen to find any interesting data in Super Mario All-Stars, whether it be ROM/RAM/SRAM data and other things, feel free to post it in this thread. We'll make sure to update our documentation.
Disassembly guidelines:
You can do 'block comments' like so:
Code
CODE_0F9158:        AD 5F 07      LDA $075F                 ;\If current world is not world 2
CODE_0F915B:        C9 01         CMP #$01                  ; |
CODE_0F915D:        D0 0A         BNE CODE_0F9169           ;/branch


Furthermore, please make sure the comments are very clear and easy to understand (of course).


This is basically all you have to worry about, but if you have any specific questions regarding commenting, feel free to ask and I'll answer them and update this post.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
I don't know if you guys are willing at this point to take suggestions, but in SMWDisc, the code commented by Nicol Bolas is, in my opinion, some of the most helpful and informative in the entire project, and it would be neat to see a specific part his style adopted for this project: the fact that he, for large blocks of code, described the logic of the upcoming section in addition to the standard comments mentioned in the first post. For example:


Code
; Logic: The user is on a level tile and has pressed a direction.
; We must now determine whether to move in that direction. We can only do so if
; the level has been passed. This code detects that.
; The directional input is in register A.

*code*

; Logic: If we're here, then the level does not prevent movement in that direction.
; Now we must check the tile in that direction to see if it is an appropriate path.
; The direction to travel in is still in register A.
; Note: Level tile 0x82 (a Pipe tile) always allows movement in any direction,
; so it jumps directly here.

(etc.)


It makes understanding the program as a whole loads easier, and I feel it would up the usefulness of this disassembly by a significant amount.
I should get a new layout.

Probably won't, though.
That sounds like a really interesting way of commenting things. I should give it a try.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
Seeing nobody really showed any interest, I'm keeping the documenting inside our team after all. We'll keep the documenting on dropbox because it's faster this way for the team.

If anyone finds a ROM/RAM address though, feel free to post here. You can say that this is now the official "interesting data" thread. We'll update our documentation with the data you find.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
In that case, here's the SMB1 Layer 3 Map16 tilemap:

$7F:3000
Your layout has been removed.
Added, thanks for the data.

I actually managed to find the BG3 map16 tables in the ROM while at it. I'll have to look a bit more in-depth though.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
I wend ahead and decided to find the values for the SMB3 powerup RAM ($7E:0578). I want to be useful too. :P

$00 = Small Mario;
$01 = Small Mario;
$02 = Big Mario;
$03 = Fiery Mario;
$04 = Raccoon Mario;
$05 = Frog Mario;
$06 = Tanooki Mario;
$07 = Hammer Mario;
$08 = Grey Raccoon Mario with odd walking frames swimming in the air (?).

Anything else may glitch.
It's easily the best thing I've done
So why the empty numb?
Updated. Pretty sure $08 is glitchy. Additionally, I found out that $20 is Tanooki statue Mario
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
So, did you know that if a Chain Chomp tugs on its chain a certain number of times, it comes loose? I certainly didn't, but I found out from this. That says 49 times, but I think it's actually 50. I counted 50 when I tested it, but I also managed to find the byte that determines it, or at least I think I did. It's $22CDD9, and its default value is 0x32, so yeah. It also starts flashing about 3 tugs before it comes loose, though that seems to be controlled by a different counter. I've found some other sprite-related stuff in SMB3 as well; see my post in the ROM/RAM map thread and my note file in the "Other notes" subfolder of the ROM/RAM data folder. I can only make an educated guess at what most of it does, though.

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Code
; DEFINES
; MTileBuffer 	= $06a1
; BG_Scene? 	= $0742
; Curr_Page 	= $0725
; Column_Pos	= $0726

CODE_03A43E:	LDX #$0C	;\ Clear out the tile buffer
CODE_03A440:	LDA #$00	; |
CODE_03A442:	STA MTileBuffer,x
CODE_03A445:	DEX		; |
CODE_03A446:	BPL CODE_03A442	;/
CODE_03A448:	LDY BG_Scene?
CODE_03A44B:	BEQ $a48f
CODE_03A44D:	LDA Curr_Page	;check if the renderer is on page 3
CODE_03A450:	CMP #$03	; (scenery occurs once per 3 pages)
CODE_03A452:	BMI $a459

; <> render BG scenery routine
CODE_03A459:	ASL		;
CODE_03A45A:	ASL 		;
CODE_03A45B:	ASL		;
CODE_03A45C:	ASL		;
CODE_03A45D:	ADC $A330,y	;$A330 seems to be the data pointers
CODE_03A460:	ADC Column_Pos
CODE_03A463:	TAX


Here's some stuff. I'll work on more when I feel more SMAS-ey.
I'm still looking into SMB3's sprite routines. It sure puts its sprite tables all over the place...and now, from what I can tell, apparently not all (normal) sprite tables are the same length. $279C96 seems to be the initialization routine for some of them, but some of them will only be initialized if the sprite index is less than 06, and some will only be initialized if it's less than 05. It seems that SMB3 reserves up to the last three sprite slots (three of eight, which already seems too small) for special sprites like powerups and the goal card.

And on the subject of SMB3's sprites, does anyone have any idea what the table at $288438 is? It seems to be a third pointer table to go with the init and main routines, but it isn't the death or graphics routine, the only sprites I've found so far that actually use it are powerups (mushroom, leaf, star, 1-Up) and the goal card, and some sprites don't even seem to use the values as pointers; sprite 18, for instance, has $000400 there. It is referenced at $27995B, $279A98, $27A49C, $27A6AD, and $28D3B0, and only $27A49C seems to actually use it as a pointer table.

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Anyone interested into my large documents of SMASSMB3? Keep in mind that this document is readable from the x200 byte header.

For most SMB3SMAS hacks in the future, those headers are going to be removed.

It's still needs more collecting!
I'll try to help over winter break. I'm very familiar with a lot of the SMB1 routines already.
----------

Interested in MushROMs? View its progress, source code, and make contributions here.

Insectduel: Oh, that could be quite useful. Should I save it in the SMASDis folder somewhere? I'll admit that some of the descriptions could be better, though.

SWR: That would be nice. It's been a while since we've heard from you. I'll admit I've mostly been looking into SMB3, not SMB1.

Both: Don't forget that you can submit ROM and RAM addresses here. Also, we'd love to have you on #smas on the IRC. That would be a good place for discussion of documentation as well as maybe figuring out some standardization in regard to data formats, ASM hack design, and the like.

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
All right, today's mystery RAM addresses are $7E3964, $7E3965, and $7E3966. I found some interesting info about these when I was trying to figure how White Mushroom House levels determine how many coins you need to collect. $7E3966 seems simple enough; as far as I can tell, it indicates how many coins you've collected in the level so far. $7E3965 seems to be the number of coins needed to activate the White Mushroom House. $7E3964...as far as I can tell, it indicates some kind of special level flag. It can have the values 00, 01, or 02. 01 flags the level as having a White Mushroom House (and it does not seem to be possible to activate one multiple times in a world), but I don't know what 02 does. Though the addresses are only referenced a few times in the ROM, so at least they shouldn't be too hard to trace. $7E3964 and $7E3965 are set by sprite D4 at $299B4B. I happened upon some other $7E39xx addresses earlier, too...I think I had $7E3963 listed as indicating what item comes out of a treasure chest (the small ones). Also, $1F17 seems to be the overworld sprite number table, and it may be 14 bytes long.

Also, couldn't we use the disassembly of the NES version of SMB3 (and possibly the others) to figure out some RAM addresses based on similar code? Sonikku and I were discussing that last night with SMB3's sprites, where the code was basically the same in some places, differing only by which addresses were referenced. In fact, at least a couple RAM addresses seem to be the same in both versions, such as $0661 and $0669.

----------------

I'm working on a hack! Check it out here. Progress: 64/95 levels.
https://tcrf.net/Super_Mario_Bros._3/Unused_graphics

Probably we have to find the ROM address for the unused objects.
Data for yellow Cheep Cheep:
-$88 (single)
-$D2 (group of 3)

Para Beetle swarm:
-$B7

The hex data comes from SMB3 Workshop. There are also "standalone" sprites (sprites intended to be spawned) like the baby fish (spawned by Big Bertha), the spiny fish (generated in 7-4), the "about to explode" Bob-Omb (sprite $50) and many others (I forgot the hex sprite numbers of the cannonballs).
Those infos are not so useful, but maybe we can discover the RAM address that controls generators/shooters and even the lightning generator (if SMAS has one). I also found an extra instrument! It's a trumpet (sample $19) that plays mainly in SMB1 fanfares or in the unused fanfare in SMB2 (later inserted in SMA4).
The sprite data was found with SMB3 workshop and the instrument with the SPC Player.
What would Brian Boitano do?



Image and video hosting by TinyPic
Originally posted by imamelia
I'm still looking into SMB3's sprite routines. It sure puts its sprite tables all over the place...and now, from what I can tell, apparently not all (normal) sprite tables are the same length. $279C96 seems to be the initialization routine for some of them, but some of them will only be initialized if the sprite index is less than 06, and some will only be initialized if it's less than 05. It seems that SMB3 reserves up to the last three sprite slots (three of eight, which already seems too small) for special sprites like powerups and the goal card.

And on the subject of SMB3's sprites, does anyone have any idea what the table at $288438 is? It seems to be a third pointer table to go with the init and main routines, but it isn't the death or graphics routine, the only sprites I've found so far that actually use it are powerups (mushroom, leaf, star, 1-Up) and the goal card, and some sprites don't even seem to use the values as pointers; sprite 18, for instance, has $000400 there. It is referenced at $27995B, $279A98, $27A49C, $27A6AD, and $28D3B0, and only $27A49C seems to actually use it as a pointer table.


My guess is that, the NES only has 2kB of RAM so they needed a compromise. Chain Chomps probably needed a lot of memory, so there was only enough room for 5 of them, but other places needed more than 5, so they made the last 3 sprite slots smaller.