![]() |
Routines |
| Prev: AF05 | Up: Map | Next: AF79 |
|
Used by the routine at AFTER_GAME.
At every new game (AFTER_GAME). Gives each of the 36 places at PLACES a graphic and puts it where it starts, copying +1 to +4 (U, V, Z, room) to +5 to +8. The kinds of valve go round in order, 96, 97, 98, 99 and again, from a random starting kind -- the seed plus the refresh register -- so there are nine of each or near it -- but see the extra lives below: they fall 16 places apart and the kinds repeat every 4, so every extra life replaces a valve of the same kind, and a deal gives 9, 9, 9 and 7 of the four kinds, or 9, 9, 9 and 6 in a game with three extra lives (one in four). Then one kind has exactly the six its sockets need, and losing one valve (BOXES_INTERSECT) leaves the game unwinnable (the counts measured; the consequence inferred). Every sixteenth place by a second count, started from the random number, gets an extra life (graphic 12) instead, and the kind that would have gone there is skipped: two or three extra lives a game.
Knight Lore's init_special_objects, which deals eight kinds in turn, the eighth its extra life; here four kinds, and the extra lives by a count of their own. The chambers want six valves of each kind (SOCKET: six sockets of each).
|
||||
| INIT_SPECIAL_OBJECTS | AF3F | LD HL,PLACES | the first place | |
| AF42 | LD A,(SEED) | E: the kind to deal next, from the seed and R | ||
| AF45 | LD E,A | |||
| AF46 | LD A,R | |||
| AF48 | ADD A,E | |||
| AF49 | LD E,A | |||
| AF4A | LD A,(RANDOM) | D: the count for the extra lives, from the random number | ||
| AF4D | LD D,A | |||
| INIT_SPECIAL_OBJECTS_0 | AF4E | DEC D | every sixteenth: an extra life | |
| AF4F | LD A,D | |||
| AF50 | AND $0F | |||
| AF52 | JR Z,INIT_SPECIAL_OBJECTS_2 | |||
| AF54 | LD A,E | a valve of the next kind, 96-99 | ||
| AF55 | AND $03 | |||
| AF57 | OR $60 | |||
| INIT_SPECIAL_OBJECTS_1 | AF59 | LD (HL),A | its graphic; the next kind | |
| AF5A | INC HL | |||
| AF5B | INC E | |||
| AF5C | PUSH DE | +1 to +4, where it starts, to +5 to +8, where it is | ||
| AF5D | EX DE,HL | |||
| AF5E | LD HL,$0004 | |||
| AF61 | ADD HL,DE | |||
| AF62 | EX DE,HL | |||
| AF63 | LD BC,$0004 | |||
| AF66 | LDIR | |||
| AF68 | EX DE,HL | until the graphic table at GRAPHICS, after the last place | ||
| AF69 | PUSH HL | |||
| AF6A | LD BC,GRAPHICS | |||
| AF6D | AND A | |||
| AF6E | SBC HL,BC | |||
| AF70 | POP HL | |||
| AF71 | POP DE | |||
| AF72 | JR C,INIT_SPECIAL_OBJECTS_0 | |||
| AF74 | RET | |||
| INIT_SPECIAL_OBJECTS_2 | AF75 | LD A,$0C | an extra life | |
| AF77 | JR INIT_SPECIAL_OBJECTS_1 | |||
| Prev: AF05 | Up: Map | Next: AF79 |