Macro tidying: use param blocks; dedupe macros that differ only by order

This commit is contained in:
Joshua Bell 2019-03-30 08:34:49 -07:00
parent 345f08a5ab
commit 1db820679c
5 changed files with 50 additions and 64 deletions

View File

@ -97,7 +97,7 @@ quit: MLI_CALL QUIT, quit_params
jmp got_prefix jmp got_prefix
get_current_prefix: get_current_prefix:
axy_call JUMP_TABLE_MLI, GET_PREFIX, get_prefix_params yax_call JUMP_TABLE_MLI, GET_PREFIX, get_prefix_params
bne no_bs bne no_bs
got_prefix: got_prefix:
@ -114,7 +114,7 @@ loop: ldx path_length
bne :- bne :-
stx bs_path stx bs_path
axy_call JUMP_TABLE_MLI, GET_FILE_INFO, get_file_info_params yax_call JUMP_TABLE_MLI, GET_FILE_INFO, get_file_info_params
bne not_found bne not_found
rts rts

View File

@ -2081,9 +2081,7 @@ done: rts
;;; (selector/dispatch) handler, then does ProDOS QUIT. ;;; (selector/dispatch) handler, then does ProDOS QUIT.
str_quit_code: PASCAL_STRING "Quit.tmp" str_quit_code: PASCAL_STRING "Quit.tmp"
saved_org := * PROC_AT quit_restore_proc, $1000
.proc quit_restore_proc
.org $1000
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
@ -2102,9 +2100,8 @@ str_quit_code: PASCAL_STRING "Quit.tmp"
DEFINE_QUIT_PARAMS quit_params DEFINE_QUIT_PARAMS quit_params
PAD_TO $1100 PAD_TO $1100
.endproc END_PROC_AT
.assert .sizeof(quit_restore_proc) = $100, error, "Proc length mismatch" .assert .sizeof(quit_restore_proc) = $100, error, "Proc length mismatch"
.org (saved_org + .sizeof(quit_restore_proc))
.proc preserve_quit_code_impl .proc preserve_quit_code_impl
quit_code_io := $800 quit_code_io := $800

View File

@ -1560,7 +1560,7 @@ nope: dex
done: jsr set_pointer_cursor done: jsr set_pointer_cursor
rts rts
open: yxa_call MLI_RELAY, OPEN, open_params open: yax_call MLI_RELAY, OPEN, open_params
bne :+ bne :+
rts rts
: lda #warning_msg_insert_system_disk : lda #warning_msg_insert_system_disk
@ -1568,9 +1568,9 @@ open: yxa_call MLI_RELAY, OPEN, open_params
beq open ; ok, so try again beq open ; ok, so try again
return #$FF ; cancel, so fail return #$FF ; cancel, so fail
read: yxa_jump MLI_RELAY, READ, read_params read: yax_jump MLI_RELAY, READ, read_params
close: yxa_jump MLI_RELAY, CLOSE, close_params close: yax_jump MLI_RELAY, CLOSE, close_params
zp_use_flag1: zp_use_flag1:
.byte $80 .byte $80
@ -13156,15 +13156,15 @@ jump_relay:
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_dialog_title, desktop_aux::str_about1 addr_call draw_dialog_title, desktop_aux::str_about1
axy_call draw_dialog_label, 1 | DDL_CENTER, desktop_aux::str_about2 yax_call draw_dialog_label, 1 | DDL_CENTER, desktop_aux::str_about2
axy_call draw_dialog_label, 2 | DDL_CENTER, desktop_aux::str_about3 yax_call draw_dialog_label, 2 | DDL_CENTER, desktop_aux::str_about3
axy_call draw_dialog_label, 3 | DDL_CENTER, desktop_aux::str_about4 yax_call draw_dialog_label, 3 | DDL_CENTER, desktop_aux::str_about4
axy_call draw_dialog_label, 5, desktop_aux::str_about5 yax_call draw_dialog_label, 5, desktop_aux::str_about5
axy_call draw_dialog_label, 6 | DDL_CENTER, desktop_aux::str_about6 yax_call draw_dialog_label, 6 | DDL_CENTER, desktop_aux::str_about6
axy_call draw_dialog_label, 7, desktop_aux::str_about7 yax_call draw_dialog_label, 7, desktop_aux::str_about7
axy_call draw_dialog_label, 9, desktop_aux::str_about8 yax_call draw_dialog_label, 9, desktop_aux::str_about8
copy16 #310 - (7 * .strlen(VERSION_SUFFIX)), dialog_label_pos copy16 #310 - (7 * .strlen(VERSION_SUFFIX)), dialog_label_pos
axy_call draw_dialog_label, 9, desktop_aux::str_about9 yax_call draw_dialog_label, 9, desktop_aux::str_about9
copy16 #dialog_label_default_x, dialog_label_pos copy16 #dialog_label_default_x, dialog_label_pos
: MGTK_RELAY_CALL MGTK::GetEvent, event_params : MGTK_RELAY_CALL MGTK::GetEvent, event_params
@ -13216,17 +13216,17 @@ close: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_about_dialog
: copy #0, has_input_field_flag : copy #0, has_input_field_flag
jsr open_dialog_window jsr open_dialog_window
axy_call draw_dialog_label, 2, desktop_aux::str_copy_from yax_call draw_dialog_label, 2, desktop_aux::str_copy_from
axy_call draw_dialog_label, 3, desktop_aux::str_copy_to yax_call draw_dialog_label, 3, desktop_aux::str_copy_to
bit move_flag bit move_flag
bmi :+ bmi :+
addr_call draw_dialog_title, desktop_aux::str_copy_title addr_call draw_dialog_title, desktop_aux::str_copy_title
axy_call draw_dialog_label, 1, desktop_aux::str_copy_copying yax_call draw_dialog_label, 1, desktop_aux::str_copy_copying
axy_call draw_dialog_label, 4, desktop_aux::str_copy_remaining yax_call draw_dialog_label, 4, desktop_aux::str_copy_remaining
rts rts
: addr_call draw_dialog_title, desktop_aux::str_move_title : addr_call draw_dialog_title, desktop_aux::str_move_title
axy_call draw_dialog_label, 1, desktop_aux::str_move_moving yax_call draw_dialog_label, 1, desktop_aux::str_move_moving
axy_call draw_dialog_label, 4, desktop_aux::str_move_remaining yax_call draw_dialog_label, 4, desktop_aux::str_move_remaining
rts rts
;; CopyDialogLifecycle::populate ;; CopyDialogLifecycle::populate
@ -13286,7 +13286,7 @@ do5: jsr reset_grafport3a
do3: jsr bell do3: jsr bell
lda winfo_alert_dialog lda winfo_alert_dialog
jsr set_port_from_window_id jsr set_port_from_window_id
axy_call draw_dialog_label, 6, desktop_aux::str_exists_prompt yax_call draw_dialog_label, 6, 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
bmi LAA7F bmi LAA7F
@ -13301,7 +13301,7 @@ LAA7F: jsr prompt_input_loop
do4: jsr bell do4: jsr bell
lda winfo_alert_dialog lda winfo_alert_dialog
jsr set_port_from_window_id jsr set_port_from_window_id
axy_call draw_dialog_label, 6, desktop_aux::str_large_prompt yax_call draw_dialog_label, 6, desktop_aux::str_large_prompt
jsr draw_ok_cancel_buttons jsr draw_ok_cancel_buttons
: jsr prompt_input_loop : jsr prompt_input_loop
bmi :- bmi :-
@ -13338,10 +13338,10 @@ do4: jsr bell
else: copy #0, has_input_field_flag else: copy #0, has_input_field_flag
jsr open_dialog_window jsr open_dialog_window
addr_call draw_dialog_title, desktop_aux::str_download addr_call draw_dialog_title, desktop_aux::str_download
axy_call draw_dialog_label, 1, desktop_aux::str_copy_copying yax_call draw_dialog_label, 1, desktop_aux::str_copy_copying
axy_call draw_dialog_label, 2, desktop_aux::str_copy_from yax_call draw_dialog_label, 2, desktop_aux::str_copy_from
axy_call draw_dialog_label, 3, desktop_aux::str_copy_to yax_call draw_dialog_label, 3, desktop_aux::str_copy_to
axy_call draw_dialog_label, 4, desktop_aux::str_copy_remaining yax_call draw_dialog_label, 4, desktop_aux::str_copy_remaining
rts rts
do1: ldy #1 do1: ldy #1
@ -13385,7 +13385,7 @@ do3: jsr reset_grafport3a
do4: jsr bell do4: jsr bell
lda winfo_alert_dialog lda winfo_alert_dialog
jsr set_port_from_window_id jsr set_port_from_window_id
axy_call draw_dialog_label, 6, desktop_aux::str_ramcard_full yax_call draw_dialog_label, 6, desktop_aux::str_ramcard_full
jsr draw_ok_button jsr draw_ok_button
: jsr prompt_input_loop : jsr prompt_input_loop
bmi :- bmi :-
@ -13418,10 +13418,10 @@ do4: jsr bell
else: jsr open_dialog_window else: jsr open_dialog_window
addr_call draw_dialog_title, desktop_aux::str_size_title addr_call draw_dialog_title, desktop_aux::str_size_title
axy_call draw_dialog_label, 1, desktop_aux::str_size_number yax_call draw_dialog_label, 1, desktop_aux::str_size_number
ldy #1 ldy #1
jsr draw_colon jsr draw_colon
axy_call draw_dialog_label, 2, desktop_aux::str_size_blocks yax_call draw_dialog_label, 2, desktop_aux::str_size_blocks
ldy #2 ldy #2
jsr draw_colon jsr draw_colon
rts rts
@ -13503,11 +13503,11 @@ do2: lda winfo_alert_dialog
addr_call draw_dialog_title, desktop_aux::str_delete_title addr_call draw_dialog_title, desktop_aux::str_delete_title
lda LAD1F lda LAD1F
beq LAD20 beq LAD20
axy_call draw_dialog_label, 4, desktop_aux::str_ok_empty yax_call draw_dialog_label, 4, desktop_aux::str_ok_empty
rts rts
LAD1F: .byte 0 LAD1F: .byte 0
LAD20: axy_call draw_dialog_label, 4, desktop_aux::str_delete_ok LAD20: yax_call draw_dialog_label, 4, desktop_aux::str_delete_ok
rts rts
;; DeleteDialogLifecycle::populate ;; DeleteDialogLifecycle::populate
@ -13574,7 +13574,7 @@ do5: jsr reset_grafport3a
;; DeleteDialogLifecycle::locked ;; DeleteDialogLifecycle::locked
do4: lda winfo_alert_dialog do4: lda winfo_alert_dialog
jsr set_port_from_window_id jsr set_port_from_window_id
axy_call draw_dialog_label, 6, desktop_aux::str_delete_locked_file yax_call draw_dialog_label, 6, 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
bmi LAE17 bmi LAE17

View File

@ -22,7 +22,7 @@ L080C: copy #$00, has_input_field_flag
lda winfo_alert_dialog lda winfo_alert_dialog
jsr desktop_main::set_port_from_window_id jsr desktop_main::set_port_from_window_id
addr_call desktop_main::draw_dialog_title, desktop_aux::str_format_disk addr_call desktop_main::draw_dialog_title, desktop_aux::str_format_disk
axy_call desktop_main::draw_dialog_label, 1, desktop_aux::str_select_format yax_call desktop_main::draw_dialog_label, 1, desktop_aux::str_select_format
jsr L0D31 jsr L0D31
copy #$FF, LD887 copy #$FF, LD887
L0832: copy16 #L0B48, desktop_main::jump_relay+1 L0832: copy16 #L0B48, desktop_main::jump_relay+1
@ -50,7 +50,7 @@ L085F: bit LD887
copy #$80, has_input_field_flag copy #$80, has_input_field_flag
copy #$00, format_erase_overlay_flag copy #$00, format_erase_overlay_flag
jsr desktop_main::clear_path_buf2 jsr desktop_main::clear_path_buf2
axy_call desktop_main::draw_dialog_label, 3, desktop_aux::str_new_volume yax_call desktop_main::draw_dialog_label, 3, desktop_aux::str_new_volume
L08A7: jsr desktop_main::prompt_input_loop L08A7: jsr desktop_main::prompt_input_loop
bmi L08A7 bmi L08A7
beq L08B7 beq L08B7
@ -74,7 +74,7 @@ L08B7: lda path_buf1
sta L09D7 sta L09D7
lda #$00 lda #$00
sta has_input_field_flag sta has_input_field_flag
axy_call desktop_main::draw_dialog_label, 3, desktop_aux::str_confirm_format yax_call desktop_main::draw_dialog_label, 3, desktop_aux::str_confirm_format
lda L09D7 lda L09D7
jsr L1A2D jsr L1A2D
addr_call desktop_main::draw_text1, ovl2_path_buf addr_call desktop_main::draw_text1, ovl2_path_buf
@ -87,7 +87,7 @@ L090C: lda winfo_alert_dialog
jsr desktop_main::set_port_from_window_id jsr desktop_main::set_port_from_window_id
MGTK_RELAY_CALL MGTK::SetPenMode, pencopy MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::clear_dialog_labels_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::clear_dialog_labels_rect
axy_call desktop_main::draw_dialog_label, 1, desktop_aux::str_formatting yax_call desktop_main::draw_dialog_label, 1, desktop_aux::str_formatting
lda L09D7 lda L09D7
jsr L12C1 jsr L12C1
and #$FF and #$FF
@ -100,7 +100,7 @@ L0942: lda winfo_alert_dialog
jsr desktop_main::set_port_from_window_id jsr desktop_main::set_port_from_window_id
MGTK_RELAY_CALL MGTK::SetPenMode, pencopy MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::clear_dialog_labels_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::clear_dialog_labels_rect
axy_call desktop_main::draw_dialog_label, 1, desktop_aux::str_erasing yax_call desktop_main::draw_dialog_label, 1, desktop_aux::str_erasing
addr_call upcase_string, path_buf1 addr_call upcase_string, path_buf1
ldxy #path_buf1 ldxy #path_buf1
lda L09D7 lda L09D7
@ -119,7 +119,7 @@ L0980: cmp #$2B
jmp L090C jmp L090C
L098C: jsr desktop_main::bell L098C: jsr desktop_main::bell
axy_call desktop_main::draw_dialog_label, 6, desktop_aux::str_erasing_error yax_call desktop_main::draw_dialog_label, 6, desktop_aux::str_erasing_error
jmp L09B8 jmp L09B8
L099B: pha L099B: pha
@ -132,7 +132,7 @@ L099B: pha
jmp L090C jmp L090C
L09AC: jsr desktop_main::bell L09AC: jsr desktop_main::bell
axy_call desktop_main::draw_dialog_label, 6, desktop_aux::str_formatting_error yax_call desktop_main::draw_dialog_label, 6, desktop_aux::str_formatting_error
L09B8: jsr desktop_main::prompt_input_loop L09B8: jsr desktop_main::prompt_input_loop
bmi L09B8 bmi L09B8
bne L09C2 bne L09C2
@ -158,7 +158,7 @@ L09D9: lda #$00
lda winfo_alert_dialog lda winfo_alert_dialog
jsr desktop_main::set_port_from_window_id jsr desktop_main::set_port_from_window_id
addr_call desktop_main::draw_dialog_title, desktop_aux::str_erase_disk addr_call desktop_main::draw_dialog_title, desktop_aux::str_erase_disk
axy_call desktop_main::draw_dialog_label, 1, desktop_aux::str_select_erase yax_call desktop_main::draw_dialog_label, 1, desktop_aux::str_select_erase
jsr L0D31 jsr L0D31
copy #$FF, LD887 copy #$FF, LD887
copy16 #L0B48, desktop_main::jump_relay+1 copy16 #L0B48, desktop_main::jump_relay+1
@ -181,7 +181,7 @@ L0A18: bit LD887
copy #$80, has_input_field_flag copy #$80, has_input_field_flag
copy #$00, format_erase_overlay_flag copy #$00, format_erase_overlay_flag
jsr desktop_main::clear_path_buf2 jsr desktop_main::clear_path_buf2
axy_call desktop_main::draw_dialog_label, 3, desktop_aux::str_new_volume yax_call desktop_main::draw_dialog_label, 3, desktop_aux::str_new_volume
L0A6A: jsr desktop_main::prompt_input_loop L0A6A: jsr desktop_main::prompt_input_loop
bmi L0A6A bmi L0A6A
beq L0A7A beq L0A7A
@ -204,7 +204,7 @@ L0A7A: lda path_buf1
lda DEVLST,x lda DEVLST,x
sta L0B47 sta L0B47
sta L0B46 sta L0B46
axy_call desktop_main::draw_dialog_label, 3, desktop_aux::str_confirm_erase yax_call desktop_main::draw_dialog_label, 3, desktop_aux::str_confirm_erase
lda L0B46 lda L0B46
and #$F0 and #$F0
jsr L1A2D jsr L1A2D
@ -218,7 +218,7 @@ L0AD1: lda winfo_alert_dialog
jsr desktop_main::set_port_from_window_id jsr desktop_main::set_port_from_window_id
MGTK_RELAY_CALL MGTK::SetPenMode, pencopy MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::clear_dialog_labels_rect MGTK_RELAY_CALL MGTK::PaintRect, desktop_aux::clear_dialog_labels_rect
axy_call desktop_main::draw_dialog_label, 1, desktop_aux::str_erasing yax_call desktop_main::draw_dialog_label, 1, desktop_aux::str_erasing
addr_call upcase_string, path_buf1 addr_call upcase_string, path_buf1
jsr desktop_main::set_cursor_watch jsr desktop_main::set_cursor_watch
ldxy #path_buf1 ldxy #path_buf1
@ -238,7 +238,7 @@ L0B12: cmp #$2B
jmp L0AD1 jmp L0AD1
L0B1E: jsr desktop_main::bell L0B1E: jsr desktop_main::bell
axy_call desktop_main::draw_dialog_label, 6, desktop_aux::str_erasing_error yax_call desktop_main::draw_dialog_label, 6, desktop_aux::str_erasing_error
L0B2A: jsr desktop_main::prompt_input_loop L0B2A: jsr desktop_main::prompt_input_loop
bmi L0B2A bmi L0B2A
beq L0AD1 beq L0AD1

View File

@ -108,14 +108,6 @@ end:
;;; ============================================================ ;;; ============================================================
;;; Calls with two parameters (call # in y, address in A,X) ;;; Calls with two parameters (call # in y, address in A,X)
;;; (various output orders to match original binary)
.macro axy_call target, yparam, addr
lda #<addr
ldx #>addr
ldy #yparam
jsr target
.endmacro
.macro yax_call target, yparam, addr .macro yax_call target, yparam, addr
ldy #yparam ldy #yparam
@ -124,17 +116,10 @@ end:
jsr target jsr target
.endmacro .endmacro
.macro yxa_call target, yparam, addr .macro yax_jump target, yparam, addr
ldy #yparam ldy #yparam
ldx #>addr
lda #<addr lda #<addr
jsr target
.endmacro
.macro yxa_jump target, yparam, addr
ldy #yparam
ldx #>addr ldx #>addr
lda #<addr
jmp target jmp target
.endmacro .endmacro
@ -611,6 +596,10 @@ skip:
skip: dec arg skip: dec arg
.endmacro .endmacro
;;; ============================================================
;;; Param Blocks
;;; ============================================================
;;; Helper macros to set up a scoped block of parameters at a pre-determined ;;; Helper macros to set up a scoped block of parameters at a pre-determined
;;; address. ;;; address.
;;; ;;;