Compare commits

...

11 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
42 changed files with 2824 additions and 484 deletions

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

@ -37,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
@ -56,17 +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 and 17 or 33 blocks (hi-res/double hi-res) or $5800 and 3 blocks
(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

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,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"
;;; ============================================================
@ -80,7 +80,7 @@ save_stack: .byte 0
sta RAMWRTON
;; Redraw DeskTop's icons.
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
;; Redraw window after event_kind_drag
jsr draw_content
@ -765,7 +765,7 @@ ignore_click:
beq ignore_click
exit: MGTK_CALL MGTK::CloseWindow, closewindow_params
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
jmp exit_da
: cmp #MGTK::Area::dragbar ; Title bar?

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"
;;; ============================================================
@ -211,7 +211,7 @@ grow_box_bitmap:
.proc exit
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
ITK_CALL IconTK::REDRAW_ICONS
rts
.endproc
@ -311,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

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
@ -779,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
@ -842,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,11 +9,11 @@ screen_height = 192
VERSION_MAJOR = 1
VERSION_MINOR = 2
.define VERSION_SUFFIX "-alpha6"
.define RELEASE_DATE "July 12, 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)
@ -22,13 +22,23 @@ 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
@ -51,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) *
@ -80,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
@ -137,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
@ -147,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
@ -304,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

View File

@ -42,7 +42,7 @@ JT_SELECT_WINDOW: jmp select_and_refresh_window
JT_AUXLOAD: jmp AuxLoad
JT_EJECT: jmp cmd_eject
JT_REDRAW_ALL: jmp redraw_windows ; *
JT_DESKTOP_RELAY: jmp DESKTOP_RELAY
JT_ITK_RELAY: jmp ITK_RELAY
JT_LOAD_OVL: jmp load_dynamic_routine
JT_CLEAR_SELECTION: jmp clear_selection ; *
JT_MLI_RELAY: jmp MLI_RELAY ; *
@ -75,8 +75,8 @@ iloop: cpx cached_window_icon_count
pha
lda cached_window_icon_list,x
jsr icon_entry_lookup
ldy #DT_ADD_ICON
jsr DESKTOP_RELAY ; icon entry addr in A,X
ldy #IconTK::ADD_ICON
jsr ITK_RELAY ; icon entry addr in A,X
pla
tax
inx
@ -187,7 +187,7 @@ L412B: jsr LoadDesktopIconTable
jsr redraw_selected_icons
L4143: bit L40F1
bpl L4151
DESKTOP_RELAY_CALL DT_REDRAW_ICONS
ITK_RELAY_CALL IconTK::REDRAW_ICONS
L4151: rts
.endproc
@ -261,9 +261,9 @@ L41FE: lda L4241
beq L4227
tax
copy cached_window_icon_list,x, icon_param
DESKTOP_RELAY_CALL DT_ICON_IN_RECT, icon_param
ITK_RELAY_CALL IconTK::ICON_IN_RECT, icon_param
beq :+
DESKTOP_RELAY_CALL DT_REDRAW_ICON, icon_param
ITK_RELAY_CALL IconTK::REDRAW_ICON, icon_param
: inc L4241
jmp L41FE
@ -310,9 +310,9 @@ window: lda num
tax
copy selected_icon_list,x, icon_param
jsr icon_screen_to_window
DESKTOP_RELAY_CALL DT_ICON_IN_RECT, icon_param
ITK_RELAY_CALL IconTK::ICON_IN_RECT, icon_param
beq :+
DESKTOP_RELAY_CALL DT_REDRAW_ICON, icon_param
ITK_RELAY_CALL IconTK::REDRAW_ICON, icon_param
: lda icon_param
jsr icon_window_to_screen
inc num
@ -327,7 +327,7 @@ desktop:
beq done
tax
copy selected_icon_list,x, icon_param
DESKTOP_RELAY_CALL DT_REDRAW_ICON, icon_param
ITK_RELAY_CALL IconTK::REDRAW_ICON, icon_param
inc num
jmp desktop
@ -527,7 +527,7 @@ call_proc:
jsr detect_double_click
sta double_click_flag
copy #0, findwindow_window_id
DESKTOP_RELAY_CALL DT_FIND_ICON, event_coords
ITK_RELAY_CALL IconTK::FIND_ICON, event_coords
lda findicon_which_icon
beq :+
jmp handle_volume_icon_click
@ -608,7 +608,7 @@ start: jsr clear_selection
and #icon_entry_winid_mask
sta winid
jsr zero_grafport5_coords
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
jsr reset_grafport3
copy winid, selected_window_index
copy #1, selected_icon_count
@ -657,7 +657,7 @@ continue:
.proc redraw_windows_and_desktop
jsr redraw_windows
DESKTOP_RELAY_CALL DT_REDRAW_ICONS
ITK_RELAY_CALL IconTK::REDRAW_ICONS
rts
.endproc
@ -920,6 +920,10 @@ begin:
bne :+
addr_jump invoke_desk_acc, str_preview_txt
: cmp #FT_FONT
bne :+
addr_jump invoke_desk_acc, str_preview_fnt
: cmp #DA_FILE_TYPE
bne :+
addr_jump invoke_desk_acc, path
@ -927,7 +931,7 @@ begin:
: lda #ERR_FILE_NOT_OPENABLE
jsr show_alert_and_fail
launch: DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ALL
launch: ITK_RELAY_CALL IconTK::REMOVE_ALL, 0 ; volume icons
MGTK_RELAY_CALL MGTK::CloseAll
MGTK_RELAY_CALL MGTK::SetMenu, blank_menu
ldx buf_win_path
@ -2262,8 +2266,8 @@ L518D: lda L51EF
tax
lda cached_window_icon_list,x
jsr icon_entry_lookup
ldy #DT_ADD_ICON
jsr DESKTOP_RELAY ; icon entry addr in A,X
ldy #IconTK::ADD_ICON
jsr ITK_RELAY ; icon entry addr in A,X
inc L51EF
jmp L518D
@ -2281,7 +2285,7 @@ L51C0: ldx L51EF
sta icon_param
jsr icon_screen_to_window
jsr offset_grafport2_and_set
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
lda icon_param
jsr icon_window_to_screen
dec L51EF
@ -2447,7 +2451,7 @@ L5265: .byte 0
;;; ============================================================
.proc close_active_window
DESKTOP_RELAY_CALL DT_CLOSE_WINDOW, active_window_id
ITK_RELAY_CALL IconTK::CLOSE_WINDOW, active_window_id
jsr LoadActiveWindowIconTable
lda icon_count
sec
@ -2709,7 +2713,7 @@ L5485: cpx cached_window_icon_count
lda cached_window_icon_list,x
sta icon_param
jsr icon_screen_to_window
DESKTOP_RELAY_CALL DT_ICON_IN_RECT, icon_param
ITK_RELAY_CALL IconTK::ICON_IN_RECT, icon_param
pha
lda icon_param
jsr icon_window_to_screen
@ -2871,7 +2875,7 @@ L55F0: ldx L544A
jsr L56F9
lda icon_param
jsr icon_screen_to_window
L5614: DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
L5614: ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
lda getwinport_params2::window_id
beq L562B
lda icon_param
@ -2890,7 +2894,7 @@ L562C: lda icon_param
jsr L56F9
lda icon_param
jsr icon_screen_to_window
L564A: DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON, icon_param
L564A: ITK_RELAY_CALL IconTK::UNHIGHLIGHT_ICON, icon_param
lda getwinport_params2::window_id
beq L5661
lda icon_param
@ -2938,7 +2942,7 @@ L56B4: ldx L56F8
beq L56CF
lda icon_param2
jsr icon_screen_to_window
L56CF: DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param2
L56CF: ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param2
lda LE22C
beq L56E3
lda icon_param2
@ -3227,7 +3231,7 @@ L5916: lda cached_window_icon_list,x
lda cached_window_icon_list,x
sta icon_param
copy #0, cached_window_icon_list,x
DESKTOP_RELAY_CALL DT_REMOVE_ICON, icon_param
ITK_RELAY_CALL IconTK::REMOVE_ICON, icon_param
lda icon_param
jsr FreeIcon
dec cached_window_icon_count
@ -3271,8 +3275,8 @@ L5986: txa
cmp trash_icon_num
beq L5998
jsr icon_entry_lookup
ldy #DT_ADD_ICON
jsr DESKTOP_RELAY ; icon entry addr in A,X
ldy #IconTK::ADD_ICON
jsr ITK_RELAY ; icon entry addr in A,X
L5998: pla
tax
inx
@ -3428,7 +3432,7 @@ not_in_map:
lda icon_param
jsr FreeIcon
jsr reset_grafport3
DESKTOP_RELAY_CALL DT_REMOVE_ICON, icon_param
ITK_RELAY_CALL IconTK::REMOVE_ICON, icon_param
: lda cached_window_icon_count
sta previous_icon_count
@ -3466,8 +3470,8 @@ add_icon:
dex
lda cached_window_icon_list,x
jsr icon_entry_lookup
ldy #DT_ADD_ICON
jsr DESKTOP_RELAY ; icon entry addr in A,X
ldy #IconTK::ADD_ICON
jsr ITK_RELAY ; icon entry addr in A,X
: jsr StoreWindowIconTable
jmp redraw_windows_and_desktop
@ -3714,7 +3718,7 @@ ctl: .byte 0
jmp clear_selection
: copy active_window_id, findicon_window_id
DESKTOP_RELAY_CALL DT_FIND_ICON, findicon_params
ITK_RELAY_CALL IconTK::FIND_ICON, findicon_params
lda findicon_which_icon
bne handle_file_icon_click
jsr L5F13
@ -3764,7 +3768,7 @@ replace:
copy icon_num, icon_param
jsr icon_screen_to_window
jsr offset_grafport2_and_set
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
copy active_window_id, getwinport_params2::window_id
jsr get_set_port2
@ -3780,7 +3784,7 @@ replace:
start_icon_drag:
copy icon_num, drag_drop_param
DESKTOP_RELAY_CALL DT_DRAG_HIGHLIGHTED, drag_drop_param
ITK_RELAY_CALL IconTK::DRAG_HIGHLIGHTED, drag_drop_param
tax
lda drag_drop_param
beq desktop
@ -3846,7 +3850,7 @@ desktop:
pha
lda selected_icon_list,x
sta redraw_icon_param
DESKTOP_RELAY_CALL DT_REDRAW_ICON, redraw_icon_param
ITK_RELAY_CALL IconTK::REDRAW_ICON, redraw_icon_param
pla
tax
dex
@ -4067,9 +4071,9 @@ L5F88: txa
lda cached_window_icon_list,x
sta icon_param
jsr icon_screen_to_window
DESKTOP_RELAY_CALL DT_ICON_IN_RECT, icon_param
ITK_RELAY_CALL IconTK::ICON_IN_RECT, icon_param
beq L5FB9
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
ldx selected_icon_count
inc selected_icon_count
copy icon_param, selected_icon_list,x
@ -4252,7 +4256,7 @@ handle_close_click:
sbc cached_window_icon_count
sta icon_count
DESKTOP_RELAY_CALL DT_CLOSE_WINDOW, active_window_id
ITK_RELAY_CALL IconTK::CLOSE_WINDOW, active_window_id
jsr free_cached_window_icons
@ -4290,7 +4294,7 @@ cont: sta cached_window_icon_count
and #icon_entry_winid_mask
sta selected_window_index
jsr zero_grafport5_coords
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
jsr reset_grafport3
copy #1, selected_icon_count
copy icon_param, selected_icon_list
@ -4818,7 +4822,7 @@ L67F6: bit BUTN0
;; Add clicked icon to selection
lda selected_window_index
bne replace_selection
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, findicon_which_icon
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, findicon_which_icon
ldx selected_icon_count
lda findicon_which_icon
sta selected_icon_list,x
@ -4831,7 +4835,7 @@ replace_selection:
;; Set selection to clicked icon
set_selection:
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, findicon_which_icon
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, findicon_which_icon
copy #1, selected_icon_count
copy findicon_which_icon, selected_icon_list
copy #0, selected_window_index
@ -4842,7 +4846,7 @@ L6834: bit double_click_flag
;; Drag of volume icon
copy findicon_which_icon, drag_drop_param
DESKTOP_RELAY_CALL DT_DRAG_HIGHLIGHTED, drag_drop_param
ITK_RELAY_CALL IconTK::DRAG_HIGHLIGHTED, drag_drop_param
tax
lda drag_drop_param
beq L6878
@ -4885,7 +4889,7 @@ L688F: ldx selected_icon_count
L6893: txa
pha
copy selected_icon_list,x, icon_param3
DESKTOP_RELAY_CALL DT_REDRAW_ICON, icon_param3
ITK_RELAY_CALL IconTK::REDRAW_ICON, icon_param3
pla
tax
dex
@ -4914,7 +4918,7 @@ L68B8: lda event_coords,x
beq L68CF
rts
L68CF: MGTK_RELAY_CALL MGTK::SetPattern, desktop_aux::checkerboard_pattern
L68CF: MGTK_RELAY_CALL MGTK::SetPattern, checkerboard_pattern
jsr set_penmode_xor
MGTK_RELAY_CALL MGTK::FrameRect, tmp_rect
L68E4: jsr peek_event
@ -4932,9 +4936,9 @@ L68F9: cpx cached_window_icon_count
: txa
pha
copy cached_window_icon_list,x, icon_param
DESKTOP_RELAY_CALL DT_ICON_IN_RECT, icon_param
ITK_RELAY_CALL IconTK::ICON_IN_RECT, icon_param
beq L692C
DESKTOP_RELAY_CALL DT_HIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::HIGHLIGHT_ICON, icon_param
ldx selected_icon_count
inc selected_icon_count
copy icon_param, selected_icon_list,x
@ -5195,8 +5199,8 @@ update_view:
tax
lda cached_window_icon_list,x
jsr icon_entry_lookup ; A,X points at IconEntry
ldy #DT_ADD_ICON
jsr DESKTOP_RELAY ; icon entry addr in A,X
ldy #IconTK::ADD_ICON
jsr ITK_RELAY ; icon entry addr in A,X
inc num
jmp :-
@ -5231,7 +5235,7 @@ done: copy cached_window_id, active_window_id
jsr offset_grafport2_and_set
lda icon_params2
jsr icon_screen_to_window
: DESKTOP_RELAY_CALL DT_REDRAW_ICON, icon_params2
: ITK_RELAY_CALL IconTK::REDRAW_ICON, icon_params2
lda getwinport_params2::window_id
beq done ; skip if on desktop
@ -5371,9 +5375,9 @@ L6D09: txa
pha
lda cached_window_icon_list,x
sta icon_param
DESKTOP_RELAY_CALL DT_ICON_IN_RECT, icon_param
ITK_RELAY_CALL IconTK::ICON_IN_RECT, icon_param
beq L6D25
DESKTOP_RELAY_CALL DT_REDRAW_ICON, icon_param
ITK_RELAY_CALL IconTK::REDRAW_ICON, icon_param
L6D25: pla
tax
inx
@ -5405,7 +5409,7 @@ L6D56: lda L6DB0
lda selected_icon_list,x
sta icon_param
jsr icon_screen_to_window
DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::UNHIGHLIGHT_ICON, icon_param
lda icon_param
jsr icon_window_to_screen
inc L6DB0
@ -5417,7 +5421,7 @@ L6D7D: lda L6DB0
tax
lda selected_icon_list,x
sta icon_param
DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON, icon_param
ITK_RELAY_CALL IconTK::UNHIGHLIGHT_ICON, icon_param
inc L6DB0
jmp L6D7D
@ -9328,7 +9332,7 @@ L8D56: .word 0
lda #0
sta step
jsr reset_grafport3
MGTK_RELAY_CALL MGTK::SetPattern, desktop_aux::checkerboard_pattern
MGTK_RELAY_CALL MGTK::SetPattern, checkerboard_pattern
jsr set_penmode_xor
loop: lda step
@ -9393,7 +9397,7 @@ step: .byte 0
lda #11
sta step
jsr reset_grafport3
MGTK_RELAY_CALL MGTK::SetPattern, desktop_aux::checkerboard_pattern
MGTK_RELAY_CALL MGTK::SetPattern, checkerboard_pattern
jsr set_penmode_xor
loop: lda step
@ -9559,6 +9563,7 @@ open: MLI_RELAY_CALL OPEN, open_params
: MLI_RELAY_CALL GET_TIME, 0
;; Assumes call from main loop, where grafport3 is initialized.
MGTK_RELAY_CALL MGTK::SetTextBG, desktop_aux::textbg_white
MGTK_RELAY_CALL MGTK::MoveTo, pos_clock
;; --------------------------------------------------
@ -10205,7 +10210,7 @@ done: stx buf
.proc redraw_desktop_and_windows
jsr JT_REDRAW_ALL
yax_call JT_DESKTOP_RELAY, DT_REDRAW_ICONS, 0
yax_call JT_ITK_RELAY, IconTK::REDRAW_ICONS, 0
rts
.endproc
@ -10811,7 +10816,7 @@ L969E: lda #$40
ldx L9706
lda selected_icon_list,x
sta icon_param2
yax_call JT_DESKTOP_RELAY, DT_REDRAW_ICON_IDX, icon_param2
yax_call JT_ITK_RELAY, IconTK::ERASE_ICON, icon_param2
copy16 L9707, $08
ldx L9706
lda selected_icon_list,x
@ -12700,6 +12705,27 @@ RAMSLOT := DEVADR + $16 ; Slot 3, Drive 2
driver: jmp (RAMSLOT)
.endproc
;;; ============================================================
;;; Determine if mouse moved (returns w/ carry set if moved)
;;; Used in dialogs to possibly change cursor
.proc check_mouse_moved
ldx #.sizeof(MGTK::Point)-1
: lda event_coords,x
cmp coords,x
bne diff
dex
bpl :-
clc
rts
diff: COPY_STRUCT MGTK::Point, event_coords, coords
sec
rts
coords: DEFINE_POINT 0,0
.endproc
;;; ============================================================
@ -12761,7 +12787,7 @@ dialog_param_addr:
sta format_erase_overlay_flag
sta cursor_ip_flag
copy #prompt_insertion_point_blink_count, prompt_ip_counter
copy DeskTop::Settings::ip_blink_speed, prompt_ip_counter
copy16 #rts1, jump_relay+1
jsr set_cursor_pointer
@ -12782,7 +12808,7 @@ dialog_param_addr:
dec prompt_ip_counter
bne :+
jsr redraw_prompt_insertion_point
copy #prompt_insertion_point_blink_count, prompt_ip_counter
copy DeskTop::Settings::ip_blink_speed, prompt_ip_counter
;; Dispatch event types - mouse down, key press
: MGTK_RELAY_CALL MGTK::GetEvent, event_params
@ -12800,6 +12826,9 @@ dialog_param_addr:
beq prompt_input_loop
;; Check if mouse is over input field, change cursor appropriately.
jsr check_mouse_moved
bcc prompt_input_loop
MGTK_RELAY_CALL MGTK::FindWindow, event_coords
lda findwindow_which_area
bne :+
@ -14168,20 +14197,15 @@ set_penmode_xor2:
dex
bpl :-
lda #0
sta counter+1
lda machine_type ; Speed of mouse driver? ($96=IIe,$FA=IIc,$FD=IIgs)
asl a ; * 2
rol counter+1 ; So IIe = $12C, IIc = $1F4, IIgs = $1FA
sta counter
copy16 DeskTop::Settings::dblclick_speed, counter
;; Decrement counter, bail if time delta exceeded
loop: dec counter
bne :+
dec counter+1
bne exit
loop: dec16 counter
lda counter
ora counter+1
beq exit
: MGTK_RELAY_CALL MGTK::PeekEvent, event_params
MGTK_RELAY_CALL MGTK::PeekEvent, event_params
;; Check coords, bail if pixel delta exceeded
jsr check_delta
@ -15389,6 +15413,9 @@ reset_grafport3a:
str_preview_fot:
PASCAL_STRING "Preview/show.image.file"
str_preview_fnt:
PASCAL_STRING "Preview/show.font.file"
str_preview_txt:
PASCAL_STRING "Preview/show.text.file"
@ -15468,27 +15495,33 @@ start:
bmi is_iigs
;; IIe (or IIe Option Card, or Laser 128)
copy #$96, machine_type ; IIe
lda id_FB1E ; Is it a Laser 128?
cmp #$AC
bne :+
bne is_iie
copy #$80, is_laser128_flag
copy #$FD, machine_type ; Assume accelerated?
: jmp end
lda #$FD ; Assume accelerated?
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*4
jmp end
;; IIe (or IIe Option Card)
is_iie: lda #$96
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*1
jmp end
;; IIgs
is_iigs:
copy #$FD, machine_type ; IIgs
lda #$FD
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*4
jmp end
;; IIc or IIc+
is_iic: copy #$FA, machine_type ; IIc
lda id_FBBF ; ROM version
is_iic: lda id_FBBF ; ROM version
cmp #$05 ; IIc Plus = $05
bne :+
copy #$80, is_iic_plus_flag
: jmp end
: lda #$FA
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*4
jmp end
id_FB1E: .byte 0
id_FBB3: .byte 0
@ -15496,6 +15529,14 @@ id_FBC0: .byte 0
id_FBBF: .byte 0
end:
sta machine_type
;; Only set if not previously configured
lda DeskTop::Settings::dblclick_speed
ora DeskTop::Settings::dblclick_speed+1
bne :+
stxy DeskTop::Settings::dblclick_speed
:
.endscope
;;; ============================================================
@ -15536,6 +15577,7 @@ end:
;;; Initialize MGTK
.scope
MGTK_RELAY_CALL MGTK::SetDeskPat, DeskTop::Settings::pattern
MGTK_RELAY_CALL MGTK::StartDeskTop, startdesktop_params
jsr desktop_main::set_mono_mode
MGTK_RELAY_CALL MGTK::SetMenu, splash_menu

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
@ -1008,21 +1002,21 @@ window_filerecord_table:
.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
@ -1208,7 +1202,7 @@ blank_dd_label:
dummy_dd_item:
PASCAL_STRING "Rien" ; ???
;; DT_UNHIGHLIGHT_ICON params
;; IconTK::UNHIGHLIGHT_ICON params
icon_params2:
.byte 0
@ -1455,7 +1449,9 @@ fto_table:
;; 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
@ -1469,6 +1465,18 @@ fto_table:
.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
;;; --------------------------------------------------
PAD_TO $ED00
@ -1791,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

@ -13,11 +13,12 @@
* 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
@ -168,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

@ -1024,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
@ -1062,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