Prev: BBCC Up: Map Next: BC6C
BBE7: Move cursor on screen depending on direction key pressed
Used by the routines at routine23 and routine41.
Movement points variable holds the number of points multiplied by two. It is set to 2 for non-diagonal movement, and 3 for diagonal movement.
move_cursor BBE7 PUSH HL Preserve registers.
BBE8 PUSH DE
BBE9 LD A,$08 Set CAPS mode.
BBEB LD ($5C6A),A
BBEE PUSH BC Preserve cursor coordinates
BBEF LD A,(computer_player_flag) Jump to routine70 if player is computer controlled.
BBF2 OR A
BBF3 JP NZ,routine70
BBF6 CALL $02BF Call KEYBOARD routine in ROM.
This entry point is used by the routine at routine70.
move_cursor_0 BBF9 POP BC Restore cursor coordinates.
BBFA LD (unknown31),A Store value of A (key pressed) in unknown31
BBFD CP $57 If 'W' key pressed set movement points to 2 and decrement y coordinate.
BBFF JR NZ,not_W_pressed
BC01 LD A,$02
BC03 LD (movement_x2),A
BC06 CALL cursor_up
not_W_pressed BC09 CP $58 If 'X' key pressed set movement points to 2 and increment y coordinate.
BC0B JR NZ,not_X_pressed
BC0D LD A,$02
BC0F LD (movement_x2),A
BC12 CALL cursor_down
not_X_pressed BC15 CP $41 If 'A' key pressed set movement points to 2 and decrement x coordinate.
BC17 JR NZ,not_A_pressed
BC19 LD A,$02
BC1B LD (movement_x2),A
BC1E CALL cursor_left
not_A_pressed BC21 CP $44 If 'D' key pressed set movement points to 2 and increment x coordinate.
BC23 JR NZ,not_D_pressed
BC25 LD A,$02
BC27 LD (movement_x2),A
BC2A CALL cursor_right
not_D_pressed BC2D CP $51 If 'Q' key pressed set movement points to 3 and decrement x and y coordinates.
BC2F JR NZ,not_Q_pressed
BC31 LD A,$03
BC33 LD (movement_x2),A
BC36 CALL cursor_left
BC39 CALL cursor_up
not_Q_pressed BC3C CP $45 If 'E' key pressed set movement points to 3, increment x, and decrement y coordinates.
BC3E JR NZ,not_E_pressed
BC40 LD A,$03
BC42 LD (movement_x2),A
BC45 CALL cursor_right
BC48 CALL cursor_up
not_E_pressed BC4B CP $5A If 'Z' key pressed set movement points to 3, increment y, and decrement x coordinates.
BC4D JR NZ,not_Z_pressed
BC4F LD A,$03
BC51 LD (movement_x2),A
BC54 CALL cursor_down
BC57 CALL cursor_left
not_Z_pressed BC5A CP $43 If 'C' key pressed set movement points to 3 and increment x and y coordinates.
BC5C JR NZ,not_C_pressed
BC5E LD A,$03
BC60 LD (movement_x2),A
BC63 CALL cursor_right
BC66 CALL cursor_down
not_C_pressed BC69 POP DE Restore registers and return.
BC6A POP HL
BC6B RET
Prev: BBCC Up: Map Next: BC6C