Prev: C314 Up: Map Next: C34D
C332: The creature's blip: a note chosen by the turn counter
Used by the routine at CREATURE_UPDATE.
Twelve waves at a pitch from BLIP_PITCHES picked by the turn counter's low four bits, if the record was drawn last turn; the flag is cleared, so it sounds once for each time the thing is on the screen. The creature's update calls it (CREATURE_UPDATE). Pentagram has the same bytes, unused.
The villains' update (VILLAIN_WANDER) enters at BLIP_FROM_TABLE, meaning to give each villain its own sixteen pitches from VILLAIN_PITCHES, and misses twice. It loads the table's address into HL, which this routine overwrites with the turn's four bits before adding BC; and the offset it puts in BC, the graphic turned left two bits and cut to its top four, keeps graphic bit 5 as well as the kind, so it is $80, $90, $A0 or $B0 rather than 0 to 48. So a villain's blip is pitched by bytes of the ROM, from $0080 to $00BF, and the four villains' tables are never read (range 4's simulator run saw the villains read their pitches at ROM addresses in each of those four sixteens).
Input
IX the record
BLIP_BY_TURN C332 LD BC,BLIP_PITCHES the creature's pitches
This entry point is used by the routine at VILLAIN_WANDER.
BLIP_FROM_TABLE C335 BIT 1,(IX+$07) BLIP_FROM_TABLE: not drawn last turn, silent; the flag cleared either way
C339 RES 1,(IX+$07)
C33D RET Z
C33E LD A,(TURNS) twelve waves at the pitch for this turn of sixteen
C341 AND $0F
C343 LD L,A
C344 LD H,$00
C346 ADD HL,BC
C347 LD B,(HL)
C348 LD C,$0C
C34A JP BEEP
Prev: C314 Up: Map Next: C34D