prefix event kind

This commit is contained in:
Joshua Bell 2018-02-02 20:10:19 -08:00
parent 2554765ba7
commit 6eee3b4ba4
9 changed files with 68 additions and 68 deletions

View File

@ -78,7 +78,7 @@ save_stack: .byte 0
call_init: call_init:
jmp init jmp init
;; Used after a drag-and-drop is completed; ;; Used after a event_kind_drag-and-drop is completed;
;; redraws the window. ;; redraws the window.
.proc redraw_screen_and_window .proc redraw_screen_and_window
@ -100,7 +100,7 @@ call_init:
bmi :+ bmi :+
DESKTOP_CALL DESKTOP_REDRAW_ICONS DESKTOP_CALL DESKTOP_REDRAW_ICONS
;; Redraw window after drag ;; Redraw window after event_kind_drag
lda #da_window_id lda #da_window_id
jsr check_visibility_and_draw_window jsr check_visibility_and_draw_window
@ -126,7 +126,7 @@ call_init:
offscreen_flag: offscreen_flag:
.byte 0 .byte 0
;; Called after window drag is complete ;; Called after window event_kind_drag is complete
;; (called with window_id in A) ;; (called with window_id in A)
.proc check_visibility_and_draw_window .proc check_visibility_and_draw_window
sta getwinport_params_window_id sta getwinport_params_window_id
@ -797,12 +797,12 @@ loop: lda adjust_txtptr_copied-1,x
input_loop: input_loop:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne :+ bne :+
jsr on_click jsr on_click
jmp input_loop jmp input_loop
: cmp #MGTK::key_down : cmp #MGTK::event_kind_key_down
bne input_loop bne input_loop
jsr on_key_press jsr on_key_press
jmp input_loop jmp input_loop
@ -1408,7 +1408,7 @@ invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port
check_button: check_button:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::drag ; Button down? cmp #MGTK::event_kind_drag ; Button down?
bne done ; Nope, done immediately bne done ; Nope, done immediately
lda #da_window_id lda #da_window_id
sta screentowindow_params::window_id sta screentowindow_params::window_id

View File

@ -79,7 +79,7 @@ call_init:
lda ROMIN2 lda ROMIN2
jmp init jmp init
;; Used after a drag-and-drop is completed; ;; Used after a event_kind_drag-and-drop is completed;
;; redraws the window. ;; redraws the window.
.proc redraw_screen_and_window .proc redraw_screen_and_window
@ -94,7 +94,7 @@ call_init:
bpl :- bpl :-
jsr zp_stash jsr zp_stash
;; Redraw window after drag ;; Redraw window after event_kind_drag
lda ROMIN2 lda ROMIN2
lda #da_window_id lda #da_window_id
jsr check_visibility_and_draw_window jsr check_visibility_and_draw_window
@ -134,7 +134,7 @@ skip: lda #0
offscreen_flag: offscreen_flag:
.byte 0 .byte 0
;; Called after window drag is complete ;; Called after window event_kind_drag is complete
;; (called with window_id in A) ;; (called with window_id in A)
.proc check_visibility_and_draw_window .proc check_visibility_and_draw_window
sta getwinport_params_window_id sta getwinport_params_window_id
@ -840,12 +840,12 @@ loop: lda adjust_txtptr_copied-1,x
input_loop: input_loop:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne :+ bne :+
jsr on_click jsr on_click
jmp input_loop jmp input_loop
: cmp #MGTK::key_down : cmp #MGTK::event_kind_key_down
bne input_loop bne input_loop
jsr on_key_press jsr on_key_press
jmp input_loop jmp input_loop
@ -1459,7 +1459,7 @@ invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port
check_button: check_button:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::drag ; Button down? cmp #MGTK::event_kind_drag ; Button down?
bne done ; Nope, done immediately bne done ; Nope, done immediately
lda #da_window_id lda #da_window_id
sta screentowindow_params::window_id sta screentowindow_params::window_id

View File

@ -328,12 +328,12 @@ init_window:
.proc input_loop .proc input_loop
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne :+ bne :+
jsr on_click jsr on_click
jmp input_loop jmp input_loop
: cmp #MGTK::key_down : cmp #MGTK::event_kind_key_down
bne input_loop bne input_loop
.endproc .endproc
@ -487,7 +487,7 @@ on_field_click:
stx hit_rect_index stx hit_rect_index
loop: MGTK_CALL MGTK::GetEvent, event_params ; Repeat while mouse is down loop: MGTK_CALL MGTK::GetEvent, event_params ; Repeat while mouse is down
lda event_params::kind lda event_params::kind
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
beq :+ beq :+
jsr do_inc_or_dec jsr do_inc_or_dec
jmp loop jmp loop

View File

@ -79,7 +79,7 @@ stash_stack: .byte 0
da_window_id := 51 da_window_id := 51
;;; ================================================== ;;; ==================================================
;;; Redraw the screen (all windows) after a drag ;;; Redraw the screen (all windows) after a event_kind_drag
.proc redraw_screen .proc redraw_screen
@ -714,13 +714,13 @@ ploop: lda position_table+1,y
.proc input_loop .proc input_loop
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne :+ bne :+
jsr on_click jsr on_click
jmp input_loop jmp input_loop
;; key? ;; key?
: cmp #MGTK::key_down : cmp #MGTK::event_kind_key_down
bne input_loop bne input_loop
jsr check_key jsr check_key
jmp input_loop jmp input_loop

View File

@ -173,7 +173,7 @@ base: .word 0
.proc event_params ; queried to track mouse-up .proc event_params ; queried to track mouse-up
kind: .byte $00 kind: .byte $00
;;; if state is MGTK::key_down ;;; if state is MGTK::event_kind_key_down
key := * key := *
modifiers := *+1 modifiers := *+1
@ -360,9 +360,9 @@ end: rts
.proc input_loop .proc input_loop
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::button_down ; was clicked? cmp #MGTK::event_kind_button_down ; was clicked?
beq exit beq exit
cmp #MGTK::key_down ; any key? cmp #MGTK::event_kind_key_down ; any key?
beq on_key beq on_key
bne input_loop bne input_loop

View File

@ -845,7 +845,7 @@ store: sta winfo::hthumbpos
;;; ================================================== ;;; ==================================================
;;; UI Helpers ;;; UI Helpers
;; Used at start of thumb drag ;; Used at start of thumb event_kind_drag
.proc do_trackthumb .proc do_trackthumb
lda event_params::mousex lda event_params::mousex
sta trackthumb_params::mousex sta trackthumb_params::mousex

View File

@ -1474,7 +1474,7 @@ L99FC: MGTK_CALL MGTK::SetPattern, checkerboard_pattern2
MGTK_CALL MGTK::FramePoly, drag_outline_buffer MGTK_CALL MGTK::FramePoly, drag_outline_buffer
L9A0E: MGTK_CALL MGTK::PeekEvent, peekevent_params L9A0E: MGTK_CALL MGTK::PeekEvent, peekevent_params
lda peekevent_params::kind lda peekevent_params::kind
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq L9A1E beq L9A1E
jmp L9BA5 jmp L9BA5
@ -3911,11 +3911,11 @@ LBB75: MGTK_RELAY2_CALL MGTK::MoveTo, point8
jsr draw_pascal_string jsr draw_pascal_string
LBB87: MGTK_RELAY2_CALL MGTK::GetEvent, event_params LBB87: MGTK_RELAY2_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne LBB9A bne LBB9A
jmp LBC0C jmp LBC0C
LBB9A: cmp #MGTK::key_down LBB9A: cmp #MGTK::event_kind_key_down
bne LBB87 bne LBB87
lda event_params_key lda event_params_key
and #$7F and #$7F
@ -3988,7 +3988,7 @@ LBC6D: MGTK_RELAY2_CALL MGTK::SetPenMode, penXOR
sta LBCE8 sta LBCE8
LBC84: MGTK_RELAY2_CALL MGTK::GetEvent, event_params LBC84: MGTK_RELAY2_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
beq LBCDB beq LBCDB
jsr LBDE1 jsr LBDE1
MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords
@ -4025,7 +4025,7 @@ LBCE9: MGTK_RELAY2_CALL MGTK::SetPenMode, penXOR
sta LBD64 sta LBD64
LBD00: MGTK_RELAY2_CALL MGTK::GetEvent, event_params LBD00: MGTK_RELAY2_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
beq LBD57 beq LBD57
jsr LBDE1 jsr LBDE1
MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords
@ -4062,7 +4062,7 @@ LBD65: lda #$00
MGTK_RELAY2_CALL MGTK::PaintRect, try_again_rect MGTK_RELAY2_CALL MGTK::PaintRect, try_again_rect
LBD7C: MGTK_RELAY2_CALL MGTK::GetEvent, event_params LBD7C: MGTK_RELAY2_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
beq LBDD3 beq LBDD3
jsr LBDE1 jsr LBDE1
MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords MGTK_RELAY2_CALL MGTK::MoveTo, event_params_coords
@ -6093,9 +6093,9 @@ L4088: jsr reset_grafport3
L40A6: jsr L464E L40A6: jsr L464E
jsr get_input jsr get_input
lda event_params_kind lda event_params_kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
beq L40B7 beq L40B7
cmp #MGTK::apple_key cmp #MGTK::event_kind_apple_key
bne L40BD bne L40BD
L40B7: jsr handle_click L40B7: jsr handle_click
jmp L4088 jmp L4088
@ -8668,9 +8668,9 @@ L5579: lda #$00
L5581: jsr L55F0 L5581: jsr L55F0
L5584: jsr get_input L5584: jsr get_input
lda event_params_kind lda event_params_kind
cmp #MGTK::key_down cmp #MGTK::event_kind_key_down
beq L5595 beq L5595
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne L5584 bne L5584
jmp L55D1 jmp L55D1
@ -8861,9 +8861,9 @@ L572D: lda #$00
sta L578C sta L578C
L5732: jsr get_input L5732: jsr get_input
lda event_params_kind lda event_params_kind
cmp #MGTK::key_down cmp #MGTK::event_kind_key_down
beq L5743 beq L5743
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne L5732 bne L5732
jmp L578B jmp L578B
@ -8929,9 +8929,9 @@ L578D: .byte 0
jsr L5803 jsr L5803
loop: jsr get_input loop: jsr get_input
lda event_params_kind lda event_params_kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
beq done beq done
cmp #MGTK::key_down cmp #MGTK::event_kind_key_down
bne loop bne loop
lda event_params_key lda event_params_key
cmp #KEY_RETURN cmp #KEY_RETURN
@ -9522,7 +9522,7 @@ L5C71: lda desktop_active_winid
L5C89: sta L5CB6 L5C89: sta L5CB6
jsr L48F0 jsr L48F0
lda event_params_kind lda event_params_kind
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq L5C99 beq L5C99
L5C96: lda #$FF L5C96: lda #$FF
rts rts
@ -9811,7 +9811,7 @@ L5F20: lda event_params_coords,x
bpl L5F20 bpl L5F20
jsr L48F0 jsr L48F0
lda event_params_kind lda event_params_kind
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq L5F3F beq L5F3F
bit BUTN0 bit BUTN0
bmi L5F3E bmi L5F3E
@ -9834,7 +9834,7 @@ L5F50: lda L5F0B,x
MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230
L5F6B: jsr L48F0 L5F6B: jsr L48F0
lda event_params_kind lda event_params_kind
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq L5FC5 beq L5FC5
MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230
ldx #$00 ldx #$00
@ -10809,7 +10809,7 @@ L68B8: lda event_params_coords,x
bpl L68B8 bpl L68B8
jsr L48F0 jsr L48F0
lda event_params_kind lda event_params_kind
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq L68CF beq L68CF
rts rts
@ -10818,7 +10818,7 @@ L68CF: MGTK_RELAY_CALL MGTK::SetPattern, checkerboard_pattern3
MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230
L68E4: jsr L48F0 L68E4: jsr L48F0
lda event_params_kind lda event_params_kind
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq L6932 beq L6932
MGTK_RELAY_CALL MGTK::FrameRect, rect_E230 MGTK_RELAY_CALL MGTK::FrameRect, rect_E230
ldx #$00 ldx #$00
@ -13947,7 +13947,7 @@ L84DC: lda grafport2::width
sbc grafport2::cliprect_y1+1 sbc grafport2::cliprect_y1+1
sta L85FB sta L85FB
lda event_params_kind lda event_params_kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne L850C bne L850C
asl a asl a
bne L850E bne L850E
@ -14100,15 +14100,15 @@ loop: dec counter
lda event_params_kind lda event_params_kind
sta state ; unused ??? sta state ; unused ???
cmp #MGTK::no_event cmp #MGTK::event_kind_no_event
beq loop beq loop
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq loop beq loop
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
bne :+ bne :+
jsr get_input jsr get_input
jmp loop jmp loop
: cmp #MGTK::button_down : cmp #MGTK::event_kind_button_down
bne exit bne exit
jsr get_input jsr get_input
@ -17756,7 +17756,7 @@ LA3CA: ldx L9188
LA3D1: yax_call JT_MGTK_RELAY, MGTK::GetEvent, event_params LA3D1: yax_call JT_MGTK_RELAY, MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::key_down cmp #MGTK::event_kind_key_down
bne LA3EC bne LA3EC
lda event_params_key lda event_params_key
cmp #KEY_ESCAPE cmp #KEY_ESCAPE
@ -17940,11 +17940,11 @@ prompt_input_loop:
sta LD8E9 sta LD8E9
LA579: MGTK_RELAY_CALL MGTK::GetEvent, event_params LA579: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
bne LA58C bne LA58C
jmp LA5EE jmp LA5EE
LA58C: cmp #MGTK::key_down LA58C: cmp #MGTK::event_kind_key_down
bne LA593 bne LA593
jmp LA6FD jmp LA6FD
@ -18302,9 +18302,9 @@ jump_relay:
: MGTK_RELAY_CALL MGTK::GetEvent, event_params : MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_down cmp #MGTK::event_kind_button_down
beq close beq close
cmp #MGTK::key_down cmp #MGTK::event_kind_key_down
bne :- bne :-
lda event_params_key lda event_params_key
and #$7F and #$7F
@ -19382,11 +19382,11 @@ LB476: MGTK_RELAY_CALL MGTK::PeekEvent, event_params
sta LB508 sta LB508
lda event_params_kind lda event_params_kind
sta LB507 sta LB507
cmp #MGTK::no_event cmp #MGTK::event_kind_no_event
beq LB45F beq LB45F
cmp #MGTK::drag cmp #MGTK::event_kind_drag
beq LB45F beq LB45F
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
bne LB4A7 bne LB4A7
MGTK_RELAY_CALL MGTK::GetEvent, event_params MGTK_RELAY_CALL MGTK::GetEvent, event_params
jmp LB45F jmp LB45F
@ -19811,7 +19811,7 @@ LB88A: sta LB8F3
sta LB8F2 sta LB8F2
LB892: MGTK_RELAY_CALL MGTK::GetEvent, event_params LB892: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::button_up cmp #MGTK::event_kind_button_up
beq LB8E3 beq LB8E3
lda winfoF lda winfoF
sta event_params sta event_params

View File

@ -4669,20 +4669,20 @@ L666D:
lda input::modifiers lda input::modifiers
sta input::kmods sta input::kmods
lda #MGTK::key_down lda #MGTK::event_kind_key_down
sta input::state sta input::state
bne L66D8 bne L66D8
L66B9: bcc up L66B9: bcc up
lda input::modifiers lda input::modifiers
beq :+ beq :+
lda #MGTK::apple_key lda #MGTK::event_kind_apple_key
bne set_state bne set_state
: lda #MGTK::button_down : lda #MGTK::event_kind_button_down
bne set_state bne set_state
up: lda #MGTK::button_up up: lda #MGTK::event_kind_button_up
set_state: set_state:
sta input::state sta input::state
@ -8524,7 +8524,7 @@ L8347: MGTK_CALL MGTK::PostEvent, set_input_params
rts rts
.proc set_input_params ; 1 byte shorter than normal, since KEY .proc set_input_params ; 1 byte shorter than normal, since KEY
state: .byte MGTK::key_down state: .byte MGTK::event_kind_key_down
key: .byte 0 key: .byte 0
modifiers: modifiers:
.byte 0 .byte 0

View File

@ -282,7 +282,7 @@ GetEvent := $2A
;; (input length 0 bytes) ;; (input length 0 bytes)
;; (output length 5 bytes) ;; (output length 5 bytes)
;; .byte kind ;; .byte kind
;; if kind is key_down: ;; if kind is event_kind_key_down:
;; .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 kind otherwise: ;; if kind otherwise:
@ -298,7 +298,7 @@ PeekEvent := $2C
PostEvent := $2D ; Set pending input kind (mouse or keyboard) PostEvent := $2D ; Set pending input kind (mouse or keyboard)
;; (input length 5 bytes) ;; (input length 5 bytes)
;; .byte kind ;; .byte kind
;; if kind is key_down: ;; if kind is event_kind_key_down:
;; .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 kind otherwise: ;; if kind otherwise:
@ -524,12 +524,12 @@ textbg_white := $7F
;;; Mouse Graphics Tool Kit Constants ;;; Mouse Graphics Tool Kit Constants
;;; Used in GetEvent ;;; Used in GetEvent
no_event := 0 ; No mouse or keypress event_kind_no_event := 0 ; No mouse or keypress
button_down := 1 ; Mouse button was depressed event_kind_button_down := 1 ; Mouse button was depressed
button_up := 2 ; Mouse button was released event_kind_button_up := 2 ; Mouse button was released
key_down := 3 ; Key was pressed event_kind_key_down := 3 ; Key was pressed
drag := 4 ; Mouse button still down event_kind_drag := 4 ; Mouse button still down
apple_key := 5 ; Mouse button was depressed, modifier key down event_kind_apple_key := 5 ; Mouse button was depressed, modifier key down
;;; Used in FindWindow ;;; Used in FindWindow
area_desktop := 0 area_desktop := 0