identified double-click detection

This commit is contained in:
Joshua Bell 2018-01-20 16:44:49 -08:00
parent d0f208abee
commit 0513ce1df9

View File

@ -3730,6 +3730,8 @@ str_on_system_disk:
.byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00,$00
;;; ==================================================
show_alert_indirection: show_alert_indirection:
jmp show_alert_dialog jmp show_alert_dialog
@ -3771,11 +3773,11 @@ alert_bitmap:
.endproc .endproc
alert_rect: alert_rect:
.word $41, $57, $1E5, $8E DEFINE_RECT $41, $57, $1E5, $8E
alert_inner_frame_rect1: alert_inner_frame_rect1:
.word $4, $2, $1A0, $35 DEFINE_RECT $4, $2, $1A0, $35
alert_inner_frame_rect2: alert_inner_frame_rect2:
.word $5, $3, $19F, $34 DEFINE_RECT $5, $3, $19F, $34
LB6D3: .byte $41 LB6D3: .byte $41
LB6D4: .byte $00 LB6D4: .byte $00
@ -3786,19 +3788,29 @@ LB6DF: .byte $A4
LB6E0: .byte $01 LB6E0: .byte $01
LB6E1: .byte $37,$00 LB6E1: .byte $37,$00
;;; ==================================================
;;; Show Alert Dialog
;;; Call show_alert_dialog with prompt number in X (???), A = ???
.proc show_alert_dialog_impl
ok_label: ok_label:
PASCAL_STRING {"OK ",GLYPH_RETURN} PASCAL_STRING {"OK ",GLYPH_RETURN}
try_again_rect: try_again_rect:
.word $14,$25,$78,$30 DEFINE_RECT $14,$25,$78,$30
try_again_pos: try_again_pos:
.word $0019,$002F DEFINE_POINT $19,$2F
cancel_rect: cancel_rect:
.word $12C,$25,$190,$30 DEFINE_RECT $12C,$25,$190,$30
cancel_pos: .word $0131,$002F cancel_pos:
.word $00BE,$0010 DEFINE_POINT $131,$2F
LB70F: .word $004B,$001D
.word $BE,$10 ; ???
LB70F: DEFINE_POINT $4B,$1D
alert_action: .byte $00 alert_action: .byte $00
LB714: .byte $00 LB714: .byte $00
@ -3823,7 +3835,7 @@ err_49: PASCAL_STRING "The volume directory cannot hold more than 51 files."
err_4E: PASCAL_STRING "The file is locked." err_4E: PASCAL_STRING "The file is locked."
err_52: PASCAL_STRING "This is not a ProDOS disk." err_52: PASCAL_STRING "This is not a ProDOS disk."
err_57: PASCAL_STRING "There is another volume with that name on the desktop." err_57: PASCAL_STRING "There is another volume with that name on the desktop."
;; Below are not ProDOS MLI error codes. ;; Below are internal (not ProDOS MLI) error codes.
err_F9: PASCAL_STRING "There are 2 volumes with the same name." err_F9: PASCAL_STRING "There are 2 volumes with the same name."
err_FA: PASCAL_STRING "This file cannot be run." err_FA: PASCAL_STRING "This file cannot be run."
err_FB: PASCAL_STRING "That name is too long." err_FB: PASCAL_STRING "That name is too long."
@ -3854,9 +3866,8 @@ alert_action_table:
.byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$80,$80,$00 .byte $00,$80,$80,$00
;; Show alert; prompt number in X (???), A = ??? ;; Actual entry point
.proc show_alert_dialog start: pha
pha
txa txa
pha pha
A2D_RELAY2_CALL A2D_HIDE_CURSOR A2D_RELAY2_CALL A2D_HIDE_CURSOR
@ -3965,7 +3976,6 @@ LBB14: A2D_RELAY2_CALL A2D_SET_FILL_MODE, const2
A2D_RELAY2_CALL A2D_SET_POS, try_again_pos A2D_RELAY2_CALL A2D_SET_POS, try_again_pos
DRAW_PASCAL_STRING try_again_label DRAW_PASCAL_STRING try_again_label
jmp LBB75 jmp LBB75
.endproc
LBB5C: A2D_RELAY2_CALL A2D_DRAW_RECT, try_again_rect LBB5C: A2D_RELAY2_CALL A2D_DRAW_RECT, try_again_rect
A2D_RELAY2_CALL A2D_SET_POS, try_again_pos A2D_RELAY2_CALL A2D_SET_POS, try_again_pos
@ -4156,6 +4166,10 @@ LBDD3: lda LBDE0
LBDDB: lda #$02 LBDDB: lda #$02
jmp LBC55 jmp LBC55
.endproc
show_alert_dialog := show_alert_dialog_impl::start
;;; ==================================================
LBDE0: .byte 0 LBDE0: .byte 0
LBDE1: lda input_params_xcoord LBDE1: lda input_params_xcoord
@ -6102,7 +6116,7 @@ L4088: jsr L4510
beq L40A6 beq L40A6
jsr L40E0 jsr L40E0
L40A6: jsr L464E L40A6: jsr L464E
jsr L48E6 jsr get_input
lda input_params_state lda input_params_state
cmp #A2D_INPUT_DOWN cmp #A2D_INPUT_DOWN
beq L40B7 beq L40B7
@ -6113,7 +6127,7 @@ L40B7: jsr L43E7
L40BD: cmp #$03 L40BD: cmp #$03
bne L40C7 bne L40C7
jsr L435A jsr menu_dispatch
jmp L4088 jmp L4088
L40C7: cmp #$06 L40C7: cmp #$06
@ -6147,7 +6161,7 @@ L4100: jsr L48F0
lda input_params_state lda input_params_state
cmp #$06 ; ??? cmp #$06 ; ???
bne L412B bne L412B
jsr L48E6 jsr get_input
L410D: jsr L4113 L410D: jsr L4113
jmp L4100 jmp L4100
@ -6321,8 +6335,10 @@ L42C3: .byte $00
;;; ================================================== ;;; ==================================================
;;; Menu Dispatch ;;; Menu Dispatch
.proc menu_dispatch_impl
;; jump table for menu item handlers ;; jump table for menu item handlers
L42C4: dispatch_table:
;; Apple menu (1) ;; Apple menu (1)
.addr cmd_about .addr cmd_about
.addr cmd_noop ; -------- .addr cmd_noop ; --------
@ -6410,10 +6426,13 @@ L42C4:
.addr cmd_startup_item .addr cmd_startup_item
;; indexed by menu id-1 ;; indexed by menu id-1
L4350: .byte $00,$14,$2C,$46,$50,$50,$6A,$7E,$8C offset_table:
.byte $00,$14,$2C,$46,$50,$50,$6A,$7E,$8C
L4359: .byte $00 flag: .byte $00
L435A: lda input_params+2
menu_dispatch:
lda input_params+2
bne L4362 bne L4362
jmp L4394 jmp L4394
@ -6427,7 +6446,7 @@ L4367: lda input_params+1
bne L4373 bne L4373
jmp L5441 jmp L5441
L4373: bit L4359 L4373: bit flag
bpl L4394 bpl L4394
cmp #$77 cmp #$77
bne L437F bne L437F
@ -6445,7 +6464,6 @@ L438D: cmp #$78
bne L4394 bne L4394
jmp L57A6 jmp L57A6
L4394: lda input_params+1 L4394: lda input_params+1
sta $E25C sta $E25C
lda input_params+2 lda input_params+2
@ -6453,12 +6471,14 @@ L4394: lda input_params+1
lda #$01 lda #$01
L43A1: sta $E25D L43A1: sta $E25D
A2D_RELAY_CALL $32, menu_click_params A2D_RELAY_CALL $32, menu_click_params
L43AD: ldx menu_click_params::menu_id
menu_dispatch2:
ldx menu_click_params::menu_id
bne L43B3 bne L43B3
rts rts
L43B3: dex ; x has top level menu id L43B3: dex ; x has top level menu id
lda L4350,x lda offset_table,x
tax tax
ldy $E25B ldy $E25B
dey dey
@ -6469,9 +6489,9 @@ L43B3: dex ; x has top level menu id
clc clc
adc L43E5 adc L43E5
tax tax
lda L42C4,x lda dispatch_table,x
sta L43E5 sta L43E5
lda L42C4+1,x lda dispatch_table+1,x
sta L43E5+1 sta L43E5+1
jsr L43E0 jsr L43E0
A2D_RELAY_CALL $33, menu_click_params A2D_RELAY_CALL $33, menu_click_params
@ -6481,6 +6501,11 @@ L43E0: tsx
stx $E256 stx $E256
L43E5 := *+1 L43E5 := *+1
jmp dummy1234 ; self-modified jmp dummy1234 ; self-modified
.endproc
menu_dispatch := menu_dispatch_impl::menu_dispatch
menu_dispatch2 := menu_dispatch_impl::menu_dispatch2
menu_dispatch_flag := menu_dispatch_impl::flag
;;; ================================================== ;;; ==================================================
@ -6503,7 +6528,7 @@ L4415: jmp L68AA
L4418: cmp #$01 L4418: cmp #$01
bne L4428 bne L4428
A2D_RELAY_CALL A2D_MENU_CLICK, menu_click_params A2D_RELAY_CALL A2D_MENU_CLICK, menu_click_params
jmp L43AD jmp menu_dispatch2
L4428: pha L4428: pha
lda desktop_winid lda desktop_winid
@ -7044,7 +7069,8 @@ L48CC: sta LD2AC
L48E4 := *+1 L48E4 := *+1
jmp dummy1234 ; self-modified jmp dummy1234 ; self-modified
L48E6: A2D_RELAY_CALL A2D_GET_INPUT, input_params get_input:
A2D_RELAY_CALL A2D_GET_INPUT, input_params
rts rts
L48F0: A2D_RELAY_CALL $2C, input_params ; ??? L48F0: A2D_RELAY_CALL $2C, input_params ; ???
@ -8617,7 +8643,7 @@ L5579: lda #$00
sta L544A sta L544A
jsr clear_selection jsr clear_selection
L5581: jsr L55F0 L5581: jsr L55F0
L5584: jsr L48E6 L5584: jsr get_input
lda input_params_state lda input_params_state
cmp #A2D_INPUT_KEY cmp #A2D_INPUT_KEY
beq L5595 beq L5595
@ -8805,7 +8831,7 @@ L5721: cpx #$08
L572D: lda #$00 L572D: lda #$00
sta L578C sta L578C
L5732: jsr L48E6 L5732: jsr get_input
lda input_params_state lda input_params_state
cmp #A2D_INPUT_KEY cmp #A2D_INPUT_KEY
beq L5743 beq L5743
@ -8856,7 +8882,7 @@ L579A: A2D_RELAY_CALL $22 ; ???
jmp L60DB jmp L60DB
L57A6: jsr L5803 L57A6: jsr L5803
L57A9: jsr L48E6 L57A9: jsr get_input
lda input_params_state lda input_params_state
cmp #A2D_INPUT_DOWN cmp #A2D_INPUT_DOWN
beq L57C2 beq L57C2
@ -9480,7 +9506,7 @@ L5CE6: cmp selected_file_index,x
bmi L5CFB bmi L5CFB
L5CF0: bit $D2AA L5CF0: bit $D2AA
bmi L5CF8 bmi L5CF8
jmp L5DFC jmp L5DFC ; double click to launch can come through here
L5CF8: jmp L5D55 L5CF8: jmp L5D55
@ -9512,7 +9538,7 @@ L5D0B: ldx is_file_selected
jsr L4510 jsr L4510
bit $D2AA bit $D2AA
bmi L5D55 bmi L5D55
jmp L5DFC jmp L5DFC ; double click to launch can come through here
L5D55: lda L5CD9 L5D55: lda L5CD9
sta $EBFC sta $EBFC
@ -9584,7 +9610,7 @@ L5DF7: ldx $E256
txs txs
rts rts
L5DFC: lda L5CD9 L5DFC: lda L5CD9 ; after a double-click (on file or folder)
jsr L86E3 jsr L86E3
sta $06 sta $06
stx $06+1 stx $06+1
@ -9645,7 +9671,7 @@ L5E57: lda ($06),y
cmp #$20 cmp #$20
bcc L5E74 bcc L5E74
lda L5E77 lda L5E77
L5E74: jmp launch_file L5E74: jmp launch_file ; when double-clicked
L5E77: .byte 0 L5E77: .byte 0
L5E78: sta L5F0A L5E78: sta L5F0A
@ -10520,7 +10546,7 @@ L66AA: lda #$01
sta $E26D sta $E26D
A2D_RELAY_CALL $35, LE26C ; ??? A2D_RELAY_CALL $35, LE26C ; ???
lda #$00 lda #$00
sta L4359 sta menu_dispatch_flag
rts rts
L66F2: dex L66F2: dex
@ -11357,7 +11383,7 @@ L6EC5: lda #$00
sta $E26D sta $E26D
A2D_RELAY_CALL $35, LE26C ; ??? A2D_RELAY_CALL $35, LE26C ; ???
lda #$80 lda #$80
sta L4359 sta menu_dispatch_flag
rts rts
L6F0D: jsr L86FB L6F0D: jsr L86FB
@ -13950,89 +13976,124 @@ L85F8: .byte 0
L85F9: .byte 0 L85F9: .byte 0
L85FA: .byte 0 L85FA: .byte 0
L85FB: .byte 0 L85FB: .byte 0
L85FC: ldx #$03
L85FE: lda input_params_coords,x ;;; ==================================================
sta L86A0,x ;;; Double Click Detection
.proc L85FC
double_click_deltax := 8
double_click_deltay := 7
;; stash initial coords
ldx #3
: lda input_params_coords,x
sta coords,x
sta $EBFD,x sta $EBFD,x
dex dex
bpl L85FE bpl :-
lda #$00
lda #0
sta L869F sta L869F
lda machine_type lda machine_type ; Since IIgs is faster?
asl a asl a
rol L869F rol L869F
sta L869E sta L869E
L8619: dec L869E
bne L8626 loop: dec L869E
bne :+
dec L869F dec L869F
lda L869F lda L869F
bne L8655 bne exit
L8626: jsr L48F0
jsr L8658 : jsr L48F0
bmi L8655 jsr check_delta
lda #$FF bmi exit ; moved past delta; no double-click
sta L86A6
lda #$FF ; ???
sta unused
lda input_params_state lda input_params_state
sta L86A5 sta state ; unused ???
cmp #A2D_INPUT_NONE cmp #A2D_INPUT_NONE
beq L8619 beq loop
cmp #A2D_INPUT_HELD cmp #A2D_INPUT_HELD
beq L8619 beq loop
cmp #A2D_INPUT_UP cmp #A2D_INPUT_UP
bne L864B bne :+
jsr L48E6 jsr get_input
jmp L8619 jmp loop
: cmp #A2D_INPUT_DOWN
bne exit
L864B: cmp #$01 jsr get_input
bne L8655 lda #$00 ; double-click
jsr L48E6
lda #$00
rts rts
L8655: lda #$FF exit: lda #$FF ; not double-click
rts rts
L8658: lda input_params_xcoord ;; Is the new coord within range of the old coord?
.proc check_delta
;; compute x delta
lda input_params_xcoord
sec sec
sbc L86A0 sbc xcoord
sta L86A4 sta delta
lda input_params_xcoord+1 lda input_params_xcoord+1
sbc L86A1 sbc xcoord+1
bpl L8674 bpl :+
lda L86A4
cmp #$F8 ;; is -delta < x < 0 ?
bcs L867B lda delta
L8671: lda #$FF cmp #($100 - double_click_deltax)
bcs check_y
fail: lda #$FF
rts rts
L8674: lda L86A4 ;; is 0 < x < delta ?
cmp #$08 : lda delta
bcs L8671 cmp #double_click_deltax
L867B: lda input_params_ycoord bcs fail
;; compute y delta
check_y:lda input_params_ycoord
sec sec
sbc L86A2 sbc ycoord
sta L86A4 sta delta
lda input_params_ycoord+1 lda input_params_ycoord+1
sbc L86A3 sbc ycoord+1
bpl L8694 bpl :+
lda L86A4
cmp #$F9 ;; is -delta < y < 0 ?
bcs L869B lda delta
L8694: lda L86A4 cmp #($100 - double_click_deltay)
cmp #$07 bcs ok
bcs L8671
L869B: lda #$00 ;; is 0 < y < delta ?
: lda delta
cmp #double_click_deltay
bcs fail
ok: lda #$00
rts rts
.endproc
L869E: .byte 0 L869E: .byte 0
L869F: .byte 0 L869F: .byte 0
L86A0: .byte 0
L86A1: .byte 0 coords:
L86A2: .byte 0 xcoord: .word 0
L86A3: .byte 0 ycoord: .word 0
L86A4: .byte 0
L86A5: .byte 0 delta: .byte 0
L86A6: .byte 0 state: .byte 0
unused: .byte 0 ; ???
.endproc
;;; ==================================================
L86A7: ldx #$00 L86A7: ldx #$00
stx L86C0 stx L86C0
asl a asl a
@ -18072,12 +18133,12 @@ LA899: jmp dummy0000
lda #$36 lda #$36
sta LD6C3 sta LD6C3
lda #$01 lda #$01
sta $D6C4 sta LD6C3+1
axy_call draw_dialog_label, desktop_aux::str_about9, $09 axy_call draw_dialog_label, desktop_aux::str_about9, $09
lda #$28 lda #$28
sta LD6C3 sta LD6C3
lda #$00 lda #$00
sta $D6C4 sta LD6C3+1
: A2D_RELAY_CALL A2D_GET_INPUT, input_params : A2D_RELAY_CALL A2D_GET_INPUT, input_params
lda input_params_state lda input_params_state
@ -19226,7 +19287,7 @@ LB59A: tya
sta LD6C3 sta LD6C3
lda #$00 lda #$00
sbc $0C sbc $0C
sta $D6C4 sta LD6C3+1
pla pla
tay tay
LB5CC: dey LB5CC: dey
@ -19236,10 +19297,10 @@ LB5CC: dey
asl a asl a
clc clc
adc $D6C1 adc $D6C1
sta $D6C5 sta LD6C3+2
lda $D6C2 lda $D6C2
adc #$00 adc #$00
sta $D6C6 sta LD6C3+3
A2D_RELAY_CALL A2D_SET_POS, LD6C3 A2D_RELAY_CALL A2D_SET_POS, LD6C3
lda $06 lda $06
ldx $06+1 ldx $06+1