Compare commits

...

517 Commits

Author SHA1 Message Date
Joshua Bell
ebb03dbb61 Bump version 2019-07-30 21:26:02 -07:00
Joshua Bell
2415869008 Add Control Panel DA.
* Desktop pattern
* Double-click speed
* Joystick calibration
* Insertion point blink speed

Settings live in LCBANK1 at $FF80 and are persisted directly to DESKTOP2 when the DA closes. DeskTop itself is modified to pull values from there. IP blink routines are improved to not slow down when the mouse pointer is over the window.

Fixes #2, #31, #72
2019-07-30 21:22:28 -07:00
Joshua Bell
daf6e87aec Rename the icon management logic in Aux 'Icon ToolKit' 2019-07-28 16:54:06 -07:00
Joshua Bell
24d318c274 Disasm: icon offset logic 2019-07-28 15:24:36 -07:00
Joshua Bell
13c1f6166a Move macros.inc into inc/ to tidy top level dir 2019-07-27 10:49:13 -07:00
Joshua Bell
ff2f652c96 Move MGTK to mgtk/ dir to tidy up top level 2019-07-27 10:45:31 -07:00
Joshua Bell
157c6a3f0c Add MGTK Font file support for Preview.
Correct docs for some DeskTop icon APIs, and improve resilience of
some of the APIs to having atypical grafports selected when called.
2019-07-26 20:44:22 -07:00
Joshua Bell
6e96eae7ed DeskTop: Fix highlighting when dragging over icons. Fixes #163
The DeskTop library routines for handling icons switched GrafPorts
in a fragile way, which previous changes had broken. Updates to
the volume icon clipping code left the GrafPort used for icon
drawing clipped, and it was not restored correctly before subsequent
file icons were drawn.

Ensure the correct grafports are used everywhere, and reset them
when necessary. Further simplification is possible.
2019-07-23 21:07:53 -07:00
Joshua Bell
e8a9add613 Correct icon clipping while dragging. Fixes #162
When dragging a selection over a desktop icon, the clipping rect of
the GrafPort used for drawing the outline would be changed. Broken
at some point, but probably only worked by accident. (Zero page fun?)

Introduce a dedicated grafport for drawing the outline.

Also, add some macros for pushorg/poporg
2019-07-22 21:14:20 -07:00
Joshua Bell
37091f842a Preview: Infer BIN at $4000 as image too 2019-07-20 10:06:01 -07:00
Joshua Bell
a2659c7ae0 Fix clock inversion when desktop icon is selected. Fixes #161 2019-07-12 14:07:30 -07:00
Joshua Bell
f96c43c3a3 version bump 2019-07-12 11:43:00 -07:00
Joshua Bell
92482500a6 Calculator DA: Fix FSUB call. Fixes #159
When updating how Calculator calls ROM routines in 88666311 the FSUB
wrapper was missing a PLA. Convert the wrappers into a macro to avoid
such mistakes (D.R.Y.)

Also, updated refs to CHRGET routine.
2019-07-11 21:18:48 -07:00
Joshua Bell
25297ccb28 Simplify Calculator DA's init/exit/redraw logic 2019-07-11 16:43:15 -07:00
Joshua Bell
46e413f3f1 Prevent crashes in Calculator/Eyes DA using ROM FP routines
During calls, MGTK uses the top half of the zero page to hold the
active grafport and local variables. It normally saves/restores the ZP
on each call so that the application's ZP state is preserved. Per
docs, the ZP1 call with param $00 can be used to disable this; MGTK
will write its state to the ZP and assume the ZP is not touched until
a subsequent ZP1 call with param $80, allowing higher performance.

DeskTop would normally run in this state ($00), except when DAs were
invoked since they could use ROM routines (etc) and expect the top
half of the ZP to be preserved during MGTK calls. But it did this with
a toggle ($00, $80, run the DA, then $00 again). Confusingly, the Calc
(and Eyes, c/o copy/pasta) DA would also attempt to get to a normal
state when running ($80, run, $00).

In rev 30532c31 I disabled DeskTop's toggling around DAs to fix an
issue in the Sort Directory DA (see #119), which might have changed
the overall behavior. The result is that on the IIc+ (and possibly
other hardware, but not Virtual II or Laser 128EX) the Calc and Eyes
DAs would crash.

This change disables use of the ZP1 by DeskTop and the DAs. This will
likely impair performance somewhat due to the save/restore overhead on
each call, but at least this gets us to a "known good state".

Fixes #157, #158
2019-07-11 15:50:20 -07:00
Joshua Bell
9e7fcdf9ea Key Caps DA: Fix IIc+ test 2019-07-11 15:08:14 -07:00
Joshua Bell
393bd12491 This Apple DA: Add II/II+ icon, for kicks 2019-06-26 20:00:05 -07:00
Joshua Bell
2d111d1771 Hold Apple key when double-clicking/File>Open to close parent. Resolves #9 2019-05-13 20:46:05 -07:00
Joshua Bell
1c10845cfd Add docs about Mouse Keys mode 2019-05-12 19:01:53 -07:00
Joshua Bell
39260141e8 DeskTop: Streamline File menu; repurpose Apple-W shortcut. Fixes #154 2019-05-09 21:43:51 -07:00
Joshua Bell
5efade0c6e DeskTop: Fix for icon redraw lockup #153 2019-05-09 20:56:36 -07:00
Joshua Bell
dae33abc9a DeskTop: rename 'View > as Icons' menu item 2019-05-05 20:28:52 -07:00
Joshua Bell
fbfca81acc Travis CI: Deploy tagged versions as pre-releases 2019-05-05 18:12:50 -07:00
Joshua Bell
0daa0f6184 DeskTop: Make type remapping data driven 2019-04-28 23:11:48 -07:00
Joshua Bell
e3424bde4f Tweak release notes after previous fix 2019-04-25 21:28:28 -07:00
Joshua Bell
aa9194ad3f DeskTop: Improve window bounds calc for icon clipping. Fixes #152
The logic for computing window bounds started with the cliprect
returned by GetWinPort. But if the window content area is offscreen
that rect is invalid. Instead, use the Winfo's position/size records.

Also, significantly simplify the math used to account for borders,
title bars and scroll bars.
2019-04-25 21:25:58 -07:00
Joshua Bell
462d3e1914 DeskTop: Don't redraw hilited icons when obscured. Fixes #151 2019-04-24 23:45:18 -07:00
Joshua Bell
e028076e0c Merge remote-tracking branch 'origin/disasm' 2019-04-24 23:44:08 -07:00
Joshua Bell
f5b12036df disasm: handle_title_click 2019-04-24 23:41:53 -07:00
Joshua Bell
83e5fe0af4 Remove obsolete comment 2019-04-23 21:20:08 -07:00
Joshua Bell
d324039d84 Update release notes w/r/t previous commit 2019-04-22 22:49:04 -07:00
Joshua Bell
6a14ad7bf0 DeskTop: Check block count when treating BIN as FOT 2019-04-22 21:44:43 -07:00
Joshua Bell
4eb5057831
Updated README
Links! Emoji! YouTube link!
2019-04-22 21:23:36 -07:00
Joshua Bell
1e162f3564 Make Apple-Delete shortcut for deleting file. Fixes #150 2019-04-14 19:38:47 -06:00
Joshua Bell
91d91d14c8 Use lookup table for hex digits 2019-04-12 10:27:55 -06:00
Joshua Bell
f4114b3900 Merge remote-tracking branch 'origin/disasm' 2019-04-12 10:07:08 -06:00
Joshua Bell
4c875790b0 disasm: window icon/filerecord mapping 2019-04-12 10:03:07 -06:00
Joshua Bell
3e5bc7d5de DeskTop: bump release 2019-04-04 09:08:40 -07:00
Joshua Bell
bf3ab53af7 Disk Copy: Don't hard-code cross-overlay addresses. Fixes #147 2019-04-04 09:04:05 -07:00
Joshua Bell
c5647d5007 Include ProDOS 2.4.2/BASIC.SYSTEM 1.6 for packaging 2019-04-03 22:38:55 -07:00
Joshua Bell
ba8c5a7383 DeskTop: Bump version/date 2019-04-03 19:35:38 -07:00
Joshua Bell
74f11c173d Fix opening folder/volume via double-clicking. Fixes #146
Broken by recent refactor; icon ptr needed to be saved after lookup.
2019-04-03 19:33:19 -07:00
Joshua Bell
6304d4789d Travis CI: Fix preview path 2019-04-02 21:34:15 -07:00
Joshua Bell
632cad07ee Travis CI: Build preview dir too 2019-04-02 21:32:07 -07:00
Joshua Bell
1189a3a275 bump version/date 2019-04-02 21:21:07 -07:00
Joshua Bell
f93b103687 Re-associate windows with dir icons. Fixes #144 2019-04-01 22:05:22 -07:00
Joshua Bell
9b2b361e90 Better handlng of recycled icons, dedupe code. 2019-04-01 20:37:01 -07:00
Joshua Bell
1abe9dec39 Merge remote-tracking branch 'origin/disasm' 2019-04-01 19:03:36 -07:00
Joshua Bell
7cf6f9406c disasm: window open logic 2019-04-01 18:58:01 -07:00
Joshua Bell
b971f98a45 disasm: Disk Copy overlay flow 2019-03-30 16:57:37 -07:00
Joshua Bell
1db820679c Macro tidying: use param blocks; dedupe macros that differ only by order 2019-03-30 08:34:49 -07:00
Joshua Bell
345f08a5ab Merge remote-tracking branch 'origin/disasm' 2019-03-30 08:23:51 -07:00
Joshua Bell
d15e52eb53 Macros for relocated procs 2019-03-30 08:21:34 -07:00
Joshua Bell
cb1394f70c Update 'DESKTOP1' references so DESKTOP.SYSTEM copied to RAMCard 2019-03-29 18:55:58 -07:00
Joshua Bell
05b1c02fe9 Hook reset to cleanly quit DeskTop back to ProDOS. Resolves #141
* Fails on Virtual II and KEGS/GSPort/GSPlus, as they fail to
  disable aux memory on reset
* Will fail within Disk Copy overlay
2019-03-29 18:52:52 -07:00
Joshua Bell
6abca47257 This Apple DA: Distinguish 65802/65816 2019-03-27 19:13:21 -07:00
Joshua Bell
6d76fea638 DeskTop: Restore leading 0 for minutes 2019-03-26 21:28:22 -07:00
Joshua Bell
2f2c4ba26b DeskTop: tighten up clock code, remove extra space 2019-03-26 18:49:22 -07:00
Joshua Bell
546c264d5e DeskTop: Show day-of-week in menu bar clock. Fixes #142 2019-03-26 17:14:56 -07:00
Joshua Bell
6800e008c3 DeskTop: apple-backtick and apple-tab cycle windows. Fixes #143 2019-03-25 22:04:54 -07:00
Joshua Bell
a9e77de75c doc updates 2019-03-17 19:17:28 -07:00
Joshua Bell
c03c12956a DeskTop: Relocate removable device enumeration to init to save space 2019-03-17 19:10:06 -07:00
Joshua Bell
b906cbb338 Remove unused 'System/Start' path check 2019-03-17 18:47:59 -07:00
Joshua Bell
45576a0a88 Show tip about skipping copy to RAMCard. Resolves #140 2019-03-17 18:35:39 -07:00
Joshua Bell
36439b1219 Reset 'last menu', fixes DA menu restore after double-click. Fixes #139
Full-screen DAs/Previews assume they were launched from a menu and need to
restore the menu bar and hilite state. If launched via double-click there
is no hilite state to restore; handle this by setting the "last menu id"
to an unused value so the HiliteMenu call is a no-op.
2019-03-17 16:15:00 -07:00
Joshua Bell
2905a5c930 DeskTop: Avoid frequent STATUS calls on Laser 128. Maybe fixes #138
Also adjust double-click timing on Laser 128, assuming acceleration.
2019-03-17 15:34:18 -07:00
Joshua Bell
b257e03fae DeskTop: improve volume icon spacing 2019-03-16 16:36:28 -07:00
Joshua Bell
6a88449189 DeskTop: bottom-align volume icons 2019-03-15 20:03:28 -07:00
Joshua Bell
a79eba08d1 Add 'Screen Saver' DA, issue #27. Also adds DrawMenu to MGTK, fixes #136. 2019-03-11 19:44:07 -07:00
Joshua Bell
088ee11777 Image Preview: Add Minipix/Print Shop clip art support. Fixes #24 2019-03-08 18:53:37 -08:00
Joshua Bell
07efa542fa Merge remote-tracking branch 'origin/disasm' 2019-02-28 20:14:16 -08:00
Joshua Bell
8b66a9faa0 disasm: scroll thumbs 2019-02-28 20:14:07 -08:00
Joshua Bell
41cf8f5452 This Apple DA: Fix RAMWorks bank detection/counting. Fixes #131 2019-02-28 19:38:31 -08:00
Joshua Bell
6edb9a3e22 Merge remote-tracking branch 'origin/disasm' 2019-02-25 19:51:53 -08:00
Joshua Bell
c62ff1bf64 disasm: Correct screen_to_window/window_to_screen directions 2019-02-25 19:47:50 -08:00
Joshua Bell
00200ccf59 Merge remote-tracking branch 'origin/disasm' 2019-02-25 19:38:40 -08:00
Joshua Bell
4dfd612333 disasm: volume/folder opening 2019-02-25 19:38:12 -08:00
Joshua Bell
18f0749cbe Remove RAM.SYSTEM (moved to external repo). Fixes #108 2019-02-24 20:14:25 -08:00
Joshua Bell
cc1c3217de Merge remote-tracking branch 'origin/disasm' 2019-02-24 20:11:21 -08:00
Joshua Bell
dd30201bcc Remove RAM.SYSTEM. Issue #108
Turns out this was Glen E. Bredon's RAM.DRV.SYSTEM which has
previously been disassembled. I preserved this work over at:

https://github.com/inexorabletash/ram.system
2019-02-24 20:08:03 -08:00
Joshua Bell
0978840c10 MGTK: Add GetDeskPat/SetDeskPat commands 2019-02-24 11:44:50 -08:00
Joshua Bell
a428ba81be Update Release Notes 2019-02-23 23:35:58 -08:00
mgcaret
efa6842ea9 Fix IRQ handling for MLI calls. (#133)
* remove all IRQ-disabling wrappeds to MLI calls
2019-02-24 18:32:32 +11:00
Joshua Bell
17184ec4d2 Rework icon drawing to eliminate selection fuzz outside mask 2019-02-23 22:06:39 -08:00
mgcaret
a99b4f4412 shk.sh: use aux type 0640 for DAs (#132) 2019-02-23 08:23:56 +11:00
Joshua Bell
b6bcb03a04 Show Apple icon for Desk Accessory files, allow running (Fixes #101. Fixes #116.) 2019-02-22 20:21:58 +11:00
Joshua Bell
18f6a07216 Merge remote-tracking branch 'origin/disasm' 2019-02-22 18:30:13 +11:00
Joshua Bell
ea44e37814 disasm: prompt/input key handling 2019-02-22 11:34:02 +11:00
Joshua Bell
593bee912d Merge remote-tracking branch 'origin/disasm' 2019-02-19 09:14:23 +11:00
Joshua Bell
f2830f2140 disasm: window dimensions 2019-02-19 09:14:06 +11:00
Joshua Bell
c81191651b Merge remote-tracking branch 'origin/disasm' 2019-02-17 17:23:40 +11:00
Joshua Bell
bc56de6ce2 disasm: scrollbars and ports 2019-02-17 17:20:49 +11:00
Joshua Bell
11102afd80 Enable empty directories to be copied/moved. Fixes #121.
This would only affect the last directory in an operation. Code appears bogus.

Also, drop note about moving locked files; macOS behaves this way too.
2019-02-17 16:30:43 +11:00
Joshua Bell
b5d76efcdd This Apple DA: Add missing RTS 2019-02-17 16:01:47 +11:00
mgcaret
08a4ba970d this.apple: correct Apple IIe Card identification (#130) 2019-02-17 14:33:24 +11:00
Joshua Bell
ad75a611a6 Fix progress/confirmation dialog clearing rects. Issue #126 2019-02-17 14:31:12 +11:00
Joshua Bell
63351ff35d disasm: scroll and views 2019-02-17 14:06:27 +11:00
Joshua Bell
b9208870ad disasm: scroll and views 2019-02-15 19:41:29 -08:00
mgcaret
a69a6de2e8 add script to generate ShrinkIt file if nulib2 is available (#128) 2019-02-14 11:06:08 -08:00
Joshua Bell
c1a32f1656 DeskTop: Check for network share using block 2
Speculative fix for issue reported by @mgcaret in issue #88
2019-02-13 22:26:07 -08:00
Joshua Bell
30e5cf4ea5 This Apple DA: Invert bitmaps 2019-02-13 20:37:12 -08:00
Joshua Bell
3770d0f24c Merge remote-tracking branch 'origin/disasm' 2019-02-13 20:26:59 -08:00
Joshua Bell
2253754aa5 disasm: icon bbox calculation 2019-02-13 20:23:19 -08:00
Joshua Bell
e41bc03c2e disasm: icon bbox calculation 2019-02-13 19:59:05 -08:00
Joshua Bell
ca8c351d32 Clear filename if re-shown. Fixes #127 2019-02-12 21:01:38 -08:00
Joshua Bell
f7df942236 Refactor LoadWindowIconTable callers to reclaim space 2019-02-11 20:19:57 -08:00
Joshua Bell
2b089124b9
Update Known_Issues.md 2019-02-10 08:38:05 -08:00
Joshua Bell
5d35f104b3 File moves: unlock source files as needed to delete 2019-02-09 21:33:05 -08:00
Joshua Bell
9d623520c8 Rename 'down load' what it is: 'Copy to RAMCard' 2019-02-09 21:19:16 -08:00
Joshua Bell
382763aec2 Use better mul/div routines 2019-02-09 20:29:37 -08:00
Joshua Bell
2546a639db Adjust vertical spacing in Selector Entry picker (Issue #126) 2019-02-09 16:57:18 -08:00
Joshua Bell
910d11b688 Merge remote-tracking branch 'origin/disasm' 2019-02-09 13:12:11 -08:00
Joshua Bell
411b0fda72 factor out mul/div routines 2019-02-09 13:11:12 -08:00
Joshua Bell
fa6abeffc8 disasm: entry picker 2019-02-09 13:10:24 -08:00
Joshua Bell
e92822eb8d Adjust vertical spacing in various dialogs (Issue #126)
* About
* Confirmation and progress dialogs (copy/delete/lock/unlock etc)
* Format/Erase disk
2019-02-08 20:26:17 -08:00
Joshua Bell
1bb9388d32 Merge remote-tracking branch 'origin/disasm' 2019-02-08 19:07:04 -08:00
Joshua Bell
0c8835e6cf disasm: dialog positions 2019-02-08 19:04:29 -08:00
Joshua Bell
bb4adada38 Docs 2019-02-05 22:00:49 -08:00
Joshua Bell
bcebbf0d48 Add docs/Known_Issues.md; note for Issue #47 2019-02-05 21:21:20 -08:00
Joshua Bell
9a3463f37e Make same-volume drags moves, not copies (by default). Fixes #8 2019-02-03 20:07:59 -08:00
Joshua Bell
b2a35e9a56 Optionally include ProDOS/BASIC.system in package 2019-02-03 18:05:31 -08:00
Joshua Bell
30b80ac253 Generate package with Title.Cased DA names. Fixes #124 2019-02-03 12:46:42 -08:00
Joshua Bell
101549d7dd release notes updates 2019-02-03 12:01:21 -08:00
Joshua Bell
24f1b2e993 Merge remote-tracking branch 'origin/disasm' 2019-02-02 20:38:00 -08:00
Joshua Bell
3c14dfe9d1 rects 2019-02-02 20:37:15 -08:00
Joshua Bell
82b183bf84 Set DHR mono 560 mode after activating graphics. Fixes #122 2019-02-02 20:31:42 -08:00
Joshua Bell
ba949cc02b Fix filetypes in packages, tweak cases. Fixes #123 2019-02-02 17:09:52 -08:00
Joshua Bell
c2a264901c bump date 2019-02-02 12:47:26 -08:00
Joshua Bell
e06e58fda0 Copy PREVIEW/ subdir to RAMCard as well 2019-02-02 12:38:36 -08:00
Joshua Bell
eaa8f828eb update release notes 2019-02-01 20:42:28 -08:00
Joshua Bell
9df26c2215 Correct off-by-one in close animation. Fixes #120 2019-02-01 20:41:28 -08:00
Joshua Bell
d9f2a28669 Merge remote-tracking branch 'origin/disasm' 2019-01-30 20:20:30 -08:00
Joshua Bell
2bcc0b0ac3 disasm: drag/drop 2019-01-30 20:19:31 -08:00
Joshua Bell
c355d59221 Merge remote-tracking branch 'origin/disasm' 2019-01-29 23:00:07 -08:00
Joshua Bell
ed157be7b8 disasm: window updates after operations 2019-01-29 22:59:49 -08:00
Joshua Bell
f67fb001b6 Merge remote-tracking branch 'origin/disasm' 2019-01-29 22:56:17 -08:00
Joshua Bell
7a82550a42 disasm: window updates after operations 2019-01-29 21:17:39 -08:00
Joshua Bell
5238769934 Merge remote-tracking branch 'origin/disasm' 2019-01-29 08:25:06 -08:00
Joshua Bell
ca1f232c1f disasm: Sort Dir DA stack fun; copy dialog resources/proc 2019-01-29 08:24:23 -08:00
Joshua Bell
30532c316d Don't monkey with ZP configuration when launching DA. Fixes #119 2019-01-28 20:32:23 -08:00
Joshua Bell
8ead691cf8 update release notes 2019-01-27 19:54:39 -08:00
Joshua Bell
3787ed24d7 Fix volume icon clipping bugs. Fixes #117 2019-01-27 19:47:08 -08:00
Joshua Bell
262571c104 New Folder/Rename dialog - don't forget part after IP (Fixes #118) 2019-01-26 21:50:41 -08:00
Joshua Bell
f792fd374d Merge remote-tracking branch 'origin/disasm' 2019-01-26 19:51:23 -08:00
Joshua Bell
4c64c5caad disasm: clipping comments 2019-01-26 19:51:12 -08:00
Joshua Bell
e30b793028 Merge remote-tracking branch 'origin/disasm' 2019-01-26 10:38:57 -08:00
Joshua Bell
250ba76c91 disasm: clipping comments 2019-01-26 10:38:51 -08:00
Joshua Bell
82fdd421eb Merge remote-tracking branch 'origin/disasm' 2019-01-26 10:34:31 -08:00
Joshua Bell
79a3aaf27e disasm: clipping comments 2019-01-26 10:34:13 -08:00
Joshua Bell
331d2bdf6f Merge remote-tracking branch 'origin/disasm' 2019-01-25 18:30:05 -08:00
Joshua Bell
c2f58620e5 disasm: volume icon clipping 2019-01-25 18:29:42 -08:00
Joshua Bell
63de8287a7 disasm: volume icon clippping/window props 2019-01-25 08:17:30 -08:00
Joshua Bell
c1673a5de6 disasm: volume icon clippping/window props 2019-01-25 00:14:45 -08:00
Joshua Bell
8b738798f4 disasm: vol icon clipping 2019-01-24 08:35:43 -08:00
Joshua Bell
ed004f9bf7 Refine 'page' icon shapes and mask 2019-01-21 20:28:31 -08:00
Joshua Bell
a8599e5c68 Add "Preview DAs", allow opening text/graphics directly (Issue #101) 2019-01-21 12:35:43 -08:00
Joshua Bell
467cc1d73a Show Image File DA: Call main routines via trampoline 2019-01-20 21:40:49 -08:00
Joshua Bell
3e9e961ebb Drop DA dependency on menu click params 2019-01-20 15:14:23 -08:00
Joshua Bell
10d84c1e11 Expose JT entry point for restoring system state 2019-01-20 15:04:52 -08:00
Joshua Bell
4763b829aa Delete hopefully unused resource bytes 2019-01-20 11:54:19 -08:00
Joshua Bell
525681931f Use common bell routine (from main/overlays) 2019-01-20 11:41:49 -08:00
Joshua Bell
5860cb493f make desktop.s pull in desktop_res instead of extra indirection 2019-01-20 11:27:52 -08:00
Joshua Bell
560418779a Drop redundant penmode table 2019-01-20 11:03:39 -08:00
Joshua Bell
86650cfd97 Show Text File DA: Don't clear selection 2019-01-19 20:38:37 -08:00
Joshua Bell
da17157870 Standardize MLI calls 2019-01-19 15:00:02 -08:00
Joshua Bell
7502d6f592 Drop unnecessary MGTK relay/usage 2019-01-19 14:49:56 -08:00
Joshua Bell
a764621f58 Merge remote-tracking branch 'origin/disasm' 2019-01-19 14:37:39 -08:00
Joshua Bell
63a7bf730d disasm: labels for window/icon tables 2019-01-19 14:37:27 -08:00
Joshua Bell
443be43396 notes on memory usage 2019-01-19 10:33:38 -08:00
Joshua Bell
1e80673273 Merge remote-tracking branch 'origin/disasm' 2019-01-19 09:43:57 -08:00
Joshua Bell
3caf86649d use icon macro for volume icons now too 2019-01-19 09:41:24 -08:00
Joshua Bell
ca15759620 disasm: Rename LC relays from SHOUTY_CAPS to TitleCase 2019-01-19 09:40:43 -08:00
Joshua Bell
5197aa83fc Free up more res space; pad with xx's for easier hole finding 2019-01-17 21:27:56 -08:00
Joshua Bell
8132a8c8f0 Merge remote-tracking branch 'origin/disasm' 2019-01-16 21:11:11 -08:00
Joshua Bell
78dc563020 disasm: Icon painting 2019-01-16 21:04:07 -08:00
Joshua Bell
120c9bac55 Icon for AppleTalk file shares. Fixes #88 2019-01-16 20:26:57 -08:00
Joshua Bell
c8cc3bde53 Use proper masks for desktop (volume) icons 2019-01-15 23:36:00 -08:00
Joshua Bell
d81e18a228 re-use save area constant 2019-01-15 21:20:30 -08:00
Joshua Bell
70c0cf2abc Merge remote-tracking branch 'origin/disasm' 2019-01-15 19:04:26 -08:00
Joshua Bell
3e55cbc4f0 disasm: Dialog bg save/restore, icon painting 2019-01-15 19:02:01 -08:00
Joshua Bell
8c9993deeb Delete unused resources 2019-01-14 23:28:45 -08:00
Joshua Bell
741579d293 Delete unused code/buffers 2019-01-14 21:04:07 -08:00
Joshua Bell
7e3f27ce3d Merge remote-tracking branch 'origin/disasm' 2019-01-14 20:45:33 -08:00
Joshua Bell
5a445fa078 disasm: copy/delete/lock/unlock/size operations 2019-01-14 20:43:17 -08:00
Joshua Bell
5db44d3cb5 Key Caps DA: Handle IIgs/IIc+ layout 2019-01-13 23:24:53 -08:00
Joshua Bell
06959e7845 Note DA API dependency 2019-01-13 20:03:55 -08:00
Joshua Bell
3a7d1985b4 Refactor color/mono mode control into new JT entries 2019-01-13 20:01:43 -08:00
Joshua Bell
b817f5c0b0 Re-enable Le Chat Mauve/AppleColor DHR color mode on exit. Fixes #111 2019-01-13 14:55:41 -08:00
Joshua Bell
0078eb6b96 Fix IIc+ detection. Fixes #25 2019-01-13 14:36:34 -08:00
Joshua Bell
0db0530367 Allow dragging "unlimited" icons. Fixes #18
The number of draggable icons was restricted to a hardcoded limit
of 20, using a pre-allocated buffer (680 bytes) to hold a composite
polygon of the icon outlines.

Switch that to re-use the "save area" (used by MGTK to stash the
background of menus, so not in conflict), $800-$1AFF, which is
more than enough room for 127 icons (the maximum number supported).
2019-01-13 12:32:52 -08:00
Joshua Bell
74fb526ced Merge remote-tracking branch 'origin/disasm' 2019-01-13 12:02:09 -08:00
Joshua Bell
4f4a514abe disasm: drag items, menus 2019-01-13 12:01:26 -08:00
Joshua Bell
2a24e28db1 Drop unreferenced names/procs 2019-01-12 17:47:49 -08:00
Joshua Bell
527ecc93cf Reclaim some redundant/unused buffers 2019-01-12 17:27:31 -08:00
Joshua Bell
91b93cb860 Tidy up case adjustment code, release notes. Resolves #64 2019-01-12 11:23:43 -08:00
Joshua Bell
86d299bb32 Support GS/OS volume name casing. Issue #64 2019-01-12 09:23:53 -08:00
Joshua Bell
55544b8835 Support GS/OS filename casing for files. Issue #64
* Move filename case adjustment to directory enumeration
* Don't adjust filename case if GS/OS upper/lowercase bitflags set
* Details at GS/OS Tech Note #8

This is primarily for ProDOS 2.5 support. Note that volume names are
not handled correctly yet - they are always case-adjusted.
2019-01-11 19:47:41 -08:00
Joshua Bell
3180399fb0 center Trash icon with other volumes 2019-01-11 18:35:53 -08:00
Joshua Bell
6e7c30112f Merge remote-tracking branch 'origin/disasm' 2019-01-11 18:32:45 -08:00
Joshua Bell
1a0fe7ec55 Center volume icons using icon defs 2019-01-11 18:32:40 -08:00
Joshua Bell
53d97be9c2 disasm: trash icon position 2019-01-11 18:31:38 -08:00
Joshua Bell
e403bef725 Merge remote-tracking branch 'origin/disasm' 2019-01-11 17:56:05 -08:00
Joshua Bell
f138c4ffba disasm: get info, masks 2019-01-11 17:55:53 -08:00
Joshua Bell
d8d9f876a6 Merge remote-tracking branch 'origin/disasm' 2019-01-10 20:58:15 -08:00
Joshua Bell
17272f74a5 disasm: new folder params 2019-01-10 20:58:03 -08:00
Joshua Bell
270ed1c053 fix make clean 2019-01-08 08:13:51 -08:00
Joshua Bell
b7977e3b2c Update release notes 2019-01-06 15:19:36 -08:00
Joshua Bell
c0d38d7a0a Show Text File DA: Fix Proportional/Fixed button, delete dead code. Fixes #110 2019-01-06 14:34:51 -08:00
Joshua Bell
5fe2a90e21 Add icon for CMD files. Resolves #105 (for now) 2019-01-06 11:33:37 -08:00
Joshua Bell
fc9920cb1a Tweak aspect ratio of Graphics icon 2019-01-06 10:53:51 -08:00
Joshua Bell
216370c9d9 Enumerate DEVLST in reverse order to improve icon order. Fixes #94 2019-01-05 21:23:10 -08:00
Joshua Bell
6fface983b Merge remote-tracking branch 'origin/disasm' 2019-01-05 21:02:19 -08:00
Joshua Bell
9d9d5b25a8 disasm: drive refreshing, volume icon creation 2019-01-05 20:57:42 -08:00
Joshua Bell
7e8d7f7f1b Merge remote-tracking branch 'origin/disasm' 2019-01-05 11:35:48 -08:00
Joshua Bell
1c3ff63ee4 disasm: Reserved banks 2019-01-04 22:11:35 -08:00
Joshua Bell
b30ac7bd96 Tweak release notes and build scripts 2019-01-04 20:03:59 -08:00
Joshua Bell
dfa87c3f2a .gitignore consolidation 2019-01-04 19:46:52 -08:00
Joshua Bell
caf44adeda Merge remote-tracking branch 'origin/disasm' 2019-01-04 19:44:07 -08:00
Joshua Bell
e18d18003a .gitignore updates 2019-01-04 19:43:54 -08:00
Joshua Bell
38a0456137 RAM.SYSTEM disassembly WIP 2019-01-04 19:41:32 -08:00
Joshua Bell
2032c53fd0 disasm: misc rect table 2019-01-04 19:34:34 -08:00
Joshua Bell
9d9bc1818f Merge remote-tracking branch 'origin/disasm' 2019-01-04 19:22:29 -08:00
Joshua Bell
53230b5967 disasm: various labels 2019-01-04 19:20:20 -08:00
Joshua Bell
a7c54d7711 IIgs: Correctly set NEWVIDEO bits on exit. Fixes #109 2019-01-04 18:53:36 -08:00
Joshua Bell
4fe7fb38ae This Apple DA: Make identification menu driven, identify IIc/IIgs ROM versions. Fixes #29 2019-01-04 18:27:47 -08:00
Joshua Bell
3a7701fc31 Populate Startup menu using ProDOS device ID bytes. Fixes #106 2019-01-03 21:28:23 -08:00
Joshua Bell
d795636248 remove some dead resources/code 2019-01-03 18:48:47 -08:00
Joshua Bell
550247f472 Compute icon offsets, eliminate table 2019-01-03 18:13:47 -08:00
Joshua Bell
555f75cedc Fix icon vertical offsets 2019-01-03 17:45:04 -08:00
Joshua Bell
c83d788b06 Start adding icon for REL files 2019-01-03 16:07:59 -08:00
Joshua Bell
2c6af218f5 Update release notes 2019-01-02 23:00:02 -08:00
Joshua Bell
6be45bcb47 Allow two-click use of menus, like modern GUIs. Fixes #104 2019-01-02 22:38:22 -08:00
Joshua Bell
5d42989909 Tips and Trics doc 2019-01-02 18:26:23 -08:00
Joshua Bell
2c15699653 release notes 2019-01-02 13:32:12 -08:00
Joshua Bell
8ecea72c84 Skip DAs with high bit set. Fixes #102 2019-01-02 10:46:03 -08:00
Joshua Bell
50a755afde Add IIgs file type remapping and icon 2019-01-01 16:28:38 -08:00
Joshua Bell
149eaf2966 Correct AppleWorks file type TLAs 2019-01-01 15:31:16 -08:00
Joshua Bell
0c44a6e073 Dedupe icon masks using explicit pointers 2019-01-01 11:55:10 -08:00
Joshua Bell
49fb7c72dd disasm: Fix icon/mask rows 2019-01-01 11:47:03 -08:00
Joshua Bell
39bf5c771a Merge remote-tracking branch 'origin/disasm' 2019-01-01 10:45:07 -08:00
Joshua Bell
0b0171d1a5 disasm: icon logic 2019-01-01 09:48:06 -08:00
Joshua Bell
6f9f3b1467 Icons for graphics, AppleWorks types 2019-01-01 09:47:47 -08:00
Joshua Bell
813e60443e Rework file type / icon tables. Fixes #103 2018-12-30 20:35:23 -08:00
Joshua Bell
b2a9e62f6d Add icon y-delta table to minimize bitmap sizes 2018-12-30 19:59:37 -08:00
Joshua Bell
72be3c1231 Add "Key Caps" DA 2018-12-30 12:12:03 -08:00
Joshua Bell
16bb4a6e53 Improve RAMDisk icon 2018-12-29 11:25:56 -08:00
Joshua Bell
287da7395c Center desktop icons in columns 2018-12-29 10:55:26 -08:00
Joshua Bell
3a128da01d Compute SmartPort unit numbers more sensibly. Fixes #100 2018-12-29 10:23:33 -08:00
Joshua Bell
2bfb2cd443 Use '<=1600 blocks' heuristic for 3.5 disks; tentatively fixes #6 2018-12-28 21:43:46 -08:00
Joshua Bell
79040d3b46 Eyes DA: Tweak dimensions slightly to fill space better 2018-12-28 16:24:37 -08:00
Joshua Bell
63dd2e7585 Prefer = for constants and := for labels (new code too) 2018-12-28 16:18:08 -08:00
Joshua Bell
6e8e5a4cd4 Merge remote-tracking branch 'origin/disasm' 2018-12-28 15:47:20 -08:00
Joshua Bell
ceec6f41a4 Prefer = for constants and := for labels 2018-12-28 15:46:09 -08:00
Joshua Bell
401695b1d4 Lowercase 'by' in View menu items. 2018-12-28 10:26:56 -08:00
Joshua Bell
b6fb8f0f9e Release notes 2018-12-28 10:17:48 -08:00
Joshua Bell
3958aea47d Merge remote-tracking branch 'origin/disasm' 2018-12-28 10:15:22 -08:00
Joshua Bell
cee0de16fd disasm: menu items 2018-12-28 10:11:59 -08:00
Joshua Bell
4b77727677 Reorganize/rename menu items. Fixes #13 2018-12-28 10:11:43 -08:00
Joshua Bell
a6b0cc0f13 RBH DA: Set PREFIX last. Fixes #95 2018-12-28 09:28:52 -08:00
Joshua Bell
23acfe7c50 Consolidate padding 2018-12-27 21:25:52 -08:00
Joshua Bell
4cf8ab90ab Add Special > Check Drive command. Fixes #97 2018-12-27 21:15:02 -08:00
Joshua Bell
8c1c184549 Merge remote-tracking branch 'origin/disasm' 2018-12-27 18:55:37 -08:00
Joshua Bell
4543aa9966 disasm: Eject command logic 2018-12-27 18:55:27 -08:00
Joshua Bell
15c03ebb70 Fix minor off-by-one bug in rename logic 2018-12-27 18:47:59 -08:00
Joshua Bell
245cf779f1 Merge remote-tracking branch 'origin/disasm' 2018-12-27 18:41:32 -08:00
Joshua Bell
59a9b2e16c disasm: Check Drive logic 2018-12-27 18:40:56 -08:00
Joshua Bell
12ee56c674 Fix buffer overrun when renaming. Fixes #99 2018-12-27 17:07:45 -08:00
Joshua Bell
43745ad7a6 Merge remote-tracking branch 'origin/disasm' 2018-12-27 16:49:34 -08:00
Joshua Bell
37db92bd47 disasm: icon renames 2018-12-27 16:49:24 -08:00
Joshua Bell
78189964b1 Merge remote-tracking branch 'origin/disasm' 2018-12-27 16:34:41 -08:00
Joshua Bell
74b2945619 disasm: window/icon table 2018-12-27 16:34:27 -08:00
Joshua Bell
231d03b548 RBH DA: Restore devices and reformat /RAM. Fixes #98 2018-12-27 12:55:56 -08:00
Joshua Bell
cb99c2c9c9 Make /RAM restoration consistent. Fixes #96 2018-12-27 12:42:48 -08:00
Joshua Bell
cb5cc42c6e Merge remote-tracking branch 'origin/disasm' 2018-12-27 11:52:44 -08:00
Joshua Bell
2e09f2b9cc disasm: Check Drive logic 2018-12-27 11:52:15 -08:00
Joshua Bell
cf2d51c50a Run Basic Here DA: Use orig DT prefix if copied to ramcard. Issue #95 2018-12-27 10:01:00 -08:00
Joshua Bell
51ef098738 Fix/restore volume type identification logic. Issue #6 2018-12-26 20:49:39 -08:00
Joshua Bell
0bb1c8671a DeskTop: Fix for IIc+ drive issue. Fixes #25 2018-12-26 16:20:59 -08:00
Joshua Bell
6677e169ac Merge remote-tracking branch 'origin/disasm' 2018-12-26 15:17:40 -08:00
Joshua Bell
9d9363110b disasm: unscoped label burn-down 2018-12-26 15:13:47 -08:00
Joshua Bell
cffb08efb7 disasm: macros, labels 2018-12-26 14:48:33 -08:00
Joshua Bell
700c0e53e4 disasm: operation callbacks 2018-12-26 09:47:26 -08:00
Joshua Bell
0b65a3b27d disasm: copy logic 2018-12-25 22:07:22 -08:00
Joshua Bell
156ab93d84 Merge remote-tracking branch 'origin/disasm' 2018-12-25 10:56:16 -08:00
Joshua Bell
feaf2a9312 disasm: unscoped label burn-down 2018-12-25 10:55:14 -08:00
Joshua Bell
29ec54e940 disasm: unscoped label burn-down 2018-12-24 23:17:33 -08:00
Joshua Bell
d036236523 Release notes, bump date 2018-12-24 20:17:36 -08:00
Joshua Bell
1f781912da Assign volume coordinates based on Slot/Drive-based table (Issue #94)
This replaces the previous mechanism that used the order from DEVLST
which resulted in somewhat unpredictable ordering, although stable
for a given machine configuration.

Also, restores special case icon for unit_number $3E, used by the
RAM.SYSTEM RAMWorks driver from MouseDesk.
2018-12-24 20:14:10 -08:00
Joshua Bell
8cc1b3499c fix unreferenced label warning 2018-12-24 18:24:11 -08:00
Joshua Bell
ed464dd1fa Merge remote-tracking branch 'origin/disasm' 2018-12-24 18:23:34 -08:00
Joshua Bell
5233597109 disasm: misc macros, constants 2018-12-24 16:00:55 -08:00
Joshua Bell
31b4964738 Merge remote-tracking branch 'origin/disasm' 2018-12-24 15:36:00 -08:00
Joshua Bell
59392f31b8 disasm: Selector > Run, devlist enumeration 2018-12-24 15:34:26 -08:00
Joshua Bell
fc210d094e disasm: more accurate names for dialog procs 2018-12-24 13:37:24 -08:00
Joshua Bell
74bdb4bd30 disasm: operation processing 2018-12-24 09:11:24 -08:00
Joshua Bell
5006979e27 Merge remote-tracking branch 'origin/disasm' 2018-12-23 20:48:33 -08:00
Joshua Bell
f2caf0c1b9 disasm: traversal logic 2018-12-23 20:31:15 -08:00
Joshua Bell
fdd47573d4 disasm: traversal params 2018-12-23 14:28:21 -08:00
Joshua Bell
0cd97501dc disasm: alerts/errors, traversal params and stack 2018-12-23 12:51:03 -08:00
Joshua Bell
1e1adb77f9 disasm: copy file space check 2018-12-23 10:48:17 -08:00
Joshua Bell
9c254838e2 disasm: more operations/dialog procs 2018-12-22 20:18:08 -08:00
Joshua Bell
2e55d97c7a disasm: recursive operations 2018-12-22 18:29:08 -08:00
Joshua Bell
46882d3408 disasm: recursive operations 2018-12-22 18:25:31 -08:00
Joshua Bell
5d6a878024 disasm: recursive operations 2018-12-21 21:25:12 -08:00
Joshua Bell
12d02b49f6 disasm: recursive operations 2018-12-21 20:21:42 -08:00
Joshua Bell
f6946e33e3 Merge remote-tracking branch 'origin/disasm' 2018-12-21 13:19:21 -08:00
Joshua Bell
afba9454a8 disasm: drag and drop 2018-12-21 13:18:32 -08:00
Joshua Bell
b9c3d3b874 Note LC //e Card fix in release notes 2018-12-21 10:30:17 -08:00
Joshua Bell
1817a81db4 Merge remote-tracking branch 'origin/disasm' 2018-12-20 16:38:46 -08:00
Joshua Bell
7dda998e65 Drag selection and opening 2018-12-20 16:35:18 -08:00
Joshua Bell
55296c2201 Clear selection on directory open. Fixes #17 2018-12-20 16:34:50 -08:00
Joshua Bell
172f1f435c Make device name population table driven 2018-12-20 11:31:20 -08:00
Joshua Bell
ceaf94851a Merge remote-tracking branch 'origin/disasm' 2018-12-20 09:37:10 -08:00
Joshua Bell
45cb968904 Device names 2018-12-20 09:33:52 -08:00
Joshua Bell
81c65f7fff Macros not math 2018-12-20 09:12:19 -08:00
Joshua Bell
97480b89bd Remove 'orig' files in master branch 2018-12-19 19:50:04 -08:00
Joshua Bell
13dfdf786c SIF DA: Optimize main>aux copy, use more macros 2018-12-19 18:52:33 -08:00
Joshua Bell
be8f64864f SIF DA: Remove unnecessary adds, use macros 2018-12-19 17:58:48 -08:00
Joshua Bell
67d0ce9319 Merge remote-tracking branch 'origin/disasm' 2018-12-19 12:38:46 -08:00
Joshua Bell
f6580ca8c2 Add IF_* / ELSE / END_IF macros 2018-12-19 12:38:16 -08:00
Joshua Bell
ec1d39faed Merge remote-tracking branch 'origin/disasm' 2018-12-18 07:45:22 -08:00
Joshua Bell
77e7c3a12e Merge origin/disasm 2018-12-18 07:43:47 -08:00
Joshua Bell
827a4c8f98 overlay handlers 2018-12-17 20:36:49 -08:00
Joshua Bell
d6ae4d352b overlay handlers 2018-12-17 20:22:29 -08:00
Joshua Bell
a708a51eab overlay handlers 2018-12-17 20:13:02 -08:00
Joshua Bell
589d6e538a overlay handlers 2018-12-17 19:43:25 -08:00
Joshua Bell
0ca7a41536 overlay handlers 2018-12-17 19:11:26 -08:00
Joshua Bell
896d31c244 overlay disasm 2018-12-17 19:01:37 -08:00
Joshua Bell
1297bbed6b Dedupe another double-click detection procedure 2018-12-16 20:01:10 -08:00
Joshua Bell
06408b3d24 Merge remote-tracking branch 'origin/disasm' 2018-12-16 18:55:07 -08:00
Joshua Bell
6b472d5fdd Identify double-click routine in ovl4 2018-12-16 18:54:03 -08:00
Joshua Bell
a7a672cc18 Merge remote-tracking branch 'origin/disasm' 2018-12-15 18:17:06 -08:00
Joshua Bell
95c5de95f7 disasm: Dialog labels 2018-12-15 18:15:47 -08:00
Joshua Bell
ab7b6c884d Add space prefix to file count, fix count pos 2018-12-15 18:07:14 -08:00
Joshua Bell
bb11e91e33 More case adjustment consolidation 2018-12-15 12:17:26 -08:00
Joshua Bell
e6a69ea587 Merge remote-tracking branch 'origin/disasm' 2018-12-15 12:08:34 -08:00
Joshua Bell
629def4937 Merge remote-tracking branch 'origin/disasm' 2018-12-15 09:46:05 -08:00
Joshua Bell
0a2525b700 disasm: more case adjustment procs 2018-12-15 09:42:53 -08:00
Joshua Bell
e073d21bac Unify case adjust functions 2018-12-14 20:46:42 -08:00
Joshua Bell
d632a7e999 Merge remote-tracking branch 'origin/disasm' 2018-12-14 20:10:45 -08:00
Joshua Bell
b2cf01f0c9 disasm: ramcard paths 2018-12-14 20:01:36 -08:00
Joshua Bell
44d1771662 DeskTop disasm: dialog lifecycle/params 2018-12-13 23:24:58 -08:00
Joshua Bell
27894b368a DeskTop disasm: dialog lifecycle/params 2018-12-12 21:25:43 -08:00
Joshua Bell
a3528536ff DeskTop: misc disasm 2018-12-12 20:45:44 -08:00
Joshua Bell
9c1169d7bf Remove unnecessary capitalization 2018-12-11 21:33:12 -08:00
Joshua Bell
6fe93e6650 Merge remote-tracking branch 'origin/disasm' 2018-12-11 19:10:20 -08:00
Joshua Bell
34b6a67067 DeskTop disasm: miscellaneous main procs 2018-12-11 19:08:11 -08:00
Joshua Bell
3f4f4f90ee DeskTop: Create SELECTOR.LIST if missing. Fixes #92 2018-12-10 22:41:53 -08:00
Joshua Bell
cc997a68b5 Add version suffix 2018-12-10 22:40:33 -08:00
Joshua Bell
994cd48c98
Update RELEASE-NOTES.md 2018-12-10 21:49:03 -08:00
Joshua Bell
82f5c5fa48
Update RELEASE-NOTES.md 2018-12-10 10:30:45 -08:00
Joshua Bell
5ffc27198b
Create RELEASE-NOTES.md 2018-12-10 08:51:42 -08:00
Joshua Bell
82840ef57f Update docs regarding branch structure 2018-12-09 20:43:56 -08:00
Joshua Bell
d8baeddbe0 Restore new DAs to fixes branch
This reverts commit 6788d153af.
2018-12-09 20:08:57 -08:00
Joshua Bell
2aaf5dc8b4 Refactor smartport call/volume icon logic 2018-12-09 20:08:38 -08:00
Joshua Bell
8fe7243e7d Date DA: Read-only if system has clock. Fixes #39 2018-12-09 20:08:38 -08:00
Joshua Bell
0dfddfd629 DeskTop: dedupe double click detection, consolidate padding 2018-12-09 20:08:38 -08:00
Joshua Bell
257d0165d2 ProDOS Y2K date handling for 'View By Date'. Fixes #15 2018-12-09 20:08:38 -08:00
Joshua Bell
b22210eee6 Simplify date code, merge padding 2018-12-09 20:08:38 -08:00
Joshua Bell
44f474346f Fix block size strings 2018-12-09 20:08:38 -08:00
Joshua Bell
21882d8a89 Handle Y2K in date strings. Issue #15 2018-12-09 20:08:38 -08:00
Joshua Bell
53c96d201d DeskTop: Check driver before reinstalling RAM 2018-12-09 20:08:38 -08:00
Joshua Bell
d0b516eb2f Build: Don't do stats/diffs for fixes branch 2018-12-09 20:08:38 -08:00
Joshua Bell
019263a014 Show clock on menu bar. Fixes #7 2018-12-09 20:08:38 -08:00
Joshua Bell
87d48e2a7f Save/Restore QUIT routine. Fixes #3
On startup (DESKTOP.SYSTEM), the current ProDOS QUIT handler
(selector/dispatcher) living in Main LC Bank 2 $D100-$D3DD is written
out to a "Quit.tmp" file, along with preamble code to restore it
and invoke QUIT.

On quit (DESKTOP2), the "Quit.tmp" file is loaded at $1000, /RAM is
reattached, then the code is invoked.

This presumes prefix is set on launch and remains unchanged. If
the Quit.tmp file cannot be found, File > Quit shows an error.

Also copy Quit.tmp to RAM Card
2018-12-09 20:08:38 -08:00
Joshua Bell
045a48cd1e STF: Apple Left/Right as Home/End. Fixes #4 2018-12-09 20:08:38 -08:00
Joshua Bell
39581705cf Allow up to 12 DAs. Fixes #90 2018-12-09 20:08:38 -08:00
Joshua Bell
832725e347 DeskTop: Increase number of desktop volumes to 13. Fixes #20 2018-12-09 20:08:38 -08:00
Joshua Bell
e4c14c8307 Improve text/generic icons 2018-12-09 20:08:38 -08:00
Joshua Bell
037d58fa96 Remove bogus padding 2018-12-09 20:08:38 -08:00
Joshua Bell
9c3d6982fb Date DA: Write into DESKTOP.SYSTEM. Issue #30 2018-12-09 20:08:38 -08:00
Joshua Bell
22c56a5ed2 MGTK: Fix param length table entries. Issue #60 2018-12-09 20:08:38 -08:00
Joshua Bell
b5222b4f04 Improve system file icon 2018-12-09 20:08:38 -08:00
Joshua Bell
d68cfdf917 Improve Trash icon appearance. Issue #74 2018-12-09 20:08:38 -08:00
Joshua Bell
d83b300eab Pick up MGTK enums 2018-12-09 20:08:38 -08:00
Joshua Bell
e4562ac043 STF DA: Add keyboard support. Issue #4 2018-12-09 20:08:38 -08:00
Joshua Bell
e4c68af91e IIgs: Restore Color DHR when exiting. 2018-12-09 20:08:38 -08:00
Joshua Bell
1f70bcd7f1 Optimize volume icons 2018-12-09 20:08:38 -08:00
Joshua Bell
0c16467fd5 Bump version to 1.2
* Drop dead (?) code segment
* Add mount scropt (for Virtual ][)
2018-12-09 20:08:38 -08:00
Joshua Bell
86940aa19a Don't poke Le Chat Mauve addresses on IIgs to avoid emulator crash. Fixes #85 2018-12-09 20:08:38 -08:00
Joshua Bell
4db53ea196 Calculator: remove offscreen flag 2018-12-09 20:08:37 -08:00
Joshua Bell
8866631110 Move calc fixes into original file 2018-12-09 20:08:37 -08:00
Joshua Bell
6788d153af Remove new DAs from master branch 2018-12-09 20:08:30 -08:00
Joshua Bell
f08ff631b7 Extend Travis-CI push to include full package; fix script; fix several typos 2018-12-09 19:49:45 -08:00
Joshua Bell
900bc42196 asmfmt: respace comments 2018-12-09 16:15:48 -08:00
Joshua Bell
b3d1102161 SIF DA: Fix loading from RamWorks RAM Disk 2018-12-08 21:27:12 -08:00
Joshua Bell
21584f128c DeskTop disasm: icon creation 2018-12-08 14:04:06 -08:00
Joshua Bell
adbd1c8fc7 disasm: block copy macros, rename pointers 2018-12-08 09:56:47 -08:00
Joshua Bell
8ce498d048 Sort Directory DA disasm 2018-12-05 19:46:29 -08:00
Joshua Bell
e82df4d29e DeskTop disasm: ProDOS driver protocol 2018-12-05 19:35:04 -08:00
Joshua Bell
721c6ce90a Add RUN.BASIC.HERE DA. Fixes #54 2018-12-04 22:24:03 -08:00
Joshua Bell
87d2d53fb7 DeskTop disasm: view sorting 2018-12-03 22:05:29 -08:00
Joshua Bell
6ad09bfb2c DeskTop disasm: view sorting 2018-12-03 21:49:12 -08:00
Joshua Bell
90812e9602 DeskTop disasm: view sorting 2018-12-03 18:41:08 -08:00
Joshua Bell
4f0e554175 DeskTop disasm: view handling, file records 2018-12-02 22:10:00 -08:00
Joshua Bell
1ea7fe51c3 DeskTop disasm: string un-padding 2018-12-02 12:54:24 -08:00
Joshua Bell
265b8bff62 DeskTop device identification: improve comment 2018-12-02 12:37:29 -08:00
Joshua Bell
0ea3e2837a DeskTop disasm: view by logic 2018-12-02 12:35:24 -08:00
Joshua Bell
5820653796 DeskTop: window animation 2018-11-30 21:30:04 -08:00
Joshua Bell
05e87145b1 DeskTop: SmartPort calls and device enumerations 2018-11-29 22:16:19 -08:00
Joshua Bell
5e30b62d13 Updated DA documentation 2018-11-27 17:39:53 -08:00
Joshua Bell
b45743a6f9 Added Screen Dump DA. Fixes #46 2018-11-27 17:31:43 -08:00
Joshua Bell
e4480a55b6 disasm: invoker preamble 2018-11-26 20:19:25 -08:00
Joshua Bell
3be197076f Add top-level package script 2018-11-25 23:12:40 -08:00
Joshua Bell
4689d3ea84 Use a common mount/ directory 2018-11-25 21:16:39 -08:00
Joshua Bell
da715ed9ce disasm: quit routines 2018-11-25 14:38:06 -08:00
Joshua Bell
983429128f This Apple DA: Bitmap tweak 2018-11-24 17:46:59 -08:00
Joshua Bell
c71bbaa7a4 DeskTop disasm: Menu command dispatch table 2018-11-24 16:23:49 -08:00
Joshua Bell
a93663b1bc Use cheap local labels for self-modifying code where possible. Fixes #89 2018-11-24 11:17:46 -08:00
Joshua Bell
ae2938c58e DeskTop disasm: startup flow 2018-11-24 10:55:14 -08:00
Joshua Bell
418cd09cd6 DeskTop disasm: volume enumeration 2018-11-23 23:03:11 -08:00
Joshua Bell
a90ef2226c DeskTop disasm 2018-11-23 22:49:41 -08:00
Joshua Bell
9efbe15092 DeskTop disasm 2018-11-23 20:02:01 -08:00
Joshua Bell
03929d70fd update README with better overlay details 2018-11-23 19:41:53 -08:00
Joshua Bell
f8d5358a88 DeskTop: disasm 2018-11-23 18:15:50 -08:00
Joshua Bell
a13ec0d872 DeskTop: disasm 2018-11-23 16:25:36 -08:00
Joshua Bell
f923f1d5fe Format/Erase Overlay: disasm 2018-11-23 15:23:15 -08:00
Joshua Bell
5ed9cec8cf Format/Erase Overlay: disasm 2018-11-23 15:20:56 -08:00
Joshua Bell
8c27dfe1e6 diasm - burn down raw references 2018-11-23 14:44:18 -08:00
Joshua Bell
3745757e74 diasm - burn down raw references 2018-11-23 14:33:37 -08:00
Joshua Bell
78498cf655 diasm - burn down raw references 2018-11-23 13:38:59 -08:00
Joshua Bell
65db2c1e92 Common Overlay disasm 2018-11-23 10:07:33 -08:00
Joshua Bell
2c292d80c0 Common Overlay disasm 2018-11-23 09:56:53 -08:00
Joshua Bell
038eb4b7eb Common Overlay disasm 2018-11-23 09:50:47 -08:00
Joshua Bell
5f7584d8d5 Disk Copy Overlay disasm 2018-11-22 20:49:48 -08:00
Joshua Bell
08bcffad5c Disk Copy Overlay disasm 2018-11-22 16:53:50 -08:00
Joshua Bell
014ac606b9 Disk Copy Overlay disasm 2018-11-22 16:20:54 -08:00
Joshua Bell
b379e4236c Disk Copy Overlay disasm 2018-11-22 14:37:58 -08:00
Joshua Bell
24b9eacd20 Disk Copy Overlay disasm 2018-11-22 14:27:03 -08:00
Joshua Bell
c519a28769 Disk Copy Overlay disasm 2018-11-22 14:13:21 -08:00
Joshua Bell
dd2422fb83 Disk Copy Overlay disasm 2018-11-22 14:12:31 -08:00
Joshua Bell
6454d5fae0 Disk Copy Overlay disasm 2018-11-21 21:00:49 -08:00
Joshua Bell
1d6a8208c9 Disk Copy Overlay disasm - more padding garbage 2018-11-21 20:24:30 -08:00
Joshua Bell
891e7d6c1a Disk Copy Overlay disasm 2018-11-21 15:29:24 -08:00
Joshua Bell
83e16b5ad8 Disk Copy Overlay disasm 2018-11-21 12:11:35 -08:00
Joshua Bell
27fd1d1677 Disk Copy Overlay disasm 2018-11-21 11:05:39 -08:00
Joshua Bell
8e2be989b1 Disk Copy Overlay disasm 2018-11-21 10:46:14 -08:00
Joshua Bell
51df5c6821 Disk Copy Overlay disasm 2018-11-21 08:49:09 -08:00
Joshua Bell
6f2d18e4e8 disasm: More padding with BS1.1 2018-11-21 00:09:11 -08:00
Joshua Bell
aeece3e83a Disk Copy Overlay disasm 2018-11-20 21:45:07 -08:00
Joshua Bell
8e0fb2983a fix bad label 2018-11-20 21:44:33 -08:00
Joshua Bell
8664a98da2 diasm: align cross-overlay equates 2018-11-19 23:21:36 -08:00
Joshua Bell
503040b440 MGTK: Correct docs for TrackGoAway params. For issue #60 2018-11-19 20:35:04 -08:00
Joshua Bell
b9608fceb2 Comments/docs: Solid Apple not Closed Apple 2018-11-19 20:27:40 -08:00
Joshua Bell
7c1ead2a8e Build: DeskTop and overlays as one target 2018-11-19 19:55:00 -08:00
Joshua Bell
45e649b57c Use constants for version fields 2018-11-18 23:35:25 -08:00
Joshua Bell
5ddb8efe6f ovl2 disasm 2018-11-18 21:45:40 -08:00
Joshua Bell
2b9bef5cbe DeskTop disasm: Overlay entry points 2018-11-17 21:00:40 -08:00
Joshua Bell
1bb2824ea5 MGTK: Start using enums/constants 2018-11-17 20:34:17 -08:00
Joshua Bell
20603b1d81 DeskTop disasm: Desk Acc enumeration 2018-11-17 17:34:35 -08:00
Joshua Bell
eb7745c324 use padding macros 2018-11-16 21:13:52 -08:00
Joshua Bell
1aa7564e13 SIF DA: Apply IIgs fixes 2018-11-16 20:44:03 -08:00
Joshua Bell
ab1389d6df disassembly: misc labels 2018-11-16 20:02:54 -08:00
Joshua Bell
e771d2cc63 DeskTop: volume icon disasm tweaks 2018-11-11 19:11:44 -08:00
Joshua Bell
1692b4da42 Add macro for copy16 w/ indexed indirect src/dst 2018-11-10 20:31:31 -08:00
Joshua Bell
ac84a24a71 Depict 'bank 2' in memory map (poorly) 2018-11-05 20:37:42 -08:00
Joshua Bell
5f825cfeab Move DESKTOP.SYSTEM a.k.a. DESKTOP1 to separate directory 2018-11-05 20:14:29 -08:00
Joshua Bell
bc5a16f3d6 stxy macro 2018-09-03 17:32:46 -07:00
Joshua Bell
a05d4631df Build disk for DeskTop itself 2018-09-03 17:31:25 -07:00
Joshua Bell
3a7a8a4b68 DeskTop: Icon creation 2018-07-28 20:46:38 -07:00
Joshua Bell
8bb974200c DeskTop: Unify filename case adjusting procs 2018-07-26 21:44:29 -07:00
Joshua Bell
c7c7d866e4 Struct for Event record 2018-07-04 21:12:20 -07:00
Joshua Bell
3b085738aa Macros: add/sub16in to use indirect indexed, with integrated INY 2018-07-04 20:58:54 -07:00
Joshua Bell
a12a8d3739 This.Apple DA: Detect mockingboard. Resolves #84 2018-06-27 20:59:40 -07:00
Joshua Bell
e6877b3785 Documentation nits 2018-06-02 11:32:30 -07:00
Joshua Bell
6201f4d814 Remove some redundant constants 2018-06-01 19:00:00 -07:00
Joshua Bell
ad71d77c3d Character masks, and sort directory DA identifications 2018-06-01 18:52:26 -07:00
Joshua Bell
501635259a DeskTop: Drag logic 2018-05-28 20:48:13 -07:00
Joshua Bell
501776a7a7 DeskTop: Untangling last API call 2018-05-27 21:16:32 -07:00
Joshua Bell
3f15d12eb1 DeskTop: Internal API noodling 2018-05-27 09:31:43 -07:00
Joshua Bell
3fff12d1f3 Miscellaneous identification 2018-05-26 09:53:55 -07:00
Joshua Bell
bcdeabb7d3 DeskTop: API docs 2018-05-26 00:48:38 -07:00
Joshua Bell
f3ac87df65 MGTK: More structs 2018-05-26 00:35:28 -07:00
Joshua Bell
f0ef581a16 MGTK: More structs 2018-05-25 18:49:36 -07:00
Joshua Bell
8b3d056d7f MGTK: Start using structs 2018-05-25 18:39:43 -07:00
Joshua Bell
94e02e4a72 DeskTop: IconEntry struct, more DT calls 2018-05-25 18:24:35 -07:00
Joshua Bell
2d835585c0 DeskTop internal calls 2018-05-24 21:35:22 -07:00
Joshua Bell
06eb536f08 DeskTop internal calls 2018-05-24 18:54:42 -07:00
Joshua Bell
361e6a6563 DeskTop: call routines 2018-05-24 08:25:41 -07:00
Joshua Bell
da8bc28883 SIF: Space toggles B&W/Color where available 2018-05-23 20:43:34 -07:00
Joshua Bell
06c721b418 SIF: Le Chat Mauve COL/BW modes 2018-05-23 20:33:44 -07:00
Joshua Bell
ecb94d43a5 DeskTop: More overlay noodling 2018-05-18 09:07:41 -07:00
Joshua Bell
afb769020c DeskTop: More overlay noodling 2018-05-17 23:54:10 -07:00
Joshua Bell
4658142898 DeskTop: Common dialog key handling 2018-05-17 19:10:47 -07:00
Joshua Bell
0fdd1a9d60 DeskTop: Overlay tidying 2018-05-17 08:54:22 -07:00
Joshua Bell
3fabe4b545 Extended QUIT 2018-05-14 00:10:39 -07:00
Joshua Bell
90bfbb8310 Fix min/max cont width/length, misc other tidying 2018-05-13 22:20:46 -07:00
Joshua Bell
37ff19ef0d Show Image DA/IIgs: Preserve NEWVIDEO bits 2018-05-11 07:59:23 -07:00
Joshua Bell
2da03912a0 DeskTop: Insertion point fun 2018-05-08 20:14:59 -07:00
Joshua Bell
904ce43d49 DeskTop: name input resources 2018-05-07 21:13:29 -07:00
Joshua Bell
6ff0b94a0e DeskTop: Identify double click timer in main memory 2018-05-07 21:06:43 -07:00
Joshua Bell
df2babc38e Elements of common dialog 2018-05-07 19:35:36 -07:00
Joshua Bell
203b88bc47 Notes on stats 2018-05-07 13:39:56 -07:00
Joshua Bell
4f6c5de9fd This.Apple DA: Refine the IIc icon 2018-05-07 13:17:40 -07:00
Joshua Bell
4ff1b11ed2 README: notes about the disk copy overlays 2018-05-07 12:43:24 -07:00
Joshua Bell
4ffa58fac8
List segments in table form 2018-05-06 23:41:45 -07:00
Joshua Bell
0fba98f1f2 DeskTop: More overlay resource identifiers 2018-05-06 17:35:34 -07:00
Joshua Bell
a1c6736df2 DeskTop: More overlay resource identifiers 2018-05-06 10:09:31 -07:00
Joshua Bell
e894207778 DeskTop: More overlay resource identifiers 2018-05-06 09:15:41 -07:00
Joshua Bell
bbe9ff8896 DeskTop: More overlay resource identifiers 2018-05-05 23:40:37 -07:00
Joshua Bell
c837871bfb DeskTop: More overlay resource identifiers 2018-05-04 08:09:07 -07:00
Joshua Bell
cab4983514 Explain the various desktop source files 2018-05-03 22:35:59 -07:00
Joshua Bell
b57070fabc DeskTop: More overlay resource identifiers 2018-05-03 19:08:30 -07:00
Joshua Bell
7bd4eec08b DeskTop: More overlay resource identifiers 2018-05-03 18:43:09 -07:00
Joshua Bell
9ea7ac1a4e DeskTop: More overlay resource identifiers 2018-05-03 09:01:57 -07:00
Joshua Bell
40bf0db1d3 DeskTop: Resource string labels used in overlays 2018-05-02 22:56:52 -07:00
Joshua Bell
fe2948e489 Autogenerate include file for LC resources 2018-05-02 21:05:31 -07:00
Joshua Bell
7ac11c080d include tidying 2018-05-02 20:04:56 -07:00
Joshua Bell
f77932a28d Split desktop source into separate files 2018-05-02 19:58:17 -07:00
Joshua Bell
3a666316f3 This Apple DA: Use per-bank signatures for RAM checks 2018-05-01 19:06:59 -07:00
Joshua Bell
d280dfd023 DeskTop overlays: identify a few string references 2018-04-30 22:35:58 -07:00
Joshua Bell
558753bdc8 This Apple DA: Don't use stack during RamWorks detection to preserve page 1 2018-04-30 20:55:06 -07:00
Joshua Bell
f2f3e8467d MGTK: One more PARAM_BLOCK 2018-04-29 13:21:52 -07:00
Joshua Bell
05f33eb0a2 Show Text File DA: Make some progress on disassembly 2018-04-28 20:00:18 -07:00
Joshua Bell
dd8423ced8
Update CONTRIBUTING.md 2018-04-28 17:05:55 -07:00
Joshua Bell
9cdbb78cc2 MGTK: More PARAM_BLOCK usage 2018-04-28 16:22:33 -07:00
mgcaret
68766cb60b Rewrite quit_code to use ca65 '816 mnemonics and provide some analysis (#79)
* Convert '816 quit code to use ca65 65816 mode.
Add commentary on this code.
2018-04-28 16:00:08 -07:00
120 changed files with 34702 additions and 27669 deletions

11
.gitignore vendored
View File

@ -1 +1,12 @@
# Build directory
out
# Directory mounted in Virtual ][ as a ProDOS volume
mount
# Shrinkit file
A2D.SHK
# OS-specific files
.DS_Store

View File

@ -7,25 +7,41 @@ install:
make -C /tmp/cc65 ca65 ld65
script:
- cd $TRAVIS_BUILD_DIR/desktop.system &&
MAKE_FLAGS="CC65=/tmp/cc65/bin" res/go.sh
- cd $TRAVIS_BUILD_DIR/desktop &&
MAKE_FLAGS="CC65=/tmp/cc65/bin" res/go.sh
- cd $TRAVIS_BUILD_DIR/desk.acc &&
MAKE_FLAGS="CC65=/tmp/cc65/bin" res/go.sh
- cd $TRAVIS_BUILD_DIR/preview &&
MAKE_FLAGS="CC65=/tmp/cc65/bin" res/go.sh
before_deploy:
- git clone https://github.com/mach-kernel/cadius /tmp/cadius &&
make -C /tmp/cadius
- cd $TRAVIS_BUILD_DIR/desktop/ &&
CADIUS="/tmp/cadius/bin/release/cadius" res/package.sh
- cd $TRAVIS_BUILD_DIR/desk.acc/ &&
CADIUS="/tmp/cadius/bin/release/cadius" res/package.sh
- cd $TRAVIS_BUILD_DIR/preview/ &&
CADIUS="/tmp/cadius/bin/release/cadius" res/package.sh
- cd $TRAVIS_BUILD_DIR/ &&
CADIUS="/tmp/cadius/bin/release/cadius" res/package.sh
deploy:
provider: releases
prerelease: true
api_key:
secure: GKESS8qxyVM+0LHVniDMIKLi3ACVXQnacUvzEb/Qn+1PEw6aJ43mv4CQ8E8WyDXSi6i0FXgf72ky+bqa5u/ziYLAwgbtyu3MibNYl2Ryx8B/jdUCQsUPPlf75uBRgQNPt8gj9oBfRFh5omhZdNRaX3VHCYqi1ZrbAO3e2nunhfwddwcMLjl8wnzaM1jdm46lfdvt++GeihqCycdKVOpc6GZQqwwVtrHt9315JCzPJ9BXALxaQL0QSCpJ5uQwVhTS0Sh/k+VqxZ/nUyJ5sqgOulBRHwE0bgqKPV6zrnqftCr1PNwRXkOJfY3eM7ZbWr/vH8TaKU/21fSOxr3NmK/mHqiDun5Sm4duIRl+fm9QAxH93uyxsqPeAmxxSfNnvq6G0k3zFXPiRVgy1ceSIvYFZyCjKQEg0FF+vup0NzP85k8TpX3G4CO/WTOwVvnXruomMO5XpR3bnF1TIffDkU4DGtSpCO7FXH/Kq/CVQw3k155DhXE3IsHCId3bxlFnP0YHk/MS6Unzmcc4DDQS8pIgQII7woMv3g8gYiRQvp4gHbNvDbVi0kyAlJYbQ9lvOWjoFYs+sfxKG6J7AgO4CJ0c10/GwitvzGw9CUeR2O2sgX3i4DUbQEDCKgOO8rj+DqNH70ZtwJZmGG1TZfv1Og+hdoz9rLaFXGw1iFJ5/OXsLK8=
file:
- $TRAVIS_BUILD_DIR/out/A2DeskTop.po
- $TRAVIS_BUILD_DIR/desktop/out/DeskTop.po
- $TRAVIS_BUILD_DIR/desk.acc/out/DeskAccessories.po
- $TRAVIS_BUILD_DIR/desk.acc/res/README.txt
- $TRAVIS_BUILD_DIR/preview/out/Preview.po
- $TRAVIS_BUILD_DIR/res/README.txt
skip_cleanup: true
on:
repo: inexorabletash/a2d

133
APIs.md
View File

@ -3,8 +3,8 @@
There are three distinct API classes that need to be used:
* MouseGraphics ToolKit - graphics primitives, windowing and events
* Icon TookKit - internal API, MLI-style interface providing icon services
* DeskTop Jump Table - simple JSR calls starting at $4003 MAIN, no arguments
* DeskTop API - another MLI-style interface starting at $8E00 AUX
In addition, some DeskTop data structures can be accessed directly.
@ -20,7 +20,7 @@ This is a complex API library written by Apple circa 1985. It consists of:
Entry point is fixed at $4000 AUX, called MLI-style (JSR followed by command type and address of param block).
See [MGTK.md](MGTK.md) for further documentation.
See [MGTK.md](mgtk/MGTK.md) for further documentation.
<!-- ============================================================ -->
@ -68,9 +68,9 @@ Eject command
Redraws all DeskTop windows. Required after a drag or resize.
Follow with `DT_REDRAW_ICONS` call.
#### `JUMP_TABLE_DESKTOP_RELAY` ($4018)
#### `JUMP_TABLE_ITK_RELAY` ($4018)
DESKTOP relay call (main>aux)
Icon ToolKit relay call (main>aux)
#### `JUMP_TABLE_LOAD_OVL` ($401B)
@ -88,7 +88,7 @@ ProDOS MLI call (Y=call, X,A=params addr) *
Copy to buffer
#### `JUMP_TABLE_COPY_FROM_BUF:=` ($4027)
#### `JUMP_TABLE_COPY_FROM_BUF` ($4027)
Copy from buffer
@ -102,17 +102,17 @@ No-Op command (RTS)
#### `JUMP_TABLE_ALERT_0` ($4030)
Show alert 0
Show alert in A, default options
#### `JUMP_TABLE_ALERT_X` ($4033)
Show alert X
Show alert in A, options in X
#### `JUMP_TABLE_LAUNCH_FILE` ($4036)
Launch file
#### `JUMP_TABLE_CUR_POINTER` ($4039) *
#### `JUMP_TABLE_CUR_POINTER` ($4039)
Changes mouse cursor to pointer.
@ -124,52 +124,126 @@ Changes mouse cursor to watch.
Restore from overlay routine
#### `JUMP_TABLE_COLOR_MODE` ($4042) *
#### `JUMP_TABLE_MONO_MODE` ($4045) *
Set DHR color or monochrome mode, respectively. DHR monochrome mode is supported natively on the Apple IIgs, and via the AppleColor card and Le Chat Mauve, and is used by default by DeskTop. Desk Accessories that display images or exit DeskTop can can toggle the mode.
#### `JUMP_TABLE_RESTORE_SYS` ($4048) *
Used when exiting DeskTop; exit DHR mode, restores DHR mode to color, restores detached devices and reformats /RAM if needed, and banks in ROM and main ZP.
<!-- ============================================================ -->
## DeskTop API
## Icon ToolKit
This is part of DeskTop (unlike MGTK), but is written to be (mostly) isolated from the rest of the application logic, depending only on MGTK.
* An internal table of icon number &rarr; IconEntry is maintained.
* An internal list of highlighted (selected) icons is maintained.
* Window-centric calls assume a GrafPort for the window is already the current GrafPort.
Call from AUX (RAMRDON/RAMWRTON). Call style:
```
jsr $8E00
jsr IconTK::MLI
.byte command
.addr params
```
> NOTE: Only some of the calls have been identified.
Return value in A, 0=success.
Commands:
### `DT_ADD_ICON` ($01)
### `IconTK::ADD_ICON` ($01)
Parameters: { addr icondata }
### `DT_HIGHLIGHT_ICON` ($02)
Inserts an icon record into the table.
### `IconTK::HIGHLIGHT_ICON` ($02)
Parameters: { byte icon }
### `DT_UNHIGHLIGHT_ICON` ($03)
Highlights (selects) an icon by number.
### `IconTK::REDRAW_ICON` ($03)
Parameters: { byte icon }
### `DT_CLOSE_WINDOW` ($07)
Redraws an icon by number.
### `IconTK::REMOVE_ICON` ($04)
Parameters: { byte icon }
Removes an icon by number.
### `IconTK::HIGHLIGHT_ALL` ($05)
Parameters: { byte window_id }
### `DT_FIND_ICON` ($09)
Highlights (selects) all icons in specified window (0 = desktop).
### `IconTK::REMOVE_ALL` ($06)
Parameters: { byte window_id }
Removes all icons from specified window (0 = desktop).
### `IconTK::CLOSE_WINDOW` ($07)
Parameters: { byte window_id }
Remove all icons associated with the specified window. No redrawing is done.
### `IconTK::GET_HIGHLIGHTED` ($08)
Parameters: { .res 20 }
Copies the numbers of the first 20 selected icons to the given buffer.
### `IconTK::FIND_ICON` ($09)
Parameters: { word mousex, word mousey, (out) byte result }
### `DT_REDRAW_ICONS` ($0C)
Find the icon number at the given coordinates.
### `IconTK::DRAG_HIGHLIGHTED` ($0A)
Parameters: { byte param }
Initiates a drag of the highlighted icon(s). On entry, set param to
the specific icon being dragged. On return, the param has 0 if the
drop was on the desktop, high bit clear if the drop target was an icon
(and the low bits are the icon number), high bit set if the drop
target was a window (and the low bits are the window number).
### `IconTK::UNHIGHLIGHT_ICON` ($0B)
Parameters: { addr iconentry }
Unhighlights the specified icon. Note that the address of the IconEntry is passed, not the number.
### `IconTK::REDRAW_ICONS` ($0C)
Parameters: none (pass $0000 as address)
Redraws the icons on the desktop (mounted volumes, trash). This call
is required after destroying, moving, or resizing a window.
is required after destroying, moving, or resizing a desk accessory window.
### `DT_ICON_IN_RECT` ($0D)
### `IconTK::ICON_IN_RECT` ($0D)
Parameters: { byte icon, rect bounds }
Tests to see if the given icon (by number) overlaps the passed rect.
### `IconTK::ERASE_ICON` ($0E)
Parameters: { byte icon }
Erases the specified icon by number. No error checking is done.
<!-- ============================================================ -->
## DeskTop Data Structures
@ -178,19 +252,18 @@ DeskTop's state - selection, windows, icons - is only partially accessible
via APIs. Operations such as opening the selected file requires accessing
internal data structures directly.
### Selection
* `path_index` (byte) - id of active window in `path_table`
* `selected_file_count` (byte) - number of selected icons
* `selected_file_list` (array of bytes) - ids of selected icons
### Window - representing an open directory
* `path_index` (byte) - id of active window in `path_table`
* `path_table` (array of addrs) - maps window id to window record address
Window record: 65-byte pathname buffer; it is a length-prefixed
absolute path (e.g. `/HD/GAMES`)
absolute path (e.g. `/VOL/GAMES`)
### Selection
* `selected_file_count` (byte) - number of selected icons
* `selected_file_list` (array of bytes) - ids of selected icons
### Icon - representing a file (in a window) or volume (on the desktop)
@ -200,16 +273,16 @@ Icon record: 27-byte structure optimized for rendering the file/volume icon.
```
.byte icon icon index
.byte ??
.byte state $80 = highlighted, 0 = otherwise
.byte type/window_id
(bits 0-3 window_id)
(bits 4,5,6)
000 = directory
001 = system
010 = binary
010 = binary (maybe runnable)
011 = basic
100 = (unused)
101 = text/generic
101 = data (text/generic/...)
110 = (unused)
111 = trash
(bit 7 = open flag)

View File

@ -11,6 +11,7 @@ Contributions welcome! Preliminaries:
1. Disassembly of the MouseGraphics ToolKit
* Continue the effort to understand this powerful GUI library.
* Make it relocatable, work on C bindings for cc65.
* Pure disassembly changes take place in the `disasm` branch, which builds identically to the original.
1. Disassembly of DeskTop itself
* The core bits of DeskTop.
* The various overlays.
@ -18,8 +19,51 @@ Contributions welcome! Preliminaries:
1. Disassembly of [Selector](https://github.com/inexorabletash/a2d/issues/63)
1. Bug fixes
* Try and tackle some of the bugs in the [issue tracker](https://github.com/inexorabletash/a2d/issues?q=is%3Aissue+is%3Aopen+label%3Abug-in-original).
* Bug fixes will alter the binary, so should occur in branches. There's a `fixes` branch with some already.
1. Add new Desk Accessories
* List of ideas in the [issue tracker](https://github.com/inexorabletash/a2d/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22Desk+Accessories%22+label%3Aenhancement-for-new)
* An ["Eyes"](https://github.com/inexorabletash/a2d/issues/53) DA would be a cool, quick demo.
* A ["Control Panel"](https://github.com/inexorabletash/a2d/issues?q=is%3Aissue+is%3Aopen+label%3A%22Control+Panel+DA+Fodder%22) DA would be really neat.
* List of ideas in the [issue tracker](https://github.com/inexorabletash/a2d/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22Desk+Accessories%22+label%3A%22feature+request%22)
## DeskTop Disassembly Burn-Down
To feel confident about making additions and fixes to DeskTop, we need to
make sure we're not breaking things. That can be done in some cases by
relying on API boundaries, such as between MGTK and the DeskTop application.
But DeskTop itself is a big, monolithic application with multiple overlays,
so we need to understand nearly all of it before we can start moving code
around.
The `res/stats.pl` tool provides is a quick and dirty analysis of the
progress in turning raw da65 output into something we can confidently
modify. Here's a snapshot of the output for some files:
```
Stats:
desktop_main.s unscoped: 246 scoped: 1109 raw: 60 unrefed: 29
desktop_res.s unscoped: 64 scoped: 0 raw: 4 unrefed: 64
desktop_aux.s unscoped: 83 scoped: 301 raw: 2 unrefed: 32
loader.s unscoped: 1 scoped: 0 raw: 20 unrefed: 0
mgtk.s unscoped: 0 scoped: 10 raw: 13 unrefed: 0
invoker.s unscoped: 0 scoped: 0 raw: 2 unrefed: 0
```
* **unscoped** counts the number of auto-generated labels like `L1234`
produced by da65 which are _not_ in _two_ nested scopes. A scope is
used for the overall structure of a module, and a nested scope
is used for procedures. This counts labels which are not in either,
and thus may have some affinity for a particular address
and therefore can't be safely moved.
* **scoped** counts the number of auto-generated labels like `L1234`
produced by da65 which _are_ inside two nested scopes. Once a label
is local to a procedure it is generally safe to move, although
actually understanding the purpose and giving it a more meaningful
label is even better.
* **raw** counts the number of 16-bit addresses (`$1234`) in the code;
these usually refer to routines, resources, or occasionally
buffer locations that need to be understood and replaced with
labels.
* **unrefed** counts the number of auto-generated labels like `L1234`
that lack references within the source file. Early on, these often
hint at bogus disassembly but can also signal that the code to
use a routine or resource has not yet been identified.

View File

@ -2,39 +2,49 @@
[![Build Status](https://travis-ci.org/inexorabletash/a2d.svg?branch=master)](https://travis-ci.org/inexorabletash/a2d)
Work-in-Progress disassembly of Apple II Desktop (a.k.a. MouseDesk)
Work-in-Progress disassembly and enhancements for Apple II Desktop (a.k.a. MouseDesk)
💾 Disk images can be found on the [Releases](https://github.com/inexorabletash/a2d/releases) page 💾
## Background
Apple II Desktop started its life as "MouseDesk" by Version Soft. It
This application started its life as **MouseDesk** by Version Soft. It
is a mouse-driven Mac-like "Finder" GUI application for 8-bit Apples
with 128k of memory (Enhanced Apple //e, Apple //c) using double-hires
monochrome graphics (560x192) and the ProDOS operating system.
and clones with 128k of memory, utilizing double-hires monochrome graphics
(560x192), an optional mouse, and the ProDOS operating system.
Apple Computer acquired the software and released it - rebranded as
Apple II Desktop - as the initial system software for the Apple IIgs
**Apple II DeskTop** - as the initial
[system software for the Apple IIgs](](http://www.whatisthe2gs.apple2.org.za/system-applications))
before 16-bit GS/OS replaced it. The rebranded version still functions
on 8-bit Apples.
on 8-bit Apples, including the Apple IIe, Apple IIc, Apple IIc Plus,
Apple IIe Option Card for Macintosh, and the Laser 128 family.
Overview: http://toastytech.com/guis/a2desk.html
* [History of MouseDesk/Apple II DeskTop versions, by Jay Edwards](https://mirrors.apple2.org.za/ground.icaen.uiowa.edu/MiscInfo/Misc/mousedesk.info)
* Overviews: [GUI Gallery](http://toastytech.com/guis/a2desk.html) &mdash; [GUIdebook](https://guidebookgallery.org/guis/apple2/mousedesk)
* Manual: [Apple IIgs System Disk Users Guide (1986)](https://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/misc/Apple%20IIgs%20System%20Disk%20Users%20Guide%20%281986%29.pdf) - Chapter 2 “The DeskTop”
* [Disk Images](https://mirrors.apple2.org.za/ftp.apple.asimov.net/images/masters/other_os/gui/) for MouseDesk and Apple II DeskTop
Manual: [Apple IIgs System Disk Users Guide (1986)](https://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/misc/Apple%20IIgs%20System%20Disk%20Users%20Guide%20%281986%29.pdf) - Chapter 2 “The DeskTop”
A pieced-together history, details of versions, bug reports and feature requests: https://mirrors.apple2.org.za/ground.icaen.uiowa.edu/MiscInfo/Misc/mousedesk.info
Disks can be found at:
ftp://ftp.apple.asimov.net/pub/apple_II/images/masters/other_os/gui/
Other GUI environments exist for the 8-bit Apples, including GEOS (which includes
productivity applications) and Quark Catalyst. While A2.Desktop is more limited -
Other GUI environments exist for the 8-bit Apples, including
[GEOS](http://toastytech.com/guis/a2geos.html) (which includes productivity applications) and
[Quark Catalyst](http://toastytech.com/guis/qcat.html).
While Apple II DeskTop is more limited -
serving only as a file manager and application launcher - it is (subjectively)
more visually appealing and better integrated with ProDOS.
## Goal
## This Project
The goal of this project is to disassemble/reverse-engineer the suite
with an eye towards understanding how it functions, and eventually fixing
bugs and adding functionality.
with an eye towards understanding how it functions, fixing bugs, and
adding functionality.
See the [Release Notes](RELEASE-NOTES.md) for a list of enhancements and fixes so far.
[![Alt text](https://img.youtube.com/vi/zbElPj5zaBs/0.jpg)](https://www.youtube.com/watch?v=zbElPj5zaBs)
<br>
_KansasFest 2018 presentation by @mgcaret_
Additional help is welcome! See the guide for [Contributing](CONTRIBUTING.md).
## Tools

113
RELEASE-NOTES.md Normal file
View File

@ -0,0 +1,113 @@
# Apple II DeskTop
Project page: https://github.com/inexorabletash/a2d/
Numbers like (#123) refer to items in the issue tracker.
https://github.com/inexorabletash/a2d/issues
## 1.2 - alpha
### DeskTop Enhancements
* Current day/time shown on right side of menu bar, if system has a clock. (#7, #142)
* Up to 13 volumes are shown on the desktop (was 10). (#20)
* Drag "unlimited" number of icons (was 20). (#18)
* Dragging files to same volume moves instead of copies; use Open-Apple to force copy. (#8)
* Menu bar menus are now drop-down in addition to pull-down. (#104)
* Add Special > Check Drive command to refresh a single drive. (#97)
* Reorganized/renamed several menu items. (#13)
* New file type icons: graphics, AppleWorks, relocatable, command, IIgs-specific, and DAs. (#105)
* Desktop icon shown for AppleTalk file shares. (#88)
* Improvements to several existing icon bitmaps. (#74)
* Icons for volumes positioned more predictably and sensibly. (#94)
* GS/OS filenames (supported by ProDOS 2.5) are shown with correct case. (#64)
* Tip about skipping copy to RAMCard is shown during startup. (#140)
* Holding Apple while double-clicking or using File>Open closes parent folder. (#9)
* Apple-` or Apple-Tab keypress cycles through open windows. (#143)
* Apple-Delete deletes selected files. (#150)
### Desk Accessory Enhancements
* Up to 12 Desk Accessories are shown in the menu (was 8). (#90)
* Desk accessory files can be executed directly. (#101)
* Desk accessory files with high bit in aux-type set are hidden in Apple menu. (#102)
* Show Text File DA: Keyboard support. Escape quits, arrows scroll. (#4)
### Additional Desk Accessories
* This Apple
* Gives details about the computer, expanded memory, and what's in each slot. (#29)
* Control Panel
* Allows editing the desktop pattern (#31), double-click speed (#2), insertion point blink speed. Also shows joystick calibration. (#72)
* Run Basic Here
* Launch BASIC.SYSTEM with PREFIX set to the current window's pathname. (#42)
* Key Caps
* Shows an on-screen keyboard map and indicates which key is pressed.
* Screen Dump
* Dumps a screenshot to an ImageWriter II attached to a Super Serial Card in Slot 1. (#46)
* Eyes
* Eyes that follow the mouse. (#53)
* Screen Saver
* Homage to the classic After Dark "Flying Toasters" by Jack Eastman. More to come. (#27)
Note that several of the new Desk Accessories will not work with older versions
of Apple II DeskTop/MouseDesk, due to dependence on new APIs.
The former "Show Text File" DA is now part of automatic preview
functionality (see below).
### Automatic Preview
Text, Graphics and Font files with the correct file types can be
previewed without leaving DeskTop; select the file icon then select
File > Open, or double-click the file icon.
* Text files must be type TXT ($04).
* Graphics files must be type FOT ($08), or BIN ($06) with an aux type
of $2000 or $4000 and 17 or 33 blocks (hi-res/double hi-res) or $5800
and 3 blocks (Minipix a.k.a. Print Shop).
* Font files must be MGTK fonts with type FNT ($07).
To preview files of other types, you can copy the preview handlers
named `SHOW.TEXT.FILE`, `SHOW.IMAGE.FILE`, etc. from the `PREVIEW`
folder to the `DESK.ACC` folder, and restart DeskTop. To use them,
select the file, then select the appropriate command from the Apple
menu.
### Notable Fixes
* Dates 00-39 are treated as 2000-2039; dates 100-127 are treated as 2000-2027. (#15)
* File > Quit returns to ProDOS 8 selector, and /RAM is reattached. (#3)
* SELECTOR.LIST created if missing. (#92)
* Prevent crash after renaming volume. (#99)
* Prevent crash with more than two volumes on a SmartPort interface. (#45)
* Startup menu will include Slot 2. (#106)
* Correct odd behavior for file type $08. (#103)
* New Folder/Rename file dialog no longer truncated after IP. (#118)
* Correct rendering issues with desktop volume icons. (#117, #152)
* Prevent occasional rectangle drawn on desktop after window close. (#120)
* Empty directories can be copied/moved. (#121)
* Ctrl+Reset quits cleanly back to ProDOS (except buggy emulators). (#141)
* Desk Accessories:
* Date: Read-only on systems with a clock. On systems without a clock, date is saved for next session. (#30, #39)
* Calculator: don't mis-paint when moved offscreen and other fixes. (#33, #34)
* Sort Directory: don't need to click before sorting. (#17)
* Hardware/Emulator Specific:
* IIc Plus: don't spin slot 5 drives constantly. (Use Special > Check Drive) (#25)
* Laser 128: avoid hangs checking SmartPort status. (Use Special > Check Drive) (#138)
* IIgs: color DHR is re-enabled on exit. (#43)
* Macintosh LC IIe Option Card: don't crash on startup. (#93)
* Macintosh LC IIe Option Card: correct problems with interrupts affecting AppleTalk. (#129)
* KEGS-based IIgs emulators no longer crash on startup. (#85)
### Known Issues
* Selector app is unmodified.
* Special > Disk Copy app is not substantially modified, and may suffer bugs fixed in DeskTop (e.g. SmartPort behavior)
# 1.1
Final release by Apple Computer. November 26, 1986.
See Jay Edwards' [MouseDesk/DeskTop History](https://mirrors.apple2.org.za/ground.icaen.uiowa.edu/MiscInfo/Misc/mousedesk.info)
for more version information.

9
desk.acc/.gitignore vendored
View File

@ -1,9 +0,0 @@
# Build directory
out
# Directory mounted in Virtual ][ as a ProDOS volume
mount
# OS-specific files
.DS_Store

View File

@ -6,27 +6,28 @@ DAs are documented here.
### Desk Accessory Lifecycle
* DAs are loaded/invoked at $800 MAIN
* Up to $1C00 MAIN is available
* But AUX $1B00 and on must be preserved.
* DAs are loaded/invoked at $800 Main
* Up to $1C00 Main is available
* But Aux $1B00 and on must be preserved.
* Save stack pointer
* Copy DA code from MAIN to AUX (e.g. using `AUXMOVE`) at same address.
* Transfer control to the AUX copy
* This allows direct access to MGTK/DeskTop MLI
* Retaining a copy in MAIN allows easy access to ProDOS MLI
* Turn on ALTZP and LCBANK1
* Copy DA code from Main to Aux (e.g. using `AUXMOVE`) at same address.
* Needed if any MGTK resources will be used (bitmaps, etc)
* Transfer control to the Aux copy (`RAMRDON`/`RAMWRTON`)
* This allows direct access to MGTK/IconTK MLI
* Retaining a copy in Main allows easy access to ProDOS MLI
* Turn on ALTZP and LCBANK1 (should already be the case)
* Create window (`OpenWindow`)
* Draw everything
* Flush event queue (`FlushEvents`)
* Run an event Loop (`GetEvent`, and subsequent processing, per MGTK)
* Normal event processing per MGTK
* In addition, following a window drag/resize, DeskTop calls must be made:
* `JUMP_TABLE_REDRAW_ALL`
* `DESKTOP_REDRAW_ICONS`
* `JUMP_TABLE_REDRAW_ALL` - redraw all windows
* `IconTK::REDRAW_ICONS` - redraw desktop (volume) icons
* ...
* Destroy window (`CloseWindow`)
* Tell DeskTop to redraw desktop icons (`DESKTOP_REDRAW_ICONS`)
* Switch control back to MAIN (`RAMRDOFF`/`RAMWRTOFF`)
* Tell DeskTop to redraw desktop icons (`IconTK::REDRAW_ICONS`)
* Switch control back to Main (`RAMRDOFF`/`RAMWRTOFF`)
* Ensure ALTZP and LCBANK1 are still on
* Restore stack pointer
* `rts`

View File

@ -20,8 +20,7 @@ $(OUTDIR):
clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(OUTDIR)/*.built
rm -f $(OUTDIR)/*.sys
rm -f $(TARGETS)
$(OUTDIR)/%.o: %.s $(HEADERS)
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
@ -29,8 +28,3 @@ $(OUTDIR)/%.o: %.s $(HEADERS)
# Desk Accessory Files
$(OUTDIR)/%.built: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
# System Files .SYS
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
xattr -wx prodos.AuxType '00 20' $@

View File

@ -3,36 +3,42 @@ Disassembly of the original desk accessories:
* [Calculator](calculator.s) - complete!
* [Date](date.s) - complete!
* [Puzzle](puzzle.s) - complete!
* [Show Text File](show.text.file.s) - in progress! 95% complete
* [Sort Directory](sort.directory.s) - in progress! 40% complete
* [Show Text File](show.text.file.s) - in progress! 95% complete - moved to [preview](../preview/)
* [Sort Directory](sort.directory.s) - in progress! 60% complete
New desk accessories:
* [Show Image File](show.image.file.s) - complete!
* [This Apple](this.apple.s) - complete!
* [Eyes](eyes.s) - complete!
* [This Apple](this.apple.s)
* Gives details about the computer, expanded memory, and what's in each slot.
* [Control Panel](control.panel.s)
* Modify DeskTop settings: desktop pattern, double-click speed, insertion point blink speed. Also shows joystick calibration.
* [Eyes](eyes.s)
* Eyes that follow the mouse.
* [Screen Dump](screen.dump.s)
* Dumps a screenshot to an ImageWriter II attached to a Super Serial Card in Slot 1.
* [Key Caps](key.caps.s)
* Shows an on-screen keyboard map, and indicates which key is pressed.
* [Run Basic Here](run.basic.here.s)
* Launches BASIC.SYSTEM with PREFIX set to current window's directory.
* [Screen Saver](screen.saver.s)
* Visual distractions.
Note that the new desk accessories require an updated version of Apple II DeskTop and **will not work** with DeskTop 1.1 or MouseDesk.
See [API.md](API.md) for programming details
## Files
* `TARGETS` - lists DAs (used by makefile and other scripts)
* `Makefile` - cleans/builds targets
* `orig/*.bin` - original binary (type $F1, auxtype $0640, start $800)
* `*.s` - source (originally generated using da65, now modified)
## Build Instructions
On Unix-like systems (including Mac OS X) `make all` should build
build the desk accessory files (original and new) into `out/`
the desk accessory files (original and new) into `out/`
output with a `.built` suffix.
For the original DAs, the `.built` and `.bin` files can be compared
using `diff` to ensure that no changes have been introduced by the
disassembly process.
With `desk.acc` as the current directory, run `res/go.sh` to automatically
verify that the files are unchanged from the original, and also generate
semi-useful stats showing disassembly progress.
## Getting The DAs Onto Your Apple II
There are a handful of approaches for getting the files on your real
@ -49,7 +55,7 @@ make -C /tmp/cadius
CADIUS=/tmp/cadius/bin/release/cadius
```
Then from the `desk.acc/` directory, run: `go/package.sh`
Then from the `desk.acc/` directory, run: `res/package.sh`
This will generate: `desk.acc/out/DeskAccessories.po`
@ -62,16 +68,16 @@ below.
If you use [Virtual \]\[](http://www.virtualii.com/) as your emulator,
you can skip creating a disk image.
With `desk.acc` as your current directory, run the `res/mount.sh`
script. This will create a `desk.acc/mount` folder and the built files
will automatically be copied in. Then run Virtual ]\[ and use the
**Media** > **Mount Folder as ProDOS Disk...** menu item, then select
the `desk.acc/mount` folder. A new ProDOS volume called `/MOUNT` will
be available. (Tip: use the **Special** > **Check Drives** command in
A2D to make it appear.)
At the top level of the repo, run `res/go.sh` to build all targets,
then run `res/mount.sh`. This will create a `mount/` folder and the
built files will automatically be copied in. Then run Virtual ]\[ and
use the **Media** > **Mount Folder as ProDOS Disk...** menu item, then
select the `mount/` folder. A new ProDOS volume called
`/MOUNT` will be available. (Tip: use the **Special** > **Check
Drives** command in A2D to make it appear.)
(The `res/go.sh` script will helpfully run `res/mount.sh`
automatically if the `mount` folder already exists.)
automatically if the `mount/` folder already exists.)
### Other

View File

@ -1,8 +1,11 @@
calculator
show.text.file
date
puzzle
sort.directory
show.image.file
this.apple
eyes
screen.dump
run.basic.here
key.caps
screen.saver
control.panel

View File

@ -2,16 +2,14 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move, font
.include "../macros.inc"
;;; ============================================================
.org $800
adjust_txtptr := $B1
;;; ============================================================
;;; Start of the code
@ -27,120 +25,67 @@ save_stack: .byte 0
tsx
stx save_stack
start := call_init
end := da_end
dest := start
;; Copy the DA to AUX memory.
lda ROMIN2
copy16 #start, STARTLO
copy16 #end, ENDLO
copy16 #dest, DESTINATIONLO
copy16 #da_end, ENDLO
copy16 #start, DESTINATIONLO
sec ; main>aux
jsr AUXMOVE
;; Invoke it.
copy16 #start, XFERSTARTLO
php
pla
ora #$40 ; set overflow: use aux zp/stack
pha
plp
sec ; control main>aux
jmp XFER
;; Fall through
.endproc
;;; ============================================================
.proc init_da
;; TODO: Should be unnecessary:
sta ALTZPON
lda LCBANK1
lda LCBANK1
;; Run DA from Aux
sta RAMRDON
sta RAMWRTON
jmp init
.endproc
.proc exit_da
;; Return to DeskTop running in Main
sta RAMRDOFF
sta RAMWRTOFF
;; TODO: Should be unnecessary:
sta ALTZPON
lda LCBANK1
lda LCBANK1
ldx save_stack
txs
rts
.endproc
;;; ============================================================
;;; Used after a event_kind_drag is completed; redraws the window.
call_init:
lda ROMIN2
jmp init
;; Used after a event_kind_drag-and-drop is completed;
;; redraws the window.
.proc redraw_screen_and_window
;; Redraw the desktop (by copying trampoline to ZP)
zp_stash := $20
lda LCBANK1
lda LCBANK1
ldx #sizeof_routine
: lda routine,x
sta zp_stash,x
dex
bpl :-
jsr zp_stash
;; Redraw window after event_kind_drag
lda ROMIN2
lda #da_window_id
jsr check_visibility_and_draw_window
;; ???
lda LCBANK1
lda LCBANK1
bit offscreen_flag ; BUG: https://github.com/inexorabletash/a2d/issues/33
bmi skip
DESKTOP_CALL DT_REDRAW_ICONS
;; ???
skip: lda #0
sta offscreen_flag
lda ROMIN2
MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, grafport
rts
.proc routine
;; Redraw DeskTop's windows.
sta RAMRDOFF
sta RAMWRTOFF
jsr JUMP_TABLE_REDRAW_ALL
sta RAMRDON
sta RAMWRTON
rts
.endproc
sizeof_routine := * - routine
.endproc
;;; ============================================================
;; Redraw DeskTop's icons.
ITK_CALL IconTK::REDRAW_ICONS
;; Set when the client area is offscreen and
;; should not be painted.
offscreen_flag:
.byte 0
;; Called after window event_kind_drag is complete
;; (called with window_id in A)
.proc check_visibility_and_draw_window
sta getwinport_params_window_id
lda openwindow_params_top
cmp #screen_height - 1
bcc :+
lda #$80
sta offscreen_flag
;; Redraw window after event_kind_drag
jsr draw_content
rts
;; Is skipping this responsible for display redraw bug?
;; https://github.com/inexorabletash/a2d/issues/34
: MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, grafport
lda getwinport_params_window_id
cmp #da_window_id
bne :+
jmp draw_background
: rts
.endproc
;;; ============================================================
@ -188,7 +133,7 @@ goaway: .byte 0
.endproc
.proc getwinport_params
window_id: .byte 0
window_id: .byte da_window_id
.addr grafport
.endproc
getwinport_params_window_id := getwinport_params::window_id
@ -204,31 +149,31 @@ flag: .byte MGTK::zp_overwrite
;;; ============================================================
;;; Button Definitions
button_width := 17
button_height := 9
button_width = 17
button_height = 9
col1_left := 13
col1_right := col1_left+button_width ; 30
col2_left := 42
col2_right := col2_left+button_width ; 59
col3_left := 70
col3_right := col3_left+button_width ; 87
col4_left := 98
col4_right := col4_left+button_width ; 115
col1_left = 13
col1_right = col1_left+button_width ; 30
col2_left = 42
col2_right = col2_left+button_width ; 59
col3_left = 70
col3_right = col3_left+button_width ; 87
col4_left = 98
col4_right = col4_left+button_width ; 115
row1_top := 22
row1_bot := row1_top+button_height ; 31
row2_top := 38
row2_bot := row2_top+button_height ; 47
row3_top := 53
row3_bot := row3_top+button_height ; 62
row4_top := 68
row4_bot := row4_top+button_height ; 77
row5_top := 83
row5_bot := row5_top+button_height ; 92
row1_top = 22
row1_bot = row1_top+button_height ; 31
row2_top = 38
row2_bot = row2_top+button_height ; 47
row3_top = 53
row3_bot = row3_top+button_height ; 62
row4_top = 68
row4_bot = row4_top+button_height ; 77
row5_top = 83
row5_bot = row5_top+button_height ; 92
border_lt := 1 ; border width pixels (left/top)
border_br := 2 ; (bottom/right)
border_lt = 1 ; border width pixels (left/top)
border_br = 2 ; (bottom/right)
.proc btn_c
viewloc: DEFINE_POINT col1_left - border_lt, row1_top - border_lt
@ -433,7 +378,7 @@ port: .word col4_left,row4_top,col4_right,row5_bot
;; drawing the shadowed buttons.
;; bitmaps are low 7 bits, 0=black 1=white
bitmap_stride := 3 ; bytes
bitmap_stride = 3 ; bytes
button_bitmap: ; bitmap for normal buttons
.byte px(%0000000),px(%0000000),px(%0000001)
.byte px(%0111111),px(%1111111),px(%1111100)
@ -449,7 +394,7 @@ button_bitmap: ; bitmap for normal buttons
.byte px(%0000000),px(%0000000),px(%0000000)
.byte px(%1000000),px(%0000000),px(%0000000)
wide_bitmap_stride := 8
wide_bitmap_stride = 8
wide_button_bitmap: ; bitmap for '0' button
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%1111111)
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111110),px(%0111111)
@ -535,10 +480,10 @@ white_pattern:
backcolor: .byte $7F
.endproc
display_left := 10
display_top := 5
display_width := 120
display_height := 17
display_left = 10
display_top = 5
display_width = 120
display_height = 17
.proc frame_display_params
left: .word display_left
@ -566,7 +511,7 @@ textptr: .addr text_buffer1
textlen: .byte 15
.endproc
text_buffer_size := 14
text_buffer_size = 14
text_buffer1:
.res text_buffer_size+2, 0
@ -647,9 +592,7 @@ textfont: .addr 0
.byte 0 ; ???
menu_bar_height := 13
screen_width := 560
screen_height := 192
menu_bar_height = 13
;; params for MGTK::SetPortBits when decorating title bar
.proc screen_port
@ -673,17 +616,17 @@ penmode: .byte MGTK::pencopy
penmode: .byte MGTK::notpenXOR
.endproc
window_width := 130
window_height := 96
default_left := 210
default_top := 60
window_width = 130
window_height = 96
default_left = 210
default_top = 60
.proc winfo
window_id: .byte da_window_id
options: .byte MGTK::option_go_away_box
options: .byte MGTK::Option::go_away_box
title: .addr window_title
hscroll: .byte MGTK::scroll_option_none
vscroll: .byte MGTK::scroll_option_none
hscroll: .byte MGTK::Scroll::option_none
vscroll: .byte MGTK::Scroll::option_none
hthumbmax: .byte 0
hthumbpos: .byte 0
vthumbmax: .byte 0
@ -714,53 +657,17 @@ openwindow_params_top := winfo::top
window_title:
PASCAL_STRING "Calc"
cursor: .byte px(%0000000),px(%0000000) ; cursor
.byte px(%0100000),px(%0000000)
.byte px(%0110000),px(%0000000)
.byte px(%0111000),px(%0000000)
.byte px(%0111100),px(%0000000)
.byte px(%0111110),px(%0000000)
.byte px(%0111111),px(%0000000)
.byte px(%0101100),px(%0000000)
.byte px(%0000110),px(%0000000)
.byte px(%0000110),px(%0000000)
.byte px(%0000011),px(%0000000)
.byte px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000) ; mask
.byte px(%1110000),px(%0000000)
.byte px(%1111000),px(%0000000)
.byte px(%1111100),px(%0000000)
.byte px(%1111110),px(%0000000)
.byte px(%1111111),px(%0000000)
.byte px(%1111111),px(%1000000)
.byte px(%1111111),px(%0000000)
.byte px(%0001111),px(%0000000)
.byte px(%0001111),px(%0000000)
.byte px(%0000111),px(%1000000)
.byte px(%0000111),px(%1000000)
.byte 1, 1 ; hotspot
;;; ============================================================
;;; ==================================================
;;; DA Init
init: sta ALTZPON
lda LCBANK1
lda LCBANK1
MGTK_CALL MGTK::SetZP1, preserve_zp_params
MGTK_CALL MGTK::OpenWindow, winfo
init: MGTK_CALL MGTK::OpenWindow, winfo
MGTK_CALL MGTK::InitPort, grafport
MGTK_CALL MGTK::SetPort, grafport ; set clipping bounds?
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::FlushEvents
lda #$01
sta event_params::kind
MGTK_CALL MGTK::PostEvent, event_params
MGTK_CALL MGTK::GetEvent, event_params
lda ROMIN2
jsr reset_buffer2
lda #da_window_id
jsr check_visibility_and_draw_window
jsr draw_content
jsr reset_buffers_and_display
lda #'=' ; last operation
@ -775,32 +682,33 @@ init: sta ALTZPON
sta calc_l
.proc copy_to_b1
ldx #sizeof_adjust_txtptr_copied + 4 ; should be just + 1 ?
loop: lda adjust_txtptr_copied-1,x
sta adjust_txtptr-1,x
ldx #sizeof_chrget_routine + 4 ; should be just + 1 ?
loop: lda chrget_routine-1,x
sta CHRGET-1,x
dex
bne loop
.endproc
lda #0 ; Turn off errors
sta ERRFLG
lda #0
sta ERRFLG ; Turn off errors
sta SHIFT_SIGN_EXT ; Zero before using FP ops
copy16 #error_hook, COUT_HOOK ; set up FP error handler
lda #1
jsr FLOAT
jsr CALL_FLOAT
ldxy #farg
jsr ROUND
jsr CALL_ROUND
lda #0 ; set FAC to 0
jsr FLOAT
jsr FADD
jsr FOUT
jsr CALL_FLOAT
jsr CALL_FADD
jsr CALL_FOUT
lda #$07
jsr FMULT
jsr CALL_FMULT
lda #$00
jsr FLOAT
jsr CALL_FLOAT
ldxy #farg
jsr ROUND
jsr CALL_ROUND
tsx
stx saved_stack
@ -810,9 +718,6 @@ loop: lda adjust_txtptr_copied-1,x
lda #'C'
jsr process_key
;; previous draws mangle the cursor (why???)
MGTK_CALL MGTK::SetCursor, cursor ; Why not use JUMP_TABLE_CUR_POINTER ?
;; fall through
;;; ============================================================
;;; Input Loop
@ -820,12 +725,12 @@ loop: lda adjust_txtptr_copied-1,x
input_loop:
MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind
cmp #MGTK::event_kind_button_down
cmp #MGTK::EventKind::button_down
bne :+
jsr on_click
jmp input_loop
: cmp #MGTK::event_kind_key_down
: cmp #MGTK::EventKind::key_down
bne input_loop
jsr on_key_press
jmp input_loop
@ -834,12 +739,9 @@ input_loop:
;;; On Click
on_click:
lda LCBANK1
lda LCBANK1
MGTK_CALL MGTK::FindWindow, findwindow_params
lda ROMIN2
lda findwindow_params::which_area
cmp #MGTK::area_content
cmp #MGTK::Area::content
bcc ignore_click
lda findwindow_params::window_id
cmp #da_window_id ; This window?
@ -849,51 +751,28 @@ ignore_click:
rts
: lda findwindow_params::which_area
cmp #MGTK::area_content ; Client area?
cmp #MGTK::Area::content ; Content area?
bne :+
jsr map_click_to_button ; try to translate click into key
bcc ignore_click
jmp process_key
: cmp #MGTK::area_close_box ; Close box?
: cmp #MGTK::Area::close_box ; Close box?
bne :+
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
lda trackgoaway_params::goaway
beq ignore_click
exit: lda LCBANK1
lda LCBANK1
MGTK_CALL MGTK::CloseWindow, closewindow_params
DESKTOP_CALL DT_REDRAW_ICONS
lda ROMIN2
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
.proc do_close
;; Copy following routine to ZP and invoke it
zp_stash := $20
ldx #sizeof_routine
loop: lda routine,x
sta zp_stash,x
dex
bpl loop
jmp zp_stash
.proc routine
sta RAMRDOFF
sta RAMWRTOFF
exit: MGTK_CALL MGTK::CloseWindow, closewindow_params
ITK_CALL IconTK::REDRAW_ICONS
jmp exit_da
.endproc
sizeof_routine := * - routine ; Can't use .sizeof before the .proc definition
.endproc
: cmp #MGTK::area_dragbar ; Title bar?
: cmp #MGTK::Area::dragbar ; Title bar?
bne ignore_click
lda #da_window_id
sta dragwindow_params::window_id
lda LCBANK1
lda LCBANK1
MGTK_CALL MGTK::DragWindow, dragwindow_params
lda ROMIN2
jsr redraw_screen_and_window
rts
@ -914,7 +793,7 @@ clear: lda #'C' ; otherwise turn Escape into Clear
trydel: cmp #CHAR_DELETE ; Delete?
beq :+
cmp #$60 ; lowercase range?
cmp #'`' ; lowercase range?
bcc :+
and #$5F ; convert to uppercase
: jmp process_key
@ -1043,7 +922,7 @@ miss: clc
sec
rts
: cpx #col4_left-border_lt ; col 4?
: cpx #col4_left-border_lt ; col 4?
bcc miss
cpx #col4_right+border_br - 1 ; bug in original?
bcs miss
@ -1069,10 +948,10 @@ miss: clc
ldxy #btn_c::port
lda #'c'
jsr depress_button
lda #$00
jsr FLOAT
lda #0
jsr CALL_FLOAT
ldxy #farg
jsr ROUND
jsr CALL_ROUND
lda #'='
sta calc_op
lda #0
@ -1220,7 +1099,7 @@ trydiv: cmp #'/' ; Divide?
ldxy #btn_9::port
jmp do_digit_click
: cmp #$7F ; Delete?
: cmp #CHAR_DELETE ; Delete?
bne end
ldy calc_l
beq end
@ -1276,12 +1155,12 @@ update: sec
: sec
ror calc_p
cpy #$0A
cpy #10
bcs rts3
pha
ldy calc_l
beq empty
lda #$0F
lda #15
sec
sbc calc_l
tax
@ -1310,8 +1189,8 @@ rts3: rts
bne :+
lda calc_g
bne reparse
lda #$00
jsr FLOAT
lda #0
jsr CALL_FLOAT
jmp do_op
: lda calc_g
@ -1321,8 +1200,8 @@ rts3: rts
jmp reset_buffer1_and_state
reparse:copy16 #text_buffer1, TXTPTR
jsr adjust_txtptr
jsr FIN
jsr CHRGET
jsr CALL_FIN
do_op: pla
ldx calc_op
@ -1332,22 +1211,22 @@ do_op: pla
cpx #'+'
bne :+
jsr FADD
jsr CALL_FADD
jmp post_op
: cpx #'-'
bne :+
jsr FSUB
jsr CALL_FSUB
jmp post_op
: cpx #'*'
bne :+
jsr FMULT
jsr CALL_FMULT
jmp post_op
: cpx #'/'
bne :+
jsr FDIV
jsr CALL_FDIV
jmp post_op
: cpx #'='
@ -1358,9 +1237,9 @@ do_op: pla
.endproc
.proc post_op
ldxy #farg ; after the FP operation is done
jsr ROUND
jsr FOUT ; output as null-terminated string to FBUFFR
ldxy #farg ; after the FP operation is done
jsr CALL_ROUND
jsr CALL_FOUT ; output as null-terminated string to FBUFFR
ldy #0 ; count the eize
sloop: lda FBUFFR,y
@ -1398,14 +1277,18 @@ end: jsr display_buffer1
.endproc
.proc depress_button
stxy invert_addr
stxy inrect_params
stxy restore_addr
MGTK_CALL MGTK::GetWinPort, getwinport_params
cmp #MGTK::Error::window_obscured
bne :+
rts
: MGTK_CALL MGTK::SetPort, grafport
button_state := $FC
stx invert_addr
stx inrect_params
stx restore_addr
sty invert_addr+1
sty inrect_params+1
sty restore_addr+1
MGTK_CALL MGTK::SetPattern, black_pattern
MGTK_CALL MGTK::SetPenMode, penmode_xor
sec
@ -1416,7 +1299,7 @@ invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port
check_button:
MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind
cmp #MGTK::event_kind_drag ; Button down?
cmp #MGTK::EventKind::drag ; Button down?
bne done ; Nope, done immediately
lda #da_window_id
sta screentowindow_params::window_id
@ -1479,17 +1362,25 @@ loop: lda #' '
; fall through
.endproc
.proc display_buffer1
MGTK_CALL MGTK::GetWinPort, getwinport_params
cmp #MGTK::Error::window_obscured
beq end
MGTK_CALL MGTK::SetPort, grafport
ldxy #text_buffer1
jsr pre_display_buffer
MGTK_CALL MGTK::DrawText, drawtext_params1
rts
end: rts
.endproc
.proc display_buffer2
MGTK_CALL MGTK::GetWinPort, getwinport_params
cmp #MGTK::Error::window_obscured
beq end
MGTK_CALL MGTK::SetPort, grafport
ldxy #text_buffer2
jsr pre_display_buffer
MGTK_CALL MGTK::DrawText, drawtext_params2
rts
end: rts
.endproc
.proc pre_display_buffer
@ -1509,7 +1400,13 @@ loop: lda #' '
;;; ============================================================
;;; Draw the window contents (background, buttons)
.proc draw_background
.proc draw_content
MGTK_CALL MGTK::GetWinPort, getwinport_params
cmp #MGTK::Error::window_obscured
bne :+
rts
: MGTK_CALL MGTK::SetPort, grafport
;; Frame
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::SetPattern, background_pattern
@ -1519,10 +1416,7 @@ loop: lda #' '
MGTK_CALL MGTK::SetPattern, white_pattern
MGTK_CALL MGTK::PaintRect, clear_display_params
MGTK_CALL MGTK::SetTextBG, settextbg_params
;; fall through
.endproc
.proc draw_buttons
;; Buttons
ptr := $FA
@ -1564,8 +1458,8 @@ loop: ldy #0
;;; Draw the title bar decoration
draw_title_bar:
offset_left := 115 ; pixels from left of client area
offset_top := 22 ; pixels from top of client area (up!)
offset_left = 115 ; pixels from left of client area
offset_top = 22 ; pixels from top of client area (up!)
ldx winfo::left+1
lda winfo::left
clc
@ -1584,10 +1478,6 @@ draw_title_bar:
: stx title_bar_bitmap::viewloc::ycoord+1
MGTK_CALL MGTK::SetPortBits, screen_port ; set clipping rect to whole screen
MGTK_CALL MGTK::PaintBits, title_bar_bitmap ; Draws decoration in title bar
lda #da_window_id
sta getwinport_params::window_id
MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::ShowCursor
jsr display_buffer2
rts
@ -1595,10 +1485,18 @@ draw_title_bar:
;; Traps FP error via call to $36 from MON.COUT, resets stack
;; and returns to the input loop.
.proc error_hook
lda LCBANK1
lda LCBANK1
jsr reset_buffers_and_display
MGTK_CALL MGTK::GetWinPort, getwinport_params
cmp #MGTK::Error::window_obscured
beq :+
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::MoveTo, error_pos
MGTK_CALL MGTK::DrawText, error_string
jsr reset_buffer1_and_state
: jsr reset_buffer1_and_state
lda #'='
sta calc_op
ldx saved_stack
@ -1606,10 +1504,7 @@ draw_title_bar:
jmp input_loop
.endproc
;; Following proc is copied to $B1
save_org := *
.proc adjust_txtptr_copied
.org $B1
PROC_AT chrget_routine, $B1 ; CHRGET ("Constant expression expected" error if label used)
dummy_addr := $EA60
loop: inc TXTPTR
@ -1628,8 +1523,44 @@ loop: inc TXTPTR
sec
sbc #$D0 ; carry set if successful
end: rts
.endproc
.org save_org + .sizeof(adjust_txtptr_copied)
sizeof_adjust_txtptr_copied := .sizeof(adjust_txtptr_copied)
END_PROC_AT
sizeof_chrget_routine = .sizeof(chrget_routine)
.macro CALL_FP proc
pha
lda ROMIN2
pla
jsr proc
pha
lda LCBANK1
lda LCBANK1
pla
rts
.endmacro
CALL_FLOAT:
CALL_FP FLOAT
CALL_FADD:
CALL_FP FADD
CALL_FSUB:
CALL_FP FSUB
CALL_FMULT:
CALL_FP FMULT
CALL_FDIV:
CALL_FP FDIV
CALL_FIN:
CALL_FP FIN
CALL_FOUT:
CALL_FP FOUT
CALL_ROUND:
CALL_FP ROUND
da_end := *

1631
desk.acc/control.panel.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,10 +3,11 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move; font; glyphs
.include "../macros.inc"
;;; ============================================================
.org $800
@ -21,7 +22,7 @@ stash_stack: .byte $00
;;; MLI Call Param Blocks
filename:
PASCAL_STRING "MD.SYSTEM"
PASCAL_STRING "DESKTOP.SYSTEM"
DEFINE_OPEN_PARAMS open_params, filename, $900
DEFINE_SET_MARK_PARAMS set_mark_params, 3
@ -30,7 +31,7 @@ filename:
write_buffer:
.byte 0,0
sizeof_write_buffer := * - write_buffer
sizeof_write_buffer = * - write_buffer
;;; ============================================================
@ -43,6 +44,11 @@ write_buffer:
stx stash_stack
sta ALTZPOFF
lda ROMIN2
lda MACHID
and #%00000001 ; bit 0 = clock card
sta clock_flag
lda DATELO
sta datelo
lda DATEHI
@ -65,7 +71,7 @@ write_buffer:
.endproc
;;; ============================================================
;;; Write date into MD.SYSTEM file and exit the DA
;;; Write date into DESKTOP.SYSTEM file and exit the DA
.proc save_date_and_exit
sta ALTZPON
@ -76,6 +82,9 @@ write_buffer:
lda write_buffer ; Dialog committed?
beq skip
;; If there is a system clock, don't write out the date.
ldx clock_flag
bne skip
ldy #OPEN ; open the file
ldax #open_params
@ -119,10 +128,10 @@ start_da:
;; The following 7 rects are iterated over to identify
;; a hit target for a click.
num_hit_rects := 7
first_hit_rect := *
up_rect_index := 3
down_rect_index := 4
num_hit_rects = 7
first_hit_rect = *
up_rect_index = 3
down_rect_index = 4
ok_button_rect:
.word $6A,$2E,$B5,$39
@ -154,6 +163,9 @@ backcolor: .byte 0 ; black
selected_field: ; 1 = day, 2 = month, 3 = year, 0 = none (init)
.byte 0
clock_flag:
.byte 0
datelo: .byte 0
datehi: .byte 0
@ -197,7 +209,7 @@ which_area:.byte 0
window_id: .byte 0
.endproc
da_window_id := 100
da_window_id = 100
.proc screentowindow_params
window_id: .byte da_window_id
@ -221,10 +233,10 @@ penmode: .byte $02 ; this should be normal, but we do inverts ??
.proc winfo
window_id: .byte da_window_id
options:.byte MGTK::option_dialog_box
options:.byte MGTK::Option::dialog_box
title: .addr 0
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hscroll:.byte MGTK::Scroll::option_none
vscroll:.byte MGTK::Scroll::option_none
hthumbmax: .byte 0
hthumbpos: .byte 0
vthumbmax: .byte 0
@ -232,14 +244,14 @@ vthumbpos: .byte 0
status: .byte 0
reserved: .byte 0
mincontwidth: .word 100
maxcontwidth: .word 100
mincontlength: .word $1F4
maxcontlength: .word $1F4
mincontlength: .word 100
maxcontwidth: .word 500
maxcontlength: .word 500
port:
viewloc: DEFINE_POINT 180, 50
mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth
cliprect: DEFINE_RECT 0, 0, $C7, $40
cliprect: DEFINE_RECT 0, 0, 199, 64
pattern:.res 8,$00
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
penloc: DEFINE_POINT 0, 0
@ -257,6 +269,11 @@ nextwinfo: .addr 0
init_window:
jsr save_zp
;; If null date, just leave the baked in default
lda datelo
ora datehi
beq :+
;; Crack the date bytes. Format is:
;; | DATEHI | DATELO |
;; |7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0|
@ -280,7 +297,7 @@ init_window:
lsr a
sta month
MGTK_CALL MGTK::OpenWindow, winfo
: MGTK_CALL MGTK::OpenWindow, winfo
lda #0
sta selected_field
jsr draw_window
@ -293,12 +310,12 @@ init_window:
.proc input_loop
MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind
cmp #MGTK::event_kind_button_down
cmp #MGTK::EventKind::button_down
bne :+
jsr on_click
jmp input_loop
: cmp #MGTK::event_kind_key_down
: cmp #MGTK::EventKind::key_down
bne input_loop
.endproc
@ -310,7 +327,11 @@ init_window:
bne :+
jmp on_ok
: cmp #CHAR_ESCAPE
;; If there is a system clock, only the first button is active
: ldx clock_flag
bne input_loop
cmp #CHAR_ESCAPE
bne :+
jmp on_cancel
: cmp #CHAR_LEFT
@ -372,7 +393,7 @@ update_selection:
bne hit
miss: rts
hit: cmp #MGTK::area_content
hit: cmp #MGTK::Area::content
bne miss
jsr find_hit_target
cpx #0
@ -449,7 +470,7 @@ on_field_click:
stx hit_rect_index
loop: MGTK_CALL MGTK::GetEvent, event_params ; Repeat while mouse is down
lda event_params::kind
cmp #MGTK::event_kind_button_up
cmp #MGTK::EventKind::button_up
beq :+
jsr do_inc_or_dec
jmp loop
@ -481,11 +502,7 @@ incr: copy16 #increment_table, ptr
go: lda selected_field
asl a
tay
lda (ptr),y
sta gosub+1
iny
lda (ptr),y
sta gosub+2
copy16in (ptr),y, gosub+1
gosub: jsr $1000 ; self modified
MGTK_CALL MGTK::SetTextBG, settextbg_params
@ -503,12 +520,12 @@ decrement_table:
.addr 0, decrement_day, decrement_month, decrement_year
day_min := 1
day_max := 31
month_min := 1
month_max := 12
year_min := 0
year_max := 99
day_min = 1
day_max = 31
month_min = 1
month_max = 12
year_min = 0
year_max = 99
increment_day:
clc
@ -581,7 +598,7 @@ decrement_year:
ptr := $07
str := month_string + 3
len := 3
len = 3
copy16 #str, ptr
@ -614,16 +631,12 @@ dialog_result: .byte 0
.proc destroy
MGTK_CALL MGTK::CloseWindow, closewindow_params
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
;; Copy the relay routine to the zero page
dest := $20
ldx #sizeof_routine
loop: lda routine,x
sta dest,x
dex
bpl loop
COPY_BYTES sizeof_routine+1, routine, dest
lda dialog_result
beq skip
@ -648,7 +661,7 @@ skip: jmp dest
sta RAMWRTOFF
jmp save_date_and_exit
.endproc
sizeof_routine := * - routine
sizeof_routine = * - routine
.endproc
;;; ============================================================
@ -668,9 +681,17 @@ loop: txa
MGTK_CALL MGTK::InRect, $1000, test_addr
bne done
clc
;; If there is a system clock, only the first button is active
ldx clock_flag
beq next
pla
ldx #0
rts
next: clc
lda test_addr
adc #8 ; size of 4 words
adc #.sizeof(MGTK::Rect)
sta test_addr
bcc :+
inc test_addr+1
@ -724,17 +745,21 @@ penheight: .byte 1
;;; ============================================================
;;; Render the window contents
draw_window:
.proc draw_window
MGTK_CALL MGTK::SetPort, winfo::port
MGTK_CALL MGTK::FrameRect, border_rect
MGTK_CALL MGTK::SetPenSize, setpensize_params
MGTK_CALL MGTK::FrameRect, date_rect
MGTK_CALL MGTK::FrameRect, ok_button_rect
MGTK_CALL MGTK::FrameRect, cancel_button_rect
MGTK_CALL MGTK::FrameRect, ok_button_rect
MGTK_CALL MGTK::MoveTo, label_ok_pos
MGTK_CALL MGTK::DrawText, label_ok
;; If there is a system clock, only draw the OK button.
ldx clock_flag
bne :+
MGTK_CALL MGTK::FrameRect, cancel_button_rect
MGTK_CALL MGTK::MoveTo, label_cancel_pos
MGTK_CALL MGTK::DrawText, label_cancel
@ -746,17 +771,24 @@ draw_window:
MGTK_CALL MGTK::DrawText, label_downarrow
MGTK_CALL MGTK::FrameRect, down_arrow_rect
jsr prepare_day_string
: jsr prepare_day_string
jsr prepare_month_string
jsr prepare_year_string
jsr draw_day
jsr draw_month
jsr draw_year
MGTK_CALL MGTK::SetPenMode, penmode_params
;; If there is a system clock, don't draw the highlight.
ldx clock_flag
beq :+
rts
: MGTK_CALL MGTK::SetPenMode, penmode_params
MGTK_CALL MGTK::SetPattern, white_pattern
lda #1
jmp highlight_selected_field
.endproc
.proc draw_selected_field
lda selected_field
@ -849,7 +881,7 @@ loop2: sbc #1
;;; Save/restore Zero Page
.proc save_zp
ldx #$00
ldx #0
loop: lda $00,x
sta zp_buffer,x
dex
@ -858,7 +890,7 @@ loop: lda $00,x
.endproc
.proc restore_zp
ldx #$00
ldx #0
loop: lda zp_buffer,x
sta $00,x
dex

View File

@ -2,10 +2,9 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
.include "../inc/fp_macros.inc"
;;; ============================================================
@ -17,9 +16,9 @@ entry:
;;; Copy the DA to AUX for easy bank switching
.scope
lda ROMIN2
copy16 #$0800, STARTLO
copy16 #entry, STARTLO
copy16 #da_end, ENDLO
copy16 #$0800, DESTINATIONLO
copy16 #entry, DESTINATIONLO
sec ; main>aux
jsr AUXMOVE
lda LCBANK1
@ -27,17 +26,17 @@ entry:
.endscope
.scope
;; run the DA
;; Run the DA
sta RAMRDON
sta RAMWRTON
jsr init
;; tear down/exit
;; TODO: Should be unnecessary:
sta ALTZPON
lda LCBANK1
lda LCBANK1
;; back to main for exit
;; Back to main for exit
sta RAMRDOFF
sta RAMWRTOFF
rts
@ -45,26 +44,21 @@ entry:
;;; ============================================================
screen_width := 560
screen_height := 192
da_window_id := 60
da_width := screen_width / 3
da_height := screen_height / 3
da_left := (screen_width - da_width)/2
da_top := 50
da_window_id = 60
da_width = screen_width / 3
da_height = screen_height / 3
da_left = (screen_width - da_width)/2
da_top = 50
str_title:
PASCAL_STRING "Eyes"
;;; TODO: Allow resizing
.proc winfo
window_id: .byte da_window_id
options: .byte MGTK::option_go_away_box
options: .byte MGTK::Option::go_away_box
title: .addr str_title
hscroll: .byte MGTK::scroll_option_none
vscroll: .byte MGTK::scroll_option_none
hscroll: .byte MGTK::Scroll::option_none
vscroll: .byte MGTK::Scroll::option_none
hthumbmax: .byte 32
hthumbpos: .byte 0
vthumbmax: .byte 32
@ -96,10 +90,10 @@ nextwinfo: .addr 0
.proc event_params
kind: .byte 0
;;; event_kind_key_down
;;; EventKind::key_down
key := *
modifiers := * + 1
;;; event_kind_update
;;; EventKind::update
window_id := *
;;; otherwise
xcoord := *
@ -162,8 +156,8 @@ textback: .byte 0
textfont: .addr 0
.endproc
grow_box_width := 17
grow_box_height := 7
grow_box_width = 17
grow_box_height = 7
.proc grow_box_params
viewloc: DEFINE_POINT 0, 0, viewloc
@ -193,8 +187,6 @@ grow_box_bitmap:
lda LCBANK1
lda LCBANK1
;; Don't let MGTK smash zero page
MGTK_CALL MGTK::SetZP1, preserve_zp_params
lda #0
sta SHIFT_SIGN_EXT ; Must zero before using FP ops
@ -208,19 +200,18 @@ grow_box_bitmap:
MGTK_CALL MGTK::GetEvent, event_params
bne exit
lda event_params::kind
cmp #MGTK::event_kind_button_down
cmp #MGTK::EventKind::button_down
beq handle_down
cmp #MGTK::event_kind_key_down
cmp #MGTK::EventKind::key_down
beq handle_key
cmp #MGTK::event_kind_no_event
cmp #MGTK::EventKind::no_event
beq handle_no_event
jmp input_loop
.endproc
.proc exit
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
ITK_CALL IconTK::REDRAW_ICONS
rts
.endproc
@ -244,11 +235,11 @@ grow_box_bitmap:
cmp winfo::window_id
bne input_loop
lda findwindow_params::which_area
cmp #MGTK::area_close_box
cmp #MGTK::Area::close_box
beq handle_close
cmp #MGTK::area_dragbar
cmp #MGTK::Area::dragbar
beq handle_drag
cmp #MGTK::area_content
cmp #MGTK::Area::content
bne :+
jmp handle_grow
: jmp input_loop
@ -320,7 +311,7 @@ common: lda dragwindow_params::moved
jsr draw_window
;; Draw DeskTop icons
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
: jmp input_loop
@ -357,10 +348,10 @@ tmpw: .word 0
penxor: .byte MGTK::penXOR
notpencopy: .byte MGTK::notpencopy
penw := 8
penh := 4
pupilw := penw * 2
pupilh := penh * 2
penw = 8
penh = 4
pupilw = penw * 2
pupilh = penh * 2
.proc outline_pensize
penwidth: .byte penw
@ -389,7 +380,7 @@ pos_r: DEFINE_POINT 0, 0, pos_r
.proc draw_window
;; Defer if content area is not visible
MGTK_CALL MGTK::GetWinPort, winport_params
cmp #MGTK::error_window_obscured
cmp #MGTK::Error::window_obscured
bne :+
rts
:
@ -403,9 +394,13 @@ pos_r: DEFINE_POINT 0, 0, pos_r
MGTK_CALL MGTK::HideCursor
copy16 winfo::maprect::x2, rx ; width / 4
inc16 rx
inc16 rx
lsr16 rx
lsr16 rx
copy16 winfo::maprect::y2, ry ; height / 2
inc16 ry
inc16 ry
lsr16 ry
lda has_drawn_outline
@ -596,7 +591,7 @@ cyf: DEFINE_FLOAT
;;; Inputs: cx, cy, rx, ry
.proc draw_outline
segments := 36
segments = 36
lda ROMIN2

890
desk.acc/key.caps.s Normal file
View File

@ -0,0 +1,890 @@
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
;;; ============================================================
.org $800
entry:
;;; Copy the DA to AUX for easy bank switching
.scope
lda ROMIN2
copy16 #$0800, STARTLO
copy16 #da_end, ENDLO
copy16 #$0800, DESTINATIONLO
sec ; main>aux
jsr AUXMOVE
lda LCBANK1
lda LCBANK1
.endscope
.scope
;; run the DA
sta RAMRDON
sta RAMWRTON
jsr init
;; tear down/exit
sta ALTZPON
lda LCBANK1
lda LCBANK1
sta RAMRDOFF
sta RAMWRTOFF
rts
.endscope
;;; ============================================================
key_width = 22
key_height = 15
da_window_id = 60
da_width = key_width * 31/2
da_height = key_height * 6
da_left = (screen_width - da_width)/2
da_top = 50
.proc winfo
window_id: .byte da_window_id
options: .byte MGTK::Option::go_away_box
title: .addr str_title
hscroll: .byte MGTK::Scroll::option_none
vscroll: .byte MGTK::Scroll::option_none
hthumbmax: .byte 32
hthumbpos: .byte 0
vthumbmax: .byte 32
vthumbpos: .byte 0
status: .byte 0
reserved: .byte 0
mincontwidth: .word da_width
mincontlength: .word da_height
maxcontwidth: .word da_width
maxcontlength: .word da_height
port:
viewloc: DEFINE_POINT da_left, da_top
mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth
maprect: DEFINE_RECT 0, 0, da_width, da_height
pattern: .res 8, $FF
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
penloc: DEFINE_POINT 0, 0
penwidth: .byte 2
penheight: .byte 1
penmode: .byte 0
textback: .byte $7F
textfont: .addr DEFAULT_FONT
nextwinfo: .addr 0
.endproc
str_title:
PASCAL_STRING "Key Caps"
background_pattern:
.byte %11011101
.byte %01110111
.byte %11011101
.byte %01110111
.byte %11011101
.byte %01110111
.byte %11011101
.byte %01110111
background_rect:
DEFINE_RECT 0, 0, da_width, da_height
penxor:
.byte MGTK::penXOR
pencopy:
.byte MGTK::pencopy
notpencopy:
.byte MGTK::notpencopy
;;; ============================================================
.proc event_params
kind: .byte 0
;;; EventKind::key_down
key := *
modifiers := * + 1
;;; EventKind::update
window_id := *
;;; otherwise
xcoord := *
ycoord := * + 2
.res 4
.endproc
.proc findwindow_params
mousex: .word 0
mousey: .word 0
which_area: .byte 0
window_id: .byte 0
.endproc
.proc trackgoaway_params
clicked: .byte 0
.endproc
.proc dragwindow_params
window_id: .byte 0
dragx: .word 0
dragy: .word 0
moved: .byte 0
.endproc
.proc winport_params
window_id: .byte da_window_id
port: .addr grafport
.endproc
.proc grafport
viewloc: DEFINE_POINT 0, 0
mapbits: .word 0
mapwidth: .word 0
cliprect: DEFINE_RECT 0, 0, 0, 0
pattern: .res 8, 0
colormasks: .byte 0, 0
penloc: DEFINE_POINT 0, 0
penwidth: .byte 0
penheight: .byte 0
penmode: .byte 0
textback: .byte 0
textfont: .addr 0
.endproc
.proc drawtext_params_char
.addr char_label
.byte 1
.endproc
char_label: .byte 0
;;; ============================================================
kb_left = key_width/2
kb_top = key_height/2
kb_right = kb_left + key_width * 29/2
left0 = kb_left + key_width
left1 = kb_left + key_width * 6/4
left2 = kb_left + key_width * 7/4
left3 = kb_left + key_width * 9/4
left4 = kb_left + key_width
row0 = kb_top
row1 = kb_top + 1 * key_height
row2 = kb_top + 2 * key_height
row3 = kb_top + 3 * key_height
row4 = kb_top + 4 * key_height
keys_bg_rect:
DEFINE_RECT kb_left, kb_top, kb_right, kb_top + key_height * 5
.macro KEY_RECT left, top, right, bottom
.if .paramcount = 0
DEFINE_RECT 0,0,0,0
.elseif .paramcount = 2
DEFINE_RECT left, top, left + key_width, top + key_height
.elseif .paramcount = 3
DEFINE_RECT left, top, right, top + key_height
.else
DEFINE_RECT left, top, right, bottom
.endif
.endmacro
key_locations:
kr00: KEY_RECT left0 + 1 * key_width, row0 ; Ctrl-@
kr01: KEY_RECT left2 + 0 * key_width, row2 ; Ctrl-A
kr02: KEY_RECT left3 + 4 * key_width, row3 ; Ctrl-B
kr03: KEY_RECT left3 + 2 * key_width, row3 ; Ctrl-C
kr04: KEY_RECT left2 + 2 * key_width, row2 ; Ctrl-D
kr05: KEY_RECT left1 + 2 * key_width, row1 ; Ctrl-E
kr06: KEY_RECT left2 + 3 * key_width, row2 ; Ctrl-F
kr07: KEY_RECT left2 + 4 * key_width, row2 ; Ctrl-G
kr08: KEY_RECT kb_right - key_width * 4, row4, kb_right - key_width * 3 ; Ctrl-H (left arrow)
kr09: KEY_RECT kb_left, row1, left1 ; Ctrl-I (tab)
kr0A: KEY_RECT kb_right - key_width * 2, row4, kb_right - key_width * 1 ; Ctrl-J (down arrow)
kr0B: KEY_RECT kb_right - key_width * 1, row4, kb_right - key_width * 0 ; Ctrl-K (up arrow)
kr0C: KEY_RECT left2 + 8 * key_width, row2 ; Ctrl-L
kr0D: KEY_RECT kb_right - key_width * 7/4 - 1, row2, kb_right ; Ctrl-M (return)
kr0E: KEY_RECT left3 + 5 * key_width, row3 ; Ctrl-N
kr0F: KEY_RECT left1 + 8 * key_width, row1 ; Ctrl-O
kr10: KEY_RECT left1 + 9 * key_width, row1 ; Ctrl-P
kr11: KEY_RECT left1 + 0 * key_width, row1 ; Ctrl-Q
kr12: KEY_RECT left1 + 3 * key_width, row1 ; Ctrl-R
kr13: KEY_RECT left2 + 1 * key_width, row2 ; Ctrl-S
kr14: KEY_RECT left1 + 4 * key_width, row1 ; Ctrl-T
kr15: KEY_RECT kb_right - key_width * 3, row4, kb_right - key_width * 2 ; Ctrl-U (right arrow)
kr16: KEY_RECT left3 + 3 * key_width, row3 ; Ctrl-V
kr17: KEY_RECT left1 + 1 * key_width, row1 ; Ctrl-W
kr18: KEY_RECT left3 + 1 * key_width, row3 ; Ctrl-X
kr19: KEY_RECT left1 + 5 * key_width, row1 ; Ctrl-Y
kr1A: KEY_RECT left3 + 0 * key_width, row3 ; Ctrl-Z
kr1B: KEY_RECT kb_left, row0, left0 ; Ctrl-[ (escape)
kr1C: KEY_RECT left1 + 12 * key_width, row1 ; Ctrl-\
kr1D: KEY_RECT left1 + 11 * key_width, row1 ; Ctrl-]
kr1E: KEY_RECT left0 + 5 * key_width, row0 ; Ctrl-^
kr1F: KEY_RECT left0 + 10 * key_width, row0 ; Ctrl-_
kr20: KEY_RECT kb_left + key_width * 4, row4, kb_right - key_width * 5 ; (space)
kr21: KEY_RECT left0 + 0 * key_width, row0 ; !
kr22: KEY_RECT left2 + 10 * key_width, row2 ; "
kr23: KEY_RECT left0 + 2 * key_width, row0 ; #
kr24: KEY_RECT left0 + 3 * key_width, row0 ; $
kr25: KEY_RECT left0 + 4 * key_width, row0 ; %
kr26: KEY_RECT left0 + 6 * key_width, row0 ; &
kr27: KEY_RECT left2 + 10 * key_width, row2 ; '
kr28: KEY_RECT left0 + 8 * key_width, row0 ; (
kr29: KEY_RECT left0 + 9 * key_width, row0 ; )
kr2A: KEY_RECT left0 + 7 * key_width, row0 ; *
kr2B: KEY_RECT left0 + 11 * key_width, row0 ; +
kr2C: KEY_RECT left3 + 7 * key_width, row3 ; ,
kr2D: KEY_RECT left0 + 10 * key_width, row0 ; -
kr2E: KEY_RECT left3 + 8 * key_width, row3 ; .
kr2F: KEY_RECT left3 + 9 * key_width, row3 ; /
kr30: KEY_RECT left0 + 9 * key_width, row0 ; 0
kr31: KEY_RECT left0 + 0 * key_width, row0 ; 1
kr32: KEY_RECT left0 + 1 * key_width, row0 ; 2
kr33: KEY_RECT left0 + 2 * key_width, row0 ; 3
kr34: KEY_RECT left0 + 3 * key_width, row0 ; 4
kr35: KEY_RECT left0 + 4 * key_width, row0 ; 5
kr36: KEY_RECT left0 + 5 * key_width, row0 ; 6
kr37: KEY_RECT left0 + 6 * key_width, row0 ; 7
kr38: KEY_RECT left0 + 7 * key_width, row0 ; 8
kr39: KEY_RECT left0 + 8 * key_width, row0 ; 9
kr3A: KEY_RECT left0 + 9 * key_width, row2 ; :
kr3B: KEY_RECT left2 + 9 * key_width, row2 ; ;
kr3C: KEY_RECT left3 + 7 * key_width, row3 ; <
kr3D: KEY_RECT left0 + 11 * key_width, row0 ; =
kr3E: KEY_RECT left3 + 8 * key_width, row3 ; >
kr3F: KEY_RECT left3 + 9 * key_width, row3 ; ?
kr40: KEY_RECT left0 + 1 * key_width, row0 ; @
kr41: KEY_RECT left2 + 0 * key_width, row2 ; A
kr42: KEY_RECT left3 + 4 * key_width, row3 ; B
kr43: KEY_RECT left3 + 2 * key_width, row3 ; C
kr44: KEY_RECT left2 + 2 * key_width, row2 ; D
kr45: KEY_RECT left1 + 2 * key_width, row1 ; E
kr46: KEY_RECT left2 + 3 * key_width, row2 ; F
kr47: KEY_RECT left2 + 4 * key_width, row2 ; G
kr48: KEY_RECT left2 + 5 * key_width, row2 ; H
kr49: KEY_RECT left1 + 7 * key_width, row1 ; I
kr4A: KEY_RECT left2 + 6 * key_width, row2 ; J
kr4B: KEY_RECT left2 + 7 * key_width, row2 ; K
kr4C: KEY_RECT left2 + 8 * key_width, row2 ; L
kr4D: KEY_RECT left3 + 6 * key_width, row3 ; M
kr4E: KEY_RECT left3 + 5 * key_width, row3 ; N
kr4F: KEY_RECT left1 + 8 * key_width, row1 ; O
kr50: KEY_RECT left1 + 9 * key_width, row1 ; P
kr51: KEY_RECT left1 + 0 * key_width, row1 ; Q
kr52: KEY_RECT left1 + 3 * key_width, row1 ; R
kr53: KEY_RECT left2 + 1 * key_width, row2 ; S
kr54: KEY_RECT left1 + 4 * key_width, row1 ; T
kr55: KEY_RECT left1 + 6 * key_width, row1 ; U
kr56: KEY_RECT left3 + 3 * key_width, row3 ; V
kr57: KEY_RECT left1 + 1 * key_width, row1 ; W
kr58: KEY_RECT left3 + 1 * key_width, row3 ; X
kr59: KEY_RECT left1 + 5 * key_width, row1 ; Y
kr5A: KEY_RECT left3 + 0 * key_width, row3 ; Z
kr5B: KEY_RECT left1 + 10 * key_width, row1 ; [
kr5C: KEY_RECT left1 + 12 * key_width, row1 ; \
kr5D: KEY_RECT left1 + 11 * key_width, row1 ; ]
kr5E: KEY_RECT left0 + 5 * key_width, row0 ; ^
kr5F: KEY_RECT left0 + 10 * key_width, row0 ; _
kr60: KEY_RECT left4 + 0 * key_width, row4 ; `
kr61: KEY_RECT left2 + 0 * key_width, row2 ; a
kr62: KEY_RECT left3 + 4 * key_width, row3 ; b
kr63: KEY_RECT left3 + 2 * key_width, row3 ; c
kr64: KEY_RECT left2 + 2 * key_width, row2 ; d
kr65: KEY_RECT left1 + 2 * key_width, row1 ; e
kr66: KEY_RECT left2 + 3 * key_width, row2 ; f
kr67: KEY_RECT left2 + 4 * key_width, row2 ; g
kr68: KEY_RECT left2 + 5 * key_width, row2 ; h
kr69: KEY_RECT left1 + 7 * key_width, row1 ; i
kr6A: KEY_RECT left2 + 6 * key_width, row2 ; j
kr6B: KEY_RECT left2 + 7 * key_width, row2 ; k
kr6C: KEY_RECT left2 + 8 * key_width, row2 ; l
kr6D: KEY_RECT left3 + 6 * key_width, row3 ; m
kr6E: KEY_RECT left3 + 5 * key_width, row3 ; n
kr6F: KEY_RECT left1 + 8 * key_width, row1 ; o
kr70: KEY_RECT left1 + 9 * key_width, row1 ; p
kr71: KEY_RECT left1 + 0 * key_width, row1 ; q
kr72: KEY_RECT left1 + 3 * key_width, row1 ; r
kr73: KEY_RECT left2 + 1 * key_width, row2 ; s
kr74: KEY_RECT left1 + 4 * key_width, row1 ; t
kr75: KEY_RECT left1 + 6 * key_width, row1 ; u
kr76: KEY_RECT left3 + 3 * key_width, row3 ; v
kr77: KEY_RECT left1 + 1 * key_width, row1 ; w
kr78: KEY_RECT left3 + 1 * key_width, row3 ; x
kr79: KEY_RECT left1 + 5 * key_width, row1 ; y
kr7A: KEY_RECT left3 + 0 * key_width, row3 ; z
kr7B: KEY_RECT left1 + 10 * key_width, row1 ; {
kr7C: KEY_RECT left1 + 12 * key_width, row1 ; |
kr7D: KEY_RECT left1 + 11 * key_width, row1 ; }
kr7E: KEY_RECT left4 + 0 * key_width, row4 ; ~
kr7F: KEY_RECT kb_right - key_width * 6/4, row0, kb_right ; (delete)
;; shift/plain
kmode_s = $80 ; shifted (symbols)/unshifted (letters) - don't draw
kmode_c = $80 ; unrepresented control - don't draw
kmode_p = 0 ; plain - draw
key_mode:
.byte kmode_c ; Ctrl-@
.byte kmode_c ; Ctrl-A
.byte kmode_c ; Ctrl-B
.byte kmode_c ; Ctrl-C
.byte kmode_c ; Ctrl-D
.byte kmode_c ; Ctrl-E
.byte kmode_c ; Ctrl-F
.byte kmode_c ; Ctrl-G
.byte kmode_p ; Ctrl-H (left arrow)
.byte kmode_p ; Ctrl-I (tab)
.byte kmode_p ; Ctrl-J (down arrow)
.byte kmode_p ; Ctrl-K (up arrow)
.byte kmode_c ; Ctrl-L
.byte kmode_p ; Ctrl-M (return)
.byte kmode_c ; Ctrl-N
.byte kmode_c ; Ctrl-O
.byte kmode_c ; Ctrl-P
.byte kmode_c ; Ctrl-Q
.byte kmode_c ; Ctrl-R
.byte kmode_c ; Ctrl-S
.byte kmode_c ; Ctrl-T
.byte kmode_p ; Ctrl-U (right arrow)
.byte kmode_c ; Ctrl-V
.byte kmode_c ; Ctrl-W
.byte kmode_c ; Ctrl-X
.byte kmode_c ; Ctrl-Y
.byte kmode_c ; Ctrl-Z
.byte kmode_p ; Ctrl-[ (escape)
.byte kmode_c ; Ctrl-\
.byte kmode_c ; Ctrl-]
.byte kmode_c ; Ctrl-^
.byte kmode_c ; Ctrl-_
.byte kmode_p ; (space)
.byte kmode_s ; !
.byte kmode_s ; "
.byte kmode_s ; #
.byte kmode_s ; $
.byte kmode_s ; %
.byte kmode_s ; &
.byte kmode_p ; '
.byte kmode_s ; (
.byte kmode_s ; )
.byte kmode_s ; *
.byte kmode_s ; +
.byte kmode_p ; ,
.byte kmode_p ; -
.byte kmode_p ; .
.byte kmode_p ; /
.byte kmode_p ; 0
.byte kmode_p ; 1
.byte kmode_p ; 2
.byte kmode_p ; 3
.byte kmode_p ; 4
.byte kmode_p ; 5
.byte kmode_p ; 6
.byte kmode_p ; 7
.byte kmode_p ; 8
.byte kmode_p ; 9
.byte kmode_s ; :
.byte kmode_p ; ;
.byte kmode_s ; <
.byte kmode_p ; =
.byte kmode_s ; >
.byte kmode_s ; ?
.byte kmode_s ; @
.byte kmode_p ; A
.byte kmode_p ; B
.byte kmode_p ; C
.byte kmode_p ; D
.byte kmode_p ; E
.byte kmode_p ; F
.byte kmode_p ; G
.byte kmode_p ; H
.byte kmode_p ; I
.byte kmode_p ; J
.byte kmode_p ; K
.byte kmode_p ; L
.byte kmode_p ; M
.byte kmode_p ; N
.byte kmode_p ; O
.byte kmode_p ; P
.byte kmode_p ; Q
.byte kmode_p ; R
.byte kmode_p ; S
.byte kmode_p ; T
.byte kmode_p ; U
.byte kmode_p ; V
.byte kmode_p ; W
.byte kmode_p ; X
.byte kmode_p ; Y
.byte kmode_p ; Z
.byte kmode_p ; [
.byte kmode_p ; \
.byte kmode_p ; ]
.byte kmode_s ; ^
.byte kmode_s ; _
.byte kmode_p ; `
.byte kmode_s ; a
.byte kmode_s ; b
.byte kmode_s ; c
.byte kmode_s ; d
.byte kmode_s ; e
.byte kmode_s ; f
.byte kmode_s ; g
.byte kmode_s ; h
.byte kmode_s ; i
.byte kmode_s ; j
.byte kmode_s ; k
.byte kmode_s ; l
.byte kmode_s ; m
.byte kmode_s ; n
.byte kmode_s ; o
.byte kmode_s ; p
.byte kmode_s ; q
.byte kmode_s ; r
.byte kmode_s ; s
.byte kmode_s ; t
.byte kmode_s ; u
.byte kmode_s ; v
.byte kmode_s ; w
.byte kmode_s ; x
.byte kmode_s ; y
.byte kmode_s ; z
.byte kmode_s ; {
.byte kmode_s ; |
.byte kmode_s ; }
.byte kmode_s ; ~
.byte kmode_p ; DEL (FIX)
rect_ctl: KEY_RECT kb_left, row2, left2
rect_shl: KEY_RECT kb_left, row3, left3
rect_cap: KEY_RECT kb_left, row4, left4
rect_gap: KEY_RECT kb_left + key_width * 2, row4
rect_oap: KEY_RECT kb_left + key_width * 3, row4
rect_sap: KEY_RECT kb_right - key_width * 5, row4, kb_right - key_width * 4
rect_shr: KEY_RECT kb_right - key_width * 9/4 - 1, row3, kb_right
label_relpos: DEFINE_POINT 8, 12
empty_rect: DEFINE_RECT 0, 0, 0, 0
;;; New keyboard locations on IIgs/IIc+
;;;
rect_new_oap: ; Open Apple
KEY_RECT kb_left + key_width * 2, row4, kb_left + key_width * 4
rect_new_sap: ; Solid Apple
KEY_RECT left4 + 0 * key_width, row4
rect_new_apos: ; Apostrophe/Tilde
KEY_RECT kb_left + key_width * 4, row4
rect_new_bshl: ; Backslash/Vertical Bar
KEY_RECT kb_right - key_width * 5, row4, kb_right - key_width * 4
rect_new_spc: ; Space
KEY_RECT kb_left + key_width * 5, row4, kb_right - key_width * 5
;;; Non-rectangular Return key handled by a Polygon:
;;;
;;; 1/7--2
;;; | |
;;; 5---6 |
;;; | |
;;; 4-------3
poly_new_ret:
.byte 7 ; vertex count
.byte 0 ; no more polys
DEFINE_POINT left1 + 12 * key_width, row1
DEFINE_POINT kb_right, row1
DEFINE_POINT kb_right, row3
DEFINE_POINT kb_right - key_width * 7/4 - 1, row3
DEFINE_POINT kb_right - key_width * 7/4 - 1, row2
DEFINE_POINT left1 + 12 * key_width, row2
DEFINE_POINT left1 + 12 * key_width, row1
poly_new_ret_inner:
.byte 7 ; vertex count
.byte 0 ; no more polys
DEFINE_POINT left1 + 12 * key_width + 4, row1 + 2
DEFINE_POINT kb_right - 3, row1 + 2
DEFINE_POINT kb_right - 3, row3 - 1
DEFINE_POINT kb_right - key_width * 7/4 - 1 + 4, row3 - 1
DEFINE_POINT kb_right - key_width * 7/4 - 1 + 4, row2 + 2
DEFINE_POINT left1 + 12 * key_width + 4, row2 + 2
DEFINE_POINT left1 + 12 * key_width + 4, row1 + 2
modern_layout_flag: ; high bit set if IIgs/IIc+
.byte 0
tmp_poly:
.res 2 + 7 * .sizeof(MGTK::Point), 0
tmp_rect:
DEFINE_RECT 0,0,0,0, tmp_rect
;;; ============================================================
.proc init
sta ALTZPON
lda LCBANK1
lda LCBANK1
jsr check_modern_layout
bcc continue
;; Swap in alternate layout
copy #$80, modern_layout_flag
COPY_STRUCT MGTK::Rect, empty_rect, rect_gap ; Gap is eliminated
COPY_STRUCT MGTK::Rect, rect_new_bshl, kr5C ; [\|] replaces Solid Apple
COPY_STRUCT MGTK::Rect, rect_new_bshl, kr7C
COPY_STRUCT MGTK::Rect, rect_new_apos, kr60 ; [`~] takes away from Space
COPY_STRUCT MGTK::Rect, rect_new_apos, kr7E
COPY_STRUCT MGTK::Rect, rect_new_spc, kr20 ; Space is smaller
COPY_STRUCT MGTK::Rect, rect_new_oap, rect_oap ; Open Apple moves
COPY_STRUCT MGTK::Rect, rect_new_sap, rect_sap ; Solid Apple (Option) moves
;; Return key handled separately
continue:
MGTK_CALL MGTK::OpenWindow, winfo
jsr draw_window
MGTK_CALL MGTK::FlushEvents
;; fall through
.endproc
.proc input_loop
MGTK_CALL MGTK::GetEvent, event_params
bne exit
lda event_params::kind
cmp #MGTK::EventKind::button_down ; was clicked?
bne :+
jmp handle_down
: cmp #MGTK::EventKind::key_down ; any key?
bne :+
jmp handle_key
: jmp input_loop
.endproc
.proc exit
MGTK_CALL MGTK::CloseWindow, winfo
ITK_CALL IconTK::REDRAW_ICONS
rts ; exits input loop
.endproc
;;; ============================================================
.proc handle_key
;; Apple-Q to quit
lda event_params::modifiers
beq start
lda event_params::key
cmp #'Q'
beq exit
start: lda KBD
and #$7F
sta last_char
jsr construct_key_poly
MGTK_CALL MGTK::GetWinPort, winport_params
cmp #MGTK::Error::window_obscured
beq done
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::SetPenMode, penxor
MGTK_CALL MGTK::PaintPoly, tmp_poly
: bit KBDSTRB
bpl :+
lda KBD
and #$7F
cmp last_char
beq :-
MGTK_CALL MGTK::PaintPoly, tmp_poly
jmp start
: MGTK_CALL MGTK::PaintPoly, tmp_poly
done: jmp input_loop
last_char:
.byte 0
return_flag:
.byte 0
.endproc
;;; ============================================================
.proc handle_down
copy16 event_params::xcoord, findwindow_params::mousex
copy16 event_params::ycoord, findwindow_params::mousey
MGTK_CALL MGTK::FindWindow, findwindow_params
bpl :+
jmp exit
: lda findwindow_params::window_id
cmp winfo::window_id
bpl :+
jmp input_loop
: lda findwindow_params::which_area
cmp #MGTK::Area::close_box
beq handle_close
cmp #MGTK::Area::dragbar
beq handle_drag
jmp input_loop
.endproc
;;; ============================================================
.proc handle_close
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
lda trackgoaway_params::clicked
bne :+
jmp input_loop
: jmp exit
.endproc
;;; ============================================================
.proc handle_drag
copy winfo::window_id, dragwindow_params::window_id
copy16 event_params::xcoord, dragwindow_params::dragx
copy16 event_params::ycoord, dragwindow_params::dragy
MGTK_CALL MGTK::DragWindow, dragwindow_params
lda dragwindow_params::moved
bpl :+
;; Draw DeskTop's windows
sta RAMRDOFF
sta RAMWRTOFF
jsr JUMP_TABLE_REDRAW_ALL
sta RAMRDON
sta RAMWRTON
;; Draw DA's window
jsr draw_window
;; Draw DeskTop icons
ITK_CALL IconTK::REDRAW_ICONS
: jmp input_loop
.endproc
;;; ============================================================
.proc draw_window
ptr := $06
MGTK_CALL MGTK::GetWinPort, winport_params
cmp #MGTK::Error::window_obscured
bne :+
rts
: MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::SetPenMode, pencopy
MGTK_CALL MGTK::SetPattern, background_pattern
MGTK_CALL MGTK::PaintRect, background_rect
MGTK_CALL MGTK::SetPenMode, pencopy
MGTK_CALL MGTK::SetPattern, winfo::pattern
MGTK_CALL MGTK::PaintRect, keys_bg_rect
MGTK_CALL MGTK::SetPattern, background_pattern
MGTK_CALL MGTK::PaintRect, rect_gap
MGTK_CALL MGTK::SetPattern, winfo::pattern
MGTK_CALL MGTK::SetPenMode, notpencopy
MGTK_CALL MGTK::FrameRect, rect_ctl
MGTK_CALL MGTK::FrameRect, rect_shl
MGTK_CALL MGTK::FrameRect, rect_cap
MGTK_CALL MGTK::FrameRect, rect_shr
MGTK_CALL MGTK::FrameRect, rect_oap
MGTK_CALL MGTK::FrameRect, rect_sap
copy #127, char
loop:
lda char
sta char_label
tax
ldy key_mode,x
bpl :+
jmp next
;; Compute address of key record
: sta ptr
copy #0, ptr+1
asl16 ptr ; * 8 = .sizeof(MGTK::Rect)
asl16 ptr
asl16 ptr
add16 ptr, #key_locations, ptr
ldy #.sizeof(MGTK::Rect)-1
: lda (ptr),y
sta tmp_rect,y
dey
bpl :-
MGTK_CALL MGTK::FrameRect, tmp_rect
lda char
cmp #' '
bcc next
cmp #CHAR_DELETE
bcs next
MGTK_CALL MGTK::MoveTo, tmp_rect
MGTK_CALL MGTK::Move, label_relpos
MGTK_CALL MGTK::DrawText, drawtext_params_char
next: dec char
lda char
bmi :+
jmp loop
:
bit modern_layout_flag
bpl :+
;; Modern layout's non-rectangular Return key
MGTK_CALL MGTK::SetPenMode, pencopy
MGTK_CALL MGTK::SetPattern, winfo::pattern
MGTK_CALL MGTK::PaintPoly, poly_new_ret
MGTK_CALL MGTK::SetPenMode, notpencopy
MGTK_CALL MGTK::FramePoly, poly_new_ret
: MGTK_CALL MGTK::ShowCursor
rts
char: .byte 0
.endproc
;;; ============================================================
;;; Returns Carry set if modern (IIgs/IIc+) layout should be used
.proc check_modern_layout
;; Button down? (Hack for testing)
lda BUTN0
ora BUTN1
bpl :+
sec
rts
:
;; Bank in ROM and do check
lda ROMIN2
jsr check
lda LCBANK1
lda LCBANK1
rts
;; --------------------------------------------------
;; Do the check (with ROM banked in)
;; Is IIgs?
check: sec
jsr ID_BYTE_FE1F ; Clears carry if IIgs
bcs :+ ; No, carry still set
sec ; Yes, is a IIgs
rts
;; Is IIc+?
: lda ID_BYTE_FBC0 ; $00 = IIc
bne done
lda ID_BYTE_FBBF ; $05 = IIc Plus
cmp #$05
bne done
sec ; Yes, is a IIc+
rts
done: clc ; No - older layout
rts
.endproc
;;; ============================================================
;;; Construct "inner" polygon for key in A.
;;; Output: tmp_poly is populated
.proc construct_key_poly
ptr := $06
cmp #CHAR_RETURN
bne normal
bit modern_layout_flag
bpl normal
;; Special key
COPY_BYTES 2 + 7 * .sizeof(MGTK::Point), poly_new_ret_inner, tmp_poly
rts
;; Rectangular key
normal:
;; Compute address of rect
sta ptr
copy #0, ptr+1
asl16 ptr ; * 8 = .sizeof(MGTK::Rect)
asl16 ptr
asl16 ptr
add16 ptr, #key_locations, ptr
ldy #.sizeof(MGTK::Rect)-1
: lda (ptr),y
sta tmp_rect,y
dey
bpl :-
copy #5, tmp_poly+0 ; # vertices
copy #0, tmp_poly+1 ; no more polys
add16 tmp_rect::x1, #4, tmp_poly+2 + (0 * .sizeof(MGTK::Point))
add16 tmp_rect::y1, #2, tmp_poly+2 + (0 * .sizeof(MGTK::Point))+2
sub16 tmp_rect::x2, #3, tmp_poly+2 + (1 * .sizeof(MGTK::Point))
add16 tmp_rect::y1, #2, tmp_poly+2 + (1 * .sizeof(MGTK::Point))+2
sub16 tmp_rect::x2, #3, tmp_poly+2 + (2 * .sizeof(MGTK::Point))
sub16 tmp_rect::y2, #1, tmp_poly+2 + (2 * .sizeof(MGTK::Point))+2
add16 tmp_rect::x1, #4, tmp_poly+2 + (3 * .sizeof(MGTK::Point))
sub16 tmp_rect::y2, #1, tmp_poly+2 + (3 * .sizeof(MGTK::Point))+2
add16 tmp_rect::x1, #4, tmp_poly+2 + (4 * .sizeof(MGTK::Point))
add16 tmp_rect::y1, #2, tmp_poly+2 + (4 * .sizeof(MGTK::Point))+2
rts
.endproc
da_end = *
.assert * < $1B00, error, "DA too big"
;; I/O Buffer starts at MAIN $1C00
;; ... but icon tables start at AUX $1B00

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,11 +2,11 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move, font
.include "../macros.inc"
;;; ============================================================
.org $800
@ -64,21 +64,17 @@ stash_stack: .byte 0
jmp create_window
.endproc
da_window_id := 51
da_window_id = 51
;;; ============================================================
;;; Redraw the screen (all windows) after a event_kind_drag
;;; Redraw the screen (all windows) after a EventKind::drag
.proc redraw_screen
dest := $20
;; copy following routine to $20 and call it
ldx #sizeof_routine
loop: lda routine,x
sta dest,x
dex
bpl loop
COPY_BYTES sizeof_routine+1, routine, dest
jsr dest
;; now check the window pos
@ -88,7 +84,7 @@ loop: lda routine,x
bit window_pos_flag
bmi skip
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
skip: lda #0
sta window_pos_flag
@ -102,14 +98,12 @@ skip: lda #0
sta RAMWRTON
rts
.endproc
sizeof_routine := * - routine
sizeof_routine = * - routine
.endproc
;;; ============================================================
;;; ???
screen_height := 192
window_pos_flag:
.byte 0 ; ???
@ -182,16 +176,16 @@ a_grafport: .addr setport_params
getwinport_params_window_id := getwinport_params::window_id
;; Puzzle piece row/columns
cw := 28
c1 := 5
c2 := c1 + cw
c3 := c2 + cw
c4 := c3 + cw
rh := 16
r1 := 3
r2 := r1 + rh
r3 := r2 + rh
r4 := r3 + rh
cw = 28
c1 = 5
c2 = c1 + cw
c3 = c2 + cw
c4 = c3 + cw
rh = 16
r1 = 3
r2 = r1 + rh
r3 = r2 + rh
r4 = r3 + rh
space_positions: ; left, top for all 16 holes
.word c1,r1
@ -585,17 +579,17 @@ setport_params:
.byte $00,$2F,$02,$B1,$00,$00,$01,$02
.byte $06
default_left := 220
default_top := 80
default_width := $79
default_height := $44
default_left = 220
default_top = 80
default_width = $79
default_height = $44
.proc winfo
window_id: .byte da_window_id
options: .byte MGTK::option_go_away_box
options: .byte MGTK::Option::go_away_box
title: .addr name
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hscroll:.byte MGTK::Scroll::option_none
vscroll:.byte MGTK::Scroll::option_none
hthumbmax: .byte 0
hthumbpos: .byte 0
vthumbmax: .byte 0
@ -702,13 +696,13 @@ ploop: lda position_table+1,y
.proc input_loop
MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind
cmp #MGTK::event_kind_button_down
cmp #MGTK::EventKind::button_down
bne :+
jsr on_click
jmp input_loop
;; key?
: cmp #MGTK::event_kind_key_down
: cmp #MGTK::EventKind::key_down
bne input_loop
jsr check_key
jmp input_loop
@ -724,28 +718,24 @@ on_click:
bail: rts
;; client area?
: cmp #MGTK::area_content
: cmp #MGTK::Area::content
bne :+
jsr find_click_piece
bcc bail
jmp process_click
;; close port?
: cmp #MGTK::area_close_box
: cmp #MGTK::Area::close_box
bne check_title
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
lda trackgoaway_params::goaway
beq bail
destroy:
MGTK_CALL MGTK::CloseWindow, closewindow_params
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
target = $20 ; copy following to ZP and run it
ldx #sizeof_routine
loop: lda routine,x
sta target,x
dex
bpl loop
COPY_BYTES sizeof_routine+1, routine, target
jmp target
.proc routine
@ -753,16 +743,16 @@ loop: lda routine,x
sta RAMWRTOFF
jmp exit_da
.endproc
sizeof_routine := * - routine
sizeof_routine = * - routine
;; title bar?
check_title:
cmp #MGTK::area_dragbar
cmp #MGTK::Area::dragbar
bne bail
lda #da_window_id
sta dragwindow_params::window_id
MGTK_CALL MGTK::DragWindow, dragwindow_params
ldx #$23
ldx #$23 ; ???
jsr redraw_screen
rts
@ -854,7 +844,7 @@ nope: clc
;;; ============================================================
;;; Process piece click
hole_piece := 12
hole_piece = 12
.proc process_click
@ -1085,8 +1075,8 @@ loop: tya
.proc play_sound
ldx #$80
loop1: lda #$58
loop2: ldy #$1B
loop1: lda #88
loop2: ldy #27
delay1: dey
bne delay1
bit SPKR

View File

@ -1,51 +0,0 @@
Apple II Desktop - Desk Accessories
===================================
Installation
------------
If using a physical Apple II with actual floppy disks, transfer the
DeskAccessories.po. file to a floppy using ADTPro. If using a floppy
emulator, copy the file to your storage medium.
1. Boot into Apple II Desktop.
2. Insert the disk with the desk accessories.
3. Drag the files into your A2.DESKTOP/DESK.ACC folder.
4. Reboot.
Tip: You can use the Sort Directory DA to order the files, which controls
the menu order:
* Open the A2.DESKTOP/DESK.ACC folder
* Hold Open-Apple and click on each file in the desired order
* Select Sort Directory from the Apple menu, and verify the order
* Restart
Source code can be found at: https://github.com/inexorabletash/a2d
Show Image File
---------------
In Apple II Desktop, select an image file. Unfortunately, these are
hard to identify in A2D; they appear as a binary file (icon is <01>)
and are usually either 17 (single hi-res) or 33 (double hi-res) blocks
- you can check View > By Name or use Special > Get Info... to see the
size.
Then select Show Image File from the Apple menu. The image should
appear. If garbage appears, it was probably not an image file. You can
move the mouse pointer while the image is displayed. Click the mouse
button or press Escape to return to the DeskTop.
This Apple
----------
Select this item from the Apple menu to see an overview of the model
of computer, the CPU, an estimate of RamWorks memory expansion (if
present), and what cards can be identified in each slot.
Eyes
----
Select this for a demo showing two eyes that follow the mouse cursor.
The window can be moved and resized.

View File

@ -3,53 +3,7 @@
# Run this from the desk.acc directory
set -e
function cecho {
case $1 in
red) tput setaf 1 ;;
green) tput setaf 2 ;;
yellow) tput setaf 3 ;;
esac
echo -e "$2"
tput sgr0
}
function do_make {
make $MAKE_FLAGS "$1" \
&& (cecho green "make $1 good") \
|| (tput blink ; cecho red "MAKE $1 BAD" ; return 1)
}
function verify {
diff "orig/$1.bin" "out/$1.built" \
&& (cecho green "diff $1 good" ) \
|| (tput blink ; cecho red "DIFF $1 BAD" ; return 1)
}
function stats {
echo "$(printf '%-20s' $1)""$(../res/stats.pl < $1)"
}
source "../res/util.sh"
#do_make clean
do_make all
# Verify original and output match
echo "Verifying diffs:"
verify "calculator"
verify "show.text.file"
verify "date"
verify "puzzle"
verify "sort.directory"
# Compute stats
echo "Stats:"
stats "calculator.s"
stats "show.text.file.s"
stats "date.s"
stats "puzzle.s"
stats "sort.directory.s"
# Mountable directory for Virtual ][
if [ -d mount ]; then
res/mount.sh
fi

View File

@ -1,31 +0,0 @@
#!/bin/bash
# Run this from the desk.acc directory
set -e
function cecho {
case $1 in
red) tput setaf 1 ;;
green) tput setaf 2 ;;
yellow) tput setaf 3 ;;
esac
echo -e "$2"
tput sgr0
}
function mount {
uppercase=$(echo "$1" | tr /a-z/ /A-Z/)
src="out/$1.built"
dst="mount/$uppercase.\$F1"
cp "$src" "$dst" \
&& xattr -wx prodos.AuxType '40 06' "$dst" \
&& (cecho green "mounted $dst" ) \
|| (cecho red "failed to mount $dst" ; return 1)
}
mkdir -p mount
echo "Copying files to mount/"
for file in $(cat TARGETS); do
mount "$file"
done

206
desk.acc/run.basic.here.s Normal file
View File

@ -0,0 +1,206 @@
;;; ============================================================
;;; RUN.BASIC.HERE - Desk Accessory
;;;
;;; Launches BASIC.SYSTEM with PREFIX set to the path of the
;;; current window. BYE will return to DeskTop. Looks for
;;; BASIC.SYSTEM up the directory tree from DeskTop itself.
;;; ============================================================
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
;;; ============================================================
.org $800
;;; ============================================================
jmp start
;;; ============================================================
bs_path: .res 65, 0
prefix_path: .res 65, 0
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, bs_path
DEFINE_OPEN_PARAMS open_params, bs_path, $C00
DEFINE_READ_PARAMS read_params, $2000, $BF00-$2000
DEFINE_CLOSE_PARAMS close_params
DEFINE_SET_PREFIX_PARAMS set_prefix_params, prefix_path
DEFINE_QUIT_PARAMS quit_params
;;; ============================================================
;; Early errors - show alert and return to DeskTop
fail: jsr JUMP_TABLE_ALERT_X
rts
start:
;; Get active window's path
jsr get_win_path
beq :+
lda #ERR_FILE_NOT_OPENABLE
bne fail
;; Find BASIC.SYSTEM
: jsr check_basic_system
beq :+
lda #ERR_BASIC_SYS_NOT_FOUND
bne fail
;; Restore system state: devices, /RAM, ROM/ZP banks.
: jsr JUMP_TABLE_RESTORE_SYS
;; Load BS
MLI_CALL OPEN, open_params
bcs quit
lda open_params::ref_num
sta read_params::ref_num
sta close_params::ref_num
MLI_CALL READ, read_params
bcs quit
MLI_CALL CLOSE, close_params
bcs quit
;; Set PREFIX. Do this last; see:
;; https://github.com/inexorabletash/a2d/issues/95
MLI_CALL SET_PREFIX, set_prefix_params
bcs quit
;; Launch
jmp $2000
;; Late errors - QUIT, which should relaunch DeskTop
quit: MLI_CALL QUIT, quit_params
;;; ============================================================
DEFINE_GET_PREFIX_PARAMS get_prefix_params, bs_path
.proc check_basic_system
;; Was DeskTop copied to a RAM Card?
jsr get_copied_to_ramcard_flag
bpl get_current_prefix ; nope
;; Use original location, since BASIC.SYSTEM was unlikely
;; to be copied.
addr_call copy_desktop_orig_prefix, bs_path
jmp got_prefix
get_current_prefix:
yax_call JUMP_TABLE_MLI, GET_PREFIX, get_prefix_params
bne no_bs
got_prefix:
lda bs_path
sta path_length
;; Append BASIC.SYSTEM to path and check for file.
loop: ldx path_length
ldy #0
: inx
iny
copy str_basic_system,y, bs_path,x
cpy str_basic_system
bne :-
stx bs_path
yax_call JUMP_TABLE_MLI, GET_FILE_INFO, get_file_info_params
bne not_found
rts
;; Pop off a path segment and try again.
not_found:
ldx path_length
dex
: lda bs_path,x
cmp #'/'
beq found_slash
dex
bne :-
found_slash:
cpx #1
beq no_bs
stx path_length
jmp loop
no_bs: return #1
;; length of directory path e.g. "/VOL/DIR/"
path_length:
.byte 0
str_basic_system:
PASCAL_STRING "BASIC.SYSTEM"
.endproc
;;; ============================================================
.proc get_win_path
ptr := $06
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::FrontWindow, ptr
lda ptr ; any window open?
beq fail
cmp #9 ; windows are 1-8
bcs fail
asl a ; window index * 2
tay
copy16 path_table,y, ptr
ldy #0
lda (ptr),y
tay
: copy (ptr),y, prefix_path,y
dey
bpl :-
return #0
fail: return #1
.endproc
;;; ============================================================
.proc get_copied_to_ramcard_flag
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
lda copied_to_ramcard_flag
tax
sta ALTZPON
lda LCBANK1
lda LCBANK1
txa
rts
.endproc
.proc copy_desktop_orig_prefix
stax @destptr
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
ldx desktop_orig_prefix
: lda desktop_orig_prefix,x
@destptr := *+1
sta $1234,x
dex
bpl :-
sta ALTZPON
lda LCBANK1
lda LCBANK1
rts
.endproc

234
desk.acc/screen.dump.s Normal file
View File

@ -0,0 +1,234 @@
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
;;; ============================================================
.org $800
;;; ============================================================
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HideCursor, 0
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
jsr dump_screen
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::ShowCursor, 0
rts
;;; ============================================================
.proc dump_screen
SLOT1 := $C100
hbasl := $6
screen_width = 560
screen_height = 192
lda ROMIN2
jsr print_screen
lda LCBANK1
lda LCBANK1
rts
.proc send_spacing
ldy #0
: lda spacing_sequence,y
beq done
jsr cout
iny
jmp :-
done: rts
.endproc
.proc send_restore_state
ldy #$00
: lda restore_state,y
beq done
jsr cout
iny
jmp :-
done: rts
.endproc
.proc send_init_graphics
ldx #0
: lda init_graphics,x
jsr cout
inx
cpx #6
bne :-
rts
init_graphics:
.byte CHAR_ESCAPE,"G0560" ; Graphics, 560 data bytes
.endproc
.proc send_row
;; Tell printer to expect graphics
jsr send_init_graphics
ldy #0
sty col_num
lda #1
sta mask
lda #0
sta x_coord
sta x_coord+1
col_loop:
lda #8 ; 8 vertical pixels per row
sta count
lda y_row
sta y_coord
;; Accumulate 8 pixels
y_loop: lda y_coord
jsr compute_hbasl ; Row address in screen
lda col_num
lsr a ; Even or odd column?
tay
sta PAGE2OFF ; By default, read main mem $2000-$3FFF
bcs :+ ; But even columns come from aux, so...
sta PAGE2ON ; Read aux mem $2000-$3FFF
: lda (hbasl),y ; Grab the whole byte
and mask ; Isolate the pixel we care about
cmp #1 ; Set carry if non-zero
ror accum ; And slide it into place
inc y_coord
dec count
bne y_loop
;; Send the 8 pixels to the printer.
lda accum ; Now output it
eor #$FF ; Invert pixels (screen vs. print)
sta PAGE2OFF ; Read main mem $2000-$3FFF
jsr cout ; And actually print
;; Done all pixels across?
lda x_coord
cmp #<(screen_width-1)
bne :+
lda x_coord+1
cmp #>(screen_width-1)
beq done
;; Next pixel to the right
: asl mask
bpl :+ ; Only 7 pixels per column
lda #1
sta mask
inc col_num
: inc x_coord
bne col_loop
inc x_coord+1
bne col_loop
done: sta PAGE2OFF ; Read main mem $2000-$3FFF
rts
.endproc
.proc print_screen
;; Init printer
jsr pr_num_1
jsr send_spacing
lda #0
sta y_row
;; Print a row (560x8), CR+LF
loop: jsr send_row
lda #CHAR_RETURN
jsr cout
lda #CHAR_DOWN
jsr cout
lda y_coord
sta y_row
cmp #screen_height
bcc loop
;; Finish up
lda #CHAR_RETURN
jsr cout
lda #CHAR_RETURN
jsr cout
jsr send_restore_state
rts
.endproc
;; Given y-coordinate in A, compute HBASL-equivalent
.proc compute_hbasl
pha
and #$C7
eor #$08
sta $07
and #$F0
lsr a
lsr a
lsr a
sta hbasl
pla
and #$38
asl a
asl a
eor hbasl
asl a
rol hbasl+1
asl a
rol hbasl+1
eor hbasl
sta hbasl
rts
.endproc
.proc pr_num_1
lda #>SLOT1
sta COUT_HOOK+1
lda #<SLOT1
sta COUT_HOOK
lda #(CHAR_RETURN | $80)
jsr invoke_slot1
rts
.endproc
.proc cout
jsr COUT
rts
.endproc
y_row: .byte 0 ; y-coordinate of row start (0, 8, ...)
x_coord:.word 0 ; x-coordinate of pixels being accumulated
y_coord:.byte 0 ; iterates y_row to y_row+7
mask: .byte 0 ; mask for pixel being processed
accum: .byte 0 ; accumulates pixels for output
count: .byte 0 ; 8...1 while a row is output
col_num:.byte 0 ; 0...79
.byte 0, 0
spacing_sequence:
.byte CHAR_ESCAPE,'e' ; 107 DPI (horizontal)
.byte CHAR_ESCAPE,"T16" ; distance between lines (16/144")
.byte CHAR_TAB,$4C,$20,$44,$8D ; ???
.byte CHAR_TAB,$5A,$8D ; ???
.byte 0
restore_state:
.byte CHAR_ESCAPE,'N' ; 80 DPI (horizontal)
.byte CHAR_ESCAPE,"T24" ; distance between lines (24/144")
.byte 0
invoke_slot1:
jmp SLOT1
.endproc ; dump_screen
;;; ============================================================

382
desk.acc/screen.saver.s Normal file
View File

@ -0,0 +1,382 @@
.setcpu "65C02"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../inc/macros.inc"
;;; ============================================================
.org $800
da_start:
jmp start
save_stack:.byte 0
.proc start
tsx
stx save_stack
;; Copy DA to AUX
copy16 #da_start, STARTLO
copy16 #da_start, DESTINATIONLO
copy16 #da_end, ENDLO
sec ; main>aux
jsr AUXMOVE
;; Transfer control to aux
sta RAMWRTON
sta RAMRDON
;; run the DA
jsr init
;; tear down/exit
sta RAMRDOFF
sta RAMWRTOFF
ldx save_stack
txs
rts
.endproc
;;; ============================================================
;;; Animation Resources
toaster_height = 32
toaster_width = 64
toaster_count = 4
xpos_table:
.word screen_width+toaster_width
.word screen_width+toaster_width+150
.word screen_width+toaster_width+300
.word screen_width+toaster_width+450
ypos_table:
.word AS_WORD(-toaster_height)
.word AS_WORD(-toaster_height)+160
.word AS_WORD(-toaster_height)+40
.word AS_WORD(-toaster_height)+99
frame_table:
.byte 0,1,2,3
;;; ============================================================
;;; Graphics Resources
da_window_id = 100
event_params: .tag MGTK::Event
.proc window_title
.byte 0 ; length
.endproc
.proc winfo
window_id: .byte da_window_id ; window identifier
options: .byte MGTK::Option::dialog_box
title: .addr window_title
hscroll: .byte MGTK::Scroll::option_none
vscroll: .byte MGTK::Scroll::option_none
hthumbmax: .byte 32
hthumbpos: .byte 0
vthumbmax: .byte 32
vthumbpos: .byte 0
status: .byte 0
reserved: .byte 0
mincontwidth: .word screen_width
mincontlength: .word screen_height
maxcontwidth: .word screen_width
maxcontlength: .word screen_height
.proc port
viewloc: DEFINE_POINT 0, 0
mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth
maprect: DEFINE_RECT 0, 0, screen_width, screen_height
.endproc
pattern: .res 8, 0
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
penloc: DEFINE_POINT 0, 0
penwidth: .byte 1
penheight: .byte 1
penmode: .byte MGTK::notpencopy
textback: .byte $7F
textfont: .addr DEFAULT_FONT
nextwinfo: .addr 0
.endproc
.proc paintbits_params
viewloc: DEFINE_POINT 0,0,viewloc
mapbits: .addr 0
mapwidth: .byte 10
reserved: .byte 0
maprect: DEFINE_RECT 0,0,toaster_width-1,toaster_height-1
.endproc
notpencopy: .byte MGTK::notpencopy
penXOR: .byte MGTK::penXOR
.proc getwinport_params
window_id: .byte da_window_id
.addr grafport
.endproc
grafport: .tag MGTK::GrafPort
;;; ============================================================
;;; DA Init
.proc init
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::OpenWindow, winfo
MGTK_CALL MGTK::SetPort, winfo::port
MGTK_CALL MGTK::InitPort, grafport
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::SetPenMode, notpencopy
MGTK_CALL MGTK::PaintRect, grafport + MGTK::GrafPort::maprect
MGTK_CALL MGTK::FlushEvents
.endproc
;;; ============================================================
;;; Main Input Loop
.proc input_loop
MGTK_CALL MGTK::GetEvent, event_params
lda event_params + MGTK::Event::kind
cmp #MGTK::EventKind::button_down ; was clicked?
beq exit
cmp #MGTK::EventKind::key_down ; any key?
beq exit
jsr animate
jmp input_loop
exit:
MGTK_CALL MGTK::DrawMenu
sta RAMWRTOFF
sta RAMRDOFF
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
sta RAMWRTON
sta RAMRDON
;; Force desktop redraw
MGTK_CALL MGTK::CloseWindow, winfo
ITK_CALL IconTK::REDRAW_ICONS
MGTK_CALL MGTK::ShowCursor
rts ; exits input loop
.endproc
;;; ============================================================
;;; Animate
.proc animate
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::SetPenMode, penXOR
;; For each toaster...
copy #toaster_count-1, index
loop:
;; Stash current toaster's values
ldx index
copy frame_table,x, frame
txa
asl
tax
copy16 xpos_table,x, xpos
copy16 ypos_table,x, ypos
;; Erase previous pos
copy16 xpos, paintbits_params::viewloc::xcoord
copy16 ypos, paintbits_params::viewloc::ycoord
lda frame
asl ; *2
tax
copy16 toaster_frames,x, paintbits_params::mapbits
MGTK_CALL MGTK::PaintBits, paintbits_params
;; Move
add16 ypos, #1, ypos
sub16 xpos, #4, xpos
;; Wrap Y
cmp16 ypos, #screen_height
bvc :+
eor #$80
: bmi :+
copy16 #AS_WORD(-toaster_height), ypos
:
;; Wrap X
cmp16 xpos, #AS_WORD(-toaster_width)
bvc :+
eor #$80
: bpl :+
copy16 #screen_width+toaster_width, xpos
:
;; Next frame
inc frame
lda frame
cmp #4 ; num frames
bne :+
copy #0, frame
:
;; Draw new pos
copy16 xpos, paintbits_params::viewloc::xcoord
copy16 ypos, paintbits_params::viewloc::ycoord
lda frame
asl ; *2
tax
copy16 toaster_frames,x, paintbits_params::mapbits
MGTK_CALL MGTK::PaintBits, paintbits_params
;; Store updated values
ldx index
copy frame, frame_table,x
txa
asl
tax
copy16 xpos, xpos_table,x
copy16 ypos, ypos_table,x
;; Next
dec index
bmi :+
jmp loop
: rts
index: .byte 0
xpos: .word 0
ypos: .word 0
frame: .byte 0
.endproc
;;; ============================================================
toaster_frames:
.addr toaster_bits1
.addr toaster_bits2
.addr toaster_bits3
.addr toaster_bits2
toaster_bits1:
.byte px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0011111),px(%1001100),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111110),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000011),px(%1100111),px(%1110011),px(%0000111),px(%1111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%1111111),px(%1001111),px(%1111111),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%1111001),px(%1111111),px(%0000000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%1111111),px(%1000000),px(%0000001),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%1111000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0111111),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1111111),px(%0000000),px(%0001111),px(%1100000),px(%0000000),px(%1111110),px(%0000000),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000001),px(%1111100),px(%0000000),px(%0111111),px(%0000001),px(%1111111),px(%1111111),px(%1000000)
.byte px(%0000111),px(%1000000),px(%0011111),px(%1000000),px(%0000111),px(%1111100),px(%1111111),px(%1110011),px(%0011000),px(%0000000)
.byte px(%0011110),px(%0000000),px(%1111000),px(%0000000),px(%1111111),px(%1110011),px(%1111001),px(%1111111),px(%1111111),px(%1000000)
.byte px(%0011111),px(%1110011),px(%1100000),px(%0001111),px(%1111111),px(%1001111),px(%1111111),px(%1001100),px(%1100000),px(%0000000)
.byte px(%1100001),px(%1111111),px(%0000000),px(%0111100),px(%1111111),px(%1001111),px(%1100111),px(%1111111),px(%1111110),px(%0000000)
.byte px(%1100000),px(%0001111),px(%1111001),px(%1110011),px(%1111110),px(%0111111),px(%1111110),px(%0110011),px(%0000000),px(%0000000)
.byte px(%1100111),px(%1000000),px(%1111111),px(%1001111),px(%1111110),px(%0111111),px(%0011111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100110),px(%0111100),px(%0000111),px(%1001111),px(%1111001),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%1100110),px(%0000011),px(%1100110),px(%0111111),px(%1111001),px(%1110011),px(%1111111),px(%1001100),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000011),px(%1100110),px(%0111111),px(%1100111),px(%1111111),px(%0000000),px(%0111100),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110011),px(%1100110),px(%0111111),px(%1100111),px(%1001111),px(%1111001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1100111),px(%1111100),px(%0000111),px(%1110000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1111110),px(%0001111),px(%1111110),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000011),px(%0000111),px(%1111111),px(%1100000),px(%0000011),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%1111111),px(%1111100),px(%0000000),px(%0001100),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0011110),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0011000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000011),px(%1100000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000110),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000110),px(%0000000),px(%0011111),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%0000110),px(%0001111),px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111111),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
toaster_bits2:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000111),px(%1111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0011111),px(%1110011),px(%1111111),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111001),px(%1111111),px(%0000000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000011),px(%1111111),px(%1000000),px(%0000001),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%1111000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0111111),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%0000000),px(%0001111),px(%1100000),px(%0000000),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000001),px(%1111100),px(%0000000),px(%0111111),px(%1111000),px(%0000011),px(%1100000),px(%0000000)
.byte px(%0000111),px(%1000000),px(%0011111),px(%1000000),px(%0000111),px(%1111111),px(%0000111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%0011110),px(%0000000),px(%1111000),px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0011111),px(%1110011),px(%1100000),px(%0001111),px(%1111111),px(%1111111),px(%0000000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100001),px(%1111111),px(%0000000),px(%0111100),px(%1111111),px(%1110000),px(%1111111),px(%1111111),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1001111),px(%1111110),px(%0111111),px(%1111111),px(%1000000)
.byte px(%1100111),px(%1000000),px(%1111111),px(%1001111),px(%1111110),px(%0111111),px(%1111111),px(%1110011),px(%0011000),px(%0000000)
.byte px(%1100110),px(%0111100),px(%0000111),px(%1001111),px(%1111001),px(%1111111),px(%1111001),px(%1111111),px(%1111111),px(%1000000)
.byte px(%1100110),px(%0000011),px(%1100110),px(%0111111),px(%1111001),px(%1111111),px(%1111111),px(%1001100),px(%0011110),px(%0000000)
.byte px(%1100000),px(%0000011),px(%1100110),px(%0111111),px(%1100111),px(%1111111),px(%1100111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110011),px(%1100110),px(%0111111),px(%1100111),px(%1001100),px(%1111110),px(%0110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1100111),px(%1111100),px(%0000000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1111110),px(%0001111),px(%1111110),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000011),px(%0000111),px(%1111111),px(%1100000),px(%0000011),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%1111111),px(%1111100),px(%0000000),px(%0001100),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0011110),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0011000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000011),px(%1100000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000110),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000110),px(%0000000),px(%0011111),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%0000110),px(%0001111),px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111111),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
toaster_bits3:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1111111),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000011),px(%1111111),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0111111),px(%1100000),px(%0000000),px(%0011111),px(%1110000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0011111),px(%1000000),px(%0000001),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000011),px(%1111000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0111111),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%0000000),px(%0001111),px(%1100000),px(%0000000),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000001),px(%1111100),px(%0000000),px(%0111111),px(%1111000),px(%0000011),px(%1100000),px(%0000000)
.byte px(%0000111),px(%1000000),px(%0011111),px(%1000000),px(%0000111),px(%1111111),px(%0000111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%0011110),px(%0000000),px(%1111000),px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0011111),px(%1110011),px(%1100000),px(%0001111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100001),px(%1111111),px(%0000000),px(%0111100),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1111111),px(%1111111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%1100111),px(%1000000),px(%1111111),px(%1001111),px(%1111111),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%1100110),px(%0111100),px(%0000111),px(%1001111),px(%1111110),px(%0001111),px(%1111111),px(%1000000),px(%1100000),px(%0000000)
.byte px(%1100110),px(%0000011),px(%1100110),px(%0111111),px(%1111001),px(%1110000),px(%0000000),px(%0001111),px(%0011110),px(%0000000)
.byte px(%1100000),px(%0000011),px(%1100110),px(%0111111),px(%1100111),px(%1111111),px(%0011110),px(%0111100),px(%1111001),px(%1000000)
.byte px(%1100000),px(%0110011),px(%1100110),px(%0111111),px(%1100111),px(%1111100),px(%1111001),px(%1110011),px(%1100111),px(%1000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1100111),px(%1111111),px(%1100111),px(%1001111),px(%0011110),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0001111),px(%1111001),px(%1111111),px(%1111111),px(%1111100),px(%1111110),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1111110),px(%0111111),px(%1111001),px(%1111111),px(%1111000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000011),px(%0000111),px(%1001111),px(%1111111),px(%1001111),px(%1111000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%1111111),px(%1110011),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%1111111),px(%1111111),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0011111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0011000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000011),px(%1100001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%0000110),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000110),px(%0000000),px(%0011111),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%0000110),px(%0001111),px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111111),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
;;; ============================================================
da_end:

View File

@ -3,17 +3,17 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
;;; ============================================================
.org $800
CHAR_MASK := $7F
CASE_MASK := $DF
dir_data_buffer := $0E00
dir_data_buffer_len = $0E00
;;; ============================================================
@ -39,9 +39,9 @@ start: tsx
bne :+
rts
: lda #$40
: lda #>(JUMP_TABLE_SELECT_WINDOW-1)
pha
lda #$0B
lda #<(JUMP_TABLE_SELECT_WINDOW-1)
pha
lda a:$0A
rts
@ -138,8 +138,8 @@ on_line_buffer:
.byte 0
io_buf := $1C00
buffer := $0E00
buffer_len := $0E00
buffer := dir_data_buffer
buffer_len = dir_data_buffer_len
DEFINE_OPEN_PARAMS open_params, path_buf, io_buf
DEFINE_READ_PARAMS read_params, buffer, buffer_len
@ -261,11 +261,7 @@ L09E7: jsr L0B16
and #STORAGE_TYPE_MASK
beq L09E7
ldy #SubdirectoryHeader::file_count
lda ($06),y
sta L0A95
iny
lda ($06),y
sta L0A95+1
copy16in ($06),y, L0A95
jsr L0AE8
lda unit_num
sta block_params::unit_num
@ -300,11 +296,7 @@ L0A4B: jsr L0B16
cmp #(ST_LINKED_DIRECTORY << 4)
bne L0A4B
ldy #$11
lda ($06),y
sta block_params::block_num
iny
lda ($06),y
sta block_params::block_num+1
copy16in ($06),y, block_params::block_num
jsr read_block
bne L0A8F
lda $07
@ -317,7 +309,7 @@ L0A4B: jsr L0B16
jsr write_block
jmp L0A4B
L0A8E: pla
L0A8E: pla ; WTF ???
L0A8F: jmp exit
dev_num:
@ -338,47 +330,50 @@ L0AAF: .byte 0
lda on_line_buffer
and #$0F
sta on_line_buffer
ldy #0
L0ABA: iny
loop: iny
lda on_line_buffer,y
and #CHAR_MASK
cmp #'a'
bcc L0AC6
bcc :+
and #CASE_MASK ; make upper-case
L0AC6: cmp path_buf+1,y
bne L0AE5
: cmp path_buf+1,y
bne fail
cpy on_line_buffer
bne L0ABA
bne loop
lda on_line_buffer
clc
adc #$01
cmp path_buf
beq L0AE2
beq success
lda path_buf+2,y
cmp #'/'
bne L0AE5
L0AE2: return #$00
bne fail
success:
return #$00
L0AE5: return #$FF
fail: return #$FF
.endproc
;;; ============================================================
.proc L0AE8
lda #$00
lda #0
sta L0B15
jsr L0B40
jsr L0B16
L0AF3: copy16 $06, $08
loop: copy16 $06, $08
jsr L0B16
bcs L0B0F
jsr L0B5E
bcc L0AF3
bcs done
jsr compare_file_entries
bcc loop
jsr swap_entries
lda #$FF
sta L0B15
bne L0AF3
L0B0F: lda L0B15
bne loop
done: lda L0B15
bne L0AE8
rts
@ -419,9 +414,9 @@ rtcs: sec
;;; ============================================================
L0B40: lda #$01
L0B40: lda #1
sta L0AAF
copy16 #$0E04, $06
copy16 #dir_data_buffer + 4, $06
rts
;;; ============================================================
@ -444,30 +439,33 @@ loop: lda (ptr1),y
.endproc
;;; ============================================================
;;; Compare file entries ($06, $08); order returned in carry.
.proc L0B5E
;;; Uses compare_selection_orders, compare_file_entry_names,
;;; and compare_entry_types_and_names as appropriate.
.proc compare_file_entries
ptr1 := $06
ptr2 := $08
ldy #0
lda (ptr1),y
and #STORAGE_TYPE_MASK ; Active file entry?
bne L0B69
bne :+
jmp rtcc
L0B69: lda (ptr2),y
: lda (ptr2),y
and #STORAGE_TYPE_MASK ; Active file entry?
bne L0B72
bne :+
jmp rtcs
L0B72: lda selected_file_count
beq L0B7F
: lda selected_file_count
beq :+
lda path_index
beq L0B7F
jmp L0BF5
beq :+
jmp compare_selection_orders
L0B7F:
ldax ptr2
: ldax ptr2
jsr check_system_file
bcc rtcc
@ -548,115 +546,122 @@ type: .byte 0
.endproc
;;; ============================================================
;;; Compare selection order of icons; order returned in carry.
;;; Handles either icon being not selected.
.proc compare_selection_orders
entry_ptr := $10
filename := $06
filename2 := $08
.proc L0BF5
ldx selected_file_count
L0BF8: dex
bmi L0C4A
loop: dex
bmi done1
;; Look up next icon, compare length.
lda selected_file_list,x
asl a
tay
add16 file_table,y, #9, $10
ldy #$00
lda ($10),y
add16 file_table,y, #IconEntry::len, entry_ptr
ldy #0
lda (entry_ptr),y
sec
sbc #$02
sta L0C24
inc16 $10
lda ($06),y
and #$0F
sbc #2 ; remove leading/trailing space
sta cmp_len
inc16 entry_ptr ; points at start of name
L0C24 := *+1
cmp #$0
bne L0BF8
sta L0C47
L0C2A: iny
lda ($10),y
and #CHAR_MASK
cmp #'a'
bcc L0C35
and #CASE_MASK ; make upper-case
L0C35: sta L0C43
lda ($06),y
and #CHAR_MASK
cmp #'a'
bcc L0C42
and #CASE_MASK ; make upper-case
L0C43 := *+1
L0C42: cmp #0
bne L0BF8
L0C47 := *+1
cpy #0
bne L0C2A
L0C4A: stx L0CBC
ldx selected_file_count
L0C50: dex
bmi L0CA2
lda selected_file_list,x
asl a
tay
add16 file_table,y, #9, $10
ldy #$00
lda ($10),y
sec
sbc #$02
sta L0C7C
inc16 $10
lda ($08),y
and #$0F
L0C7C := *+1
lda (filename),y
and #NAME_LENGTH_MASK
cmp_len := *+1
cmp #0
bne loop ; lengths don't match, so not a match
bne L0C50
sta L0C9F
L0C82: iny
lda ($10),y
;; Bytewise compare names.
sta cpy_len
next: iny ; skip leading space
lda (entry_ptr),y
and #CHAR_MASK
cmp #'a'
bcc L0C8D
and #CASE_MASK
L0C8D: sta L0C9B
lda ($08),y
bcc :+
and #CASE_MASK ; make upper-case
: sta cmp_char
lda (filename),y
and #CHAR_MASK
cmp #'a'
bcc L0C9A
and #CASE_MASK
L0C9B := *+1
L0C9A: cmp #0
bne L0C50
L0C9F := *+1
bcc :+
and #CASE_MASK ; make upper-case
cmp_char := *+1
: cmp #0
bne loop ; no match - try next icon
cpy_len := *+1
cpy #0
bne next
bne L0C82
L0CA2: stx L0CBD
lda L0CBC
and L0CBD
cmp #$FF
beq L0CBA
lda L0CBD
cmp L0CBC
beq L0CBA
rts
done1: stx match ; match, or $FF if none
ldx selected_file_count
loop2: dex
bmi done2
;; Look up next icon, compare length.
lda selected_file_list,x
asl a
tay
add16 file_table,y, #IconEntry::len, entry_ptr
ldy #0
lda (entry_ptr),y ; len
sec
sbc #2 ; remove leading/trailing space
sta cmp_len2
inc16 entry_ptr ; points at start of name
lda (filename2),y
and #NAME_LENGTH_MASK
cmp_len2 := *+1
cmp #0
bne loop2 ; lengths don't match, so not a match
;; Bytewise compare names.
sta cpy_len2
next2: iny
lda (entry_ptr),y
and #CHAR_MASK
cmp #'a'
bcc :+
and #CASE_MASK ; make upper-case
: sta cmp_char2
lda (filename2),y
and #CHAR_MASK
cmp #'a'
bcc :+
and #CASE_MASK ; make upper-case
cmp_char2 := *+1
: cmp #0
bne loop2 ; no match - try next icon
cpy_len2 := *+1
cpy #0
bne next2
done2: stx match2 ; match, or $FF if none
lda match
and match2
cmp #$FF ; if either didn't match
beq clear
lda match2
cmp match
beq clear ; if they're the same
rts ; otherwise carry is order
;; No match
sec
rts
L0CBA: clc
clear: clc
rts
L0CBC: .byte 0
L0CBD: .byte 0
match: .byte 0
match2: .byte 0
.endproc
;;; ============================================================

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,51 @@
;;; DeskTop Internals
;;; ============================================================
DA_LOAD_ADDRESS := $800
DA_MAX_SIZE := $1C00 - DA_LOAD_ADDRESS
;; I/O Buffer starts at MAIN $1C00
;; (but icon tables start at AUX $1B00)
screen_width = 560
screen_height = 192
;;; ============================================================
VERSION_MAJOR = 1
VERSION_MINOR = 2
.define VERSION_SUFFIX "-alpha8"
.define RELEASE_DATE "July 30, 2019"
DA_FILE_TYPE = $F1
DA_Aux_TYPE = $640 ; High bit set = don't show in Apple menu
APP_FILE_TYPE = $01 ; FT_SYS w/ ".SYSTEM" (FT_BAD mapped to FT_TYPELESS)
max_desk_acc_count = 12
INVOKER := $290 ; Invoke other programs
INVOKER_FILENAME := $280 ; File to invoke (PREFIX must be set)
;;; Desk Accessories are loaded in Main ($800-$1BFF) using
;;; an I/O buffer (Main $1C00-1FFF). DAs often copy themselves
;;; into Aux but can only use $800-$1AFF due to icon tables.
DA_LOAD_ADDRESS := $800 ; Loaded into Main
DA_IO_BUFFER := $1C00 ; ...through $1FFF
DA_MAX_SIZE = DA_IO_BUFFER - DA_LOAD_ADDRESS
;;; Scratch area (in Aux) used during modal operations:
;;; * Given to MGTK to save background when menus are shown
;;; * Used by DeskTop to save background when alert dialog shown
;;; * Used by DeskTop to store icon outline polygons during drag
SAVE_AREA_BUFFER := $800 ; through $1AFF
SAVE_AREA_SIZE = $1300
;;; Memory in Aux - $80 bytes for desktop and 8 windows. First byte is a
;;; count, up to 127 icon entries. $1F80-$1FFF is a map of used/free icon
;;; numbers.
WINDOW_ICON_TABLES := $1B00
;; Quit routine signature/data
copied_to_ramcard_flag := $D3FF
ramcard_prefix := $D3EE
desktop_orig_prefix := $D3AD
;;; ============================================================
;;; Direct Calls (from main memory)
@ -16,57 +57,80 @@ JUMP_TABLE_MAIN_LOOP := $4000 ; Enter DeskTop main loop
JUMP_TABLE_MGTK_RELAY := $4003 ; MGTK relay call (main>aux)
JUMP_TABLE_SIZE_STRING := $4006 ; Compose "nnn Blocks" string into internal buffer
JUMP_TABLE_DATE_STRING := $4009 ; Compose date string into internal buffer
JUMP_TABLE_0C := $400C ; ???
JUMP_TABLE_0F := $400F ; Auxload
JUMP_TABLE_SELECT_WINDOW:= $400C ; Select and refresh given window
JUMP_TABLE_AUXLOAD := $400F ; Auxload
JUMP_TABLE_EJECT := $4012 ; Eject command
JUMP_TABLE_REDRAW_ALL := $4015 ; Redraw all windows (e.g. after a drag) *
JUMP_TABLE_DESKTOP_RELAY:= $4018 ; DESKTOP relay call (main>aux)
JUMP_TABLE_ITK_RELAY := $4018 ; Icon ToolKit relay call (main>aux)
JUMP_TABLE_LOAD_OVL := $401B ; Load overlay routine
JUMP_TABLE_CLEAR_SEL := $401E ; Clear DeskTop selection *
JUMP_TABLE_MLI := $4021 ; ProDOS MLI call (Y=call, X,A=params addr) *
JUMP_TABLE_COPY_TO_BUF := $4024 ; Copy to buffer
JUMP_TABLE_COPY_FROM_BUF:= $4027 ; Copy from buffer
JUMP_TABLE_NOOP := $402A ; No-Op command (RTS)
JUMP_TABLE_2D := $402D ; ??? (Draw type/size/date in non-icon views?)
JUMP_TABLE_ALERT_0 := $4030 ; Show alert 0
JUMP_TABLE_ALERT_X := $4033 ; Show alert X
JUMP_TABLE_FILE_TYPE_STRING := $402D ; Compose file type string into internal buffer
JUMP_TABLE_ALERT_0 := $4030 ; Show alert (A=err code, default options)
JUMP_TABLE_ALERT_X := $4033 ; Show alert X (A=err code, X=options)
JUMP_TABLE_LAUNCH_FILE := $4036 ; Launch file
JUMP_TABLE_CUR_POINTER := $4039 ; Changes mouse cursor to pointer *
JUMP_TABLE_CUR_WATCH := $403C ; Changes mouse cursor to watch
JUMP_TABLE_RESTORE_OVL := $403F ; Restore from overlay routine
JUMP_TABLE_COLOR_MODE := $4042 ; Set DHR color mode (IIgs, AppleColor, Le Chat Mauve) *
JUMP_TABLE_MONO_MODE := $4045 ; Set DHR mono mode (IIgs, AppleColor, Le Chat Mauve) *
JUMP_TABLE_RESTORE_SYS := $4048 ; Exit DHR, restore devices and /RAM, bank in ROM and ZP. *
;;; ============================================================
;;; API Calls (from aux memory)
;;; Error codes used for alerts which are not ProDOS errors
ERR_DUPLICATE_VOL_NAME = $F9
ERR_FILE_NOT_OPENABLE = $FA
ERR_NAME_TOO_LONG = $FB
ERR_INSERT_SRC_DISK = $FC
ERR_INSERT_DST_DISK = $FD
ERR_BASIC_SYS_NOT_FOUND = $FE
;;; ============================================================
;;; Icon ToolKit Calls (from aux memory)
.scope IconTK
;;; * = Used by Desk Accessories
DESKTOP := $8E00
;; MLI-style call (jsr DEKSTOP ; .byte call ; .addr params)
;; Call from AUX (RAMRDON/RAMWRTON)
MLI := $8E00
;; MLI-style call (jsr IconTK::MLI ; .byte call ; .addr params)
;; Call from Aux (RAMRDON/RAMWRTON)
;; Implementation bounces to $93BC, uses jump table at $939E
ADD_ICON = $01 ; { .addr icondata }
HIGHLIGHT_ICON = $02 ; { .byte icon }
REDRAW_ICON = $03 ; { .byte icon }
REMOVE_ICON = $04 ; { .byte icon }
HIGHLIGHT_ALL = $05 ; { .byte window_id }
REMOVE_ALL = $06 ; { .byte window_id }
CLOSE_WINDOW = $07 ; { .byte window_id }
GET_HIGHLIGHTED = $08 ; { .res 20 }
FIND_ICON = $09 ; { .word mousex, .word mousey, .byte result }
DRAG_HIGHLIGHTED = $0A ; { .byte param }
; Input: specific icon being dragged
; Output: 0 = on desktop (no-op)
; hi bit clear: low bits are target icon
; hi bit set: low bits are target window
UNHIGHLIGHT_ICON = $0B ; { .addr iconentry }
REDRAW_ICONS = $0C ; Repaints desktop icons *
ICON_IN_RECT = $0D ; { .byte icon, rect bounds }
ERASE_ICON = $0E ; { .byte icon }
DT_ADD_ICON := $01 ; { .addr icondata }
DT_HIGHLIGHT_ICON := $02 ; { .byte icon }
DT_UNHIGHLIGHT_ICON := $03 ; { .byte icon }
;; $04 ???
;; $05 ???
;; $06 ???
DT_CLOSE_WINDOW := $07 ; { .byte window_id }
DT_FIND_ICON := $09 ; { .word mousex, .word mousey, .byte result }
;; $0A ???
;; $0B ???
DT_REDRAW_ICONS := $0C ; Repaints desktop icons *
DT_ICON_IN_RECT := $0D ; { .byte icon, rect bounds }
;;; `icon` is the icon number, i.e. first field in icon entry
;;; `icon_index` is the index in the icon table
.endscope ; IconTK
;;; Call a DESKTOP entry point:
;;; DESKTOP_CALL n - params is $0000
;;; DESKTOP_CALL n, params_addr
;;; DESKTOP_CALL m, params_addr, label - params_addr is labeled for modifying
;;; Call a IconTK entry point:
;;; ITK_CALL n - params is $0000
;;; ITK_CALL n, params_addr
;;; ITK_CALL m, params_addr, label - params_addr is labeled for modifying
.macro DESKTOP_CALL op, addr, label
jsr DESKTOP
.macro ITK_CALL op, addr, label
jsr IconTK::MLI
.byte op
.if .paramcount > 2
@ -85,7 +149,7 @@ label := *
;;; Relays from Main to Aux (params must be in ZP or LC)
MGTK_RELAY := $D000
DESKTOP_RELAY := $D040
ITK_RELAY := $D040
.macro MGTK_RELAY_CALL call, addr
.if .paramcount > 1
@ -95,15 +159,14 @@ DESKTOP_RELAY := $D040
.endif
.endmacro
.macro DESKTOP_RELAY_CALL call, addr
.macro ITK_RELAY_CALL call, addr
.if .paramcount > 1
yax_call DESKTOP_RELAY, (call), (addr)
yax_call ITK_RELAY, (call), (addr)
.else
yax_call DESKTOP_RELAY, (call), 0
yax_call ITK_RELAY, (call), 0
.endif
.endmacro
;;; ============================================================
;;; Internals - Windows (paths) and Icons (files)
@ -121,18 +184,20 @@ path_table := $DFB3 ; window address table
selected_file_list := $DF22 ; indexes of selected file (global, not w/in window, up to 127)
file_table := $DD9F ; file address table
last_menu_click_params := $E23D
;;; Icon (file/volume) entries - length 27 bytes, maximum of 127
;;; .byte icon icon index
;;; .byte ??
;;; .byte state $80 = highlighted, 0 = otherwise
;;; .byte type/window_id
;;; (bits 0-3 window_id)
;;; (bits 4,5,6)
;;; 000 = directory
;;; 001 = system
;;; 010 = binary
;;; 010 = binary (maybe runnable)
;;; 011 = basic
;;; 100 = (unused)
;;; 101 = text/generic
;;; 101 = data (text/generic/...)
;;; 110 = (unused)
;;; 111 = trash
;;; (bit 7 = open flag)
@ -142,28 +207,28 @@ file_table := $DD9F ; file address table
;;; .byte len (name length + 2)
;;; .res 17 name (name, with a space before and after)
icon_entry_offset_index := 0
icon_entry_offset_state := 1
icon_entry_offset_win_type := 2
icon_entry_offset_iconx := 3
icon_entry_offset_icony := 5
icon_entry_offset_iconbits := 7
icon_entry_offset_len := 9
icon_entry_offset_name := 10
icon_entry_name_bufsize := 17
icon_entry_size := 27
.struct IconEntry
id .byte ; 0
state .byte ; 1
win_type .byte ; 2
iconx .word ; 3
icony .word ; 5
iconbits .addr ; 7
len .byte ; 9
name .res 17 ; 10 (15 chars plus leading/trailing spaces)
.endstruct
max_icon_count := 127
max_icon_count = 127
icon_entry_open_mask := %10000000
icon_entry_type_mask := %01110000
icon_entry_winid_mask := %00001111
icon_entry_type_dir := %00000000
icon_entry_type_sys := %00010000
icon_entry_type_bin := %00100000
icon_entry_type_bas := %00110000
icon_entry_type_txt := %01010000
icon_entry_type_trash := %01110000
icon_entry_open_mask = %10000000
icon_entry_type_mask = %01110000
icon_entry_winid_mask = %00001111
icon_entry_type_dir = %00000000
icon_entry_type_system = %00010000
icon_entry_type_binary = %00100000
icon_entry_type_basic = %00110000
icon_entry_type_generic = %01010000
icon_entry_type_trash = %01110000
;;; ============================================================
;;; Internals - Default Font
@ -171,14 +236,6 @@ icon_entry_type_trash := %01110000
;;; Used by DAs for window definitions
DEFAULT_FONT := $8800
;;; Modified by Show Text File DA to toggle fixed width
font_flag := $8800 ; = $00 - if high bit set, glyphs are 2 bytes wide
font_last_char := $8801 ; = $7F - max glyph number (count is this + 1)
font_height := $8802 ; 9 pixels
font_width_table := $8803 ; width in pixels, indexed by ASCII code
font_glyphs := $8883 ; $80 glyphs, organized by row, 9 bytes per
;;; Control Character Glyphs
;;;
;;; Glyphs $00-$1F are useful symbols; some overlap with MouseText
@ -192,7 +249,7 @@ font_glyphs := $8883 ; $80 glyphs, organized by row, 9 bytes per
;;; $05 = pointer (MT:B) $15 = rarrow (MT:U)
;;; $06 = vbar (MT:_) $16 = tri
;;; $07 = hbar (MT:S) $17 = open circ
;;; $08 = larrow $18 = close (MT:])
;;; $08 = larrow (MT:H) $18 = close (MT:])
;;; $09 = left box $19 = gray odd (MT:W)
;;; $0A = darrow (MT:J) $1A = gray even (MT:V)
;;; $0B = uarrow (MT:K) $1B = solid circ
@ -201,13 +258,19 @@ font_glyphs := $8883 ; $80 glyphs, organized by row, 9 bytes per
;;; $0E = (C) $1E = solid apple (MT:@)
;;; $0F = (R) $1F = open apple (MT:A)
GLYPH_LARROW := $09
GLYPH_RARROW := $15
GLYPH_UARROW := $0B
GLYPH_DARROW := $0A
GLYPH_RETURN := $0D
GLYPH_OAPPLE := $1F
GLYPH_SAPPLE := $1E
GLYPH_FOLDERL = $01
GLYPH_FOLDERR = $02
GLYPH_SPC = $00
GLYPH_INSPT = $06
GLYPH_LARROW = $08
GLYPH_RARROW = $15
GLYPH_UARROW = $0B
GLYPH_DARROW = $0A
GLYPH_RETURN = $0D
GLYPH_OAPPLE = $1F
GLYPH_SAPPLE = $1E
;;; Menu (by default) uses:
;;; Solid Mod $1E
@ -215,3 +278,62 @@ GLYPH_SAPPLE := $1E
;;; Check $1D
;;; Control $01
;;; Inactive $7F
;;; ============================================================
;;; Internals - miscellaneous structures
.struct IconDefinition
;; First part is MGTK::MapInfo without leading viewloc
mapbits .addr ; address of bitmap bits
mapwidth .byte ; stride of bitmap bits
reserved .byte ; 0
maprect .tag MGTK::Rect ; x1,y1 must be 0,0
;; Next part is address of mask bits; must be same
;; dimensions as rect of icon.
maskbits .addr
.endstruct
.macro DEFICON mapbits, mapwidth, dx, dy, maskbits
;; First part is MGTK::MapInfo without leading viewloc
.addr mapbits
.byte mapwidth
.byte 0 ; reserved
.word 0, 0, dx, dy ; maprect
;; Next part is link to mask
.addr maskbits
.endmacro
.struct FileRecord
name .res 16
file_type .byte ; 16 $10
blocks .word ; 17 $11
creation_date .word ; 19 $13
creation_time .word ; 21 $15
modification_date .word ; 23 $17
modification_time .word ; 25 $19
access .byte ; 27 $1B
header_pointer .word ; 28 $1C
aux_type .word ; 30 $1E
.endstruct
;;; ============================================================
;;; Internals - Settings (modified by Control Panel)
DESKTOP2_SETTINGS_OFFSET = $A700
.scope DeskTop
.scope Settings
address := $FF80
length = $80
pattern := $FF80 ; .res 8
dblclick_speed := $FF88 ; .word
kDefaultDblClickSpeed = $12C
ip_blink_speed := $FF8A ; .byte
kDefaultIPBlinkSpeed = 60
.endscope
.endscope

29
desktop.system/Makefile Normal file
View File

@ -0,0 +1,29 @@
CC65 = ~/dev/cc65/bin
CAFLAGS = --target apple2enh --list-bytes 0
CCFLAGS = --config apple2-asm.cfg
OUTDIR = out
HEADERS = $(wildcard ../*.inc)
TARGETS = $(OUTDIR)/desktop.system.SYS
.PHONY: clean all
all: $(OUTDIR) $(TARGETS)
$(OUTDIR):
mkdir -p $(OUTDIR)
clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(TARGETS)
$(OUTDIR)/%.o: %.s $(HEADERS)
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
# System Files .SYS
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
xattr -wx prodos.AuxType '00 20' $@

14
desktop.system/README.md Normal file
View File

@ -0,0 +1,14 @@
# DeskTop diassembly notes - DESKTOP.SYSTEM
`desktop.system.s`
A short (8k) loader program. This is responsible for copying the rest
to a RAM card (if available), then invoking the main app. The second
half is used to "Down load", i.e. copy Selector entries to RAMCard on
first boot.
The file is present in the original distribution as `DESKTOP1` but is
renamed `DESKTOP.SYSTEM` in many disk images to be launched at boot.
The main app (`DESKTOP2`) is invoked by loading only the first segment,
which in turn loads the rest of the segments of the file.

View File

@ -5,7 +5,19 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
;;; ============================================================
;;; Locations in Main LC Bank 2 (past end of custom quit routines)
;; 16 bytes $D395-$D3A4 - set to $FF when entry is copied
;; ("down loaded") to RAM Card.
entry_copied_flags := $D395
;; Quit routine signature/data
copied_to_ramcard_flag := $D3FF ; $00 at start, $C0 mid copy, $80 done
ramcard_prefix := $D3EE
desktop_orig_prefix := $D3AD
;;; ============================================================
.proc copy_desktop_to_ramcard
@ -100,23 +112,26 @@ L23DF: .byte $00,$00,$00
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, buffer
.byte 0
;; Files/Directories to copy
str_f1: PASCAL_STRING "DESKTOP1"
str_f1: PASCAL_STRING "DESKTOP.SYSTEM"
str_f2: PASCAL_STRING "DESKTOP2"
str_f3: PASCAL_STRING "DESK.ACC"
str_f4: PASCAL_STRING "SELECTOR.LIST"
str_f5: PASCAL_STRING "SELECTOR"
str_f6: PASCAL_STRING "PRODOS"
str_f4: PASCAL_STRING "PREVIEW"
str_f5: PASCAL_STRING "SELECTOR.LIST"
str_f6: PASCAL_STRING "SELECTOR"
str_f7: PASCAL_STRING "PRODOS"
str_f8: PASCAL_STRING "Quit.tmp"
filename_table:
.addr str_f1,str_f2,str_f3,str_f4,str_f5,str_f6
.addr str_f1,str_f2,str_f3,str_f4,str_f5,str_f6,str_f7,str_f8
num_filenames = 8
str_copying_to_ramcard:
PASCAL_STRING "Copying Apple II DeskTop into RAMCard"
;; Jump target from filer launcher - why???
rts1: rts
str_tip_skip_copying:
PASCAL_STRING {"Tip: To skip copying to RAMCard, hold down ",15,27,65,24,14," when launching."}
;; Signature of block storage devices ($Cn0x)
sig_bytes:
@ -154,22 +169,19 @@ start: sta MIXCLR
cmp #$30
beq have128k
;; Relocate FILER launch routine to $300 and invoke
.scope
target := $300
length := $D0
ldy #length
: lda launch_filer,y
sta target,y
dey
cpy #$FF ; why not bpl ???
bne :-
jmp target
.endscope
;; If not 128k machine, just quit back to ProDOS
MLI_CALL QUIT, quit_params
DEFINE_QUIT_PARAMS quit_params
have128k:
lda #$00
;; Save original Quit routine and small loader
;; TODO: Assumes prefix is retained. Compose correct path.
jsr preserve_quit_code
;; (Original code from here on)
resume: lda #$00
sta SHADOW ; IIgs ???
lda DEVNUM ; Most recent device
@ -194,7 +206,7 @@ match: sta $D3AC
lda ROMIN2
ldx #0
jsr stx_lc_d3ff
jsr set_copied_to_ramcard_flag
;; Point $8 at $C100
lda #0
@ -277,13 +289,13 @@ found_slot:
bne :-
ldx #$C0
jsr stx_lc_d3ff
addr_call copy_to_lc2_b, path0
jsr set_copied_to_ramcard_flag
addr_call set_ramcard_prefix, path0
jsr check_desktop2_on_device
bcs :+
ldx #$80
jsr stx_lc_d3ff
jsr copy_2005_to_lc2_a
jsr set_copied_to_ramcard_flag
jsr copy_2005_to_desktop_orig_prefix
jmp fail
: lda BUTN1
@ -305,14 +317,16 @@ str_slash_desktop:
.byte ST_LINKED_DIRECTORY ; storage_type
.endproc
start_copy:
.proc start_copy
ptr := $06
jsr show_copying_screen
MLI_CALL GET_PREFIX, get_prefix_params
beq :+
jmp fail_copy
: dec buffer
ldx #$80
jsr stx_lc_d3ff
jsr set_copied_to_ramcard_flag
ldy buffer
: lda buffer,y
@ -348,30 +362,28 @@ file_loop:
lda filenum
asl a
tax
lda filename_table,x
sta $06
lda filename_table+1,x
sta $06+1
copy16 filename_table,x, ptr
ldy #0
lda ($06),y
lda (ptr),y
tay
: lda ($06),y
: lda (ptr),y
sta filename_buf,y
dey
bpl :-
jsr copy_file
inc filenum
lda filenum
cmp #$06
cmp #num_filenames
bne file_loop
jmp fail2
.endproc
fail2: lda copy_flag
beq :+
sta path0
MLI_CALL SET_PREFIX, set_prefix_params
: jsr write_desktop1
jsr copy_2005_to_lc2_a
jsr copy_2005_to_desktop_orig_prefix
lda #$00
sta RAMWORKS_BANK ; ???
@ -382,17 +394,19 @@ fail2: lda copy_flag
bpl :-
jmp copy_selector_entries_to_ramcard
.proc stx_lc_d3ff
;;; ============================================================
.proc set_copied_to_ramcard_flag
lda LCBANK2
lda LCBANK2
stx $D3FF
stx copied_to_ramcard_flag
lda ROMIN2
rts
.endproc
.proc copy_to_lc2_b
.proc set_ramcard_prefix
ptr := $6
target := $D3EE
target := ramcard_prefix
stax ptr
lda LCBANK2
@ -408,13 +422,14 @@ fail2: lda copy_flag
rts
.endproc
.proc copy_to_lc2_a
.proc set_desktop_orig_prefix
ptr := $6
target := $D3AD
target := desktop_orig_prefix
stax ptr
lda LCBANK2
lda LCBANK2
ldy #0
lda (ptr),y
tay
@ -422,10 +437,13 @@ fail2: lda copy_flag
sta target,y
dey
bpl :-
lda ROMIN2
rts
.endproc
;;; ============================================================
fail: lda #0
sta flag
jmp fail2
@ -548,12 +566,32 @@ done: dex
sta CV
jsr VTAB
ldy #0
loop: iny
: iny
lda str_copying_to_ramcard,y
ora #$80
jsr COUT
cpy str_copying_to_ramcard
bne loop
bne :-
;; Center string
lda #80
sec
sbc str_tip_skip_copying
clc
adc #4 ; 4 control characters (for MouseText)
lsr a ; / 2 to center
sta CH
lda #23
sta CV
jsr VTAB
ldy #0
: iny
lda str_tip_skip_copying,y
ora #$80
jsr COUT
cpy str_tip_skip_copying
bne :-
rts
.endproc
@ -573,7 +611,7 @@ loop: iny
loop: lda IN,y
cmp #$80|CHAR_RETURN
beq done
and #$7F
and #CHAR_MASK
sta buffer+1,y
iny
jmp loop
@ -624,7 +662,7 @@ done: rts
open_io_buffer := $A000
dir_buffer := $A400
dir_bufsize := BLOCK_SIZE
dir_bufsize = BLOCK_SIZE
entry_length_offset := $23
file_count_offset := $25
@ -848,7 +886,7 @@ str_desktop2:
DEFINE_OPEN_PARAMS open_params, str_desktop1_path, open_io_buffer
str_desktop1_path:
PASCAL_STRING "DeskTop/DESKTOP1"
PASCAL_STRING "DeskTop/DESKTOP.SYSTEM"
DEFINE_WRITE_PARAMS write_params, dt1_addr, dt1_size
DEFINE_CLOSE_PARAMS close_params
@ -866,8 +904,8 @@ start: MLI_CALL OPEN, open_params
;;; ============================================================
.proc copy_2005_to_lc2_a
addr_call copy_to_lc2_a, L2005
.proc copy_2005_to_desktop_orig_prefix
addr_call set_desktop_orig_prefix, L2005
rts
.endproc
@ -875,49 +913,9 @@ start: MLI_CALL OPEN, open_params
path0: .res 65, 0
;;; ============================================================
;;; Launch FILER - used if machine is not 128k
;;; Relocated to $300 before invoking
saved_org := *
.proc launch_filer
.org $300
sys_start := $2000
MLI_CALL OPEN, open_params
beq :+
jmp rts1
: lda open_params_ref_num
sta read_params_ref_num
MLI_CALL READ, read_params
beq :+
jmp rts1
: MLI_CALL CLOSE, close_params
beq :+
jmp rts1
: jmp sys_start
DEFINE_OPEN_PARAMS open_params, filename, $800
open_params_ref_num := open_params::ref_num
DEFINE_READ_PARAMS read_params, sys_start, MLI - sys_start
read_params_ref_num := read_params::ref_num
DEFINE_CLOSE_PARAMS close_params
filename:
PASCAL_STRING "FILER"
.endproc
.assert .sizeof(launch_filer) <= $D0, error, "Routine length exceeded"
;;; ============================================================
.org (saved_org + .sizeof(launch_filer))
filenum:
.byte 0 ; index of file being copied
@ -930,19 +928,19 @@ slot: .byte 0
DEFINE_WRITE_BLOCK_PARAMS write_block2_params, prodos_loader_blocks + 512, 1
write_block2_params_unit_num := write_block2_params::unit_num
PAD_TO $2C00
PAD_TO $2D00
;;; ============================================================
prodos_loader_blocks:
.assert * = $2C00, error, "Segment length mismatch"
.incbin "inc/pdload.dat"
.assert * = $2D00, error, "Segment length mismatch"
.incbin "../inc/pdload.dat"
.endproc ; copy_desktop_to_ramcard
;;; ============================================================
.assert * = $3000, error, "Segment length mismatch"
.assert * = $3100, error, "Segment length mismatch"
;;; SPECULATION: This copies Selector entries marked
;;; "Down load" / "At boot" to the RAMCard as well
@ -955,6 +953,7 @@ prodos_loader_blocks:
;; $ 2 - 24 * 16-byte data entries
;; $0 - label (length-prefixed, 15 bytes)
;; $F - active_flag (other flags, i.e. download on ... ?)
;; bit 6 = "down loaded" flag ???
;; $182 - 24 * 64-byte pathname
;; $782 - EOF
@ -968,7 +967,7 @@ prodos_loader_blocks:
jsr HOME
lda LCBANK2
lda LCBANK2
lda $D3FF ; ??? last byte of selector routine?
lda copied_to_ramcard_flag
pha
lda ROMIN2
pla
@ -979,7 +978,7 @@ prodos_loader_blocks:
lda LCBANK2
ldx #$17
lda #0
: sta $D395,x
: sta entry_copied_flags,x
dex
bpl :-
lda ROMIN2
@ -1010,7 +1009,7 @@ entry_loop:
lda LCBANK2
ldx entry_num
lda #$FF
sta $D395,x
sta entry_copied_flags,x
lda ROMIN2
next_entry:
@ -1049,7 +1048,7 @@ entry_loop2:
adc #8
tax
lda #$FF
sta $D395,x
sta entry_copied_flags,x
lda ROMIN2
next_entry2:
inc entry_num
@ -1296,7 +1295,7 @@ L346F: .byte 0
loop: lda IN,y
cmp #$80|CHAR_RETURN
beq done
and #$7F
and #CHAR_MASK
sta path2+1,y
iny
jmp loop
@ -1371,11 +1370,7 @@ is_dir: lda #$FF
jmp show_no_space_prompt
;; copy dates
: ldx #3
: lda get_file_info_params2::create_date,x
sta create_params::create_date,x
dex
bpl :-
: COPY_STRUCT DateTime, get_file_info_params2::create_date, create_params::create_date
;; create the file
lda create_params::storage_type
@ -1572,11 +1567,7 @@ finish: MLI_CALL CLOSE, close_dstdir_params
sta create_dir_params::access
;; Copy dates
ldx #3
: lda get_file_info_params2::create_date,x
sta create_dir_params::create_date,x
dex
bpl :-
COPY_STRUCT DateTime, get_file_info_params2::create_date, create_dir_params::create_date
;; Create it
lda create_dir_params::storage_type
@ -1721,11 +1712,7 @@ loop2: lda L320A,y
.proc get_file_info_and_copy
MLI_CALL GET_FILE_INFO, get_file_info_params2
bne fail
ldx #$0A
: lda get_file_info_params2::access,x
sta get_file_info_params3::access,x
dex
bpl :-
COPY_BYTES $B, get_file_info_params2::access, get_file_info_params3::access
rts
fail: pla
@ -1887,7 +1874,7 @@ read: sta read_params::ref_num
ldy L324A
: lda L324A,y
and #$7F
and #CHAR_MASK
cmp #'/'
beq L38D2
dey
@ -1896,7 +1883,7 @@ read: sta read_params::ref_num
L38D2: dey
sty L324A
L38D6: lda L324A,y
and #$7F
and #CHAR_MASK
cmp #'/'
beq :+
dey
@ -1914,8 +1901,8 @@ L38D6: lda L324A,y
lda LCBANK2
lda LCBANK2
ldy $D3EE
: lda $D3EE,y
ldy ramcard_prefix
: lda ramcard_prefix,y
sta L320A,y
dey
bpl :-
@ -2016,7 +2003,7 @@ str_not_completed:
sta KBDSTRB
loop: lda KBD
bpl loop
and #$7F
and #CHAR_MASK
sta KBDSTRB
cmp #'M'
beq monitor
@ -2046,15 +2033,15 @@ monitor:
stax ptr
ldy #0
lda (ptr),y
sta len
sta @len
beq done
loop: iny
: iny
lda ($06),y
ora #$80
jsr COUT
len := *+1
@len := *+1
cpy #0 ; self-modified
bne loop
bne :-
done: rts
.endproc
@ -2069,7 +2056,7 @@ done: rts
lda KBD
bpl wait_enter_escape
sta KBDSTRB
and #$7F
and #CHAR_MASK
cmp #CHAR_ESCAPE
beq done
cmp #CHAR_RETURN
@ -2088,12 +2075,82 @@ done: rts
.endproc ; copy_selector_entries_to_ramcard
.assert * = $3AD8, error, "Segment size mismatch"
;;; ============================================================
;;; Loaded at $1000 by DeskTop2 on Quit, and copies $1100-$13FF
;;; to Language Card Bank 2 $D100-$D3FF, to restore saved quit
;;; (selector/dispatch) handler, then does ProDOS QUIT.
str_quit_code: PASCAL_STRING "Quit.tmp"
PROC_AT quit_restore_proc, $1000
lda LCBANK2
lda LCBANK2
ldx #0
:
.repeat 3, i
lda $1100 + ($100 * i), x
sta SELECTOR + ($100 * i), x
.endrepeat
dex
bne :-
lda ROMIN2
MLI_CALL QUIT, quit_params
DEFINE_QUIT_PARAMS quit_params
PAD_TO $1100
END_PROC_AT
.assert .sizeof(quit_restore_proc) = $100, error, "Proc length mismatch"
.proc preserve_quit_code_impl
quit_code_io := $800
quit_code_addr := $1000
quit_code_size := $400
DEFINE_CREATE_PARAMS create_params, str_quit_code, ACCESS_DEFAULT, $F1
DEFINE_OPEN_PARAMS open_params, str_quit_code, quit_code_io
DEFINE_WRITE_PARAMS write_params, quit_code_addr, quit_code_size
DEFINE_CLOSE_PARAMS close_params
start: lda LCBANK2
lda LCBANK2
ldx #0
:
lda quit_restore_proc, x
sta $1000, x
.repeat 3, i
lda SELECTOR + ($100 * i), x
sta $1100 + ($100 * i), x
.endrepeat
dex
bne :-
lda ROMIN2
;; Create file (if needed)
copy16 DATELO, create_params::create_date
copy16 TIMELO, create_params::create_time
MLI_CALL CREATE, create_params
beq :+
cmp #ERR_DUPLICATE_FILENAME
bne done
;; Populate it
: MLI_CALL OPEN, open_params
lda open_params::ref_num
sta write_params::ref_num
sta close_params::ref_num
MLI_CALL WRITE, write_params
MLI_CALL CLOSE, close_params
done: rts
.endproc
preserve_quit_code := preserve_quit_code_impl::start
;;; ============================================================
;;; This is a chunk of BASIC.SYSTEM 1.1 !!
;;; (ends up in memory at $B0D8, file offset TBD)
.incbin "inc/bs.dat"
PAD_TO $4000
.assert * = $4000, error, "Segment size mismatch"

9
desktop.system/res/go.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# Run this from the desktop.system directory
set -e
source "../res/util.sh"
#do_make clean
do_make all

12
desktop/.gitignore vendored
View File

@ -1,12 +0,0 @@
# Build directory
out
# "Info" files guiding disassembly
*.info
# Directory mounted in Virtual ][ as a ProDOS volume
mount
# OS-specific files
.DS_Store

View File

@ -5,12 +5,11 @@ CCFLAGS = --config asm.cfg
OUTDIR = out
HEADERS = $(wildcard ../*.inc) $(wildcard ../inc/*.inc) $(wildcard *.inc)
HEADERS = $(wildcard ../*.inc) $(wildcard ../inc/*.inc) $(wildcard ../mgtk/*.inc) $(wildcard *.inc)
SEGMENTS = loader mgtk desktop invoker \
ovl1 ovl1a ovl1b ovl1c ovl2 ovl34567
SEGMENTS = loader mgtk desktop
TARGETS = $(patsubst %,$(OUTDIR)/%.built,$(SEGMENTS)) out/sys.SYS
TARGETS = $(OUTDIR)/DESKTOP2.built
.PHONY: clean all
all: $(OUTDIR) $(TARGETS)
@ -22,9 +21,12 @@ clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(OUTDIR)/*.built
rm -f $(OUTDIR)/*.sys
rm -f $(TARGETS)
$(OUTDIR)/ovl34567.o: ovl34567.s $(HEADERS) ovl3.s ovl4.s ovl5.s ovl6.s ovl7.s
$(OUTDIR)/mgtk.o: ../mgtk/mgtk.s $(HEADERS)
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
$(OUTDIR)/desktop.o: desktop.s $(HEADERS) desktop_* ovl*.s
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
$(OUTDIR)/%.o: %.s $(HEADERS)
@ -34,7 +36,6 @@ $(OUTDIR)/%.o: %.s $(HEADERS)
$(OUTDIR)/%.built: $(OUTDIR)/%.o asm.cfg
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
# System Files .SYS
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<
xattr -wx prodos.AuxType '00 20' $@
# DeskTop combined
$(OUTDIR)/DESKTOP2.built: $(patsubst %,$(OUTDIR)/%.built,$(SEGMENTS))
cat $(patsubst %,$(OUTDIR)/%.built,$(SEGMENTS)) > $@

View File

@ -1,17 +1,5 @@
# DeskTop diassembly notes
## DESKTOP.SYSTEM
`sys.s`
A short (8k) loader program. This is responsible for copying
the rest to a RAM card (if available), then invoking the main app.
NOTE: The second half may be used for "Down load", i.e. copy
Selector entries to RAMCard as well.
## DESKTOP2.$F1
# DeskTop diassembly notes - DESKTOP2.$F1
This is large - 111k. It includes a loader and the DeskTop app with
both main memory and aux memory segments, filling everything from
@ -20,25 +8,27 @@ more code segments swapped in dynamically.
The file is broken down into multiple segments:
* segment 0: load - A$2000-$257F, L$0580, B$000000 (`loader.s`; Loader)
* segment 1: aux - A$4000-$BFFF, L$8000, B$000580 (`mgtk.s`, `desktop.s`; MGTK, DeskTop)
* segment 2: auxlc - A$D000-$ECFF, L$1D00, B$008580 (`desktop.s`; DeskTop)
* segment 3: auxlc - A$FB00-$FFFF, L$0500, B$00A280 (`desktop.s`; DeskTop)
* segment 4: main - A$4000-$BEFF, L$7F00, B$00A780 (`desktop.s`; DeskTop)
* segment 5: main - A$0800-$0FFF, L$0800, B$012680 (`desktop.s`; Initializer)
* segment 6: main - A$0290-$03EF, L$0160, B$012E80 (`invoker.s`; Invoker)
* overlays dynamically loaded for these actions:
* disk copy - A$0800-$09FF, L$0200, B$012FE0 (`ovl1.s`)
* which loads - A$1800-$19FF, L$0200, B$0131E0 (`ovl1a.s`)
* which loads - A$D000-$F1FF, L$2200, B$0133E0 (`ovl1b.s`; overwrites the aux LC)
* and... - A$0800-$12FF, L$0B00, B$0155E0 (`ovl1c.s`)
* format/erase - A$0800-$1BFF, L$1400, B$0160E0 (`ovl2.s`)
* selector - A$9000-$9FFF, L$1000, B$0174E0 (`ovl3.s`)
* common - A$5000-$6FFF, L$2000, B$0184E0 (`ovl4.s`; used by selector, copy, delete)
* file copy - A$7000-$77FF, L$0800, B$01A4E0 (`ovl5.s`)
* file delete - A$7000-$77FF, L$0800, B$01ACE0 (`ovl6.s`)
* selector - A$7000-$77FF, L$0800, B$01B4E0 (`ovl7.s`)
* (EOF is $01BCE0)
| Purpose | File Offset | Bank | Address | Length | Sources |
|---------------|-------------|--------|--------------|--------|--------------------------------|
| Loader | B$000000 | Main | A$2000-$257F | L$0580 | `loader.s` |
| MGTK/DeskTop | B$000580 | Aux | A$4000-$BFFF | L$8000 | `mgtk.s`, `desktop_aux.s` |
| DeskTop | B$008580 | Aux LC | A$D000-$ECFF | L$1D00 | `desktop_lc.s`,`desktop_res.s` |
| DeskTop | B$00A280 | Aux LC | A$FB00-$FFFF | L$0500 | `desktop_res.s` |
| DeskTop | B$00A780 | Main | A$4000-$BEFF | L$7F00 | `desktop_main.s` |
| Initializer | B$012680 | Main | A$0800-$0FFF | L$0800 | `desktop_main.s` |
| Invoker | B$012E80 | Main | A$0290-$03EF | L$0160 | `invoker.s` |
| Disk Copy 1/4 | B$012FE0 | Main | A$0800-$09FF | L$0200 | `ovl1.s` |
| Disk Copy 2/4 | B$0131E0 | Main | A$1800-$19FF | L$0200 | `ovl1a.s` |
| Disk Copy 3/4 | B$0133E0 | Aux LC | A$D000-$F1FF | L$2200 | `ovl1b.s` |
| Disk Copy 4/4 | B$0155E0 | Main | A$0800-$12FF | L$0B00 | `ovl1c.s` |
| Format/Erase | B$0160E0 | Main | A$0800-$1BFF | L$1400 | `ovl2.s` |
| Selector 1/2 | B$0174E0 | Main | A$9000-$9FFF | L$1000 | `ovl3.s` |
| Common | B$0184E0 | Main | A$5000-$6FFF | L$2000 | `ovl4.s` |
| File Copy | B$01A4E0 | Main | A$7000-$77FF | L$0800 | `ovl5.s` |
| File Delete | B$01ACE0 | Main | A$7000-$77FF | L$0800 | `ovl6.s` |
| Selector 2/2 | B$01B4E0 | Main | A$7000-$77FF | L$0800 | `ovl7.s` |
(EOF is $01BCE0)
The DeskTop segments loaded into the Aux bank switched ("language
card") memory can be used from both main and aux, so contain relay
@ -63,7 +53,7 @@ moving them to the appropriate destination in aux/banked/main memory.
There's fourth chunk of code, which expects to live at $280 so it
can't co-exist with the Invoker; it may be temporary code, as there is
no sign that it is ever moved into place. It's also unclear how it
would be hooked in. The routine detects OA+CA+P and prints the DHR
would be hooked in. The routine detects OA+SA+P and prints the DHR
screen to an ImageWriter II printer attached to Slot 1. (This may have
been used to produce screenshots during development for manuals.)
@ -79,7 +69,7 @@ pathname passed at $2006 (see ProDOS TLM).
### Initializer
(in `desktop.s`)
(in `desktop_main.s`)
Loaded at $800-$FFF, this does one-time initialization of the
DeskTop. It is later overwritten when any desk accessories are
@ -89,7 +79,7 @@ run.
`mgtk.s`
Aux $4000-$851E is the [MouseGraphics ToolKit](../MGTK.md) - a
Aux $4000-$8580 is the [MouseGraphics ToolKit](../mgtk/MGTK.md) - a
GUI library used for the DeskTop application.
Since this resides in Aux memory, DeskTop spends most of its time
@ -99,27 +89,51 @@ data.
### "DeskTop" Application
`desktop.s`
`desktop.s` which includes in:
* `desktop_aux.s`
* `desktop_lc.s`
* `desktop_res.s`
* `desktop_main.s`
DeskTop application code is in the lower 48k of both Aux and Main:
* Aux $851F-$BFFF - sitting above the GUI library
* Main $4000-$BEFF
* Aux $8580-$BFFF - sitting above the GUI library (`desktop_aux.s`)
* Main $4000-$BEFF (`desktop_main.s`)
...and in the Aux language card area (accessible from both aux and
main code) are relays, buffers and resources:
* Aux $D000-$ECFF - relays and other aux/main helpers, resources (menus, strings, window)
* Aux $D000-$D1FF - main-to-aux relay calls
* Aux $D200-$ECFF - resources (menus, strings, window)
* Aux $ED00-$FAFF - hole for data buffer - entries for each icon on desktop/in windows
* Aux $FB00-$FFFF - more resources (file types, icons)
($C000-$CFFF is reserved for I/O, and main $BF page and language card is ProDOS)
Aux $1B00-$1F7F holds lists of icons, one for the desktop then one for up
to 8 windows. First byte is a count, up to 127 icon entries. Icon numbers
map indirectly into a table at $ED00 that holds the type, coordinates, etc.
Aux $1F80-$1FFF is a map of used/free icon numbers, as they are reassigned
as windows are opened and closed.
`desktop_res.s` defines these common resources. It is built as part of
`desktop.s`. Many additional resources needed for MGTK operations
exist in `desktop_aux.s` as well.
The DeskTop code in Aux primarily implements the actual desktop GUI,
drawing file icons in windows, volume icons on the desktop, handling
selection and dragging, and tracking icons in windows; this code is
implemented as a library with MLI-style calls. The code in Main
handles the bulk of the application logic.
When running, lower memory use includes:
* Main $800-$1BFF is used as scratch space for a variety of routines.
* Main $1C00-$1FFF is used as a 1k ProDOS I/O buffer.
* Aux $0800-$1AFF is a "save area"; used by MGTK to store the background
when menus are drawn so it can be restored without redrawing. The
save area is also used by DeskTop to save the background for alert
dialogs, and icon outlines when dragging.
* Aux $1B00-$1F7F holds lists of icons, one for the desktop then one for up
to 8 windows. First byte is a count, up to 127 icon entries. Icon numbers
map indirectly into a table at $ED00 that holds the type, coordinates, etc.
* Aux $1F80-$1FFF is a map of used/free icon numbers, as they are reassigned
as windows are opened and closed.
### Overlays
@ -127,93 +141,131 @@ as windows are opened and closed.
Interactive commands including disk copy/format/erase, file
copy/delete, and Selector add/edit/delete/run all dynamically load
main memory code overlays into one or more of: $800-$1BFF,
$5000-$6FFF, $7000-$77FF, and $9000-$9FFF. When complete, any original
code above $4000 is reloaded.
main memory code overlays. When complete, any original code above
$4000 is reloaded (unless a full restart is required.)
Several of the overlays also use a common file selector dialog overlay
`ovl4.s` ($5000-$6FFF).
#### Disk Copy Overlay
The Disk Copy command replaces large chunks of memory and is best
thought of as a separate application.
The first part (`ovl1.s`, $800-$9FF) loads into main memory the other
overlays, but in turn it loads a second short ($200-byte) overlay
(`ovl1a.s`, $1800-$19FF). This then loads a replacement for the
resources in the aux language card area (`ovl1b.s`, Aux LC
$D000-$F1FF) and another block of code in main memory (`ovl1c.s`, Main
$0800-$12FF). When exiting, the DeskTop is restarted from the
beginning.
#### Disk Format/Disk Erase
Simple overlay: `ovl2.s`, loaded into Main A$0800-$1BFF.
#### Selector - Delete Entry / Run Entry
Simple overlay: `ovl3.s` ($9000-$9FFF).
#### Selector - Add Entry / Edit Entry
Also uses `ovl3.s` ($9000-$9FFF) but additionally uses overlay
`ovl7.s` ($7000-$77FF) and the file selector dialog `ovl4.s`
($5000-$6FFF).
#### File Copy
Overlay `ovl5.s` ($7000-$77FF), uses file selector dialog `ovl4.s`
($5000-$6FFF).
#### File Delete
Overlay `ovl6.s` ($7000-$77FF), uses file selector dialog `ovl4.s`
($5000-$6FFF).
## Memory Map
```
Main Aux ROM
$FFFF +-------------+ +-------------+ +-------------+
| ProDOS | | DeskTop | | Monitor |
$F800 | | | Resources/ | +-------------+
| | | Buffers | | Applesoft |
| | | | | |
| | | | | |
| | | | | |
$D000 +-------------+ +-------------+ +-------------+ +-------------+
| I/O |
| |
$C000 +-------------+ +-------------+ +-------------+
| ProDOS GP | | DeskTop |
$BF00 +-------------+ | App Code |
| DeskTop | | |
| App Code | | |
| | | |
| | | |
| | | |
| | | |
$A000 | +------+ | |
| | Ovl | | |
| | | | |
| | | | |
$9000 | +------+ | |
| | | |
$8E00 | | | Entry Point |
| | | |
$8800 | | | Font |
| | | |
$851F | | +-------------+
| | | MGTK |
| | | |
| | | |
| | | |
$7800 | +------+ | |
| | Ovl | | |
$7000 | +------+ | |
| | Ovl | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
$5000 | +------+ | |
| | | |
| | | |
| | | |
| | | |
$4000 +-------------+ +-------------+
| Graphics | | Graphics |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
$2000 +-------------+ +-------------+
| Initializer | | Win/Icn Map |
$1B00 | & Desk Acc | +-------------+
| & Overlays | | Desk Acc & |
| | | Save Area |
| | | |
$0800 +-------------+ +-------------+
| Drawing | | Drawing |
| Temp Buffer | | Temp Buffer |
$0400 +-------------+ +-------------+
| Invoker | | |
$0300 +-------------+ +-------------+
| Input Buf | | Input Buf |
$0200 +-------------+ +-------------+
| Stack | | Stack |
$0100 +-------------+ +-------------+
| Zero Page | | Zero Page |
$0000 +-------------+ +-------------+
Main Aux ROM
$FFFF +-------------+ +-------------+ +-------------+
| ProDOS | | DeskTop | | Monitor |
$F800 | | | Resources/ | +-------------+
| | | Buffers | | Applesoft |
| |Bank2 | |Bank2 | |
$E000 | +----+ | +----+ | |
| | PD | | | xx | | |
$D000 +-------------+----+ +-------------+----+ +-------------+
| I/O |
| |
$C000 +-------------+ +-------------+ +-------------+
| ProDOS GP | | DeskTop |
$BF00 +-------------+ | App Code |
| DeskTop | | |
| App Code | | |
| | | |
| | | |
| | | |
| | | |
$A000 | +------+ | |
| | Ovl | | |
| | | | |
| | | | |
$9000 | +------+ | |
| | | |
$8E00 | | | Entry Point |
| | | |
$8800 | | | Font |
| | | |
$8580 | | +-------------+
| | | MGTK |
| | | |
| | | |
| | | |
$7800 | +------+ | |
| | Ovl | | |
$7000 | +------+ | |
| | Ovl | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
$5000 | +------+ | |
| | | |
| | | |
| | | |
| | | |
$4000 +-------------+ +-------------+
| Graphics | | Graphics |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
$2000 +-------------+ +-------------+
| Initializer | | Win/Icn Map |
$1B00 | & Desk Acc | +-------------+
| & Overlays | | Desk Acc & |
| | | Save Area |
| | | |
$0800 +-------------+ +-------------+
| Drawing | | Drawing |
| Temp Buffer | | Temp Buffer |
$0400 +-------------+ +-------------+
| Invoker | | |
$0300 +-------------+ +-------------+
| Input Buf | | Input Buf |
$0200 +-------------+ +-------------+
| Stack | | Stack |
$0100 +-------------+ +-------------+
| Zero Page | | Zero Page |
$0000 +-------------+ +-------------+
```
The Disk Copy command replaces large chunks of memory and is best
thought of as a separate application. When exiting, the DeskTop is
restarted from the beginning.
Memory use by the Disk Copy overlay is not shown.

File diff suppressed because it is too large Load Diff

4251
desktop/desktop_aux.s Normal file

File diff suppressed because it is too large Load Diff

346
desktop/desktop_lc.s Normal file
View File

@ -0,0 +1,346 @@
;;; ============================================================
;;; DeskTop - "Language Card" Segment
;;;
;;; Compiled as part of desktop.s
;;; ============================================================
;;; ============================================================
;;; Segment loaded into AUX $D000-$D1FF
;;; ============================================================
.org $D000
;;; Constants needed in both main and aux
menu_id_apple = 1
menu_id_file = 2
menu_id_view = 4
menu_id_special = 5
menu_id_startup = 8
menu_id_selector = 3
;;; Various routines callable from MAIN
;;; ============================================================
;;; MGTK call from main>aux, call in Y, params at (X,A)
.proc MGTKRelayImpl
.assert * = MGTK_RELAY, error, "Entry point mismatch"
sty addr-1
stax addr
sta RAMRDON
sta RAMWRTON
MGTK_CALL 0, 0, addr
sta RAMRDOFF
sta RAMWRTOFF
rts
.endproc
;;; ============================================================
;;; SET_POS with params at (X,A) followed by DRAW_TEXT call
.proc SetPosDrawText
stax addr
sta RAMRDON
sta RAMWRTON
MGTK_CALL MGTK::MoveTo, 0, addr
MGTK_RELAY_CALL MGTK::DrawText, text_buffer2
tay
sta RAMRDOFF
sta RAMWRTOFF
tya
rts
.endproc
;;; ============================================================
;;; IconTK call from main>aux, call in Y params at (X,A)
.proc ITKRelayImpl
.assert * = ITK_RELAY, error, "Entry point mismatch"
sty addr-1
stax addr
sta RAMRDON
sta RAMWRTON
ITK_CALL 0, 0, addr
tay
sta RAMRDOFF
sta RAMWRTOFF
tya
rts
.endproc
;;; ============================================================
;;; Used/Free icon map (Aux $1F80 - $1FFF)
free_icon_map := $1F80
;;; Find first available free icon in the map; if
;;; available, mark it and return index+1.
.proc AllocateIcon
sta RAMRDON
sta RAMWRTON
ldx #0
loop: lda free_icon_map,x
beq :+
inx
cpx #$7F
bne loop
rts
: inx
txa
dex
tay
lda #1
sta free_icon_map,x
sta RAMRDOFF
sta RAMWRTOFF
tya
rts
.endproc
;;; Mark the specified icon as free
.proc FreeIcon
tay
sta RAMRDON
sta RAMWRTON
dey
lda #0
sta free_icon_map,y
sta RAMRDOFF
sta RAMWRTOFF
rts
.endproc
;;; ============================================================
;;; Copy data to/from buffers (see cached_window_id / cached_window_icon_list / window_icon_count_table/2) ???
.proc XferWindowIconTable
ptr := $6
from:
lda #$80
bne :+ ; always
to:
lda #$00
: sta flag
jsr desktop_main_push_pointers
lda cached_window_id
asl a ; * 2
tax
copy16 window_icon_count_table,x, ptr
sta RAMRDON
sta RAMWRTON
bit flag
bpl set_length
;; assign length from cached_window_icon_list
lda cached_window_icon_count
ldy #0
sta (ptr),y
jmp set_copy_ptr
;; assign length to cached_window_icon_list
set_length:
ldy #0
lda (ptr),y
sta cached_window_icon_count
set_copy_ptr:
copy16 window_icon_list_table,x, ptr
bit flag
bmi copy_from
;; copy into cached_window_icon_list
ldy #0 ; flag clear...
: cpy cached_window_icon_count
beq done
lda (ptr),y
sta cached_window_icon_list,y
iny
jmp :-
;; copy from cached_window_icon_list
copy_from:
ldy #0
: cpy cached_window_icon_count
beq done
lda cached_window_icon_list,y
sta (ptr),y
iny
jmp :-
done: sta RAMRDOFF
sta RAMWRTOFF
jsr desktop_main_pop_pointers
rts
flag: .byte 0
rts ; ???
.endproc
StoreWindowIconTable := XferWindowIconTable::from
LoadWindowIconTable := XferWindowIconTable::to
.proc LoadActiveWindowIconTable
copy active_window_id, cached_window_id
jmp LoadWindowIconTable
.endproc
.proc LoadDesktopIconTable
copy #0, cached_window_id
jmp LoadWindowIconTable
.endproc
;;; ============================================================
;;; Assign active state to active_window_id window
.proc OverwriteWindowPort
src := $6
dst := $8
sta RAMRDON
sta RAMWRTON
MGTK_CALL MGTK::GetPort, src ; grab window state
lda active_window_id ; which desktop window?
asl a
tax
copy16 win_table,x, dst
lda dst
clc
adc #MGTK::Winfo::port
sta dst
bcc :+
inc dst+1
: ldy #.sizeof(MGTK::GrafPort)-1
loop: lda (src),y
sta (dst),y
dey
bpl loop
sta RAMRDOFF
sta RAMWRTOFF
rts
.endproc
;;; ============================================================
;;; From MAIN, load AUX (A,X) into A
.proc AuxLoad
stx op+2
sta op+1
sta RAMRDON
sta RAMWRTON
op: lda dummy1234
sta RAMRDOFF
sta RAMWRTOFF
rts
.endproc
;;; ============================================================
;;; From MAIN, show alert
;;; ...with prompt #0
.proc ShowAlert
ldx #$00
;; fall through
.endproc
;;; ... with prompt # in X
.proc ShowAlertOption
sta RAMRDON
sta RAMWRTON
jsr desktop_aux::show_alert_indirection
sta RAMRDOFF
sta RAMWRTOFF
rts
.endproc
;;; ============================================================
;;; Input: numbers in A,X, Y (all unsigned)
;;; Output: number in A,X (unsigned)
.proc Multiply_16_8_16
stax num1
sty num2
;; Accumulate directly into A,X
lda #0
tax
beq test
add: clc
adc num1
tay
txa
adc num1+1
tax
tya
loop: asl num1
rol num1+1
test: lsr num2
bcs add
bne loop
rts
num1: .word 0
num2: .byte 0
.endproc
;;; ============================================================
;;; Input: dividend in A,X, divisor in Y (all unsigned)
;;; Output: quotient in A,X (unsigned)
.proc Divide_16_8_16
result := dividend
stax dividend
sty divisor
lda #0
sta divisor+1
sta remainder
sta remainder+1
ldx #16
loop: asl dividend
rol dividend+1
rol remainder
rol remainder+1
lda remainder
sec
sbc divisor
tay
lda remainder+1
sbc divisor+1
bcc skip
sta remainder+1
sty remainder
inc result
skip: dex
bne loop
ldax dividend
rts
dividend:
.word 0
divisor:
.word 0
remainder:
.word 0
.endproc
;;; ============================================================
PAD_TO $D200

16429
desktop/desktop_main.s Normal file

File diff suppressed because it is too large Load Diff

1832
desktop/desktop_res.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
## `desktoplc.inc`
Header defining various resources in the language card area, used by
overlays.
TODO: Make the linker take care of this, use exports/imports instead.
## `pdload.dat`
ProDOS Loader blocks, used when formatting a disk.
## `bs.dat`
A chunk of BASIC.SYSTEM 1.1, inexplicably found padding out the end of
DESKTOP.SYSTEM.SYS.

Binary file not shown.

View File

@ -1,84 +0,0 @@
;;; ============================================================
;;; Re-used param space for events/queries
pencopy := $D200
penOR := $D201
penXOR := $D202
penBIC := $D203
notpencopy := $D204
notpenOR := $D205
notpenXOR := $D206
notpenBIC := $D207
event_params := $D208
event_kind := event_params + 0
;; if kind is key_down
event_key := event_params + 1
event_modifiers := event_params + 2
;; if kind is no_event, button_down/up, drag, or apple_key:
event_coords := event_params + 1
event_xcoord := event_params + 1
event_ycoord := event_params + 3
;; if kind is update:
event_window_id := event_params + 1
screentowindow_params := event_params
screentowindow_window_id := screentowindow_params + 0
screentowindow_screenx := screentowindow_params + 1
screentowindow_screeny := screentowindow_params + 3
screentowindow_windowx := screentowindow_params + 5
screentowindow_windowy := screentowindow_params + 7
.assert screentowindow_screenx = event_xcoord, error, "param mismatch"
.assert screentowindow_screeny = event_ycoord, error, "param mismatch"
findwindow_params := event_params + 1 ; offset to x/y overlap event_params x/y
findwindow_mousex := findwindow_params + 0
findwindow_mousey := findwindow_params + 2
findwindow_which_area := findwindow_params + 4
findwindow_window_id := findwindow_params + 5
.assert findwindow_mousex = event_xcoord, error, "param mismatch"
.assert findwindow_mousey = event_ycoord, error, "param mismatch"
findcontrol_params := event_params + 1 ; offset to x/y overlap event_params x/y
findcontrol_mousex := findcontrol_params + 0
findcontrol_mousey := findcontrol_params + 2
findcontrol_which_ctl := findcontrol_params + 4
findcontrol_which_part := findcontrol_params + 5
.assert findcontrol_mousex = event_xcoord, error, "param mismatch"
.assert findcontrol_mousey = event_ycoord, error, "param mismatch"
activatectl_params := event_params
activatectl_which_ctl := activatectl_params
activatectl_activate := activatectl_params + 1
trackthumb_params := event_params
trackthumb_which_ctl := trackthumb_params
trackthumb_mousex := trackthumb_params + 1
trackthumb_mousey := trackthumb_params + 3
trackthumb_thumbpos := trackthumb_params + 5
trackthumb_thumbmoved := trackthumb_params + 6
.assert trackthumb_mousex = event_xcoord, error, "param mismatch"
.assert trackthumb_mousey = event_ycoord, error, "param mismatch"
updatethumb_params := event_params
updatethumb_which_ctl := updatethumb_params
updatethumb_thumbpos := updatethumb_params + 1
updatethumb_stash := updatethumb_params + 5 ; not part of struct
;;; ============================================================
;;; Resources
winfo_alert_dialog := $D57D
winfo_entrydlg := $D5B7
winfo_entrydlg_file_picker := $D5F1
winfo_entry_picker := $D665
path_buf0 := $D402
path_buf1 := $D443
path_buf2 := $D484
grafport3 := $D239
dialog_rect1 := $DA9E
dialog_rect2 := $DAAA

View File

@ -1,9 +1,3 @@
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../macros.inc"
;;; ============================================================
;;; Segment loaded into MAIN $290-$3EF
@ -39,6 +33,7 @@ prefix_length:
bs_path:
PASCAL_STRING "BASIC.SYSTEM"
;; $EE = extended call signature for IIgs/GS/OS variation.
DEFINE_QUIT_PARAMS quit_params, $EE, FILENAME
;;; ============================================================
@ -177,5 +172,6 @@ update_bitmap:
exit: rts
;; Pad to $160 bytes
.res $160 - (* - start), 0
PAD_TO $3F0
.endproc ; invoker

View File

@ -3,7 +3,7 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
DESKTOP_INIT := $0800 ; init location
L7ECA := $7ECA ; ???
@ -187,7 +187,7 @@ prompt_for_system_disk:
wait: sta KBDSTRB
: lda KBD
bpl :-
and #$7F
and #CHAR_MASK
cmp #$0D ; Return
bne wait
jmp start
@ -265,21 +265,13 @@ start:
bpl :-
;; Open this system file
php
sei
MLI_CALL OPEN, open_params
plp
and #$FF ; ???
beq :+
brk ; crash
: lda open_params::ref_num
sta set_mark_params::ref_num
sta read_params::ref_num
php
sei
MLI_CALL SET_MARK, set_mark_params
plp
and #$FF ; ???
beq :+
brk ; crash
: lda #0
@ -290,11 +282,7 @@ loop: lda segment_num
bne continue
;; Close and invoke DeskTop init routine
php
sei
MLI_CALL CLOSE, close_params
plp
and #$FF ; ???
beq :+
brk ; crash
: jmp DESKTOP_INIT
@ -304,11 +292,7 @@ continue:
tax
copy16 segment_addr_table,x, read_params::data_buffer
copy16 segment_size_table,x, read_params::request_count
php
sei
MLI_CALL READ, read_params
plp
and #$FF ; ???
beq :+
brk ; crash
: ldx segment_num
@ -412,8 +396,7 @@ max_page:
.byte 0
.endproc
;; Padding
.res $2200 - *,0
PAD_TO $2200
.endproc ; install_segments
;;; ============================================================
@ -423,14 +406,10 @@ max_page:
.org $280
SLOT1 := $C100
TAB := $09
LF := $0A
CR := $0D
ESC := $1B
hbasl := $6
screen_width := 560
screen_height := 192
screen_width = 560
screen_height = 192
;; Test for OpenApple+SolidApple+P
pha
@ -485,7 +464,7 @@ done: rts
bne :-
rts
init_graphics:
.byte ESC,"G0560" ; Graphics, 560 data bytes
.byte CHAR_ESCAPE,"G0560" ; Graphics, 560 data bytes
.endproc
.proc send_row
@ -561,9 +540,9 @@ done: sta PAGE2OFF ; Read main mem $2000-$3FFF
;; Print a row (560x8), CR+LF
loop: jsr send_row
lda #CR
lda #CHAR_RETURN
jsr cout
lda #LF
lda #CHAR_DOWN
jsr cout
lda y_coord
@ -572,9 +551,9 @@ loop: jsr send_row
bcc loop
;; Finish up
lda #CR
lda #CHAR_RETURN
jsr cout
lda #CR
lda #CHAR_RETURN
jsr cout
jsr send_restore_state
sta ALTZPON
@ -613,7 +592,7 @@ loop: jsr send_row
sta COUT_HOOK+1
lda #<SLOT1
sta COUT_HOOK
lda #(CR | $80)
lda #(CHAR_RETURN | $80)
jsr invoke_slot1
rts
.endproc
@ -634,22 +613,21 @@ col_num:.byte 0 ; 0...79
.byte 0, 0
spacing_sequence:
.byte ESC,'e' ; 107 DPI (horizontal)
.byte ESC,"T16" ; distance between lines (16/144")
.byte TAB,$4C,$20,$44,$8D ; ???
.byte TAB,$5A,$8D ; ???
.byte CHAR_ESCAPE,'e' ; 107 DPI (horizontal)
.byte CHAR_ESCAPE,"T16" ; distance between lines (16/144")
.byte CHAR_TAB,$4C,$20,$44,$8D ; ???
.byte CHAR_TAB,$5A,$8D ; ???
.byte 0
restore_state:
.byte ESC,'N' ; 80 DPI (horizontal)
.byte ESC,"T24" ; distance between lines (24/144")
.byte CHAR_ESCAPE,'N' ; 80 DPI (horizontal)
.byte CHAR_ESCAPE,"T24" ; distance between lines (24/144")
.byte 0
invoke_slot1:
jmp SLOT1
;; Padding
.res $400 - *, 0
PAD_TO $400
.endproc ; dump_screen
.assert .sizeof(install_as_quit) + .sizeof(quit_routine) + .sizeof(install_segments) + .sizeof(dump_screen) = $580, error, "Size mismatch"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +0,0 @@
#!/bin/bash
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_loader skip=$(( 0x0)) count=$(( 0x580))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_mgtk skip=$(( 0x580)) count=$((0x451F))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_desktop skip=$(( 0x4A9F)) count=$((0xE3E1))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_invoker skip=$((0x12E80)) count=$(( 0x160))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl1 skip=$((0x12FE0)) count=$(( 0x200))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl1a skip=$((0x131E0)) count=$(( 0x200))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl1b skip=$((0x133E0)) count=$((0x2200))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl1c skip=$((0x155E0)) count=$(( 0xB00))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl2 skip=$((0x160E0)) count=$((0x1400))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl3 skip=$((0x174E0)) count=$((0x1000))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl4 skip=$((0x184E0)) count=$((0x2000))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl5 skip=$((0x1A4E0)) count=$(( 0x800))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl6 skip=$((0x1ACE0)) count=$(( 0x800))
dd if=DESKTOP2.\$F1 bs=1 of=DESKTOP2_ovl7 skip=$((0x1B4E0)) count=$(( 0x800))

View File

@ -1,295 +0,0 @@
;;; ============================================================
;;; This chunk of code is wedged in between MGTK and the font,
;;; $851F - $87FF. No references to it have yet been identified.
.byte $03
.addr $85E9
L8522: php
lda winfo7+MGTK::winfo_offset_port+5,x
sta $08+1
ldy #$14
ldx #$00
L852C: lda ($08),y
sta L8590,x
iny
inx
cpx #$04
bne L852C
ldy #$1C
ldx #$00
L853B: lda ($08),y
sta L8594,x
iny
inx
cpx #$04
bne L853B
ldy #$03
lda ($06),y
sec
sbc L8590
sta ($06),y
iny
lda ($06),y
sbc L8591
sta ($06),y
iny
lda ($06),y
sec
sbc L8592
sta ($06),y
iny
lda ($06),y
sbc L8593
sta ($06),y
ldy #$03
lda ($06),y
clc
adc L8594
sta ($06),y
iny
lda ($06),y
adc L8595
sta ($06),y
iny
lda ($06),y
clc
adc L8596
sta ($06),y
iny
lda ($06),y
adc L8597
sta ($06),y
jsr $83A5
rts
L8590: .byte $24
L8591: .byte $00
L8592: .byte $23
L8593: .byte $00
L8594: .byte $00
L8595: .byte $00
L8596: .byte $00
L8597: .byte $00
ldax #0
: sta $D409,x
sta $D401,x
sta $D40D
inx
cpx #$04
bne :-
lda #$0A
sta $D40D
sta $D40F
MGTK_RELAY_CALL MGTK::SetPort, $D401
rts
addr_call $6B17, $1A39
ldx $D5CA
txs
rts
addr_call $6B17, $1A56
ldx $D5CA
txs
rts
addr_call $6B17, $1A71
ldx $D5CA
txs
rts
L85E0: cmp #$27
bne :+
addr_call $6B17, $1B22
ldx $D5CA
txs
jmp L8625
: cmp #$45
bne :+
addr_call $6B17, $1B3B
ldx $D5CA
txs
jmp L8625
: cmp #$52
bne :+
addr_call $6B17, $1B5B
ldx $D5CA
txs
jmp L8625
: cmp #$57
bne L8625
addr_call $6B17, $1B7C
ldx $D5CA
txs
L8625: MGTK_RELAY_CALL MGTK::HiliteMenu, $D63F ; ???
rts
addr_call $6B17, $1B9C
ldx $D5CA
txs
MGTK_RELAY_CALL MGTK::HiliteMenu, $D63F ; ???
rts
addr_call $6B17, $1BBF
ldx $D5CA
txs
MGTK_RELAY_CALL MGTK::HiliteMenu, $D63F ; ???
rts
sta L8737
sty L8738
and #$F0
sta on_line_unit_num
sta ALTZPOFF
MLI_CALL ON_LINE, on_line_params
sta ALTZPON
beq L867B
L8672: pha
dec $EF8A ; ???
dec $EF88 ; ???
pla
rts
L867B: lda on_line_buffer
beq L8672
jsr $8388 ; into dynamically loaded code???
jsr DESKTOP_ALLOC_ICON ; AUX > MAIN call???
ldy L8738
sta $D464,y
asl a
tax
copy16 $F13A,x, $06
ldx #$00
ldy #$09
lda #' '
L869E: sta ($06),y
iny
inx
cpx #$12
bne L869E
ldy #$09
lda on_line_buffer
and #$0F
sta on_line_buffer
sta ($06),y
ldx #$00
ldy #$0B
L86B6: lda on_line_buffer+1,x
cmp #$41 ; convert to lowercase ???
bcc L86C4
cmp #$5F
bcs L86C4
clc
adc #$20
L86C4: sta ($06),y
iny
inx
cpx on_line_buffer
bne L86B6
ldy #9
lda ($06),y
clc
adc #2 ; increase length by 2 (spaces) ???
sta ($06),y
lda L8737 ; type?
and #$0F
cmp #$04
bne L86ED
ldy #icon_entry_offset_iconbits
lda #<$14B4 ; $14B4 ???
sta ($06),y
iny
lda #>$14B4
sta ($06),y
jmp L870A
L86ED: cmp #$0B
bne L86FF
ldy #icon_entry_offset_iconbits
lda #<$1470 ; $1470 ???
sta ($06),y
iny
lda #>$1470
sta ($06),y
jmp L870A
L86FF: ldy #icon_entry_offset_iconbits
lda #<$1440 ; $1440 ???
sta ($06),y
iny
lda #>$1440
sta ($06),y
L870A: ldy #icon_entry_offset_win_type
lda #0
sta ($06),y
inc L8738
lda L8738
asl a
asl a
tax
ldy #icon_entry_offset_iconx
: lda L8739,x
sta ($06),y
inx
iny
cpy #7
bne :-
ldx $EF8A
dex
ldy #0
lda ($06),y
sta $EF8B,x
jsr $83A5
return #0
L8737: .byte $60 ; file type ???
L8738: .byte $04
L8739: .byte $00,$00,$00,$00
L873D: DEFINE_POINT 500, 16
DEFINE_POINT 500, 41
DEFINE_POINT 500, 66
DEFINE_POINT 500, 91
DEFINE_POINT 500, 116
DEFINE_POINT 440, 16
DEFINE_POINT 440, 41
DEFINE_POINT 440, 66
DEFINE_POINT 440, 91
DEFINE_POINT 440, 116
DEFINE_POINT 440, 141
DEFINE_POINT 400, 16
DEFINE_POINT 400, 41
DEFINE_POINT 400, 66
DEFINE_ON_LINE_PARAMS on_line_params, $60, on_line_buffer ; Slot 6 Drive 1
on_line_unit_num := on_line_params::unit_num
;; Per ProDOS TRM this should be 256 bytes!
on_line_buffer:
.byte $0B
.byte "GRAPHICS.TK",$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$C8

View File

@ -1,18 +1,9 @@
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
;;; ============================================================
;;; Overlay for Disk Copy
;;; Overlay for Disk Copy - $0800 - $09FF (file 1/4)
;;; ============================================================
.org $800
.proc disk_copy_overlay
.org $800
jmp start
@ -31,7 +22,7 @@ menu: DEFINE_MENU 1
DEFINE_MENU_ITEM menu_target + (item_label - menu_bar)
menu_label:
PASCAL_STRING " Disk copy version 1.1 "
PASCAL_STRING .sprintf(" Disk copy version %d.%d ",::VERSION_MAJOR,::VERSION_MINOR)
item_label:
PASCAL_STRING "Rien"
.endproc
@ -52,16 +43,12 @@ str_desktop2:
start: lda #$80
sta ptr
DESKTOP_RELAY_CALL $6, $0
ITK_RELAY_CALL IconTK::REMOVE_ALL, 0 ; volume icons
MGTK_RELAY_CALL MGTK::CloseAll
MGTK_RELAY_CALL MGTK::SetZP1, ptr
;; Copy menu bar up to language card, and use it.
ldx #.sizeof(menu_bar)
: lda menu_bar,x
sta $D400,x
dex
bpl :-
COPY_BYTES .sizeof(menu_bar)+1, menu_bar, $D400
MGTK_RELAY_CALL MGTK::SetMenu, menu_target
;; Clear most of the system bitmap
@ -94,8 +81,6 @@ start: lda #$80
sty call
sta params
stx params+1
php
sei
sta ALTZPOFF
lda ROMIN2
jsr MLI
@ -105,7 +90,6 @@ params: .addr 0
sta ALTZPON
lda LCBANK1
lda LCBANK1
plp
txa
self: bne self ; hang on error?
rts
@ -114,4 +98,5 @@ self: bne self ; hang on error?
;;; ============================================================
PAD_TO $A00
.endproc ; disk_copy_overlay

View File

@ -1,33 +1,12 @@
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
;;; ============================================================
;;; Overlay for Disk Copy #2
;;; Overlay for Disk Copy - $1800 - $19FF (file 2/4)
;;; ============================================================
.org $1800
.proc disk_copy_overlay2
.org $1800
jmp start
L1A39 := $1A39
L1A3B := $1A3B
LA798 := $A798
LA839 := $A839
LA83D := $A83D
LA8E8 := $A8E8
LA960 := $A960
LAA00 := $AA00
LAA1B := $AA1B
LAA3A := $AA3A
LAB37 := $AB37
;;; ============================================================
DEFINE_OPEN_PARAMS open_params, filename, $1C00
@ -80,7 +59,7 @@ L183F: sta BITMAP+1,x
lda LCBANK1
lda LCBANK1
jmp MGTK_RELAY
jmp disk_copy_overlay3_start
;;; ============================================================
;;; Copy first chunk to the Language Card
@ -141,125 +120,15 @@ loop: lda (src),y
.proc MLI_RELAY
sty call
stax params
php
sei
jsr MLI
call: .byte 0
params: .addr 0
plp
and #$FF
self: bne self ; hang if fails
rts
.endproc
;;; ============================================================
tax
bne L192C
bcc L1998
lda $BE54
lsr a
bcs L1962
L192C: jmp LA839
lda $BE53
cmp #$06
bne L192C
jmp LA798
jsr LAA1B
beq L192C
cmp #$41
beq L198C
jsr LAB37
sty $BCAD
ldy #$13
sty $BCAE
ldy #$40
sty $BE56
jsr LA960
bcs L1961
lda $BE6B
cmp #$08
bcc L1991
L195E: lda #$02
sec
L1961: rts
L1962: lsr a
bcc L1987
jsr LAA3A
beq L192C
dex
lda #$82
sta $BCA9
ldy #$01
jsr LAA00
dey
dey
sty $0280
lda #$03
sta $BE56
dex
jsr LAA3A
bne L192C
bcc L1998
L1987: jsr LAA3A
beq L192C
L198C: jsr LA8E8
bcs L1961
L1991: jsr LAA3A
bne L192C
bcs L1987
L1998: lda $BE61
beq L195E
cmp #$08
bcs L195E
lda $BE62
beq L195E
cmp #$03
bcs L195E
lda $BE54
and #$21
lsr a
beq L19BB
lda $BE42
bne L19BB
lda #$0F
sec
rts
L19BB: bcc L19FD
lda $BE55
and #$04
beq L19FD
lda $BE56
lsr a
bcs L19D3
lda $BE54
and #$90
beq L1A39
bpl L19FD
L19D3: lda $BCBD
eor #$2F
beq L19DF
lda $BF9A
beq L19F8
L19DF: lda $BE57
and #$04
beq L19FD
bcs L19F8
lda #$00
sta $BCBC
sta $BCBD
lda #$01
ora $BE56
sta $BE56
L19F8: jsr LA83D
bcs L1A3B
L19FD: lda $BE53
;;; ============================================================
PAD_TO $1A00
.endproc ; disk_copy_overlay2

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,10 @@
.setcpu "6502"
.include "apple2.inc"
.include "../macros.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
L0006 := $0006
LDAEE := $DAEE
LDB55 := $DB55
LDBE0 := $DBE0
LDE9F := $DE9F
LDF94 := $DF94
LE0FE := $E0FE
LE137 := $E137
LE6AB := $E6AB
LE6FD := $E6FD
LE766 := $E766
LE7A8 := $E7A8
;;; Disk II / IWM I/O locations ($C0nX, n = slot + 8)
;;; c/o http://archive.li/ewHUL
PHASE0 := $C080 ; Stepper motor phase 0
PHASE1 := $C082 ; Stepper motor phase 1
PHASE2 := $C084 ; Stepper motor phase 2
PHASE3 := $C086 ; Stepper motor phase 3
DISABLE := $C088 ; Turn disk drive off
ENABLE := $C089 ; Turn disk drive on
SELECT := $C08A ; Select drive 1 or 2
SELECT1 := $C08A ; Select drive 1
SELECT2 := $C08B ; Select drive 1
XMIT := $C08C ; Get/set bits to/from disk
TESTWP := $C08D ; Test WP mode (then WPRES has result)
DATA := $C08D ; Write data to buffer (then XMIT to send)
WPRES := $C08E ; WP mode test result
RDMODE := $C08E ; Turn off write mode
WRMODE := $C08F ; Turn on write mode
;;; ============================================================
;;; Overlay for Disk Copy - $0800 - $12FF (file 4/4)
;;; ============================================================
.proc disk_copy_overlay4
.org $800
.macro exit_with_result arg
lda #arg
jmp exit
@ -664,8 +630,6 @@ on_line_buffer:
.proc MLI_RELAY
sty call
stax params
php
sei
sta ALTZPOFF
lda ROMIN2
jsr MLI
@ -675,18 +639,21 @@ params: .addr 0
sta ALTZPON
lda LCBANK1
lda LCBANK1
plp
txa
rts
.endproc
;;; ============================================================
.proc noop
rts
.endproc
;;; ============================================================
;;; Quit back to ProDOS (which will launch DeskTop)
jsr LDF94
.proc quit
jsr disk_copy_overlay3::restore_ram_disk
sta ALTZPOFF
lda ROMIN2
sta DHIRESOFF
@ -700,61 +667,64 @@ params: .addr 0
jsr HOME
MLI_CALL QUIT, quit_params
rts
.endproc
;;; ============================================================
ldx $D418
lda $D3F7,x
sta L0CEC
L0CAF: ldx disk_copy_overlay3::dest_drive_index
lda disk_copy_overlay3::drive_unitnum_table,x
sta unit_number
and #$0F
beq L0CCC
lda $D3F7,x
jsr L0D26
ldy #$FF
lda (L0006),y
lda disk_copy_overlay3::drive_unitnum_table,x
jsr unit_number_to_driver_address
ldy #$FF ; offset to low byte of driver address
lda ($06),y
beq L0CCC
cmp #$FF
bne L0CD3
L0CCC: lda L0CEC
L0CCC: lda unit_number
jsr L0800
rts
L0CD3: lda L0CEC
jsr L0D26
ldy #$FF
lda (L0006),y
sta L0006
lda #$03
sta $42
lda L0CEC
sta $43
jmp (L0006)
L0CD3: lda unit_number
jsr unit_number_to_driver_address
ldy #$FF ; offset to low byte of driver address
lda ($06),y
sta $06
lda #DRIVER_COMMAND_FORMAT
sta DRIVER_COMMAND
lda unit_number
sta DRIVER_UNIT_NUMBER
jmp ($06)
rts
L0CEC: .byte 0
unit_number:
.byte 0
;;; ============================================================
;;; Eject Disk via SmartPort
.proc eject_disk
sta L0D24
jsr L0D26 ; Point $06 at $Cn00
jsr unit_number_to_driver_address ; Point $06 at $Cn00
ldy #$07 ; Check firmware bytes
lda (L0006),y ; $Cn07 = $00 ??
lda ($06),y ; $Cn07 = $00 ??
bne done
ldy #$FB
lda (L0006),y ; $CnFB = $7F ??
lda ($06),y ; $CnFB = $7F ??
and #$7F
bne done
ldy #$FF
lda (L0006),y
lda ($06),y
clc
adc #3 ; Locate dispatch routine (offset $CnFF + 3)
sta L0006
sta $06
lda L0D24
jsr L0D51
@ -768,7 +738,7 @@ L0CEC: .byte 0
done: rts
smartport_call:
jmp (L0006)
jmp ($06)
.proc control_params
param_count: .byte 3
@ -785,31 +755,37 @@ L0D24: .byte 0
.endproc
;;; ============================================================
;;; Get driver address for unit number
;;; Input: unit_number in A
;;; Output: $6/$7 points at driver address
L0D26: sta L0D50
ldx #$11
lda L0D50
and #$80
beq L0D34
ldx #$21
L0D34: stx load_addr
lda L0D50
and #$70
.proc unit_number_to_driver_address
sta unit_number
ldx #$11 ; $BF11 is DEVADR+1 for S0D1
lda unit_number
and #$80 ; high bit set?
beq :+
ldx #$21 ; $BF21 is DEVADR+1 for S0D2
: stx @load_addr
lda unit_number
and #$70 ; mask off slot
lsr a
lsr a
lsr a
clc
adc load_addr
sta load_addr
adc @load_addr
sta @load_addr
load_addr := * + 1
lda $BF00 ; self-modified
sta $07
@load_addr := *+1
lda MLI ; self-modified
sta $06+1
lda #$00
sta L0006
sta $06
rts
L0D50: .byte 0
unit_number:
.byte 0
.endproc
;;; ============================================================
@ -828,15 +804,15 @@ L0D51: pha
;;; ============================================================
L0D5F: ldx $D417
lda $D3F7,x
L0D5F: ldx disk_copy_overlay3::source_drive_index
lda disk_copy_overlay3::drive_unitnum_table,x
sta block_params::unit_num
lda #$00
sta block_params::block_num
sta block_params::block_num+1
jsr L12AF
bne L0D8A
lda $1C01
lda $1C00+1
cmp #$E0
beq L0D7F
jmp L0DA4
@ -847,13 +823,13 @@ L0D7F: lda $1C02
cmp #$60
beq L0D90
L0D8A: lda #$81
sta $D44D
sta disk_copy_overlay3::LD44D
rts
L0D90: addr_call LDE9F, $1300
addr_call LE0FE, $1300
L0D90: addr_call disk_copy_overlay3::LDE9F, $1300
addr_call disk_copy_overlay3::adjust_case, $1300
lda #$C0
sta $D44D
sta disk_copy_overlay3::LD44D
rts
L0DA4: cmp #$A5
@ -862,64 +838,64 @@ L0DA4: cmp #$A5
cmp #$27
bne L0D8A
lda #$80
sta $D44D
sta disk_copy_overlay3::LD44D
rts
;;; ============================================================
L0DB5: lda #$14
jsr L1133
lda $D417
lda disk_copy_overlay3::source_drive_index
asl a
tax
lda $D407,x
lda disk_copy_overlay3::LD407,x
sta L0EB0
lda $D408,x
lda disk_copy_overlay3::LD407+1,x
sta L0EB1
lsr16 L0EB0
lsr16 L0EB0
lsr16 L0EB0
copy16 L0EB0, $D427
bit $D44D
copy16 L0EB0, disk_copy_overlay3::LD427
bit disk_copy_overlay3::LD44D
bmi L0DF6
lda $D451
lda disk_copy_overlay3::quick_copy_flag
bne L0DF6
jmp L0E4D
L0DF6: lda #$FF
clc
adc $D427
sta L0006
adc disk_copy_overlay3::LD427
sta $06
lda #$13
adc $D428
adc disk_copy_overlay3::LD427+1
sta $07
ldy #$00
L0E07: lda #$00
sta (L0006),y
dec L0006
lda L0006
sta ($06),y
dec $06
lda $06
cmp #$FF
bne L0E15
dec $07
L0E15: lda $07
cmp #$14
bne L0E07
lda L0006
lda $06
cmp #$00
bne L0E07
lda #$00
sta (L0006),y
lda $D428
sta ($06),y
lda disk_copy_overlay3::LD427+1
cmp #$02
bcs L0E2D
rts
L0E2D: lda #$14
sta L0006
lda $D428
sta $06
lda disk_copy_overlay3::LD427+1
pha
L0E35: inc L0006
inc L0006
L0E35: inc $06
inc $06
pla
sec
sbc #$02
@ -929,13 +905,13 @@ L0E35: inc L0006
jmp L0E35
L0E46: pla
L0E47: lda L0006
L0E47: lda $06
jsr L1133
rts
L0E4D: copy16 #$0006, block_params::block_num
ldx $D417
lda $D3F7,x
L0E4D: copy16 #6, block_params::block_num
ldx disk_copy_overlay3::source_drive_index
lda disk_copy_overlay3::drive_unitnum_table,x
sta block_params::unit_num
copy16 #$1400, block_params::data_buffer
jsr L12AF
@ -993,34 +969,34 @@ L0ED6: .byte 0
;;; ============================================================
L0ED7: bit $C010
L0ED7: bit KBDSTRB
sta L0FE6
and #$FF
bpl L0EFF
copy16 $D424, $D421
lda $D426
sta $D423
ldx $D418
lda $D3F7,x
copy16 disk_copy_overlay3::LD424, disk_copy_overlay3::LD421
lda disk_copy_overlay3::LD426
sta disk_copy_overlay3::LD423
ldx disk_copy_overlay3::dest_drive_index
lda disk_copy_overlay3::drive_unitnum_table,x
sta block_params::unit_num
jmp L0F1A
L0EFF: copy16 $D421, $D424
lda $D423
sta $D426
ldx $D417
lda $D3F7,x
L0EFF: copy16 disk_copy_overlay3::LD421, disk_copy_overlay3::LD424
lda disk_copy_overlay3::LD423
sta disk_copy_overlay3::LD426
ldx disk_copy_overlay3::source_drive_index
lda disk_copy_overlay3::drive_unitnum_table,x
sta block_params::unit_num
L0F1A: lda #$07
sta $D420
sta disk_copy_overlay3::LD420
lda #$00
sta $D41F
sta disk_copy_overlay3::LD41F
sta L0FE4
sta L0FE5
L0F2A: lda $C000
cmp #$9B
L0F2A: lda KBD
cmp #(CHAR_ESCAPE | $80)
bne L0F37
jsr LE6AB
jsr disk_copy_overlay3::LE6AB
jmp L0F6F
L0F37: bit L0FE4
@ -1052,7 +1028,7 @@ L0F6F: return #$01
L0F72: stax block_params::block_num
ldx L0FE8
lda L0FE7
ldy $D41F
ldy disk_copy_overlay3::LD41F
cpy #$10
bcs L0F9A
bit L0FE6
@ -1081,11 +1057,11 @@ L0FAF: jsr L120C
L0FB7: bit L0FE6
bmi L0FC4
jsr LE766
jsr disk_copy_overlay3::LE766
bmi L0F6F
jmp L0F2A
L0FC4: jsr LE7A8
L0FC4: jsr disk_copy_overlay3::LE7A8
bmi L0F6F
jmp L0F2A
@ -1120,35 +1096,35 @@ L0FF6: jsr L0FFF
tax
rts
L0FFF: dec $D423
lda $D423
L0FFF: dec disk_copy_overlay3::LD423
lda disk_copy_overlay3::LD423
cmp #$FF
beq L100B
L1009: clc
rts
L100B: lda #$07
sta $D423
inc16 $D421
L1018: lda $D422
cmp $D428
sta disk_copy_overlay3::LD423
inc16 disk_copy_overlay3::LD421
lda disk_copy_overlay3::LD421+1
cmp disk_copy_overlay3::LD427+1
bne L1009
lda $D421
cmp $D427
lda disk_copy_overlay3::LD421
cmp disk_copy_overlay3::LD427
bne L1009
sec
rts
L102A: lda #$00
clc
adc $D421
sta L0006
adc disk_copy_overlay3::LD421
sta $06
lda #$14
adc $D422
adc disk_copy_overlay3::LD421+1
sta $07
ldy #$00
lda (L0006),y
ldx $D423
lda ($06),y
ldx disk_copy_overlay3::LD423
cpx #$00
beq L1048
L1044: lsr a
@ -1159,16 +1135,16 @@ L1048: and #$01
tay
beq L1051
L104F: ldy #$FF
L1051: lda $D422
L1051: lda disk_copy_overlay3::LD421+1
sta L1076
lda $D421
lda disk_copy_overlay3::LD421
asl a
rol L1076
asl a
rol L1076
asl a
rol L1076
ldx $D423
ldx disk_copy_overlay3::LD423
clc
adc L1077,x
pha
@ -1199,25 +1175,25 @@ L108C: jsr L1095
tax
rts
L1095: dec $D420
lda $D420
L1095: dec disk_copy_overlay3::LD420
lda disk_copy_overlay3::LD420
cmp #$FF
beq L10A1
L109F: clc
rts
L10A1: lda #$07
sta $D420
inc $D41F
lda $D41F
sta disk_copy_overlay3::LD420
inc disk_copy_overlay3::LD41F
lda disk_copy_overlay3::LD41F
cmp #$21
bcc L109F
sec
rts
L10B2: ldx $D41F
L10B2: ldx disk_copy_overlay3::LD41F
lda L12B9,x
ldx $D420
ldx disk_copy_overlay3::LD420
cpx #$00
beq L10C3
L10BF: lsr a
@ -1228,14 +1204,14 @@ L10C3: and #$01
ldy #$00
beq L10CD
L10CB: ldy #$FF
L10CD: lda $D41F
L10CD: lda disk_copy_overlay3::LD41F
cmp #$10
bcs L10E3
L10D4: asl a
asl a
asl a
asl a
ldx $D420
ldx disk_copy_overlay3::LD420
clc
adc L10F3,x
tax
@ -1257,17 +1233,17 @@ L10F3:
;;; ============================================================
L10FB: lda #$14
sta L0006
sta $06
lda #$00
sta L111E
L1104: lda L0006
L1104: lda $06
jsr L111F
inc L0006
inc L0006
inc $06
inc $06
inc L111E
inc L111E
lda L111E
cmp $D428
cmp disk_copy_overlay3::LD427+1
beq L1104
bcc L1104
rts
@ -1321,12 +1297,12 @@ L1160: stax block_params::data_buffer
L1166: jsr L12AF
beq L1174
ldx #$00
jsr LE6FD
jsr disk_copy_overlay3::LE6FD
bmi L1174
bne L1166
L1174: rts
L1175: sta L0006
L1175: sta $06
sta $08
stx $07
stx $09
@ -1335,7 +1311,7 @@ L1175: sta L0006
L1189: jsr L12AF
beq L119A
ldx #$00
jsr LE6FD
jsr disk_copy_overlay3::LE6FD
beq L119A
bpl L1189
return #$80
@ -1343,14 +1319,14 @@ L1189: jsr L12AF
L119A: ldy #$FF
iny
L119D: lda $1C00,y
sta (L0006),y
sta ($06),y
lda $1D00,y
sta ($08),y
iny
bne L119D
return #$00
L11AD: sta L0006
L11AD: sta $06
sta $08
stx $07
stx $09
@ -1359,19 +1335,19 @@ L11AD: sta L0006
L11C1: jsr L12AF
beq L11D8
ldx #$00
jsr LE6FD
jsr disk_copy_overlay3::LE6FD
beq L11D8
bpl L11C1
lda LCBANK1
lda LCBANK1
return #$80
L11D8: lda $C083
lda $C083
L11D8: lda LCBANK2
lda LCBANK2
ldy #$FF
iny
L11E1: lda $1C00,y
sta (L0006),y
sta ($06),y
lda $1D00,y
sta ($08),y
iny
@ -1384,12 +1360,12 @@ L11F7: stax block_params::data_buffer
L11FD: jsr L12A5
beq L120B
ldx #$80
jsr LE6FD
jsr disk_copy_overlay3::LE6FD
beq L120B
bpl L11FD
L120B: rts
L120C: sta L0006
L120C: sta $06
sta $08
stx $07
stx $09
@ -1397,7 +1373,7 @@ L120C: sta L0006
copy16 #$1C00, block_params::data_buffer
ldy #$FF
iny
L1223: lda (L0006),y
L1223: lda ($06),y
sta $1C00,y
lda ($08),y
sta $1D00,y
@ -1406,14 +1382,14 @@ L1223: lda (L0006),y
L1230: jsr L12A5
beq L123E
ldx #$80
jsr LE6FD
jsr disk_copy_overlay3::LE6FD
beq L123E
bpl L1230
L123E: rts
L123F: bit $C083
bit $C083
sta L0006
L123F: bit LCBANK2
bit LCBANK2
sta $06
sta $08
stx $07
stx $09
@ -1421,7 +1397,7 @@ L123F: bit $C083
copy16 #$1C00, block_params::data_buffer
ldy #$FF
iny
L125C: lda (L0006),y
L125C: lda ($06),y
sta $1C00,y
lda ($08),y
sta $1D00,y
@ -1432,7 +1408,7 @@ L125C: lda (L0006),y
L126F: jsr L12A5
beq L127D
ldx #$80
jsr LE6FD
jsr disk_copy_overlay3::LE6FD
beq L127D
bpl L126F
L127D: rts
@ -1495,16 +1471,33 @@ L12B9: .byte 0
.byte $7F
.byte $FF
L12DA: lda $D133
cmp $D18D
bne :+
jmp LDAEE
: cmp $D1C7
bne :+
jmp LDB55
: rts
;;; ============================================================
lda $D18D
sta $D12D
jsr LE137
yax_call LDBE0, $46, $D12D
PAD_TO $1300
.assert * = $1300, error, "Segment length mismatch"
.endproc
disk_copy_overlay4_L0CAF := disk_copy_overlay4::L0CAF
disk_copy_overlay4_L0D51 := disk_copy_overlay4::L0D51
disk_copy_overlay4_L0D5F := disk_copy_overlay4::L0D5F
disk_copy_overlay4_L0DB5 := disk_copy_overlay4::L0DB5
disk_copy_overlay4_L0EB2 := disk_copy_overlay4::L0EB2
disk_copy_overlay4_L0ED7 := disk_copy_overlay4::L0ED7
disk_copy_overlay4_L10FB := disk_copy_overlay4::L10FB
disk_copy_overlay4_L127E := disk_copy_overlay4::L127E
disk_copy_overlay4_L1291 := disk_copy_overlay4::L1291
disk_copy_overlay4_L129B := disk_copy_overlay4::L129B
disk_copy_overlay4_L12A5 := disk_copy_overlay4::L12A5
disk_copy_overlay4_L12AF := disk_copy_overlay4::L12AF
disk_copy_overlay4_block_params_block_num := disk_copy_overlay4::block_params::block_num
disk_copy_overlay4_block_params_data_buffer := disk_copy_overlay4::block_params::data_buffer
disk_copy_overlay4_block_params_unit_num := disk_copy_overlay4::block_params::unit_num
disk_copy_overlay4_eject_disk := disk_copy_overlay4::eject_disk
disk_copy_overlay4_noop := disk_copy_overlay4::noop
disk_copy_overlay4_on_line_buffer := disk_copy_overlay4::on_line_buffer
disk_copy_overlay4_on_line_params2_unit_num := disk_copy_overlay4::on_line_params2::unit_num
disk_copy_overlay4_on_line_params_unit_num := disk_copy_overlay4::on_line_params::unit_num
disk_copy_overlay4_quit := disk_copy_overlay4::quit
disk_copy_overlay4_unit_number_to_driver_address := disk_copy_overlay4::unit_number_to_driver_address

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,9 @@
.setcpu "6502"
;;; NB: Compiled as part of ovl34567.s
;;; ============================================================
;;; Overlay for Selector (part of it, anyway)
;;; ============================================================
.org $9000
.proc selector_overlay2
;;; Entry points in desktop_main
launch_dialog := $A500
set_cursor_watch := $B3E7
set_cursor_pointer := $B403
LB445 := $B445 ; ???
draw_text1 := $B708
set_port_from_window_id := $B7B9
.org $9000
sta L938E
ldx #$FF
@ -33,10 +21,10 @@ L9016: rts
L9017: lda $0C00
clc
adc $0C01
sta $D343
sta num_selector_list_items
lda #$00
sta $D344
jsr L9DED
sta LD344
jsr get_copied_to_ramcard_flag
cmp #$80
bne L9015
jsr JUMP_TABLE_REDRAW_ALL
@ -48,15 +36,15 @@ L9017: lda $0C00
rts
L903C: ldx #$01
copy16 $DB1C, load
load := *+1
copy16 selector_menu_addr, @load
@load := *+1
lda dummy1234
cmp #$0D
bcc L9052
inx
L9052: lda #$00
sta $D402
sta $D443
sta path_buf0
sta path_buf1
ldy #$03
lda #$02
jsr common_overlay_L5000
@ -100,7 +88,7 @@ L9093: copy16 $0C00, L938B
lda L938B
jsr L9A0A
inc $0C00
copy16 $DB1C, @addr
copy16 selector_menu_addr, @addr
@addr := *+1
inc dummy1234
jsr L9CEA
@ -165,14 +153,14 @@ L913F: cmp #$04
L9146: lda L938D
jsr L979D
jsr set_cursor_watch
jsr desktop_main::set_cursor_watch
lda L938D
jsr L9A97
beq L915D
jsr set_cursor_pointer
jsr desktop_main::set_cursor_pointer
jmp L933F
L915D: jsr set_cursor_pointer
L915D: jsr desktop_main::set_cursor_pointer
lda #$FF
sta L938D
jsr L99F5
@ -191,7 +179,7 @@ L9174: lda L938D
lda ($06),y
tay
L918C: lda ($06),y
sta $D443,y
sta path_buf1,y
dey
bpl L918C
ldy #$0F
@ -204,7 +192,7 @@ L918C: lda ($06),y
lda ($06),y
tay
L91AA: lda ($06),y
sta $D402,y
sta path_buf0,y
dey
bpl L91AA
ldx #$01
@ -270,7 +258,7 @@ L9215: lda L938D
L9220: ldx L938B
inc L938B
inc $0C00
copy16 $DB1C, @addr
copy16 selector_menu_addr, @addr
@addr := *+1
inc dummy1234
txa
@ -304,13 +292,13 @@ L926D: ldy L9104
beq L927B
jmp L936E
L927B: jsr set_cursor_pointer
L927B: jsr desktop_main::set_cursor_pointer
jmp L900F
L9281: .byte 0
L9282: lda L938D
jsr L979D
jsr set_cursor_watch
jsr desktop_main::set_cursor_watch
lda L938D
jsr L9BD5
stax $06
@ -319,7 +307,7 @@ L9282: lda L938D
cmp #$C0
beq L92F0
sta L938A
jsr L9DED
jsr get_copied_to_ramcard_flag
beq L92F0
lda L938A
beq L92CE
@ -333,7 +321,7 @@ L9282: lda L938D
lda ($06),y
tay
L92C1: lda ($06),y
sta $D355,y
sta buf_win_path,y
dey
bpl L92C1
lda #$FF
@ -349,7 +337,7 @@ L92D6: lda L938D
lda ($06),y
tay
L92E5: lda ($06),y
sta $D355,y
sta buf_win_path,y
dey
bpl L92E5
jmp L9307
@ -361,11 +349,11 @@ L92F0: lda L938D
lda ($06),y
tay
L92FF: lda ($06),y
sta $D355,y
sta buf_win_path,y
dey
bpl L92FF
L9307: ldy $D355
L930A: lda $D355,y
L9307: ldy buf_win_path
L930A: lda buf_win_path,y
cmp #$2F
beq L9314
dey
@ -376,15 +364,15 @@ L9314: dey
ldx #$00
L931B: iny
inx
lda $D355,y
sta $D345,x
cpy $D355
lda buf_win_path,y
sta buf_filename2,x
cpy buf_win_path
bne L931B
stx $D345
stx buf_filename2
lda L938A
sta $D355
sta buf_win_path
jsr JUMP_TABLE_LAUNCH_FILE
jsr set_cursor_pointer
jsr desktop_main::set_cursor_pointer
lda #$FF
sta L938D
jmp L936E
@ -396,14 +384,14 @@ L933F: pha
lda #$07
jsr JUMP_TABLE_RESTORE_OVL
jsr JUMP_TABLE_REDRAW_ALL
L934F: MGTK_RELAY_CALL MGTK::InitPort, $D239
MGTK_RELAY_CALL MGTK::SetPort, $D239
L934F: MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entry_picker
pla
jmp L900F
L936E: MGTK_RELAY_CALL MGTK::InitPort, $D239
MGTK_RELAY_CALL MGTK::SetPort, $D239
L936E: MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entry_picker
rts
@ -417,101 +405,101 @@ L938F: .byte 0
L9390: MGTK_RELAY_CALL MGTK::OpenWindow, winfo_entry_picker
lda winfo_entry_picker
jsr set_port_from_window_id
jsr desktop_main::set_port_from_window_id
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::FrameRect, $D6D8
MGTK_RELAY_CALL MGTK::FrameRect, $D6E0
MGTK_RELAY_CALL MGTK::MoveTo, $D6E8
MGTK_RELAY_CALL MGTK::LineTo, $D6EC
MGTK_RELAY_CALL MGTK::MoveTo, $D6F0
MGTK_RELAY_CALL MGTK::LineTo, $D6F4
MGTK_RELAY_CALL MGTK::FrameRect, entry_picker_outer_rect
MGTK_RELAY_CALL MGTK::FrameRect, entry_picker_inner_rect
MGTK_RELAY_CALL MGTK::MoveTo, entry_picker_line1_start
MGTK_RELAY_CALL MGTK::LineTo, entry_picker_line1_end
MGTK_RELAY_CALL MGTK::MoveTo, entry_picker_line2_start
MGTK_RELAY_CALL MGTK::LineTo, entry_picker_line2_end
MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::FrameRect, $D6F8
MGTK_RELAY_CALL MGTK::FrameRect, $D700
MGTK_RELAY_CALL MGTK::FrameRect, entry_picker_ok_rect
MGTK_RELAY_CALL MGTK::FrameRect, entry_picker_cancel_rect
jsr L94A9
jsr L94BA
lda L938E
cmp #$02
bne L9417
addr_call L94F0, $D729
addr_call L94F0, edit_an_entry_label
rts
L9417: cmp #$03
bne L9423
addr_call L94F0, $D73B
addr_call L94F0, delete_an_entry_label
rts
L9423: addr_call L94F0, $D74F
L9423: addr_call L94F0, run_an_entry_label
rts
L942B: stx $07
sta $06
lda $D6C3
lda dialog_label_pos::xcoord
sta L94A8
tya
pha
cmp #$10
cmp #16 ; 3rd column (16-24)
bcc L9441
sec
sbc #$10
sbc #16
jmp L9448
L9441: cmp #$08
;; 8 rows
L9441: cmp #8 ; 2nd column (8-15)
bcc L9448
sec
sbc #$08
L9448: ldx #$00
stx L94A7
asl a
rol L94A7
asl a
rol L94A7
asl a
rol L94A7
sbc #8
;; A has row
L9448: ldx #0
ldy #entry_picker_item_height
jsr Multiply_16_8_16 ; A,X = A,X * Y
clc
adc #$20
sta $D6C5
lda L94A7
adc #$00
sta $D6C6
pla
cmp #$08
bcs L9471
lda #$00
tax
beq L947F
L9471: cmp #$10
bcs L947B
ldx #$00
lda #$73
bne L947F
L947B: ldax #$00DC
L947F: clc
adc #$0A
sta $D6C3
adc #32
sta dialog_label_pos::ycoord
txa
adc #$00
sta $D6C4
MGTK_RELAY_CALL MGTK::MoveTo, $D6C3
lda $06
ldx $07
adc #0
sta dialog_label_pos::ycoord+1
pla
cmp #8
bcs :+
lda #0 ; col 1
tax
beq L947F ; always
: cmp #16
bcs :+
ldx #0
lda #115 ; col 2
bne L947F ; always
: ldax #220 ; col 3
L947F: clc
adc #10
sta dialog_label_pos::xcoord
txa
adc #0
sta dialog_label_pos::xcoord+1
MGTK_RELAY_CALL MGTK::MoveTo, dialog_label_pos
ldax $06
jsr L94CB
lda L94A8
sta $D6C3
lda #$00
sta $D6C4
sta dialog_label_pos::xcoord
lda #0
sta dialog_label_pos::xcoord+1
rts
L94A7: .byte 0
L94A8: .byte 0
L94A9: MGTK_RELAY_CALL MGTK::MoveTo, $D708
addr_call draw_text1, $AE40
L94A9: MGTK_RELAY_CALL MGTK::MoveTo, entry_picker_ok_pos
addr_call desktop_main::draw_text1, desktop_aux::str_ok_label
rts
L94BA: MGTK_RELAY_CALL MGTK::MoveTo, $D70C
addr_call draw_text1, $AE96
L94BA: MGTK_RELAY_CALL MGTK::MoveTo, entry_picker_cancel_pos
addr_call desktop_main::draw_text1, desktop_aux::str_cancel_label
rts
L94CB: stax $06
@ -519,11 +507,11 @@ L94CB: stax $06
lda ($06),y
tay
L94D4: lda ($06),y
sta $D486,y
sta path_buf2+2,y
dey
bpl L94D4
copy16 #$D487, $D484
MGTK_RELAY_CALL MGTK::DrawText, $D484
copy16 #path_buf2+3, path_buf2
MGTK_RELAY_CALL MGTK::DrawText, path_buf2
rts
L94F0: stax $06
@ -540,11 +528,11 @@ L94F0: stax $06
ror a
sec
sbc $09
sta $D6B7
sta pos_dialog_title
lda L9539
sbc $0A
sta $D6B8
MGTK_RELAY_CALL MGTK::MoveTo, $D6B7
sta pos_dialog_title+1
MGTK_RELAY_CALL MGTK::MoveTo, pos_dialog_title
MGTK_RELAY_CALL MGTK::DrawText, $06
rts
@ -553,13 +541,13 @@ L953A: lda #$00
sta L95BF
L953F: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_kind
cmp #MGTK::event_kind_button_up
cmp #MGTK::EventKind::button_up
beq L95A2
lda winfo_entry_picker
sta screentowindow_window_id
MGTK_RELAY_CALL MGTK::ScreenToWindow, screentowindow_params
MGTK_RELAY_CALL MGTK::MoveTo, screentowindow_windowx
MGTK_RELAY_CALL MGTK::InRect, $D6F8
MGTK_RELAY_CALL MGTK::InRect, entry_picker_ok_rect
cmp #MGTK::inrect_inside
beq L957C
lda L95BF
@ -571,7 +559,7 @@ L957C: lda L95BF
jmp L953F
L9584: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D6F8
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_ok_rect
lda L95BF
clc
adc #$80
@ -583,7 +571,7 @@ L95A2: lda L95BF
return #$FF
L95AA: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D6F8
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_ok_rect
return #$00
L95BF: .byte 0
@ -591,13 +579,13 @@ L95C0: lda #$00
sta L9645
L95C5: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_kind
cmp #MGTK::event_kind_button_up
cmp #MGTK::EventKind::button_up
beq L9628
lda winfo_entry_picker
sta screentowindow_window_id
MGTK_RELAY_CALL MGTK::ScreenToWindow, screentowindow_params
MGTK_RELAY_CALL MGTK::MoveTo, screentowindow_windowx
MGTK_RELAY_CALL MGTK::InRect, $D700
MGTK_RELAY_CALL MGTK::InRect, entry_picker_cancel_rect
cmp #MGTK::inrect_inside
beq L9602
lda L9645
@ -609,7 +597,7 @@ L9602: lda L9645
jmp L95C5
L960A: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D700
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_cancel_rect
lda L9645
clc
adc #$80
@ -621,17 +609,17 @@ L9628: lda L9645
return #$FF
L9630: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D700
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_cancel_rect
return #$01
L9645: .byte 0
L9646: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_kind
cmp #MGTK::event_kind_button_down
cmp #MGTK::EventKind::button_down
bne L9659
jmp L9660
L9659: cmp #MGTK::event_kind_key_down
L9659: cmp #MGTK::EventKind::key_down
bne L9646
jmp L9822
@ -640,7 +628,7 @@ L9660: MGTK_RELAY_CALL MGTK::FindWindow, findwindow_params
bne L9671
return #$FF
L9671: cmp #MGTK::area_content
L9671: cmp #MGTK::Area::content
beq L9678
return #$FF
@ -650,75 +638,66 @@ L9678: lda findwindow_window_id
return #$FF
L9683: lda winfo_entry_picker
jsr set_port_from_window_id
jsr desktop_main::set_port_from_window_id
lda winfo_entry_picker
sta screentowindow_window_id
MGTK_RELAY_CALL MGTK::ScreenToWindow, screentowindow_params
MGTK_RELAY_CALL MGTK::MoveTo, screentowindow_windowx
MGTK_RELAY_CALL MGTK::InRect, $D6F8
MGTK_RELAY_CALL MGTK::InRect, entry_picker_ok_rect
cmp #MGTK::inrect_inside
bne L96C8
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D6F8
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_ok_rect
jsr L953A
bmi L96C7
lda #$00
L96C7: rts
L96C8: MGTK_RELAY_CALL MGTK::InRect, $D700
L96C8: MGTK_RELAY_CALL MGTK::InRect, entry_picker_cancel_rect
cmp #MGTK::inrect_inside
bne L96EF
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D700
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_cancel_rect
jsr L95C0
bmi L96EE
lda #$01
L96EE: rts
L96EF: lda $D20D
sec
sbc #$0A
sta $D20D
lda $D20E
sbc #$00
sta $D20E
lda $D20F
sec
sbc #$19
sta $D20F
lda $D210
sbc #$00
sta $D210
L96EF: sub16 screentowindow_windowx, #10, screentowindow_windowx
sub16 screentowindow_windowy, #25, screentowindow_windowy
bpl L9716
return #$FF
L9716: cmp16 $D20D, #$006E
;; Determine column
L9716: cmp16 screentowindow_windowx, #110
bmi L9736
cmp16 $D20D, #$00DC
cmp16 screentowindow_windowx, #220
bmi L9732
lda #$02
lda #2
bne L9738
L9732: lda #$01
L9732: lda #1
bne L9738
L9736: lda #$00
L9736: lda #0
;; Determine row
L9738: pha
lsr16 $D20F
lsr16 $D20F
lsr16 $D20F
lda $D20F
cmp #$08
bcc L9756
ldax screentowindow_windowy
ldy #entry_picker_item_height
jsr Divide_16_8_16
stax screentowindow_windowy
cmp #8
bcc :+
pla
return #$FF
L9756: pla
: pla
asl a
asl a
asl a
clc
adc $D20F
adc screentowindow_windowy
sta L979C
cmp #$08
cmp #8
bcs L9782
cmp L938B
bcs L9790
@ -729,15 +708,15 @@ L976A: cmp L938D
lda L979C
sta L938D
jsr L979D
L977E: jsr LB445
L977E: jsr desktop_main::detect_double_click
rts
L9782: sec
sbc #$08
sbc #8
cmp L938C
bcs L9790
clc
adc #$08
adc #8
jmp L976A
L9790: lda L938D
@ -756,41 +735,41 @@ L97A0: pha
lsr a
tax
beq L97B6
cmp #$01
cmp #1
bne L97B2
addr_jump L97B6, $0069
L97B2: ldax #$00D2
L97B2: ldax #210
L97B6: clc
adc #$09
sta $D877
adc #9
sta entry_picker_item_rect::x1
txa
adc #$00
sta $D878
adc #0
sta entry_picker_item_rect::x1+1
pla
cmp #$08
cmp #8
bcc L97D4
cmp #$10
cmp #16
bcs L97D1
sec
sbc #$08
sbc #8
jmp L97D4
L97D1: sec
sbc #$10
L97D4: asl a
asl a
asl a
sbc #16
L97D4: ldx #0
ldy #entry_picker_item_height
jsr Multiply_16_8_16
clc
adc #$18
sta $D879
lda #$00
adc #$00
sta $D87A
add16 $D877, #$006A, $D87B
add16 $D879, #$0007, $D87D
adc #24
sta entry_picker_item_rect::y1
txa
adc #0
sta entry_picker_item_rect::y1+1
add16 entry_picker_item_rect::x1, #106, entry_picker_item_rect::x2
add16 entry_picker_item_rect::y1, #entry_picker_item_height-1, entry_picker_item_rect::y2
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D877
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_item_rect
MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
rts
@ -800,7 +779,7 @@ L9822: lda event_modifiers
bne :+
return #$FF
: lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_LEFT
bne :+
@ -829,16 +808,16 @@ L9822: lda event_modifiers
: return #$FF
L985E: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D6F8
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_ok_rect
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D6F8
return #$00
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_ok_rect
return #0
L9885: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D700
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_cancel_rect
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D700
return #$01
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_cancel_rect
return #1
L98AC: lda L938B
ora L938C
@ -1011,7 +990,7 @@ L99ED: .byte 0
.byte 0
.byte 0
L99F5: MGTK_RELAY_CALL MGTK::SetPenMode, pencopy
MGTK_RELAY_CALL MGTK::PaintRect, $D87F
MGTK_RELAY_CALL MGTK::PaintRect, entry_picker_all_items_rect
rts
rts
@ -1031,8 +1010,8 @@ L9A11: sta L9A60
lda L9A60
jsr L9BEF
stax $08
ldy $D443
L9A2D: lda $D443,y
ldy path_buf1
L9A2D: lda path_buf1,y
sta ($06),y
sta ($08),y
dey
@ -1047,8 +1026,8 @@ L9A2D: lda $D443,y
lda L9A60
jsr L9BFC
stax $08
ldy $D402
L9A55: lda $D402,y
ldy path_buf0
L9A55: lda path_buf0,y
sta ($06),y
sta ($08),y
dey
@ -1062,8 +1041,8 @@ L9A61: sta L9A96
lda L9A96
jsr L9BD5
stax $06
ldy $D443
L9A73: lda $D443,y
ldy path_buf1
L9A73: lda path_buf1,y
sta ($06),y
dey
bpl L9A73
@ -1073,8 +1052,8 @@ L9A73: lda $D443,y
lda L9A96
jsr L9BE2
stax $06
ldy $D402
L9A8D: lda $D402,y
ldy path_buf0
L9A8D: lda path_buf0,y
sta ($06),y
dey
bpl L9A8D
@ -1092,7 +1071,7 @@ L9AA1: tax
bne L9AC0
L9AA8: dec $0C00
dec L938B
copy16 $DB1C, @addr
copy16 selector_menu_addr, @addr
@addr := *+1
dec dummy1234
jmp L9CEA
@ -1268,18 +1247,18 @@ L9BFC: jsr L9DA7
tya
rts
L9C09: sta $D2AC
yax_call launch_dialog, $0C, $D2AC
L9C09: sta warning_dialog_num
yax_call desktop_main::invoke_dialog_proc, $0C, warning_dialog_num
rts
DEFINE_OPEN_PARAMS open_params, $1C00, $800
DEFINE_WRITE_PARAMS write_params, $C00, $800
DEFINE_CLOSE_PARAMS flush_close_params
L9C26: addr_call L9E2A, $1C00
L9C26: addr_call copy_desktop_orig_prefix, $1C00
inc $1C00
ldx $1C00
lda #$2F
lda #'/'
sta $1C00,x
ldx #$00
ldy $1C00
@ -1313,7 +1292,7 @@ L9C81: yax_call MLI_RELAY, FLUSH, flush_close_params
yax_call MLI_RELAY, CLOSE, flush_close_params
rts
DEFINE_OPEN_PARAMS open_params2, $9C9A, $800
DEFINE_OPEN_PARAMS open_params2, L9C9A, $800
L9C9A: PASCAL_STRING "Selector.List"
@ -1445,8 +1424,6 @@ L9DC8: .byte 0
.proc MLI_RELAY
sty call
stax params
php
sei
sta ALTZPOFF
sta ROMIN2
jsr MLI
@ -1456,53 +1433,64 @@ params: .addr 0
tax
lda LCBANK1
lda LCBANK1
plp
txa
rts
.endproc
;;; ============================================================
L9DED: sta ALTZPOFF
lda $C083
lda $C083
lda $D3FF
.proc get_copied_to_ramcard_flag
sta ALTZPOFF
lda LCBANK2
lda LCBANK2
lda copied_to_ramcard_flag
tax
sta ALTZPON
lda LCBANK1
lda LCBANK1
txa
rts
.endproc
L9E05: stax L9E1B
.proc copy_ramcard_prefix
stax @addr
sta ALTZPOFF
lda $C083
lda $C083
ldx $D3EE
L9E17: lda $D3EE,x
.byte $9D
L9E1B: .addr $1234
lda LCBANK2
lda LCBANK2
ldx ramcard_prefix
: lda ramcard_prefix,x
@addr := *+1
sta dummy1234,x
dex
bpl L9E17
bpl :-
sta ALTZPON
lda LCBANK1
lda LCBANK1
rts
.endproc
L9E2A: stax L9E40
.proc copy_desktop_orig_prefix
stax @addr
sta ALTZPOFF
lda $C083
lda $C083
ldx $D3AD
L9E3C: lda $D3AD,x
.byte $9D
L9E40: .addr $1234
lda LCBANK2
lda LCBANK2
ldx desktop_orig_prefix
: lda desktop_orig_prefix,x
@addr := *+1
sta dummy1234,x
dex
bpl L9E3C
bpl :-
sta ALTZPON
lda LCBANK1
lda LCBANK1
rts
.endproc
;;; ============================================================
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, 0
@ -1512,7 +1500,7 @@ L9E61: jsr L9E74
rts
L9E74: sta L9EBF
addr_call L9E05, $9EC1
addr_call copy_ramcard_prefix, L9EC1
lda L9EBF
jsr L9BE2
stax $06
@ -1521,15 +1509,15 @@ L9E74: sta L9EBF
sta L9EC0
tay
L9E90: lda ($06),y
and #$7F
cmp #$2F
and #CHAR_MASK
cmp #'/'
beq L9E9B
dey
bne L9E90
L9E9B: dey
L9E9C: lda ($06),y
and #$7F
cmp #$2F
and #CHAR_MASK
cmp #'/'
beq L9EA7
dey
bne L9E9C
@ -1542,15 +1530,15 @@ L9EAB: inx
cpy L9EC0
bne L9EAB
stx L9EC1
ldax #$9EC1
ldax #L9EC1
rts
L9EBF: .byte 0
L9EC0: .byte 0
L9EC1: .byte 0
;; how much is buffer, how much is padding?
;;; ============================================================
PAD_TO $A000
.endproc ; selector_overlay2

View File

@ -1,28 +0,0 @@
.setcpu "6502"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "inc/desktoplc.inc"
.macro entry arg1, arg2
.byte arg1
.addr arg2
.endmacro
dummy1234 := $1234
;;; ============================================================
;;; Interdependent Overlays
.include "ovl3.s" ; Selector (1/2) @ $9000-$9FFF
.include "ovl4.s" ; Common @ $5000-$6FFF
.include "ovl5.s" ; File Copy @ $7000-$77FF
.include "ovl6.s" ; File Delete @ $7000-$77FF
.include "ovl7.s" ; Selector (2/2) @ $7000-$77FF
common_overlay_L5000 := common_overlay::L5000

File diff suppressed because it is too large Load Diff

View File

@ -1,139 +1,133 @@
.setcpu "6502"
;;; NB: Compiled as part of ovl34567.s
;;; ============================================================
;;; Overlay for File Copy
;;; ============================================================
.org $7000
.proc file_copy_overlay
.org $7000
L7000: jsr common_overlay::L5CF7
L7000: jsr common_overlay::create_common_dialog
jsr L7052
jsr common_overlay::L5E87
jsr common_overlay::device_on_line
jsr common_overlay::L5F5B
jsr common_overlay::L6161
jsr common_overlay::L61B1
jsr common_overlay::L606D
jsr L7026
jsr common_overlay::L6D30
jsr common_overlay::L6D27
lda #$FF
sta $D8EC
jsr common_overlay::jt_prep_path
jsr common_overlay::jt_redraw_input
copy #$FF, LD8EC
jmp common_overlay::L5106
L7026: ldx L709B
L7029: lda L709B+1,x
sta $6D1E,x
L7026: ldx jt_source_filename
L7029: lda jt_source_filename+1,x
sta common_overlay::jump_table,x
dex
lda L709B+1,x
sta $6D1E,x
lda jt_source_filename+1,x
sta common_overlay::jump_table,x
dex
dex
bpl L7029
lda #$80
sta $5104
sta common_overlay::L5104
lda #$00
sta path_buf0
sta $51AE
sta common_overlay::L51AE
lda #$01
sta path_buf2
lda #$06
sta $D485
sta path_buf2+1
rts
L7052: lda winfo_entrydlg
jsr common_overlay::L62C8
addr_call common_overlay::L5E0A, $DA67 ; "Copy a File ..."
addr_call common_overlay::L5E57, $DA77 ; "Source filename:"
addr_call common_overlay::L5E6F, $DA88 ; "Destination filename:"
jsr common_overlay::set_port_for_window
addr_call common_overlay::L5E0A, copy_a_file_label
addr_call common_overlay::L5E57, source_filename_label
addr_call common_overlay::L5E6F, destination_filename_label
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR ; penXOR
MGTK_RELAY_CALL MGTK::FrameRect, dialog_rect1
MGTK_RELAY_CALL MGTK::FrameRect, dialog_rect2
MGTK_RELAY_CALL MGTK::FrameRect, common_input1_rect
MGTK_RELAY_CALL MGTK::FrameRect, common_input2_rect
MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
rts
L709B: .byte $29 ; length of following data block
entry 0, L70F1
entry 0, L71D8
jt_source_filename:
.byte $29 ; length of following data block
jump_table_entry L70F1
jump_table_entry L71D8
jump_table_entry common_overlay::blink_f1_ip
jump_table_entry common_overlay::redraw_f1
jump_table_entry common_overlay::strip_f1_path_segment
jump_table_entry common_overlay::jt_handle_f1_tbd05
jump_table_entry common_overlay::prep_path_buf0
jump_table_entry common_overlay::handle_f1_other_key
jump_table_entry common_overlay::handle_f1_delete_key
jump_table_entry common_overlay::handle_f1_left_key
jump_table_entry common_overlay::handle_f1_right_key
jump_table_entry common_overlay::handle_f1_meta_left_key
jump_table_entry common_overlay::handle_f1_meta_right_key
jump_table_entry common_overlay::handle_f1_click
entry 0, $6593
entry 0, $664E
entry 0, $6DC2
entry 0, $6DD0
entry 0, $6E1D
entry 0, $69C6
entry 0, $6A18
entry 0, $6A53
entry 0, $6AAC
entry 0, $6B01
entry 0, $6B44
entry 0, $66D8
L70C6: .byte $29 ; length of following data block
entry 0, L7189
entry 0, L71F9
entry 0, $65F0
entry 0, $6693
entry 0, $6DC9
entry 0, $6DD4
entry 0, $6E31
entry 0, $6B72
entry 0, $6BC4
entry 0, $6BFF
entry 0, $6C58
entry 0, $6CAD
entry 0, $6CF0
entry 0, $684F
jt_destination_entries:
.byte $29 ; length of following data block
jump_table_entry L7189
jump_table_entry L71F9
jump_table_entry common_overlay::blink_f2_ip
jump_table_entry common_overlay::redraw_f2
jump_table_entry common_overlay::strip_f2_path_segment
jump_table_entry common_overlay::jt_handle_f2_tbd05
jump_table_entry common_overlay::prep_path_buf1
jump_table_entry common_overlay::handle_f2_other_key
jump_table_entry common_overlay::handle_f2_delete_key
jump_table_entry common_overlay::handle_f2_left_key
jump_table_entry common_overlay::handle_f2_right_key
jump_table_entry common_overlay::handle_f2_meta_left_key
jump_table_entry common_overlay::handle_f2_meta_right_key
jump_table_entry common_overlay::handle_f2_click
;;; ============================================================
L70F1: lda #1
sta path_buf2
lda #$20
sta $D485
jsr common_overlay::L6D27
sta path_buf2+1
jsr common_overlay::jt_redraw_input
ldx L70C6
: lda L70C6+1,x
sta $6D1E,x
ldx jt_destination_entries
: lda jt_destination_entries+1,x
sta common_overlay::jump_table,x
dex
lda L70C6+1,x
sta $6D1E,x
lda jt_destination_entries+1,x
sta common_overlay::jump_table,x
dex
dex
bpl :-
lda #$80
sta $50A8
sta $51AE
lda $D920
sta $D921
sta common_overlay::L50A8
sta common_overlay::L51AE
lda LD920
sta LD921
lda #$FF
sta $D920
jsr common_overlay::L5E87
sta LD920
jsr common_overlay::device_on_line
jsr common_overlay::L5F5B
jsr common_overlay::L6161
jsr common_overlay::L61B1
jsr common_overlay::L606D
ldx $5028
L7137: lda $5028,x
ldx common_overlay::path_buf
L7137: lda common_overlay::path_buf,x
sta path_buf1,x
dex
bpl L7137
addr_call common_overlay::L6129, path_buf1 ; path_buf1
lda #$01
sta path_buf2 ; path_buf2
sta path_buf2
lda #$06
sta $D485
sta path_buf2+1
ldx path_buf0
beq L7178
L7156: lda path_buf0,x
and #$7F
and #CHAR_MASK
cmp #'/'
beq L7162
dex
@ -149,11 +143,11 @@ L7165: cpx path_buf0
iny
jmp L7165
L7178: jsr common_overlay::L6D27
lda $D8F0
sta $D8F1
lda $D8F2
sta $D8F0
L7178: jsr common_overlay::jt_redraw_input
lda LD8F0
sta LD8F1
lda LD8F2
sta LD8F0
rts
.byte 0
@ -162,7 +156,7 @@ L7178: jsr common_overlay::L6D27
L7189: addr_call common_overlay::L647C, path_buf0
beq L7198
L7192: lda #$40
L7192: lda #ERR_INVALID_PATHNAME
jsr JUMP_TABLE_ALERT_0
rts
@ -170,14 +164,12 @@ L7198: addr_call common_overlay::L647C, path_buf1
bne L7192
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg
lda #0
sta $50A8
lda #0
sta $D8EC
jsr common_overlay::L55BA
copy #0, common_overlay::L50A8
copy #0, LD8EC
jsr common_overlay::set_cursor_pointer
copy16 #path_buf0, $6
copy16 #path_buf1, $8
ldx $50AA
ldx common_overlay::stash_stack
txs
return #$00
@ -188,9 +180,9 @@ L7198: addr_call common_overlay::L647C, path_buf1
L71D8: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg
lda #0
sta $D8EC
jsr common_overlay::L55BA
ldx $50AA
sta LD8EC
jsr common_overlay::set_cursor_pointer
ldx common_overlay::stash_stack
txs
return #$FF
@ -199,54 +191,54 @@ L71D8: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
L71F9: lda #1
sta path_buf2
lda #' '
sta $D485
jsr common_overlay::L6D27
ldx L709B
L7209: lda L709B+1,x
sta $6D1E,x
sta path_buf2+1
jsr common_overlay::jt_redraw_input
ldx jt_source_filename
L7209: lda jt_source_filename+1,x
sta common_overlay::jump_table,x
dex
lda L709B+1,x
sta $6D1E,x
lda jt_source_filename+1,x
sta common_overlay::jump_table,x
dex
dex
bpl L7209
lda #$01
sta path_buf2
lda #$06
sta $D485
sta path_buf2+1
lda #$00
sta $50A8
sta common_overlay::L50A8
lda #$FF
sta $D920
sta LD920
lda #$00
sta $51AE
lda $D8F0
sta $D8F2
lda $D8F1
sta $D8F0
sta common_overlay::L51AE
lda LD8F0
sta LD8F2
lda LD8F1
sta LD8F0
ldx path_buf0
: lda path_buf0,x
sta $5028,x
sta common_overlay::path_buf,x
dex
bpl :-
jsr common_overlay::L5F49
bit $D8F0
bit LD8F0
bpl L726D
jsr common_overlay::L5E87
jsr common_overlay::device_on_line
lda #0
jsr common_overlay::L6227
jsr common_overlay::L5F5B
jsr common_overlay::L6161
jsr common_overlay::L61B1
jsr common_overlay::L606D
jsr common_overlay::L6D27
jsr common_overlay::jt_redraw_input
jmp L7295
L726D: lda $5028
L726D: lda common_overlay::path_buf
bne L7281
L7272: jsr common_overlay::L5E87
L7272: jsr common_overlay::device_on_line
lda #$00
jsr common_overlay::L6227
jsr common_overlay::L5F5B
@ -254,8 +246,8 @@ L7272: jsr common_overlay::L5E87
bne L7289
L7281: jsr common_overlay::L5F5B
bcs L7272
lda $D921
L7289: sta $D920
lda LD921
L7289: sta LD920
jsr common_overlay::L6163
jsr common_overlay::L61B1
jsr common_overlay::L606D
@ -264,4 +256,5 @@ L7295: rts
;;; ============================================================
PAD_TO $7800
.endproc ; file_copy_overlay

View File

@ -1,40 +1,36 @@
.setcpu "6502"
;;; NB: Compiled as part of ovl34567.s
;;; ============================================================
;;; Overlay for File Delete
;;; ============================================================
.org $7000
.proc file_delete_overlay
.org $7000
L7000: jsr common_overlay::L5CF7
L7000: jsr common_overlay::create_common_dialog
jsr L704D
jsr common_overlay::L5E87
jsr common_overlay::device_on_line
jsr common_overlay::L5F5B
jsr common_overlay::L6161
jsr common_overlay::L61B1
jsr common_overlay::L606D
jsr L7026
jsr common_overlay::L6D30
jsr common_overlay::L6D27
jsr common_overlay::jt_prep_path
jsr common_overlay::jt_redraw_input
lda #$FF
sta $D8EC
sta LD8EC
jmp common_overlay::L5106
L7026: ldx L7086
L7029: lda L7087,x
sta $6D1E,x
L7026: ldx jt_filename
L7029: lda jt_filename+1,x
sta common_overlay::jump_table,x
dex
lda L7087,x
sta $6D1E,x
lda jt_filename+1,x
sta common_overlay::jump_table,x
dex
dex
bpl L7029
lda #$00
sta path_buf0
sta $51AE
sta common_overlay::L51AE
lda #$01
sta path_buf2
lda #$06
@ -42,45 +38,46 @@ L7029: lda L7087,x
rts
L704D: lda winfo_entrydlg
jsr common_overlay::L62C8
addr_call common_overlay::L5E0A, $DAB6 ; "Delete a File ..."
addr_call common_overlay::L5E57, $DAC8 ; "File to delete:"
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR ; penXOR
MGTK_RELAY_CALL MGTK::FrameRect, dialog_rect1
jsr common_overlay::set_port_for_window
addr_call common_overlay::L5E0A, delete_a_file_label
addr_call common_overlay::L5E57, file_to_delete_label
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::FrameRect, common_input1_rect
MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
rts
L7086: .byte $29 ; length of the following data block
L7087: entry 0, L70B1
entry 0, L70EA
entry 0, $6593
entry 0, $664E
entry 0, $6DC2
entry 0, $6DD0
entry 0, $6E1D
entry 0, $69C6
entry 0, $6A18
entry 0, $6A53
entry 0, $6AAC
entry 0, $6B01
entry 0, $6B44
entry 0, $66D8
jt_filename:
.byte $29 ; length of the following data block
jump_table_entry L70B1
jump_table_entry L70EA
jump_table_entry common_overlay::blink_f1_ip
jump_table_entry common_overlay::redraw_f1
jump_table_entry common_overlay::strip_f1_path_segment
jump_table_entry common_overlay::jt_handle_f1_tbd05
jump_table_entry common_overlay::prep_path_buf0
jump_table_entry common_overlay::handle_f1_other_key
jump_table_entry common_overlay::handle_f1_delete_key
jump_table_entry common_overlay::handle_f1_left_key
jump_table_entry common_overlay::handle_f1_right_key
jump_table_entry common_overlay::handle_f1_meta_left_key
jump_table_entry common_overlay::handle_f1_meta_right_key
jump_table_entry common_overlay::handle_f1_click
L70B1: addr_call common_overlay::L647C, path_buf0
beq L70C0
lda #$40
lda #ERR_INVALID_PATHNAME
jsr JUMP_TABLE_ALERT_0
rts
L70C0: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg
lda #0
sta $D8EC
jsr common_overlay::L55BA
sta LD8EC
jsr common_overlay::set_cursor_pointer
copy16 #path_buf0, $6
ldx $50AA
ldx common_overlay::stash_stack
txs
lda #0
rts
@ -90,13 +87,13 @@ L70C0: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
L70EA: MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg
lda #0
sta $D8EC
jsr common_overlay::L55BA
ldx $50AA
sta LD8EC
jsr common_overlay::set_cursor_pointer
ldx common_overlay::stash_stack
txs
return #$FF
;;; ============================================================
PAD_TO $7800
.endproc ; file_delete_overlay
.endproc ; file_delete_overlay

View File

@ -1,32 +1,27 @@
.setcpu "6502"
;;; NB: Compiled as part of ovl34567.s
;;; ============================================================
;;; Overlay for Selector (part of it, anyway)
;;; ============================================================
.org $7000
.proc selector_overlay
.org $7000
L7000: stx L73A9
sty L73AA
jsr common_overlay::L5CF7
jsr common_overlay::create_common_dialog
jsr L7101
jsr L70AD
jsr common_overlay::L5E87
jsr common_overlay::device_on_line
lda path_buf0
beq L7056
addr_call common_overlay::L6129, path_buf0
ldy path_buf0
L7021: lda path_buf0,y
sta $5028,y
sta common_overlay::path_buf,y
dey
bpl L7021
jsr common_overlay::L5F49
ldy path_buf0
L7030: lda path_buf0,y
cmp #$2F
cmp #'/'
beq L7044
dey
cpy #$01
@ -46,21 +41,23 @@ L7046: iny
L7056: jsr common_overlay::L5F5B
lda #$00
bcs L706A
addr_call common_overlay::L6516, $709D
sta $D920
addr_call common_overlay::L6516, L709D
sta LD920
jsr common_overlay::L6586
L706A: jsr common_overlay::L6163
jsr common_overlay::L61B1
jsr common_overlay::L606D
lda path_buf0
bne L707B
jsr common_overlay::L6D30
L707B: copy16 #$2001, $D484
jsr common_overlay::L6D27
jsr common_overlay::L6693
copy16 #$2001, $D484
jsr common_overlay::jt_prep_path
L707B: copy #1, path_buf2
copy #' ', path_buf2+1
jsr common_overlay::jt_redraw_input
jsr common_overlay::redraw_f2
copy #1, path_buf2
copy #' ', path_buf2+1
lda #$FF
sta $D8EC
sta LD8EC
jmp common_overlay::L5106
;;; ============================================================
@ -70,72 +67,67 @@ L709D: .res 16, 0
;;; ============================================================
L70AD: ldx L7207
L70B0: lda L7207+1,x
sta $6D1E,x
L70AD: ldx jt_pathname
L70B0: lda jt_pathname+1,x
sta common_overlay::jump_table,x
dex
lda L7207+1,x
sta $6D1E,x
lda jt_pathname+1,x
sta common_overlay::jump_table,x
dex
dex
bpl L70B0
lda #$00
sta $51AE
sta common_overlay::L51AE
lda #$80
sta $5104
copy16 #$0601, $D484
sta common_overlay::L5104
copy #1, path_buf2
copy #GLYPH_INSPT, path_buf2+1
lda winfo_entrydlg
jsr common_overlay::L62C8
jsr common_overlay::set_port_for_window
lda L73A9
jsr L7467
lda L73AA
jsr L747B
lda #$80
sta $5103
lda #$AB
sta $531C
lda #$73
sta $531D
lda #$F4
sta $5B24
lda #$74
sta $5B25
sta common_overlay::L5103
copy16 #L73AB, common_overlay::L531B+1
copy16 #L74F4, common_overlay::L59B9::key_meta_digit+1
rts
L7101: lda winfo_entrydlg
jsr common_overlay::L62C8
jsr common_overlay::set_port_for_window
lda path_buf0
beq L7116
addr_call common_overlay::L5E0A, $D729
addr_call common_overlay::L5E0A, edit_an_entry_label
jmp L711D
L7116: addr_call common_overlay::L5E0A, $D718
L711D: addr_call common_overlay::L5E6F, $D849
L7116: addr_call common_overlay::L5E0A, add_an_entry_label
L711D: addr_call common_overlay::L5E6F, enter_the_full_pathname_label2
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR ; penXOR
MGTK_RELAY_CALL MGTK::FrameRect, dialog_rect1
MGTK_RELAY_CALL MGTK::FrameRect, dialog_rect2
addr_call common_overlay::L5E57, $D769
addr_call common_overlay::L5E6F, $D797
MGTK_RELAY_CALL MGTK::MoveTo, $D922
addr_call common_overlay::L5DED, $D7DE
MGTK_RELAY_CALL MGTK::MoveTo, $D926
addr_call common_overlay::L5DED, $D7F6
MGTK_RELAY_CALL MGTK::MoveTo, $D92A
addr_call common_overlay::L5DED, $D802
MGTK_RELAY_CALL MGTK::MoveTo, $D92E
addr_call common_overlay::L5DED, $D814
MGTK_RELAY_CALL MGTK::MoveTo, $D932
addr_call common_overlay::L5DED, $D81F
MGTK_RELAY_CALL MGTK::MoveTo, $D936
addr_call common_overlay::L5DED, $D830
MGTK_RELAY_CALL MGTK::MoveTo, $D93A
addr_call common_overlay::L5DED, $D840
MGTK_RELAY_CALL MGTK::FrameRect, common_input1_rect
MGTK_RELAY_CALL MGTK::FrameRect, common_input2_rect
addr_call common_overlay::L5E57, enter_the_full_pathname_label1
addr_call common_overlay::L5E6F, enter_the_name_to_appear_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D922
addr_call common_overlay::draw_string, add_a_new_entry_to_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D926
addr_call common_overlay::draw_string, run_list_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D92A
addr_call common_overlay::draw_string, other_run_list_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D92E
addr_call common_overlay::draw_string, down_load_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D932
addr_call common_overlay::draw_string, at_first_boot_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D936
addr_call common_overlay::draw_string, at_first_use_label
MGTK_RELAY_CALL MGTK::MoveTo, pos_D93A
addr_call common_overlay::draw_string, never_label
MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::FrameRect, $D93E
MGTK_RELAY_CALL MGTK::FrameRect, $D946
MGTK_RELAY_CALL MGTK::FrameRect, $D94E
MGTK_RELAY_CALL MGTK::FrameRect, $D956
MGTK_RELAY_CALL MGTK::FrameRect, $D95E
MGTK_RELAY_CALL MGTK::FrameRect, rect_D93E
MGTK_RELAY_CALL MGTK::FrameRect, rect_D946
MGTK_RELAY_CALL MGTK::FrameRect, rect_D94E
MGTK_RELAY_CALL MGTK::FrameRect, rect_D956
MGTK_RELAY_CALL MGTK::FrameRect, rect_D95E
MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
rts
@ -144,62 +136,63 @@ L711D: addr_call common_overlay::L5E6F, $D849
.byte $00
L7207: .byte $29
entry 0, $725D
entry 0, $732F
entry 0, $6593
entry 0, $664E
entry 0, $6DC2
entry 0, $6DD0
entry 0, $6E1D
entry 0, $69C6
entry 0, $6A18
entry 0, $6A53
entry 0, $6AAC
entry 0, $6B01
entry 0, $6B44
entry 0, $66D8
jt_pathname: .byte $29
jump_table_entry L725D
jump_table_entry L732F
jump_table_entry common_overlay::blink_f1_ip
jump_table_entry common_overlay::redraw_f1
jump_table_entry common_overlay::strip_f1_path_segment
jump_table_entry common_overlay::jt_handle_f1_tbd05
jump_table_entry common_overlay::prep_path_buf0
jump_table_entry common_overlay::handle_f1_other_key
jump_table_entry common_overlay::handle_f1_delete_key
jump_table_entry common_overlay::handle_f1_left_key
jump_table_entry common_overlay::handle_f1_right_key
jump_table_entry common_overlay::handle_f1_meta_left_key
jump_table_entry common_overlay::handle_f1_meta_right_key
jump_table_entry common_overlay::handle_f1_click
L7232: .byte $29
entry 0, $72CD
entry 0, $736C
entry 0, $65F0
entry 0, $6693
entry 0, $6DC9
entry 0, $6DD4
entry 0, $6E31
entry 0, $6B72
entry 0, $6BC4
entry 0, $6BFF
entry 0, $6C58
entry 0, $6CAD
entry 0, $6CF0
entry 0, $684F
jt_entry_name: .byte $29
jump_table_entry L72CD
jump_table_entry L736C
jump_table_entry common_overlay::blink_f2_ip
jump_table_entry common_overlay::redraw_f2
jump_table_entry common_overlay::strip_f2_path_segment
jump_table_entry common_overlay::jt_handle_f2_tbd05
jump_table_entry common_overlay::prep_path_buf1
jump_table_entry common_overlay::handle_f2_other_key
jump_table_entry common_overlay::handle_f2_delete_key
jump_table_entry common_overlay::handle_f2_left_key
jump_table_entry common_overlay::handle_f2_right_key
jump_table_entry common_overlay::handle_f2_meta_left_key
jump_table_entry common_overlay::handle_f2_meta_right_key
jump_table_entry common_overlay::handle_f2_click
;;; ============================================================
copy16 #$2001, $D484
jsr common_overlay::L6D27
ldx L7232
L726D: lda L7232+1,x
sta $6D1E,x
L725D: copy #1, path_buf2
copy #' ', path_buf2+1
jsr common_overlay::jt_redraw_input
ldx jt_entry_name
L726D: lda jt_entry_name+1,x
sta common_overlay::jump_table,x
dex
lda L7232+1,x
sta $6D1E,x
lda jt_entry_name+1,x
sta common_overlay::jump_table,x
dex
dex
bpl L726D
lda #$80
sta $51AE
sta $5105
lda $D8F0
sta $D8F1
sta common_overlay::L51AE
sta common_overlay::L5105
lda LD8F0
sta LD8F1
lda #$00
sta $D8F0
lda $D443
sta LD8F0
lda path_buf1
bne L72BF
lda #$00
sta $D443
sta path_buf1
ldx path_buf0
beq L72BF
L72A0: lda path_buf0,x
@ -213,27 +206,28 @@ L72AD: ldy #$00
L72AF: iny
inx
lda path_buf0,x
sta $D443,y
sta path_buf1,y
cpx path_buf0
bne L72AF
sty $D443
L72BF: copy16 #$0601, $D484
jsr common_overlay::L6D27
sty path_buf1
L72BF: copy #1, path_buf2
copy #GLYPH_INSPT, path_buf2+1
jsr common_overlay::jt_redraw_input
rts
addr_call common_overlay::L647C, path_buf0
L72CD: addr_call common_overlay::L647C, path_buf0
bne L72E2
lda $D443
lda path_buf1
beq L72E7
cmp #$0F
bcs L72E8
jmp L72EE
L72E2: lda #$40
L72E2: lda #ERR_INVALID_PATHNAME
jsr JUMP_TABLE_ALERT_0
L72E7: rts
L72E8: lda #$FB
L72E8: lda #ERR_NAME_TOO_LONG
jsr JUMP_TABLE_ALERT_0
rts
@ -241,76 +235,73 @@ L72EE: MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg
sta $D8EC
jsr common_overlay::L55BA
copy16 #$59B8, $5B24
ldx $50AA
sta LD8EC
jsr common_overlay::set_cursor_pointer
copy16 #common_overlay::noop, common_overlay::L59B9::key_meta_digit+1
ldx common_overlay::stash_stack
txs
ldx L73A9
ldy L73AA
return #$00
MGTK_RELAY_CALL MGTK::InitPort, grafport3
L732F: MGTK_RELAY_CALL MGTK::InitPort, grafport3
MGTK_RELAY_CALL MGTK::SetPort, grafport3
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg_file_picker
MGTK_RELAY_CALL MGTK::CloseWindow, winfo_entrydlg
lda #$00
sta $D8EC
jsr common_overlay::L55BA
copy16 #$59B8, $5B24
ldx $50AA
sta LD8EC
jsr common_overlay::set_cursor_pointer
copy16 #common_overlay::noop, common_overlay::L59B9::key_meta_digit+1
ldx common_overlay::stash_stack
txs
return #$FF
copy16 #$2001, $D484
jsr common_overlay::L6D27
ldx L7207
L737C: lda L7207+1,x
sta $6D1E,x
L736C: copy #1, path_buf2
copy #' ', path_buf2+1
jsr common_overlay::jt_redraw_input
ldx jt_pathname
L737C: lda jt_pathname+1,x
sta common_overlay::jump_table,x
dex
lda L7207+1,x
sta $6D1E,x
lda jt_pathname+1,x
sta common_overlay::jump_table,x
dex
dex
bpl L737C
copy16 #$0601, $D484
jsr common_overlay::L6D27
copy #1, path_buf2
copy #GLYPH_INSPT, path_buf2+1
jsr common_overlay::jt_redraw_input
lda #$00
sta $5105
sta $51AE
lda $D8F1
sta $D8F0
sta common_overlay::L5105
sta common_overlay::L51AE
lda LD8F1
sta LD8F0
rts
L73A9: .byte 0
L73AA: .byte 0
MGTK_RELAY_CALL MGTK::InRect, $D966
L73AB: MGTK_RELAY_CALL MGTK::InRect, rect_D966
cmp #MGTK::inrect_inside
bne L73BB
bne :+
jmp L73FE
L73BB: MGTK_RELAY_CALL MGTK::InRect, $D96E
: MGTK_RELAY_CALL MGTK::InRect, rect_D96E
cmp #MGTK::inrect_inside
bne L73CB
bne :+
jmp L7413
L73CB: MGTK_RELAY_CALL MGTK::InRect, $D976
: MGTK_RELAY_CALL MGTK::InRect, rect_D976
cmp #MGTK::inrect_inside
bne L73DB
bne :+
jmp L7428
L73DB: MGTK_RELAY_CALL MGTK::InRect, $D97E
: MGTK_RELAY_CALL MGTK::InRect, rect_D97E
cmp #MGTK::inrect_inside
bne L73EB
bne :+
jmp L743D
L73EB: MGTK_RELAY_CALL MGTK::InRect, $D986
: MGTK_RELAY_CALL MGTK::InRect, rect_D986
cmp #MGTK::inrect_inside
bne L73FB
bne :+
jmp L7452
L73FB: return #$00
: return #0
L73FE: lda L73A9
cmp #1
@ -359,67 +350,82 @@ L7464: return #$FF
L7467: cmp #1
bne L7473
addr_call L749B, $D93E
addr_call draw_inset_rect, rect_D93E
rts
L7473: addr_call L749B, $D946
L7473: addr_call draw_inset_rect, rect_D946
rts
L747B: cmp #1
bne L7487
addr_call L749B, $D94E
addr_call draw_inset_rect, rect_D94E
rts
L7487: cmp #2
bne L7493
addr_call L749B, $D956
addr_call draw_inset_rect, rect_D956
rts
L7493: addr_call L749B, $D95E
L7493: addr_call draw_inset_rect, rect_D95E
rts
L749B: stax $06
ldy #7
L74A1: lda ($06),y
sta $D98E,y
;;; ============================================================
;;; Draw rect inset by 2px. Pointer to Rect in A,X.
.proc draw_inset_rect
ptr := $06
;; Copy to scratch rect
stax ptr
ldy #.sizeof(MGTK::Rect)-1
: lda (ptr),y
sta rect_scratch,y
dey
bpl L74A1
lda $D98E
clc
adc #2
sta $D98E
bcc L74B7
inc $D98F
L74B7: lda $D990
clc
adc #2
sta $D990
bcc L74C5
inc $D991
L74C5: lda $D992
sec
sbc #2
sta $D992
bcs L74D3
dec $D993
L74D3: lda $D994
sec
sbc #2
sta $D994
bcs L74E1
dec $D995
L74E1: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, $D98E
rts
bpl :-
lda winfo_entrydlg
jsr common_overlay::L62C8
lda $D20A
lda rect_scratch::x1
clc
adc #2
sta rect_scratch::x1
bcc :+
inc rect_scratch::x1+1
: lda rect_scratch::y1
clc
adc #2
sta rect_scratch::y1
bcc :+
inc rect_scratch::y1+1
: lda rect_scratch::x2
sec
sbc #2
sta rect_scratch::x2
bcs :+
dec rect_scratch::x2+1
: lda rect_scratch::y2
sec
sbc #2
sta rect_scratch::y2
bcs :+
dec rect_scratch::y2+1
: MGTK_RELAY_CALL MGTK::SetPenMode, penXOR
MGTK_RELAY_CALL MGTK::PaintRect, rect_scratch
rts
.endproc
;;; ============================================================
L74F4: lda winfo_entrydlg
jsr common_overlay::set_port_for_window
lda event_modifiers
bne L7500
rts
L7500: lda $D209
and #$7F
L7500: lda event_key
and #CHAR_MASK
cmp #'1'
bne L750C
jmp L73FE

View File

@ -1,49 +1,9 @@
#!/bin/bash
# Run this from the desktop directory
set -e
function cecho {
case $1 in
red) tput setaf 1 ;;
green) tput setaf 2 ;;
yellow) tput setaf 3 ;;
esac
echo -e "$2"
tput sgr0
}
function do_make {
make $MAKE_FLAGS "$1" \
&& (cecho green "make $1 good") \
|| (tput blink ; cecho red "MAKE $1 BAD" ; return 1)
}
function verify {
diff "orig/$1" "out/$2" \
&& (cecho green "diff $2 good" ) \
|| (tput blink ; cecho red "DIFF $2 BAD" ; return 1)
}
function stats {
echo "$(printf '%-10s' $1)""$(../res/stats.pl < $1)"
}
source "../res/util.sh"
#do_make clean
do_make all
COMMON="loader mgtk desktop invoker ovl1 ovl1a ovl1b ovl1c ovl2"
TARGETS="$COMMON ovl34567"
SOURCES="sys $COMMON ovl3 ovl4 ovl5 ovl6 ovl7"
# Verify original and output match
echo "Verifying diffs:"
for t in $TARGETS; do
verify "DESKTOP2_$t" "$t.built"
done;
verify "DESKTOP.SYSTEM.SYS" "sys.SYS"
# Compute stats
echo "Stats:"
for t in $SOURCES; do
stats "$t.s"
done;

39
desktop/res/package.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
# Use Cadius to create a disk image for distribution
# https://github.com/mach-kernel/cadius
set -e
CADIUS="${CADIUS:-$HOME/dev/cadius/bin/release/cadius}"
PACKDIR="out/package"
FINFO="$PACKDIR/_FileInformation.txt"
IMGFILE="out/DeskTop.po"
VOLNAME="A2.DESKTOP"
mkdir -p "$PACKDIR"
# Prepare _FileInformation.txt file with extra ProDOS file entry data
# and copy renamed files into package directory.
cat > "$FINFO" <<EOF
DESKTOP.SYSTEM=Type(FF),AuxType(0),VersionCreate(00),MinVersion(B9),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
DESKTOP2=Type(F1),AuxType(0),VersionCreate(00),MinVersion(B9),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
EOF
cp "../desktop.system/out/desktop.system.SYS" "$PACKDIR/DESKTOP.SYSTEM"
cp "out/DESKTOP2.built" "$PACKDIR/DESKTOP2"
# Create a new disk image.
$CADIUS CREATEVOLUME $IMGFILE $VOLNAME 143KB
# Add the files into the disk image.
for file in DESKTOP.SYSTEM DESKTOP2; do
$CADIUS ADDFILE $IMGFILE "/$VOLNAME" $PACKDIR/$file
done
# Add an empty folder for desk accessories (which are on a separate disk).
$CADIUS CREATEFOLDER $IMGFILE "/$VOLNAME/DESK.ACC"

View File

@ -29,7 +29,7 @@ syntax details.
lda value
cmp #limit ; less than the limit?
bcc less ; yes, so go do that
rol $1234 ; what does this do ???
```
@ -63,6 +63,16 @@ cases, e.g. `HideCursor`, `HideCursorImpl`, etc.
: rts
```
* **Do** use [cheap local labels](https://cc65.github.io/doc/ca65.html#ss6.5)
to higlight repeated patterns. For example, retries:
```asm
@retry: MLI_CALL GET_FILE_INFO, params
beq :+
jsr show_error_alert
jmp @retry
```
## Literals
* Use binary `%00110110` for bit patterns
@ -72,6 +82,7 @@ cases, e.g. `HideCursor`, `HideCursorImpl`, etc.
* Avoid magic numbers where possible:
* Define local variables (e.g. `ptr := $06`)
* Define offsets, constants, etc.
* Use `.struct` definitions to define offsets into structures
* Use math where necessary (e.g. `ldy #offset2 - offset1`)
* Use `.sizeof()` (or math if needed) rather than hardcoding sizes
@ -120,7 +131,7 @@ start: lda ptr
* Macro use is **encouraged**.
* Use local macros to avoid repeating code.
* Use `macros.inc` and extend as needed to capture patterns such as
* Use `inc/macros.inc` and extend as needed to capture patterns such as
16-bit operations
* API calls such as ProDOS MLI calls should be done with macros
@ -151,20 +162,23 @@ well in the future.
## Self-modifying code
* Add a label for the value being modified (byte or address)
* Add a label for the value being modified (byte or address). Use
[cheap local labels](https://cc65.github.io/doc/ca65.html#ss6.5) via the
`@`-prefix where possible so make self-modification references more
visible.
```asm
sta jump_addr
stx jump_addr+1
jump_addr := *+1
sta @jump_addr
stx @jump_addr+1
@jump_addr := *+1
jmp $0000
```
```asm
sty count
sty @count
ldy #0
: sta table,y
iny
count := *+1
cpy #count
@count := *+1
cpy #00
bne :-
```

View File

@ -7,17 +7,24 @@ with the keyboard.
▲ = Solid Apple
## Mouse Keys
* To enter Mouse Keys mode, hold down △ and then press and release ▲.
* While holding △ down, you can you can navigate the cursor with the Arrow keys, and click using ▲.
* To exit Mouse Keys mode, release △.
## Windows
* △-W - Activate window; Left/Right Arrows to navigate
* △-G - Resize window; Arrows to resize, Return to finish
* △-M - Move window; Arrows to move, Return to finish
* △-X - Scroll contents; Arrows to scroll, Esc or Return when done
* △-` or △-Tab - Cycle through open windows
## Icons
* △-H - Highlight icon; Left/Right Arrows to navigate, Esc or Return when done
* △-A - Select all icons
* △-Delete - Delete selected icons (or eject volume)
## Menus
@ -28,25 +35,24 @@ with the keyboard.
__File Menu__
* △-F - New Folder
* △-O - Open
* △-C - Close
* △-B - Close All
* △-W - Close
* △-A - Select All
* △-I - Get Info
* △-Y - Copy a File
* △-D - Delete a File
* △-E - Eject
* △-Q - Quit
__View Menu__
* △-J - View By Icon
* △-J - View As Icons
* △-N - View By Name
* △-T - View By Date
* △-K - View By Size
* △-L - View By Type
__Special Menu__
* △-E - Eject Disk
* △-S - Format a Disk
* △-Z - Erase a Disk
* △-I - Get Info
__Selector Menu__
* △-0 - Run Selector

8
docs/Known_Issues.md Normal file
View File

@ -0,0 +1,8 @@
# ProDOS Related
* Certain features are known to fail with versions of ProDOS before 1.1. Booting with a newer version is recommended.
# Hardware Specific
* The M0100 mouse is known to have compatibility issues with the //c and IIc+ where the mouse may not be detected, or one axis may stop being measured. This is due to a hardware problem affecting only some mice with that model number. Mice with models starting with A2 should function correctly. (This problem is not specific to Apple II DeskTop.) [More details](https://mirrors.apple2.org.za/ground.icaen.uiowa.edu/MiscInfo/Hardware/mouse.iic)

30
docs/Tips_And_Tricks.md Normal file
View File

@ -0,0 +1,30 @@
△ = Open Apple
▲ = Solid Apple
# Undiscoverable Features
* When dragging a selection of files to a destination on the same volume, the files will be moved by default. Hold down **△** before letting go of the mouse button to force a copy instead. Files dragged to a different volume will always be copied.
* Hold down **△** when launching `DESKTOP.SYSTEM` to prevent DeskTop from being copied to a RAM card. (A tip is now shown for this while copying.)
* Desk Accessory files with high bit set in the aux type field ($8640) will not appear in the Apple menu.
* You can't run a Binary file by double-clicking, but you can run it with the **△O** shortcut or holding down **△** or **▲** while selecting **File > Open**.
* The Sort Directory desk accessory has two modes:
* If any files are selected, these are moved to the start of the directory listing, in selection order; other files appear after, order unchanged.
* If no files are selected, all files are sorted by type: DIR, then TXT, then SYS, then others in descending (numeric) order.
* Hold down **△** or **▲** when opening a folder using double-click or **File > Open** to close the parent folder.
* Note: Does not work with the **△O** shortcut.
* The Control Panel desk accessory writes settings back to the `DESKTOP2` file when it is closed. If it is not present, or is locked, the settings will not be saved for the next session.
# File Types
* Binary files (type $06) with aux type $2000 or $4000 are treated as Graphics files (HR/DHR)
* Binary files (type $06) with aux type $5800 are treated as Graphics files (Minipix/Print Shop)
* Desk Accessory files have type $F1, and auxtype $640 or $8640
# Secrets and Mysteries
* The Calculator desk accessory has a tiny monogram resembling "JB" drawn in the title bar - possibly "J. Bernard" thanked in the credits?
* The string "Rien" appears in a couple of places in the code. Is this a name?
* In the "This Apple" desk accessory, type **E** to see what other Apple models look like.

3
inc/README.md Normal file
View File

@ -0,0 +1,3 @@
## `pdload.dat`
ProDOS Loader blocks, used when formatting a disk.

View File

@ -29,6 +29,8 @@ SHADOW := $C035 ; IIgs - inhibit shadowing
AN3_ON := $C05F ; AppleColor Adapter Card / Le Chat Mauve
AN3_OFF := $C05E
BUTN2 := $C063
RAMWORKS_BANK := $C071 ; RAMWorks bank selection ???
HR1_ON := $C0B3
@ -45,6 +47,7 @@ HR3_OFF := $C0B6
;;; Monitor
INIT := $FB2F
SETPWRC := $FB6F
VERSION := $FBB3
BELL1 := $FBDD
VTAB := $FC22
@ -52,6 +55,7 @@ VTABZ := $FC24
HOME := $FC58
PRBYTE := $FDDA
COUT := $FDED
MOVE := $FE2C
SETKBD := $FE89
SETVID := $FE93
MONZ := $FF69
@ -61,9 +65,11 @@ F8VERSION := $06
;;; Miscellaneous
IRQ_VECTOR := $3FE
ID_BYTE_FB1E := $FB1E ; $AC = Laser 128
ID_BYTE_FBB3 := $FBB3 ; $06 = IIe or later
ID_BYTE_FBC0 := $FBC0 ; $EA = IIe, $E0 = IIe enh/IIgs, $00 = IIc/IIc+
ID_BYTE_FE1F := $FE1F ; RTS ($60) on pre-IIgs
ID_BYTE_FBBF := $FBBF ; IIc ROM version ($05 = IIc+)
ID_BYTE_FE1F := $FE1F ; RTS ($60) on pre-IIgs, clears carry on IIgs
;;; ============================================================
@ -74,6 +80,7 @@ ID_BYTE_FE1F := $FE1F ; RTS ($60) on pre-IIgs
LINNUM := $50 ; Line number, unsigned word
ERRFLG := $D8
CHRGET := $B1 ; Routine called by ROM
TXTPTR := $B8
FAC := $9D
SHIFT_SIGN_EXT := $A4 ; Zero before using FP ops
@ -152,6 +159,7 @@ ALTZPON := $C009
CLR80VID := $C00C
SET80VID := $C00D
RDALTZP := $C016
RD80STORE := $C018
RDPAGE2 := $C01C
@ -162,6 +170,9 @@ HIRESOFF := $C057
DHIRESON := $C05E
DHIRESOFF := $C05F
PADDL0 := $C064
PTRIG := $C070
;;; Routines
SLOT3ENTRY := $C300
AUXMOVE := $C311 ; carry set main>aux, carry clear aux>main
@ -178,6 +189,29 @@ DESTINATIONHI := $43
;;; Other Locations
XFERSTARTLO := $03ED
XFERSTARTHI := $03EE
RESETVEC := $03F2
;;; ============================================================
;;; Disk II / IWM I/O locations
;;; ============================================================
;;; $C0nX, n = slot + 8 -- c/o http://archive.li/ewHUL
PHASE0 := $C080 ; Stepper motor phase 0
PHASE1 := $C082 ; Stepper motor phase 1
PHASE2 := $C084 ; Stepper motor phase 2
PHASE3 := $C086 ; Stepper motor phase 3
DISABLE := $C088 ; Turn disk drive off
ENABLE := $C089 ; Turn disk drive on
SELECT := $C08A ; Select drive 1 or 2
SELECT1 := $C08A ; Select drive 1
SELECT2 := $C08B ; Select drive 2
XMIT := $C08C ; Get/set bits to/from disk
TESTWP := $C08D ; Test WP mode (then WPRES has result)
DATA := $C08D ; Write data to buffer (then XMIT to send)
WPRES := $C08E ; WP mode test result
RDMODE := $C08E ; Turn off write mode
WRMODE := $C08F ; Turn on write mode
;;; ============================================================
@ -186,24 +220,24 @@ XFERSTARTHI := $03EE
;;; Firmware Routines
SETMOUSE := $12
SERVEMOUSE := $13
READMOUSE := $14
CLEARMOUSE := $15
POSMOUSE := $16
CLAMPMOUSE := $17
HOMEMOUSE := $18
INITMOUSE := $19
SETMOUSE = $12
SERVEMOUSE = $13
READMOUSE = $14
CLEARMOUSE = $15
POSMOUSE = $16
CLAMPMOUSE = $17
HOMEMOUSE = $18
INITMOUSE = $19
;;; Constants
CLAMP_X := 0
CLAMP_Y := 1
CLAMP_X = 0
CLAMP_Y = 1
MOUSE_MODE_OFF := $00
MOUSE_MODE_TRANS:= $01
MOUSE_MODE_INT := $03
MOUSE_MODE_BTN := $05
MOUSE_MODE_OFF = $00
MOUSE_MODE_TRANS= $01
MOUSE_MODE_INT = $03
MOUSE_MODE_BTN = $05
;;; RAM Locations
@ -227,11 +261,16 @@ MOUSE_MODE := $0738
;;; Character Constants (Screen/Key Codes)
;;; ============================================================
CHAR_LEFT := $08
CHAR_TAB := $09
CHAR_DOWN := $0A
CHAR_UP := $0B
CHAR_RETURN := $0D
CHAR_RIGHT := $15
CHAR_ESCAPE := $1B
CHAR_DELETE := $7F
CHAR_MASK = $7F
CASE_MASK = $DF
CHAR_CTRL_C = $03
CHAR_LEFT = $08
CHAR_TAB = $09
CHAR_DOWN = $0A
CHAR_UP = $0B
CHAR_RETURN = $0D
CHAR_CTRL_O = $0F
CHAR_RIGHT = $15
CHAR_ESCAPE = $1B
CHAR_DELETE = $7F

View File

@ -4,6 +4,7 @@
.define _is_immediate(arg) (.match (.mid (0, 1, {arg}), #))
.define _is_register(arg) (.match ({arg}, x) .or .match ({arg}, y))
.define _is_y_register(arg) (.match ({arg}, y))
.define _immediate_value(arg) (.right (.tcount ({arg})-1, {arg}))
.macro _op_lo op, arg
@ -22,16 +23,40 @@
.endif
.endmacro
;;; ============================================================
;;; Length-prefixed string
;;;
;;; Can include control chars by using:
;;;
;;; PASCAL_STRING {"abc",$0D,"def"}
.macro PASCAL_STRING str,res
.local data
.local end
.byte end - data
data: .byte str
end:
.if .paramcount > 1
.res res - (end - data), 0
.endif
.endmacro
;;; ============================================================
;;; Pad with zeros to the given address
.macro PAD_TO addr
.res addr - *, 0
.if (addr - *) >= 0
.res addr - *
.else
.error .sprintf("Padding offset %d", addr - *)
.endif
.endmacro
;;; ============================================================
;;; Common patterns
.define AS_BYTE(arg) arg & $FF
.define AS_WORD(arg) arg & $FFFF
@ -41,9 +66,23 @@
.endmacro
.macro copy arg1, arg2
.macro copy arg1, arg2, arg3, arg4
.if _is_register {arg2} && _is_register {arg4}
;; indexed load/indexed store
lda arg1,arg2
sta arg3,arg4
.elseif _is_register {arg2}
;; indexed load variant (arg2 is x or y)
lda arg1,arg2
sta arg3
.elseif _is_register {arg3}
;; indexed store variant (arg3 is x or y)
lda arg1
sta arg2,arg3
.else
lda arg1
sta arg2
.endif
.endmacro
;;; ============================================================
@ -68,15 +107,7 @@
.endmacro
;;; ============================================================
;;; Calls with two paramters (call # in y, address in A,X)
;;; (various output orders to match original binary)
.macro axy_call target, yparam, addr
lda #<addr
ldx #>addr
ldy #yparam
jsr target
.endmacro
;;; Calls with two parameters (call # in y, address in A,X)
.macro yax_call target, yparam, addr
ldy #yparam
@ -85,17 +116,10 @@
jsr target
.endmacro
.macro yxa_call target, yparam, addr
.macro yax_jump target, yparam, addr
ldy #yparam
ldx #>addr
lda #<addr
jsr target
.endmacro
.macro yxa_jump target, yparam, addr
ldy #yparam
ldx #>addr
lda #<addr
jmp target
.endmacro
@ -134,6 +158,13 @@
stx arg+1
.endmacro
;;; Store X,Y
;;; stxy $1234 ; absolute
.macro stxy arg
stx arg
sty arg+1
.endmacro
;;; Core for add16/sub16
.macro _addsub16 op, opc, arg1, arg2, arg3, arg4, arg5, arg6
.if _is_register {arg2} && _is_register {arg4} && _is_register {arg6}
@ -282,6 +313,79 @@
.endif
.endmacro
;;; Core for add16in/sub16in
.macro _addsub16in op, opc, arg1, arg2, arg3, arg4, arg5, arg6
.if _is_y_register {arg2} && _is_y_register {arg4} && _is_y_register {arg6}
;; xxx16in $1111,y, $2222,y, $3333,y
lda (arg1),y
opc
op (arg3),y
sta (arg5),y
iny
lda (arg1),y
op (arg3),y
sta (arg5),y
.elseif _is_y_register {arg2} && _is_y_register {arg4}
;; xxx16in $1111,y, $2222,y, $3333
lda (arg1),y
opc
op (arg3),y
sta arg5
iny
lda (arg1),y
op (arg3),y
sta arg5+1
.elseif _is_y_register {arg2} && _is_y_register {arg5}
;; xxx16in $1111,y, $2222, $3333,y
;; xxx16in $1111,y, #$2222, $3333,y
lda (arg1),y
opc
_op_lo op, {arg3}
sta (arg4),y
iny
lda (arg1),y
_op_hi op, {arg3}
sta (arg4),y
.elseif _is_y_register {arg2}
;; xxx16in $1111,x, $2222, $3333
;; xxx16in $1111,x, #$2222, $3333
lda (arg1),y
opc
_op_lo op, {arg3}
sta arg4
iny
lda (arg1),y
_op_hi op, {arg3}
sta arg4+1
.elseif _is_y_register {arg3}
;; xxx16in $1111, $2222,y $3333
;; xxx16in #$1111, $2222,y $3333
_op_lo lda, {arg1}
opc
op (arg2),y
sta arg4
iny
_op_hi lda, {arg1}
op (arg2),y
sta arg4+1
.elseif _is_y_register {arg4}
;; xxx16in $1111, $2222, $3333,y
;; xxx16in #$1111, $2222, $3333,y
;; xxx16in $1111, #$2222, $3333,y
;; xxx16in #$1111, #$2222, $3333,y
_op_lo lda, {arg1}
opc
_op_lo op, {arg2}
sta (arg3),y
iny
_op_hi lda, {arg1}
_op_hi op, {arg2}
sta (arg3),y
.else
.error "Indirect indexed required at least one use of y reg"
.endif
.endmacro
;;; Add arg1 to arg2, store to arg3
;;; add16 $1111, $2222, $3333 ; absolute, absolute, absolute
;;; add16 $1111, #$2222, $3333 ; absolute, immediate, absolute
@ -297,6 +401,10 @@
.macro add16lc arg1, arg2, arg3, arg4, arg5, arg6
_addsub16lc adc, clc, arg1, arg2, arg3, arg4, arg5, arg6
.endmacro
;;; (as above, but indirect indexed, y register is incremented)
.macro add16in arg1, arg2, arg3, arg4, arg5, arg6
_addsub16in adc, clc, arg1, arg2, arg3, arg4, arg5, arg6
.endmacro
;;; Add arg1 (absolute) to arg2 (8-bit absolute), store to arg3
@ -341,6 +449,10 @@
.macro sub16lc arg1, arg2, arg3, arg4, arg5, arg6
_addsub16lc sbc, sec, arg1, arg2, arg3, arg4, arg5, arg6
.endmacro
;;; (as above, but indirect indexed, y register incremented)
.macro sub16in arg1, arg2, arg3, arg4, arg5, arg6
_addsub16in sbc, sec, arg1, arg2, arg3, arg4, arg5, arg6
.endmacro
;;; Subtract arg2 from arg1, store to arg3
;;; sub16_8 #$1111, #$22, $3333 ; immediate, immediate, absolute
@ -391,6 +503,40 @@
.endif
.endmacro
;;; Copy 16-bit value, indexed indirect, y register incremented
;;; copy16in #$1111, ($2222),y ; immediate load, indexed indirect store
;;; copy16in $1111, ($2222),y ; absolute load, indexed indirect store
;;; copy16in ($1111),y, $2222 ; indexed indirect load, absolute store
;;; copy16in ($1111),y ($2222),y ; indexed indirect load, indexed indirect store
.macro copy16in arg1, arg2, arg3, arg4
.if _is_y_register {arg2} && _is_y_register {arg4}
;; copy16in ($1111),y, ($2222),y
lda (arg1),y
sta (arg3),y
iny
lda (arg1),y
sta (arg3),y
.elseif _is_y_register {arg2}
;; copy16in ($1111),y, $2222
lda (arg1),y
sta arg3
iny
lda (arg1),y
sta arg3+1
.elseif _is_y_register {arg3}
;; copy16in #$1111, ($2222),y
;; copy16in $1111, ($2222),y
_op_lo lda, {arg1}
sta (arg2),y
iny
_op_hi lda, {arg1}
sta (arg2),y
.else
.error "Indirect indexed required at least one use of y reg"
.endif
.endmacro
;;; Compare 16-bit values
;;; cmp16 #$1111, #$2222 ; immediate, immediate (silly, but supported)
;;; cmp16 #$1111, $2222 ; immediate, absolute
@ -450,6 +596,10 @@ skip:
skip: dec arg
.endmacro
;;; ============================================================
;;; Param Blocks
;;; ============================================================
;;; Helper macros to set up a scoped block of parameters at a pre-determined
;;; address.
;;;
@ -484,3 +634,172 @@ skip: dec arg
.org saved_org
.endscope
.endmacro
;;; ============================================================
;;; Structure Helpers
;;; ============================================================
.macro COPY_BYTES size, src, dst
.scope
ldx #size - 1
loop: lda src,x
sta dst,x
dex
bpl loop
.endscope
.endmacro
.macro COPY_STRUCT type, src, dst
COPY_BYTES .sizeof(type), src, dst
.endmacro
.macro COPY_BLOCK block, dst
COPY_BYTES .sizeof(block), block, dst
.endmacro
.macro COPY_STRING src, dst
.scope
ldx src
loop: lda src,x
sta dst,x
dex
bpl loop
.endscope
.endmacro
;;; ============================================================
;;; Placed Procedures
;;; ============================================================
;;; Usage:
;;; PROC_AT relocated_proc, $300
;;; .assert * = $300, ...
;;; ...
;;; END_PROC_AT
;;; .assert * = back to normal
.macro PROC_AT name, addr
.proc name
saved_org := *
.org addr
.proc __inner__
.endmacro
.macro END_PROC_AT
.endproc ; __inner__
.org saved_org + .sizeof(__inner__)
.endproc
.endmacro
;;; ============================================================
;;; Temporary org change, for relocated routines
;;; ============================================================
__pushorg_depth__ .set 0
.macro pushorg addr
::__pushorg_depth__ .set ::__pushorg_depth__ + 1
.ident(.sprintf("__pushorg_saved__%d", ::__pushorg_depth__)) := *
.org addr
.ident(.sprintf("__pushorg_start__%d", ::__pushorg_depth__)) := *
.endmacro
.macro poporg
.org .ident(.sprintf("__pushorg_saved__%d", ::__pushorg_depth__)) + (* - .ident(.sprintf("__pushorg_start__%d", ::__pushorg_depth__)))
::__pushorg_depth__ .set ::__pushorg_depth__ - 1
.endmacro
;;; ============================================================
;;; Flow Control
;;; ============================================================
;;; Usage:
;;; lda foo
;;; cmp bar
;;; IF_EQ
;;; ...
;;; ELSE ; optional
;;; ...
;;; END_IF
;;;
;;; Macros:
;;; IF_EQ aliases: IF_ZERO
;;; IF_NE aliases: IF_NOT_ZERO
;;; IF_CC aliases: IF_LT
;;; IF_CS aliases: IF_GE
;;; IF_PLUS
;;; IF_MINUS aliases: IF_NEG
__depth__ .set 0
.macro IF_EQ
::__depth__ .set ::__depth__ + 1
.scope
bne .ident(.sprintf("__else__%d", ::__depth__))
.endmacro
.macro IF_NE
::__depth__ .set ::__depth__ + 1
.scope
beq .ident(.sprintf("__else__%d", ::__depth__))
.endmacro
.macro IF_CC
::__depth__ .set ::__depth__ + 1
.scope
bcs .ident(.sprintf("__else__%d", ::__depth__))
.endmacro
.macro IF_CS
::__depth__ .set ::__depth__ + 1
.scope
bcc .ident(.sprintf("__else__%d", ::__depth__))
.endmacro
.macro IF_PLUS
::__depth__ .set ::__depth__ + 1
.scope
bmi .ident(.sprintf("__else__%d", ::__depth__))
.endmacro
.macro IF_MINUS
::__depth__ .set ::__depth__ + 1
.scope
bpl .ident(.sprintf("__else__%d", ::__depth__))
.endmacro
.define IF_ZERO IF_EQ
.define IF_NOT_ZERO IF_NE
.define IF_GE IF_CS
.define IF_LT IF_CC
.define IF_NEG IF_MINUS
;;; --------------------------------------------------
.macro ELSE
jmp .ident(.sprintf("__endif__%d", ::__depth__))
.ident(.sprintf("__else__%d", ::__depth__)) := *
.endmacro
.macro ELSE_IF
.error "ELSE_IF not supported"
.endmacro
.macro ELSEIF
.error "ELSEIF not supported"
.endmacro
;;; --------------------------------------------------
.macro END_IF
.if .not(.defined(.ident(.sprintf("__else__%d", ::__depth__))))
.ident(.sprintf("__else__%d", ::__depth__)) := *
.endif
.ident(.sprintf("__endif__%d", ::__depth__)) := *
.endscope
::__depth__ .set ::__depth__ - 1
.endmacro
.macro ENDIF
.error "Do you mean END_IF ?"
.endmacro

View File

@ -6,11 +6,14 @@
;;; Entry point / Global Page
MLI := $BF00 ; Entry point
DATETIME := $BF06 ; JMP to clock routine
DEVADR := $BF10 ; Device driver addresses ($BF10-$BF2F)
NODEV := $BF10 ; "No Device Connected" entry (slot 0)
DEVNUM := $BF30 ; Most recent accessed device
DEVCNT := $BF31 ; Number of on-line devices minus 1
DEVLST := $BF32 ; Up to 14 units
DEVLST := $BF32 ; Up to 14 units ($BF32-$BF3F)
BITMAP := $BF58 ; System memory bitmap
BITMAP_SIZE := $18 ; Bits for pages $00 to $BF
BITMAP_SIZE = $18 ; Bits for pages $00 to $BF
DATELO := $BF90 ; Date lo
DATEHI := $BF91 ; Date hi
TIMELO := $BF92 ; Time lo
@ -24,53 +27,56 @@ KVERSION := $BFFF ; ProDOS Kernel Version
;;; Patch Locations
SELECTOR := $D100
BLOCK_SIZE := $200
BLOCK_SIZE = $200
;;; ============================================================
;;; MLI Calls
;;; ============================================================
;;; Housekeeping Calls
CREATE := $C0
DESTROY := $C1
RENAME := $C2
SET_FILE_INFO := $C3
GET_FILE_INFO := $C4
ON_LINE := $C5
SET_PREFIX := $C6
GET_PREFIX := $C7
CREATE = $C0
DESTROY = $C1
RENAME = $C2
SET_FILE_INFO = $C3
GET_FILE_INFO = $C4
ON_LINE = $C5
SET_PREFIX = $C6
GET_PREFIX = $C7
;;; Filing Calls
OPEN := $C8
NEWLINE := $C9
READ := $CA
WRITE := $CB
CLOSE := $CC
FLUSH := $CD
SET_MARK := $CE
GET_MARK := $CF
SET_EOF := $D0
GET_EOF := $D1
SET_BUF := $D2
GET_BUF := $D3
OPEN = $C8
NEWLINE = $C9
READ = $CA
WRITE = $CB
CLOSE = $CC
FLUSH = $CD
SET_MARK = $CE
GET_MARK = $CF
SET_EOF = $D0
GET_EOF = $D1
SET_BUF = $D2
GET_BUF = $D3
;;; System Calls
GET_TIME := $82
ALLOC_INTERRUPT := $40
DEALLOC_INTERRUPT := $41
QUIT := $65
GET_TIME = $82
ALLOC_INTERRUPT = $40
DEALLOC_INTERRUPT = $41
QUIT = $65
;;; Direct Disk Access Commands
READ_BLOCK := $80
WRITE_BLOCK := $81
READ_BLOCK = $80
WRITE_BLOCK = $81
;;; ============================================================
;;; Device Types (low nibble of unit number in DEVLST)
;;; ============================================================
DT_DISKII := $0
DT_PROFILE := $4
DT_RAM := $F
;;; As used by DeskTop; these are not actually correct...
DT_DISKII = $0
DT_PROFILE = $4
DT_REMOVABLE = $B
DT_RAM = $F
;;; See ProDOS Tech Note #21 - other than the above types, there
;;; is not an "ID nibble". The nibble is a copy of $CnFE's high
@ -84,48 +90,81 @@ DT_RAM := $F
;;; File Types
;;; ============================================================
FT_TYPELESS := $00
FT_BAD := $01
FT_TEXT := $04
FT_BINARY := $06
FT_DIRECTORY := $0F
FT_SRC := $B0 ; IIgs system type; re-used?
FT_S16 := $B3 ; IIgs Application Program
FT_BASIC := $FC
FT_SYSTEM := $FF
FT_TYPELESS = $00
FT_BAD = $01
FT_TEXT = $04 ; ASCII Text File *
FT_BINARY = $06 ; Generic Binary File *
FT_FONT = $07 ; Font File
FT_GRAPHICS = $08 ; Graphics File
FT_DIRECTORY = $0F ; Directory *
FT_ADB = $19 ; AppleWorks Database *
FT_AWP = $1A ; AppleWorks Word Processing *
FT_ASP = $1B ; AppleWorks Spreadsheet *
FT_SRC = $B0 ; IIgs system type; re-used?
FT_S16 = $B3 ; IIgs Application Program
FT_PAS = $EF ; Pascal Area *
FT_CMD = $F0 ; ProDOS Command File *
FT_INT = $FA ; Integer BASIC Program *
FT_IVR = $FB ; Integer BASIC Variable File *
FT_BASIC = $FC ; Applesoft BASIC Program *
FT_VAR = $FD ; Applesoft BASIC Variable File *
FT_REL = $FE ; EDASM/Contiki Relocatable File *
FT_SYSTEM = $FF ; ProDOS System File *
;;; Types marked with * are known to BASIC.SYSTEM and have an
;;; associated three-letter abbreviation.
;;; ============================================================
;;; Access
;;; ============================================================
ACCESS_DEFAULT := %11000011
ACCESS_DEFAULT = %11000011
ACCESS_LOCKED = %00100001
;;; ============================================================
;;; Storage Types
;;; ============================================================
ST_STANDARD_FILE := $01
ST_LINKED_DIRECTORY := $0D
ST_VOLUME_DIRECTORY := $0F
ST_STANDARD_FILE = $01
ST_LINKED_DIRECTORY = $0D
ST_VOLUME_DIRECTORY = $0F
;;; ============================================================
;;; Errors
;;; ============================================================
ERR_PATH_NOT_FOUND := $44
ERR_VOL_NOT_FOUND := $45
ERR_FILE_NOT_FOUND := $46
ERR_DUPLICATE_FILENAME:= $47
ERR_OVERRUN_ERROR := $48
ERR_VOLUME_DIR_FULL := $49
ERR_END_OF_FILE := $4C
ERR_DEVICE_NOT_CONNECTED = $28
ERR_WRITE_PROTECTED = $2B
ERR_INVALID_PATHNAME = $40
ERR_INVALID_REFERENCE = $43
ERR_PATH_NOT_FOUND = $44
ERR_VOL_NOT_FOUND = $45
ERR_FILE_NOT_FOUND = $46
ERR_DUPLICATE_FILENAME= $47
ERR_OVERRUN_ERROR = $48
ERR_VOLUME_DIR_FULL = $49
ERR_END_OF_FILE = $4C
ERR_ACCESS_ERROR = $4E
ERR_DUPLICATE_VOLUME = $57
ERR_NETWORK_ERROR = $88
;;; ============================================================
;;; Misc Structures
;;; ============================================================
.struct DateTime
datelo .byte
datehi .byte
timelo .byte
timehi .byte
.endstruct
;;; ============================================================
;;; Directory Structures
;;; ============================================================
STORAGE_TYPE_MASK := $F0
NAME_LENGTH_MASK := $0F
STORAGE_TYPE_MASK = $F0
NAME_LENGTH_MASK = $0F
;;; Volume Directory Header structure
.struct VolumeDirectoryHeader
@ -190,6 +229,22 @@ NAME_LENGTH_MASK := $0F
.endstruct
.assert .sizeof(FileEntry) = $27, error, "incorrect struct size"
;;; ============================================================
;;; ProDOS Driver Protocol
;;; ============================================================
;;; Addresses for command parameters
DRIVER_COMMAND := $42
DRIVER_UNIT_NUMBER := $43
DRIVER_BUFFER := $44
DRIVER_BLOCK_NUMBER := $46
;;; Commands
DRIVER_COMMAND_STATUS = 0
DRIVER_COMMAND_READ = 1
DRIVER_COMMAND_WRITE = 2
DRIVER_COMMAND_FORMAT = 3
;;; ============================================================
;;; Macros
@ -201,18 +256,6 @@ NAME_LENGTH_MASK := $0F
.addr addr
.endmacro
.macro PASCAL_STRING str,res ; Length-prefixed string
.local data ; Can include control chars by using:
.local end ; PASCAL_STRING {"abc",$0D,"def"}
.byte end - data
data: .byte str
end:
.if .paramcount > 1
.res res - (end - data), 0
.endif
.endmacro
.macro DEFINE_OPEN_PARAMS name, pn, io, rn
.if .xmatch(.string(pn), "pathname")
;; If 'pathname' is passed then expansion yields a circular reference.
@ -343,16 +386,16 @@ int_num: .byte 0
.endproc
.endmacro
.macro DEFINE_QUIT_PARAMS name, arg1, arg2
.macro DEFINE_QUIT_PARAMS name, ext, pathname
.proc name
param_count: .byte 4
.ifnblank arg1
.byte arg1
.ifnblank ext
.byte ext
.else
.byte 0
.endif
.ifnblank arg2
.word arg2
.ifnblank pathname
.word pathname
.else
.word 0
.endif

View File

@ -342,6 +342,13 @@ Parameters:
# Mouse Graphics
## Mouse Keys
* To enter Mouse Keys mode, hold down the Open-Apple key and then press and release the Solid-Apple key.
* While holding the Open-Apple key down, you can you can navigate the cursor with the Arrow keys, and click using the Solid-Apple key.
* To exit Mouse Keys mode, release the Open-Apple key.
## Concepts
### Cursor
@ -378,16 +385,16 @@ otherwise:
```
```
event_kind_no_event := 0 ; No mouse or keypress
event_kind_button_down := 1 ; Mouse button was depressed
event_kind_button_up := 2 ; Mouse button was released
event_kind_key_down := 3 ; Key was pressed
event_kind_drag := 4 ; Mouse button still down
event_kind_apple_key := 5 ; Mouse button was depressed, modifier key down
event_kind_update := 6 ; Window update needed
event_kind_no_event = 0 ; No mouse or keypress
event_kind_button_down = 1 ; Mouse button was depressed
event_kind_button_up = 2 ; Mouse button was released
event_kind_key_down = 3 ; Key was pressed
event_kind_drag = 4 ; Mouse button still down
event_kind_apple_key = 5 ; Mouse button was depressed, modifier key down
event_kind_update = 6 ; Window update needed
event_modifier_open_apple := 1 << 0
event_modifier_solid_apple := 1 << 1
event_modifier_open_apple = 1 << 0
event_modifier_solid_apple = 1 << 1
```
### Menu
@ -431,8 +438,8 @@ Menu record:
.byte status
.byte reserved
.word mincontwidth minimum content size (horizontal)
.word maxcontwidth maximum content size (horizontal)
.word mincontlength minimum content size (vertical)
.word maxcontwidth maximum content size (horizontal)
.word maxcontlength maximum content size (vertical)
GrafPort windowport GrafPort record
.addr nextwinfo address of next lower window in stack
@ -443,15 +450,15 @@ _title bar_ which in turn has an optional _close box_. Within the content area a
optional _resize box_ and optional _scroll bars_.
```
option_dialog_box := 1 << 0
option_go_away_box := 1 << 1
option_grow_box := 1 << 2
option_dialog_box = 1 << 0
option_go_away_box = 1 << 1
option_grow_box = 1 << 2
scroll_option_none := 0
scroll_option_present := 1 << 7
scroll_option_thumb := 1 << 6
scroll_option_active := 1 << 0
scroll_option_normal := scroll_option_present | scroll_option_thumb | scroll_option_active
scroll_option_none = 0
scroll_option_present = 1 << 7
scroll_option_thumb = 1 << 6
scroll_option_active = 1 << 0
scroll_option_normal = scroll_option_present | scroll_option_thumb | scroll_option_active
```
## Commands
@ -740,7 +747,7 @@ Parameters:
.addr port address of GrafPort to populate
```
Returns `error_window_obscured` if the content area of the window is completely offscreen and drawing should be skipped. (The port rect will be invalid.)
Returns `Error::window_obscured` if the content area of the window is completely offscreen and drawing should be skipped. (The port rect will be invalid.)
#### SetWinPort ($3D)
@ -799,8 +806,6 @@ Parameters:
Parameters:
```
.byte clicked (out) 0 = cancelled, 1 = close
.byte ?? (out)
.byte ?? (out)
```
#### DragWindow ($44)
@ -904,11 +909,40 @@ Parameters:
.byte activate 0=deactivate, 1=activate
```
#### GetDeskPat ($4F)
Get address of desktop pattern.
Parameters:
```
.addr pattern (out) 8x8 pixel pattern
```
#### SetDeskPat ($50)
Set new desktop pattern. Note that this does NOT redraw anything.
Applications can show/hide a full-screen window to force a redraw.
Parameters:
```
.res 8 pattern 8x8 pixel pattern
```
#### DrawMenu ($51)
Redraws the current menu bar. Useful after full-screen operations.
Note that hilite state of menu bar items is not restored; this must
be done by manual calls to `HiliteMenu`
Parameters:
```
.res 8 pattern 8x8 pixel pattern
```
# Creating Applications and DeskTop Desk Accessories
### Application Use
_Notes specific to DeskTop Desk Accessories (DA) are included where usage notable differs._
_Notes specific to DeskTop Desk Accessories (DA) are included where usage differs._
#### Initialization
@ -947,7 +981,7 @@ _Notes specific to DeskTop Desk Accessories (DA) are included where usage notabl
#### Redraw window
* `GetWinPort` - populate a local GrafPort with an appropriately clipped port
* if `error_window_obscured` is returned, abort these steps (port will be invalid)
* if `Error::window_obscured` is returned, abort these steps (port will be invalid)
* `SetPort` - make it current
* optional: `HideCursor` - if multiple drawing calls will be made
* ... draw ...
@ -990,7 +1024,7 @@ _DA specific: Use the following steps instead:_
* If not `moved` - done
* Call `JUMP_TABLE_REDRAW_ALL` so DeskTop can redraw its windows
* [Redraw](#redraw-window) window content
* Call `DESKTOP_REDRAW_ICONS` so DeskTop can redraw the desktop (volume) icons
* Call `IconTK::REDRAW_ICONS` so DeskTop can redraw the desktop (volume) icons
#### Handle Window Close
@ -1028,7 +1062,7 @@ _DA specific:_
In addition to the above steps:
* Call `JUMP_TABLE_REDRAW_ALL` _before_ redrawing the DA window.
* Call `DESKTOP_REDRAW_ICONS` _after_ redrawing the DA window.
* Call `IconTK::REDRAW_ICONS` _after_ redrawing the DA window.
#### Handle Update Events

7
mgtk/README.md Normal file
View File

@ -0,0 +1,7 @@
# MouseGraphics ToolKit
* `mgtk.inc` - header file to include
* `mgtk.s` - toolkit source - build as part of application
* `MGTK.md` - ToolKit documentation

View File

@ -12,38 +12,54 @@ MLI := $4000
;;; Graphics Primitives
;;; ============================================================
;;; Point record:
;;;
;;; .word xcoord
;;; .word ycoord
.struct Point
xcoord .word
ycoord .word
.endstruct
;;; Rect record:
;;;
;;; .word x1
;;; .word y1
;;; .word x2
;;; .word y2
.struct Rect
x1 .word
y1 .word
x2 .word
y2 .word
.endstruct
;;; MapInfo record:
;;;
;;; Point viewloc
;;; .addr mapbits screen_mapbits
;;; .byte mapwidth screen_mapwidth
;;; .byte reserved
;;; Rect maprect a.k.a. cliprect
.struct Pattern
row0 .byte
row1 .byte
row2 .byte
row3 .byte
row4 .byte
row5 .byte
row6 .byte
row7 .byte
.endstruct
;;; GrafPort record:
;;;
;;; MapInfo portmap
;;; .res 8 penpattern
;;; .byte colormask_and
;;; .byte colormask_or
;;; Point penloc
;;; .byte penwidth horizontal pen thickness
;;; .byte penheight vertical pen thickness
;;; .byte penmode
;;; .byte textback text background
;;; .addr textfont
.struct MapInfo
viewloc .tag Point
mapbits .word ; screen_mapbits=$2000 for windows, or bitmap bits
mapwidth .byte ; screen_mapwidth=$80 for windows, or stride for bitmap
reserved .byte
maprect .tag Rect ; a.k.a. cliprect
.endstruct
.struct GrafPort
;; MapInfo
viewloc .tag Point ; 0
mapbits .addr ; 4
mapwidth .byte ; 6
reserved .byte ; 7
maprect .tag Rect ; 8
pattern .tag Pattern ; 16
colormasks .byte 2 ; 24 colormask_and, colormask_or
penloc .tag Point ; 26
penwidth .byte ; 30 horizontal pen thickness
penheight .byte ; 31 vertical pen thickness
penmode .byte ; 32
textback .byte ; 33 text background
textfont .addr ; 34
.endstruct
;;; PolyList record:
@ -53,122 +69,121 @@ MLI := $4000
;;; Point vertex2
;;; ...
;;; Font record:
;;;
;;; .byte fonttype 0=regular, $80=double-width
;;; .byte lastchar char code of last character (usually $7F)
;;; .byte height pixels (1-16)
;;; .res N charwidth pixels, for each char
;;; .res N row0 bits
;;; .res N row0right bits (double-width only)
;;; ...
.struct Font
fonttype .byte ; 0=regular, $80=double-width
lastchar .byte ; char code of last character (usually $7F)
height .byte ; pixels (1-16)
charwidth .byte ; pixels, for each char
;; row0 .res N bits
;; row0right .res N bits (double-width only)
.endstruct
NoOp := $00 ; No-op
NoOp = $00 ; No-op
;;; (no parameters)
;;; --------------------------------------------------
;;; Initialization Commands
InitGraf := $01
InitGraf = $01
;;; (no parameters)
SetSwitches := $02 ; Configure display switches
SetSwitches = $02 ; Configure display switches
;;; .byte flags bit 0=hires, 1=page2, 2=mixed, 3=text
;;; --------------------------------------------------
;;; GrafPort Commands
InitPort := $03 ; Initialize GrafPort to standard values
InitPort = $03 ; Initialize GrafPort to standard values
;;; (input is address of GrafPort record)
SetPort := $04 ; Set current port as specified
SetPort = $04 ; Set current port as specified
;;; (input is address of GrafPort record)
GetPort := $05 ; Get pointer to current port
GetPort = $05 ; Get pointer to current port
;;; .addr port (out)
SetPortBits := $06 ; Set just the mapinfo (viewloc, mapbits)
SetPortBits = $06 ; Set just the mapinfo (viewloc, mapbits)
;;; (input is address of MapInfo record)
SetPenMode := $07 ; Set the current pen mode
SetPenMode = $07 ; Set the current pen mode
;;; .byte mode pen*/notpen*
SetPattern := $08 ; Set the current pattern
SetPattern = $08 ; Set the current pattern
;;; .res 8 pattern 8x8 pixel pattern for PaintRect calls
SetColorMasks := $09 ; Set the current color masks
SetColorMasks = $09 ; Set the current color masks
;;; .byte and_mask
;;; .byte or_mask
SetPenSize := $0A ; Set the current pen size
SetPenSize = $0A ; Set the current pen size
;;; .byte penwidth horizontal pen thickness
;;; .byte penheight vertical pen thickness
SetFont := $0B ; Set the current font
SetFont = $0B ; Set the current font
;;; .addr textfont font definition
SetTextBG := $0C ; Set the current text background
SetTextBG = $0C ; Set the current text background
;;; .byte backcolor 0=black, $7F=white
;;; --------------------------------------------------
;;; Drawing Commands
Move := $0D ; Set current pen location (relative)
Move = $0D ; Set current pen location (relative)
;;; .word xdelta
;;; .word ydelta
MoveTo := $0E ; Set current pen location (absolute)
MoveTo = $0E ; Set current pen location (absolute)
;;; Point pos
Line := $0F ; Draw line from current pen location (relative)
Line = $0F ; Draw line from current pen location (relative)
;;; .word xdelta
;;; .word ydelta
LineTo := $10 ; Draw line from current pen location (absolute)
LineTo = $10 ; Draw line from current pen location (absolute)
;;; Point pos
PaintRect := $11 ; Fill rectangle with selected simple pattern/thickness
PaintRect = $11 ; Fill rectangle with selected simple pattern/thickness
;;; Rect rect
FrameRect := $12 ; Draw rectangle with selected simple pattern/thickness
FrameRect = $12 ; Draw rectangle with selected simple pattern/thickness
;;; Rect rect
InRect := $13 ; Is current position in bounds? A=$80 true, 0 false
InRect = $13 ; Is current position in bounds? A=$80 true, 0 false
;;; Rect rect
PaintBits := $14 ; Draw pattern
PaintBits = $14 ; Draw pattern
;;; (input is address of MapInfo record)
PaintPoly := $15
PaintPoly = $15
;;; (input is address of PolyList record)
FramePoly := $16 ; Draw multiple closed polygons
FramePoly = $16 ; Draw multiple closed polygons
;;; (input is address of PolyList record)
InPoly := $17 ; Is current position in bounds? A=$80 true, 0 false
InPoly = $17 ; Is current position in bounds? A=$80 true, 0 false
;;; (input is address of PolyList record)
;;; --------------------------------------------------
;;; Text Commands
TextWidth := $18 ; Measure the width of a string in pixels
TextWidth = $18 ; Measure the width of a string in pixels
;;; .addr data
;;; .byte length
;;; .word width (out) result in pixels
DrawText := $19 ; Drawn at penpos as left, baseline
DrawText = $19 ; Drawn at penpos as left, baseline
;;; .addr data
;;; .byte length
;;; --------------------------------------------------
;;; Utility Commands
SetZP1 := $1A ; Configure lower half of ZP usage by API (speed vs. convenience)
SetZP2 := $1B ; Configure upper half ZP usage by API (speed vs. convenience)
SetZP1 = $1A ; Configure lower half of ZP usage by API (speed vs. convenience)
SetZP2 = $1B ; Configure upper half ZP usage by API (speed vs. convenience)
;;; .byte preserve 0=stash/no auto restore; 1=restore now and onward
Version := $1C ; Get toolkit version
Version = $1C ; Get toolkit version
;;; .byte (out) major
;;; .byte (out) minor
;;; .byte (out) patch
@ -182,7 +197,7 @@ Version := $1C ; Get toolkit version
;;; --------------------------------------------------
;;; Initialization Calls
StartDeskTop := $1D ; Inits state, registers interrupt handler, draws desktop
StartDeskTop = $1D ; Inits state, registers interrupt handler, draws desktop
;;; .byte machine ROM FBB3 ($06 = IIe or later)
;;; .byte subid ROM FBC0 ($EA = IIe, $E0 = IIe enh/IIgs, $00 = IIc/IIc+)
;;; .byte op_sys 0=ProDOS, 1=Pascal
@ -192,25 +207,25 @@ StartDeskTop := $1D ; Inits state, registers interrupt handler, draw
;;; .addr savearea buffer for saving screen data (e.g. behind menus)
;;; .word savesize bytes
StopDeskTop := $1E ; Deallocates interrupt, hides cursor
StopDeskTop = $1E ; Deallocates interrupt, hides cursor
;;; (no parameters)
SetUserHook := $1F
SetUserHook = $1F
;;; .byte hook_id 0=before, 1=after event checking
;;; .addr routine_ptr 0=remove hook_id
AttachDriver := $20 ; Install pointer driver; A=0 on success, $95 if mouse disabled
AttachDriver = $20 ; Install pointer driver; A=0 on success, $95 if mouse disabled
;;; .addr hook Mouse hook routine to install
;;; .addr mouse_state (out) Address of mouse state (.word x, y; .byte status)
ScaleMouse := $21 ; Set mouse/screen scaling
ScaleMouse = $21 ; Set mouse/screen scaling
;;; .byte x_exponent x-scale factor for mouse, 0...3
;;; .byte y_exponent y-scale factor for mouse, 0...3
KeyboardMouse := $22 ; Next operation will be performed by keyboard
KeyboardMouse = $22 ; Next operation will be performed by keyboard
;;; (no parameters)
GetIntHandler := $23 ; Get address of interrupt handler
GetIntHandler = $23 ; Get address of interrupt handler
;;; .addr handler (out) Address of interrupt handler (after cld)
;;; --------------------------------------------------
@ -218,57 +233,69 @@ GetIntHandler := $23 ; Get address of interrupt handler
;;; Cursor record:
;;;
;;; .res 24 bitmap 2x12 byte bitmap (XOR'd after mask)
;;; .res 24 mask 2x12 byte mask (OR'd with screen)
;;; .byte hotx hotspot coords (pixels)
;;; .byte hoty
SetCursor := $24 ; Set cursor definition
cursor_height = 12
cursor_width = 2
.struct Cursor
bits .byte 24 ; 2x12 byte bitmap (XOR'd after mask)
mask .byte 24 ; 2x12 byte mask (OR'd with screen)
hotspot .byte 2 ; x, y - hotspot coords (pixels)
.endstruct
SetCursor = $24 ; Set cursor definition
;;; (input is address of Cursor record)
ShowCursor := $25 ; Return cursor to visibility
ShowCursor = $25 ; Return cursor to visibility
;;; (no parameters)
HideCursor := $26 ; Cursor hidden until ShowCursor call
HideCursor = $26 ; Cursor hidden until ShowCursor call
;;; (no parameters)
ObscureCursor := $27 ; Cursor hidden until moved
ObscureCursor = $27 ; Cursor hidden until moved
;;; (no parameters)
GetCursorAddr := $28 ; Get cursor definition
GetCursorAddr = $28 ; Get cursor definition
;;; .addr definition (out) Address of cursor record
;;; --------------------------------------------------
;;; Event Manager Calls
;;; Event record:
;;;
;;; .byte kind event_kind_*
;;; if kind is event_kind_key_down:
;;; .byte key (ASCII code; high bit clear)
;;; .byte modifiers (0=none, 1=open-apple, 2=solid-apple, 3=both)
;;; if kind is event_kind_update:
;;; .byte window_id
;;; otherwise:
;;; .word xcoord
;;; .word ycoord
.struct Event
kind .byte ; event_kind_*
.union
.struct ; event_kind_down
key .byte ; ASCII code; high bit clear
modifiers .byte ; 0=none, 1=open-apple, 2=solid-apple, 3=both
.endstruct
CheckEvents := $29 ; Process mouse/kbd if GetEvent will be delayed.
.struct ; event_kind_update
window_id .byte
.endstruct
.struct ; otherwise
xcoord .word
ycoord .word
.endstruct
.endunion
.endstruct
CheckEvents = $29 ; Process mouse/kbd if GetEvent will be delayed.
;;; (no parameters)
GetEvent := $2A
GetEvent = $2A
;;; (parameter is address of Event record)
FlushEvents := $2B
FlushEvents = $2B
;;; (no parameters)
PeekEvent := $2C
PeekEvent = $2C
;;; (parameter is address of Event record)
PostEvent := $2D ; Post event to queue
PostEvent = $2D ; Post event to queue
;;; (parameter is address of Event record)
SetKeyEvent := $2E ; If set, keypresses are ignored by Tool Kit
SetKeyEvent = $2E ; If set, keypresses are ignored by Tool Kit
;;; .byte handle_keys high bit set = ignore keyboard, otherwise check
;;; --------------------------------------------------
@ -278,62 +305,67 @@ SetKeyEvent := $2E ; If set, keypresses are ignored by Tool Kit
;;;
;;; .word count Number of menu bar items
;;; (array of...)
;;; .byte menu_id Menu identifier
;;; .byte disabled Flag
;;; .addr title Address of length-prefixed string
;;; .addr menu Address of Menu record
;;; .res 6 reserved Reserved
;;; ...
;;;
.struct MenuBarItem
menu_id .byte ; Menu identifier
disabled .byte ; Flag
title .addr ; Address of length-prefixed string
menu .addr ; Address of Menu record
reserved .res 6 ; Reserved
.endstruct
;;; Menu record:
;;;
;;; .byte count Number of items in menu
;;; .res 5 reserved Reserved
;;; (array of...)
;;; .byte options bit 0=OA, 1=SA, 2=mark, 5=check, 6=filler, 7=disabled
;;; .byte mark_char Custom mark character if mark option set
;;; .byte char1 ASCII code of shortcut #1 (e.g. uppercase B); or 0
;;; .byte char2 ASCII code of shortcut #2 (e.g. lowercase b, or same); or 0
;;; .addr name Address of length-prefixed string
;;; ...
InitMenu := $2F
.struct MenuItem
options .byte ; bit 0=OA, 1=SA, 2=mark, 5=check, 6=filler, 7=disabled
mark_char .byte ; Custom mark character if mark option set
char1 .byte ; ASCII code of shortcut #1 (e.g. uppercase B); or 0
char2 .byte ; ASCII code of shortcut #2 (e.g. lowercase b, or same); or 0
name .addr ; Address of length-prefixed string
.endstruct
InitMenu = $2F
;;; .byte solid_char char code to use for solid apple glyph
;;; .byte open_char char code to use for open apple glyph
;;; .byte check_char char code to use for checkmark glyph
;;; .byte control_char char code to use for control key glyph
SetMenu := $30 ; Configure (and draw) menu
SetMenu = $30 ; Configure (and draw) menu
;;; (input is address of Menu Bar record)
MenuSelect := $31 ; Enter modal loop for handling mouse-down on menu bar
MenuSelect = $31 ; Enter modal loop for handling mouse-down on menu bar
;;; .byte menu_id (out) Top level menu identifier, or 0 if none
;;; .byte menu_item (out) Index (1-based) of item in menu, or 0 if none
MenuKey := $32 ; Find menu item corresponding to keypress
MenuKey = $32 ; Find menu item corresponding to keypress
;;; .byte menu_id (out)
;;; .byte menu_item (out)
;;; .byte which_key
;;; .byte key_mods bit 0=OA, bit 1=SA
HiliteMenu := $33 ; Toggle highlight state of menu
HiliteMenu = $33 ; Toggle highlight state of menu
;;; .byte menu_id
DisableMenu := $34
DisableMenu = $34
;;; .byte menu_id
;;; .byte disable 0=enable, 1=disable
DisableItem := $35
DisableItem = $35
;;; .byte menu_id
;;; .byte menu_item
;;; .byte disable 0=enable, 1=disable
CheckItem := $36
CheckItem = $36
;;; .byte menu_id
;;; .byte menu_item
;;; .byte check 0=unchecked, 1=checked
SetMark := $37
SetMark = $37
;;; .byte menu_id
;;; .byte menu_item
;;; .byte set_char 0=use checkmark, 1=use mark_char
@ -342,88 +374,88 @@ SetMark := $37
;;; --------------------------------------------------
;;; Window Manager Calls
;;; WInfo record:
;;;
;;; .byte id
;;; .byte options option_*
;;; .addr title
;;; .byte hscroll scroll_option_*
;;; .byte vscroll scroll_option_*
;;; .byte hthumbmax
;;; .byte hthumbpos
;;; .byte vthumbmax
;;; .byte vthumbpos
;;; .byte status
;;; .byte reserved
;;; .word mincontwidth minimum content size (horizontal)
;;; .word mincontlength minimum content size (vertical)
;;; .word maxcontwidth maximum content size (horizontal)
;;; .word maxcontlength maximum content size (vertical)
;;; GrafPort windowport GrafPort record
;;; .addr nextwinfo address of next lower window in stack
.struct Winfo
window_id .byte
options .byte ; Option::*
title .addr
hscroll .byte ; Scroll::option_*
vscroll .byte ; Scroll::option_*
hthumbmax .byte
hthumbpos .byte
vthumbmax .byte
vthumbpos .byte
status .byte
reserved .byte
mincontwidth .word ; minimum content size (horizontal)
mincontheight .word ; minimum content size (vertical)
maxcontwidth .word ; maximum content size (horizontal)
maxcontheight .word ; maximum content size (vertical)
port .tag GrafPort
nextwinfo .addr ; address of next lower window in stack
.endstruct
OpenWindow := $38
;;; (input is address of WInfo record)
OpenWindow = $38
;;; (input is address of Winfo record)
CloseWindow := $39
CloseWindow = $39
;;; .byte window_id
CloseAll := $3A
CloseAll = $3A
;;; (no parameters)
GetWinPtr := $3B ; Get pointer to window params by id; A=0 on success
GetWinPtr = $3B ; Get pointer to window params by id; A=0 on success
;;; .byte window_id
;;; .addr window_ptr (out) winfo address
GetWinPort := $3C ; Get drawing state of window (possibly clipped)
GetWinPort = $3C ; Get drawing state of window (possibly clipped)
;;; .byte window_id
;;; .addr port address of grafport to populate
SetWinPort := $3D ; Update port of window
SetWinPort = $3D ; Update port of window
;;; .byte window_id
;;; .addr port GrafPort to copy from
BeginUpdate := $3E ; Respond to update event for window
BeginUpdate = $3E ; Respond to update event for window
;;; .byte window_id
EndUpdate := $3F
EndUpdate = $3F
;;; (no parameters)
FindWindow := $40
FindWindow = $40
;;; .word mousex screen coordinates
;;; .word mousey
;;; .byte which_area (out) area_*
;;; .byte window_id (out) of window
FrontWindow := $41 ; Get id of top window
FrontWindow = $41 ; Get id of top window
;;; .byte window_id (out) window, or 0 if none
SelectWindow := $42 ; Make window topmost
SelectWindow = $42 ; Make window topmost
;;; .byte window_id
TrackGoAway := $43
TrackGoAway = $43
;;; .byte clicked (out) 0 = cancelled, 1 = close
DragWindow := $44
DragWindow = $44
;;; .byte window_id
;;; .word dragx mouse coords
;;; .word dragy
;;; .byte moved high bit set if moved, clear if not
GrowWindow := $45
GrowWindow = $45
;;; .byte window_id
;;; .word mousex
;;; .word mousey
;;; .byte itgrew (out) 0 = no change, 1 = moved
ScreenToWindow := $46 ; Map screen coords to content coords
ScreenToWindow = $46 ; Map screen coords to content coords
;;; .byte window_id
;;; .word screenx
;;; .word screeny
;;; .word windowx (out)
;;; .word windowy (out)
WindowToScreen := $47 ; Map content coords to screen coords
WindowToScreen = $47 ; Map content coords to screen coords
;;; .byte window_id
;;; .word windowx
;;; .word windowy
@ -433,224 +465,202 @@ WindowToScreen := $47 ; Map content coords to screen coords
;;; --------------------------------------------------
;;; Control Manager Calls
FindControl := $48
FindControl = $48
;;; .word mousex
;;; .word mousey
;;; .byte which_ctl ctl_*
;;; .byte which_part part_*
SetCtlMax := $49
SetCtlMax = $49
;;; .byte which_ctl ctl_*_scroll_bar
;;; .byte ctlmax maximum value
TrackThumb := $4A
TrackThumb = $4A
;;; .byte which_ctl ctl_*_scroll_bar
;;; .word mousex
;;; .word mousey
;;; .byte thumbpos (out) 0...255
;;; .byte thumbmoved (out) 0 = no change, 1 = moved
UpdateThumb := $4B
UpdateThumb = $4B
;;; .byte which_ctl ctl_*_scroll_bar
;;; .byte thumbpos new position 0...250
ActivateCtl := $4C ; Activate/deactivate scroll bar
ActivateCtl = $4C ; Activate/deactivate scroll bar
;;; .byte which_ctl ctl_*_scroll_bar
;;; .byte activate 0=deactivate, 1=activate
;;; $4D ???
;;; --------------------------------------------------
;;; Extra Calls
BitBlt = $4D
;;; (input length: 16 bytes)
;;; $4E ???
SetMenuSelection = $4E
;;; (input length: 2 bytes)
GetDeskPat = $4F
;;; .addr pattern (out) Address of desktop pattern
SetDeskPat = $50
;;; .res 8 pattern 8x8 pixel pattern to use for desktop
DrawMenu = $51 ; Redraw menu bar
;;; (no parameters)
;;; ============================================================
;;; Graphics Primitives Constants
;;; Used in GetWinPort / SetPortBits
screen_mapbits := $2000 ; Screen address
screen_mapwidth := $80 ; Stride in bytes
screen_mapbits = $2000 ; Screen address
screen_mapwidth = $80 ; Stride in bytes
;;; Used in SetPenMode
pencopy := 0
penOR := 1
penXOR := 2
penBIC := 3
notpencopy := 4
notpenOR := 5
notpenXOR := 6
notpenBIC := 7
pencopy = 0
penOR = 1
penXOR = 2
penBIC = 3
notpencopy = 4
notpenOR = 5
notpenXOR = 6
notpenBIC = 7
;;; Used in SetZP1
zp_overwrite := 0
zp_preserve := 1<<7
zp_overwrite = 0
zp_preserve = 1<<7
;;; Used in GrafPorts
colormask_and := $FF
colormask_or := $00
textbg_black := $00
textbg_white := $7F
colormask_and = $FF
colormask_or = $00
textbg_black = $00
textbg_white = $7F
;;; ============================================================
;;; MouseGraphics ToolKit Constants
;;; Used in GetEvent
event_kind_no_event := 0 ; No mouse or keypress
event_kind_button_down := 1 ; Mouse button was depressed
event_kind_button_up := 2 ; Mouse button was released
event_kind_key_down := 3 ; Key was pressed
event_kind_drag := 4 ; Mouse button still down
event_kind_apple_key := 5 ; Mouse button was depressed, modifier key down
event_kind_update := 6 ; Window update needed
.enum EventKind
no_event = 0 ; No mouse or keypress
button_down = 1 ; Mouse button was depressed
button_up = 2 ; Mouse button was released
key_down = 3 ; Key was pressed
drag = 4 ; Mouse button still down
apple_key = 5 ; Mouse button was depressed, modifier key down
update = 6 ; Window update needed
.endenum
event_modifier_open_apple := 1 << 0
event_modifier_solid_apple := 1 << 1
event_modifier_open_apple = 1 << 0
event_modifier_solid_apple = 1 << 1
;;; Used in FindWindow
area_desktop := 0
area_menubar := 1
area_content := 2 ; Includes scroll bars
area_dragbar := 3
area_grow_box := 4
area_close_box := 5
.enum Area
desktop = 0
menubar = 1
content = 2 ; Includes scroll bars
dragbar = 3
grow_box = 4
close_box = 5
.endenum
;;; Used in FindControl, TrackThumb, UpdateThumb
ctl_not_a_control := 0
ctl_vertical_scroll_bar := 1
ctl_horizontal_scroll_bar := 2
ctl_dead_zone := 3
.enum Ctl
not_a_control = 0
vertical_scroll_bar = 1
horizontal_scroll_bar = 2
dead_zone = 3
.endenum
;;; Used in FindControl
part_up_arrow := 1
part_left_arrow := 1
part_down_arrow := 2
part_right_arrow := 2
part_page_up := 3
part_page_left := 3
part_page_down := 4
part_page_right := 4
part_thumb := 5
.enum Part
up_arrow = 1
left_arrow = 1
down_arrow = 2
right_arrow = 2
page_up = 3
page_left = 3
page_down = 4
page_right = 4
thumb = 5
.endenum
;;; Used in OpenWindow
option_dialog_box := 1 << 0
option_go_away_box := 1 << 1
option_grow_box := 1 << 2
.enum Option
dialog_box = 1 << 0
go_away_box = 1 << 1
grow_box = 1 << 2
.endenum
scroll_option_none := 0
scroll_option_present := 1 << 7
scroll_option_thumb := 1 << 6
scroll_option_active := 1 << 0
scroll_option_normal := scroll_option_present | scroll_option_thumb | scroll_option_active
.enum Scroll
option_none = 0
option_present = 1 << 7
option_thumb = 1 << 6
option_active = 1 << 0
option_normal = Scroll::option_present | Scroll::option_thumb | Scroll::option_active
.endenum
;;; Used in menu structs
menuopt_open_apple := 1 << 0
menuopt_solid_apple := 1 << 1
menuopt_item_has_mark := 1 << 2
menuopt_item_is_checked := 1 << 5
menuopt_item_is_filler := 1 << 6
menuopt_disable_flag := 1 << 7
.enum MenuOpt
open_apple = 1 << 0
solid_apple = 1 << 1
item_has_mark = 1 << 2
item_is_checked = 1 << 5
item_is_filler = 1 << 6
disable_flag = 1 << 7
.endenum
disablemenu_enable := 0
disablemenu_disable := 1
disableitem_enable := 0
disableitem_disable := 1
disablemenu_enable = 0
disablemenu_disable = 1
disableitem_enable = 0
disableitem_disable = 1
checkitem_uncheck := 0
checkitem_check := 1
checkitem_uncheck = 0
checkitem_check = 1
;;; Used in ActivateCtl
activatectl_deactivate := 0
activatectl_activate := 1
activatectl_deactivate = 0
activatectl_activate = 1
;;; Response from InRect/InPoly
inrect_inside := $80
inrect_outside := $00
inpoly_inside := $80
inpoly_outside := $00
inrect_inside = $80
inrect_outside = $00
inpoly_inside = $80
inpoly_outside = $00
;;; ============================================================
;;; Offsets
grafport_offset_viewloc := 0
grafport_offset_viewloc_xcoord := 0
grafport_offset_viewloc_ycoord := 2
grafport_offset_mapbits := 4
grafport_offset_mapwidth := 6
grafport_offset_maprect := 8
grafport_offset_pattern := 16
grafport_offset_colormasks := 24
grafport_offset_penloc := 26
grafport_offset_penwidth := 30
grafport_offset_penheight := 31
grafport_offset_penmode := 32
grafport_offset_textback := 33
grafport_offset_textfont := 34
grafport_size := 36
winfo_offset_window_id := 0
winfo_offset_options := 1
winfo_offset_title := 2
winfo_offset_hscroll := 4
winfo_offset_vscroll := 5
winfo_offset_hthumbmax := 6
winfo_offset_hthumbpos := 7
winfo_offset_vthumbmax := 8
winfo_offset_vthumbpos := 9
winfo_offset_status := 10
winfo_offset_mincontwidth := 12
winfo_offset_mincontheight := 14
winfo_offset_maxcontwidth := 16
winfo_offset_maxcontheight := 18
winfo_offset_port := 20
winfo_offset_nextwinfo := 56
winfo_size := 58
menu_size := 12
menu_item_size := 6
short_event_size := 4 ; events that don't have mouse coordinates
event_size := 5 ; any kind of event
cursor_height := 12
cursor_width := 2
cursor_offset_mask := cursor_width * cursor_height
cursor_offset_hotspot := 2 * cursor_width * cursor_height
cursor_size := cursor_offset_hotspot + 2
font_offset_fonttype := 0
font_offset_lastchar := 1
font_offset_height := 2
font_offset_charwidth := 3
short_event_size = 4 ; events that don't have mouse coordinates
event_size = 5 ; any kind of event
;;; ============================================================
;;; Errors
error_empty_object := $81
error_bad_object := $82
error_font_too_big := $83
error_invalid_op_sys := $90
error_no_mouse := $92
error_invalid_irq_setting := $93
error_invalid_hook := $94
error_desktop_already_initialized := $95
error_irq_in_use := $97
error_invalid_event := $98
error_event_queue_full := $99
error_menu_not_found := $9A
error_menu_item_not_found := $9B
error_insufficient_savebehind_area := $9C
error_window_already_exists := $9D
error_window_id_required := $9E
error_window_not_found := $9F
error_no_active_window := $A0
error_window_not_draggable := $A1
error_window_not_resizable := $A2
error_window_obscured := $A3
error_control_not_found := $A4
.enum Error
empty_object = $81
bad_object = $82
font_too_big = $83
invalid_op_sys = $90
no_mouse = $92
invalid_irq_setting = $93
invalid_hook = $94
desktop_already_initialized = $95
irq_in_use = $97
invalid_event = $98
event_queue_full = $99
menu_not_found = $9A
menu_item_not_found = $9B
insufficient_savebehind_area = $9C
window_already_exists = $9D
window_id_required = $9E
window_not_found = $9F
no_active_window = $A0
window_not_draggable = $A1
window_not_resizable = $A2
window_obscured = $A3
control_not_found = $A4
.endenum
.endscope ; MGTK
@ -755,7 +765,7 @@ end:
.macro DEFINE_MENU_ITEM saddr, shortcut1, shortcut2
.if .paramcount > 1
.byte MGTK::menuopt_open_apple ; option byte
.byte MGTK::MenuOpt::open_apple ; option byte
.byte 0 ; mark_char
.byte shortcut1 ; char1
.byte shortcut2 ; char2
@ -773,7 +783,7 @@ end:
.endmacro
.macro DEFINE_MENU_SEPARATOR
.byte MGTK::menuopt_item_is_filler ; option byte
.byte MGTK::MenuOpt::item_is_filler ; option byte
.byte 0 ; mark_char
.byte 19 ; char1 - Ctrl+S for separator ???
.byte 0 ; char2
@ -784,6 +794,4 @@ end:
;;; Define pattern for PaintBits - low 7 bits are reversed
;;; e.g. .byte px(%1000000)
;;; px() has high bit clear, PX() has high bit set
.define px(bits) (((bits&$40)>>6)|((bits&$20)>>4)|((bits&$10)>>2)|(bits&$8)|((bits&$4)<<2)|((bits&$2)<<4)|((bits&$1)<<6))
.define PX(bits) (((bits&$40)>>6)|((bits&$20)>>4)|((bits&$10)>>2)|(bits&$8)|((bits&$4)<<2)|((bits&$2)<<4)|((bits&$1)<<6)|$80)

File diff suppressed because it is too large Load Diff

30
preview/Makefile Normal file
View File

@ -0,0 +1,30 @@
CC65 = ~/dev/cc65/bin
CAFLAGS = --target apple2enh --list-bytes 0
CCFLAGS = --config apple2-asm.cfg
OUTDIR = out
HEADERS = $(wildcard ../*.inc) $(wildcard ../inc/*.inc) $(wildcard *.inc)
DAS = $(shell cat TARGETS)
TARGETS = $(patsubst %,$(OUTDIR)/%.built,$(DAS))
.PHONY: clean all
all: $(OUTDIR) $(TARGETS)
$(OUTDIR):
mkdir -p $(OUTDIR)
clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(TARGETS)
$(OUTDIR)/%.o: %.s $(HEADERS)
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
# Desk Accessory Files
$(OUTDIR)/%.built: $(OUTDIR)/%.o
$(CC65)/ld65 $(CCFLAGS) -o '$@' $<

27
preview/README.md Normal file
View File

@ -0,0 +1,27 @@
# Preview
These files are a special class of Desk Accessory which reside in
the `PREVIEW` subdirectory relative to `DESKTOP2` (next to `DESK.ACC`).
These DAs will be invoked automatically for certain file types when
File > Open is run or the files are double-clicked.
* [show.text.file](show.text.file.s)
* Handles text files (TXT $04)
* [show.image.file](show.image.file.s)
* Handles image files (FOT $08)
* 8k Hires or 16k Double Hires images are supported
* [show.font.file](show.font.file.s)
* Handles MGTK font files (FNT $07)
The files can optionally be copied into the `DESK.ACC` directory to
allow direct invocation from the Apple menu. This can be useful to
preview files of different file types e.g. image files saved as BIN
$06.
See [API.md](../desk.acc/API.md) for programming details.
See the DA [README.md](../desk.acc/README.md) for build and installation
details.
NOTE: ProDOS file type FNT $07 is reserved for Apple /// SOS font
files, but given their scarcity the type is re-used here.

3
preview/TARGETS Normal file
View File

@ -0,0 +1,3 @@
show.text.file
show.image.file
show.font.file

Some files were not shown because too many files have changed in this diff Show More