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
  
User name:
Password:
Reply:
 

UserPost
blackhole89
Posts: 617/971
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).
Atma X
Posts: 771/801
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
Smallhacker
Posts: 1466/2273
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
Posts: 770/801
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.
Sukasa
Posts: 369/1981
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.
mikeyk
Posts: 52/110
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
Posts: 363/1981
Now all I need to do is remember what sprite number was used by the extra chuck sprite and overwrite it.
blackhole89
Posts: 615/971
...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.
Smallhacker
Posts: 1461/2273
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.
Atma X
Posts: 769/801
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).
Sukasa
Posts: 359/1981
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!
Smallhacker
Posts: 1454/2273
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...
mikeyk
Posts: 51/110
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.
Sukasa
Posts: 356/1981
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
Posts: 50/110
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
Posts: 350/1981
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?
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.004 seconds.