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 Super Mario World hacking: labmaster | 3 guests
Acmlm's Board - I2 Archive - Super Mario World hacking - Sprite ASM pointers | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 350/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 04-04-05 04:30 AM Link | Quote
Hey!

I was trying to figure out how sprite code works, but when I was trying to find the start of the sprite code, I wound up confusing myself to hell. Which ROM bank hold the sprite ASM? I'm looking to see if I can figure some stuff out, but I can't. Could anyone help?
mikeyk

Koopa
Level: 18

Posts: 50/110
EXP: 25086
For next: 4811

Since: 07-17-04

Since last post: 45 days
Last activity: 44 days
Posted on 04-04-05 07:50 AM Link | Quote
ROM addy 0x87CC is the table of ASM pointers... 2 bytes per sprite that tell where in bank 01 to jump to. Take Rex, sprite AB, the pointer at 0x8922 (0x87CC + 2 * 0xAB) equals 8E 87. This means that the start of code used by Rex is at SNES $01878E. As you can see from the code posted below, the pointer for Rex is used by many sprites, and his specific code doesn't begin until $039517.

//location jumped to by following ASM pointer
$01/878E 22 18 A1 03 JSL $03A118[$03:A118] A:878E X:0007 Y:0000

//determines which sprite is being handled
$03/A118 8B PHB A:878E X:0007 Y:0000
$03/A119 4B PHK A:878E X:0007 Y:0000
$03/A11A AB PLB A:878E X:0007 Y:0000
$03/A11B B5 9E LDA $9E,x [$00:00A5] A:878E X:0007 Y:0000
$03/A11D C9 C8 CMP #$C8 A:87AB X:0007 Y:0000
$03/A11F D0 05 BNE $05 [$A126] A:87AB X:0007 Y:0000
$03/A126 C9 C7 CMP #$C7 A:87AB X:0007 Y:0000
$03/A128 D0 05 BNE $05 [$A12F] A:87AB X:0007 Y:0000
$03/A12F C9 51 CMP #$51 A:87AB X:0007 Y:0000
$03/A131 D0 05 BNE $05 [$A138] A:87AB X:0007 Y:0000
$03/A138 C9 1B CMP #$1B A:87AB X:0007 Y:0000
$03/A13A D0 05 BNE $05 [$A141] A:87AB X:0007 Y:0000
$03/A141 C9 C6 CMP #$C6 A:87AB X:0007 Y:0000
$03/A143 D0 05 BNE $05 [$A14A] A:87AB X:0007 Y:0000
$03/A14A C9 7A CMP #$7A A:87AB X:0007 Y:0000
$03/A14C D0 05 BNE $05 [$A153] A:87AB X:0007 Y:0000
$03/A153 C9 7C CMP #$7C A:87AB X:0007 Y:0000
$03/A155 D0 05 BNE $05 [$A15C] A:87AB X:0007 Y:0000
$03/A15C C9 C5 CMP #$C5 A:87AB X:0007 Y:0000
$03/A15E D0 05 BNE $05 [$A165] A:87AB X:0007 Y:0000
$03/A165 C9 C4 CMP #$C4 A:87AB X:0007 Y:0000
$03/A167 D0 05 BNE $05 [$A16E] A:87AB X:0007 Y:0000
$03/A16E C9 C2 CMP #$C2 A:87AB X:0007 Y:0000
$03/A170 D0 05 BNE $05 [$A177] A:87AB X:0007 Y:0000
$03/A177 C9 C3 CMP #$C3 A:87AB X:0007 Y:0000
$03/A179 D0 05 BNE $05 [$A180] A:87AB X:0007 Y:0000
$03/A180 C9 C1 CMP #$C1 A:87AB X:0007 Y:0000
$03/A182 D0 05 BNE $05 [$A189] A:87AB X:0007 Y:0000
$03/A189 C9 C0 CMP #$C0 A:87AB X:0007 Y:0000
$03/A18B D0 05 BNE $05 [$A192] A:87AB X:0007 Y:0000
$03/A192 C9 BF CMP #$BF A:87AB X:0007 Y:0000
$03/A194 D0 05 BNE $05 [$A19B] A:87AB X:0007 Y:0000
$03/A19B C9 BE CMP #$BE A:87AB X:0007 Y:0000
$03/A19D D0 05 BNE $05 [$A1A4] A:87AB X:0007 Y:0000
$03/A1A4 C9 BD CMP #$BD A:87AB X:0007 Y:0000
$03/A1A6 D0 05 BNE $05 [$A1AD] A:87AB X:0007 Y:0000
$03/A1AD C9 BC CMP #$BC A:87AB X:0007 Y:0000
$03/A1AF D0 05 BNE $05 [$A1B6] A:87AB X:0007 Y:0000
$03/A1B6 C9 B8 CMP #$B8 A:87AB X:0007 Y:0000
$03/A1B8 F0 04 BEQ $04 [$A1BE] A:87AB X:0007 Y:0000
$03/A1BA C9 B7 CMP #$B7 A:87AB X:0007 Y:0000
$03/A1BC D0 05 BNE $05 [$A1C3] A:87AB X:0007 Y:0000
$03/A1C3 C9 B9 CMP #$B9 A:87AB X:0007 Y:0000
$03/A1C5 D0 05 BNE $05 [$A1CC] A:87AB X:0007 Y:0000
$03/A1CC C9 BA CMP #$BA A:87AB X:0007 Y:0000
$03/A1CE D0 05 BNE $05 [$A1D5] A:87AB X:0007 Y:0000
$03/A1D5 C9 BB CMP #$BB A:87AB X:0007 Y:0000
$03/A1D7 D0 05 BNE $05 [$A1DE] A:87AB X:0007 Y:0000
$03/A1DE C9 B3 CMP #$B3 A:87AB X:0007 Y:0000
$03/A1E0 D0 05 BNE $05 [$A1E7] A:87AB X:0007 Y:0000
$03/A1E7 B5 9E LDA $9E,x [$00:00A5] A:87AB X:0007 Y:0000
$03/A1E9 C9 B2 CMP #$B2 A:87AB X:0007 Y:0000
$03/A1EB D0 05 BNE $05 [$A1F2] A:87AB X:0007 Y:0000
$03/A1F2 C9 AE CMP #$AE A:87AB X:0007 Y:0000
$03/A1F4 D0 05 BNE $05 [$A1FB] A:87AB X:0007 Y:0000
$03/A1FB C9 B6 CMP #$B6 A:87AB X:0007 Y:0000
$03/A1FD D0 05 BNE $05 [$A204] A:87AB X:0007 Y:0000
$03/A204 C9 B0 CMP #$B0 A:87AB X:0007 Y:0000
$03/A206 D0 05 BNE $05 [$A20D] A:87AB X:0007 Y:0000
$03/A20D C9 B1 CMP #$B1 A:87AB X:0007 Y:0000
$03/A20F D0 05 BNE $05 [$A216] A:87AB X:0007 Y:0000
$03/A216 C9 AC CMP #$AC A:87AB X:0007 Y:0000
$03/A218 F0 04 BEQ $04 [$A21E] A:87AB X:0007 Y:0000
$03/A21A C9 AD CMP #$AD A:87AB X:0007 Y:0000
$03/A21C D0 05 BNE $05 [$A223] A:87AB X:0007 Y:0000
$03/A223 C9 AB CMP #$AB A:87AB X:0007 Y:0000
$03/A225 D0 05 BNE $05 [$A22C] A:87AB X:0007 Y:0000
$03/A227 20 17 95 JSR $9517 [$03:9517] A:87AB X:0007 Y:0000

//start of rex specific code
$03/9517 20 7E 96 JSR $967E [$03:967E] A:87AB X:0007 Y:0000
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 356/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 04-04-05 09:47 AM Link | Quote
Oh, Okay, because I need to figure that out so I can decide where to place a JML to custom code for a qpecial sprite I am inserting. I know it might be a bit much, but could you help out a bit more MikeyK?
mikeyk

Koopa
Level: 18

Posts: 51/110
EXP: 25086
For next: 4811

Since: 07-17-04

Since last post: 45 days
Last activity: 44 days
Posted on 04-04-05 12:17 PM Link | Quote
I have inserted all of my created sprites by setting the ASM pointer to 8E 87, tweaking the existing code, and adding a bit more to handle the new sprites.

--------------------------------------------------------------------------
original code
--------------------------------------------------------------------------
//location jumped to by following ASM pointer
$01/878E 22 18 A1 03 JSL $03A118[$03:A118]

//determines which sprite is being handled
$03/A118 8B PHB
$03/A119 4B PHK
$03/A11A AB PLB
$03/A11B B5 9E LDA $9E,x [$00:00A5] //loads sprite number to acc.
$03/A11D C9 C8 CMP #$C8
$03/A11F D0 05 BNE $05 [$A126]
$03/A121 20 F5 C1
$03/A124 AB
$03/A125 6B
$03/A126 C9 C7 CMP #$C7
$03/A128 D0 05 BNE $05 [$A12F]

--------------------------------------------------------------------------
original code to modify
--------------------------------------------------------------------------
Replace $03/A11D through $03/A120 with
5C XX XX XX //jump command to the code below

--------------------------------------------------------------------------
new code
--------------------------------------------------------------------------
C9 C8
F0 10
C9 XX //sprite number of your new enemy
D0 08
22 XX XX XX //JSL to your custom code
5C 24 A1 03
5C 26 A1 03
5C 21 A1 03

Since I really haven't been doing too much with sprite hacking lately, I may release some notes on how i created some sprites from scratch in the next few days.
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 1454/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 04-04-05 03:12 PM Link | Quote
I realized something! Who needs Palette Controlled ASM? All you have to do is to modify a sprite (as long as you can spare one) to execute the wanted code. You can even make one that can execute different code depending on X/Y position and the Extra Data that sprites placed in Lunar Magic can have! AFAIK, it gives 256*4=1024 possible combinations! The possibilities and potential of Sprite Controlled ASM is (next to) endless!

Edit: Also, other things than the sprite's settings can be used to decide which piece of code to execute. For example:
The current level
If you're on the overworld/on a submap
Local screen exit
A few (hidden) blocks in the upper left corner of the level which is read by the sprite code.
If the Rom is unlocked or not (to create Debug functions without having to worry about removing them)
Etc, etc, etc, etc...


(edited by Smallhacker on 04-03-05 10:18 PM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 359/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 04-04-05 11:40 PM Link | Quote
Or you could use both if you really needed to. I'm just wondering how to add custom code for this to finish my NEW final boss, "Duboar". Thanks for how to do that MikeyK. Now all I need to do is ad a RATS tag and write the code. Thanks!


(edited by Darkflight on 04-04-05 08:59 AM)
Atma X

Bandit
Level: 43

Posts: 769/801
EXP: 553639
For next: 11407

Since: 03-16-04
From: Derrière vous!!!

Since last post: 43 days
Last activity: 14 days
Posted on 04-05-05 12:10 AM Link | Quote
Originally posted by Smallhacker
I realized something! Who needs Palette Controlled ASM? All you have to do is to modify a sprite (as long as you can spare one) to execute the wanted code.


It's about damm time someone else started thinking. I was getting worried about all the people who had the idea that they even need to mess with BMF's Palette Routine. All you have to do is find any area of the game that is executing Instructions before the Instrutions that you want to be executed (for example, if you have a routine that you want to be executed during the time that a level is loaded, rendered etc., then simply write a JMP to your routine before the all of the routines for loading a level are done executing, and then write a JMP back to the previous Address).


(edited by Atma X on 04-04-05 07:12 AM)
(edited by Atma X on 04-04-05 07:12 AM)
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 1461/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 04-05-05 12:37 AM Link | Quote
That would affect the entire game (unless you make a piece of code which says "If Mario is on level 105, then do this". The advantage of Palette Controlled ASM (compared to normal ASM addition) is that it only affects the wanted levels, without having to hard code the level numbers. The advantage (or disadvantage) of Sprite Controlled ASM (compared to the others) is that it only affects at most 3 screens, unless you place it once every second or third screen. That way, not the entire level is bound to that piece of code.


(edited by Smallhacker on 04-04-05 07:39 AM)
blackhole89

LOLSEALS
Moderator of ROM hacking
EmuNET IRC network admin
Head GM of TwilightRO
Level: 47

Posts: 615/971
EXP: 739208
For next: 26995

Since: 03-15-04
From: Dresden/Germany

Since last post: 14 hours
Last activity: 12 hours
Posted on 04-05-05 12:41 AM Link | Quote
...and the advantage of writing a hook routine like Atma X described, but making it also check for the current level number or whatever you want, is that you can perfectly do anything about this, like making it run only when mario's X location is even or 5 seconds after you gain a fire flower.
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 363/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 04-05-05 02:15 AM Link | Quote
Now all I need to do is remember what sprite number was used by the extra chuck sprite and overwrite it.
mikeyk

Koopa
Level: 18

Posts: 52/110
EXP: 25086
For next: 4811

Since: 07-17-04

Since last post: 45 days
Last activity: 44 days
Posted on 04-05-05 03:19 AM Link | Quote
I dont know if you have written the code for your new boss yet, but I was curious if you were familiar with some things like drawing sprite graphics, handling interactions with mario or other sprites, etc. I may be able to help you out with some of these if you need it. Glad to see someone taking some steps forward in this area.
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 369/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 04-05-05 04:19 AM Link | Quote
No, I am using only custom blocks with the sprite as an "overlord" to control various parts of the level (modifying it via sensitive custom blocks that react only to this sprtie) The only interactions the sprite will have will be with objects (custom blocks) and a couple palette entries. The only things I would need help with are;

1. Sprite generation/killing, and

2. Sprite X/Y pos editing (to allow the sprite to interact with the custom blocks at only certain times).

If you could help with those I would be very thankful.
Atma X

Bandit
Level: 43

Posts: 770/801
EXP: 553639
For next: 11407

Since: 03-16-04
From: Derrière vous!!!

Since last post: 43 days
Last activity: 14 days
Posted on 04-05-05 10:03 AM Link | Quote
I think I take my comment back, and give it to Blackhole

@Smallhacker: And how do you think the Palette Routine was written,... think about it for a while

Btw, messing with the Palette's Routine isn't neccesarily a bad thing, but from what I've heard, BMF didn't do a very good job with it,... I heard there were some problems with it (I've never used his Palette Routine, so I can't determine what is causing the problems,... I suppose maybe he wrote some Instructions in the middle of the Routine,... which depending on what he wrote, may have messed with the original palette's routine in an undesierable way,... but I don't know, I'd have to take a look at it)

Anyway, I think it's more fun to write my own routines, I personally don't like using someone else's work (but yea, I'm using Nintendo's work,... but I'll be writing my own games soon,... it just takes more time, and time is not something that I have a lot of right now).

Besides the fact that it's not as fun to rewrite other people's work, it also takes longer, because you have to read though it to see what someone else wrote (you could also see what the program does by running it, and think of the kind of Instructions it uses, and the order of execution,... but I still think that doing things from scratch is better)

And one final note,... make sure you get away from scripts,... you'll learn a lot more that way,... and take some time to think about the logics of how a computer really works.


(edited by Atma X on 04-04-05 05:03 PM)
(edited by Atma X on 04-04-05 05:08 PM)
(edited by Atma X on 04-04-05 05:23 PM)
(edited by Atma X on 04-04-05 05:32 PM)
(edited by Atma X on 04-04-05 05:33 PM)
(edited by Atma X on 04-04-05 05:35 PM)
(edited by Atma X on 04-04-05 05:38 PM)
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 1466/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 04-05-05 10:36 AM Link | Quote
Originally posted by Atma X
@Smallhacker: And how do you think the Palette Routine was written,... think about it for a while


I know, but it was made so that ASM hackers wouldn't have to hardcode everything, which makes it much easier.
Atma X

Bandit
Level: 43

Posts: 771/801
EXP: 553639
For next: 11407

Since: 03-16-04
From: Derrière vous!!!

Since last post: 43 days
Last activity: 14 days
Posted on 04-05-05 11:10 AM Link | Quote
But then what if you hard code your own routine (yea, it wouldn't be as much, but it could turn into a lot,... besides, hardcoding is fun as much as it is to not hardcode things ).
But meh,.. for me, I almost always like writing my own stuff from scratch (and for me, writing my own stuff is just as easy as modifying someone else's ,... but then again, it's easy for me,... and not for some of the other people).

There's a lot to learn, but it can actually be learned quite fast,... a hell of a whole lot faster than I expected it would be when I first started (it's been about 4-5 months for me since the begining)

But anyway, the key to it all is to spend a lot of time thinking about the logic.

And remember, Scripts are bad


(edited by Atma X on 04-04-05 06:10 PM)
(edited by Atma X on 04-04-05 06:11 PM)
(edited by Atma X on 04-04-05 06:12 PM)
(edited by Atma X on 04-04-05 06:13 PM)
(edited by Atma X on 04-04-05 06:14 PM)
blackhole89

LOLSEALS
Moderator of ROM hacking
EmuNET IRC network admin
Head GM of TwilightRO
Level: 47

Posts: 617/971
EXP: 739208
For next: 26995

Since: 03-15-04
From: Dresden/Germany

Since last post: 14 hours
Last activity: 12 hours
Posted on 04-05-05 01:18 PM Link | Quote
Sprite hacking is actually quite easy when you consequently try to locate what the 16 bit pointers shown in Mario World Reconfigurator or any other sprite data editor point at. I mean, I am currently running two or three non chuck derivate selfmade bosses in my hack, and they work quite fine (although some handler routine take away dangerously much CPU time already).
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Super Mario World hacking - Sprite ASM pointers | |


ABII


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



Page rendered in 0.027 seconds.