Prev: F8B0 Up: Map Next: F8F5
F8B9: Drum sample players
Input
A Calling this <speed value> (8/3/1 seem to be the used values in practice)
b7_playdrum_X F8B9 LD HL,$F406 Load address of drum X data
F8BC LD D,$5E 94 sample bytes
F8BE JR es_playdrum_go Jump to es_playdrum_go
b7_playdrum_Y F8C0 LD HL,$F464 Load address of drum Y data
F8C3 LD D,$A0 160 sample bytes
es_playdrum_go F8C5 LD ($F3E2),A Self modify b7pd_go below, setting the <speed value> to A as passed in
F8C8 LD A,$01 Self modify b7pm_start_drums above, setting the <drum is playing> flag to 1
F8CA LD ($F3B6),A
F8CD JR b7pd_go Jump to b7pd_go
b7pd_bank_go F8CF EXX Bank
b7pd_go F8D0 LD B,$08 <speed value> iterations. Self modified by es_playdrum_go above
b7pd_loop F8D2 LD A,$10 Set speaker flag
F8D4 NOP Delay
F8D5 BIT 7,(HL) Test a sample bit
F8D7 JR NZ,b7pd_output_bit Set speaker flag to match sample bit
F8D9 RES 4,A
b7pd_output_bit F8DB OUT ($FE),A Output it
F8DD RLC (HL) Rotate sample byte in-place
F8DF DJNZ b7pd_loop Loop to pd_loop while B
F8E1 INC HL Move to next sample byte
F8E2 DEC D Decrement sample bytes remaining
F8E3 JR Z,b7pd_end_of_sample Jump to pd_end_of_sample if no bytes remain
F8E5 LD A,($F3BC) Read A from the <interrupt flag> at b7pm_wait_for_interrupt
F8E8 AND A Set flags
F8E9 JP Z,$F3E1 Loop to pd_go if clear
F8EC EXX Otherwise unbank
F8ED RET Return
b7pd_end_of_sample F8EE XOR A Self modify b7pm_start_drums above, clearing the <drum is playing> flag now that the sample has finished
F8EF LD ($F3B6),A
F8F2 JP $F3BB Jump to pm_wait_for_interrupt
Prev: F8B0 Up: Map Next: F8F5