(5) Timer channel 0 interrupt routine
Clear the status register flag to stop the interrupt signal.
Save registers to the stack area.
Read COUNT and, if it is not 0, decrement it by one and store
the value in COUNT and end.
If COUNT is 0, increment MUSIC_ADRS by two to address the next
tone.
Read the next tone to check to see if it is H'FFFF (iteration
of the last tone).
If the next tone is H'FFFF (iteration of the last tone), stop
timer ch0 and reset MUSIC_ADRS to the same initial value as set in the
main routine. Reset the COUNT address to 0.
If the next sound is not H'FFFF (iteration of the last sound),
start timer ch0 and store the sound data length (R0L) at the COUNT
address.
R0H designates the order from the top of the (6) scale and GRA
setting value correspondence table. If ER4 is set to 0 and R4L is
loaded with the value of R0H, ER4 will then indicate the order from the
top of the table in 32-bit terms. Read the corresponding value of
GRA from the table and set it in GRA.
If the read value is H'FFFF(rest), stop timer ch3 to suppress
sound output.
Restore the registers from the stack and return from the interrupt
handler.
|