Prev: AE98 Up: Map Next: AF7F
AF6C: Cold start
Wipes the game's whole RAM -- $5BA0 to $6107, 1384 bytes -- and falls into main. The one thing it keeps is the ROM's frame counter, which it reads before the wipe and writes back afterwards as the first random seed. A machine that has been switched on for a different length of time therefore gets a different castle.
The read has to come first for a second reason: FRAMES, at $5C78, lies inside the object table (it is byte 16 of object 3), so the wipe destroys it.
START AF6C LD HL,$5BA0 $5BA0 to $6107: the variables and all 40 object records
AF6F LD BC,$0568
AF72 LD A,($5C78) FRAMES, the ROM's 50Hz counter, as the seed
AF75 PUSH AF
AF76 CALL clr_mem clear them, and take the seed back
AF79 POP AF
AF7A LD ($5BA0),A put it back where the wipe cannot reach it
AF7D JR main and set up a game
Prev: AE98 Up: Map Next: AF7F