a2d/desk.acc/API.md

34 lines
1.3 KiB
Markdown
Raw Permalink 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
* 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.
* 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)
2018-02-19 19:33:13 +00:00
* 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` - redraw all windows
* `IconTK::REDRAW_ICONS` - redraw desktop (volume) icons
2018-02-19 19:33:13 +00:00
* ...
* Destroy window (`CloseWindow`)
* Tell DeskTop to redraw desktop icons (`IconTK::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`