mist: minor size optimization in the direction code

This commit is contained in:
Vince Weaver 2020-03-27 00:43:51 -04:00
parent db8a45e483
commit 907cbf7add
1 changed files with 20 additions and 23 deletions

View File

@ -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