Prev: 49593 Up: Map Next: 49661
49627: Build Random Table
Used by the routine at StartGame.
Fills the 34 bytes at ItemsLeft_Tiles with random numbers from 16 to 31, taken from a random place in the ROM.
The routine then makes the second part of the copy protection check: it returns if bit 7 of the memory refresh register is set (the loader sets it, see Decryption), and resets the computer if not.
BuildRandomTable 49627 CALL IncrementFrameCounter Update the frame counter and the random number generator.
49630 LD HL,(48042) Fetch the random number.
49633 LD A,H Turn it into the address of a random place in the first 4096 bytes of the ROM.
49634 AND 15
49636 LD H,A
49637 LD DE,48080 Point at the table of random numbers.
49640 LD B,34 Set the length of the table to 34 bytes.
BuildRandomTable_Loop 49642 LD A,(HL) Copy a byte of the ROM into the table, after making it a number from 16 to 31, and loop back until the table is full.
49643 INC HL
49644 AND 15
49646 OR 16
49648 LD (DE),A
49649 INC DE
49650 DJNZ BuildRandomTable_Loop
49652 LD A,R Return if the loader has set bit 7 of the memory refresh register.
49654 BIT 7,A
49656 RET NZ
This entry point is used by the routine at CheckPlayerDead.
The memory refresh register has not been set up by the stub, so the game has been tampered with. Reset the computer.
BuildRandomTable_Reset 49657 XOR A The game has been tampered with, so reset the computer.
49658 LD L,A
49659 LD H,A
49660 JP (HL)
Prev: 49593 Up: Map Next: 49661