| Routines

8400: The game has just loaded

After the game has loaded, this is where it all starts.
8400 | DI | Disable interrupts
8401 | LD HL,$5BFF | Place the address of the routine at 869F on the stack
8404 | LD (HL),$86
8406 | DEC HL
8407 | LD (HL),$9F
8409 | LD SP,$5BFE
840C | SUB A | Set HL=8500 in a roundabout way
840D | LD L,A
840E | XOR $0A
8410 | LD B,A
8411 | INC B
8412 | LD H,B
8413 | RRC H
8415 | LD C,(HL) | Read through addresses 8500-FFFF, without changing their contents; perhaps this code was once used to descramble the contents of pages 0x85-0xFF, but now all it does is introduce a pause of about 0.47s before displaying the code entry screen
8416 | LD A,L
8417 | XOR C
8418 | XOR H
8419 | LD (HL),C
841A | INC HL
841B | BIT 7,H
841D | JR NZ,$8415
841F | RET | Make an indirect jump to 869F