macros define scopes not procs; button event loop

This commit is contained in:
Joshua Bell 2018-02-03 19:59:50 -08:00
parent fb4b59f204
commit bbb6e3c680
2 changed files with 218 additions and 181 deletions

View File

@ -424,30 +424,30 @@ L8C83: .byte $00,$00,$00,$00,$77,$30,$01
num_vertices: .byte 8 num_vertices: .byte 8
lastpoly: .byte 0 ; 0 = last poly lastpoly: .byte 0 ; 0 = last poly
vertices: vertices:
DEFINE_POINT 0, 0, v0 v0: DEFINE_POINT 0, 0, v0
DEFINE_POINT 0, 0, v1 v1: DEFINE_POINT 0, 0, v1
DEFINE_POINT 0, 0, v2 v2: DEFINE_POINT 0, 0, v2
DEFINE_POINT 0, 0, v3 v3: DEFINE_POINT 0, 0, v3
DEFINE_POINT 0, 0, v4 v4: DEFINE_POINT 0, 0, v4
DEFINE_POINT 0, 0, v5 v5: DEFINE_POINT 0, 0, v5
DEFINE_POINT 0, 0, v6 v6: DEFINE_POINT 0, 0, v6
DEFINE_POINT 0, 0, v7 v7: DEFINE_POINT 0, 0, v7
.endproc .endproc
.proc paintbits_params2 .proc paintbits_params2
DEFINE_POINT 0, 0, viewloc viewloc: DEFINE_POINT 0, 0, viewloc
mapbits: .addr 0 mapbits: .addr 0
mapwidth: .byte 0 mapwidth: .byte 0
reserved: .byte 0 reserved: .byte 0
DEFINE_RECT 0,0,0,0,maprect maprect: DEFINE_RECT 0,0,0,0,maprect
.endproc .endproc
.proc paintbits_params .proc paintbits_params
DEFINE_POINT 0, 0, viewloc viewloc: DEFINE_POINT 0, 0, viewloc
mapbits: .addr 0 mapbits: .addr 0
mapwidth: .byte 0 mapwidth: .byte 0
reserved: .byte 0 reserved: .byte 0
DEFINE_RECT 0,0,0,0,maprect maprect: DEFINE_RECT 0,0,0,0,maprect
.endproc .endproc
.proc paintrect_params6 .proc paintrect_params6
@ -3702,11 +3702,11 @@ alert_inner_frame_rect2:
DEFINE_RECT 5, 3, 415, 52 DEFINE_RECT 5, 3, 415, 52
.proc grafport6 .proc grafport6
DEFINE_POINT $41, $57, viewloc viewloc: DEFINE_POINT $41, $57, viewloc
mapbits: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
mapwidth: .byte MGTK::screen_mapwidth mapwidth: .byte MGTK::screen_mapwidth
reserved: .byte 0 reserved: .byte 0
DEFINE_RECT 0, 0, $1A4, $37, maprect maprect: DEFINE_RECT 0, 0, $1A4, $37, maprect
.endproc .endproc
@ -3731,7 +3731,7 @@ cancel_pos:
.word $BE,$10 ; ??? .word $BE,$10 ; ???
DEFINE_POINT 75,29, point8 point8: DEFINE_POINT 75,29, point8
alert_action: .byte $00 alert_action: .byte $00
prompt_addr: .addr 0 prompt_addr: .addr 0
@ -5111,11 +5111,11 @@ nextwinfo: .addr 0
;; Coordinates for labels? ;; Coordinates for labels?
.byte $28,$00,$25,$00,$68,$01,$2F,$00,$2D,$00,$2E,$00 .byte $28,$00,$25,$00,$68,$01,$2F,$00,$2D,$00,$2E,$00
DEFINE_RECT 40,61,360,71, rect1 rect1: DEFINE_RECT 40,61,360,71, rect1
DEFINE_POINT 45,70, point6 point6: DEFINE_POINT 45,70, point6
DEFINE_POINT 0, 18, point4 point4: DEFINE_POINT 0, 18, point4
DEFINE_POINT 40,18, point7 point7: DEFINE_POINT 40,18, point7
DEFINE_POINT $28, $23, pointD pointD: DEFINE_POINT $28, $23, pointD
dialog_label_pos: dialog_label_pos:
DEFINE_POINT 40,0 DEFINE_POINT 40,0
@ -5532,10 +5532,10 @@ LE6C1:
win_buf_table: ; ??? win_buf_table: ; ???
.res 8, 0 .res 8, 0
DEFINE_POINT 0, 0, point9 point9: DEFINE_POINT 0, 0, point9
DEFINE_POINT 112, 0, pointA pointA: DEFINE_POINT 112, 0, pointA
DEFINE_POINT 140, 0, pointB pointB: DEFINE_POINT 140, 0, pointB
DEFINE_POINT 231, 0, pointC pointC: DEFINE_POINT 231, 0, pointC
.proc text_buffer2 .proc text_buffer2
.addr data .addr data
@ -5602,9 +5602,9 @@ str_items:
items_label_pos: items_label_pos:
DEFINE_POINT 8, 10 DEFINE_POINT 8, 10
DEFINE_POINT 0, 0, point1 point1: DEFINE_POINT 0, 0, point1
DEFINE_POINT 0, 0, point5 point5: DEFINE_POINT 0, 0, point5
str_k_in_disk: str_k_in_disk:
PASCAL_STRING "K in disk" PASCAL_STRING "K in disk"
@ -5616,8 +5616,8 @@ str_6_spaces:
PASCAL_STRING " " PASCAL_STRING " "
LEBE3: .byte $00,$00,$00,$00,$00,$00,$00,$00 LEBE3: .byte $00,$00,$00,$00,$00,$00,$00,$00
DEFINE_POINT 0, 0, point2 point2: DEFINE_POINT 0, 0, point2
DEFINE_POINT 0, 0, point3 point3: DEFINE_POINT 0, 0, point3
.byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00 .byte $00
@ -17998,7 +17998,7 @@ LA5A9: lda $D20E
jmp prompt_input_loop jmp prompt_input_loop
LA5B4: lda winfoF LA5B4: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
lda winfoF lda winfoF
sta event_params sta event_params
MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params
@ -18033,7 +18033,7 @@ LA609: lda $D20E
rts rts
LA614: lda winfoF LA614: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
lda winfoF lda winfoF
sta event_params sta event_params
MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params
@ -18047,42 +18047,48 @@ LA63A: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::ok_button_rect
beq LA64A beq LA64A
jmp LA6C1 jmp LA6C1
LA64A: jsr set_fill_black prompt_button_ok := 0
prompt_button_cancel := 1
prompt_button_yes := 2
prompt_button_no := 3
prompt_button_all := 4
LA64A: jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::ok_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::ok_button_rect
jsr LB7CF jsr button_loop_ok
bmi LA65D bmi :+
lda #$00 lda #prompt_button_ok
LA65D: rts : rts
LA65E: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::yes_button_rect LA65E: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::yes_button_rect
cmp #$80 cmp #$80
bne LA67F bne LA67F
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::yes_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::yes_button_rect
jsr LB7D9 jsr button_loop_yes
bmi LA67E bmi :+
lda #$02 lda #prompt_button_yes
LA67E: rts : rts
LA67F: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::no_button_rect LA67F: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::no_button_rect
cmp #$80 cmp #$80
bne LA6A0 bne LA6A0
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::no_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::no_button_rect
jsr LB7DE jsr button_loop_no
bmi LA69F bmi :+
lda #$03 lda #prompt_button_no
LA69F: rts : rts
LA6A0: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::all_button_rect LA6A0: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::all_button_rect
cmp #$80 cmp #$80
bne LA6C1 bne LA6C1
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::all_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::all_button_rect
jsr LB7E3 jsr button_loop_all
bmi LA6C0 bmi :+
lda #$04 lda #prompt_button_all
LA6C0: rts : rts
LA6C1: bit LD8E7 LA6C1: bit LD8E7
bpl LA6C9 bpl LA6C9
@ -18094,12 +18100,12 @@ LA6C9: MGTK_RELAY_CALL MGTK::InRect, desktop_aux::cancel_button_rect
beq LA6D9 beq LA6D9
jmp LA6ED jmp LA6ED
LA6D9: jsr set_fill_black LA6D9: jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::cancel_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::cancel_button_rect
jsr LB7D4 jsr button_loop_cancel
bmi LA6EC bmi :+
lda #$01 lda #prompt_button_cancel
LA6EC: rts : rts
LA6ED: bit LD8E8 LA6ED: bit LD8E8
bmi LA6F7 bmi LA6F7
@ -18233,17 +18239,17 @@ LA7DD: ldx LD8E8
LA7E5: lda #$FF LA7E5: lda #$FF
rts rts
LA7E8: jsr set_fill_black LA7E8: jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::yes_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::yes_button_rect
lda #$02 lda #$02
rts rts
LA7F7: jsr set_fill_black LA7F7: jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::no_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::no_button_rect
lda #$03 lda #$03
rts rts
LA806: jsr set_fill_black LA806: jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::all_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::all_button_rect
lda #$04 lda #$04
rts rts
@ -18281,16 +18287,16 @@ LA84E: lda #$FF
rts rts
LA851: lda winfoF LA851: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::ok_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::ok_button_rect
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::ok_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::ok_button_rect
lda #$00 lda #$00
rts rts
LA86F: lda winfoF LA86F: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::cancel_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::cancel_button_rect
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::cancel_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::cancel_button_rect
lda #$01 lda #$01
@ -18315,8 +18321,8 @@ jump_relay:
.proc show_about_dialog .proc show_about_dialog
MGTK_RELAY_CALL MGTK::OpenWindow, winfo18 MGTK_RELAY_CALL MGTK::OpenWindow, winfo18
lda winfo18::window_id lda winfo18::window_id
jsr LB7B9 jsr set_port_from_window_id
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::about_dialog_outer_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::about_dialog_outer_rect
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::about_dialog_inner_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::about_dialog_inner_rect
addr_call draw_centered_string, desktop_aux::str_about1 addr_call draw_centered_string, desktop_aux::str_about1
@ -18403,7 +18409,7 @@ LA9B5: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB0B6 MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB0B6
addr_call draw_text1, str_7_spaces addr_call draw_text1, str_7_spaces
addr_call draw_text1, str_files addr_call draw_text1, str_files
@ -18418,7 +18424,7 @@ LA9E6: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr LBE8D jsr LBE8D
jsr LBE9A jsr LBE9A
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
@ -18454,7 +18460,7 @@ LAA5A: jsr reset_state
LAA6A: jsr bell LAA6A: jsr bell
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
axy_call draw_dialog_label, $06, desktop_aux::str_exists_prompt axy_call draw_dialog_label, $06, desktop_aux::str_exists_prompt
jsr draw_yes_no_all_cancel_buttons jsr draw_yes_no_all_cancel_buttons
LAA7F: jsr prompt_input_loop LAA7F: jsr prompt_input_loop
@ -18468,7 +18474,7 @@ LAA7F: jsr prompt_input_loop
LAA9C: jsr bell LAA9C: jsr bell
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
axy_call draw_dialog_label, $06, desktop_aux::str_large_prompt axy_call draw_dialog_label, $06, desktop_aux::str_large_prompt
jsr draw_ok_cancel_buttons jsr draw_ok_cancel_buttons
LAAB1: jsr prompt_input_loop LAAB1: jsr prompt_input_loop
@ -18531,7 +18537,7 @@ do1: ldy #1
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB0B6 MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB0B6
addr_call draw_text1, str_7_spaces addr_call draw_text1, str_7_spaces
addr_call draw_text1, str_files addr_call draw_text1, str_files
@ -18546,7 +18552,7 @@ do2: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr LBE8D jsr LBE8D
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
ldy #$03 ldy #$03
@ -18570,7 +18576,7 @@ do3: jsr reset_state
do4: jsr bell do4: jsr bell
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
axy_call draw_dialog_label, ptr, desktop_aux::str_ramcard_full axy_call draw_dialog_label, ptr, desktop_aux::str_ramcard_full
jsr draw_ok_button jsr draw_ok_button
: jsr prompt_input_loop : jsr prompt_input_loop
@ -18628,7 +18634,7 @@ do1: ldy #$01
sta LD90A sta LD90A
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
lda #$A5 lda #$A5
sta dialog_label_pos sta dialog_label_pos
yax_call draw_dialog_label, $01, str_7_spaces yax_call draw_dialog_label, $01, str_7_spaces
@ -18658,7 +18664,7 @@ do3: jsr reset_state
rts rts
do2: lda winfoF do2: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr draw_ok_button jsr draw_ok_button
: jsr prompt_input_loop : jsr prompt_input_loop
bmi :- bmi :-
@ -18719,7 +18725,7 @@ LAD2A: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
lda LAD1F lda LAD1F
bne LAD54 bne LAD54
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB16A MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB16A
@ -18739,7 +18745,7 @@ LAD6C: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr LBE8D jsr LBE8D
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
ldy #$03 ldy #$03
@ -18757,7 +18763,7 @@ LAD6C: ldy #$01
rts rts
LADBB: lda winfoF LADBB: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr draw_ok_cancel_buttons jsr draw_ok_cancel_buttons
LADC4: jsr prompt_input_loop LADC4: jsr prompt_input_loop
bmi LADC4 bmi LADC4
@ -18776,7 +18782,7 @@ LADF5: jsr reset_state
rts rts
LAE05: lda winfoF LAE05: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
axy_call draw_dialog_label, $06, desktop_aux::str_delete_locked_file axy_call draw_dialog_label, $06, desktop_aux::str_delete_locked_file
jsr draw_yes_no_all_cancel_buttons jsr draw_yes_no_all_cancel_buttons
LAE17: jsr prompt_input_loop LAE17: jsr prompt_input_loop
@ -18809,9 +18815,9 @@ LAE49: lda #$80
lda #$00 lda #$00
jsr LB509 jsr LB509
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
addr_call draw_centered_string, desktop_aux::str_new_folder_title addr_call draw_centered_string, desktop_aux::str_new_folder_title
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, rect1 MGTK_RELAY_CALL MGTK::FrameRect, rect1
rts rts
@ -18835,7 +18841,7 @@ LAE90: lda ($08),y
dey dey
bpl LAE90 bpl LAE90
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
yax_call draw_dialog_label, $02, desktop_aux::str_in_colon yax_call draw_dialog_label, $02, desktop_aux::str_in_colon
lda #$37 lda #$37
sta dialog_label_pos sta dialog_label_pos
@ -18906,7 +18912,7 @@ LAF34: lda #$00
eor #$80 eor #$80
jsr LB509 jsr LB509
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
addr_call draw_centered_string, desktop_aux::str_info_title addr_call draw_centered_string, desktop_aux::str_info_title
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
ldy #$00 ldy #$00
@ -18934,7 +18940,7 @@ LAF9B: yax_call draw_dialog_label, $04, desktop_aux::str_info_create
jmp reset_state jmp reset_state
LAFB9: lda winfoF LAFB9: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
ldy #$00 ldy #$00
lda ($06),y lda ($06),y
@ -19029,7 +19035,7 @@ LB068: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB231 MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB231
addr_call draw_text1, str_7_spaces addr_call draw_text1, str_7_spaces
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB239 MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB239
@ -19045,7 +19051,7 @@ LB0A2: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr LBE8D jsr LBE8D
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
ldy #$03 ldy #$03
@ -19063,7 +19069,7 @@ LB0A2: ldy #$01
rts rts
LB0F1: lda winfoF LB0F1: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr draw_ok_cancel_buttons jsr draw_ok_cancel_buttons
LB0FA: jsr prompt_input_loop LB0FA: jsr prompt_input_loop
bmi LB0FA bmi LB0FA
@ -19121,7 +19127,7 @@ LB186: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB22D MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB22D
addr_call draw_text1, str_7_spaces addr_call draw_text1, str_7_spaces
MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB235 MGTK_RELAY_CALL MGTK::MoveTo, desktop_aux::LB235
@ -19137,7 +19143,7 @@ LB1C0: ldy #$01
jsr LBDC4 jsr LBDC4
jsr LBDDF jsr LBDDF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr LBE8D jsr LBE8D
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
ldy #$03 ldy #$03
@ -19155,7 +19161,7 @@ LB1C0: ldy #$01
rts rts
LB20F: lda winfoF LB20F: lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr draw_ok_cancel_buttons jsr draw_ok_cancel_buttons
LB218: jsr prompt_input_loop LB218: jsr prompt_input_loop
bmi LB218 bmi LB218
@ -19197,9 +19203,9 @@ LB27D: jsr LBD75
lda #$00 lda #$00
jsr LB509 jsr LB509
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
addr_call draw_centered_string, desktop_aux::str_rename_title addr_call draw_centered_string, desktop_aux::str_rename_title
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, rect1 MGTK_RELAY_CALL MGTK::FrameRect, rect1
yax_call draw_dialog_label, $02, desktop_aux::str_rename_old yax_call draw_dialog_label, $02, desktop_aux::str_rename_old
lda #$55 lda #$55
@ -19230,7 +19236,7 @@ LB2ED: lda #$00
lda #$80 lda #$80
sta LD8E8 sta LD8E8
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
LB2FD: jsr prompt_input_loop LB2FD: jsr prompt_input_loop
bmi LB2FD bmi LB2FD
bne LB313 bne LB313
@ -19259,7 +19265,7 @@ LB313: jsr reset_state
MGTK_RELAY_CALL MGTK::HideCursor MGTK_RELAY_CALL MGTK::HideCursor
jsr create_window_with_alert_bitmap jsr create_window_with_alert_bitmap
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
addr_call draw_centered_string, desktop_aux::str_warning addr_call draw_centered_string, desktop_aux::str_warning
MGTK_RELAY_CALL MGTK::ShowCursor MGTK_RELAY_CALL MGTK::ShowCursor
jsr copy_dialog_param_addr_to_ptr jsr copy_dialog_param_addr_to_ptr
@ -19388,7 +19394,7 @@ set_cursor_insertion_point:
MGTK_RELAY_CALL MGTK::ShowCursor MGTK_RELAY_CALL MGTK::ShowCursor
rts rts
set_fill_black: set_penmode_xor2:
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
rts rts
@ -19495,8 +19501,8 @@ LB537: jmp reset_state
LB53A: MGTK_RELAY_CALL MGTK::OpenWindow, winfoF LB53A: MGTK_RELAY_CALL MGTK::OpenWindow, winfoF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_outer_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_outer_rect
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_inner_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_inner_rect
rts rts
@ -19504,10 +19510,10 @@ LB53A: MGTK_RELAY_CALL MGTK::OpenWindow, winfoF
create_window_with_alert_bitmap: create_window_with_alert_bitmap:
MGTK_RELAY_CALL MGTK::OpenWindow, winfoF MGTK_RELAY_CALL MGTK::OpenWindow, winfoF
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr set_fill_white jsr set_fill_white
MGTK_RELAY_CALL MGTK::PaintBits, alert_bitmap2_params MGTK_RELAY_CALL MGTK::PaintBits, alert_bitmap2_params
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_outer_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_outer_rect
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_inner_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::confirm_dialog_inner_rect
rts rts
@ -19600,7 +19606,7 @@ draw_all_label:
rts rts
draw_yes_no_all_cancel_buttons: draw_yes_no_all_cancel_buttons:
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::yes_button_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::yes_button_rect
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::no_button_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::no_button_rect
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::all_button_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::all_button_rect
@ -19622,7 +19628,7 @@ erase_yes_no_all_cancel_buttons:
rts rts
draw_ok_cancel_buttons: draw_ok_cancel_buttons:
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::ok_button_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::ok_button_rect
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::cancel_button_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::cancel_button_rect
jsr draw_ok_label jsr draw_ok_label
@ -19638,7 +19644,7 @@ erase_ok_cancel_buttons:
rts rts
draw_ok_button: draw_ok_button:
jsr set_fill_black jsr set_penmode_xor2
MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::ok_button_rect MGTK_RELAY_CALL MGTK::FrameRect, desktop_aux::ok_button_rect
jsr draw_ok_label jsr draw_ok_label
lda #$80 lda #$80
@ -19751,45 +19757,57 @@ LB7A3: iny
LB7B5: dey LB7B5: dey
jmp LB78D jmp LB78D
LB7B9: sta getwinport_params2::window_id .proc set_port_from_window_id
sta getwinport_params2::window_id
MGTK_RELAY_CALL MGTK::GetWinPort, getwinport_params2 MGTK_RELAY_CALL MGTK::GetWinPort, getwinport_params2
ldy #$04 MGTK_RELAY_CALL MGTK::SetPort, grafport2
lda #$15
LB7CA := *+1
ldx #$D2
jsr MGTK_RELAY
rts rts
LB7CF: lda #$00 .endproc
jmp LB7E8
LB7D4: lda #$01 ;;; ==================================================
jmp LB7E8 ;;; Event loop during button press - handle inverting
;;; the text as mouse is dragged in/out, report final
;;; click (A as passed) / cancel (A is negative)
LB7D9: lda #$02 button_loop_ok:
jmp LB7E8 lda #prompt_button_ok
jmp button_event_loop
LB7DE: lda #$03 button_loop_cancel:
jmp LB7E8 lda #prompt_button_cancel
jmp button_event_loop
LB7E3: lda #$04 button_loop_yes:
jmp LB7E8 lda #prompt_button_yes
jmp button_event_loop
LB7E8: pha button_loop_no:
lda #prompt_button_no
jmp button_event_loop
button_loop_all:
lda #prompt_button_all
jmp button_event_loop
.proc button_event_loop
;; Configure test and fill procs
pha
asl a asl a
asl a asl a
tax tax
lda LB808,x lda test_fill_button_proc_table,x
sta LB886 sta test_button_proc_addr
lda LB808+1,x lda test_fill_button_proc_table+1,x
sta LB887 sta test_button_proc_addr+1
lda LB808+2,x lda test_fill_button_proc_table+2,x
sta LB888 sta fill_button_proc_addr
lda LB808+3,x lda test_fill_button_proc_table+3,x
sta LB889 sta fill_button_proc_addr+1
pla pla
jmp LB88A jmp event_loop
LB808: .addr test_ok_button,fill_ok_button test_fill_button_proc_table:
.addr test_ok_button,fill_ok_button
.addr test_cancel_button,fill_cancel_button .addr test_cancel_button,fill_cancel_button
.addr test_yes_button,fill_yes_button .addr test_yes_button,fill_yes_button
.addr test_no_button,fill_no_button .addr test_no_button,fill_no_button
@ -19835,56 +19853,63 @@ fill_all_button:
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::all_button_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::all_button_rect
rts rts
LB880: jmp (LB886) test_proc: jmp (test_button_proc_addr)
fill_proc: jmp (fill_button_proc_addr)
LB883: jmp (LB888) test_button_proc_addr: .addr 0
fill_button_proc_addr: .addr 0
LB886: .byte 0 event_loop:
LB887: .byte 0 sta click_result
LB888: .byte 0 lda #0
LB889: .byte 0 sta down_flag
LB88A: sta LB8F3 loop: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda #$00
sta LB8F2
LB892: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_params_kind lda event_params_kind
cmp #MGTK::event_kind_button_up cmp #MGTK::event_kind_button_up
beq LB8E3 beq exit
lda winfoF lda winfoF
sta event_params sta event_params
MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params
MGTK_RELAY_CALL MGTK::MoveTo, $D20D MGTK_RELAY_CALL MGTK::MoveTo, $D20D
jsr LB880 jsr test_proc
cmp #$80 cmp #$80 ; inside?
beq LB8C9 beq inside
lda LB8F2 lda down_flag ; outside but was inside?
beq LB8D1 beq invert
jmp LB892 jmp loop
LB8C9: lda LB8F2 inside: lda down_flag ; already depressed?
bne LB8D1 bne invert
jmp LB892 jmp loop
LB8D1: jsr set_fill_black invert: jsr set_penmode_xor2
jsr LB883 jsr fill_proc
lda LB8F2 lda down_flag
clc clc
adc #$80 adc #$80
sta LB8F2 sta down_flag
jmp LB892 jmp loop
LB8E3: lda LB8F2 exit: lda down_flag ; was depressed?
beq LB8EB beq clicked
lda #$FF lda #$FF ; hi bit = cancelled
rts rts
LB8EB: jsr LB883 clicked:
lda LB8F3 jsr fill_proc ; invert one last time
lda click_result ; grab expected result
rts rts
LB8F2: .byte 0 down_flag:
LB8F3: .byte 0 .byte 0
rts
click_result:
.byte 0
rts ; ???
.endproc
;;; ==================================================
.proc LB8F5 .proc LB8F5
point := $6 point := $6
@ -19923,14 +19948,14 @@ LB93B: lda #<LD8EF
MGTK_RELAY_CALL MGTK::DrawText, drawtext_params MGTK_RELAY_CALL MGTK::DrawText, drawtext_params
MGTK_RELAY_CALL MGTK::SetTextBG, desktop_aux::LAE6D MGTK_RELAY_CALL MGTK::SetTextBG, desktop_aux::LAE6D
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
rts rts
.endproc .endproc
LB961: lda path_buf1 LB961: lda path_buf1
beq LB9B7 beq LB9B7
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
jsr set_fill_white jsr set_fill_white
MGTK_RELAY_CALL MGTK::PaintRect, rect1 MGTK_RELAY_CALL MGTK::PaintRect, rect1
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
@ -19941,7 +19966,7 @@ LB961: lda path_buf1
addr_call draw_text1, path_buf2 addr_call draw_text1, path_buf2
addr_call draw_text1, str_2_spaces addr_call draw_text1, str_2_spaces
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
LB9B7: rts LB9B7: rts
LB9B8: MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params LB9B8: MGTK_RELAY_CALL MGTK::ScreenToWindow, event_params
@ -20132,7 +20157,7 @@ LBB0B: sta LBB62
addr_call draw_text1, str_1_char addr_call draw_text1, str_1_char
addr_call draw_text1, path_buf2 addr_call draw_text1, path_buf2
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
rts rts
.endproc .endproc
@ -20159,7 +20184,7 @@ LBB63: lda path_buf1
addr_call draw_text1, path_buf2 addr_call draw_text1, path_buf2
addr_call draw_text1, str_2_spaces addr_call draw_text1, str_2_spaces
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
rts rts
.endproc .endproc
@ -20197,7 +20222,7 @@ LBBBC: ldx path_buf1
addr_call draw_text1, path_buf2 addr_call draw_text1, path_buf2
addr_call draw_text1, str_2_spaces addr_call draw_text1, str_2_spaces
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
rts rts
.endproc .endproc
@ -20227,7 +20252,7 @@ LBC2D: dec path_buf2
addr_call draw_text1, path_buf2 addr_call draw_text1, path_buf2
addr_call draw_text1, str_2_spaces addr_call draw_text1, str_2_spaces
lda winfoF lda winfoF
jsr LB7B9 jsr set_port_from_window_id
rts rts
LBC5E: lda path_buf1 LBC5E: lda path_buf1

View File

@ -602,14 +602,17 @@ menuopt_disable_flag := 1 << 7
;;; ------------------------------------ ;;; ------------------------------------
.macro DEFINE_RECT left, top, right, bottom, label ;;; Rect definition. Option fifth param gives scope.
;;; DEFINE_RECT 0,0,20,30
;;; DEFINE_RECT 0,0,20,30,rect ; rect::x1, rect::y1, rect::x2, rect::y2
.macro DEFINE_RECT left, top, right, bottom, opt_scope
.if .paramcount > 4 .if .paramcount > 4
.proc label .scope opt_scope
x1: .word left x1: .word left
y1: .word top y1: .word top
x2: .word right x2: .word right
y2: .word bottom y2: .word bottom
.endproc .endscope
.else .else
.word left .word left
.word top .word top
@ -618,27 +621,36 @@ y2: .word bottom
.endif .endif
.endmacro .endmacro
.macro DEFINE_POINT left, top, label ;;; Point definition. Option third param gives scope.
;;; DEFINE_POINT 10,20
;;; DEFINE_POINT 10,20,pt ; pt::xcoord, pt::ycoord
.macro DEFINE_POINT left, top, opt_scope
.if .paramcount > 2 .if .paramcount > 2
.proc label .scope opt_scope
xcoord: .word left xcoord: .word left
ycoord: .word top ycoord: .word top
.endproc .endscope
.else .else
.word left .word left
.word top .word top
.endif .endif
.endmacro .endmacro
.macro DEFINE_STRING str, label ; String definition, for use with TextWidth/DrawText ;;; String definition w/ inline data, for use with DrawText
.local data ; Call as DEFINE_STRING "abc" ;;; DEFINE_STRING "abc"
.local end ; Can include control chars by using: ;;; DEFINE_STRING {"Ring a bell",$07,"!!!"} ; control characters
.addr data ; DEFINE_STRING {"abc",$0D,"def"} ;;; Optional second param gives label to internal Pascal string
.macro DEFINE_STRING str, opt_label
.local data
.local end
.addr data ; textptr
.if .paramcount > 1
opt_label:
.endif
.byte end - data ; textlen
.if .paramcount > 1
label:
.endif
.byte end - data
data: .byte str data: .byte str
end: end:
.endmacro .endmacro