; if timer is 0 apply movement
; and jump to next tile
call try_abort_move
+ jp z, @done
ld a, [cursor_y]
ld b, a
ld hl, cursor_x
ld de, cursor_move_x
call try_abort_move_at
+ ret z
+ ; TODO check other directions here
ret
+
; aborts a move direciton
; inputs:
; b: compare variable (e.g. min or max value)
; c: move direction compare value (e.g. move + or -)
; hl: position ptr
; de: move variable to set to 0
+ ; returns: z == 0 if move was aborted
try_abort_move_at:
; do not abort if position is wrong
ld a, [hl]
xor a, a
ld [de], a
+ ; z = 0 due to xor a, a
ret