Skip to content

Commit e648ec7

Browse files
Launcher: Consume Esc keypress when canceling shortcut copy to RAMCard
KBD was read but KBDSTRB wasn't hit to consume the keypress. Do it! Also: leave high bit alone and adjust nearby compares. Also also: leave some breadcrumbs in MGTK source about potentially resolving similar issues once the GUI is active. Fixes #868
1 parent 6e22e61 commit e648ec7

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Project Page: https://github.com/a2stuff/a2d
1818

1919
* Don't trust a partial copy of DeskTop on RAMCard; use DESKTOP.SYSTEM itself as a sentinel.
2020
* If running from a RAMCard, don't try to copy DeskTop to it.
21+
* Consume Esc keypress when canceling shortcut copy to RAMCard. ([#868](https://github.com/a2stuff/a2d/issues/868))
2122

2223
### DeskTop
2324

res/notes/testplan.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
* Without starting DeskTop, launch BASIC.SYSTEM. Set a prefix (e.g. "/RAM"). Invoke DESKTOP.SYSTEM with an absolute path (e.g. "-/A2.DESKTOP/DESKTOP.SYSTEM"). Verify that it starts correctly.
88
* Move DeskTop into a subdirectory of a volume (e.g. "/VOL/A2D"). Without starting DeskTop, launch BASIC.SYSTEM. Set a prefix to a parent directory of desktop (e.g. "/VOL"). Invoke DESKTOP.SYSTEM with a relative path (e.g. "-A2D/DESKTOP.SYSTEM"). Verify that it starts correctly.
9-
* Configure a shortcut to copy to RAMCard "at boot". Launch DeskTop. Verify the shortcut's files were copied to RAMCard. Quit DeskTop. Re-launch DeskTop from the original startup volume. Eject the disk containing the shortcut. Run the shortcut. Verify that it launches correctly.
9+
* Configure a system with a RAMCard, and ensure DeskTop is configured to copy to RAMCard on startup. Configure a shortcut to copy to RAMCard "at boot". Launch DeskTop. Verify the shortcut's files were copied to RAMCard. Quit DeskTop. Re-launch DeskTop from the original startup volume. Eject the disk containing the shortcut. Run the shortcut. Verify that it launches correctly.
10+
* Configure a system with a RAMCard, and ensure DeskTop is configured to copy to RAMCard on startup. Configure a shortcut to copy to RAMCard "at boot". Launch DeskTop. While the shortcut's files are copying to RAMCard, press Esc. Verify that when the DeskTop appears the Apple menu is not activated.
1011
* Configure an Apple II+ system. Invoke DESKTOP.SYSTEM from a launcher (e.g. Bitsy Bye). Verify the launcher is restarted and does not crash or hang.
1112
* Configure an Apple IIe system with no card in the Aux slot. Invoke DESKTOP.SYSTEM from a launcher (e.g. Bitsy Bye). Verify the launcher is restarted and does not crash or hang.
1213
* Launch BASIC.SYSTEM. Save a file to /RAM. Invoke DESKTOP.SYSTEM. Verify that a warning is shown about /RAM not being empty. Press Esc. Verify that the ProDOS launcher is re-invoked. Verify that the file is still present in /RAM.

src/desktop.system/desktop.system.s

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ close: MLI_CALL CLOSE, close_dstfile_params
698698
.proc CheckCancel
699699
lda KBD
700700
bpl ret
701+
sta KBDSTRB
701702
cmp #$80|CHAR_ESCAPE
702703
beq cancel
703704
ret: rts
@@ -2108,15 +2109,14 @@ str_not_completed:
21082109
sta KBDSTRB
21092110
loop: lda KBD
21102111
bpl loop
2111-
and #CHAR_MASK
21122112
sta KBDSTRB
21132113

2114-
cmp #kShortcutMonitor ; Easter Egg: If 'M', enter monitor
2114+
cmp #$80|kShortcutMonitor ; Easter Egg: If 'M', enter monitor
21152115
beq monitor
2116-
cmp #TO_LOWER(kShortcutMonitor)
2116+
cmp #$80|TO_LOWER(kShortcutMonitor)
21172117
beq monitor
21182118

2119-
cmp #CHAR_RETURN
2119+
cmp #$80|CHAR_RETURN
21202120
bne loop
21212121

21222122
jmp FinishAndInvoke
@@ -2369,10 +2369,9 @@ done: rts
23692369
: lda KBD
23702370
bpl :-
23712371
sta KBDSTRB
2372-
and #CHAR_MASK
2373-
cmp #CHAR_ESCAPE
2372+
cmp #$80|CHAR_ESCAPE
23742373
beq done
2375-
cmp #CHAR_RETURN
2374+
cmp #$80|CHAR_RETURN
23762375
bne :-
23772376
done: rts
23782377
.endproc ; WaitEnterEscape

src/mgtk/mgtk.s

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4812,6 +4812,8 @@ reset_desktop:
48124812
jsr SaveParamsAndStack
48134813
jsr SetDesktopPort
48144814

4815+
;; TODO: Consider clearing `KBDSTRB` to avoid lingering keypresses.
4816+
48154817
;; Fills the desktop background on startup (menu left black)
48164818
MGTK_CALL MGTK::SetPattern, desktop_pattern
48174819
MGTK_CALL MGTK::PaintRect, desktop_mapinfo+MGTK::MapInfo::maprect
@@ -5377,16 +5379,18 @@ eventbuf:
53775379

53785380
.res kEventBufSize*MGTK::short_event_size
53795381

5380-
53815382
.proc FlushEventsImpl
53825383
php
53835384
sei
53845385
lda #0
53855386
sta eventbuf_tail
53865387
sta eventbuf_head
5388+
;; TODO: Consider clearing `KBDSTRB` to avoid a race where the
5389+
;; keypress hasn't been seen yet when `FlushEvents` is called.
53875390
plp
53885391
rts
53895392
.endproc ; FlushEventsImpl
5393+
53905394
;; called during PostEvent and a few other places
53915395
.proc PutEvent
53925396
lda eventbuf_head

0 commit comments

Comments
 (0)