Skip to content

Commit

Permalink
DeskTop: Simplify and re-scope auxtype display in Get Info dialog
Browse files Browse the repository at this point in the history
Saves ~55 bytes in main, but some of that is shuffling strings to aux.
  • Loading branch information
inexorabletash committed Jan 26, 2025
1 parent 0523bc6 commit 613cb09
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 58 deletions.
5 changes: 5 additions & 0 deletions desktop/auxmem.s
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,12 @@ str_info_size_suffix_singular:
PASCAL_STRING res_string_get_info_label_size_suffix_singular
str_info_size_slash:
PASCAL_STRING res_string_get_info_label_size_slash
str_auxtype_prefix:
PASCAL_STRING res_string_auxtype_prefix
str_volume:
PASCAL_STRING res_string_volume

;; Format / Erase dialog strings
str_select_format:
PASCAL_STRING res_string_format_disk_label_select
str_location:
Expand Down
98 changes: 40 additions & 58 deletions desktop/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ JT_CLEAR_UPDATES: jmp ClearUpdates ; *
JT_SYSTEM_TASK: jmp SystemTask ; *
JT_ACTIVATE_WINDOW: jmp ActivateAndRefreshWindow ; *
JT_SHOW_ALERT: jmp ShowAlert ; *
JT_SHOW_ALERT_PARAMS : jmp ShowAlertStruct ; *
JT_SHOW_ALERT_PARAMS: jmp ShowAlertStruct ; *
JT_LAUNCH_FILE: jmp LaunchFileWithPath
JT_SHOW_FILE: jmp ShowFileWithPath ; *
JT_RESTORE_OVL: jmp RestoreDynamicRoutine ; *
Expand Down Expand Up @@ -12355,21 +12355,21 @@ write_protected_flag:
lda selected_window_id
IF_ZERO
;; Volume
COPY_STRING str_volume, text_buffer2
param_call DrawDialogLabel, 2 | DDL_VALUE, aux::str_volume
ELSE
;; File
lda src_file_info_params::file_type
pha
jsr ComposeFileTypeString
COPY_STRING str_file_type, text_buffer2
COPY_STRING str_file_type, text_input_buf
pla ; A = file type
cmp #FT_DIRECTORY
IF_NE
ldax src_file_info_params::aux_type
jsr AppendAuxType
jsr _AppendAuxType
END_IF
param_call DrawDialogLabel, 2 | DDL_VALUE, text_input_buf
END_IF
param_call DrawDialogLabel, 2 | DDL_VALUE, text_buffer2

;; --------------------------------------------------
;; Size/Blocks
Expand Down Expand Up @@ -12531,6 +12531,41 @@ num_blocks:
.word 0
.endproc ; _GetDirSize

;;; ------------------------------------------------------------
;;; Append aux type (in A,X) to `text_input_buf`

.proc _AppendAuxType
pha
txa
pha
param_call AppendToTextInputBuf, aux::str_auxtype_prefix

;; Append type
pla
jsr do_byte
pla
FALL_THROUGH_TO do_byte

do_byte:
pha
lsr
lsr
lsr
lsr
jsr do_nibble
pla
FALL_THROUGH_TO do_nibble

do_nibble:
and #%00001111
tax
lda hex_digits,x
inc text_input_buf
ldx text_input_buf
sta text_input_buf,x
rts
.endproc ; _AppendAuxType

;;; ------------------------------------------------------------
;;; Input loop and (hooked) event handlers

Expand Down Expand Up @@ -12606,53 +12641,6 @@ ret: return #$FF

.endproc ; DoGetInfo

;;; ============================================================
;;; Append aux type (in A,X) to text_buffer2

.proc AppendAuxType
stax auxtype
ldy text_buffer2

;; Append prefix
ldx #0
: lda str_auxtype_prefix+1,x
sta text_buffer2+1,y
inx
iny
cpx str_auxtype_prefix
bne :-

;; Append type
lda auxtype+1
jsr DoByte
lda auxtype
jsr DoByte

sty text_buffer2
rts

DoByte:
pha
lsr
lsr
lsr
lsr
tax
lda hex_digits,x
sta text_buffer2+1,y
iny
pla
and #%00001111
tax
lda hex_digits,x
sta text_buffer2+1,y
iny
rts

auxtype:
.word 0
.endproc ; AppendAuxType

.endscope ; get_info

;;; ============================================================
Expand Down Expand Up @@ -15780,9 +15768,6 @@ run_list_paths:
;;; Localized strings (may change length)
;;; ============================================================

str_auxtype_prefix:
PASCAL_STRING res_string_auxtype_prefix

str_device_type_diskii:
PASCAL_STRING res_string_volume_type_disk_ii
str_device_type_ramdisk:
Expand All @@ -15792,9 +15777,6 @@ str_device_type_appletalk:
str_device_type_vdrive:
PASCAL_STRING res_string_volume_type_vdrive

str_volume:
PASCAL_STRING res_string_volume

;;; ============================================================

.endscope ; main
Expand Down

0 comments on commit 613cb09

Please sign in to comment.