Sort out call 0

This commit is contained in:
Joshua Bell 2017-09-08 20:45:11 -07:00
parent 96d7ccf9d8
commit 0d460f63c1
3 changed files with 40 additions and 33 deletions

View File

@ -88,8 +88,12 @@ A2D_HIDE_CURSOR := $26
A2D_GET_INPUT := $2A A2D_GET_INPUT := $2A
;; .byte state (0=up, 1=press, 2=release, 3=key, 4=held) ;; .byte state (0=up, 1=press, 2=release, 3=key, 4=held)
;; if state is not 3:
;; .byte key (ASCII code; high bit clear) ;; .byte key (ASCII code; high bit clear)
;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both) ;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both)
;; if state is 3:
;; .word xcoord
;; .word ycoord
A2D_UNK_2B := $2B ; Unknown A2D_UNK_2B := $2B ; Unknown
;; no parameters (pass $0000 as address) ;; no parameters (pass $0000 as address)
@ -135,9 +139,9 @@ A2D_DESTROY_WINDOW := $39
A2D_UNK_3C := $3C ; Unknown, used in calculator A2D_UNK_3C := $3C ; Unknown, used in calculator
A2D_GET_MOUSE := $40 A2D_QUERY_TARGET := $40
;; .word x (relative to screen) ;; .word queryx (relative to screen)
;; .word y ;; .word queryy
;; .byte element (A2D_ELEM_*) ;; .byte element (A2D_ELEM_*)
;; 0 = desktop ;; 0 = desktop
;; 1 = menu ;; 1 = menu

View File

@ -158,8 +158,8 @@ L08C4: rts
.proc map_coords_params .proc map_coords_params
id := * id := *
screen := * + 1 screen := * + 1
screenx := * + 1 ; aligns with get_mouse_params::xcoord screenx := * + 1 ; aligns with target_params::xcoord
screeny := * + 3 ; aligns with get_mouse_params::ycoord screeny := * + 3 ; aligns with target_params::ycoord
client := * + 5 client := * + 5
clientx := * + 5 clientx := * + 5
clienty := * + 7 clienty := * + 7
@ -167,19 +167,21 @@ clienty := * + 7
.proc input_state_params .proc input_state_params
state: .byte 0 state: .byte 0
key := * xcoord := * ; if state is 0,1,2,4
modifiers := * + 1 ycoord := * + 2 ; "
key := * ; if state is 3
modifiers := * + 1 ; "
.endproc .endproc
.proc get_mouse_params .proc target_params
xcoord: .word 0 queryx: .word 0 ; aligns with input_state_params::xcoord
ycoord: .word 0 queryy: .word 0 ; aligns with input_state_params::ycoord
elem: .byte 0 elem: .byte 0
id: .byte 0 id: .byte 0
.word 0 ; ???
.endproc .endproc
.byte $00,$00 .byte 0, 0 ; fills out space for map_coords_params
.byte 0, 0 ; ???
.proc button_click_params .proc button_click_params
state: .byte 0 state: .byte 0
@ -723,19 +725,19 @@ input_loop:
on_click: on_click:
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
A2D_CALL A2D_GET_MOUSE, get_mouse_params A2D_CALL A2D_QUERY_TARGET, target_params
lda ROMIN2 lda ROMIN2
lda get_mouse_params::elem lda target_params::elem
cmp #A2D_ELEM_CLIENT ; Less than CLIENT is MENU or DESKTOP cmp #A2D_ELEM_CLIENT ; Less than CLIENT is MENU or DESKTOP
bcc ignore_click bcc ignore_click
lda get_mouse_params::id lda target_params::id
cmp #window_id ; This window? cmp #window_id ; This window?
beq :+ beq :+
ignore_click: ignore_click:
rts rts
: lda get_mouse_params::elem : lda target_params::elem
cmp #A2D_ELEM_CLIENT ; Client area? cmp #A2D_ELEM_CLIENT ; Client area?
bne :+ bne :+
jsr map_click_to_button ; try to translate click into key jsr map_click_to_button ; try to translate click into key

View File

@ -245,12 +245,13 @@ track_scroll_delta:
fixed_mode_flag: fixed_mode_flag:
.byte $00 ; 0 = proportional, otherwise = fixed .byte $00 ; 0 = proportional, otherwise = fixed
input_params: ; queried to track mouse-up .proc input_params
.byte $00 state: .byte 0
coords: ; spills into target query
.proc mouse_params ; queried by main input loop
xcoord: .word 0 xcoord: .word 0
ycoord: .word 0 ycoord: .word 0
.endproc
.proc target_params
elem: .byte 0 elem: .byte 0
win: .byte 0 win: .byte 0
.endproc .endproc
@ -515,24 +516,24 @@ input_loop:
cmp #1 ; was clicked? cmp #1 ; was clicked?
bne input_loop ; nope, keep waiting bne input_loop ; nope, keep waiting
A2D_CALL A2D_GET_MOUSE, mouse_params A2D_CALL A2D_QUERY_TARGET, input_params::coords
lda mouse_params::win ; in our window? lda target_params::win ; in our window?
cmp #window_id cmp #window_id
bne input_loop bne input_loop
;; which part of the window? ;; which part of the window?
lda mouse_params::elem lda target_params::elem
cmp #A2D_ELEM_CLOSE cmp #A2D_ELEM_CLOSE
beq on_close_click beq on_close_click
;; title and resize clicks need mouse location ;; title and resize clicks need mouse location
ldx mouse_params::xcoord ldx input_params::xcoord
stx resize_drag_params::xcoord stx resize_drag_params::xcoord
stx query_client_params::xcoord stx query_client_params::xcoord
ldx mouse_params::xcoord+1 ldx input_params::xcoord+1
stx resize_drag_params::xcoord+1 stx resize_drag_params::xcoord+1
stx query_client_params::xcoord+1 stx query_client_params::xcoord+1
ldx mouse_params::ycoord ldx input_params::ycoord
stx resize_drag_params::ycoord stx resize_drag_params::ycoord
stx query_client_params::ycoord stx query_client_params::ycoord
@ -857,11 +858,11 @@ store: sta window_params::hscroll_pos
;; Used at start of thumb drag ;; Used at start of thumb drag
.proc do_thumb_drag .proc do_thumb_drag
lda mouse_params::xcoord lda input_params::xcoord
sta thumb_drag_params::xcoord sta thumb_drag_params::xcoord
lda mouse_params::xcoord+1 lda input_params::xcoord+1
sta thumb_drag_params::xcoord+1 sta thumb_drag_params::xcoord+1
lda mouse_params::ycoord lda input_params::ycoord
sta thumb_drag_params::ycoord sta thumb_drag_params::ycoord
A2D_CALL A2D_DRAG_SCROLL, thumb_drag_params A2D_CALL A2D_DRAG_SCROLL, thumb_drag_params
rts rts
@ -1365,10 +1366,10 @@ end: rts
;;; Title Bar (Proportional/Fixed mode button) ;;; Title Bar (Proportional/Fixed mode button)
.proc on_title_bar_click .proc on_title_bar_click
lda mouse_params::xcoord+1 ; mouse x high byte? lda input_params::xcoord+1 ; mouse x high byte?
cmp mode_box_left+1 cmp mode_box_left+1
bne :+ bne :+
lda mouse_params::xcoord lda input_params::xcoord
cmp mode_box_left cmp mode_box_left
: bcc ignore : bcc ignore