params and docs

This commit is contained in:
Joshua Bell 2018-02-18 11:33:21 -08:00
parent 214e0595c5
commit 2141e3b41f
4 changed files with 171 additions and 153 deletions

View File

@ -177,8 +177,8 @@ $4000 +-------------+ +-------------+
$2000 +-------------+ +-------------+ $2000 +-------------+ +-------------+
| Initializer | | Win/Icn Map | | Initializer | | Win/Icn Map |
$1B00 | & Desk Acc | +-------------+ $1B00 | & Desk Acc | +-------------+
| & Overlays | | Desk Acc | | & Overlays | | Desk Acc & |
| | | | | | | Save Area |
| | | | | | | |
$0800 +-------------+ +-------------+ $0800 +-------------+ +-------------+
| Text | | Text | | Text | | Text |

View File

@ -4495,11 +4495,16 @@ checkerboard_pattern3:
.byte $FF .byte $FF
;; Copies of ROM bytes used for machine identification ;; Copies of ROM bytes used for machine identification
id_byte_1: .byte $06 ; ROM FBB3 ($06 = IIe or later) .proc startdesktop_params
id_byte_2: .byte $EA ; ROM FBC0 ($EA = IIe, $E0 = IIe enh/IIgs, $00 = IIc/IIc+) machine: .byte $06 ; ROM FBB3 ($06 = IIe or later)
subid: .byte $EA ; ROM FBC0 ($EA = IIe, $E0 = IIe enh/IIgs, $00 = IIc/IIc+)
.byte $00,$00,$00,$00,$88,$00,$08,$00 op_sys: .byte 0 ; 0=ProDOS
.byte $13 slot_num: .byte 0 ; Mouse slot, 0 = search
use_interrupts: .byte 0 ; 0=passive
sysfontptr: .addr desktop_aux::font_definition
savearea: .addr $0800 ; $0800 - $1AFF
savesize: .word $1300
.endproc
zp_use_flag0: zp_use_flag0:
.byte 0 .byte 0
@ -20047,8 +20052,8 @@ start:
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
sta SET80COL sta SET80COL
stx id_byte_1 ; Stash so DeskTop can check machine bytes stx startdesktop_params::machine
sty id_byte_2 ; when ROM is banked out. sty startdesktop_params::subid
cpy #0 cpy #0
beq is_iic ; Now identify/store specific machine type. beq is_iic ; Now identify/store specific machine type.
bit iigs_flag ; (number is used in double-click timer) bit iigs_flag ; (number is used in double-click timer)
@ -20121,7 +20126,7 @@ found_ram:
;; Initialize MGTK ;; Initialize MGTK
.proc init_mgtk .proc init_mgtk
MGTK_RELAY_CALL MGTK::StartDeskTop, id_byte_1 MGTK_RELAY_CALL MGTK::StartDeskTop, startdesktop_params
MGTK_RELAY_CALL MGTK::SetMenu, splash_menu MGTK_RELAY_CALL MGTK::SetMenu, splash_menu
MGTK_RELAY_CALL MGTK::SetZP1, zp_use_flag0 MGTK_RELAY_CALL MGTK::SetZP1, zp_use_flag0
MGTK_RELAY_CALL MGTK::SetCursor, watch_cursor MGTK_RELAY_CALL MGTK::SetCursor, watch_cursor

View File

@ -166,7 +166,7 @@ adjust_stack: ; Adjust stack to account for params
pha pha
lda params_addr+1 lda params_addr+1
pha pha
bit hide_cursor_flag bit desktop_initialized_flag
bpl :+ bpl :+
jsr hide_cursor jsr hide_cursor
: pla : pla
@ -193,7 +193,7 @@ jump: jsr $FFFF ; the actual call
;; Exposed for routines to call directly ;; Exposed for routines to call directly
cleanup: cleanup:
bit hide_cursor_flag bit desktop_initialized_flag
bpl :+ bpl :+
jsr show_cursor jsr show_cursor
@ -329,8 +329,8 @@ jump_table:
;; Initialization Calls ;; Initialization Calls
.addr StartDeskTopImpl ; $1D StartDeskTop .addr StartDeskTopImpl ; $1D StartDeskTop
.addr StopDeskTopImpl ; $1E StopDeskTop .addr StopDeskTopImpl ; $1E StopDeskTop
.addr L64D2 ; $1F ??? .addr SetUserHookImpl ; $1F SetUserHook
.addr SetUserHookImpl ; $20 SetUserHook .addr AttachDriverImpl ; $20 AttachDriver
.addr ScaleMouseImpl ; $21 ScaleMouseImpl .addr ScaleMouseImpl ; $21 ScaleMouseImpl
.addr KeyboardMouse ; $22 KeyboardMouse .addr KeyboardMouse ; $22 KeyboardMouse
.addr GetIntHandlerImpl ; $23 GetIntHandler .addr GetIntHandlerImpl ; $23 GetIntHandler
@ -428,7 +428,7 @@ param_lengths:
PARAM_DEFN 12, $82, 0 ; $1D StartDeskTop PARAM_DEFN 12, $82, 0 ; $1D StartDeskTop
PARAM_DEFN 0, $00, 0 ; $1E StopDeskTop PARAM_DEFN 0, $00, 0 ; $1E StopDeskTop
PARAM_DEFN 3, $82, 0 ; $1F PARAM_DEFN 3, $82, 0 ; $1F
PARAM_DEFN 2, $82, 0 ; $20 SetUserHook PARAM_DEFN 2, $82, 0 ; $20 AttachDriver
PARAM_DEFN 2, $82, 0 ; $21 ScaleMouse PARAM_DEFN 2, $82, 0 ; $21 ScaleMouse
PARAM_DEFN 1, $82, 0 ; $22 KeyboardMouse PARAM_DEFN 1, $82, 0 ; $22 KeyboardMouse
PARAM_DEFN 0, $00, 0 ; $23 GetIntHandler PARAM_DEFN 0, $00, 0 ; $23 GetIntHandler
@ -4096,7 +4096,7 @@ L633C: .byte $00
L633D: .byte $00 L633D: .byte $00
L633E: .byte $00 L633E: .byte $00
hide_cursor_flag: desktop_initialized_flag:
.byte 0 .byte 0
L6340: .byte $00 L6340: .byte $00
@ -4190,7 +4190,7 @@ L63E5: lda L6338
L63F6: stx L6338 L63F6: stx L6338
lda #$80 lda #$80
sta hide_cursor_flag sta desktop_initialized_flag
lda L6338 lda L6338
bne L640D bne L640D
bit L6339 bit L6339
@ -4294,17 +4294,16 @@ L64A4: rts
pha pha
plp plp
lda #$00 lda #$00
sta hide_cursor_flag sta desktop_initialized_flag
rts rts
.endproc .endproc
;;; ================================================== ;;; ==================================================
;;; SetUserHook
;;; $1F IMPL
;;; 3 bytes of params, copied to $82 ;;; 3 bytes of params, copied to $82
L64D2: SetUserHookImpl:
lda $82 lda $82
cmp #$01 cmp #$01
bne L64E5 bne L64E5
@ -4434,14 +4433,14 @@ checkerboard_pattern:
.byte $00 .byte $00
;;; ================================================== ;;; ==================================================
;;; SetUserHook ;;; AttachDriver
;;; 2 bytes of params, copied to $82 ;;; 2 bytes of params, copied to $82
.proc SetUserHookImpl .proc AttachDriverImpl
params := $82 params := $82
bit hide_cursor_flag bit desktop_initialized_flag
bmi fail bmi fail
lda params lda params

272
mgtk.inc
View File

@ -193,13 +193,11 @@ InPoly := $17
;;; Text Commands ;;; Text Commands
TextWidth := $18 ; Measure the width of a string in pixels TextWidth := $18 ; Measure the width of a string in pixels
;; (input length 3 bytes)
;; .addr data ;; .addr data
;; .byte length ;; .byte length
;; .word width result in pixels ;; .word width (out) result in pixels
DrawText := $19 ; Drawn at last SET_POS as left, baseline DrawText := $19 ; Drawn at last SET_POS as left, baseline
;; (input length 3 bytes)
;; .addr data ;; .addr data
;; .byte length ;; .byte length
@ -224,187 +222,203 @@ Version := $1C ; ???
;;; Initialization Calls ;;; Initialization Calls
StartDeskTop := $1D ; Inits state, registers interrupt handler, draws desktop StartDeskTop := $1D ; Inits state, registers interrupt handler, draws desktop
;; (input length 12 byte) ;; .byte machine ROM FBB3 ($06 = IIe or later)
;; ??? ;; .byte subid ROM FBC0 ($EA = IIe, $E0 = IIe enh/IIgs, $00 = IIc/IIc+)
;; .byte op_sys 0=ProDOS, 1=Pascal
;; .byte slot_num: Mouse slot, 0 = search (will be filled in)
;; .byte use_interrupts 0=passive, 1=interrupt
;; .addr sysfontptr
;; .addr savearea buffer for saving screen data (e.g. behind menus)
;; .word savesize bytes
StopDeskTop := $1E ; Deallocates interrupt, hides cursor StopDeskTop := $1E ; Deallocates interrupt, hides cursor
;; (no parameters; pass $0000 as address) ;; (no parameters)
SetUserHook := $1F
;; .byte hook_id 0=before, 1=after event checking
;; .addr routine_ptr 0=remove hook_id
;;; $1F ??? AttachDriver := $20 ; Install pointer driver; A=0 on success, $95 if mouse disabled
SetUserHook := $20 ; Install mouse hook; A=0 on success, $95 if mouse disabled
;; NOTE: Doesn't set the internal flag - buggy ???
;; (input length 2 bytes)
;; (output length 2 bytes)
;; .addr hook Mouse hook routine to install ;; .addr hook Mouse hook routine to install
;; .addr mouse_state (out) Address of mouse state (.word x, y; .byte status) ;; .addr mouse_state (out) Address of mouse state (.word x, y; .byte status)
ScaleMouse := $21 ; ??? ScaleMouse := $21 ; Set mouse/screen scaling
;; .byte x_exponent x-scale factor for mouse, 0...3
;; .byte y_exponent y-scale factor for mouse, 0...3
KeyboardMouse := $22 ; ??? KeyboardMouse := $22 ; Next operation will be performed by keyboard
;; (no parameters)
GetIntHandler := $23 ; Get address of interrupt handler GetIntHandler := $23 ; Get address of interrupt handler
;; (input length 0)
;; (output length 2 bytes)
;; .addr handler (out) Address of interrupt handler (after cld) ;; .addr handler (out) Address of interrupt handler (after cld)
;;; -------------------------------------------------- ;;; --------------------------------------------------
;;; Cursor Manager Calls ;;; Cursor Manager Calls
SetCursor := $24 ; Set cursor definition ;;; Cursor record:
;; (input not copied) ;;;
;; .res 24 bitmap 2x12 byte bitmap ;;; .res 24 bitmap 2x12 byte bitmap (XOR'd after mask)
;; .res 24 mask 2x12 byte mask ;;; .res 24 mask 2x12 byte mask (OR'd with screen)
;; .byte hotx hotspot coords ;;; .byte hotx hotspot coords (pixels)
;; .byte hoty ;;; .byte hoty
ShowCursor := $25 ; Return cursor to visibility SetCursor := $24 ; Set cursor definition
;; (no parameters; pass $0000 as address) ;; (input is address of Cursor record)
HideCursor := $26 ; Cursor hidden until ShowCursor call ShowCursor := $25 ; Return cursor to visibility
;; (no parameters; pass $0000 as address) ;; (no parameters)
ObscureCursor := $27 ; Cursor hidden until moved HideCursor := $26 ; Cursor hidden until ShowCursor call
;; (no parameters; pass $0000 as address) ;; (no parameters)
GetCursorAddr := $28 ; Get cursor definition ObscureCursor := $27 ; Cursor hidden until moved
;; (input length 0 bytes) ;; (no parameters)
;; (output length 2 bytes)
;; .addr definition See SetCursor GetCursorAddr := $28 ; Get cursor definition
;; .addr definition (out) Address of cursor record
;;; -------------------------------------------------- ;;; --------------------------------------------------
;;; Event Manager Calls ;;; Event Manager Calls
CheckEvents := $29 ; ??? ;;; Event record:
;;;
;;; .byte kind
;;; if kind is event_kind_key_down:
;;; .byte key (ASCII code; high bit clear)
;;; .byte modifiers (0=none, 1=open-apple, 2=solid-apple, 3=both)
;;; if kind is event_kind_update:
;;; .byte window_id
;;; if kind otherwise:
;;; .word xcoord
;;; .word ycoord
CheckEvents := $29 ; Process mouse/kbd if GetEvent will be delayed.
;; (no parameters)
GetEvent := $2A GetEvent := $2A
;; (input length 0 bytes) ;; (parameter is address of Event record)
;; (output length 5 bytes)
;; .byte kind
;; if kind is event_kind_key_down:
;; .byte key (ASCII code; high bit clear)
;; .byte modifiers (0=none, 1=open-apple, 2=solid-apple, 3=both)
;; if kind otherwise:
;; .word xcoord
;; .word ycoord
FlushEvents := $2B FlushEvents := $2B
;; (no parameters; pass $0000 as address) ;; (no parameters)
PeekEvent := $2C PeekEvent := $2C
;; (input length 0 bytes) ;; (parameter is address of Event record)
PostEvent := $2D ; Set pending input kind (mouse or keyboard) PostEvent := $2D ; Post event to queue
;; (input length 5 bytes) ;; (parameter is address of Event record)
;; .byte kind
;; if kind is event_kind_key_down:
;; .byte key ASCII code; high bit clear
;; .byte modifiers 0=none, 1=open-apple, 2=solid-apple, 3=both
;; if kind otherwise:
;; .word xcoord
;; .word ycoord
SetKeyEvent := $2E ; When set, keyboard is ignored in $29 calls SetKeyEvent := $2E ; If set, keypresses are ignored by MGTK
;; (input length 1 byte) ;; .byte handle_keys high bit set = ignore keyboard, otherwise check
;; .byte flag high bit set = ignore keyboard, otherwise check
;;; -------------------------------------------------- ;;; --------------------------------------------------
;;; Menu Manager Calls ;;; Menu Manager Calls
;;; Menu Bar record:
;;;
;;; .word count Number of menu bar items
;;; (array of...)
;;; .byte menu_id Menu identifier
;;; .byte disabled Flag
;;; .addr title Address of length-prefixed string
;;; .addr menu Address of Menu record
;;; .res 6 Reserved
;;; ...
;;;
;;; Menu record:
;;;
;;; .word count Number of items in menu
;;; (array of...)
;;; .res 5 Reserved
;;; .byte options bit 0=OA, 1=SA, 2=mark, 5=check, 6=filler, 7=disabled
;;; .byte mark_char Custom mark character if mark option set
;;; .byte char1 ASCII code of shortcut #1 (e.g. uppercase B); or 0
;;; .byte char2 ASCII code of shortcut #2 (e.g. lowercase b, or same); or 0
;;; .addr name Address of length-prefixed string
;;; ...
InitMenu := $2F InitMenu := $2F
;; .byte solid_char char code to use for solid apple glyph
;; .byte open_char char code to use for open apple glyph
;; .byte check_char char code to use for checkmark glyph
;; .byte control_char char code to use for control key glyph
;; .byte inactive_char (unused?)
SetMenu := $30 ; Configure (and draw) menu SetMenu := $30 ; Configure (and draw) menu
;; (input not copied) ;; (input is address of Menu Bar record)
;; .word count Number of top-level menus
;;
;; .word menu_id Menu identifier
;; .addr label Address of pascal (length-prefixed) string
;; .addr menu_defn Address of menu definition
;; .word 0,0,0 (overwritten with ???, left edge, right edge)
;; ...
;;
;; Menu definitions are:
;; .word count Number of items in menu
;; Menu items are:
;; .word 0,0 ???
;; .word has_shortcut 1 if has keyboard shortcuts, 0 otherwise
;; .byte shortcut1 ASCII code of shortcut #1 (e.g. uppercase B); or 0
;; .byte shortcut2 ASCII code of shortcut #2 (e.g. uppercase b, or same); or 0
;; .addr label Address of pascal (length-prefixed) string
;; or for a separator:
;; .word $40, $13, $0
MenuSelect := $31 ; Enter modal loop for handling mouse-down on menu bar MenuSelect := $31 ; Enter modal loop for handling mouse-down on menu bar
;; (input not copied) ;; .byte menu_id (out) Top level menu identifier, or 0 if none
;; (output 2 bytes) ;; .byte menu_item (out) Index (1-based) of item in menu, or 0 if none
;; .byte menu_id Top level menu identifier, or 0 if none
;; .byte item_num Index (1-based) of item in menu, or 0 if none MenuKey := $32 ; Find menu item corresponding to keypress
;; .byte menu_id (out)
;; .byte menu_item (out)
;; .byte which_key
;; .byte key_mods bit 0=OA, bit 1=SA
HiliteMenu := $33 ; Toggle highlight state of menu
;; .byte menu_id
MenuKey := $32
HiliteMenu := $33
DisableMenu := $34 DisableMenu := $34
;; .byte menu_id
;; .byte disable 0=enable, 1=disable
DisableItem := $35 DisableItem := $35
;; .byte menu_id
;; .byte menu_item
;; .byte disable 0=enable, 1=disable
CheckItem := $36 CheckItem := $36
;; .byte menu_id
;; .byte menu_item
;; .byte check 0=unchecked, 1=checked
SetMark := $37 SetMark := $37
;; .byte menu_id
;; .byte menu_item
;; .byte set_char 0=use checkmark, 1=use mark_char
;; .byte mark_char char code to use for mark
;;; -------------------------------------------------- ;;; --------------------------------------------------
;;; Window Manager Calls ;;; Window Manager Calls
;;; WInfo record:
;;;
;;; .byte id
;;; .byte options option_*
;;; .addr title
;;; .byte hscroll scroll_option_*
;;; .byte vscroll scroll_option_*
;;; .byte hthumbmax
;;; .byte hthumbpos
;;; .byte vthumbmax
;;; .byte vthumbpos
;;; .byte status
;;; .byte reserved
;;; .word mincontwidth minimum content size (horizontal)
;;; .word maxcontwidth maximum content size (horizontal)
;;; .word mincontlength minimum content size (vertical)
;;; .word maxcontlength maximum content size (vertical)
;;; GrafPort windowport GrafPort record
;;; .addr nextwinfo address of next lower window in stack
OpenWindow := $38 OpenWindow := $38
;; (input not copied) ;; (input is address of WInfo record)
;; .byte id
;; .byte options option_*
;; .addr title
;; .byte hscroll scroll_option_*
;; .byte vscroll scroll_option_*
;; .byte hsmax
;; .byte hspos
;; .byte vsmax
;; .byte vspos
;; .byte ???
;; .byte ???
;; .word width_a ??? possibly size of scroll area within window of scroll area?
;; .word height_a ???
;; .word width_b (of scroll area?)
;; .word height_b (of scroll area?)
;; - next section is identical to that for SetPort
;; .word left pixels from screen edge
;; .word top
;; .word screen_addr
;; .word screen_stride
;; .word maprect_x1 pixels scrolled
;; .word maprect_y1
;; .word maprect_x2 pixels
;; .word maprect_y2
;; .res 8 pattern
;; .byte mskand AND mask, default $FF
;; .byte mskor ORA mask, default $00
;; .word xpos
;; .word ypos
;; .byte penwidth
;; .byte penheight
;; .byte 0 ??? fill mode?
;; .byte textback text background
;; .addr textfont
;; .addr next address of next lower window in stack (filled in by call)
CloseWindow := $39 CloseWindow := $39
;; (input length 1 byte) ;; .byte window_id
;; .byte id
CloseAll := $3A CloseAll := $3A
;; (no parameters)
GetWinPtr := $3B ; Get pointer to window params by id; A=0 on success GetWinPtr := $3B ; Get pointer to window params by id; A=0 on success
;; (input length 1 byte) ;; .byte window_id
;; (output length 3 bytes) ;; .addr window_ptr (out) winfo address
;; .byte id of window
;; .addr window (out) window params
GetWinPort := $3C ; get drawing state of window GetWinPort := $3C ; Get drawing state of window
;; (input length 3 bytes) ;; .byte window_id
;; .byte id window
;; .addr port port definition to populate, like SetPort ;; .addr port port definition to populate, like SetPort
SetWinPort := $3D ; Update port by passed window id SetWinPort := $3D ; Update port by passed window id