I have a piece of code using the Stack & RST40 calculator, plays a few notes and then bums out with Int error. Any ideas. Not really sure what I'm doing to be honest. Ive seen use of this method in a few games I've disassembled - but can't seem o get it to work for me. Any help much appreciated, cheers
Code: Select all
org $8000
di
ld hl, tablea ; $61da
ld (pointer),hl
ld b, $ff
MainLoop
call PlayNote
MainLoopCont
jp MainLoop
Exit
pop hl ; clear stack of RET address
loop
jp loop
PlayNote
ld hl, (pointer)
ld a,(hl)
cp $00
jp z, Exit
srl a
call $2d28
rst 40
defb $a4,$a4,$04,$05,$38
ld hl,(pointer)
inc hl
ld a, (hl)
inc hl
ld (pointer),hl
call $2d28
ld hl, (pointer)
dec hl
bit 7,(hl)
jp z, PlayNotejp1
rst 40
defb $1b,$38
PlayNotejp1
call $03f8
ret ; reurn to MainLoopCont
pointer defw 0
tablea
defb $c0,$00,$20,$00,$20,$02,$40,$03,$20,$02,$20,$00,$20,$82,$20,$00
defb $40,$02,$ff,$85,$00,$00,$00,$00,$00,$00,$8c,$c8,$c0,$80,$ff,$ff
end $8000