![]() |
Routines |
Prev: 24476 | Up: Map |
Used by the routine at 62910. The main entry point is used to play the theme tune.
|
|||||||
24477 | LD HL,23611 | Reset bit 5 at 23611, clearing the record of any keypresses before the tune starts | |||||
24480 | RES 5,(HL) | ||||||
24482 | LD HL,56384 | The theme tune data starts at 56385 | |||||
This entry point is used by the routine at 23907 with HL=56364-1 (the up-a-year tune data starts at 56364).
|
|||||||
24485 | DI | Disable interrupts | |||||
24486 | INC HL | Point HL at the next tune datum | |||||
24487 | LD A,(HL) | Pick it up | |||||
24488 | INC A | Is it an end-of-section marker? | |||||
24489 | JR NZ,24496 | Jump if not | |||||
24491 | INC HL | Point HL at the first datum in the next section | |||||
24492 | LD A,(HL) | ||||||
24493 | INC HL | ||||||
24494 | LD H,(HL) | ||||||
24495 | LD L,A | ||||||
24496 | LD A,(HL) | A=tune datum | |||||
24497 | AND A | Have we reached the end of the tune? | |||||
24498 | JP Z,62169 | Jump if so | |||||
A non-zero tune datum has been found, meaning the tune is not finished yet.
|
|||||||
24501 | PUSH HL | Save the tune data table pointer | |||||
24502 | RRCA | Set the carry flag if we should pause briefly | |||||
24503 | LD B,A | Copy the right-rotated tune datum to B | |||||
24504 | JR NC,24514 | Jump unless we should pause briefly | |||||
24506 | LD D,15 | Pause briefly | |||||
24508 | DEC E | ||||||
24509 | JR NZ,24508 | ||||||
24511 | DEC D | ||||||
24512 | JR NZ,24508 | ||||||
24514 | AND 7 | 0<=A<=7 | |||||
24516 | LD C,A | C=border colour for this note | |||||
24517 | ADD A,A | Point HL at an entry in the note duration/pitch data table at 24560 | |||||
24518 | ADD A,240 | ||||||
24520 | LD L,A | ||||||
24521 | LD H,95 | ||||||
24523 | LD A,B | A=original tune datum rotated right one bit | |||||
24524 | RRCA | Obtain the note frequency parameter in E and the note duration parameter in HL | |||||
24525 | RRCA | ||||||
24526 | RRCA | ||||||
24527 | AND 15 | ||||||
24529 | LD B,A | ||||||
24530 | LD E,(HL) | ||||||
24531 | INC L | ||||||
24532 | LD A,(HL) | ||||||
24533 | LD HL,0 | ||||||
24536 | ADD HL,DE | ||||||
24537 | DJNZ 24536 | ||||||
24539 | RES 0,L | ||||||
24541 | LD E,A | ||||||
24542 | LD A,C | Produce a note | |||||
24543 | OUT (254),A | ||||||
24545 | XOR 16 | ||||||
24547 | LD C,A | ||||||
24548 | LD B,E | ||||||
24549 | DJNZ 24549 | ||||||
24551 | DEC HL | ||||||
24552 | DEC L | ||||||
24553 | LD A,H | ||||||
24554 | OR L | ||||||
24555 | JR NZ,24542 | ||||||
24557 | POP HL | Restore the tune data table pointer to HL | |||||
24558 | JR 24486 | Pick up the next tune datum |
Prev: 24476 | Up: Map |