Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - Super Mario Bros 1 sprite TSA | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 2352/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 10-08-05 04:06 PM Link | Quote
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


(edited by Kawa-oneechan on 10-08-05 07:06 AM)
AP

Panser
Level: 22

Posts: 301/333
EXP: 56817
For next: 1533

Since: 08-07-05

Since last post: 6 hours
Last activity: 6 hours
Posted on 10-08-05 09:24 PM Link | Quote
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.
















AddressBit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
1st byteY coordinate -1
2nd byteSprite pattern index number
3rd byteTop 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
UnusedPallet
4th byteX coordinate



If this isn't clear enough, then you could look at the (translated) section about PPU.


(edited by AP on 10-08-05 12:25 PM)
(edited by AP on 10-09-05 07:16 PM)
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 2360/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 10-08-05 10:22 PM Link | Quote
Ummm, Anony...

Not to sound stupid or anything but I already know that format. The question was where SMB1 gets the flip bits -from-.
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 2361/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 10-08-05 11:22 PM Link | Quote
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.
AP

Panser
Level: 22

Posts: 303/333
EXP: 56817
For next: 1533

Since: 08-07-05

Since last post: 6 hours
Last activity: 6 hours
Posted on 10-08-05 11:25 PM Link | Quote
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.


(edited by AP on 10-08-05 02:28 PM)
(edited by AP on 10-08-05 02:30 PM)
(edited by AP on 10-08-05 02:32 PM)
(edited by AP on 10-08-05 02:33 PM)
(edited by AP on 10-08-05 02:46 PM)
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 2362/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 10-08-05 11:48 PM Link | Quote
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'...


(edited by Kawa-oneechan on 10-08-05 03:49 PM)
AP

Panser
Level: 22

Posts: 303/333
EXP: 56817
For next: 1533

Since: 08-07-05

Since last post: 6 hours
Last activity: 6 hours
Posted on 10-09-05 01:11 AM Link | Quote
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.


(edited by AP on 10-08-05 04:14 PM)
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 2363/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 10-09-05 01:24 AM Link | Quote
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
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 7544/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 10-09-05 01:30 AM Link | Quote
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.
AP

Panser
Level: 22

Posts: 304/333
EXP: 56817
For next: 1533

Since: 08-07-05

Since last post: 6 hours
Last activity: 6 hours
Posted on 10-09-05 01:58 AM Link | Quote
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


(edited by AP on 10-08-05 04:58 PM)
(edited by AP on 10-08-05 05:02 PM)
(edited by AP on 10-08-05 05:07 PM)
(edited by AP on 10-08-05 05:19 PM)
(edited by AP on 10-08-05 05:22 PM)
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 2365/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 10-09-05 02:07 AM Link | Quote
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

Panser
Level: 22

Posts: 310/333
EXP: 56817
For next: 1533

Since: 08-07-05

Since last post: 6 hours
Last activity: 6 hours
Posted on 10-10-05 01:11 AM Link | Quote
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.


(edited by AP on 10-09-05 04:11 PM)
(edited by AP on 10-09-05 07:20 PM)
(edited by AP on 10-09-05 07:22 PM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - Super Mario Bros 1 sprite TSA | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.013 seconds.