a2d/desk.acc/API.md

33 lines
1.1 KiB
Markdown
Raw Normal View History

2018-02-19 19:33:13 +00:00
# Desk Accessory API
Desk Accessories for DeskTop have general access to the Mouse Graphics
Tool Kit MLI, ProDOS MLI, and DeskTop APIs. Special considerations for
DAs are documented here.
### Desk Accessory Lifecycle
2018-04-28 03:40:39 +00:00
* DAs are loaded/invoked at $800 MAIN
* Up to $1C00 MAIN is available
* But AUX $1B00 and on must be preserved.
2018-02-19 19:33:13 +00:00
* 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
* 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`
* ...
* Destroy window (`CloseWindow`)
* Tell DeskTop to redraw desktop icons (`DESKTOP_REDRAW_ICONS`)
* Switch control back to MAIN (`RAMRDOFF`/`RAMWRTOFF`)
2018-04-28 03:40:39 +00:00
* Ensure ALTZP and LCBANK1 are still on
2018-02-19 19:33:13 +00:00
* Restore stack pointer
* `rts`