Prev: 5E71 Up: Map Next: 5E77
5E76: Decrypt a data block (first run)
Used by the routine at 5E52.
Input
HL Start address
The length is taken as the top value on the stack. This routine is modified when run, changing the code for subsequent runs
5E76 POP BC Get the length off the stack - 3A
5E77 LD A,(HL) Put the next byte in A
5E78 NEG Invert its sign
5E7A LD (HL),A Store it
5E7B INC HL Point to next byte
5E7C DJNZ $5E77 Loop round if more to do
5E7E POP HL Take HL off the stack - 67ED
5E7F LD ($5E78),HL Modify the above instruction to read RRD (ED, 67)
5E82 POP BC Get the next length off the stack (3A)
5E83 LD A,$C9 Change the above code to return early after the loop at 5E7C
5E85 LD ($5E7E),A
5E88 LD A,$00 Remove the above LD (HL), A - as RRD does a bit shift across A and (HL) it is not required
5E8A LD ($5E7A),A
5E8D PUSH DE Restore original start of 5E12 in HL
5E8E POP HL
5E8F RET Return to decrypt again at 5E77
Prev: 5E71 Up: Map Next: 5E77