Chase H.Q. | Routines |
Prev: EE6E | Up: Map | Next: EF19 |
|
||||
play_music_48k | EE9E | XOR A | Clear <interrupt flag> at pm_wait_for_interrupt | |
EE9F | LD ($EF14),A | |||
EEA2 | LD A,$00 | Counter, self modified by EEA8 below | ||
EEA4 | AND A | Set flags | ||
EEA5 | JR NZ,pm_delay_1 | Jump to pm_delay_1 if non-zero | ||
EEA7 | INC A | Otherwise increment and self modify EEA2 | ||
EEA8 | LD ($EEA3),A | |||
EEAB | JR pm_reset_pattern | Jump to pm_reset_pattern | ||
pm_delay_1 | EEAD | LD A,$00 | Self modified by EEBB, cycles 5,4?,3,2,1 (set to first music data byte) | |
EEAF | DEC A | Decrement and set flags | ||
EEB0 | JP Z,pm_delay_complete | Jump to pm_delay_complete if zero | ||
EEB3 | LD ($EEAE),A | Self modify 'LD A' @ pm_delay_1 above (store decremented) | ||
EEB6 | JP pm_zero_or_456 | Jump to pm_zero_or_456 | ||
pm_delay_complete | EEB9 | LD A,$00 | Self modified by EE8E (set to first music data byte - value for when resetting) | |
EEBB | LD ($EEAE),A | Self modify 'LD A' @ pm_delay_1 above (reset it) | ||
EEBE | LD HL,$0000 | Self modified below, cycles $F12x .. $F2xx ish <addr of next music byte> | ||
Fetch a byte of the form 0bdaaaaiii (d is delay bit, aaaa is argument, iii is instrument index)
|
||||
pm_loop | EEC1 | LD A,(HL) | Fetch a music byte | |
EEC2 | DEC A | Temporarily decrement for testing (will undo later) | ||
EEC3 | JP NZ,pm_continue_pattern | Jump to pm_continue_pattern if the byte is NOT 1 - the terminating byte of the music data | ||
EEC6 | CALL next_pattern | Call next_pattern | ||
pm_reset_pattern | EEC9 | LD HL,$0000 | Self modified by EE94 (set to address of second music data byte) | |
EECC | LD ($EEBF),HL | *$EEBF = HL (Resetting <addr of next music byte> above when we loop) | ||
EECF | JP pm_loop | Loop | ||
pm_continue_pattern | EED2 | INC HL | Advance | |
EED3 | LD ($EEBF),HL | Update <addr of next music byte> above | ||
EED6 | INC A | Compensate for earlier decrement | ||
EED7 | BIT 7,A | Jump if music byte < 128 | ||
EED9 | JR Z,pm_play_inst | |||
A byte of the form 0b1aaaaiii (1 is delay bit)
|
||||
EEDB | AND $7F | Mask off delay bit | ||
EEDD | EX AF,AF' | Bank | ||
EEDE | LD A,$01 | Self modify 'LD A' @ pm_delay_1 (setting <delay data byte thing> to 1) | ||
EEE0 | LD ($EEAE),A | |||
EEE3 | LD ($EF01),A | Self modify 'LD A' @ pm_zero_or_456 below | ||
EEE6 | EX AF,AF' | Unbank | ||
A byte now of the form 0b0aaaaiii
|
||||
pm_play_inst | EEE7 | LD D,A | Save a copy of the byte | |
EEE8 | AND $07 | Extract bottom 3 instrument bits -- must be the command | ||
EEEA | JR Z,pm_zero_or_456 | Jump to pm_zero_or_456 if they're zero | ||
EEEC | LD B,A | Save the instrument | ||
EEED | LD A,D | Extract the four argument bits | ||
EEEE | SRL A | |||
EEF0 | SRL A | |||
EEF2 | SRL A | |||
If NOPped this call seems to make the music halt... not firing interrupts?
|
||||
EEF4 | DEC B | Jump to playdrum_2 if instrument is 1 -- drum 2 | ||
EEF5 | JP Z,playdrum_2 | |||
EEF8 | DEC B | Jump to playdrum_1 if instrument is 2 -- drum 1 | ||
EEF9 | JP Z,playdrum_1 | |||
EEFC | DEC B | Jump to noise if instrument is 3 -- noise | ||
EEFD | JP Z,noise | |||
pm_zero_or_456 | EF00 | LD A,$00 | Self modified by EEE3 above, EF09 below (set to <delay data byte thing>) | |
EF02 | AND A | Set flags | ||
EF03 | JR Z,pm_start_drums | Jump to pm_start_drums if zero (no delay) | ||
EF05 | LD HL,$EEAE | Self modify 'LD A' @ pm_delay_1 (decrementing initial delay counter) | ||
EF08 | DEC (HL) | |||
EF09 | LD HL,$EF01 | Self modify 'LD A' @ pm_zero_or_456 above | ||
EF0C | DEC (HL) | |||
pm_start_drums | EF0D | LD A,$00 | Load <drum is playing flag> -- Self modified by EF33 | |
EF0F | DEC A | Decrement | ||
EF10 | JP Z,pd_bank_go | Jump to pd_bank_go if zero -- resuming? | ||
This entry point is used by the routines at playdrum_2 and noise.
|
||||
pm_wait_for_interrupt | EF13 | LD A,$00 | Loop while waiting for this <interrupt flag> to be set | |
EF15 | AND A | |||
EF16 | JR Z,pm_wait_for_interrupt | |||
EF18 | RET | Return |
Prev: EE6E | Up: Map | Next: EF19 |