Prev: 40418 Up: Map Next: 40504
40439: PlayMusicPhrase
Plays the title-screen jingle: 8 successive 2-note phrases drawn from the phrase table at PhrasePairs. Each phrase byte is a (loA, hiB) pair selecting two notes from NoteTable via PlayNoteByIndex. The inner loop repeats each pair 8 times (so the phrase audibly trills on its 2-note interval), and the keyboard rows are polled between notes — any key press aborts playback via Music_Abort.
Used by the routine at DrawIntroScreen.
40439 LD HL,40398 HL = PhrasePairs base
40442 LD (40416),HL phrase cursor = start of the table
40445 LD B,8 8 two-note phrases
40447 PUSH BC
40448 LD HL,(40416)
40451 LD E,(HL) E = 1st note index,
40452 INC HL
40453 LD D,(HL) D = 2nd note index
40454 INC HL
40455 LD (40416),HL advance the phrase cursor
40458 LD (40414),DE stash the pair where the player below reads it
40462 LD B,8 trill the pair 8 times
40464 PUSH BC
40465 LD A,(40414) 1st note
40468 CALL 40418 PlayNoteByIndex
40471 LD A,(40415) 2nd note
40474 CALL 40418
40477 LD BC,65278 sweep the whole keyboard between notes
40480 IN A,(C)
40482 AND 31 keep the 5 key bits
40484 XOR 31 pressed keys read 0
40486 JR NZ,40499 any key: abort playback
40488 RLC B next half-row
40490 JR C,40480
40492 POP BC
40493 DJNZ 40464
40495 POP BC
40496 DJNZ 40447
40498 RET
40499 POP BC drop the two saved loop counters
40500 POP BC
40501 RET
40502 NOP variable: 255 = keyboard input chosen
40503 NOP variable: the endgame Competence Rating accumulator (see ComputeRating)
Prev: 40418 Up: Map Next: 40504