![]() |
Routines |
| Prev: 5F9C | Up: Map |
|
Used by the routine at F5BE. The main entry point is used to play the theme tune.
|
||||||||
| 5F9D | LD HL,$5C3B | Reset bit 5 at 5C3B, clearing the record of any keypresses before the tune starts | ||||||
| 5FA0 | RES 5,(HL) | |||||||
| 5FA2 | LD HL,$DC40 | The theme tune data starts at DC41 | ||||||
|
This entry point is used by the routine at 5D63 with HL=DC2C-1 (the up-a-year tune data starts at DC2C).
|
||||||||
| 5FA5 | DI | Disable interrupts | ||||||
| 5FA6 | INC HL | Point HL at the next tune datum | ||||||
| 5FA7 | LD A,(HL) | Pick it up | ||||||
| 5FA8 | INC A | Is it an end-of-section marker? | ||||||
| 5FA9 | JR NZ,$5FB0 | Jump if not | ||||||
| 5FAB | INC HL | Point HL at the first datum in the next section | ||||||
| 5FAC | LD A,(HL) | |||||||
| 5FAD | INC HL | |||||||
| 5FAE | LD H,(HL) | |||||||
| 5FAF | LD L,A | |||||||
| 5FB0 | LD A,(HL) | A=tune datum | ||||||
| 5FB1 | AND A | Have we reached the end of the tune? | ||||||
| 5FB2 | JP Z,$F2D9 | Jump if so | ||||||
|
A non-zero tune datum has been found, meaning the tune is not finished yet.
|
||||||||
| 5FB5 | PUSH HL | Save the tune data table pointer | ||||||
| 5FB6 | RRCA | Set the carry flag if we should pause briefly | ||||||
| 5FB7 | LD B,A | Copy the right-rotated tune datum to B | ||||||
| 5FB8 | JR NC,$5FC2 | Jump unless we should pause briefly | ||||||
| 5FBA | LD D,$0F | Pause briefly | ||||||
| 5FBC | DEC E | |||||||
| 5FBD | JR NZ,$5FBC | |||||||
| 5FBF | DEC D | |||||||
| 5FC0 | JR NZ,$5FBC | |||||||
| 5FC2 | AND $07 | 0<=A<=7 | ||||||
| 5FC4 | LD C,A | C=border colour for this note | ||||||
| 5FC5 | ADD A,A | Point HL at an entry in the note duration/pitch data table at 5FF0 | ||||||
| 5FC6 | ADD A,$F0 | |||||||
| 5FC8 | LD L,A | |||||||
| 5FC9 | LD H,$5F | |||||||
| 5FCB | LD A,B | A=original tune datum rotated right one bit | ||||||
| 5FCC | RRCA | Obtain the note frequency parameter in E and the note duration parameter in HL | ||||||
| 5FCD | RRCA | |||||||
| 5FCE | RRCA | |||||||
| 5FCF | AND $0F | |||||||
| 5FD1 | LD B,A | |||||||
| 5FD2 | LD E,(HL) | |||||||
| 5FD3 | INC L | |||||||
| 5FD4 | LD A,(HL) | |||||||
| 5FD5 | LD HL,$0000 | |||||||
| 5FD8 | ADD HL,DE | |||||||
| 5FD9 | DJNZ $5FD8 | |||||||
| 5FDB | RES 0,L | |||||||
| 5FDD | LD E,A | |||||||
| 5FDE | LD A,C | Produce a note | ||||||
| 5FDF | OUT ($FE),A | |||||||
| 5FE1 | XOR $10 | |||||||
| 5FE3 | LD C,A | |||||||
| 5FE4 | LD B,E | |||||||
| 5FE5 | DJNZ $5FE5 | |||||||
| 5FE7 | DEC HL | |||||||
| 5FE8 | DEC L | |||||||
| 5FE9 | LD A,H | |||||||
| 5FEA | OR L | |||||||
| 5FEB | JR NZ,$5FDE | |||||||
| 5FED | POP HL | Restore the tune data table pointer to HL | ||||||
| 5FEE | JR $5FA6 | Pick up the next tune datum | ||||||
| Prev: 5F9C | Up: Map |