spawner
by circlefriendo
Game: SMW
Description: Summons a configurable sprite
!sprite = $7f9d0a !time = $7f9d0b !reserve = $7f9d0c ; https://smwspeedruns.com/Sprites !mode = $0100|!addr !item_box = $0dc2|!addr !drop_item = $028008 !timer = $7f9d1a lda !mode eor #$14 bne end lda !carl_initialized beq init lda !timer sta $0f0d ; only when frame counter = 0 lda $14 and #$1f bne end lda !timer dec sta !timer beq go_off cmp #$04 bcs end lda #$23 sta $1DFC|!addr rtl go_off: lda !time sta !timer sta $0f04|!addr trigger: ; end if not mode $14 lda !mode eor #$14 bne end ; store current reserve item lda !item_box sta !reserve ; spawn sprite from item box lda !sprite sta !item_box jsl !drop_item ; restore reserve item lda !reserve sta !item_box end: rtl init: !goomba = #$9c lda !goomba sta !sprite lda #$10 sta !time sta !timer lda #$01 sta !carl_initialized rtlback to listings