Skip to content

Commit

Permalink
File Dialog: Save 97 bytes by moving buffers out of overlay
Browse files Browse the repository at this point in the history
The dialog code already uses a bunch space on the $1x pages but page
$16 was unused. A great place to stash some large buffers rather than
wasting space in the lib/overlay.

No functional changes.
  • Loading branch information
inexorabletash committed Oct 8, 2023
1 parent e576743 commit b434d07
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/file_dialog.s
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
;;; | index | position in list to filename
;;; $1780 +-----------+
;;; | (unused) |
;;; $1661 +-----------+
;;; | path buf |
;;; $1620 +-----------+
;;; | online buf|
;;; $1610 +-----------+
;;; | typedown |
;;; $1600 +-----------+
;;; | |
;;; | dir buf | current directory block
Expand All @@ -64,6 +70,12 @@

.scope file_dialog_impl

;;; Buffer used when selecting filename by holding Apple key and typing name.
;;; Length-prefixed string, initialized to 0 when the dialog is shown.
type_down_buf := $1600 ; 16 bytes
on_line_buffer := $1610 ; 16 bytes for ON_LINE calls
path_buf := $1620 ; 65 bytes for path+length

;;; Map from index in file_names to list entry; high bit is
;;; set for directories.
file_list_index := $1780
Expand All @@ -85,20 +97,12 @@ file_names := $1800
DEFINE_READ_PARAMS read_params, dir_read_buf, kDirReadSize
DEFINE_CLOSE_PARAMS close_params

on_line_buffer: .res 16, 0
path_buf: .res ::kPathBufferSize, 0 ; used in MLI calls, so must be in main memory

only_show_dirs_flag: ; set when selecting copy destination
.byte 0

dir_count:
.byte 0

;;; Buffer used when selecting filename by holding Apple key and typing name.
;;; Length-prefixed string, initialized to 0 when the dialog is shown.
type_down_buf:
.res 16, 0

selected_index: ; $FF if none
.byte 0

Expand Down

0 comments on commit b434d07

Please sign in to comment.