diff --git a/mist/draw_pointer.s b/mist/draw_pointer.s index cfdd2bdb..25efbf1c 100644 --- a/mist/draw_pointer.s +++ b/mist/draw_pointer.s @@ -18,15 +18,15 @@ draw_pointer: cmp #$ff beq finger_not_special ; if $ff not special - lda (LOCATION_STRUCT_L),Y - cmp #$4 - beq was_any +; lda (LOCATION_STRUCT_L),Y +; cmp #DIRECTION_ANY +; beq was_any lda DIRECTION and #$f - cmp (LOCATION_STRUCT_L),Y - bne finger_not_special ; only special if facing right way + and (LOCATION_STRUCT_L),Y + beq finger_not_special ; only special if facing right way was_any: @@ -147,9 +147,15 @@ check_cursor_right: beq finger_right bne finger_uturn_right +log2_table: + ; 0 1 2 3 4 5 6 7 8 + .byte 0,0,1,1,2,2,2,2,3 + lookup_direction: lda DIRECTION and #$f + tay + lda log2_table,Y asl asl asl diff --git a/mist/keyboard.s b/mist/keyboard.s index 74550c8c..c12200cc 100644 --- a/mist/keyboard.s +++ b/mist/keyboard.s @@ -154,6 +154,8 @@ no_split: done_split: and #$f ; mask off special flags + tay + lda log2_table,Y asl clc adc #LOCATION_NORTH_BG @@ -204,6 +206,8 @@ go_forward: lda DIRECTION and #$f + tay + lda log2_table,Y clc adc #LOCATION_NORTH_EXIT tay @@ -218,6 +222,8 @@ go_forward: lda DIRECTION and #$f + tay + lda log2_table,Y clc adc #LOCATION_NORTH_EXIT_DIR tay diff --git a/mist/zp.inc b/mist/zp.inc index 92e1fbe3..32959a2e 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -37,11 +37,11 @@ CURSOR_Y= $63 XPOS = $64 YPOS = $65 DIRECTION = $66 - DIRECTION_N = $0 - DIRECTION_S = $1 - DIRECTION_E = $2 - DIRECTION_W = $3 - DIRECTION_ANY=$4 + DIRECTION_N = $1 + DIRECTION_S = $2 + DIRECTION_E = $4 + DIRECTION_W = $8 + DIRECTION_ANY=$f DIRECTION_ONLY_POINT = $40 ; do not change pointer to grab DIRECTION_SPLIT = $80 ; split text/graphics LOCATION = $67