![]() |
Routines |
| Prev: FE15 | Up: Map | Next: FF6A |
|
One pass is: the keys that are not the knight's own (walking, jumping, fighting, picking up and dropping are read in his update, CREATURE_UPDATE); LIFE printed if it has changed; the message line (SHOW_MESSAGE); and each record from the knight's, the seventh, to the last in use updated by the author's CHE3D (CHE3D). Nothing waits for the frame, so a pass takes as long as it takes. The author's source text, left on the tape, names the places from the use of a thing on: STAR2, USE6 to USE4, ST20 to ST22, STE3, ST3 to ST6 and ST9.
The keys, in order. 9 turns the Kempston joystick on or off (bit 3 of OPTIONS), and waits until no key is held. After a room's first pass its colours are put on (ATTRI) -- it was drawn black on black -- so it appears all at once, and the thing in use is shown again. Then, unless the joystick is being pushed: SPACE and SYMBOL SHIFT together pause the game until a key is pressed; SYMBOL SHIFT and 0 together return from ROOMST, which ends the game; 6 or 7 use the thing in the chosen place; 1 to 5 choose a place and show what is in it.
What using a thing does depends on its kind (+12). Kind 9 carries the knight off to room 30, to where a new game starts him (TELE, TITLE_SCREEN), after SAVE_OBJECT_POSITIONS has saved the room. Kind 6 makes LIFE 99. Kind 5 freezes the room's creatures until he leaves it (bit 7 of GAME_FLAGS: CHE3D then lets everything but the knight only fall). Kind 4 adds 10 to LIFE, to no more than 99. Each of these is used up: its place is emptied, though its record stays among the room's, hidden, and its entry in the object table says room $FE; LIFE is printed again. A thing of any other kind does nothing.
A pass ends with a RET when LIFE is 0: that returns from ROOMST to TITLE_SCREEN, which says GAME OVER.
|
||||
| MAIN_LOOP | FE47 | LD A,$EF | Row 6 to 0: 9 held? | |
| FE49 | CALL INPUT | |||
| FE4C | RRA | |||
| FE4D | RRA | |||
| FE4E | JR NC,MAIN_LOOP_1 | |||
| FE50 | LD A,(OPTIONS) | Turn the joystick on or off | ||
| FE53 | XOR $08 | |||
| FE55 | LD (OPTIONS),A | |||
| MAIN_LOOP_0 | FE58 | XOR A | Wait until no key is held | |
| FE59 | CALL INPUT | |||
| FE5C | JR NZ,MAIN_LOOP_0 | |||
| MAIN_LOOP_1 | FE5E | BIT 2,(IY+GAME_FLAGS-V) | After the room's first pass (bit 2 of GAME_FLAGS)... | |
| FE62 | JR Z,PASS_KEYS | |||
| FE64 | CALL ATTRI | ...put the room's colours on, so it appears at once... | ||
| FE67 | RES 2,(IY+GAME_FLAGS-V) | ...and show the thing in use again | ||
| FE6B | LD A,(SELECTED) | |||
| FE6E | JP SHOW_IN_USE | |||
|
This entry point is used by the routine at DRAW_STILL_THINGS.
|
||||
| PASS_KEYS | FE71 | CALL IN31 | PASS_KEYS: the joystick pushed? Then no more keys this pass | |
| FE74 | JP NZ,START_PASS | |||
| FE77 | LD A,$7F | B = SPACE (bit 0) and SYMBOL SHIFT (bit 1) | ||
| FE79 | CALL INPUT | |||
| FE7C | AND $03 | |||
| FE7E | LD B,A | |||
| FE7F | CP $03 | Both: pause until a key (WAIT) | ||
| FE81 | CALL Z,WAIT | |||
| FE84 | LD A,$EF | Row 6 to 0 again, 0 into the carry | ||
| FE86 | CALL INPUT | |||
| FE89 | RRA | |||
| FE8A | JR NC,MAIN_LOOP_2 | |||
| FE8C | BIT 1,B | 0 with SYMBOL SHIFT: return, ending the game | ||
| FE8E | RET NZ | |||
| MAIN_LOOP_2 | FE8F | AND $0C | STAR2: 6 or 7 (now bits 3 and 2)? Use the thing in the chosen place | |
| FE91 | JR Z,MAIN_LOOP_8 | |||
| FE93 | LD H,$FF | IX = its record (0 for an empty place: its +12 is a ROM byte of kind 15, and nothing happens) | ||
| FE95 | LD L,(IY+SELECTED-V) | |||
| FE98 | LD E,(HL) | |||
| FE99 | INC HL | |||
| FE9A | LD D,(HL) | |||
| FE9B | PUSH DE | |||
| FE9C | POP IX | |||
| FE9E | LD A,(IX+OBJ_KIND) | Kind 9? | ||
| FEA1 | AND $0F | |||
| FEA3 | CP $09 | |||
| FEA5 | JR NZ,MAIN_LOOP_3 | |||
| FEA7 | LD (IY+ROOM-V),$1E | To room 30 | ||
| FEAB | LD B,$00 | Empty the place | ||
| FEAD | LD (HL),B | |||
| FEAE | DEC HL | |||
| FEAF | LD (HL),B | |||
| FEB0 | CALL SAVE_OBJECT_POSITIONS | Save the room's things (SAVE_OBJECT_POSITIONS) | ||
| FEB3 | POP HL | Drop the return to the new game's code, and go in as a new game does (TELE) | ||
| FEB4 | JP TELE | |||
| MAIN_LOOP_3 | FEB7 | CP $06 | USE6: kind 6, LIFE 99 | |
| FEB9 | JR NZ,MAIN_LOOP_4 | |||
| FEBB | LD DE,$0909 | |||
| FEBE | LD (LIFE_TENS),DE | |||
| FEC2 | JR MAIN_LOOP_7 | |||
| MAIN_LOOP_4 | FEC4 | CP $05 | USE5: kind 5, freeze the creatures | |
| FEC6 | JR NZ,MAIN_LOOP_5 | |||
| FEC8 | SET 7,(IY+GAME_FLAGS-V) | |||
| FECC | JR MAIN_LOOP_7 | |||
| MAIN_LOOP_5 | FECE | CP $04 | USE4: kind 4, LIFE's tens up one... | |
| FED0 | JR NZ,MAIN_LOOP_8 | |||
| FED2 | LD A,(LIFE_TENS) | |||
| FED5 | INC A | |||
| FED6 | CP $0A | |||
| FED8 | JR NC,MAIN_LOOP_6 | |||
| FEDA | LD (LIFE_TENS),A | |||
| FEDD | JR MAIN_LOOP_7 | |||
| MAIN_LOOP_6 | FEDF | LD (IY+LIFE_UNITS-V),$09 | ...or at 9 tens already, 99 (ST21) | |
| MAIN_LOOP_7 | FEE3 | LD A,(SELECTED) | ST22: used up -- LIFE to be printed, the place emptied, and shown empty | |
| FEE6 | SET 0,(IY+GAME_FLAGS-V) | |||
| FEEA | LD (HL),$00 | |||
| FEEC | DEC HL | |||
| FEED | LD (HL),$00 | |||
| FEEF | JR SHOW_IN_USE | |||
| MAIN_LOOP_8 | FEF1 | LD A,$F7 | ST20: row 1 to 5; nothing held, on to the pass | |
| FEF3 | CALL INPUT | |||
| FEF6 | JR Z,START_PASS | |||
| FEF8 | LD B,$05 | C = 1, 3, 5, 7 or 9 for keys 1 to 5 | ||
| FEFA | LD C,$FF | |||
| MAIN_LOOP_9 | FEFC | INC C | ||
| FEFD | INC C | |||
| FEFE | RRA | |||
| FEFF | JR C,MAIN_LOOP_10 | |||
| FF01 | DJNZ MAIN_LOOP_9 | |||
| MAIN_LOOP_10 | FF03 | LD A,$9E | The place ($9F to $A7); the one in use already: nothing to do | |
| FF05 | ADD A,C | |||
| FF06 | CP (IY+SELECTED-V) | |||
| FF09 | JR Z,START_PASS | |||
| FF0B | LD (IY+SELECTED-V),A | Choose it | ||
| SHOW_IN_USE | FF0E | LD H,$FF | SHOW_IN_USE (STE3): HL = the record in the place | |
| FF10 | LD L,A | |||
| FF11 | LD E,(HL) | |||
| FF12 | INC HL | |||
| FF13 | LD D,(HL) | |||
| FF14 | EX DE,HL | |||
| FF15 | LD A,H | |||
| FF16 | OR L | |||
| FF17 | JR NZ,MAIN_LOOP_11 | |||
| FF19 | CALL CLEAR_THING_BOX | Empty: clear the box and show the place's number (CLEAR_THING_BOX) | ||
| FF1C | JR START_PASS | |||
| MAIN_LOOP_11 | FF1E | CALL SHOW_THING_IN_USE | Show the thing (SHOW_THING_IN_USE) | |
| START_PASS | FF21 | BIT 0,(IY+GAME_FLAGS-V) | START_PASS (ST3): LIFE changed (bit 0 of GAME_FLAGS)? Then move the printer to x 55, y 12 | |
| FF25 | JR Z,MAIN_LOOP_12 | |||
| FF27 | RES 0,(IY+GAME_FLAGS-V) | |||
| FF2B | CALL PRINT | |||
| FF2E | DEFB $C8,$37,$0C | Print at x 55, y 12 | ||
| FF31 | DEFB $A4 | End of the string | ||
| FF32 | LD A,(LIFE_TENS) | |||
| FF35 | ADD A,$1B | |||
| FF37 | CALL PRINT_CHAR | |||
| FF3A | LD A,(LIFE_UNITS) | |||
| FF3D | ADD A,$1B | |||
| FF3F | CALL PRINT_CHAR | |||
| MAIN_LOOP_12 | FF42 | CALL SHOW_MESSAGE | The message line (SHOW_MESSAGE, at ST9) | |
| FF45 | LD HL,KNIGHT | From the knight's record, the seventh | ||
| FF48 | LD (IY+THIS_RECORD-V),$07 | |||
| FF4C | LD A,(LIFE_TENS) | LIFE 0: return from ROOMST, the game over | ||
| FF4F | OR (IY+LIFE_UNITS-V) | |||
| FF52 | RET Z | |||
| MAIN_LOOP_13 | FF53 | PUSH HL | Update this object (CHE3D) | |
| FF54 | CALL CHE3D | |||
| FF57 | POP HL | |||
| FF58 | LD A,(THIS_RECORD) | The last in use done: next pass | ||
| FF5B | INC (IY+THIS_RECORD-V) | |||
| FF5E | CP (IY+OBJECT_COUNT-V) | |||
| FF61 | JP Z,MAIN_LOOP | |||
| FF64 | LD DE,$0014 | Next record | ||
| FF67 | ADD HL,DE | |||
| FF68 | JR MAIN_LOOP_13 | |||
| Prev: FE15 | Up: Map | Next: FF6A |