a2d/desktop.inc

239 lines
8.0 KiB
PHP
Raw Normal View History

2018-03-05 05:36:00 +00:00
;;; ============================================================
;;; DeskTop Internals
2018-03-05 05:36:00 +00:00
;;; ============================================================
screen_width := 560
screen_height := 192
;;; ============================================================
INVOKER := $290 ; Invoke other programs
INVOKER_FILENAME := $280 ; File to invoke (PREFIX must be set)
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.
2018-01-23 16:33:12 +00:00
2018-03-05 05:36:00 +00:00
;;; ============================================================
2018-01-20 18:57:25 +00:00
;;; Direct Calls (from main memory)
2018-01-20 22:31:48 +00:00
;;; * = Used by Desk Accessories
2018-02-16 20:14:39 +00:00
JUMP_TABLE_MAIN_LOOP := $4000 ; Enter DeskTop main loop
2018-01-29 05:18:00 +00:00
JUMP_TABLE_MGTK_RELAY := $4003 ; MGTK relay call (main>aux)
2018-02-10 06:59:05 +00:00
JUMP_TABLE_SIZE_STRING := $4006 ; Compose "nnn Blocks" string into internal buffer
JUMP_TABLE_DATE_STRING := $4009 ; Compose date string into internal buffer
2018-01-20 18:57:25 +00:00
JUMP_TABLE_0C := $400C ; ???
JUMP_TABLE_0F := $400F ; Auxload
2018-01-20 22:31:48 +00:00
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)
2018-04-28 03:40:39 +00:00
JUMP_TABLE_LOAD_OVL := $401B ; Load overlay routine
2018-01-20 22:31:48 +00:00
JUMP_TABLE_CLEAR_SEL := $401E ; Clear DeskTop selection *
JUMP_TABLE_MLI := $4021 ; ProDOS MLI call (Y=call, X,A=params addr) *
JUMP_TABLE_COPY_TO_BUF := $4024 ; Copy to buffer
JUMP_TABLE_COPY_FROM_BUF:= $4027 ; Copy from buffer
JUMP_TABLE_NOOP := $402A ; No-Op command (RTS)
JUMP_TABLE_2D := $402D ; ??? (Draw type/size/date in non-icon views?)
2018-02-25 07:19:29 +00:00
JUMP_TABLE_ALERT_0 := $4030 ; Show alert 0
JUMP_TABLE_ALERT_X := $4033 ; Show alert X
2018-01-20 22:31:48 +00:00
JUMP_TABLE_LAUNCH_FILE := $4036 ; Launch file
JUMP_TABLE_CUR_POINTER := $4039 ; Changes mouse cursor to pointer *
JUMP_TABLE_CUR_WATCH := $403C ; Changes mouse cursor to watch
2018-04-28 03:40:39 +00:00
JUMP_TABLE_RESTORE_OVL := $403F ; Restore from overlay routine
2018-03-05 05:36:00 +00:00
;;; ============================================================
2018-02-05 03:13:21 +00:00
;;; API Calls (from aux memory)
2018-02-05 03:13:21 +00:00
;;; * = Used by Desk Accessories
DESKTOP := $8E00
2018-01-29 05:18:00 +00:00
;; MLI-style call (jsr DEKSTOP ; .byte call ; .addr params)
;; Call from AUX (RAMRDON/RAMWRTON)
;; Implementation bounces to $93BC, uses jump table at $939E
2018-02-07 05:59:25 +00:00
DT_ADD_ICON := $01 ; { .addr icondata }
2018-02-05 03:13:21 +00:00
DT_HIGHLIGHT_ICON := $02 ; { .byte icon }
2018-05-25 04:35:22 +00:00
DT_REDRAW_ICON := $03 ; { .byte icon }
DT_UNHIGHLIGHT_ICON := $04 ; { .byte icon }
DT_HIGHLIGHT_ALL := $05 ; { .byte window_id }
2018-05-24 15:25:41 +00:00
DT_UNHIGHLIGHT_ALL := $06
2018-02-05 03:13:21 +00:00
DT_CLOSE_WINDOW := $07 ; { .byte window_id }
2018-05-25 01:54:42 +00:00
DT_GET_HIGHLIGHTED := $08 ; { .res 20 }
2018-02-05 03:13:21 +00:00
DT_FIND_ICON := $09 ; { .word mousex, .word mousey, .byte result }
2018-02-14 02:53:02 +00:00
;; $0A ???
;; $0B ???
2018-02-05 03:13:21 +00:00
DT_REDRAW_ICONS := $0C ; Repaints desktop icons *
DT_ICON_IN_RECT := $0D ; { .byte icon, rect bounds }
DT_REDRAW_ICON_IDX := $0E ; { .byte icon_index }
;;; `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
2018-02-06 05:49:39 +00:00
.macro DESKTOP_CALL op, addr, label
jsr DESKTOP
.byte op
.if .paramcount > 2
label := *
.endif
.if .paramcount > 1
.addr addr
.else
.addr 0
.endif
.endmacro
2018-03-05 05:36:00 +00:00
;;; ============================================================
2018-02-21 04:36:46 +00:00
;;; Relays from Main to Aux (params must be in ZP or LC)
MGTK_RELAY := $D000
DESKTOP_RELAY := $D040
.macro MGTK_RELAY_CALL call, addr
.if .paramcount > 1
yax_call MGTK_RELAY, (call), (addr)
.else
yax_call MGTK_RELAY, (call), 0
.endif
.endmacro
.macro DESKTOP_RELAY_CALL call, addr
.if .paramcount > 1
yax_call DESKTOP_RELAY, (call), (addr)
.else
yax_call DESKTOP_RELAY, (call), 0
.endif
.endmacro
;;; ============================================================
;;; Internals
;;; Set to specific machine type; used for insertion point blinking
;;; and double-click timing.
;;; //e - $96
;;; //c - $FA
;;; IIgs - $FD
machine_speed := $D2AB
2018-02-21 04:36:46 +00:00
2018-03-05 05:36:00 +00:00
;;; ============================================================
;;; Internals - Windows (paths) and Icons (files)
;;; NOTE: Some of these are used by Desk Accessories
2018-02-09 05:42:59 +00:00
;;; These are DeskTop internals, but it appears there is no
;;; API for getting the selected file.
2018-02-19 19:33:13 +00:00
selected_file_count := $DF21
2018-02-06 05:49:39 +00:00
path_index := $DF20 ; index of selected window (used to get prefix)
path_table := $DFB3 ; window address table
2018-02-09 05:42:59 +00:00
;;; each entry is 65 bytes long
;;; length-prefixed path string (no trailing /)
2018-02-06 05:49:39 +00:00
2018-02-19 19:33:13 +00:00
selected_file_list := $DF22 ; indexes of selected file (global, not w/in window, up to 127)
file_table := $DD9F ; file address table
2018-02-18 01:15:27 +00:00
;;; Icon (file/volume) entries - length 27 bytes, maximum of 127
2018-02-09 05:42:59 +00:00
;;; .byte icon icon index
;;; .byte state $80 = highlighted, 0 = otherwise
2018-02-09 05:42:59 +00:00
;;; .byte type/window_id
;;; (bits 0-3 window_id)
;;; (bits 4,5,6)
;;; 000 = directory
;;; 001 = system
;;; 010 = binary
;;; 011 = basic
;;; 100 = (unused)
;;; 101 = text/generic
;;; 110 = (unused)
;;; 111 = trash
;;; (bit 7 = open flag)
;;; .word iconx (pixels)
;;; .word icony (pixels)
;;; .addr iconbits (addr of {mapbits, mapwidth, reserved, maprect})
;;; .byte len (name length + 2)
;;; .res 17 name (name, with a space before and after)
.struct IconEntry
index .byte
state .byte
win_type .byte
iconx .word
icony .word
iconbits .addr
len .byte
name .res 17 ; 15 chars plus leading/trailing spaces
.endstruct
2018-02-18 01:15:27 +00:00
max_icon_count := 127
2018-02-09 05:42:59 +00:00
icon_entry_open_mask := %10000000
icon_entry_type_mask := %01110000
icon_entry_winid_mask := %00001111
icon_entry_type_dir := %00000000
icon_entry_type_sys := %00010000
icon_entry_type_bin := %00100000
icon_entry_type_bas := %00110000
icon_entry_type_txt := %01010000
icon_entry_type_trash := %01110000
2018-01-20 18:57:25 +00:00
2018-03-05 05:36:00 +00:00
;;; ============================================================
;;; Internals - Default Font
2018-01-20 18:57:25 +00:00
;;; Used by DAs for window definitions
DEFAULT_FONT := $8800
;;; Control Character Glyphs
2018-01-20 18:57:25 +00:00
;;;
;;; Glyphs $00-$1F are useful symbols; some overlap with MouseText
;;; (called out as MT:X in the table below)
;;;
;;; $00 = space $10 = TM left
;;; $01 = folder left (MT:X) $11 = TM right
;;; $02 = folder right (MT:Y) $12 = pound
;;; $03 = hourglass (MT:C) $13 = pi
;;; $04 = insertion pt $14 = divide
;;; $05 = pointer (MT:B) $15 = rarrow (MT:U)
;;; $06 = vbar (MT:_) $16 = tri
;;; $07 = hbar (MT:S) $17 = open circ
;;; $08 = larrow (MT:H) $18 = close (MT:])
;;; $09 = left box $19 = gray odd (MT:W)
;;; $0A = darrow (MT:J) $1A = gray even (MT:V)
;;; $0B = uarrow (MT:K) $1B = solid circ
;;; $0C = right box $1C = inv check (MT:E)
;;; $0D = return (MT:M) $1D = check (MT:D)
;;; $0E = (C) $1E = solid apple (MT:@)
;;; $0F = (R) $1F = open apple (MT:A)
GLYPH_FOLDERL := $01
GLYPH_FOLDERR := $02
GLYPH_SPC := $00
2018-05-08 02:35:36 +00:00
GLYPH_INSPT := $06
GLYPH_LARROW := $09
GLYPH_RARROW := $15
GLYPH_UARROW := $0B
GLYPH_DARROW := $0A
GLYPH_RETURN := $0D
GLYPH_OAPPLE := $1F
2018-02-05 05:05:31 +00:00
GLYPH_SAPPLE := $1E
2018-01-30 16:57:36 +00:00
;;; Menu (by default) uses:
;;; Solid Mod $1E
;;; Open Mod $1F
;;; Check $1D
;;; Control $01
;;; Inactive $7F