Prev: 61974 Up: Map Next: 62048
61982: Code sheet - hash/randomize the security code co-ordinates required for input
Used by the routine at 62068.
This routine provides random code sheet co-ordinates for security code entry.
The first 4 bytes at 61974 contain random values (generated at 62089 from the FRAMES system variable timer).
This routine then uses a combination of bit shift and XOR operations to further obfuscate the data at 61974. Ultimately a randomized byte #4 of this set is used to generate the random codesheet co-ordinates.
61982 PUSH HL Store registers
61983 PUSH BC
61984 PUSH IX
61986 LD B,8 8 x iterations of the below
The first 4 pseudo-random bytes at 61974 are altered (using XOR/shifts) with the following 4 (fixed) bytes at 61978.
This process is started once bits 7 is set in the 4th byte just to ensure we've got some data to combine.
61988 LD IX,61974 Pointer to byte 1 of 8 byte data set
61992 AND A Sets (A=0) or unsets (A<>0) zero flag, though the zero flag will be changed in the next instruction anyway
61993 BIT 7,(IX+3) Top bit of 4th byte in data set (61974)
61997 JR Z,62022 If it's zero (bit not set), rotate left first 4 bytes of data set and jump back to 61988
Combine some bytes to further mix up the numbers:
61999 LD HL,61978 Pointer to byte 5 of 8 byte data set
62002 LD C,3 3 iterations
62004 LD A,(IX+0) Mash together (XOR) bytes 1-3 in the table with (fixed) bytes 5-7
62007 XOR (HL)
62008 LD (IX+0),A ...re-storing each one
62011 INC IX Increment both pointers
62013 INC HL
62014 DEC C
62015 JR NZ,62004 Repeat for first three 3 bytes in table
62017 LD IX,61974 Point to the start of the 8 byte set
62021 SCF Set the carry flag ready for the next loop
62022 RL (IX+0) Rotate each of the first 4 bytes
62026 RL (IX+1)
62030 RL (IX+2)
62034 RL (IX+3)
62038 DJNZ 61988 ...and repeat from 61988 (8 iterations)
62040 LD A,(IX+3) Grab the randomized/hashed 4th btye of the table in the A register - this will be used to generate the co-ordinates
62043 POP IX Retrieve registers
62045 POP BC
62046 POP HL
62047 RET A register returned with the number to use to pick the code sheet co-ordinates.
Prev: 61974 Up: Map Next: 62048