2020-07-14 03:53:08 +00:00
|
|
|
; this is a painful one
|
2020-07-14 15:15:40 +00:00
|
|
|
; mostly because the tree puzzle is sort of obscure in the original
|
2020-07-14 03:53:08 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
;====================
|
|
|
|
; safe was clicked
|
|
|
|
;====================
|
2020-07-14 03:53:08 +00:00
|
|
|
goto_safe:
|
|
|
|
lda #CABIN_SAFE
|
|
|
|
sta LOCATION
|
|
|
|
jmp change_location
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
;====================
|
|
|
|
; safe was touched
|
|
|
|
;====================
|
|
|
|
touch_safe:
|
2020-07-14 04:03:01 +00:00
|
|
|
|
|
|
|
lda CURSOR_Y
|
2020-07-14 15:15:40 +00:00
|
|
|
|
|
|
|
; check if buttons
|
2020-07-14 04:03:01 +00:00
|
|
|
cmp #26 ; blt
|
2020-07-14 15:15:40 +00:00
|
|
|
bcc safe_buttons
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
; check if handle
|
|
|
|
cmp #34
|
|
|
|
bcs pull_handle ; bge
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
; else do nothing
|
|
|
|
rts
|
2020-07-14 04:03:01 +00:00
|
|
|
|
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
pull_handle:
|
|
|
|
; FIXME
|
|
|
|
rts
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
safe_buttons:
|
2020-07-14 04:03:01 +00:00
|
|
|
lda CURSOR_X
|
2020-07-14 15:15:40 +00:00
|
|
|
cmp #13 ; not a button
|
|
|
|
bcc no_button
|
|
|
|
cmp #19
|
|
|
|
bcc hundreds_inc
|
|
|
|
cmp #25
|
|
|
|
bcc tens_inc
|
|
|
|
bcs ones_inc
|
|
|
|
|
|
|
|
no_button:
|
|
|
|
rts
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
hundreds_inc:
|
|
|
|
sed
|
|
|
|
lda SAFE_HUNDREDS
|
2020-07-14 04:03:01 +00:00
|
|
|
clc
|
2020-07-14 15:15:40 +00:00
|
|
|
adc #$1
|
|
|
|
cld
|
|
|
|
and #$f
|
|
|
|
sta SAFE_HUNDREDS
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
rts
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
tens_inc:
|
|
|
|
sed
|
|
|
|
lda SAFE_TENS
|
|
|
|
clc
|
|
|
|
adc #$1
|
|
|
|
cld
|
2020-07-14 04:03:01 +00:00
|
|
|
and #$f
|
2020-07-14 15:15:40 +00:00
|
|
|
sta SAFE_TENS
|
|
|
|
|
2020-07-14 04:03:01 +00:00
|
|
|
rts
|
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
ones_inc:
|
|
|
|
sed
|
|
|
|
lda SAFE_ONES
|
|
|
|
clc
|
|
|
|
adc #$1
|
|
|
|
cld
|
|
|
|
and #$f
|
|
|
|
sta SAFE_ONES
|
|
|
|
|
2020-07-14 04:03:01 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
|
|
|
|
;==============================
|
|
|
|
; draw the numbers on the safe
|
|
|
|
;==============================
|
|
|
|
draw_safe_combination:
|
|
|
|
|
|
|
|
; hundreds digit
|
|
|
|
|
|
|
|
lda SAFE_HUNDREDS
|
2020-07-14 04:03:01 +00:00
|
|
|
and #$f
|
2020-07-14 15:15:40 +00:00
|
|
|
asl
|
|
|
|
tay
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
lda number_sprites,Y
|
|
|
|
sta INL
|
|
|
|
lda number_sprites+1,Y
|
|
|
|
sta INH
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
lda #15
|
|
|
|
sta XPOS
|
|
|
|
lda #8
|
|
|
|
sta YPOS
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
jsr put_sprite_crop
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
; tens digit
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
lda SAFE_TENS
|
2020-07-14 04:03:01 +00:00
|
|
|
and #$f
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
|
|
|
|
lda number_sprites,Y
|
|
|
|
sta INL
|
|
|
|
lda number_sprites+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
lda #21
|
|
|
|
sta XPOS
|
|
|
|
lda #8
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
; ones digit
|
2020-07-14 04:03:01 +00:00
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
lda SAFE_ONES
|
|
|
|
and #$f
|
|
|
|
asl
|
2020-07-14 04:03:01 +00:00
|
|
|
tay
|
|
|
|
|
|
|
|
lda number_sprites,Y
|
|
|
|
sta INL
|
|
|
|
lda number_sprites+1,Y
|
|
|
|
sta INH
|
|
|
|
|
2020-07-14 15:15:40 +00:00
|
|
|
lda #27
|
2020-07-14 04:03:01 +00:00
|
|
|
sta XPOS
|
|
|
|
lda #8
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
jsr put_sprite_crop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|