Chase H.Q. | Routines |
Prev: EF22 | Up: Map | Next: F0FE |
Used by the routine at play_music_48k.
|
||||||||
noise | F0C6 | LD E,A | Set E to duration counter | |||||
n_outer_loop | F0C7 | LD D,$32 | Set D to inner counter 50 | |||||
n_loop | F0C9 | LD HL,$9618 | Point at rng_seed | |||||
F0CC | INC (HL) | Increment first byte of rng_seed by 3 | ||||||
F0CD | INC (HL) | |||||||
F0CE | INC (HL) | |||||||
F0CF | LD B,(HL) | Load it into B | ||||||
F0D0 | INC HL | Advance to second byte of rng_seed | ||||||
Note that this is a different order of operations than in rng/rng.
|
||||||||
F0D1 | LD A,(HL) | Subtract 141 from second byte of rng_seed | ||||||
F0D2 | SUB $8D | |||||||
F0D4 | LD (HL),A | |||||||
F0D5 | ADD A,B | Add first and second rng_seed bytes together | ||||||
F0D6 | INC HL | Advance to third byte of seed | ||||||
F0D7 | RLCA | Rotate A left by 1 | ||||||
F0D8 | RRC (HL) | Rotate third byte of seed right by 1 | ||||||
F0DA | ADD A,(HL) | Add it to A | ||||||
F0DB | LD (HL),A | Write it back | ||||||
F0DC | AND $10 | Take a tap off at bit 4 | ||||||
F0DE | JR Z,n_continue | Jump to n_continue if zero | ||||||
n_make_noise | F0E0 | LD A,$18 | Delay for (24 - E) iterations | |||||
F0E2 | SUB E | |||||||
F0E3 | LD B,A | |||||||
n_delay_loop_1 | F0E4 | DJNZ n_delay_loop_1 | Delay | |||||
F0E6 | LD A,$18 | Set EAR + MIC bits | ||||||
F0E8 | OUT ($FE),A | |||||||
F0EA | LD B,E | Delay for E iterations | ||||||
n_delay_loop_2 | F0EB | DJNZ n_delay_loop_2 | Delay | |||||
F0ED | XOR A | Clear EAR + MIC bits | ||||||
F0EE | OUT ($FE),A | |||||||
n_continue | F0F0 | DEC D | Decrement inner counter | |||||
F0F1 | JR NZ,n_loop | Jump to n_loop if non-zero | ||||||
This whole interrupt check is redundant since AND A + RET C results in the return never being taken. Should it be RET NZ instead? RET Z messed things up.
|
||||||||
F0F3 | LD A,($EF14) | Read A from 'LD A' @ pm_wait_for_interrupt -- <interrupt flag> | ||||||
F0F6 | AND A | Set flags | ||||||
F0F7 | RET C | Carry is cleared by AND A so this makes no sense | ||||||
F0F8 | DEC E | Decrement duration counter | ||||||
F0F9 | JR NZ,n_outer_loop | Jump to n_outer_loop if non-zero | ||||||
F0FB | JP pm_wait_for_interrupt | Exit via pm_wait_for_interrupt |
Prev: EF22 | Up: Map | Next: F0FE |