2017-09-17 21:52:46 +00:00
|
|
|
|
|
|
|
# DeskTop diassembly notes
|
|
|
|
|
|
|
|
## DESKTOP.SYSTEM
|
|
|
|
|
2018-03-05 16:41:22 +00:00
|
|
|
`sys.s`
|
|
|
|
|
|
|
|
A short (8k) loader program. This is responsible for copying
|
2017-09-17 21:52:46 +00:00
|
|
|
the rest to a RAM card (if available), then invoking the main app.
|
|
|
|
|
2018-03-06 05:30:13 +00:00
|
|
|
NOTE: The second half may be used for "Down load", i.e. copy
|
|
|
|
Selector entries to RAMCard as well.
|
|
|
|
|
2017-09-17 21:52:46 +00:00
|
|
|
## DESKTOP2.$F1
|
|
|
|
|
2018-02-25 07:19:29 +00:00
|
|
|
This is large - 111k. It includes a loader and the DeskTop app with
|
|
|
|
both main memory and aux memory segments, filling everything from
|
|
|
|
$4000 to $FFFF (except for I/O space and ProDOS), and still having
|
|
|
|
more code segments swapped in dynamically.
|
2017-09-17 21:52:46 +00:00
|
|
|
|
|
|
|
The file is broken down into multiple segments:
|
|
|
|
|
2018-02-24 06:01:04 +00:00
|
|
|
* 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)
|
2018-02-08 05:48:19 +00:00
|
|
|
* overlays dynamically loaded for these actions:
|
2018-02-24 06:01:04 +00:00
|
|
|
* 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`)
|
2018-01-19 17:00:24 +00:00
|
|
|
* (EOF is $01BCE0)
|
2017-09-17 21:52:46 +00:00
|
|
|
|
2018-01-20 18:40:48 +00:00
|
|
|
The DeskTop segments loaded into the Aux bank switched ("language
|
|
|
|
card") memory can be used from both main and aux, so contain relay
|
|
|
|
routines, resources, and buffers. More details below.
|
|
|
|
|
2017-10-10 15:21:32 +00:00
|
|
|
## Structure
|
|
|
|
|
2018-01-05 07:23:06 +00:00
|
|
|
### Loader
|
|
|
|
|
|
|
|
`loader.s`
|
|
|
|
|
|
|
|
Invoked at $2000; patches the ProDOS QUIT routine (at LC2 $D100) then
|
|
|
|
invokes it. That gets copied to $1000-$11FF and run by ProDOS.
|
|
|
|
|
2018-01-05 17:42:32 +00:00
|
|
|
The invoked code stashes the current prefix and re-patches ProDOS with
|
|
|
|
itself. It then (in a convoluted way) loads in the second $200 bytes of
|
|
|
|
`DESKTOP2` at $2000 and invokes that.
|
2018-01-05 07:23:06 +00:00
|
|
|
|
2018-01-05 08:26:13 +00:00
|
|
|
This code then loads the rest of the file as a sequence of segments,
|
|
|
|
moving them to the appropriate destination in aux/banked/main memory.
|
|
|
|
|
2018-01-08 01:16:26 +00:00
|
|
|
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
|
|
|
|
screen to an ImageWriter II printer attached to Slot 1. (This may have
|
|
|
|
been used to produce screenshots during development for manuals.)
|
2018-01-07 19:45:52 +00:00
|
|
|
|
2018-01-06 05:03:10 +00:00
|
|
|
### Invoker
|
|
|
|
|
2018-01-08 01:16:26 +00:00
|
|
|
`invoker.s`
|
2018-01-06 05:03:10 +00:00
|
|
|
|
|
|
|
Loaded at $290-$03EF, this small routine is used to invoke a target,
|
|
|
|
e.g. a double-clicked file. System files are loaded/run at $2000,
|
|
|
|
binary files at the location specified by their aux type, and BASIC
|
|
|
|
files loaded by searching for BASIC.SYSTEM and running it with the
|
|
|
|
pathname passed at $2006 (see ProDOS TLM).
|
|
|
|
|
2018-01-08 01:16:26 +00:00
|
|
|
### Initializer
|
|
|
|
|
2018-02-22 05:18:46 +00:00
|
|
|
(in `desktop.s`)
|
2018-01-08 01:16:26 +00:00
|
|
|
|
|
|
|
Loaded at $800-$FFF, this does one-time initialization of the
|
|
|
|
DeskTop. It is later overwritten when any desk accessories are
|
|
|
|
run.
|
|
|
|
|
2018-02-21 16:06:38 +00:00
|
|
|
### MouseGraphics ToolKit (MGTK)
|
2017-10-10 15:21:32 +00:00
|
|
|
|
2018-02-22 05:18:46 +00:00
|
|
|
`mgtk.s`
|
2018-01-04 22:18:24 +00:00
|
|
|
|
2018-02-24 06:01:04 +00:00
|
|
|
Aux $4000-$851E is the [MouseGraphics ToolKit](../MGTK.md) - a
|
|
|
|
GUI library used for the DeskTop application.
|
2017-10-10 15:21:32 +00:00
|
|
|
|
2018-02-24 06:01:04 +00:00
|
|
|
Since this resides in Aux memory, DeskTop spends most of its time
|
|
|
|
with Aux read/write enabled. The state and logic for rendering
|
|
|
|
the desktop and window contents resides in Aux to avoid proxying
|
|
|
|
data.
|
2017-09-17 21:52:46 +00:00
|
|
|
|
2017-10-10 15:21:32 +00:00
|
|
|
### "DeskTop" Application
|
|
|
|
|
2018-01-04 22:18:24 +00:00
|
|
|
`desktop.s`
|
|
|
|
|
2017-12-31 20:53:53 +00:00
|
|
|
DeskTop application code is in the lower 48k of both Aux and Main:
|
|
|
|
|
2018-01-20 18:40:48 +00:00
|
|
|
* Aux $851F-$BFFF - sitting above the GUI library
|
2017-12-31 20:53:53 +00:00
|
|
|
* Main $4000-$BEFF
|
|
|
|
|
2018-01-20 18:40:48 +00:00
|
|
|
...and in the Aux language card area (accessible from both aux and
|
|
|
|
main code) are relays, buffers and resources:
|
2017-12-31 20:53:53 +00:00
|
|
|
|
|
|
|
* Aux $D000-$ECFF - relays and other aux/main helpers, resources (menus, strings, window)
|
2018-02-24 06:01:04 +00:00
|
|
|
* Aux $ED00-$FAFF - hole for data buffer - entries for each icon on desktop/in windows
|
2017-12-31 20:53:53 +00:00
|
|
|
* Aux $FB00-$FFFF - more resources (file types, icons)
|
|
|
|
|
|
|
|
($C000-$CFFF is reserved for I/O, and main $BF page and language card is ProDOS)
|
|
|
|
|
2018-02-24 06:01:04 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
`ovl1.s` etc
|
|
|
|
|
2018-01-20 18:40:48 +00:00
|
|
|
Interactive commands including disk copy/format/erase, file
|
|
|
|
copy/delete, and Selector add/edit/delete/run all dynamically load
|
2018-02-24 06:01:04 +00:00
|
|
|
main memory code overlays into one or more of: $800-$1BFF,
|
2018-01-20 18:40:48 +00:00
|
|
|
$5000-$6FFF, $7000-$77FF, and $9000-$9FFF. When complete, any original
|
|
|
|
code above $4000 is reloaded.
|
2018-01-05 08:26:13 +00:00
|
|
|
|
2018-02-24 06:01:04 +00:00
|
|
|
## Memory Map
|
2018-02-08 05:48:19 +00:00
|
|
|
|
2017-12-31 20:53:53 +00:00
|
|
|
```
|
2018-01-07 19:45:52 +00:00
|
|
|
Main Aux ROM
|
|
|
|
$FFFF +-------------+ +-------------+ +-------------+
|
|
|
|
| ProDOS | | DeskTop | | Monitor |
|
|
|
|
$F800 | | | Resources/ | +-------------+
|
|
|
|
| | | Buffers | | Applesoft |
|
|
|
|
| | | | | |
|
|
|
|
| | | | | |
|
|
|
|
| | | | | |
|
|
|
|
$D000 +-------------+ +-------------+ +-------------+ +-------------+
|
|
|
|
| I/O |
|
|
|
|
| |
|
|
|
|
$C000 +-------------+ +-------------+ +-------------+
|
|
|
|
| ProDOS GP | | DeskTop |
|
|
|
|
$BF00 +-------------+ | App Code |
|
|
|
|
| DeskTop | | |
|
|
|
|
| App Code | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
$A000 | +------+ | |
|
2018-02-08 05:48:19 +00:00
|
|
|
| | Ovl | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
$9000 | +------+ | |
|
2018-01-07 19:45:52 +00:00
|
|
|
| | | |
|
2018-02-24 06:01:04 +00:00
|
|
|
$8E00 | | | Entry Point |
|
|
|
|
| | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
$8800 | | | Font |
|
2018-01-07 19:45:52 +00:00
|
|
|
| | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
$851F | | +-------------+
|
2018-01-29 05:18:00 +00:00
|
|
|
| | | MGTK |
|
|
|
|
| | | |
|
2018-01-07 19:45:52 +00:00
|
|
|
| | | |
|
|
|
|
| | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
$7800 | +------+ | |
|
2018-02-08 05:48:19 +00:00
|
|
|
| | Ovl | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
$7000 | +------+ | |
|
2018-02-08 05:48:19 +00:00
|
|
|
| | Ovl | | |
|
2018-01-20 18:40:48 +00:00
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
| | | | |
|
|
|
|
$5000 | +------+ | |
|
2018-01-07 19:45:52 +00:00
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
$4000 +-------------+ +-------------+
|
|
|
|
| Graphics | | Graphics |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
| | | |
|
|
|
|
$2000 +-------------+ +-------------+
|
2018-02-08 05:48:19 +00:00
|
|
|
| Initializer | | Win/Icn Map |
|
|
|
|
$1B00 | & Desk Acc | +-------------+
|
2018-02-18 19:33:21 +00:00
|
|
|
| & Overlays | | Desk Acc & |
|
|
|
|
| | | Save Area |
|
2018-01-07 19:45:52 +00:00
|
|
|
| | | |
|
|
|
|
$0800 +-------------+ +-------------+
|
2018-03-27 14:44:13 +00:00
|
|
|
| Drawing | | Drawing |
|
|
|
|
| Temp Buffer | | Temp Buffer |
|
2018-01-07 19:45:52 +00:00
|
|
|
$0400 +-------------+ +-------------+
|
|
|
|
| Invoker | | |
|
|
|
|
$0300 +-------------+ +-------------+
|
|
|
|
| Input Buf | | Input Buf |
|
|
|
|
$0200 +-------------+ +-------------+
|
|
|
|
| Stack | | Stack |
|
|
|
|
$0100 +-------------+ +-------------+
|
|
|
|
| Zero Page | | Zero Page |
|
|
|
|
$0000 +-------------+ +-------------+
|
2017-12-31 20:53:53 +00:00
|
|
|
```
|
2018-02-22 05:18:46 +00:00
|
|
|
|
|
|
|
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.
|