Compare commits

...

37 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
46 changed files with 3364 additions and 1011 deletions

View File

@ -33,6 +33,7 @@ before_deploy:
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:

71
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)
@ -135,76 +135,80 @@ Used when exiting DeskTop; exit DHR mode, restores DHR mode to color, restores d
<!-- ============================================================ -->
## 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
```
Return value in A, 0=success.
> NOTE: Only some of the calls have been identified.
Commands:
### `DT_ADD_ICON` ($01)
### `IconTK::ADD_ICON` ($01)
Parameters: { addr icondata }
Inserts an icon record into the table.
### `DT_HIGHLIGHT_ICON` ($02)
### `IconTK::HIGHLIGHT_ICON` ($02)
Parameters: { byte icon }
Highlights (selects) an icon by number.
### `DT_REDRAW_ICON` ($03)
### `IconTK::REDRAW_ICON` ($03)
Parameters: { byte icon }
Redraws an icon by number.
### `DT_REMOVE_ICON` ($04)
### `IconTK::REMOVE_ICON` ($04)
Parameters: { byte icon }
Removes an icon by number.
### `DT_HIGHLIGHT_ALL` ($05)
### `IconTK::HIGHLIGHT_ALL` ($05)
Parameters: { byte window_id }
Highlights (selects) all icons in a window.
Highlights (selects) all icons in specified window (0 = desktop).
### `DT_UNHIGHLIGHT_ALL` ($06)
Parameters: _N/A_
Unhighlights (deselects) all icons.
### `DT_CLOSE_WINDOW` ($07)
### `IconTK::REMOVE_ALL` ($06)
Parameters: { byte window_id }
Closes the specified window.
Removes all icons from specified window (0 = desktop).
### `DT_GET_HIGHLIGHTED` ($08)
### `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.
### `DT_FIND_ICON` ($09)
### `IconTK::FIND_ICON` ($09)
Parameters: { word mousex, word mousey, (out) byte result }
Find the icon number at the given coordinates.
### `DT_DRAG_HIGHLIGHTED` ($0A)
### `IconTK::DRAG_HIGHLIGHTED` ($0A)
Parameters: { byte param }
@ -214,33 +218,30 @@ 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).
### `DT_UNHIGHLIGHT_ICON` ($0B)
### `IconTK::UNHIGHLIGHT_ICON` ($0B)
Parameters: { addr iconentry }
Unhighlights the specified icon. Note that the address of the icon
entry is passed, not the number.
Unhighlights the specified icon. Note that the address of the IconEntry is passed, not the number.
### `DT_REDRAW_ICONS` ($0C)
### `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 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.
### `DT_REDRAW_ICON_IDX` ($0E)
### `IconTK::ERASE_ICON` ($0E)
Parameters: { byte icon_index }
Redraws the icon at the given index in the icon list. Note that this
is not the same as the icon number.
Parameters: { byte icon }
Erases the specified icon by number. No error checking is done.
<!-- ============================================================ -->

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

View File

@ -22,7 +22,9 @@ https://github.com/inexorabletash/a2d/issues
* 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
@ -35,6 +37,8 @@ https://github.com/inexorabletash/a2d/issues
* 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
@ -44,7 +48,7 @@ https://github.com/inexorabletash/a2d/issues
* Eyes
* Eyes that follow the mouse. (#53)
* Screen Saver
* Homage to Jack Eastman's classic. More to come. (#27)
* 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.
@ -54,16 +58,21 @@ functionality (see below).
### Automatic Preview
Text and Graphics 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 (hi-res/double hi-res) or $5800 (Minipix a.k.a. Print Shop).
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` and `SHOW.IMAGE.FILE` 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.
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
@ -75,7 +84,7 @@ file, then select the appropriate command from the Apple menu.
* 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)
* 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)

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

@ -10,6 +10,8 @@ New desk accessories:
* [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)
@ -21,6 +23,8 @@ New desk accessories:
* [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

View File

@ -8,3 +8,4 @@ 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 "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
;;; ============================================================
.org $800
adjust_txtptr := $B1
;;; ============================================================
;;; Start of the code
@ -27,68 +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:
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_routine := $20
COPY_BYTES sizeof_routine+1, routine, zp_routine
jsr zp_routine
DESKTOP_CALL DT_REDRAW_ICONS
;; Redraw window after event_kind_drag
jsr draw_content
rts
.proc routine
;; Redraw DeskTop's windows.
sta RAMRDOFF
sta RAMWRTOFF
jsr JUMP_TABLE_REDRAW_ALL
sta RAMRDON
sta RAMWRTON
;; Redraw DeskTop's icons.
ITK_CALL IconTK::REDRAW_ICONS
;; Redraw window after event_kind_drag
jsr draw_content
rts
.endproc
sizeof_routine = * - routine
.endproc
;;; ============================================================
@ -663,11 +660,7 @@ window_title:
;;; ==================================================
;;; 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
MGTK_CALL MGTK::FlushEvents
@ -689,15 +682,16 @@ 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
@ -769,25 +763,10 @@ ignore_click:
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
lda trackgoaway_params::goaway
beq ignore_click
exit: 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_routine := $20
COPY_BYTES sizeof_routine+1, routine, zp_routine
jmp zp_routine
.proc routine
sta RAMRDOFF
sta RAMWRTOFF
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?
bne ignore_click
@ -1221,7 +1200,7 @@ rts3: rts
jmp reset_buffer1_and_state
reparse:copy16 #text_buffer1, TXTPTR
jsr adjust_txtptr
jsr CHRGET
jsr CALL_FIN
do_op: pla
@ -1525,8 +1504,7 @@ draw_title_bar:
jmp input_loop
.endproc
;; Following proc is copied to $B1
PROC_AT adjust_txtptr_copied, $B1
PROC_AT chrget_routine, $B1 ; CHRGET ("Constant expression expected" error if label used)
dummy_addr := $EA60
loop: inc TXTPTR
@ -1546,94 +1524,43 @@ loop: inc TXTPTR
sbc #$D0 ; carry set if successful
end: rts
END_PROC_AT
sizeof_adjust_txtptr_copied = .sizeof(adjust_txtptr_copied)
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:
pha
lda ROMIN2
pla
jsr FLOAT
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FLOAT
CALL_FADD:
pha
lda ROMIN2
pla
jsr FADD
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FADD
CALL_FSUB:
pha
lda ROMIN2
jsr FSUB
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FSUB
CALL_FMULT:
pha
lda ROMIN2
pla
jsr FMULT
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FMULT
CALL_FDIV:
pha
lda ROMIN2
pla
jsr FDIV
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FDIV
CALL_FIN:
pha
lda ROMIN2
pla
jsr FIN
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FIN
CALL_FOUT:
pha
lda ROMIN2
pla
jsr FOUT
pha
lda LCBANK1
lda LCBANK1
pla
rts
CALL_FP FOUT
CALL_ROUND:
pha
lda ROMIN2
pla
jsr ROUND
pha
lda LCBANK1
lda LCBANK1
pla
rts
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,9 +3,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"
;;; ============================================================
@ -631,7 +631,7 @@ 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

View File

@ -2,9 +2,9 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
.include "../inc/fp_macros.inc"
;;; ============================================================
@ -16,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
@ -26,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
@ -53,8 +53,6 @@ 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
@ -189,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
@ -215,8 +211,7 @@ grow_box_bitmap:
.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
@ -316,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

View File

@ -2,9 +2,9 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
;;; ============================================================
@ -592,7 +592,7 @@ continue:
.proc exit
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
rts ; exits input loop
.endproc
@ -693,7 +693,7 @@ return_flag:
jsr draw_window
;; Draw DeskTop icons
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
: jmp input_loop
@ -803,14 +803,21 @@ char: .byte 0
rts
:
;; Is IIgs?
;; Bank in ROM and do check
lda ROMIN2
sec
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
lda LCBANK1
lda LCBANK1
bcs :+ ; No, carry still set
sec
sec ; Yes, is a IIgs
rts
;; Is IIc+?
@ -819,10 +826,10 @@ char: .byte 0
lda ID_BYTE_FBBF ; $05 = IIc Plus
cmp #$05
bne done
sec
sec ; Yes, is a IIc+
rts
done: clc
done: clc ; No - older layout
rts
.endproc

View File

@ -2,9 +2,9 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
;;; ============================================================
@ -84,7 +84,7 @@ stash_stack: .byte 0
bit window_pos_flag
bmi skip
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
skip: lda #0
sta window_pos_flag
@ -732,7 +732,7 @@ bail: rts
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
COPY_BYTES sizeof_routine+1, routine, target

View File

@ -11,9 +11,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"
;;; ============================================================

View File

@ -3,9 +3,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"
;;; ============================================================

View File

@ -2,9 +2,9 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/macros.inc"
;;; ============================================================
@ -169,7 +169,7 @@ exit:
;; Force desktop redraw
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
MGTK_CALL MGTK::ShowCursor
rts ; exits input loop

View File

@ -3,9 +3,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"
;;; ============================================================

View File

@ -3,9 +3,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"
;;; ============================================================
@ -46,7 +46,7 @@ da_window_id = 60
da_width = 400
da_height = 118
da_left = (screen_width - da_width)/2
da_top = 50
da_top = 45
.proc winfo
window_id: .byte da_window_id
@ -86,6 +86,14 @@ str_title:
;;; ============================================================
.proc ii_bitmap
viewloc: DEFINE_POINT 59, 8
mapbits: .addr ii_bits
mapwidth: .byte 8
reserved: .res 1
maprect: DEFINE_RECT 0, 0, 50, 18
.endproc
.proc iie_bitmap
viewloc: DEFINE_POINT 59, 5
mapbits: .addr iie_bits
mapwidth: .byte 8
@ -133,6 +141,26 @@ reserved: .res 1
maprect: DEFINE_RECT 0, 0, 47, 29
.endproc
ii_bits:
.byte px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1000000),px(%0000000),px(%0000000),px(%1100000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1001111),px(%1111111),px(%1111100),px(%1100000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1001100),px(%0000000),px(%0001100),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1001100),px(%1100110),px(%0001100),px(%1100000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1001100),px(%0000000),px(%0001100),px(%1100111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1001100),px(%1100000),px(%0001100),px(%1100000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1001100),px(%0000000),px(%0001100),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1001100),px(%0000000),px(%0001100),px(%1100000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1001111),px(%1111111),px(%1111100),px(%1100111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1000000),px(%0000000),px(%0000000),px(%1100000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1000000),px(%0000000)
.byte px(%0000011),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%1110000),px(%0000000)
.byte px(%0001110),px(%0001100),px(%1100110),px(%0110011),px(%0011001),px(%1001100),px(%0011100),px(%0000000)
.byte px(%0111000),px(%0110011),px(%0011001),px(%1001100),px(%1100110),px(%0110011),px(%0000111),px(%0000000)
.byte px(%1100001),px(%1001100),px(%1100110),px(%0110011),px(%0011001),px(%1001100),px(%1100001),px(%1000000)
.byte px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1000000)
.byte px(%0111000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000111),px(%0000000)
.byte px(%0001111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111100),px(%0000000)
iie_bits:
.byte px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1000000),px(%0000000)
@ -536,8 +564,8 @@ model_str_table:
model_pix_table:
.addr ii_bitmap ; Apple ][
.addr ii_bitmap ; Apple ][+
.addr ii_bitmap ; Apple IIe (original)
.addr ii_bitmap ; Apple IIe (enhanced)
.addr iie_bitmap ; Apple IIe (original)
.addr iie_bitmap ; Apple IIe (enhanced)
.addr iic_bitmap ; Apple IIc
.addr iic_bitmap ; Apple IIc (3.5 ROM)
.addr iic_bitmap ; Apple IIc (Org. Mem. Exp.)
@ -751,7 +779,7 @@ done: rts
.proc exit
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
rts ; exits input loop
.endproc
@ -814,7 +842,7 @@ done: rts
jsr draw_window
;; Draw DeskTop icons
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
: jmp input_loop

View File

@ -9,24 +9,36 @@ screen_height = 192
VERSION_MAJOR = 1
VERSION_MINOR = 2
.define VERSION_SUFFIX "-alpha4"
.define RELEASE_DATE "April 4, 2019"
.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
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)
DA_LOAD_ADDRESS := $800 ; Loaded into MAIN
;;; 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
;; Can't load DA past I/O Buffer at MAIN $1C00,
;; but icon tables start at AUX $1B00 so can't clone there.
;;; Memory in AUX - $80 bytes for desktop and 8 windows. First byte is a
;;; 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
@ -49,7 +61,7 @@ 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) *
@ -78,45 +90,47 @@ ERR_INSERT_DST_DISK = $FD
ERR_BASIC_SYS_NOT_FOUND = $FE
;;; ============================================================
;;; API Calls (from aux memory)
;;; 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
DT_ADD_ICON = $01 ; { .addr icondata }
DT_HIGHLIGHT_ICON = $02 ; { .byte icon }
DT_REDRAW_ICON = $03 ; { .byte icon }
DT_REMOVE_ICON = $04 ; { .byte icon }
DT_HIGHLIGHT_ALL = $05 ; { .byte window_id }
DT_UNHIGHLIGHT_ALL = $06
DT_CLOSE_WINDOW = $07 ; { .byte window_id }
DT_GET_HIGHLIGHTED = $08 ; { .res 20 }
DT_FIND_ICON = $09 ; { .word mousex, .word mousey, .byte result }
DT_DRAG_HIGHLIGHTED = $0A ; { .byte param }
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
DT_UNHIGHLIGHT_ICON = $0B ; { .addr iconentry }
DT_REDRAW_ICONS = $0C ; Repaints desktop icons *
DT_ICON_IN_RECT = $0D ; { .byte icon, rect bounds }
DT_REDRAW_ICON_IDX = $0E ; { .byte icon_index }
UNHIGHLIGHT_ICON = $0B ; { .addr iconentry }
REDRAW_ICONS = $0C ; Repaints desktop icons *
ICON_IN_RECT = $0D ; { .byte icon, rect bounds }
ERASE_ICON = $0E ; { .byte icon }
;;; `icon` is the icon number, i.e. first field in icon entry
;;; `icon_index` is the index in the icon table
;;; 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
.endscope ; IconTK
.macro DESKTOP_CALL op, addr, label
jsr DESKTOP
;;; 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 ITK_CALL op, addr, label
jsr IconTK::MLI
.byte op
.if .paramcount > 2
@ -135,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
@ -145,11 +159,11 @@ 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
@ -302,3 +316,24 @@ GLYPH_SAPPLE = $1E
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

View File

@ -5,7 +5,7 @@
.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)

View File

@ -5,7 +5,7 @@ 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
@ -23,6 +23,9 @@ clean:
rm -f $(OUTDIR)/*.built
rm -f $(TARGETS)
$(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 $@ $<

View File

@ -79,7 +79,7 @@ run.
`mgtk.s`
Aux $4000-$8580 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

View File

@ -3,9 +3,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"
;;; ============================================================

File diff suppressed because it is too large Load Diff

View File

@ -53,15 +53,15 @@
.endproc
;;; ============================================================
;;; DESKTOP call from main>aux, call in Y params at (X,A)
;;; IconTK call from main>aux, call in Y params at (X,A)
.proc DTRelayImpl
.assert * = DESKTOP_RELAY, error, "Entry point mismatch"
.proc ITKRelayImpl
.assert * = ITK_RELAY, error, "Entry point mismatch"
sty addr-1
stax addr
sta RAMRDON
sta RAMWRTON
DESKTOP_CALL 0, 0, addr
ITK_CALL 0, 0, addr
tay
sta RAMRDOFF
sta RAMWRTOFF

File diff suppressed because it is too large Load Diff

View File

@ -146,9 +146,6 @@ fontptr: .addr DEFAULT_FONT
;;; ============================================================
save_area_buffer := $800
save_area_size = $1300
;; Copies of ROM bytes used for machine identification
.proc startdesktop_params
machine: .byte $06 ; ROM FBB3 ($06 = IIe or later)
@ -157,8 +154,8 @@ op_sys: .byte 0 ; 0=ProDOS
slot_num: .byte 0 ; Mouse slot, 0 = search
use_interrupts: .byte 0 ; 0=passive
sysfontptr: .addr DEFAULT_FONT
savearea: .addr save_area_buffer
savesize: .word save_area_size
savearea: .addr SAVE_AREA_BUFFER
savesize: .word SAVE_AREA_SIZE
.endproc
zp_use_flag0:
@ -171,7 +168,7 @@ LD2A9: .byte 0
double_click_flag:
.byte 0 ; high bit clear if double-clicked, set otherwise
;; Set to specific machine type; used for double-click timing.
;; Set to specific machine type
machine_type:
.byte $00 ; Set to: $96 = IIe, $FA = IIc, $FD = IIgs
@ -603,11 +600,8 @@ LD8E7: .byte 0
has_input_field_flag:
.byte 0
prompt_insertion_point_blink_count = $14
prompt_ip_counter:
.byte prompt_insertion_point_blink_count
.byte 1 ; immediately decremented to 0 and reset
prompt_ip_flag:
.byte 0
@ -929,7 +923,8 @@ window_path_addr_table:
;;; ============================================================
str_file_type: .res 4, 0
str_file_type:
PASCAL_STRING " $00"
;;; ============================================================
@ -988,29 +983,40 @@ device_to_icon_map:
open_dir_path_buf:
.res 65, 0
LE1F1: .res 15, 0 ; length-prefixed string
LE200: .word 0
LE202: .res 24, 0 ; addr table
;;; Icon to window file record mapping list. First byte is number of
;;; entries, then each entry is an icon number. Position in the list
;;; is the same as position in the subsequent file record list.
window_icon_to_filerecord_list:
.res 9, 0 ; 8 entries + length
.byte $00,$00,$00,$00,$7F,$64,$00,$1C ; ???
.res 6 ; Unused ???
LE200: .word 0 ; Unused ???
;;; Mapping from position in above table to FileRecord entry
window_filerecord_table:
.res 8*2
.res 8, 0 ; Unused ???
.byte $00,$00,$00,$00,$7F,$64,$00,$1C
.byte $00,$1E,$00,$32,$00,$1E,$00,$40
.byte $00
;; DT_HIGHLIGHT_ICON params
;; IconTK::HIGHLIGHT_ICON params
icon_param2:
.byte 0
LE22C: .byte 0
;; DT_HIGHLIGHT_ICON params
;; IconTK::HIGHLIGHT_ICON params
icon_param3:
.byte 0
redraw_icon_param:
.byte 0
;; DT_HIGHLIGHT_ICON params
;; DT_UNHIGHLIGHT_ICON params
;; IconTK::HIGHLIGHT_ICON params
;; IconTK::UNHIGHLIGHT_ICON params
icon_param: .byte 0
;; Used for all sorts of temporary work
@ -1196,7 +1202,7 @@ blank_dd_label:
dummy_dd_item:
PASCAL_STRING "Rien" ; ???
;; DT_UNHIGHLIGHT_ICON params
;; IconTK::UNHIGHLIGHT_ICON params
icon_params2:
.byte 0
@ -1382,9 +1388,94 @@ LEC53: .byte 0
LEC54: .word 0
.res 4, 0
date: .word 0
date: .word 0
.res 7, 0 ; ???
.res 7, 0 ; Used! But where ???
hex_digits:
.byte "0123456789ABCDEF"
;;; Parent window to close after an Open action
window_id_to_close:
.byte 0
;;; High bit set if menu dispatch via keyboard accelerator, clear otherwise.
menu_kbd_flag:
.byte 0
;;; --------------------------------------------------
;;; Params for check_file_type_overrides
fto_type: .byte 0
fto_auxtype: .word 0
fto_blocks: .word 0
;;; Data-driven remapping of file types - used for icons, open/preview, etc.
;;;
;;; The incoming type is compared (using a mask) against a type, and
;;; optionally auxtype and block count. If matched, a replacement type
;;; is used. All entries are processed, even if a match was found. This
;;; allows inverted matches.
.struct FTORecord ; Offset
mask .byte ; 0 incoming type masked before comparison
type .byte ; 1 type for the record (must match)
flags .byte ; 2 bit 7 = compare aux; 6 = compare blocks
aux .word ; 3 optional aux type
blocks .word ; 5 optional block count
newtype .byte ; 7 replacement type
.endstruct
.macro DEFINE_FTORECORD mask, type, flags, aux, blocks, newtype
.byte mask
.byte type
.byte flags
.word aux
.word blocks
.byte newtype
.endmacro
FTO_FLAGS_NONE = %00000000
FTO_FLAGS_AUX = %10000000
FTO_FLAGS_BLOCKS = %01000000
fto_table_record_size = 8
fto_table:
DEFINE_FTORECORD $FF, FT_BAD, FTO_FLAGS_NONE, 0, 0, FT_TYPELESS ; Reserve BAD for tmp
;; Desk Accessories/Applets
DEFINE_FTORECORD $FF, DA_FILE_TYPE, FTO_FLAGS_NONE, 0, 0, FT_BAD ; Remap $F1 by default...
DEFINE_FTORECORD $FF, FT_BAD, FTO_FLAGS_AUX, $640, 0, DA_FILE_TYPE ; Restore $F1/$0640 as DA
DEFINE_FTORECORD $FF, FT_BAD, FTO_FLAGS_AUX, $8640, 0, DA_FILE_TYPE ; Restore $F1/$8640 as DA
DEFINE_FTORECORD $FF, FT_BAD, FTO_FLAGS_NONE, 0, 0, FT_TYPELESS ; Reserve BAD for tmp
;; Graphics Files
DEFINE_FTORECORD $FF, FT_BINARY, FTO_FLAGS_AUX|FTO_FLAGS_BLOCKS, $2000, 17, FT_GRAPHICS ; HR image as FOT
DEFINE_FTORECORD $FF, FT_BINARY, FTO_FLAGS_AUX|FTO_FLAGS_BLOCKS, $4000, 17, FT_GRAPHICS ; HR image as FOT
DEFINE_FTORECORD $FF, FT_BINARY, FTO_FLAGS_AUX|FTO_FLAGS_BLOCKS, $2000, 33, FT_GRAPHICS ; DHR image as FOT
DEFINE_FTORECORD $FF, FT_BINARY, FTO_FLAGS_AUX|FTO_FLAGS_BLOCKS, $4000, 33, FT_GRAPHICS ; DHR image as FOT
DEFINE_FTORECORD $FF, FT_BINARY, FTO_FLAGS_AUX|FTO_FLAGS_BLOCKS, $5800, 3, FT_GRAPHICS ; Minipix as FOT
;; Applications
DEFINE_FTORECORD $FF, FT_S16, FTO_FLAGS_NONE, 0, 0, APP_FILE_TYPE ; IIgs System => "App"
;; IIgs-Specific Files (ranges)
DEFINE_FTORECORD $F0, $50, FTO_FLAGS_NONE, 0, 0, FT_SRC ; IIgs General => SRC
DEFINE_FTORECORD $F0, $A0, FTO_FLAGS_NONE, 0, 0, FT_SRC ; IIgs BASIC => SRC
DEFINE_FTORECORD $F0, $B0, FTO_FLAGS_NONE, 0, 0, FT_SRC ; IIgs System => SRC
DEFINE_FTORECORD $F0, $C0, FTO_FLAGS_NONE, 0, 0, FT_SRC ; IIgs Graphics => SRC
.byte 0 ; sentinel at end of table
;;; --------------------------------------------------
checkerboard_pattern:
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
;;; --------------------------------------------------
@ -1444,6 +1535,9 @@ type_names_table:
;;; Similarly, IIgs-specific types ($5x, $Ax-$Cx) are all
;;; mapped to $B0 (SRC).
.assert FT_BAD = APP_FILE_TYPE, error, "Mismatched file type remapping"
icon_type_table:
.byte icon_entry_type_generic ; typeless
.byte icon_entry_type_generic ; src
@ -1705,4 +1799,34 @@ app_mask:
;; Reserve $80 bytes for settings
PAD_TO $FF80
PAD_TO $10000
;;; ============================================================
;;; Settings - modified by Control Panel
;;; ============================================================
.scope settings
.assert * = DeskTop::Settings::address, error, "Address mismatch"
;; This is offset $A700 into DESKTOP2 file
.assert * = DeskTop::Settings::pattern, error, "Address mismatch"
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.assert * = DeskTop::Settings::dblclick_speed, error, "Address mismatch"
.word 0 ; $12C * 1, * 4, or * 32, 0 if not set
.assert * = DeskTop::Settings::ip_blink_speed, error, "Address mismatch"
.byte 60 ; 120, 60 or 30; lower is faster
;; Reserved for future use...
PAD_TO DeskTop::Settings::address + DeskTop::Settings::length
.endscope
.assert * = $10000, error, "Segment length mismatch"

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 ; ???

View File

@ -43,7 +43,7 @@ str_desktop2:
start: lda #$80
sta ptr
DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ALL
ITK_RELAY_CALL IconTK::REMOVE_ALL, 0 ; volume icons
MGTK_RELAY_CALL MGTK::CloseAll
MGTK_RELAY_CALL MGTK::SetZP1, ptr

View File

@ -43,7 +43,7 @@ routine_table: .addr $7000, $7000, $7000
sta L5104
sta L5103
sta L5105
lda #prompt_insertion_point_blink_count
lda DeskTop::Settings::ip_blink_speed
sta prompt_ip_counter
lda #$FF
sta LD920
@ -76,7 +76,7 @@ L5106: bit LD8EC
dec prompt_ip_counter
bne :+
jsr jt_blink_ip
copy #prompt_insertion_point_blink_count, prompt_ip_counter
copy DeskTop::Settings::ip_blink_speed, prompt_ip_counter
: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_kind
@ -88,7 +88,11 @@ L5106: bit LD8EC
: cmp #MGTK::EventKind::key_down
bne :+
jsr L59B9
: MGTK_RELAY_CALL MGTK::FindWindow, findwindow_params
jmp L5106
: jsr desktop_main::check_mouse_moved
bcc L5106
MGTK_RELAY_CALL MGTK::FindWindow, findwindow_params
lda findwindow_which_area
bne :+
jmp L5106

View File

@ -131,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

View File

@ -7,18 +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 △-X - Cycle through open windows
* △-` 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
@ -29,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

View File

@ -11,11 +11,14 @@
* 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 are treated as Graphics files (HR/DHR)
* 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

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
@ -78,6 +80,7 @@ ID_BYTE_FE1F := $FE1F ; RTS ($60) on pre-IIgs, clears carry on 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
@ -167,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

View File

@ -692,6 +692,24 @@ loop: lda src,x
.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
;;; ============================================================

View File

@ -94,6 +94,7 @@ 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 *

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
@ -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)
@ -974,7 +981,7 @@ _Notes specific to DeskTop Desk Accessories (DA) are included where usage differ
#### 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 ...
@ -1017,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
@ -1055,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

@ -45,20 +45,20 @@ MLI := $4000
.struct GrafPort
;; MapInfo
viewloc .tag Point
mapbits .addr
mapwidth .byte
reserved .byte
maprect .tag Rect
viewloc .tag Point ; 0
mapbits .addr ; 4
mapwidth .byte ; 6
reserved .byte ; 7
maprect .tag Rect ; 8
pattern .tag Pattern
colormasks .byte 2 ; colormask_and, colormask_or
penloc .tag Point
penwidth .byte ; horizontal pen thickness
penheight .byte ; vertical pen thickness
penmode .byte
textback .byte ; text background
textfont .addr
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:

View File

@ -3,9 +3,8 @@
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "mgtk.inc"
.include "../inc/macros.inc"
;;; ============================================================
;;; MouseGraphics ToolKit

View File

@ -10,6 +10,8 @@ File > Open is run or the files are double-clicked.
* [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
@ -20,3 +22,6 @@ 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.

View File

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

450
preview/show.font.file.s Normal file
View File

@ -0,0 +1,450 @@
.feature string_escapes
.setcpu "6502"
.include "apple2.inc"
.include "../inc/macros.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
.include "../mgtk/mgtk.inc"
.include "../desktop.inc"
;;; ============================================================
.org $800
jmp entry
;;; ============================================================
pathbuf: .res 65, 0
font_buffer := $D00
io_buf := WINDOW_ICON_TABLES
read_length = WINDOW_ICON_TABLES-font_buffer
DEFINE_OPEN_PARAMS open_params, pathbuf, io_buf
DEFINE_READ_PARAMS read_params, font_buffer, read_length
DEFINE_CLOSE_PARAMS close_params
;;; ============================================================
;;; Get filename by checking DeskTop selected window/icon
entry:
.proc get_filename
;; Check that an icon is selected
lda #0
sta pathbuf
lda selected_file_count
beq abort ; some file properties?
lda path_index ; prefix index in table
bne :+
abort: rts
;; Copy path (prefix) into pathbuf.
: src := $06
dst := $08
asl a ; (since address table is 2 bytes wide)
tax
copy16 path_table,x, src
ldy #0
lda (src),y
tax
inc src
bne :+
inc src+1
: copy16 #pathbuf+1, dst
jsr copy_pathbuf ; copy x bytes (src) to (dst)
;; Append separator.
lda #'/'
ldy #0
sta (dst),y
inc pathbuf
inc dst
bne :+
inc dst+1
;; Get file entry.
: lda selected_file_list ; file index in table
asl a ; (since table is 2 bytes wide)
tax
copy16 file_table,x, src
;; Exit if a directory.
ldy #2 ; 2nd byte of entry
lda (src),y
and #icon_entry_type_mask
bne :+
rts ; 000 = directory
;; Set window title to point at filename (9th byte of entry)
;; (title includes the spaces before/after from the icon)
: clc
lda src
adc #IconEntry::len
sta winfo_title
lda src+1
adc #0
sta winfo_title+1
;; Append filename to path.
ldy #IconEntry::len
lda (src),y ; grab length
tax ; name has spaces before/after
dex ; so subtract 2 to get actual length
dex
clc
lda src
adc #11 ; 9 = length, 10 = space, 11 = name
sta src
bcc :+
inc src+1
: jsr copy_pathbuf ; copy x bytes (src) to (dst)
jmp load_file_and_run_da
.proc copy_pathbuf ; copy x bytes from src to dst
ldy #0 ; incrementing path length and dst
loop: lda (src),y
sta (dst),y
iny
inc pathbuf
dex
bne loop
tya
clc
adc dst
sta dst
bcc end
inc dst+1
end: rts
.endproc
.endproc
;;; ============================================================
;;; Load the file
.proc load_file_and_run_da
;; TODO: Ensure there's enough room, fail if not
;; NOTE: This only leaves $1000-$1AFF (2816 bytes)
;; which is not enough for all the wide fonts.
;; --------------------------------------------------
;; Load the file
sta ALTZPOFF
MLI_CALL OPEN, open_params ; TODO: Check for error
lda open_params::ref_num
sta read_params::ref_num
sta close_params::ref_num
MLI_CALL READ, read_params ; TODO: Check for error
MLI_CALL CLOSE, close_params
sta ALTZPON
;; --------------------------------------------------
;; Copy the DA code and loaded data to AUX
lda ROMIN2
copy16 #DA_LOAD_ADDRESS, STARTLO
copy16 #WINDOW_ICON_TABLES-1, ENDLO
copy16 #DA_LOAD_ADDRESS, DESTINATIONLO
sec ; main>aux
jsr AUXMOVE
lda LCBANK1
lda LCBANK1
;; --------------------------------------------------
;; Run the DA from Aux, back to Main when done
sta RAMRDON
sta RAMWRTON
jsr init
sta RAMRDOFF
sta RAMWRTOFF
rts
.endproc
;;; ============================================================
da_window_id = 60
da_width = 380
da_height = 140
da_left = (screen_width - da_width)/2
da_top = (screen_height - da_height)/2
.proc winfo
window_id: .byte da_window_id
options: .byte MGTK::Option::go_away_box
title: .addr 0 ; overwritten to point at filename
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 font_buffer
nextwinfo: .addr 0
.endproc
winfo_title := winfo::title
;;; ============================================================
.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
;;; ============================================================
;;; ============================================================
.proc init
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
lda event_params::key
cmp #CHAR_ESCAPE
bne :+
jmp exit
: jmp input_loop
.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 (from Main)
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
;;; ============================================================
line1: PASCAL_STRING "\x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0A \x0B \x0C \x0D \x0E \x0F"
line2: PASCAL_STRING "\x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1A \x1B \x1C \x1D \x1E \x1F"
line3: PASCAL_STRING " ! \x22 # $ % & ' ( ) * + , - . /"
line4: PASCAL_STRING "0 1 2 3 4 5 6 7 8 9 : ; < = > ?"
line5: PASCAL_STRING "@ A B C D E F G H I J K L M N O"
line6: PASCAL_STRING "P Q R S T U V W X Y Z [ \x5C ] ^ _"
line7: PASCAL_STRING "` a b c d e f g h i j k l m n o"
line8: PASCAL_STRING "p q r s t u v w x y z { | } ~ \x7F"
line_count = 8
line_addrs:
.addr line1, line2, line3, line4, line5, line6, line7, line8
pos: DEFINE_POINT 0,0, pos
initial_y = 5
line_height = 15
.proc draw_window
ptr := $06
PARAM_BLOCK params, $06
data: .addr 0
len: .byte 0
width: .word 0
END_PARAM_BLOCK
MGTK_CALL MGTK::GetWinPort, winport_params
cmp #MGTK::Error::window_obscured
bne :+
rts
: MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::HideCursor
copy16 #initial_y, pos::ycoord
copy #0, index
loop: lda index
asl
tax
copy16 line_addrs,x, ptr
ldy #0
lda (ptr),y ; length
sta params::len
add16 ptr, #1, params::data ; offset past length
;; Position the string
MGTK_CALL MGTK::TextWidth, params
sub16 #da_width, params::width, pos::xcoord ; center it
lsr16 pos::xcoord
add16 pos::ycoord, #line_height, pos::ycoord ; next row
MGTK_CALL MGTK::MoveTo, pos
MGTK_CALL MGTK::DrawText, params
inc index
lda index
cmp #line_count
bne loop
MGTK_CALL MGTK::ShowCursor
rts
index: .byte 0
.endproc
;;; ============================================================
.assert * < font_buffer, error, "DA too big"

View File

@ -3,9 +3,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"
;;; ============================================================
;;; Memory map
@ -394,7 +394,7 @@ exit:
;; Force desktop redraw
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
MGTK_CALL MGTK::ShowCursor
rts ; exits input loop

View File

@ -3,9 +3,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"
;;; ============================================================
@ -557,7 +557,7 @@ no_mod:
.proc do_close
jsr close_file
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
rts ; exits input loop
.endproc
@ -839,7 +839,7 @@ end: rts
.endproc
.proc finish_resize ; only called from dead code
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
MGTK_CALL MGTK::SetPort, winfo::port
lda winfo::hscroll
ror a ; check if low bit (track enabled) is set

View File

@ -5,7 +5,7 @@ A2DeskTop.po is an 800k image containing the full application and
all accessories. It can be transferred to an 3.5" floppy using ADTPro.
DeskTop.po, DeskAccessories.po and Preview.po are 140k images
containing different parts of the application, and can be trasnferred to
containing different parts of the application, and can be transferred to
5.25" floppies using ADTPro.
Installation