Prev: D260 Up: Map Next: D2E9
D290: Main entry point
When the game has loaded, the ROM loading routine returns to here
D290 NOP This does nothing except waste a bit of time.
D291 NOP
D292 NOP
D293 NOP
D294 NOP
D295 NOP
D296 NOP
D297 NOP
D298 NOP
D299 NOP
D29A NOP
D29B NOP
D29C NOP
D29D LD IX,$D5B9 Point to the start of the theme tune (D5B9).
D2A1 LD E,(IX+$00) Put the pitch in DE.
D2A4 LD D,(IX+$01)
D2A7 LD L,(IX+$02) Put the length in HL.
D2AA LD H,(IX+$03)
D2AD LD A,L If the length is 0, don't play a note, but pause instead.
D2AE OR H
D2AF JP Z,$D2CF
D2B2 PUSH IX Play the BEEP routine in the ROM.
D2B4 CALL $03B5
D2B7 POP IX
D2B9 LD DE,$0004 Move onto the next note.
D2BC ADD IX,DE
D2BE LD A,(IX+$01) If the second byte of the pitch is FF , the tune is finished, so move on.
D2C1 CP $FF
D2C3 JR Z,$D2D5
D2C5 IN A,($FE) See if a key was pressed.
D2C7 AND $1F
D2C9 XOR $1F
D2CB JR Z,$D2A1 If no key pressed, then loop back to play another note.
D2CD JR $D2D5 Otherwise, move on.
At this point, there is a rest in the tune.
D2CF LD B,E Pause for the relevant amount of time.
D2D0 HALT
D2D1 DJNZ $D2D0
D2D3 JR $D2B9 Loop back for another note.
The tune has finished, or was stopped by pressing a key.
D2D5 LD HL,$F7D6 Load F7D6 (start a new game) on the stack so the call to D254 will return here.
D2D8 PUSH HL
D2D9 LD HL,$4000 Clear the screen.
D2DC LD DE,$4001
D2DF LD BC,$17FF
D2E2 LD (HL),$00
D2E4 LDIR
D2E6 JP $D254 Copy the screen to the working buffer, then jump to D254.
Prev: D260 Up: Map Next: D2E9