Routines |
Prev: C2F5 | Up: Map | Next: C33A |
Used by the routines at disbelieve_spell, lightning_spell, dark_power_spell, INTERO, routine20, routine35 and routine80.
|
||||
play_sound_effect_pointer | C2F6 | LD HL,(sound_effect_pointer) | load sound_effect_pointer into HL as address to copy sound data from | |
This entry point is used by the routines at subversion_spell, raise_dead_spell, CHONUM, main_routine, TREPUT, CAST_S, select_spell, display_spell_info, routine07, routine13, disbelieve_spell, lightning_spell, dark_power_spell, INTERO, routine22, routine23, COUNTL, routine24, routine25, routine26, WIZKIL, routine35, routine47, display_object_info, routine72 and routine78.
|
||||
play_sound_effect_in_HL | C2F9 | LD DE,sound_effect_temp | copy ten bytes from address in HL to sound_effect_temp (sound effect playback data) | |
C2FC | LD BC,$000A | |||
C2FF | LDIR | |||
This entry point is used by the routines at disbelieve_spell, lightning_spell, dark_power_spell, routine20, routine26, WIZKIL, routine31, routine32, routine35 and routine80.
|
||||
sound_effect_playback | C301 | DI | disable interrupts | |
C302 | LD HL,sound_effect_temp | load first byte of sound effect playback data into B | ||
C305 | LD B,(HL) | |||
outer_sound_loop | C306 | PUSH BC | preserve BC (outer loop counter) | |
C307 | LD HL,$C2E9 | load second byte of sound_effect_temp data into B | ||
C30A | LD B,(HL) | |||
middle_sound_loop | C30B | PUSH BC | preserve BC (middle loop counter) | |
C30C | LD B,$04 | set B to four as loop counter | ||
C30E | LD HL,$C2EA | set HL to third byte of sound_effect_temp data | ||
inner_sound_loop | C311 | PUSH BC | preserve inner loop counter | |
C312 | PUSH HL | preserve HL | ||
C313 | LD B,(HL) | load byte at HL into B as delay | ||
C314 | CALL sound_playback_delay_routine | call sound_playback_delay_routine | ||
C317 | LD A,(port_FE_output_byte) | load port_FE_output_byte into A | ||
C31A | XOR $30 | XOR with 00110000 (flip bits 4 and 5) | ||
C31C | LD (port_FE_output_byte),A | write result back to port_FE_output_byte | ||
C31F | OUT ($FE),A | output value to port $FE (ULA sound and border) | ||
C321 | POP HL | restore HL | ||
C322 | INC HL | increment HL to point to the next byte in the data block | ||
C323 | POP BC | restore inner loop counter | ||
C324 | DJNZ inner_sound_loop | loop back to inner_sound_loop for 4 iterations | ||
C326 | POP BC | restore middle loop counter | ||
C327 | DJNZ middle_sound_loop | loop back to middle_sound_loop | ||
C329 | LD B,$04 | set B to four | ||
C32B | EX DE,HL | swap HL and DE (so DE = C2EE) | ||
C32C | LD HL,$C2EA | set HL to C2EA | ||
sound_delay_addition_loop | C32F | LD A,(DE) | add byte at address in HL to byte at address in DE and store result at address in HL | |
C330 | ADD A,(HL) | |||
C331 | LD (HL),A | |||
C332 | INC DE | increment DE and HL | ||
C333 | INC HL | |||
C334 | DJNZ sound_delay_addition_loop | loop back to sound_delay_addition_loop three times | ||
C336 | POP BC | restore outer loop counter | ||
C337 | DJNZ outer_sound_loop | loop back to outer_sound_loop | ||
C339 | RET | return |
Prev: C2F5 | Up: Map | Next: C33A |