spriterandom
by nambona
Game: smw
Description: some sprites in the whitelist crash and i have no clue why
!okaysprites = OkaySprites_end-OkaySprites !statustile = $0F0D main: LDA $0100 EOR #$14 ORA $9D BEQ + RTL + LDA $14 BEQ .changeall CMP #$C0 BEQ .1left CMP #$90 BEQ .2left CMP #$60 BEQ .3left RTL .1left LDA #$01 STA !statustile LDA #$23 STA $1DFC RTL .2left LDA #$02 STA !statustile LDA #$23 STA $1DFC RTL .3left LDA #$03 STA !statustile LDA #$23 STA $1DFC RTL .changeall LDA #$00 STA !statustile LDA #$29 STA $1DFC LDX #$0B - LDA $14C8,x CMP #$08 BCC ..next LDA #$01 STA $14C8,x ..tryagain JSR RNG LDA $148D CMP.b #!okaysprites BCC ..okay LDA $148E CMP.b #!okaysprites BCS ..tryagain ..okay TAY LDA OkaySprites,y STA $9E,x WDM #$00 ..next DEX BPL - RTL RNG: REP #$20 ; If you know you will be coming here from the SNES side, you can make Accumulator 16-bit, and then jump here to save some time LDA $2137 ;\ PPU registers LDA $213C ;/ ADC $13 ADC $148D ; 36 ADC $14 XBA STA $148D SEP #$20 RTS OkaySprites: db $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0E,$0F,$10 db $1A,$1C,$21,$2D,$2F,$35,$3E,$45,$4F,$50,$59,$5A,$6B,$6C,$74,$75 db $76,$77,$78,$79,$7B,$7E,$7F,$80,$81,$83,$84,$B1,$B9,$BD,$C1,$C7 db $C8,$0D,$11,$13,$14,$15,$16,$18,$1B,$1D,$1E,$1F,$20 db $26,$27,$28,$2A,$2B,$2C,$2E,$30,$31,$32,$37,$38,$39,$3A db $3B,$3C,$3D,$3F,$40,$43,$44,$46,$47,$48,$49,$4A,$4B,$4C db $4D,$4E,$51,$54,$55,$56,$57,$58,$5B,$5C,$5E,$5F,$61 db $62,$63,$64,$65,$66,$67,$6A,$6E,$6F,$70,$71,$72,$73,$7D,$86 db $87,$8A,$8D,$90,$91,$92,$93,$94,$95,$97,$98,$99 db $9C,$9D,$9E,$9F,$A2,$A3,$A5,$A6,$A8,$AA,$AB,$AC,$AD,$AE db $AF,$B2,$B3,$B4,$B6,$B7,$B8,$BA,$BB,$BC,$BE,$BF,$C0,$C2,$C3 db $C4,$E0 .endback to listings