Prev: E454 Up: Map Next: E4A2
E47B: Controls: Up
Used by the routine at Controls_CheckDown.
Did the player press up?
Controls_CheckUp E47B CP $08 Jump to Controls_CheckRightDown if the player didn't press up (08).
E47D JR NZ,Controls_CheckRightDown
Up movement checks for boundaries and the home box.
MoveUp_Checks E47F LD A,($D82C) A=*DestinationCursor_Y_Position.
Can the player move up?
E482 CP $05 If *DestinationCursor_Y_Position is at or beyond the top-most boundary jump to Handler_CursorMovement.
E484 JP M,Handler_CursorMovement
Is the player below the home box?
This is position 02/ 06:
cursor-02-06
E487 CP $06 If *DestinationCursor_Y_Position is not 06 (which confirms the player can't be below the home box), jump to MoveUp.
E489 JR NZ,MoveUp
If the horizontal co-ordinate is 02 and the vertical co-ordinate is 06 then the player is below the home box. As the home box can only be entered from the right side, we treat the bottom side as a boundary and don't allow the player to move through it.
E48B LD A,($D82D) Now compare *DestinationCursor_X_Position with 02.
E48E CP $02
E490 JP Z,Handler_CursorMovement If *DestinationCursor_X_Position is 02 (which confirms that yes, the player is below the home box), jump to Handler_CursorMovement to prevent the movement from happening.
Normal up movement.
E493 LD A,($D82C) Reload *DestinationCursor_Y_Position into A.
MoveUp E496 SUB $04 Move 04 rows up.
E498 LD ($D82C),A Update *DestinationCursor_Y_Position.
Update the tile ID the player has now landed on.
E49B LD A,(HL) Subtract 07 from *HL.
E49C SUB $07
E49E LD (HL),A
E49F JP Handler_CursorMovement Jump to Handler_CursorMovement.
Prev: E454 Up: Map Next: E4A2