Routines |
Prev: 26997 | Up: Map | Next: 27352 |
27136 | CALL 27765 | Draw Magic Knight's current room, draw objects and characters and initialise room-specific data | ||
This entry point is used by the routine at 26997.
|
||||
27139 | CALL 28457 | Set Magic Knight's velocity to zero, if appropriate move to new room, execute room-specific routine | ||
27142 | CALL 27357 | Handle Magic Knight's fall | ||
27145 | LD A,127 | Reset bit 7 in A to select the keyboard half-row SPACE - B | ||
27147 | IN A,(254) | Read the keyboard | ||
27149 | RRA | Reset carry flag if SPACE pressed, else set it | ||
27150 | JR C,27163 | SPACE was not pressed, so skip ahead to 27163 | ||
27152 | LD A,254 | Reset bit 0 in A to select the keyboard half-row SHIFT - V | ||
27154 | IN A,(254) | Read the keyboard | ||
27156 | RRA | Reset carry flag if SHIFT pressed, else set it | ||
27157 | LD HL,44552 | Point HL at "BREAK KEY PRESSED" text | ||
27160 | JP NC,55685 | If SHIFT was pressed (i.e. SHIFT-SPACE, or BREAK) jump to "game over" window routine and return to control selection menu | ||
27163 | CALL 27508 | Kill Magic Knight's x-velocity if he cannot horizontally pass through a block beside him | ||
27166 | CALL 54942 | Capture keyboard or joystick input loading result into A | ||
27169 | BIT 0,A | If "left" pressed then... | ||
27171 | JR NZ,27198 | Skip ahead to "move left" subroutine | ||
27173 | BIT 1,A | If "right" pressed then... | ||
27175 | JR NZ,27236 | Skip ahead to "move right" subroutine | ||
27177 | BIT 2,A | If "up" pressed then... | ||
27179 | JP NZ,27252 | Skip ahead to "jump" subroutine | ||
27182 | BIT 3,A | If "down" pressed then... | ||
27184 | CALL NZ,55768 | ...select Magic Knight's room and USS Pisces' Current Location if cheat / debug mode is enabled | ||
27187 | BIT 4,A | If "fire" pressed then... | ||
27189 | JP NZ,30001 | ...display and handle main in-game menu | ||
27192 | CALL 53115 | Erase Magic Knight from display, advance his current position then redraw | ||
27195 | JP 27139 | Loop back for next key / control press | ||
Left pressed
|
||||
27198 | LD HL,23474 | If Magic-Knight-can't-move-left flag is set... | ||
27201 | BIT 0,(HL) | ... | ||
27203 | JR NZ,27139 | ...then loop back to start of keyboard check routine | ||
27205 | EX AF,AF' | Switch AF and AF' | ||
27206 | LD A,1 | Set Magic-Knight-facing-left flag... | ||
27208 | LD (23425),A | ... | ||
27211 | LD A,254 | Set Magic Knight's x-velocity to minus 2... | ||
27213 | LD (25160),A | ... | ||
27216 | LD (27283),A | Prepare to set Magic Knight's x-velocity to minus 2 | ||
27219 | EX AF,AF' | Switch AF and AF' (A now holds pressed controls bitmap) | ||
27220 | BIT 2,A | If "up" was also pressed... | ||
27222 | JR NZ,27256 | ...then skip ahead to 27256 (jumping subroutine) | ||
27224 | XOR A | Set Magic Knight's current y-velocity to zero... | ||
27225 | LD (25161),A | ... | ||
27228 | CALL 53115 | Erase Magic Knight from display, advance his current position then redraw | ||
27231 | CALL 27357 | Handle Magic Knight's fall | ||
27234 | JR 27139 | Loop back for next key / control press | ||
Right pressed
|
||||
27236 | LD HL,23474 | If Magic-Knight-can't-move-right flag is set... | ||
27239 | BIT 1,(HL) | ... | ||
27241 | JR NZ,27139 | ...then loop back to start of keyboard check routine | ||
27243 | EX AF,AF' | Switch AF and AF' | ||
27244 | XOR A | Reset Magic-Knight-facing-left flag... | ||
27245 | LD (23425),A | ... | ||
27248 | LD A,2 | Jump to 27213, setting Magic Knight's x-velocity to 2... | ||
27250 | JR 27213 | ... | ||
Up pressed
|
||||
27252 | XOR A | Prepare to set Magic Knight's x-velocity to zero... | ||
27253 | LD (27283),A | ... | ||
27256 | LD HL,37074 | Point HL at start of Magic Knight's y-velocities sequence table | ||
27259 | LD (37072),HL | Store current position in Magic Knight's y-velocities sequence table at 37072 | ||
27262 | LD A,(25157) | Load A with Magic Knight's current y-coordinate (pixels) | ||
27265 | CP 8 | If y-coordinate is less than 8... | ||
27267 | JP C,27336 | ...then jump to 27336 (exit loop as Magic Knight can't get any higher!) | ||
27270 | LD HL,(37072) | Load HL with current position in Magic Knight's y-velocities sequence table | ||
27273 | LD A,(HL) | Load the current y-velocity in the sequence into A | ||
27274 | NEG | Negate (as Magic Knight is jumping upwards) | ||
27276 | OR A | If A is zero... | ||
27277 | JR Z,27336 | ...jump to 27336 (exit loop as we have reached the end of the sequence) | ||
27279 | LD (25161),A | Load A into Magic Knight's y-velocity | ||
27282 | LD A,0 | Set Magic Knight's x-velocity... | ||
27284 | LD (25160),A | ... | ||
27287 | CALL 27508 | Kill Magic Knight's x-velocity if he cannot horizontally pass through a block beside him | ||
27290 | LD A,(25160) | Load Magic Knight's x-velocity into B... | ||
27293 | LD B,A | ... | ||
27294 | LD A,(23474) | Load Magic Knight movement flags into A | ||
27297 | XOR B | Check: | ||
27298 | CP 255 | If x-velocity is -2 (left), and Magic Knight can't move left... | ||
27300 | JP Z,27342 | ...then jump ahead to 27342 | ||
27303 | CP 253 | If x-velocity is -2 (left), and Magic Knight can't move left or right... | ||
27305 | JP Z,27342 | ...then jump ahead to 27342 | ||
27308 | CP 1 | If x-velocity is +2 (right), and Magic Knight can't move left or right... | ||
27310 | JP Z,27342 | ...then jump ahead to 27342 | ||
27313 | OR A | If x-velocity is +2 (right), and Magic Knight can't move right... | ||
27314 | JP Z,27342 | ...then jump ahead to 27342 | ||
27317 | CALL 27647 | Kill Magic Knight's jump if he cannot vertically pass through a block above him | ||
27320 | PUSH AF | Store AF (A = Magic-Knight's-jump-was-impeded flag) | ||
27321 | CALL 53115 | Erase Magic Knight from display, advance his current position then redraw | ||
27324 | POP AF | Restore AF (A = Magic-Knight's-jump-was-impeded flag) | ||
27325 | JR NZ,27336 | If Magic Knight's jump was impeded by a block above him then jump to 27336 | ||
27327 | CALL 28457 | Set Magic Knight's velocity to zero, if appropriate move to new room, execute room-specific routine | ||
27330 | LD HL,(37072) | Load HL with current position in Magic Knight's y-velocities sequence table | ||
27333 | INC HL | Advance to next y-velocity in the sequence | ||
27334 | JR 27259 | Loop back to 27259 | ||
27336 | CALL 27352 | Handle Magic Knight's fall, preserving x-velocity | ||
27339 | JP 27139 | Loop back to start of keyboard check routine | ||
27342 | XOR A | Set Magic Knight's x-velocity to zero... | ||
27343 | LD (25160),A | ... | ||
27346 | LD (27283),A | Prepare to set Magic Knight's x-velocity to zero | ||
27349 | JP 27317 | Jump back to 27317 |
Prev: 26997 | Up: Map | Next: 27352 |