Dynamite Dan | Routines |
Prev: FF52 | Up: Map | Next: FFD4 |
Used by the routine at FE45.
|
||||
FF70 | LD A,$00 | Set the border to black | ||
FF72 | OUT ($FE),A | |||
FF74 | CALL $FE1F | Get hash from the screen | ||
FF77 | LD HL,$FE43 | Does it equal the value in FE43? | ||
FF7A | CP (HL) | |||
FF7B | JP Z,$FF89 | Yes, so move on | ||
FF7E | LD HL,$EE48 | Hash is wrong. There's a loading error. Wipe the memory, which will lead to the code at 0000 to be executed, causing a reset. | ||
FF81 | LD BC,$FFFF | |||
FF84 | LD DE,$EE49 | |||
FF87 | LDIR | |||
FF89 | LD HL,$FFA3 | Start of block to decrypt | ||
FF8C | LD BC,$0045 | Length of block | ||
FF8F | LD A,D | D is 12, set up by the code at FE6F. | ||
FF90 | XOR (HL) | Flip bits | ||
FF91 | LD (HL),A | Store decrypted value | ||
FF92 | INC HL | Point to next byte | ||
FF93 | DEC BC | Decrease length | ||
FF94 | LD A,B | Is length 0? | ||
FF95 | OR C | |||
FF96 | JP NZ,$FF8F | Loop back if not | ||
FF99 | CALL $FE31 | Get hash from memory | ||
FF9C | LD HL,$FE44 | Does it equal the value in FE44? | ||
FF9F | CP (HL) | |||
FFA0 | JP NZ,$FF7E | If not, jump back to routine that resets the machine | ||
After the decrypter has run, the next block becomes executable code
|
||||
FFA3 | LD HL,$5DC0 | Start of block | ||
FFA6 | LD BC,$7530 | Length | ||
FFA9 | CALL $FFD4 | Decrypt it | ||
FFAC | LD HL,$5DC0 | Start of block | ||
FFAF | LD BC,$7530 | Length | ||
FFB2 | CALL $FFDE | Decrypt it | ||
FFB5 | LD HL,$FA1C | Move the game into the right place | ||
FFB8 | LD DE,$FF1C | |||
FFBB | LD BC,$9F1D | |||
FFBE | LDDR | |||
FFC0 | LD HL,$A710 | Set value to calculate start position | ||
FFC3 | LD ($5C36),HL | Set CHARS to this value - pretty meaningless if using custom character set | ||
FFC6 | LD BC,$DF10 | Calculate offset to change HL by - -20F0 | ||
FFC9 | XOR A | Reset carry flag | ||
FFCA | SBC HL,BC | Subtract negative offset (ie: adding it) to give C800 | ||
FFCC | LD SP,$FFFF | Put the stack pointer somewhere safe | ||
FFCF | IM 1 | Turn interrupts back on | ||
FFD1 | JP $006F | 006F contains JP (HL) (part of the ROM's NMI handler) | ||
Control passes to the game's main entry point at C800
|
Prev: FF52 | Up: Map | Next: FFD4 |