From 907cbf7addf2b26c224bea0465105de1c72fc219 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 27 Mar 2020 00:43:51 -0400 Subject: [PATCH] mist: minor size optimization in the direction code --- mist/draw_pointer.s | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/mist/draw_pointer.s b/mist/draw_pointer.s index a7b20b1b..e7458bef 100644 --- a/mist/draw_pointer.s +++ b/mist/draw_pointer.s @@ -74,6 +74,7 @@ finger_not_special: bne really_not_special rts + really_not_special: ; check for left/right @@ -120,38 +121,18 @@ real_finger_point: jmp finger_draw check_cursor_left: - lda DIRECTION - and #$f - asl - asl - asl - asl - clc - ldy #LOCATION_BGS - adc (LOCATION_STRUCT_L),Y - tay + jsr lookup_direction - lda direction_lookup,Y and #$f beq finger_point - cmp #1 + cmp #$1 beq finger_left bne finger_uturn_left check_cursor_right: - lda DIRECTION - and #$f - asl - asl - asl - asl - clc - ldy #LOCATION_BGS - adc (LOCATION_STRUCT_L),Y - tay + jsr lookup_direction - lda direction_lookup,Y and #$f0 beq finger_point @@ -159,6 +140,22 @@ check_cursor_right: beq finger_right bne finger_uturn_right +lookup_direction: + lda DIRECTION + and #$f + asl + asl + asl + asl + clc + ldy #LOCATION_BGS + adc (LOCATION_STRUCT_L),Y + tay + + lda direction_lookup,Y + + rts + finger_left: lda #1 sta IN_LEFT