Prev: 4000 Up: Map Next: 5E00
5B80: Decryption Routine
Runs "RRD" on each of the 7C00 bytes that start at 5FFF which decrypts the game, and then jumps to SecurityCheck.
Set up the address of the first byte to decrypt and the counters.
GameEntry 5B80 LD HL,$5FFF HL=5FFF (the address of the first byte to decrypt).
5B83 LD BC,$007C BC=007C (B=00 so the inner loop runs 0100 times, and C counts the 7C outer passes).
5B86 XOR A A=00 (and reset the flags).
Rotate the nibbles of each byte, chaining the low nibble of one byte into the high nibble of the next.
Decryption_Loop 5B87 RRD RRD operation on *HL.
5B89 INC HL Move HL on to the next byte to decrypt.
5B8A DJNZ Decryption_Loop Decrease the byte counter (B) by one and loop back to Decryption_Loop until all 0100 bytes have been done.
5B8C DEC C Decrease the pass counter (C) by one and loop back to Decryption_Loop until all 7C passes have been done.
5B8D JR NZ,Decryption_Loop
5B8F JP SecurityCheck Jump to SecurityCheck to run the security check.
View the equivalent code in Lunar Jetman.
Earlier Ultimate games use a much simpler mechanism;
Prev: 4000 Up: Map Next: 5E00