Rename the icon management logic in Aux 'Icon ToolKit'

This commit is contained in:
Joshua Bell 2019-07-28 16:54:06 -07:00
parent 24d318c274
commit daf6e87aec
19 changed files with 271 additions and 230 deletions

51
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.
@ -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 specified window (0 = desktop).
### `DT_REMOVE_ALL` ($06)
### `IconTK::REMOVE_ALL` ($06)
Parameters: { byte window_id }
Removes all icons from specified window (0 = desktop).
### `DT_CLOSE_WINDOW` ($07)
### `IconTK::CLOSE_WINDOW` ($07)
Parameters: { byte window_id }
Closes the specified window.
Remove all icons associated with the specified window. No redrawing is done.
### `DT_GET_HIGHLIGHTED` ($08)
### `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,27 +218,26 @@ 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_ERASE_ICON` ($0E)
### `IconTK::ERASE_ICON` ($0E)
Parameters: { byte icon }

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

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

View File

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

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

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

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

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

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

@ -13,7 +13,7 @@ VERSION_MINOR = 2
.define RELEASE_DATE "July 12, 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_REMOVE_ALL = $06 ; { .byte window_id }
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_ERASE_ICON = $0E ; { .byte icon }
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

View File

@ -220,13 +220,14 @@ basic_mask:
PAD_TO $8E00
;;; ============================================================
;;; Entry point for "DESKTOP"
;;; Entry point for "Icon TookKit"
;;; ============================================================
.assert * = DESKTOP, error, "DESKTOP entry point must be at $8E00"
.assert * = IconTK::MLI, error, "IconTK entry point must be at $8E00"
jmp DESKTOP_DIRECT
.proc icon_toolkit
jmp ITK_DIRECT
;;; ============================================================
@ -325,8 +326,8 @@ highlight_list: ; selected icons
;;; Re-use the "save area" ($800-$1AFF) since menus won't show during
;;; this operation.
drag_outline_buffer := save_area_buffer
max_draggable_items = save_area_size / (.sizeof(MGTK::Point) * 8 + 2)
drag_outline_buffer := SAVE_AREA_BUFFER
max_draggable_items = SAVE_AREA_SIZE / (.sizeof(MGTK::Point) * 8 + 2)
;;; ============================================================
@ -356,7 +357,7 @@ textbg: .byte MGTK::textbg_black
fontptr: .addr DEFAULT_FONT
.endproc
;;; Grafport used to draw icon outlines during
;;; Grafport used to draw icon outlines during drag
.proc drag_outline_grafport
viewloc: DEFINE_POINT 0, 0, viewloc
mapbits: .addr 0
@ -393,7 +394,7 @@ fontptr: .addr 0
.endproc
;;; ============================================================
;;; DESKTOP command jump table
;;; IconTK command jump table
desktop_jump_table:
.addr 0
@ -412,15 +413,15 @@ desktop_jump_table:
.addr ICON_IN_RECT_IMPL
.addr ERASE_ICON_IMPL
.macro DESKTOP_DIRECT_CALL op, addr, label
jsr DESKTOP_DIRECT
.macro ITK_DIRECT_CALL op, addr, label
jsr ITK_DIRECT
.byte op
.addr addr
.endmacro
;;; DESKTOP entry point (after jump)
;;; IconTK entry point (after jump)
.proc DESKTOP_DIRECT
.proc ITK_DIRECT
;; Stash return value from stack, adjust by 3
;; (command byte, params addr)
@ -588,10 +589,10 @@ L949D: ldx highlight_count
ldy #IconEntry::id
lda (ptr),y ; icon num
sta icon
DESKTOP_DIRECT_CALL DT_REDRAW_ICON, icon
ITK_DIRECT_CALL IconTK::REDRAW_ICON, icon
return #0 ; Highlighted
;; DT_REDRAW_ICON params
;; IconTK::REDRAW_ICON params
icon: .byte 0
.endproc
@ -766,7 +767,7 @@ ptr_window_id: .addr 0
ptr := $08
;; DT_HIGHLIGHT_ICON params
;; IconTK::HIGHLIGHT_ICON params
icon: .byte 0
buffer: .res 127, 0
@ -775,7 +776,7 @@ start: lda HIGHLIGHT_ICON_IMPL ; ???
beq start2
lda highlight_list
sta icon
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, icon
ITK_DIRECT_CALL IconTK::UNHIGHLIGHT_ICON, icon
jmp start
start2:
@ -823,7 +824,7 @@ loop2: lda buffer,x
rts
: sta icon
DESKTOP_DIRECT_CALL DT_HIGHLIGHT_ICON, icon
ITK_DIRECT_CALL IconTK::HIGHLIGHT_ICON, icon
pla
tax
inx
@ -846,7 +847,7 @@ ptr_window_id: .addr 0
icon_ptr := $08
;; DT_REMOVE_ICON params
;; IconTK::REMOVE_ICON params
icon: .byte 0
count: .byte 0
@ -870,7 +871,7 @@ loop: ldx count
ldy #0
cmp (params::ptr_window_id),y
bne loop
DESKTOP_DIRECT_CALL DT_REMOVE_ICON, icon
ITK_DIRECT_CALL IconTK::REMOVE_ICON, icon
jmp loop
done: return #0
@ -879,35 +880,43 @@ done: return #0
;;; ============================================================
;;; CLOSE_WINDOW IMPL
;;; param is window id
.proc CLOSE_WINDOW_IMPL
jmp L96D7
PARAM_BLOCK params, $06
window_id: .addr 0
END_PARAM_BLOCK
L96D5: .byte 0
L96D6: .byte 0
ptr := $08
L96D7: lda num_icons
sta L96D6
L96DD: ldx L96D6
jmp start
icon: .byte 0
count: .byte 0
start: lda num_icons
sta count
loop: ldx count
bne L96E5
return #0
L96E5: dec L96D6
L96E5: dec count
dex
lda icon_table,x
sta L96D5
sta icon
asl a
tax
copy16 icon_ptrs,x, $08
copy16 icon_ptrs,x, ptr
ldy #IconEntry::win_type
lda ($08),y
and #icon_entry_winid_mask
lda (ptr),y
and #icon_entry_winid_mask ; check window
ldy #0
cmp ($06),y
bne L96DD
cmp (params::window_id),y ; match?
bne loop ; nope
;; Move to end of icon list
ldy #IconEntry::id
lda ($08),y ; icon num
lda (ptr),y ; icon num
ldx num_icons ; icon index
jsr change_icon_index
@ -917,12 +926,12 @@ L96E5: dec L96D6
sta icon_table,x
ldy #IconEntry::state
lda #0
sta ($08),y
sta (ptr),y
lda has_highlight
beq L9758
ldx #0
ldy #0
L972B: lda ($08),y
L972B: lda (ptr),y
cmp highlight_list,x
beq L973B
inx
@ -930,7 +939,7 @@ L972B: lda ($08),y
bne L972B
jmp L9758
L973B: lda ($08),y ; icon num
L973B: lda (ptr),y ; icon num
ldx highlight_count ; new position
jsr change_highlight_index
dec highlight_count
@ -941,7 +950,7 @@ L973B: lda ($08),y ; icon num
L9750: lda #0
ldx highlight_count
sta highlight_list,x
L9758: jmp L96DD
L9758: jmp loop
.endproc
;;; ============================================================
@ -1028,7 +1037,7 @@ L97F6: .byte 0
;;; ============================================================
;;; DESKTOP DRAG_HIGHLIGHTED IMPL
;;; IconTK DRAG_HIGHLIGHTED IMPL
.proc DRAG_HIGHLIGHTED
ldy #IconEntry::id
@ -1063,7 +1072,7 @@ icon_id:
deltax: .word 0
deltay: .word 0
;; DT_HIGHLIGHT_ICON params
;; IconTK::HIGHLIGHT_ICON params
highlight_icon_id: .byte $00
L9831: .byte $00
@ -1160,7 +1169,7 @@ L98F2: lda highlight_count,x
ldx #$80
stx L9833
L9909: sta L9834
DESKTOP_DIRECT_CALL DT_ICON_IN_RECT, L9834
ITK_DIRECT_CALL IconTK::ICON_IN_RECT, L9834
beq L9954
jsr calc_icon_poly
lda L9C74
@ -1298,13 +1307,13 @@ L9A31: COPY_BYTES 4, findwindow_params2, L9C92
beq L9A84
lda L9831
sta findwindow_params2::window_id
DESKTOP_DIRECT_CALL DT_FIND_ICON, findwindow_params2
ITK_DIRECT_CALL IconTK::FIND_ICON, findwindow_params2
lda findwindow_params2::which_area
cmp highlight_icon_id
beq L9A84
jsr xdraw_outline
MGTK_CALL MGTK::SetPort, icon_grafport
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, highlight_icon_id
ITK_DIRECT_CALL IconTK::UNHIGHLIGHT_ICON, highlight_icon_id
jsr xdraw_outline
lda #0
sta highlight_icon_id
@ -1386,7 +1395,7 @@ L9BA5: jsr xdraw_outline
lda highlight_icon_id
beq :+
MGTK_CALL MGTK::SetPort, icon_grafport
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, highlight_icon_id
ITK_DIRECT_CALL IconTK::UNHIGHLIGHT_ICON, highlight_icon_id
jmp L9C63
: MGTK_CALL MGTK::FindWindow, findwindow_params2
@ -1583,7 +1592,7 @@ L9E1A: jsr push_pointers
lda findwindow_params2::which_area
bne L9E2B
sta findwindow_params2::window_id
L9E2B: DESKTOP_DIRECT_CALL DT_FIND_ICON, findwindow_params2
L9E2B: ITK_DIRECT_CALL IconTK::FIND_ICON, findwindow_params2
lda findwindow_params2::which_area ; Icon ID
bne L9E39
jmp L9E97
@ -1611,7 +1620,7 @@ L9E3D: cmp highlight_list,x
: sta highlight_icon_id
jsr xdraw_outline
MGTK_CALL MGTK::SetPort, icon_grafport
DESKTOP_DIRECT_CALL DT_HIGHLIGHT_ICON, highlight_icon_id
ITK_DIRECT_CALL IconTK::HIGHLIGHT_ICON, highlight_icon_id
jsr xdraw_outline
L9E97: jsr pop_pointers
rts
@ -1667,10 +1676,10 @@ start: lda has_highlight
: ldy #IconEntry::id
lda (params::ptr_iconent),y
sta icon
DESKTOP_DIRECT_CALL DT_REDRAW_ICON, icon
ITK_DIRECT_CALL IconTK::REDRAW_ICON, icon
return #0
;; DT_REDRAW_ICON params
;; IconTK::REDRAW_ICON params
icon: .byte 0
.endproc
@ -2071,40 +2080,44 @@ text_width: .byte 0
;;; REDRAW_ICONS IMPL
.proc REDRAW_ICONS_IMPL
jmp LA2AE
ptr := $06
;; DT_REDRAW_ICON params
LA2A9: .byte 0
jmp start
LA2AA: jsr pop_pointers
;; IconTK::REDRAW_ICON params
icon: .byte 0
done: jsr pop_pointers
rts
LA2AE: jsr push_pointers
start: jsr push_pointers
MGTK_CALL MGTK::InitPort, icon_grafport
MGTK_CALL MGTK::SetPort, icon_grafport
ldx num_icons
dex
LA2B5: bmi LA2AA
loop: bmi done
txa
pha
lda icon_table,x
asl a
tax
copy16 icon_ptrs,x, $06
copy16 icon_ptrs,x, ptr
ldy #IconEntry::win_type
lda ($06),y
and #icon_entry_winid_mask
bne LA2DD
ldy #0
lda ($06),y
sta LA2A9
DESKTOP_DIRECT_CALL DT_REDRAW_ICON, LA2A9
LA2DD: pla
lda (ptr),y
and #icon_entry_winid_mask ; desktop icon
bne next ; no, skip it
ldy #IconEntry::id
lda (ptr),y
sta icon
ITK_DIRECT_CALL IconTK::REDRAW_ICON, icon
next: pla
tax
dex
jmp LA2B5
jmp loop
.endproc
;;; ============================================================
@ -2260,7 +2273,7 @@ erase_icon:
LA3AC: .byte 0
LA3AD: .byte 0
;; DT_REDRAW_ICON params
;; IconTK::REDRAW_ICON params
LA3AE: .byte 0
LA3AF: .word 0
@ -2296,7 +2309,7 @@ window_id: .byte 0
jsr offset_icon_poly
jsr shift_port_down ; Further offset by window's items/used/free bar
jsr erase_window_icon
jmp LA446
jmp redraw_icons_after_erase
;; Volume (i.e. icon on desktop)
volume:
@ -2307,7 +2320,7 @@ volume:
lda more_drawing_needed_flag
bne :-
MGTK_CALL MGTK::SetPortBits, grafport ; default maprect
jmp LA446
jmp redraw_icons_after_erase
.endproc
;;; ============================================================
@ -2330,8 +2343,9 @@ volume:
.endproc
;;; ============================================================
;;; After erasing an icon, redraw any overlapping icons
.proc LA446
.proc redraw_icons_after_erase
ptr := $8
jsr push_pointers
@ -2381,10 +2395,10 @@ LA49D: ldy #IconEntry::id ; icon num
bit LA3B7 ; windowed?
bpl LA4AC ; nope, desktop
jsr offset_icon_do ; yes, adjust rect
LA4AC: DESKTOP_DIRECT_CALL DT_ICON_IN_RECT, LA3AE
LA4AC: ITK_DIRECT_CALL IconTK::ICON_IN_RECT, LA3AE
beq :+
DESKTOP_DIRECT_CALL DT_REDRAW_ICON, LA3AE
ITK_DIRECT_CALL IconTK::REDRAW_ICON, LA3AE
: bit LA3B7
bpl next
@ -2958,6 +2972,8 @@ vert: cmp16 win_t, cr_t
rts
.endproc
.endproc ; icon_toolkit
;;; ============================================================
floppy140_pixels:
@ -3970,7 +3986,7 @@ LBDE1: sub16 event_xcoord, portmap::viewloc::xcoord, event_xcoord
ptr := $06
.proc save
copy16 #save_area_buffer, addr
copy16 #SAVE_AREA_BUFFER, addr
lda LBFC9
jsr LBF10
lda LBFCB
@ -4006,7 +4022,7 @@ LBE5C: .byte 0
.endproc
.proc restore
copy16 #save_area_buffer, addr
copy16 #SAVE_AREA_BUFFER, addr
ldx LBFCD
ldy LBFCE
lda #$FF
@ -4048,7 +4064,7 @@ LBEAE: lda LBF0B
sta PAGE2ON ; aux $2000-$3FFF
addr := *+1
: lda save_area_buffer ; self-modified
: lda SAVE_AREA_BUFFER ; self-modified
pha
lda LBF0B

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
@ -931,7 +931,7 @@ begin:
: lda #ERR_FILE_NOT_OPENABLE
jsr show_alert_and_fail
launch: DESKTOP_RELAY_CALL DT_REMOVE_ALL, 0 ; volume icons
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
@ -2266,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
@ -2285,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
@ -2451,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
@ -2713,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
@ -2875,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
@ -2894,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
@ -2942,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
@ -3231,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
@ -3275,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