(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
06-16-24 08:04 AM
0 users currently in SMW Hacking.
Acmlm's Board - I3 Archive - SMW Hacking - POW, On/Off animation routine New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
Kailieann



 





Since: 11-18-05

Last post: 6327 days
Last view: 6327 days
Posted on 09-04-06 05:14 PM Link | Quote
Basically what I wanted to accomplish here was finding out where the game loads the POW flags to check and see if it should activate the POW animations, and see if I could change it to use another RAM address.

Looking for reads of $14AD (Blue POW timer) pulled up about seven addresses, and, one by one I changed them all to EAEAEA to see what would happen.

The last one, $05:BB77 (x2BD77 in a hex editor) did exactly what I hoped it would -- EAing it made it so that the Blue POW activated animations didn't activate.

So I tried making it load $0076 (Mario's position) instead, and sure enough, the animations changed every time Mario turned around.

Further testing revealed that the Silver POW and On/Off animations are handled by the same routine ($14AD indexed with X, where X is 0, 1, or 2).

I disassembled the entire routine, though I honestly have no idea what most of it does.
But I do know that it's really easy to change the animation activators to another three addresses, and it shouldn't be too difficult to JSR elsewhere and set each address individually.

This means that with a little (potentially very little) work, you can have animations activated by just about anything you want.

Anyhow, here's the disassembled part for those of you who know what all this nonsense means. It starts at $05:BB39 and ends at $05:BBA5 (x2BD39 and x2BDA5 in a hex editor)

$05:BB39 8B PHB
$05:BB3A 4B PHK
$05:BB3B AB PLB
$05:BB3C A5 14 LDA $14
$05:BB3E 29 07 AND #$07
$05:BB40 85 00 STA $00
$05:BB42 0A ASL
$05:BB43 65 00 ADC $00
$05:BB45 A8 TAY
$05:BB46 0A ASL
$05:BB47 AA TAX
$05:BB48 C2 20 REP #$20
$05:BB4A A5 14 LDA $14
$05:BB4C 29 18 00 AND #$0018
$05:BB4F 4A LSR
$05:BB50 4A LSR
$05:BB51 85 00 STA $00
$05:BB53 BD 3B B9 LDA,x $B93B
$05:BB56 8D 08 0D STA $0D80
$05:BB59 BD 3D B9 LDA,x $B93D
$05:BB5C 8D 7E 0D STA $0D7E
$05:BB5F BD 3F B9 LDA,x $B93F
$05:BB62 8D 7C 0D STA $0D7C
$05:BB65 A2 04 LDX #$04
$05:BB67 5A PHY
$05:BB68 DA PHX
$05:BB69 E2 20 SEP #$20
$05:BB6B 98 TYA
$05:BB6C BE 6B B9 LDX, $B96B
$05:BB6F F0 17 BEQ 17
$05:BB71 CA DEX
$05:BB72 D0 0D BNE 0D
$05:BB74 BE 7D B9 LDX,y $B97D
$05:BB77 BC AD 14 LDY,x $14AD <= The address to change
$05:BB7A F0 0C BEQ 0C
$05:BB7C 18 CLC
$05:BB7D 69 26 ADC #$26
$05:BB7F 80 07 BRA 07
$05:BB81 AC 31 19 LDY $1931
$05:BB84 18 CLC
$05:BB85 79 8B B9 ADC,y $B98B
$05:BB88 C2 30 REP #$30
$05:BB8A 29 FF 00 AND #$00FF
$05:BB8D 0A ASL
$05:BB8E 0A ASL
$05:BB8F 0A ASL
$05:BB90 05 00 ORA $00
$05:BB92 0A TAY
$05:BB93 B9 99 B9 LDA,y $B999
$05:BB96 E2 10 SEP #$10
$05:BB98 FA PLX
$05:BB99 9D 76 0D STA,x $0D76
$05:BB9C 7A PLY
$05:BB9D C8 INY
$05:BB9E CA DEX
$05:BB9F CA DEX
$05:BBA0 10 C5 BPL -59
$05:BBA2 E2 20 SEP #$20
$05:BBA4 AB PLB
$05:BBA5 6B RTL


Also of potential interest to some people:

00:C563 (DEC,x $14A8) <- Part of the overall timer countdown code. Changing it to EAEAEA makes it so that the POW timers won't run out. (x4763 in a hex editor)

00:F5C6 (LDY $14AD) <- The part of the Coin code that tells it to change its behavior based on the Blue POW timer. Changing it to EAEAEA makes it so that it always acts like a coin, even if the POW switch is active. (x77C6 in a hex editor)
spel werdz rite









Since: 11-19-05

Last post: 6328 days
Last view: 6327 days
Posted on 09-04-06 05:42 PM Link | Quote
Yay! Now I'll try to work on animations that work only when the Blue and Silver POWs are Activated.
Glyphodon



 





Since: 11-18-05

Last post: 6368 days
Last view: 6349 days
Posted on 09-04-06 10:05 PM Link | Quote
Good stuff. I'll see if I can use this information to make doors in my hack that only open if you've beaten the boss or hit a switch or something like that. Also, you should probably post this in the address thread, so this doesn't disappear beneath the shifting posts and be lost to eternity.
Kailieann



 





Since: 11-18-05

Last post: 6327 days
Last view: 6327 days
Posted on 09-05-06 12:19 AM Link | Quote
Well, I managed to cobble together a working override script.

$05:BB74 20 A8 BB ; JSR $BBA8 <- Jumps to new subroutine[1]
$05:BB77 BC 0B 01 ; LDY,x $010B <- The newly relocated address[2]

$05:BBA8 BE 7D B9 ; LDX,y $B97D <- Original code that was overwritten by JSR
$05:BBAB 48 ; PHA
$05:BBAC DA ; PHX
$05:BBAD A2 00 ; LDX #$00
$05:BBAF AD 0D 14 ; LDA $140D <- RAM address to override POW animations[3]
$05:BBB2 9D 0B 01 ; STA,x $010B <- Store in unused RAM [2]
$05:BBB5 E8 ; INX
$05:BBB6 AD 85 00 ; LDA $0085 <- RAM address to override Silver POW[3]
$05:BBB9 9D 0B 01 ; STA,x $010B
$05:BBBC E8 ; INX
$05:BBBD AD FB 1E ; LDA $1EFB <- RAM address to override On/Off[3]
$05:BBC0 9D 0B 01 ; STA,x $010B
$05:BBC3 E8 ; INX
$05:BBC4 FA ; PLX
$05:BBC5 68 ; PLA
$05:BBC6 60 ; RTS


[1] There's a good chunk of free space conveniently located after the original routine. I only left two bytes between the routines, but there's more than enough room for a RATS tag for the paranoid people out there.

[2] I used the ass-end of the game's internal stack as a holding pen for the override addresses because I knew they'd be unused in a clean ROM. Of course, they can easily be relocated anywhere you like.

[3] In order to ensure quick and easy testing, I used the Spin Jump flag as an override for the POW animations. The example Silver POW and On/Off overrides are the Water Level and Special World Passed flags, which both offer some interesting potential.


EDIT: I haven't done a full disassembly yet, but the read of $14AE (Silver POW timer) that tells the game to load the silver coins instead of normal sprites is at $02:A99E
Note that this only applies to newly-generated sprites. I'd run down the POW code itself to see where existing sprites are handled, but I have to go to work


(edited by Kailieann on 09-05-06 07:17 AM)
(edited by Kailieann on 09-05-06 07:20 AM)
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - SMW Hacking - POW, On/Off animation routine |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.012 seconds; used 370.03 kB (max 439.36 kB)