Hey there, any of you know that wavy HDMA code?
..Uhm it makes the screen ripple? Thanks.
..Uhm it makes the screen ripple? Thanks.
LDA #$3F ; enable color math on everything STA $40 LDA #$00 ; use background color instead of subscreen layers STA $44 LDA #$1F ; Put all layers on the main screen STA $212C LDA #$00 ; No layers on subscreen STA $212D
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
LDA #$25 ;Music # STA $1DFB ;Change level music
TAX ; hold song # in X STA $0DDA ;\ this stuff is required by romi's addmusic STA $1DFB ;| LDA #$11 ;| STA $0100 ;/ STZ $4200 ; disable NMI LDA $13BF ;\ stuff required by romi's addmusic PHA ;| STZ $13BF ;| LDA $0DAE ;| PHA ;| LDA $0DAF ;| PHA ;/ PHK ; We push our return address onto the stack PER RETURNADDR-1 TDC ;\ PHA ;| set bank 0 PLB ;/ TXA ; get song # back in A JML [$9741] ; We use the addmusic hijack as ; a pointer to jump to the hack RETURNADDR: ; it loads the song and returns here to the ; return address we pushed PLA ; now just pull all this stuff back STA $0DAF PLA STA $0DAE LDA #$14 STA $0100 PLA STA $13BF LDA #$81 STA $4200 ; reenable NMI
;generates a sprite when touched by Mario with the below parameters ;by smkdan ;Act like whatever JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall ;don't touch those ;NOTE: ;If you want to spawn a stationary shell, select a shelled koopa of the color you like and set INITSTAT to 09 !SPRITENUMBER = $00 ;sprite # to generate !ISCUSTOM = $00 ;set to 01 to generate custom or 00 for standard !INITSTAT = $01 ;change only if the note told you so !XDISP = $0020 ;value added to block position on generation !YDISP = $FFE0 !XSPD = $00 ;speed values !YSPD = $00 Return_l: RTL MarioAbove: MarioSide: RTL MarioBelow: PHY ;preserve Y JSL $02A9DE ;grab sprite slot BMI Return_l ;return if none avaliable TYX ;into X LDA #!INITSTAT ;set to initial status STA $14C8,x ;status LDA #!ISCUSTOM ;if custom set different type table BNE Custom ;Standard: LDA #!SPRITENUMBER ;sprite to generate STA $9E,x ;sprite type JSL $07F7D2 ;clear BRA SkipCustom Custom: LDA #!SPRITENUMBER STA $7FAB9E,x ;custom sprite type table JSL $07F7D2 ;clear JSL $0187A7 ;load tables LDA #$88 ;set as custom sprite STA $7FAB10,X SkipCustom: REP #$20 ;apply xdisp LDA $9A CLC ADC #!XDISP SEP #$20 STA $E4,x XBA STA $14E0,x REP #$20 ;apply ydisp LDA $98 CLC ADC #!YDISP SEP #$20 STA $D8,x XBA STA $14D4,x LDA #!XSPD ;store speeds STA $B6,x LDA #!YSPD STA $AA,x LDA #$02 ;erase self STA $9C JSL $00BEB0 ;generate blank block SpriteV: SpriteH: MarioCape: MarioFireBall: PLY ;restore Y RTL
SpriteV: SpriteH: MarioCape: MarioFireBall: PLY ;restore Y RTL
PLY ;restore Y SpriteV: SpriteH: MarioCape: MarioFireBall: RTL
GetRand: PLA : PHA;even if it's always called from the same spot, it can't hurt PHX;just in case TAX : SBC $06825E,x;add in some garbage so it won't be so sequential SBC $13 : SBC $14 : ADC $0F30 : EOR $0DBF;get some random numbers (the lack of CLC/SEC is intentional) TAX : EOR $068636,x;another random table ADC $2137 : SBC $213C : EOR $213D : ADC $213C : ADC $213D ;throw in the current pixel being drawn by the PPU, in case this routine is called many times per frame TAX : ADC $00,x;and finally add in a random ram address PLX : RTS;and return