![]() |
Routines |
| Prev: 27490 | Up: Map | Next: 27666 |
|
Used by the routine at 27176.
|
||||
| 27495 | XOR A | Set A to zero | ||
|
This entry point is used by the routine at 27490.
|
||||
| 27496 | LD (27531),A | Prepare to set Magic Knight's x-velocity to A | ||
| 27499 | LD HL,41872 | Point HL at end of table of y-velocities sequence for jumping and falling | ||
| 27502 | LD (41857),HL | Store current position at 41857 | ||
| 27505 | LD A,(23470) | If Magic Knight's movement flags are unset... | ||
| 27508 | OR A | ... | ||
| 27509 | JR Z,27515 | ...then skip ahead to 27515 | ||
| 27511 | XOR A | Prepare to set Magic Knight's x-velocity to zero... | ||
| 27512 | LD (27531),A | ... | ||
| 27515 | LD HL,(41857) | Load current position in y-velocities table into HL | ||
| 27518 | LD A,(HL) | Load current y-velocity from table into A | ||
| 27519 | CP 7 | If velocity is 7... | ||
| 27521 | JR Z,27527 | ...then skip ahead to 28527 | ||
| 27523 | DEC HL | Step pointer back one byte in y-velocities table | ||
| 27524 | LD (41857),HL | Store pointer | ||
| 27527 | LD (25392),A | Load last y-velocity read from table into Magic Knight's y-velocity | ||
| 27530 | LD A,0 | Set Magic Knight's x-velocity... | ||
| 27532 | LD (25391),A | ... | ||
| 27535 | LD A,(25387) | Load Magic Knight's current x-coordinate into A | ||
| 27538 | ADD A,4 | Add 4 to x-coordinate | ||
| 27540 | CALL 30123 | Divide x-coordinate by eight, rounding down to nearest integer | ||
| 27543 | LD C,A | Load result (Magic Knight's x-coordinate in characters) into C, setting B to zero... | ||
| 27544 | LD B,0 | ... | ||
| 27546 | LD A,(25388) | Load Magic Knight's current y-coordinate into A | ||
| 27549 | AND 7 | If y-coordinate is a multiple of eight... | ||
| 27551 | JR Z,27555 | ...then skip ahead to 27555 | ||
|
y-coordinate is not a multiple of eight
|
||||
| 27553 | LD B,8 | Set B to 8, as we need to look one character block lower due to Magic Knight spanning five, rather than four, characters | ||
| 27555 | LD A,(25388) | Load Magic Knight's current y-coordinate into A | ||
| 27558 | ADD A,B | Add B to current y-coordinate (i.e. y-coordinate of highest full character block spanned by Magic Knight) | ||
| 27559 | ADD A,32 | Add 32 (as Magic Knight is 32 pixels high, so now y-coordinate of highest full character block not occupied by Magic Knight) | ||
| 27561 | RRCA | Divide result by 8, removing remainder... | ||
| 27562 | RRCA | ... | ||
| 27563 | RRCA | ... | ||
| 27564 | AND 31 | ... | ||
| 27566 | LD B,A | Load result (y-coordinate in characters) into B | ||
| 27567 | CALL 36586 | Point HL at terrain interaction data for character coordinates x=C, y=B (block that Magic Knight is "falling through") | ||
| 27570 | BIT 7,(HL) | If block cannot be passed vertically (i.e. Magic Knight has landed)... | ||
| 27572 | JP NZ,27627 | ...then skip ahead to 27627 | ||
| 27575 | INC HL | Advance to next block right (as Magic Knight is two character blocks wide) in terrain interaction table | ||
| 27576 | BIT 7,(HL) | If block cannot be passed vertically (i.e. Magic Knight has landed)... | ||
| 27578 | JP NZ,27627 | ...then skip ahead to 27627 | ||
| 27581 | CALL 27666 | Kill Magic Knight's x-velocity if he cannot horizontally pass through a block beside him | ||
| 27584 | LD A,(25391) | Load Magic Knight's x-velocity into B... | ||
| 27587 | LD B,A | ... | ||
| 27588 | LD A,(23470) | Load Magic Knight's movement flags into A | ||
| 27591 | XOR B | Check: | ||
| 27592 | CP 255 | If x-velocity is -2 (left), and Magic Knight can't move left... | ||
| 27594 | JP Z,27656 | ...then jump ahead to 27656 | ||
| 27597 | CP 253 | If x-velocity is -2 (left), and Magic Knight can't move left or right... | ||
| 27599 | JP Z,27656 | ...then jump ahead to 27656 | ||
| 27602 | CP 1 | If x-velocity is +2 (right), and Magic Knight can't move left or right... | ||
| 27604 | JP Z,27656 | ...then jump ahead to 27656 | ||
| 27607 | OR A | If x-velocity is +2 (right), and Magic Knight can't move right... | ||
| 27608 | JP Z,27656 | ...then jump ahead to 27656 | ||
| 27611 | CALL 34821 | Update Magic Knight's current frame based on x-coordinate | ||
| 27614 | LD (65528),A | Store frame number at 65528 | ||
| 27617 | XOR A | Set A to zero (index for Magic Knight) and... | ||
| 27618 | CALL 39224 | ...draw Magic Knight (erase old frame and draw new frame) | ||
| 27621 | CALL 29763 | Run checks and updates (Magic Knight's current room and room-specific routines) | ||
| 27624 | JP 27505 | Loop back to 27505 | ||
| 27627 | LD A,(25388) | Load Magic Knight's current y-coordinate into A (e.g. 105) | ||
| 27630 | AND 15 | Retain only pixel-within-two-characters component (e.g. 9 pixels down the pair of character blocks) | ||
| 27632 | NEG | Negate (i.e. -9 pixels) | ||
| 27634 | AND 15 | Retain only pixel-within-two-characters component (e.g. 7 pixels up the pair of character blocks, or 7 pixels down to the ground) | ||
| 27636 | LD (25392),A | Set Magic Knight's y-velocity so that it will take his feet to the ground | ||
| 27639 | LD A,(65528) | Set Magic Knight's frame number to match stored value... | ||
| 27642 | LD (25390),A | ... | ||
| 27645 | XOR A | Set A to zero (Magic Knight) and... | ||
| 27646 | CALL 39224 | ...draw Magic Knight (erase old frame and draw new frame) | ||
| 27649 | LD HL,0 | Set Magic Knight's x- and y-velocities to zero... | ||
| 27652 | LD (25391),HL | ... | ||
| 27655 | RET | Return (Magic Knight has landed) | ||
| 27656 | XOR A | Set Magic Knight's x-velocity to zero... | ||
| 27657 | LD (25391),A | ... | ||
| 27660 | LD (27531),A | Prepare to set Magic Knight's x-velocity to zero | ||
| 27663 | JP 27611 | Jump back to 27611 | ||
| Prev: 27490 | Up: Map | Next: 27666 |