Code Library

From SMWiki
Jump to: navigation, search

People have been hacking SMW for many years now and it's no surprise some routines are common among different hackers. There's no need to recreate the wheel for every patch. Here are some common subroutines.

Block Routines

Shatter.

     LDA #$02
     STA $9C
     JSL $00BEB0
     PHB
     LDA #$02
     PHA
     PLB
     LDA #$00 ;01 for rainbow
     JSL $028663
     PLB

Sprite Routines

Block Shatter. This code then the normal block shatter code.

     LDA $0A ;\
     AND #$F0 ;| Update the position
     STA $9A ;| of the block
     LDA $0B ;| so it doesn't shatter
     STA $9B ;| where the players at
     LDA $0C ;|
     AND #$F0 ;|
     STA $98 ;|
     LDA $0D ;|
     STA $99 ;/
Personal tools