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
;; .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 modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both)
;; if state is 3:
;; .word xcoord
;; .word ycoord
A2D_UNK_2B := $2B ; Unknown
;; no parameters (pass $0000 as address)
@ -135,9 +139,9 @@ A2D_DESTROY_WINDOW := $39
A2D_UNK_3C := $3C ; Unknown, used in calculator
A2D_GET_MOUSE := $40
;; .word x (relative to screen)
;; .word y
A2D_QUERY_TARGET := $40
;; .word queryx (relative to screen)
;; .word queryy
;; .byte element (A2D_ELEM_*)
;; 0 = desktop
;; 1 = menu

View File

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

View File

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