Routines |
Prev: 57706 | Up: Map | Next: 57863 |
Generic white noise sound effects, crunching, stepping sounds - e.g. doors opening/closing, creature footsteps. Also used to generate the thunder sound in the intro lightning routine.
|
||||
57815 | LD (60247),HL | Preserve HL for this routine | ||
57818 | LD A,(60246) | Counter/frequency for sound effect | ||
57821 | LD B,A | Store in B register | ||
57822 | CP 0 | |||
57824 | JR Z,57859 | |||
57826 | DEC A | Decrement counter and store | ||
57827 | LD (60246),A | |||
57830 | LD A,B | Retrieve (pre-decremented) counter | ||
57831 | AND 7 | Check bits 0-2 to cause an occasional change of address for the base address pointer | ||
57833 | LD HL,(60249) | Get byte from address pointer in readiness | ||
57836 | LD A,(HL) | |||
57837 | JR NZ,57850 | |||
Every 8 loops, move to a different address for the byte value to base the effect on:
|
||||
57839 | INC HL | Skip to the next address | ||
57840 | LD (60249),HL | ..and store address pointer | ||
57843 | LD A,(HL) | |||
57844 | JR NZ,57850 | Repeat of condition that was checked at 57837 | ||
57846 | INC HL | Skip another address | ||
57847 | LD (60249),HL | ...and re-store counter | ||
Use pseudo-random byte to generate sound:
|
||||
57850 | INC B | Shift sound byte based on counter - randomize speaker bit | ||
57851 | RLA | |||
57852 | DJNZ 57851 | |||
57854 | SBC A,A | Based on the (randomized) carry flag the subtraction will cause the speaker bit to be either on or off (50/50) | ||
57855 | AND 16 | Filter out everything except speaker bit (bit 4) | ||
57857 | OUT (254),A | Output value to speaker (1 or 0) | ||
57859 | LD HL,(60247) | Retrieve HL register pair value preserved at the start of the routine | ||
57862 | RET |
Prev: 57706 | Up: Map | Next: 57863 |