![]() |
Routines |
| Prev: 58334 | Up: Map | Next: 58653 |
|
IM 2 lands here from AliasInterruptRedirect. Plays the next tune note every five ticks and services any pending sound.
|
||||
| Handler_Interrupts | 58476 | PUSH AF | Stash AF, BC, DE, HL and IX. | |
| 58477 | PUSH BC | |||
| 58478 | PUSH DE | |||
| 58479 | PUSH HL | |||
| 58480 | PUSH IX | |||
| 58482 | LD A,R | Return unless bit 7 of the refresh register is set. | ||
| 58484 | BIT 7,A | |||
| 58486 | RET Z | |||
| 58487 | LD A,(25710) | Increase *InterruptTick and return unless it reached 5. | ||
| 58490 | INC A | |||
| 58491 | LD (25710),A | |||
| 58494 | CP 5 | |||
| 58496 | JR NZ,Handler_Interrupts_Done | |||
| 58498 | XOR A | Write 0 to *InterruptTick. | ||
| 58499 | LD (25710),A | |||
| 58502 | LD A,(25714) | Call Sound_Score if bit 4 of *SoundFlags is set. | ||
| 58505 | BIT 4,A | |||
| 58507 | CALL NZ,Sound_Score | |||
| 58510 | LD A,(25715) | Jump to Handler_Interrupts_Beep if *SoundDuration is set. | ||
| 58513 | OR A | |||
| 58514 | JP NZ,Handler_Interrupts_Beep | |||
| 58517 | LD BC,4358 | Call Play_Tune with note length 4358. | ||
| 58520 | CALL Play_Tune | |||
| Handler_Interrupts_Done | 58523 | POP IX | Restore the stashed registers from the stack. | |
| 58525 | POP HL | |||
| 58526 | POP DE | |||
| 58527 | POP BC | |||
| 58528 | POP AF | |||
| 58529 | EI | Enable interrupts. | ||
| 58530 | RET | Return. | ||
|
|
||||
| Handler_Interrupts_Beep | 58531 | DEC A | Decrease *SoundDuration and play a short beep. | |
| 58532 | LD (25715),A | |||
| 58535 | LD B,127 | |||
| 58537 | LD D,12 | |||
| 58539 | CALL Play_Click | |||
| 58542 | JP Handler_Interrupts_Done | Jump to Handler_Interrupts_Done. | ||
|
This entry point is used by the routine at Handler_RoomSixteen.
Click the speaker D times using a random delay.
|
||||
| Play_Click | 58545 | CALL Play_Click_Delay | Toggle bit 4 of the speaker for D iterations. | |
| 58548 | OUT (254),A | |||
| 58550 | CALL Play_Click_Delay | |||
| 58553 | OR 16 | |||
| 58555 | OUT (254),A | |||
| 58557 | DEC D | |||
| 58558 | JR NZ,Play_Click | |||
| 58560 | RET | |||
| Play_Click_Delay | 58561 | PUSH BC | Delay by a random count masked with B. | |
| 58562 | CALL JumpTable_GetRandomNumber | |||
| 58565 | AND B | |||
| 58566 | LD B,A | |||
| 58567 | OR A | |||
| 58568 | JR Z,Play_Click_Done | |||
| Play_Click_Wait | 58570 | NOP | ||
| 58571 | NOP | |||
| 58572 | DJNZ Play_Click_Wait | |||
| Play_Click_Done | 58574 | POP BC | A=*Active_BorderColour. | |
| 58575 | LD A,(25629) | |||
| 58578 | RET | Return. | ||
|
Falling-pitch score sound.
|
||||
| Sound_Score | 58579 | AND %11101111 | Clear bit 4. | |
| 58581 | LD (25714),A | Write A to *SoundFlags. | ||
| 58584 | LD DE,50 | DE=0050. | ||
| 58587 | LD BC,100 | BC=0100. | ||
| 58590 | JP Sound_Square | Jump to Sound_Square. | ||
|
This entry point is used by the routine at Handler_Combination.
Square-wave sound while DE and BC count down.
|
||||
| Sound_Square | 58593 | CALL JumpTable_Delay | Toggle the speaker until both counters are zero. | |
| 58596 | LD A,(25629) | |||
| 58599 | OUT (254),A | |||
| 58601 | CALL JumpTable_Delay | |||
| 58604 | LD A,(25629) | |||
| 58607 | OR 16 | |||
| 58609 | OUT (254),A | |||
| 58611 | DEC BC | |||
| 58612 | LD A,C | |||
| 58613 | OR B | |||
| 58614 | JR Z,Sound_Square_Done | |||
| 58616 | DEC DE | |||
| 58617 | LD A,D | |||
| 58618 | OR E | |||
| 58619 | JR NZ,Sound_Square | |||
| Sound_Square_Done | 58621 | LD A,(25714) | A=*SoundFlags. | |
| 58624 | RET | Return. | ||
|
This entry point is used by the routines at Handler_InventoryItems and Handler_Combination.
Rising-pitch pickup sound.
|
||||
| Sound_Pickup | 58625 | CALL JumpTable_Delay | Toggle the speaker while increasing BC. | |
| 58628 | LD A,(25629) | |||
| 58631 | OUT (254),A | |||
| 58633 | CALL JumpTable_Delay | |||
| 58636 | LD A,(25629) | |||
| 58639 | OR 16 | |||
| 58641 | OUT (254),A | |||
| 58643 | INC BC | |||
| 58644 | DEC DE | |||
| 58645 | LD A,E | |||
| 58646 | OR D | |||
| 58647 | JR NZ,Sound_Pickup | |||
| 58649 | LD A,(25714) | |||
| 58652 | RET | |||
|
View the equivalent code in Booty.
|
||||
| Prev: 58334 | Up: Map | Next: 58653 |