SMW already has a routine for this:
Make sure that $98, $99, $9A, and $9B are set the appropriate values.
Code
LDA #!type-1 STA $04 LDA #!action ; block action. e.g., 0 = nothing 6 = coin, 7 = multi-coin, others spawn sprites. STA $05 LDA #!direction ; 0 = up, 1 = right, 2 = left, 3 = down STA $06 LDA #!block_to_spawn ; the $9C value block to spawn when the bounce sprite is finished. STA $07 JSL $028752
Make sure that $98, $99, $9A, and $9B are set the appropriate values.