a2d/desktop/README.md

196 lines
7.6 KiB
Markdown
Raw Normal View History

2017-09-17 21:52:46 +00:00
# DeskTop diassembly notes
## DESKTOP.SYSTEM
A short (8k) loader program. This is likely responsible for copying
the rest to a RAM card (if available), then invoking the main app.
## DESKTOP2.$F1
This is large - 111k. It includes a loader, 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:
* segment 0: load - A$2000-$257F, L$0580, mark $000000 (Loader)
2018-01-29 05:18:00 +00:00
* segment 1: aux - A$4000-$BFFF, L$8000, mark $000580 (MGTK, DeskTop)
* segment 2: auxlc - A$D000-$ECFF, L$1D00, mark $008580 (DeskTop)
* segment 3: auxlc - A$FB00-$FFFF, L$0500, mark $00A280 (DeskTop)
* segment 4: main - A$4000-$BEFF, L$7F00, mark $00A780 (DeskTop)
* segment 5: main - A$0800-$0FFF, L$0800, mark $012680 (Initializer)
* segment 6: main - A$0290-$03EF, L$0160, mark $012E80 (Invoker)
2018-02-08 05:48:19 +00:00
* overlays dynamically loaded for these actions:
2018-01-19 17:00:24 +00:00
* disk copy - A$0800, L$0200, mark $012FE0
* format/erase - A$0800, L$1400, mark $0160E0
* selector - A$9000, L$1000, mark $0174E0
* common - A$5000, L$2000, mark $0184E0 (used by selector, copy, delete)
2018-01-19 17:00:24 +00:00
* file copy - A$7000, L$0800, mark $01A4E0
* file delete - A$7000, L$0800, mark $01ACE0
* selector - A$7000, L$0800, mark $01B4E0
* (EOF is $01BCE0)
2017-09-17 21:52:46 +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
### 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.
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 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.
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
`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).
### Initializer
`desktop.s`
Loaded at $800-$FFF, this does one-time initialization of the
DeskTop. It is later overwritten when any desk accessories are
run.
2018-01-29 05:18:00 +00:00
### Mouse Graphics Tool Kit (MGTK)
2017-10-10 15:21:32 +00:00
`a2d.s`
AUX $4000-$851E is the GUI library used for the DeskTop application
2017-10-10 15:21:32 +00:00
and (presumably) for disk copy and Selector apps (TBD).
Entry point is $4000 with a ProDOS MLI-style calling convention
2017-09-17 21:52:46 +00:00
2017-10-10 15:21:32 +00:00
### "DeskTop" Application
`desktop.s`
2017-12-31 20:53:53 +00:00
DeskTop application code is in the lower 48k of both Aux and Main:
* Aux $851F-$BFFF - sitting above the GUI library
2017-12-31 20:53:53 +00:00
* Main $4000-$BEFF
...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)
* Aux $ED00-$FAFF - hole for data buffer
* Aux $FB00-$FFFF - more resources (file types, icons)
($C000-$CFFF is reserved for I/O, and main $BF page and language card is ProDOS)
Interactive commands including disk copy/format/erase, file
copy/delete, and Selector add/edit/delete/run all dynamically load
2018-02-08 05:48:19 +00:00
main memory code overlays into one or more of: $800-$1FFF,
$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-08 05:48:19 +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.
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 | | |
| | | |
| | | |
| | | |
| | | |
$A000 | +------+ | |
2018-02-08 05:48:19 +00:00
| | Ovl | | |
| | | | |
| | | | |
$9000 | +------+ | |
2018-01-07 19:45:52 +00:00
| | | |
$8800 | | | Font |
2018-01-07 19:45:52 +00:00
| | | |
$851F | | +-------------+
2018-01-29 05:18:00 +00:00
| | | MGTK |
| | | |
2018-01-07 19:45:52 +00:00
| | | |
| | | |
$7800 | +------+ | |
2018-02-08 05:48:19 +00:00
| | Ovl | | |
$7000 | +------+ | |
2018-02-08 05:48:19 +00:00
| | Ovl | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
$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 | +-------------+
| & Overlays | | Desk Acc |
| | | |
2018-01-07 19:45:52 +00:00
| | | |
$0800 +-------------+ +-------------+
| Text | | Text |
| | | |
$0400 +-------------+ +-------------+
| Invoker | | |
$0300 +-------------+ +-------------+
| Input Buf | | Input Buf |
$0200 +-------------+ +-------------+
| Stack | | Stack |
$0100 +-------------+ +-------------+
| Zero Page | | Zero Page |
$0000 +-------------+ +-------------+
2017-12-31 20:53:53 +00:00
```