Skip to content

Commit c0e2020

Browse files
DeskTop: Fix volume icon flicker on launch with empty Disk II drives
Regression introduced in 05ef150 (new in v1.5); a bad branch when an empty Disk II was detected caused the most recent volume icon to be repainted. Reorganize the function to use better flow control constructs.
1 parent 343c539 commit c0e2020

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Project Page: https://github.com/a2stuff/a2d
3030
* Eliminate cursor flickering when clicking on the desktop or windows.
3131
* Time window open/close animations using VBL.
3232
* Add Apple+Escape as shortcut to clear selection.
33+
* Prevent volume icon flicker on startup with empty Disk II drives.
3334

3435
### Selector
3536

notes/testplan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ When steps say to a path e.g. `/TESTS/FOLDER/SUBFOLDER`, open the volume then ea
160160
* Open `TESTS/FILE.TYPES`. Verify that an icon appears for the `TEST08` file.
161161
* Open `TESTS/FILE.TYPES`. Verify that an icon appears for the `TEST01` file.
162162

163+
* Configure a system with a SmartPort hard drive, RAMFactor card, and Disk II controller card with drives but no floppies. (MAME works) Launch DeskTop. Verify that the RAMCard volume icon doesn't flicker when the desktop is initially painted. (This will be easier to observe in emulators with acceleration disabled.)
163164

164165
## Selection
165166

src/desktop/init.s

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -643,28 +643,27 @@ end:
643643
pha ; A = unmasked unit number
644644

645645
jsr main::CreateVolumeIcon ; A = unmasked unit number, Y = device index
646-
IF A = #ERR_DEVICE_NOT_CONNECTED
646+
647+
IF ZERO
648+
;; Success! Draw it.
649+
ldx cached_window_icon_count
650+
copy8 cached_window_icon_list-1,x, icon_param
651+
ITK_CALL IconTK::DrawIcon, icon_param
652+
ELSE_IF A = #ERR_DEVICE_NOT_CONNECTED
647653
;; If device is not connected, remove it from DEVLST
648654
;; unless it's a Disk II.
649655
pla ; A = unmasked unit number
650656
pha ; A = unmasked unit number
651657
;; NOTE: Not masked with `UNIT_NUM_MASK`, `IsDiskII` handles it.
652658
jsr main::IsDiskII
653-
beq done_create ; skip
659+
IF ZC
654660
CALL _RemoveDevice, X=device_index
655-
jmp next
656-
END_IF
657-
658-
IF A = #ERR_DUPLICATE_VOLUME
661+
END_IF
662+
ELSE_IF A = #ERR_DUPLICATE_VOLUME
663+
;; If duplicate, show a special error.
659664
copy8 #kErrDuplicateVolName, main::pending_alert
660665
END_IF
661666

662-
done_create:
663-
ldx cached_window_icon_count
664-
copy8 cached_window_icon_list-1,x, icon_param
665-
ITK_CALL IconTK::DrawIcon, icon_param
666-
667-
next:
668667
pla
669668
dec device_index
670669
WHILE POS

src/desktop/main.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ JT_GET_TICKS: jmp GetTickCount ; *
6767
;;; Main event loop for the application
6868

6969
.proc MainLoop
70-
7170
;; Poll drives every Nth time `SystemTask` does its thing.
7271
;; At 1MHz on a //e this is about once every 3 seconds.
7372
kDrivePollFrequency = 35

0 commit comments

Comments
 (0)