Up: Map Next: 5D4C
5D0C: Game loader - load game code and set execution starting address
First short block of data on the tape.
Start by copying the routine below, starting at 5D1A, to near the top of RAM (FDE8)
5D0C LD HL,$5D1A
5D0F LD DE,$FDE8
5D12 LD BC,$003C 60 bytes of code to copy
5D15 LDIR Copy the code
5D17 JP $FDE8 ...now jump there and execute the code
Start of code that is copied to FDE8
5D1A LD SP,$FFFA Put the stack pointer (nearly) at the top of RAM
5D1D LD IX,$61A9 IX = address pointer at start of data block to LOAD
5D21 LD DE,$9858 Data block length (code up to RAM address 64000)
5D24 LD A,$FF Indicates a data block to load (rather than header)
5D26 SCF Sets the carry flag, which tells the ROM routine to perform a LOAD
The next 4 instructions are part of the ROM loading routine just before 1377, executed here just before the jump there at 5D2E (as it's loading data, not a header block).
5D27 INC D
5D28 EX AF,AF'
5D29 DEC D
5D2A DI
5D2B LD HL,$FDFF This is the address that the code in the following instructions (starting from 5D31) will be at after the copy at the start of this routine.
5D2E JP $0561 Launch the ROM loading routine
The following code is copied to FDFF and is executed from there once the game has loaded (see this address for disassembly).
5D31 LD HL,$61A9
5D34 LD DE,$9858
5D37 LD A,(HL)
5D38 XOR $66
5D3A RRCA
5D3B XOR L
5D3C LD (HL),A
5D3D INC HL
5D3E DEC DE
5D3F LD A,D
5D40 OR E
5D41 JR NZ,$5D37
5D43 LD A,$02
5D45 LD ($5C6B),A
5D48 EI
5D49 JP $F34B
Up: Map Next: 5D4C