Skip to content

Commit

Permalink
DeskTop: Misc internal tidying/streamlining
Browse files Browse the repository at this point in the history
No functional changes.
  • Loading branch information
inexorabletash committed Jan 21, 2025
1 parent f226189 commit 25c7cb1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 59 deletions.
6 changes: 3 additions & 3 deletions desktop/auxmem.s
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ str_alert_unreadable_format:
;;; 1 = Cancel
;;; 2 = OK

.proc AlertById
jmp start
.proc AlertByIdImpl

;;; --------------------------------------------------
;;; Messages
Expand Down Expand Up @@ -572,7 +571,8 @@ start:

ldax #alert_params
FALL_THROUGH_TO Alert
.endproc ; AlertById
.endproc ; AlertByIdImpl
AlertById := AlertByIdImpl::start

;;; ============================================================
;;; Display alert
Expand Down
4 changes: 2 additions & 2 deletions desktop/init.s
Original file line number Diff line number Diff line change
Expand Up @@ -1100,11 +1100,11 @@ loop: ldy #0

lda #$80
sta main::copy_new_window_bounds_flag
sta main::OpenDirectory::suppress_error_on_open_flag
sta main::OpenDirectoryImpl::suppress_error_on_open_flag
jsr _MaybeOpenWindow
lda #0
sta main::copy_new_window_bounds_flag
sta main::OpenDirectory::suppress_error_on_open_flag
sta main::OpenDirectoryImpl::suppress_error_on_open_flag

next: jsr PopPointers

Expand Down
80 changes: 36 additions & 44 deletions desktop/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -1074,14 +1074,14 @@ sys_disk:

jsr SetCursorWatch ; before invoking

;; Easiest to assume absolute path later.
jsr _MakeSrcPathAbsolute ; Trashes `INVOKER_INTERPRETER`

;; Assume no interpreter to start
lda #0
sta INVOKER_INTERPRETER
sta INVOKER_BITSY_COMPAT

;; Easiest to assume absolute path later.
param_call MakePathAbsolute, src_path_buf

;; Get the file info to determine type.
retry: jsr GetSrcFileInfo
bcc :+
Expand Down Expand Up @@ -1142,7 +1142,7 @@ interpreter:

;; Construct absolute path
ldax ptr1
jsr _GetPrefixAndAppendToInvokerInterpreter
jsr _MakeRelPathAbsoluteIntoInvokerInterpreter
FALL_THROUGH_TO launch

;; --------------------------------------------------
Expand Down Expand Up @@ -1260,7 +1260,7 @@ _CheckBasisSystem := _CheckBasixSystemImpl::basis

.proc _CheckBasicSystem
ldax #str_extras_basic
jsr _GetPrefixAndAppendToInvokerInterpreter
jsr _MakeRelPathAbsoluteIntoInvokerInterpreter
param_call GetFileInfo, INVOKER_INTERPRETER
jcs _CheckBasixSystemImpl::basic ; nope, look relative to launch path
rts
Expand All @@ -1270,7 +1270,7 @@ _CheckBasisSystem := _CheckBasixSystemImpl::basis

;;; Input: A,X = relative path to append
;;; Output: `INVOKER_INTERPRETER` has absolute path
.proc _GetPrefixAndAppendToInvokerInterpreter
.proc _MakeRelPathAbsoluteIntoInvokerInterpreter
pha
txa
pha
Expand All @@ -1281,7 +1281,7 @@ _CheckBasisSystem := _CheckBasixSystemImpl::basis
tax
pla
FALL_THROUGH_TO _AppendToInvokerInterpreter
.endproc ; _GetPrefixAndAppendToInvokerInterpreter
.endproc ; _MakeRelPathAbsoluteIntoInvokerInterpreter

;;; --------------------------------------------------

Expand Down Expand Up @@ -1369,13 +1369,35 @@ check_header:

.endproc ; _InvokeLink

;;; --------------------------------------------------

;;; Trashes: `INVOKER_INTERPRETER`
.proc _MakeSrcPathAbsolute
;; Already absolute?
lda src_path_buf+1
cmp #'/'
IF_NE
;; Get prefix and append path
ldax #src_path_buf
jsr _MakeRelPathAbsoluteIntoInvokerInterpreter

;; Copy back to original buffer
ldy INVOKER_INTERPRETER
: lda INVOKER_INTERPRETER,y
sta src_path_buf,y
dey
bpl :-
END_IF

rts
.endproc ; _MakeSrcPathAbsolute

;;; --------------------------------------------------

DEFINE_GET_PREFIX_PARAMS get_prefix_params, INVOKER_INTERPRETER

.endproc ; LaunchFileWithPath
LaunchFileWithPathOnSystemDisk := LaunchFileWithPath::sys_disk
MakePathAbsoluteInInvokerInterpreter := LaunchFileWithPath::_GetPrefixAndAppendToInvokerInterpreter

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

Expand Down Expand Up @@ -2025,34 +2047,6 @@ main_length: .word 0

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

;;; Make a path absolute using current prefix. No-op if already absolute.
;;; Inputs: A,X = path
;;; Outputs: $06 is path, which is updated
;;; Trashes: `INVOKER_INTERPRETER`
.proc MakePathAbsolute
ptr := $06
stax ptr

;; Already absolute?
ldy #1
lda (ptr),y
cmp #'/'
beq ret

;; Get prefix and append path
ldax ptr
jsr MakePathAbsoluteInInvokerInterpreter

;; Copy back to original buffer
ldy INVOKER_INTERPRETER
: lda INVOKER_INTERPRETER,y
sta (ptr),y
dey
bpl :-

ret: rts
.endproc ; MakePathAbsolute

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

;;; Inputs: A,X = absolute path
Expand Down Expand Up @@ -2565,9 +2559,7 @@ done: rts

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

.proc CmdDiskCopy
jmp start

.proc CmdDiskCopyImpl
DEFINE_OPEN_PARAMS open_params, str_disk_copy, IO_BUFFER
DEFINE_READ_PARAMS read_params, DISK_COPY_BOOTSTRAP, kDiskCopyBootstrapLength
DEFINE_CLOSE_PARAMS close_params
Expand Down Expand Up @@ -2631,7 +2623,8 @@ start:
bit ROMIN2

jmp DISK_COPY_BOOTSTRAP
.endproc ; CmdDiskCopy
.endproc ; CmdDiskCopyImpl
CmdDiskCopy := CmdDiskCopyImpl::start

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

Expand Down Expand Up @@ -6921,9 +6914,7 @@ found_windows_list:

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

.proc OpenDirectory
jmp _Start

.proc OpenDirectoryImpl
DEFINE_OPEN_PARAMS open_params, src_path_buf, $800

dir_buffer := $C00
Expand Down Expand Up @@ -7227,7 +7218,8 @@ suppress_error_on_open_flag:
.endproc ; _DoClose

;;; --------------------------------------------------
.endproc ; OpenDirectory
.endproc ; OpenDirectoryImpl
OpenDirectory := OpenDirectoryImpl::_Start

;;; ============================================================
;;; Inputs: `src_path_buf` set to full path (not modified)
Expand Down
6 changes: 3 additions & 3 deletions disk_copy/auxlc.s
Original file line number Diff line number Diff line change
Expand Up @@ -2065,8 +2065,7 @@ ret: rts
;;; ============================================================


.proc ShowAlertDialog
jmp start
.proc ShowAlertDialogImpl

;;; --------------------------------------------------
;;; Messages
Expand Down Expand Up @@ -2291,7 +2290,8 @@ find_in_alert_table:
: rts
.endproc ; _IsDriveEjectable

.endproc ; ShowAlertDialog
.endproc ; ShowAlertDialogImpl
ShowAlertDialog := ShowAlertDialogImpl::start

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

Expand Down
13 changes: 6 additions & 7 deletions toolkits/icontk.s
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ done: rts
;;; ============================================================
;;; IconInRect

.proc IconInRectImpl
.proc IconInRectImplImpl
params := $06
.struct IconInRectParams
icon .byte
Expand All @@ -1184,8 +1184,6 @@ done: rts

ptr := $06

jmp start

icon: .byte 0
DEFINE_RECT rect, 0, 0, 0, 0

Expand Down Expand Up @@ -1245,7 +1243,8 @@ outside:

inside:
return #1
.endproc ; IconInRectImpl
.endproc ; IconInRectImplImpl
IconInRectImpl := IconInRectImplImpl::start

;;; ============================================================
;;; GetIconBounds
Expand Down Expand Up @@ -2171,8 +2170,7 @@ empty: return #$FF
;;; paint call is needed, and `more_drawing_needed_flag` is non-zero
;;; if another call to this proc is needed after the paint. Returns
;;; C=1 if no clipping rect remains, so no drawing is needed.
.proc CalcWindowIntersections
jmp start
.proc CalcWindowIntersectionsImpl

.params findwindow_params
mousex: .word 0
Expand Down Expand Up @@ -2409,7 +2407,8 @@ case2:
: copy #0, more_drawing_needed_flag
sec ; C=1 means no clipping rect remains
rts
.endproc ; CalcWindowIntersections
.endproc ; CalcWindowIntersectionsImpl
CalcWindowIntersections := CalcWindowIntersectionsImpl::start

;;; ============================================================
;;; Used when doing clipped drawing to map viewport and icon
Expand Down

0 comments on commit 25c7cb1

Please sign in to comment.