Skip to content

Commit

Permalink
DeskTop.system: Prevent crash copying to RAMCard
Browse files Browse the repository at this point in the history
The DeskTop.system launcher had a latent issue where the last bit of
the code ended up overwritten by the copy buffer when copying to
RAMCard. An assert would have caught this but wasn't present.
Previously, we got lucky - it was the tail end of a proc that would
only happen if non-standard files were present to copy.

The change in e83915e pushed more code into the danger zone, and so a
crash was inevitable. Oops! Fix by adjusting buffer start location and
adding an assert to catch this in the future.
  • Loading branch information
inexorabletash committed Feb 4, 2024
1 parent 8c8323d commit b0ef1f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions desktop.system/desktop.system.s
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
;;; :.............:
;;; |.............|
;;; |.(buffer)....| * data buffer for copies to RAMCard
;;; $3680 +-------------+
;;; $3900 +-------------+
;;; | |
;;; | |
;;; | |
Expand Down Expand Up @@ -55,7 +55,7 @@ src_io_buffer := $E00 ; 1024 bytes for I/O
dst_io_buffer := $1200 ; 1024 bytes for I/O
selector_buffer := $1600 ; Room for `kSelectorListBufSize`

copy_buffer := $3700
copy_buffer := $3900
kCopyBufferSize = MLI - copy_buffer
.assert (kCopyBufferSize .mod BLOCK_SIZE) = 0, error, "better performance for an integral number of blocks"

Expand Down Expand Up @@ -2279,3 +2279,7 @@ done: rts
ADJUSTCASE_VOLBUF := $820
ADJUSTCASE_IO_BUFFER := src_io_buffer
.include "../lib/adjustfilecase.s"

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

.assert * <= copy_buffer, error, "copy_buffer collides with code"

0 comments on commit b0ef1f0

Please sign in to comment.