DeskTop: Identify double click timer in main memory

This commit is contained in:
Joshua Bell 2018-05-07 21:06:43 -07:00
parent df2babc38e
commit 6ff0b94a0e
3 changed files with 112 additions and 72 deletions

View File

@ -193,7 +193,7 @@ DEFAULT_FONT := $8800
;;; $05 = pointer (MT:B) $15 = rarrow (MT:U) ;;; $05 = pointer (MT:B) $15 = rarrow (MT:U)
;;; $06 = vbar (MT:_) $16 = tri ;;; $06 = vbar (MT:_) $16 = tri
;;; $07 = hbar (MT:S) $17 = open circ ;;; $07 = hbar (MT:S) $17 = open circ
;;; $08 = larrow $18 = close (MT:]) ;;; $08 = larrow (MT:H) $18 = close (MT:])
;;; $09 = left box $19 = gray odd (MT:W) ;;; $09 = left box $19 = gray odd (MT:W)
;;; $0A = darrow (MT:J) $1A = gray even (MT:V) ;;; $0A = darrow (MT:J) $1A = gray even (MT:V)
;;; $0B = uarrow (MT:K) $1B = solid circ ;;; $0B = uarrow (MT:K) $1B = solid circ

View File

@ -29,6 +29,9 @@ $(OUTDIR)/desktop_res.inc: desktop_res.s desktop_res_builder.s res/build_res_inc
$(CC65)/ca65 $(CAFLAGS) --listing $(OUTDIR)/desktop_res.list -o $@ desktop_res_builder.s $(CC65)/ca65 $(CAFLAGS) --listing $(OUTDIR)/desktop_res.list -o $@ desktop_res_builder.s
cat $(OUTDIR)/desktop_res.list | res/build_res_inc.pl > $@ cat $(OUTDIR)/desktop_res.list | res/build_res_inc.pl > $@
$(OUTDIR)/desktop.o: desktop.s $(HEADERS) desktop_aux.s desktop_lc.s desktop_main.s desktop_res.s
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
$(OUTDIR)/ovl34567.o: ovl34567.s $(HEADERS) ovl3.s ovl4.s ovl5.s ovl6.s ovl7.s $(OUTDIR)/ovl34567.o: ovl34567.s $(HEADERS) ovl3.s ovl4.s ovl5.s ovl6.s ovl7.s
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $< $(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<

View File

@ -7837,6 +7837,7 @@ loop: dec counter
dec counter+1 dec counter+1
lda counter+1 lda counter+1
bne exit bne exit
: jsr peek_event : jsr peek_event
;; Check coords, bail if pixel delta exceeded ;; Check coords, bail if pixel delta exceeded
@ -7847,7 +7848,7 @@ loop: dec counter
sta unused sta unused
lda event_kind lda event_kind
sta state ; unused ??? sta kind ; unused ???
cmp #MGTK::event_kind_no_event cmp #MGTK::event_kind_no_event
beq loop beq loop
@ -7855,8 +7856,10 @@ loop: dec counter
beq loop beq loop
cmp #MGTK::event_kind_button_up cmp #MGTK::event_kind_button_up
bne :+ bne :+
jsr get_event jsr get_event
jmp loop jmp loop
: cmp #MGTK::event_kind_button_down : cmp #MGTK::event_kind_button_down
bne exit bne exit
@ -7888,7 +7891,8 @@ fail: return #$FF
bcs fail bcs fail
;; compute y delta ;; compute y delta
check_y:lda event_ycoord check_y:
lda event_ycoord
sec sec
sbc ycoord sbc ycoord
sta delta sta delta
@ -7908,16 +7912,15 @@ check_y:lda event_ycoord
ok: return #0 ok: return #0
.endproc .endproc
counter:.word 0 counter:
.word 0
coords: coords:
xcoord: .word 0 xcoord: .word 0
ycoord: .word 0 ycoord: .word 0
delta: .byte 0 delta: .byte 0
state: .byte 0 ; unused?
unused: .byte 0 ; ???
kind: .byte 0 ; unused
unused: .byte 0 ; unused
.endproc .endproc
;;; ============================================================ ;;; ============================================================
@ -12923,88 +12926,122 @@ set_penmode_xor2:
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
rts rts
ldx #$03 ;; Another double-click timer?
LB447: lda event_coords,x .proc LB554
sta LB502,x double_click_deltax := 5
double_click_deltay := 4
ldx #3
: lda event_coords,x
sta coords,x
dex dex
bpl LB447 bpl :-
lda #$00
sta LB501 lda #0
sta counter+1
lda machine_type lda machine_type
asl a asl a
sta LB500 sta counter
rol LB501 rol counter+1
LB45F: dec LB500
lda LB500 ;; Decrement counter, bail if time delta exceeded
loop: dec counter
lda counter
cmp #$FF cmp #$FF
bne LB46C bne :+
dec LB501 dec counter+1
LB46C: lda LB501 : lda counter+1
bne LB476 bne :+
lda LB500 lda counter
beq LB4B7 beq exit
LB476: MGTK_RELAY_CALL MGTK::PeekEvent, event_params
jsr LB4BA : MGTK_RELAY_CALL MGTK::PeekEvent, event_params
bmi LB4B7
lda #$FF ;; Check coords, bail if pixel delta exceeded
sta LB508 jsr check_delta
lda event_kind bmi exit ; moved past delta; no double-click
sta LB507
lda #$FF ; ???
sta unused
lda event_kind ; unused ???
sta kind
cmp #MGTK::event_kind_no_event cmp #MGTK::event_kind_no_event
beq LB45F beq loop
cmp #MGTK::event_kind_drag cmp #MGTK::event_kind_drag
beq LB45F beq loop
cmp #MGTK::event_kind_button_up cmp #MGTK::event_kind_button_up
bne LB4A7 bne :+
MGTK_RELAY_CALL MGTK::GetEvent, event_params MGTK_RELAY_CALL MGTK::GetEvent, event_params
jmp LB45F jmp loop
: cmp #MGTK::event_kind_button_down
bne exit
LB4A7: cmp #$01
bne LB4B7
MGTK_RELAY_CALL MGTK::GetEvent, event_params MGTK_RELAY_CALL MGTK::GetEvent, event_params
return #0 return #0 ; double-click
LB4B7: return #$FF exit: return #$FF ; not double-click
LB4BA: lda event_xcoord ;; Is the new coord within range of the old coord?
.proc check_delta
;; compute x delta
lda event_xcoord
sec sec
sbc LB502 sbc xcoord
sta LB506 sta delta
lda event_xcoord+1 lda event_xcoord+1
sbc LB503 sbc xcoord+1
bpl LB4D6 bpl :+
lda LB506
cmp #$FB
bcs LB4DD
LB4D3: return #$FF
LB4D6: lda LB506 ;; is -delta < x < 0 ?
cmp #$05 lda delta
bcs LB4D3 cmp #($100 - double_click_deltax)
LB4DD: lda event_ycoord bcs check_y
fail: return #$FF
;; is 0 < x < delta ?
: lda delta
cmp #double_click_deltax
bcs fail
;; compute y delta
check_y:
lda event_ycoord
sec sec
sbc LB504 sbc ycoord
sta LB506 sta delta
lda event_ycoord+1 lda event_ycoord+1
sbc LB505 sbc ycoord+1
bpl LB4F6 bpl :+
lda LB506
cmp #$FC ;; is -delta < y < 0 ?
bcs LB4FD lda delta
LB4F6: lda LB506 cmp #($100 - double_click_deltay)
cmp #$04 bcs ok
bcs LB4D3
LB4FD: return #0 ;; is 0 < y < delta ?
: lda delta
cmp #double_click_deltay
bcs fail
ok: return #0
.endproc
counter:
.word 0
coords:
xcoord: .word 0
ycoord: .word 0
delta: .byte 0
kind: .byte 0 ; unused
unused: .byte 0 ; unused
.endproc
;;; ============================================================
LB500: .byte 0
LB501: .byte 0
LB502: .byte 0
LB503: .byte 0
LB504: .byte 0
LB505: .byte 0
LB506: .byte 0
LB507: .byte 0
LB508: .byte 0
LB509: sta LD8E7 LB509: sta LD8E7
jsr open_dialog_window jsr open_dialog_window
bit LD8E7 bit LD8E7