Acmlm's Board - I2 Archive - Rom Hacking - Super Mario Bros 1 sprite TSA
User | Post |
AP
Posts: 310/333 |
I'll post the flipping swimming feet code, but this is only for reference, and I'm not sure if Kawa would have any use of this:
$EF2D:BD E7 EE LDA $EEE7,X ($EEE7 and $EEE8 are the tiles [big and small] that are used for the flipping feet) $EF30:99 19 02 STA $0219,Y @ $021D = Address that has the flipping tile
Putting EA's over the code would disable it. This might be useful if anyone doesn't want the flipping feet.
EDIT: I finally know why dead Mario uses the flipping code:
$F0EC:A5 0E LDA $0E - Mario condition (decides whether Mario is going inside a pipe, horizontal or vertical, whether he's going up with a vine, whether he's autowalking for beating a level, etc.) $F0EE:C9 0B CMP #$0B - 0B = Dead Mario $F0F0:F0 13 BEQ $F105 - Flipping Code B If you don't want dead Mario to use flipping, EA over the code. If you want dead Mario to use Flipping Code A instead, change F0 13 into F0 25. |
Kyoufu Kawa
Posts: 2365/2481 |
Okay lessee... my hack has no small Mario save for dead, but I guess I'll just back up and use the last thing you mentioned, the 4C29F1 bit. |
AP
Posts: 304/333 |
I found a much better subsitute to make the flipping tiles of standing (big and small) Mario, crouching Mario, the semi big/small form during the growth process when getting a mushroom, and/or dead Mario. This should fix Kawa's messed up sprite problem. $F0F2:AD D5 06 LDA $06D5 - RAM address that determines Mario's sprite $F0F5:C9 50 CMP #$50 - crouching Mario $F0F7:F0 1E BEQ $F117 - branches to tile flipping code A $F0F9:C9 B8 CMP #$B8 - standing small Mario $F0FB:F0 1A BEQ $F117 $F0FD:C9 C0 CMP #$C0 - the semi big/small Mario $F0FF:F0 16 BEQ $F117 $F101:C9 C8 CMP #$C8 - standing big Mario (big Mario and dead Mario flipping code, hereby called "flipping code B" starts at $F105, unlike the others) $F103: D0 24 BNE $F129 - goes to RTS for any of the Mario sprites that are not the following compared in the code (except for dead Mario, not sure how or why, since dead Mario is B0 and B0 is not compared as far as I can tell) If you would want to make one of the forms (excluding big Mario) not use the tile flipping code, change the branch code right below into F0 original value right after + 12 in hex. If you want any of those forms to use code B, change the branch code into F0 original value right after - 0C. If you don't want any form (including dead Mario) to use the flipping code, put 4C 29 F1 at $F105 and $F117. If you want big Mario and dead Mario to use code A, put 4C 17 F1 at $F105. If you don't want BOTH forms to use a flipping code, put 4C 29 F1 at $F105. If you don't want big Mario to use a flipping code, put EAs on C9 C8.
With this data, you could even change which forms use flipping codes. If anyone is interested in doing something like that, here's a list of forms used in game (some is from Frantik's documents, so the credit for that stuff goes to Frantik [and Googie for posting his documents at boards]: B8 - small Mario standing 60, 70, 80 - small Mario walking positions C8 - big Mario standing 20 - big Mario jump 00, 10, 20 - big Mario walking positions 50 - big Mario's crouch C0 - semi big/small Mario 18 - big Mario skid B0 - dead Mario 40, 48 - big Mario sliding/climbing 80 - small Mario jump 78 - small Mario skid A0, A8 - small Mario sliding/climbing 58 - fire Mario shooting a fireball 90, 98, 88 - small Mario swimming 30, 38, 28 - big Mario swimming |
HyperLamer
Posts: 7544/8210 |
Originally posted by AP This is from a translation of this page. Excuse the large space between "it is the total 256KB" and "Address".
Wow, that translated pretty damn good. As for the space, delete all the line breaks within the table. |
Kyoufu Kawa
Posts: 2363/2481 |
Too late. I too have flipped Mario's arm back. But now there's a new problem.
Facing right looks fine... head 1 right, head 2 right head 3 right, head 4 right arm 1 right, arm 2 right foot 1 right, foot 2 right
But facing left looks NOT fine... head 2 left, head 1 left head 4 left, head 3 left arm 2 right, arm 1 right foot 2 right, foot 1 right
|
AP
Posts: 303/333 |
The ASM code I posted before is only for the bottom right tile of Mario. The following ASM code would be for the tile right above the bottom right one: $F112:09 40 ORA #$40 $F114:99 16 02 STA $0216,Y @ $021A = #$40 I might even try to find data for flipping of other sprites, like Koopa shells. |
Kyoufu Kawa
Posts: 2362/2481 |
Hey hey hey... this is interesting... Lessee if I can do that to his left hand...
Yeah. Can do. It looks funky now, but if I were to overhaul the whole sprite set, it'd be cool. And considering Kunio requires less distinct tiles than Mario, I'll have some left for other purposes too!
Edit: Damn! He fucks up when facing left Oh well... keep hackin'... |
AP
Posts: 303/333 |
Originally posted by Kawa-oneechan Again you repeat info I already have:
Originally posted by Kawa-oneechan
Sprite memory is DMA'd in from 0x0200 (nes mem) each frame, and is in standard Famicom format: ypos, tile, flags, xpos. First sprite is always the splitscreen coin, followed (I guess always) by Mario's 8 tiles.
Sorry about that, I realized that after I read your first post. I just feel pretty excited about this, since I wanted to do something like this. I did find some ASM code here: $F124:09 40 ORA #$40 $F126:99 1E 02 STA $021E,Y @ $0222 = #$40 I found that after setting up a breakpoint to $0222. Well, I hope this was what you wanted. I believe that's where those flipping bits come from (at least for Mario). IIRC, I believe 40 means flip horizontally and use Mario palette. Changing (RAM address, not ROM) $F125 to 00 makes the tiles of Mario that flip not flip. |
Kyoufu Kawa
Posts: 2361/2481 |
Again you repeat info I already have:
Originally posted by Kawa-oneechan
Sprite memory is DMA'd in from 0x0200 (nes mem) each frame, and is in standard Famicom format: ypos, tile, flags, xpos. First sprite is always the splitscreen coin, followed (I guess always) by Mario's 8 tiles.
|
Kyoufu Kawa
Posts: 2360/2481 |
Ummm, Anony...
Not to sound stupid or anything but I already know that format. The question was where SMB1 gets the flip bits -from-. |
AP
Posts: 301/333 |
This is from a translation of this page. Excuse the large space between "it is the total 256KB" and "Address".
* Sprite One sprite is formed at 4 bytes, 64 data have lined up, it is the total 256KB.
Address | Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
---|
1st byte | Y coordinate -1 |
2nd byte | Sprite pattern index number |
3rd byte | Top and bottom reversal The 0= it does not do The 1= it does | Left and right reversal The 0= it does not do The 1= it does | Priority of sprite and background 0= sprite priority 1= background priority | Unused | Pallet |
4th byte | X coordinate |
If this isn't clear enough, then you could look at the (translated) section about PPU. |
Kyoufu Kawa
Posts: 2352/2481 |
Yeah, so I was dabbling in SMB1 a bit, made a nifty little ASM hack that makes you start big (big > big + extra hitpoint > big + fire) and replaced Mario's tiles with Alex/Kunio's.
I also found the sprite TSA data (which can't really be considered "square" so "TSA" is a bit of a misnomer). Basically, you got 8 tiles arranged in a two-by-four figure for all Mario sprites and 6 in a two-by-three figure for all enemies, including Goomba and Bowser, who actually consists of two seperately drawn sprites!
My main beef is with the sprite flipping bit.
According to my homebaked docs, Mario's TSA data is at 0x6E72 in file and 0xEE62 in NES memory. That's eight bytes a tile, no flipping data included.
Sprite memory is DMA'd in from 0x0200 (nes mem) each frame, and is in standard Famicom format: ypos, tile, flags, xpos. First sprite is always the splitscreen coin, followed (I guess always) by Mario's 8 tiles.
All in all, I can't get myself to wade through the ASM code just to find something that's probably already known: what would Brian Boitano do? where does it get the flip bits from?
Edit: layout removed to prevent scrolling |
|