Skip to content

Commit

Permalink
DeskTop: Preserve all 14 devices in ProDOS DEVLST table. Fixes #549
Browse files Browse the repository at this point in the history
A buffer for preserving DEVCNT+DEVLST was too short. To support
the maximum number of devices and the count, 15 bytes are needed.
On restoration, this would cause the first entry in the next
table to appear as a ProDOS device, e.g. Slot 0, Drive 1.
  • Loading branch information
inexorabletash committed Aug 29, 2021
1 parent ed032f7 commit 551d0b0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
9 changes: 4 additions & 5 deletions desktop/init.s
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ end:

.scope
;; Make a copy of the original device list
ldx DEVCNT
inx
: lda DEVLST-1,x
ldx DEVCNT ; number of devices
inx ; include DEVCNT itself
: lda DEVLST-1,x ; DEVCNT is at DEVLST-1
sta devlst_backup,x
dex
bpl :-
Expand Down Expand Up @@ -905,8 +905,7 @@ cvi_result:
dex
: inx
copy DEVLST+1,x, DEVLST,x
lda device_to_icon_map+1,x
sta device_to_icon_map,x
copy device_to_icon_map+1,x, device_to_icon_map,x
cpx DEVCNT
bne :-
dec DEVCNT
Expand Down
6 changes: 5 additions & 1 deletion desktop/internal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ kDAFileAuxType = $641 ; High bit set = don't show in Apple menu

kMaxDeskAccCount = 12

;;; Maximum number of ProDOS devices (2 per slot 1-7). This is the
;;; maximum size of DEVLST not counting DEVCNT itself.
kMaxDevListSize = 14

;;; Maximum number of volumes displayed/tracked. This is two per slot,
;;; except S3,D2 is assumed to be /RAM which is disconnected.
kMaxVolumes = 13
kMaxVolumes = kMaxDevListSize - 1

;;; ============================================================
;;; Window/Icon Metrics
Expand Down
4 changes: 2 additions & 2 deletions desktop/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -1184,8 +1184,8 @@ filerecords_free_start:

.proc restore_device_list
ldx devlst_backup
inx
: copy devlst_backup,x, DEVLST-1,x
inx ; include the count itself
: copy devlst_backup,x, DEVLST-1,x ; DEVCNT is at DEVLST-1
dex
bpl :-
rts
Expand Down
2 changes: 1 addition & 1 deletion desktop/res.s
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ entries_read_this_block:

;;; Backup copy of DEVLST made before detaching ramdisk
devlst_backup:
.res kMaxVolumes+1, 0 ; TODO: Why +1?
.res kMaxDevListSize+1, 0 ; +1 for DEVCNT itself

;; index is device number (in DEVLST), value is icon number
device_to_icon_map:
Expand Down
2 changes: 2 additions & 0 deletions res/notes/testplan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,5 @@
* Launch DeskTop. Select a folder. File > Open. Verify that the folder icon is no longer selected.
* Launch DeskTop. Double-click a folder. Verify that the volume icon is no longer selected.
* Launch DeskTop. Open a window containing a folder. Position the window so that the folder icon will not be obscured when opened. Select the folder. File > Open. Verify that the folder is no longer selected.

* Configure a system with 14 devices. Launch and then exit DeskTop. Load another ProDOS app that enumerates devices. Verify that all expected devices are present, and that there's no "Slot 0, Drive 1" entry.

2 comments on commit 551d0b0

@c0mmander8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"* Configure a system with 14 devices. Launch and then exit DeskTop. Load another ProDOS app that enumerates devices. Verify that all expected devices are present, and that there's no "Slot 0, Drive 1" entry." should be
"* Configure a system with 14 devices. Launch and then exit DeskTop. Load another ProDOS app that enumerates devices. Verify that all expected devices are present and that there's no "Slot 0, Drive 1" entry." instead.

@c0mmander8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no comma between "present" and "and".

Please sign in to comment.