Prev: FEA5 Up: Map
FEDE: Main loader (2)
FEDE LD L,$01
FEE0 CALL $FEA5
FEE3 JP NC,$0000
FEE6 LD A,$C6
FEE8 CP B
FEE9 RL L
FEEB LD B,$B0
FEED JP NC,$FEE0
FEF0 LD A,H
FEF1 XOR L
FEF2 LD H,A
FEF3 LD A,D
FEF4 OR E
FEF5 JR NZ,$FEC7
FEF7 LD HL,$4000
FEFA LD BC,$BF24
FEFD LD A,$00
FEFF ADD A,(HL)
FF00 LD E,A
FF01 INC HL
FF02 DEC BC
FF03 LD A,B
FF04 OR C
FF05 LD A,E
FF06 JR NZ,$FEFF
FF08 CP (HL)
FF09 JP NZ,$0000
The rest of the code is not present in the BASIC loader and only loaded after the end of the main tape block.
FF0C LD DE,$5B80 Point DE at the start of the block to decrypt. (5B80)
FF0F LD HL,$53FE Set the intial key in HL to 53FE.
FF12 LD A,(DE) Get the next byte to decrypt.
FF13 XOR (HL) Invert the bits against the key.
FF14 RES 4,H Reset bit 4 in the key.
FF16 XOR (HL) Invert the bits again.
FF17 SET 4,H Set it back again ready for the next pass.
FF19 LD (DE),A Store the decrypted byte.
FF1A DEC HL Decrease the key value.
FF1B INC DE Increase the address to look at.
FF1C LD A,E Has the last address (5B9A) been reached yet?
FF1D CP $9A
FF1F JR NZ,$FF12 Jump back if not.
FF21 JP $5B94 Otherwise run the main decrypter.
Prev: FEA5 Up: Map