![]() |
Routines |
| Prev: C1B9 | Up: Map | Next: C1FD |
|
Used by the routine at StartGame.
Fills the 22 bytes at ItemsLeft_Tiles with random numbers from 10 to 1F, 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 | C1DB | CALL IncrementFrameCounter | Update the frame counter and the random number generator. | |
| C1DE | LD HL,($BBAA) | Fetch the random number. | ||
| C1E1 | LD A,H | Turn it into the address of a random place in the first 1000 bytes of the ROM. | ||
| C1E2 | AND $0F | |||
| C1E4 | LD H,A | |||
| C1E5 | LD DE,$BBD0 | Point at the table of random numbers. | ||
| C1E8 | LD B,$22 | Set the length of the table to 22 bytes. | ||
| BuildRandomTable_Loop | C1EA | LD A,(HL) | Copy a byte of the ROM into the table, after making it a number from 10 to 1F, and loop back until the table is full. | |
| C1EB | INC HL | |||
| C1EC | AND $0F | |||
| C1EE | OR $10 | |||
| C1F0 | LD (DE),A | |||
| C1F1 | INC DE | |||
| C1F2 | DJNZ BuildRandomTable_Loop | |||
| C1F4 | LD A,R | Return if the loader has set bit 7 of the memory refresh register. | ||
| C1F6 | BIT 7,A | |||
| C1F8 | 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 | C1F9 | XOR A | The game has been tampered with, so reset the computer. | |
| C1FA | LD L,A | |||
| C1FB | LD H,A | |||
| C1FC | JP (HL) | |||
| Prev: C1B9 | Up: Map | Next: C1FD |