Prev: 40416 Up: Map Next: 40439
40418: PlayNoteByIndex
Plays one beeper note via the ZX Spectrum ROM BEEP routine at $03B5. Input: A = note index (0..8) into NoteTable at 40362. Each table entry is 4 bytes: 2-byte duration (passed in DE) and 2-byte period in T-states (passed in HL). Used twice per inner iteration of PlayMusicPhrase.
40418 ADD A,A A *= 2
40419 ADD A,A A *= 2 (now A = index × 4 = byte offset)
40420 LD E,A
40421 LD D,0 DE = byte offset
40423 LD HL,40362 HL → NoteTable base
40426 ADD HL,DE HL → 4-byte entry for note A
40427 LD E,(HL)
40428 INC HL
40429 LD D,(HL) DE = duration (cycles)
40430 INC HL
40431 LD A,(HL)
40432 INC HL
40433 LD H,(HL)
40434 LD L,A HL = T-state period
40435 CALL 949 ROM BEEP at $03B5 — play tone
40438 RET
Prev: 40416 Up: Map Next: 40439