a2d/a2d.inc

591 lines
21 KiB
PHP
Raw Normal View History

;;; ==================================================
;;; A2Desktop - GUI Library
;;; ==================================================
;;; ==================================================
;;; A2D Calls
A2D := $4000
;; MLI-style call (jsr A2D ; .byte call ; .addr params)
;; Call from AUX (RAMRDON/RAMWRTON)
2017-09-11 02:40:52 +00:00
;;; $40E5,(call*2) is the jump table used for processing these calls
;;; $4184,(call*2) defines param blocks input length
;;; if >=0, is length of param block
;;; if <0, and with $7E to get length
;;; if $4185,(call*2) is non-zero, param block is copied.
A2D_CFG_DISPLAY := $02 ; Configure display switches
;; (input length 1 byte)
;; Turns on 80 col/DHR, and then:
;; bit 0: LoRes if clear, HiRes if set
;; bit 1: Page 1 if clear, Page 2 if set
;; bit 2: Full screen if clear, split screen if set
;; bit 3: Graphics if clear, text if set
2017-09-14 04:35:23 +00:00
A2D_QUERY_SCREEN := $03 ; Get screen state
2017-09-11 02:40:52 +00:00
;; (input length 0 bytes)
2017-10-07 20:59:25 +00:00
;; (output length 36 bytes)
2017-09-10 04:15:01 +00:00
;; .word left
;; .word top
;; .addr addr A2D_SCREEN_ADDR
;; .word stride A2D_SCREEN_STRIDE
2017-10-08 03:22:39 +00:00
;; .word hoff
;; .word voff
2017-09-10 04:15:01 +00:00
;; .word width 560-1
;; .word height 192-1
;; .res 8 pattern
2017-09-14 04:35:23 +00:00
;; .byte mskand AND mask, default $FF
;; .byte mskor ORA mask, default $00
2017-10-07 20:59:25 +00:00
;; .word xpos
;; .word ypos
2017-09-14 04:35:23 +00:00
;; .byte hthick horizontal pen thickness
;; .byte vthick vertical pen thickness
;; .byte 0 ??? fill mode?
2017-10-08 03:22:39 +00:00
;; .byte tmask AND mask for text, default $7F
;; .addr font A2D_DEFAULT_FONT
2017-09-16 03:04:56 +00:00
2017-09-14 04:35:23 +00:00
A2D_SET_STATE := $04 ; Set full drawing state
2017-09-11 02:40:52 +00:00
;; (input length 36 bytes)
;; .word left pixels from screen edge
;; .word top
2017-09-14 04:35:23 +00:00
;; .addr addr A2D_SCREEN_ADDR
;; .word stride A2D_SCREEN_STRIDE
2017-10-08 03:22:39 +00:00
;; .word hoff pixels scrolled
;; .word voff
;; .word width pixels
;; .word height
;; .res 8 pattern
2017-09-14 04:38:35 +00:00
;; .byte mskand AND mask, default $FF
;; .byte mskor ORA mask, default $00
2017-10-07 20:59:25 +00:00
;; .word xpos
;; .word ypos
;; .byte hthick horizontal pen thickness
;; .byte vthick vertical pen thickness
;; .byte 0 ??? fill mode?
2017-10-08 03:22:39 +00:00
;; .byte tmask AND mask for text, default $7F
;; .addr font A2D_DEFAULT_FONT
2017-10-12 15:04:27 +00:00
A2D_GET_STATE := $05 ; Get pointer to active drawing state
2017-09-16 02:30:49 +00:00
;; (input length 0 bytes)
2017-10-12 15:04:27 +00:00
;; (output length 2 bytes)
;; .addr state (out)
2017-09-16 02:30:49 +00:00
A2D_SET_BOX := $06 ; Set just the drawing box, subset of full state
2017-09-11 02:40:52 +00:00
;; (input length 16 bytes)
2017-09-02 04:02:00 +00:00
;; .word left pixels from screen edge
;; .word top
2017-09-12 03:38:58 +00:00
;; .addr addr A2D_SCREEN_ADDR ($2000)
;; .word stride A2D_SCREEN_STRIDE ($80)
2017-10-08 03:22:39 +00:00
;; .word hoff pixels scrolled
;; .word voff
2017-09-02 04:02:00 +00:00
;; .word width pixels
;; .word height
2017-09-10 17:40:08 +00:00
A2D_SET_FILL_MODE := $07
2017-09-11 02:40:52 +00:00
;; (input length 1 byte)
2017-10-08 03:22:39 +00:00
;; .byte mode (>=4 also sets eor mask to $7f)
2017-09-03 03:23:14 +00:00
A2D_SET_PATTERN := $08
2017-09-11 02:40:52 +00:00
;; (input length 8 bytes)
;; .res 8 pattern 8x8 pixel pattern for A2D_FILL_RECT calls
2017-10-07 20:59:25 +00:00
A2D_SET_MSK := $09
;; (input length 2 bytes)
;; .byte mskand
;; .byte mskor
2017-09-03 01:51:03 +00:00
A2D_SET_THICKNESS := $0A
2017-09-11 03:40:32 +00:00
;; (input length 2 bytes)
;; .byte hthick horizontal pen thickness
;; .byte vthick vertical pen thickness
2017-09-11 03:40:32 +00:00
A2D_SET_FONT := $0B
;; (input length 2 bytes)
;; .addr font font definition (see below)
2017-09-19 05:51:24 +00:00
A2D_SET_TEXT_MASK := $0C ; Stored to background before XORing glyph
2017-09-11 02:40:52 +00:00
;; (input length 1 byte)
2017-09-19 05:51:24 +00:00
;; .byte mask
2017-09-03 01:51:03 +00:00
2017-10-08 15:42:27 +00:00
A2D_OFFSET_POS := $0D ; Adjust start of subsequent DRAW_TEXT, DRAW_LINE
;; (input length 4 bytes)
;; .word xdelta
;; .word ydelta
2017-09-19 05:51:24 +00:00
A2D_SET_POS := $0E ; Start of subsequent DRAW_TEXT, DRAW_LINE
2017-09-11 02:40:52 +00:00
;; (input length 4 bytes)
2017-09-19 04:43:35 +00:00
;; .word xcoord
;; .word ycoord
2017-09-01 15:15:05 +00:00
2017-09-19 04:43:35 +00:00
A2D_DRAW_LINE := $0F ; Draw line (from SET_POS)
2017-09-11 03:40:32 +00:00
;; (input length 4 bytes)
2017-09-19 04:43:35 +00:00
;; .word xdelta signed, delta in pixels
;; .word ydelta
2017-09-11 03:40:32 +00:00
2017-10-07 22:07:12 +00:00
A2D_DRAW_LINE_ABS := $10 ; Draw line (from SET_POS)
;; (input length 4 bytes)
;; .word xcoord end coords in pixels
;; .word ycoord
A2D_FILL_RECT := $11 ; Fill rectangle with selected simple pattern/thickness
2017-09-11 02:40:52 +00:00
;; (input length 8 bytes)
2017-09-07 06:43:40 +00:00
;; .word left (includes scroll pos)
;; .word top
;; .word right pixels
;; .word bottom
A2D_DRAW_RECT := $12 ; Draw rectangle with selected simple pattern/thickness
2017-09-11 02:40:52 +00:00
;; (input length 8 bytes)
;; .word left pixels
2017-09-07 06:43:40 +00:00
;; .word top
;; .word right
2017-09-07 06:43:40 +00:00
;; .word bottom
2017-09-02 16:44:33 +00:00
A2D_TEST_BOX := $13 ; Is pos (via SET_POS) in bounds? Returns true/false in A
2017-09-11 02:40:52 +00:00
;; (input length 8 bytes)
2017-09-09 19:18:06 +00:00
;; .word left
;; .word top
;; .word right
;; .word bottom
A2D_DRAW_BITMAP := $14 ; Draw pattern
2017-09-11 02:40:52 +00:00
;; (input length 16 bytes)
2017-09-10 00:43:37 +00:00
;; .word left
;; .word top
2017-09-25 00:57:57 +00:00
;; .addr bitmap bitmap is 7 bits per byte, 0 = black, 1 = white
;; .byte stride bitmap width in bytes
;; .byte 0 ???
2017-10-08 03:22:39 +00:00
;; .word hoff offset within bitmap definition
;; .word voff
2017-09-10 00:43:37 +00:00
;; .word width pixels
;; .word height pixels
2017-09-02 16:44:33 +00:00
2017-09-16 02:30:49 +00:00
;; $15 used in DeskTop but not DAs - icon redraw
;; (input length 0 bytes)
2017-10-14 06:23:31 +00:00
A2D_DRAW_POLYGONS := $16 ; Draw multiple closed polygons
2017-09-16 02:30:49 +00:00
;; (input length 0 bytes)
2017-10-14 06:23:31 +00:00
;; Address points at struct:
;; .byte points count
;; .byte flag high bit clear if this is last polygon, set if not
;; .word x1, y1
;; .word x2, y2
;; ...
2017-09-16 02:30:49 +00:00
;; $17 used in DeskTop but not DAs - maybe selection drag
;; (input length 0 bytes)
A2D_MEASURE_TEXT := $18 ; Measure the width of a string in pixels
2017-09-11 02:40:52 +00:00
;; (input length 3 bytes)
;; .addr data
;; .byte length
;; .word width result in pixels
2017-09-09 19:18:06 +00:00
A2D_DRAW_TEXT := $19 ; Drawn at last SET_POS as left, baseline
2017-09-11 02:40:52 +00:00
;; (input length 3 bytes)
2017-08-31 03:30:46 +00:00
;; .addr data
;; .byte length
2017-09-21 15:09:11 +00:00
A2D_CONFIGURE_ZP_USE := $1A ; Configure ZP usage by API (speed vs. convenience)
2017-09-11 02:40:52 +00:00
;; (input length 1 byte)
2017-09-21 15:09:11 +00:00
;; .byte flag (AWS_CZP_*; high bit set = preserve ZP during calls)
2017-10-15 05:09:00 +00:00
A2D_INIT_SCREEN_AND_MOUSE := $1D; Inits state, registers interrupt handler, draws desktop
;; (input length 12 byte)
;; ???
A2D_DISABLE_MOUSE := $1E ; Deallocates interrupt, hides cursor
;; (no parameters; pass $0000 as address)
A2D_HOOK_MOUSE := $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 mouse_state (out) Address of mouse state (.word x, y; .byte status)
2017-10-16 03:20:54 +00:00
A2D_GET_INT_HANDLER := $24 ; Get address of interrupt handler
;; (input length 0)
;; (output length 2 bytes)
;; .addr handler (out) Address of interrupt handler (after cld)
2017-10-14 19:51:25 +00:00
A2D_SET_CURSOR := $24 ; Set cursor definition
2017-09-19 04:32:46 +00:00
;; (input not copied)
;; .res 24 bitmap 2x12 byte bitmap
;; .res 24 mask 2x12 byte mask
;; .byte hotx hotspot coords
2017-09-19 04:32:46 +00:00
;; .byte hoty
2017-10-14 19:56:59 +00:00
A2D_SHOW_CURSOR := $25 ; Return cursor to visibility
2017-09-11 02:40:52 +00:00
;; (no parameters; pass $0000 as address)
2017-09-07 06:43:40 +00:00
2017-10-14 19:56:59 +00:00
A2D_HIDE_CURSOR := $26 ; Cursor hidden until A2D_SHOW_CURSOR call
;; (no parameters; pass $0000 as address)
A2D_ERASE_CURSOR := $27 ; Cursor hidden until moved or other A2D call
2017-09-11 02:40:52 +00:00
;; (no parameters; pass $0000 as address)
2017-09-07 06:43:40 +00:00
2017-10-14 19:51:25 +00:00
A2D_GET_CURSOR := $28 ; Get cursor definition
;; (input length 0 bytes)
;; (output length 2 bytes)
;; .addr definition See A2D_SET_CURSOR
2017-09-09 19:18:06 +00:00
A2D_GET_INPUT := $2A
2017-09-11 02:40:52 +00:00
;; (input length 0 bytes)
;; (output length 5 bytes)
;; .byte state (A2D_INPUT_*)
;; if state is A2D_INPUT_KEY:
;; .byte key (ASCII code; high bit clear)
;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both)
;; if state otherwise:
2017-09-09 03:45:11 +00:00
;; .word xcoord
;; .word ycoord
2017-09-01 02:05:41 +00:00
2017-09-11 02:40:52 +00:00
A2D_UNK_2B := $2B ; Unknown - possibly "reset drawing state"
;; (no parameters; pass $0000 as address)
2017-09-25 04:02:13 +00:00
;; $2C used in DeskTop but not DAs - icon drag
2017-09-16 02:30:49 +00:00
;; (input length 0 bytes)
2017-09-19 14:58:17 +00:00
A2D_SET_INPUT := $2D ; Set pending input state (mouse or keyboard)
2017-09-11 02:40:52 +00:00
;; (input length 5 bytes)
;; .byte state A2D_INPUT_*
2017-09-19 14:58:17 +00:00
;; if state is A2D_INPUT_KEY:
;; .byte key ASCII code; high bit clear
;; .byte modifiers 0=none, 1=open-apple, 2=closed-apple, 3=both
2017-09-19 14:58:17 +00:00
;; if state otherwise:
;; .word xcoord
;; .word ycoord
2017-10-16 03:28:50 +00:00
A2D_SET_KBD_FLAG := $2E ; When set, keyboard is ignored in $29 calls
;; (input length 1 byte)
;; .byte flag high bit set = ignore keyboard, otherwise check
2017-10-15 02:45:51 +00:00
A2D_SET_MENU := $30 ; Configure (and draw) menu
;; (input not copied)
;; .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
A2D_MENU_CLICK := $31 ; Enter modal loop for handling mouse-down on menu bar
;; (input not copied)
;; (output 2 bytes)
;; .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
2017-09-01 02:05:41 +00:00
A2D_CREATE_WINDOW := $38
;; (input not copied)
;; .byte id 0 = desktop, 1-...n = DeskTop windows, DAs use 51, 52, 100
;; .byte flags A2D_CWF_*
2017-09-02 01:32:37 +00:00
;; .addr title
;; .byte hscroll A2D_CWS_*
;; .byte vscroll A2D_CWS_*
;; .byte hsmax
;; .byte hspos
;; .byte vsmax
;; .byte vspos
2017-09-03 01:51:03 +00:00
;; .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?)
2017-09-14 04:35:23 +00:00
;; - next section is identical to that for A2D_SET_STATE
;; .word left pixels from screen edge
;; .word top
;; .word screen_addr
;; .word screen_stride
2017-10-08 03:22:39 +00:00
;; .word hoff pixels scrolled
;; .word voff
;; .word width pixels
2017-09-03 01:51:03 +00:00
;; .word height
;; .res 8 pattern
2017-09-14 04:38:35 +00:00
;; .byte mskand AND mask, default $FF
;; .byte mskor ORA mask, default $00
2017-10-07 20:59:25 +00:00
;; .word xpos
;; .word ypos
;; .byte hthick
;; .byte vthick
;; .byte 0 ??? fill mode?
2017-10-08 03:22:39 +00:00
;; .byte tmask AND mask for text, default $7F
;; .addr font A2D_DEFAULT_FONT
;; .addr next address of next lower window in stack (filled in by call)
2017-09-01 02:05:41 +00:00
A2D_DESTROY_WINDOW := $39
2017-09-11 02:40:52 +00:00
;; (input length 1 byte)
2017-09-06 06:24:21 +00:00
;; .byte id
2017-08-31 03:30:46 +00:00
2017-10-12 04:33:23 +00:00
A2D_QUERY_WINDOW := $3B ; Get pointer to window params by id; A=0 on success
2017-09-16 02:30:49 +00:00
;; (input length 1 byte)
2017-10-12 04:33:23 +00:00
;; (output length 3 bytes)
;; .byte id of window
;; .addr window (out) window params
2017-09-16 02:30:49 +00:00
A2D_QUERY_STATE := $3C ; get drawing state of window
2017-09-11 02:40:52 +00:00
;; (input length 3 bytes)
2017-09-10 01:11:01 +00:00
;; .byte id window
2017-09-14 04:35:23 +00:00
;; .addr state state definition to populate, like A2D_SET_STATE
2017-10-15 04:15:35 +00:00
A2D_UPDATE_STATE := $3D ; Update drawing state by passed window id
;; ** Implementation appears buggy - or maybe just really cryptic ??? **
;; (input length 2 bytes)
;; .byte id window
;; .byte ???
A2D_REDRAW_WINDOW := $3E ; Draws window border, background, title bar, scroll bars
;; (input length 1 byte)
;; .byte id
2017-09-09 03:45:11 +00:00
A2D_QUERY_TARGET := $40
2017-09-11 02:40:52 +00:00
;; (input length 4 bytes)
;; .word queryx relative to screen
2017-09-09 03:45:11 +00:00
;; .word queryy
2017-10-12 04:33:23 +00:00
;; .byte element (out) A2D_ELEM_*
;; .byte id (out) of window
2017-08-31 03:30:46 +00:00
2017-10-15 04:15:35 +00:00
A2D_QUERY_TOP := $41 ; Get id of top window
2017-09-16 02:30:49 +00:00
;; (input length 0 bytes)
2017-10-15 04:15:35 +00:00
;; (output length 1 byte)
;; .byte id (out) window, or 0 if none
2017-09-16 02:30:49 +00:00
2017-10-15 04:15:35 +00:00
A2D_RAISE_WINDOW := $42 ; Make window topmost
2017-10-12 04:33:23 +00:00
;; (input length 1 byte)
2017-10-15 04:15:35 +00:00
;; .byte id window
2017-10-12 04:33:23 +00:00
A2D_CLOSE_CLICK := $43
2017-09-11 02:40:52 +00:00
;; (input length 0 bytes)
2017-10-12 04:33:23 +00:00
;; .byte clicked (out) 0 = cancelled, 1 = clicked
;; .byte ?? (out)
;; .byte ?? (out)
2017-08-31 03:30:46 +00:00
2017-09-11 02:40:52 +00:00
A2D_DRAG_WINDOW := $44
;; (input length 5 bytes)
;; .byte id window
;; .word xcoord mouse coords
2017-09-11 02:40:52 +00:00
;; .word ycoord
2017-09-25 04:02:13 +00:00
;; .byte moved high bit set if moved, clear if not
2017-09-11 02:40:52 +00:00
2017-09-02 02:54:04 +00:00
A2D_DRAG_RESIZE := $45
2017-09-11 02:40:52 +00:00
;; (input length 5 bytes)
;; .byte id window
;; .word xcoord mouse coords
;; .word ycoord
;; .byte ?? likely: moved? 0 = no change, 1 = moved
2017-09-02 02:54:04 +00:00
A2D_MAP_COORDS := $46 ; Map screen coords to client coords
2017-09-11 02:40:52 +00:00
;; (input length 5 bytes)
2017-09-09 03:13:09 +00:00
;; .byte window_id
;; .word screenx
;; .word screeny
;; .word clientx
;; .word clienty
2017-08-31 03:30:46 +00:00
A2D_QUERY_CLIENT:= $48
2017-09-11 02:40:52 +00:00
;; (input length 4 bytes)
;; .word xcoord
;; .word ycoord
;; .byte part A2D_CLIENT, A2D_HSCROLL or A2D_VSCROLL
;; .byte scroll A2D_SCROLL_PART_*
2017-09-01 05:12:02 +00:00
A2D_RESIZE_WINDOW := $49 ; ???
2017-09-11 02:40:52 +00:00
;; (input length 3 bytes)
;; .byte ??? maybe part (i.e. HSCROLL or VSCROLL) ???
;; .byte ??? width fraction ??
;; .byte ???
2017-09-02 02:54:04 +00:00
A2D_DRAG_SCROLL := $4A
2017-09-11 02:40:52 +00:00
;; (input length 5 bytes)
;; .byte type A2D_HSCROLL or A2D_VSCROLL
;; .word mouse xcoord
;; .word mouse ycoord
;; .byte position 0...255
;; .byte moved 0 = no change, 1 = moved
2017-08-31 03:30:46 +00:00
2017-08-31 15:10:51 +00:00
A2D_UPDATE_SCROLL:= $4B
2017-09-11 02:40:52 +00:00
;; (input length 3 bytes)
;; .byte type A2D_HSCROLL or A2D_VSCROLL
;; .byte pos new position 0...250
2017-09-11 02:40:52 +00:00
;; .byte ???
;;; $4E looks like last call
;;; ==================================================
;;; Constants
2017-09-14 04:35:23 +00:00
;;; Used in A2D_QUERY_STATE / A2D_SET_BOX
A2D_SCREEN_ADDR := $2000 ; Screen address
2017-10-07 20:59:25 +00:00
A2D_SCREEN_STRIDE := $80 ; Stride in bytes
2017-09-09 03:13:09 +00:00
;;; Used in A2D_GET_INPUT
A2D_INPUT_NONE := 0 ; No mouse or keypress
A2D_INPUT_DOWN := 1 ; Mouse button was depressed
A2D_INPUT_UP := 2 ; Mouse button was released
A2D_INPUT_KEY := 3 ; Key was pressed
A2D_INPUT_HELD := 4 ; Mouse button still down
A2D_INPUT_DOWN_MOD := 5 ; Mouse button was depressed, modifier key down
2017-09-02 02:54:04 +00:00
2017-09-01 05:39:06 +00:00
;;; Used in A2D_GET_MOUSE
2017-09-01 06:03:46 +00:00
A2D_ELEM_DESKTOP:= 0
A2D_ELEM_MENU := 1
A2D_ELEM_CLIENT := 2 ; Includes scroll bars
2017-09-01 05:39:06 +00:00
A2D_ELEM_TITLE := 3
2017-09-01 16:20:32 +00:00
A2D_ELEM_RESIZE := 4
2017-09-01 05:39:06 +00:00
A2D_ELEM_CLOSE := 5
;;; Used in A2D_QUERY_CLIENT, A2D_DRAG_SCROLL, A2D_UPDATE_SCROLL
A2D_CLIENT := 0
A2D_VSCROLL := 1
A2D_HSCROLL := 2
;;; Used in A2D_QUERY_CLIENT
A2D_SCROLL_PART_UP := 1
A2D_SCROLL_PART_LEFT := 1
A2D_SCROLL_PART_DOWN := 2
A2D_SCROLL_PART_RIGHT := 2
A2D_SCROLL_PART_ABOVE := 3
A2D_SCROLL_PART_BEFORE := 3
A2D_SCROLL_PART_BELOW := 4
A2D_SCROLL_PART_AFTER := 4
A2D_SCROLL_PART_THUMB := 5
2017-09-10 17:40:08 +00:00
;;; Used in A2D_SET_FILL_MODE
A2D_SFM_NORMAL := 0
A2D_SFM_XOR := 6
2017-09-03 03:29:06 +00:00
;;; Used in A2D_CREATE_WINDOW
A2D_CWF_NOTITLE := 1 << 0
A2D_CWF_ADDCLOSE := 1 << 1
A2D_CWF_ADDRESIZE := 1 << 2
2017-09-03 03:49:28 +00:00
A2D_CWS_NOSCROLL := 0
A2D_CWS_SCROLL_ENABLED := 1 << 7
A2D_CWS_SCROLL_THUMB := 1 << 6
A2D_CWS_SCROLL_TRACK := 1 << 0
A2D_CWS_SCROLL_NORMAL := A2D_CWS_SCROLL_ENABLED | A2D_CWS_SCROLL_THUMB | A2D_CWS_SCROLL_TRACK
2017-09-03 03:49:28 +00:00
2017-09-21 15:09:11 +00:00
;;; Used in A2D_CONFIGURE_ZP_USE
A2D_CZP_PRESERVE := 1<<7
A2D_CZP_OVERWRITE := 0
2017-09-21 15:09:11 +00:00
2017-09-15 08:02:38 +00:00
;;; Used in various state blocks
A2D_DEFAULT_MSKAND := $FF
A2D_DEFAULT_MSKOR := $00
2017-10-08 03:22:39 +00:00
A2D_DEFAULT_TMASK := $7F
2017-09-01 05:39:06 +00:00
;;; ==================================================
;;; Macros
;;; Call an A2D entry point:
;;; A2D_CALL n - params is $0000
;;; A2D_CALL n, params_addr
;;; A2D_CALL m, params_addr, label - params_addr is labeled for modifying
2017-09-07 04:33:22 +00:00
.macro A2D_CALL op, addr, label
jsr A2D
.byte op
2017-09-07 04:33:22 +00:00
.if .paramcount > 2
label := *
.endif
2017-09-07 06:43:40 +00:00
.if .paramcount > 1
.addr addr
2017-09-07 06:43:40 +00:00
.else
.addr 0
.endif
.endmacro
;;; ------------------------------------
2017-09-13 05:01:45 +00:00
.macro A2D_DEFSTRING str, label ; String definition, for use with A2D_TEXT
2017-09-13 04:27:27 +00:00
.local data ; Call as A2D_DEFSTRING "abc"
.local end ; Can include control chars by using:
.addr data ; A2D_DEFSTRING {"abc",$0D,"def"}
2017-09-28 19:24:41 +00:00
.if .paramcount > 1
label:
.endif
2017-09-13 04:27:27 +00:00
.byte end - data
data: .byte str
2017-09-13 04:27:27 +00:00
end:
.endmacro
2017-09-04 04:47:45 +00:00
2017-09-06 06:24:21 +00:00
.macro PASCAL_STRING str ; Length-prefixed string
2017-09-28 15:45:05 +00:00
.local data ; Can include control chars by using:
.local end ; A2D_DEFSTRING {"abc",$0D,"def"}
.byte end - data
data: .byte str
end:
2017-09-06 06:24:21 +00:00
.endmacro
2017-09-29 20:57:02 +00:00
2017-09-14 04:58:37 +00:00
;;; Define pattern for A2D_DRAW_BITMAP - low 7 bits are reversed
;;; e.g. .byte px(%1000000)
2017-09-28 02:41:40 +00:00
;;; px() has high bit clear, PX() has high bit set
.define px(bits) (((bits&$40)>>6)|((bits&$20)>>4)|((bits&$10)>>2)|(bits&$8)|((bits&$4)<<2)|((bits&$2)<<4)|((bits&$1)<<6))
2017-09-28 02:41:40 +00:00
.define PX(bits) (((bits&$40)>>6)|((bits&$20)>>4)|((bits&$10)>>2)|(bits&$8)|((bits&$4)<<2)|((bits&$2)<<4)|((bits&$1)<<6)|$80)
2017-09-04 04:47:45 +00:00
;;; ==================================================
;;; Internals
2017-09-16 03:04:56 +00:00
A2D_DEFAULT_FONT := $8800
2017-09-16 03:04:56 +00:00
font_flag := $8800 ; = $00 - if high bit set, glyphs are 2 bytes wide (???)
font_size_count := $8801 ; = $7F - max glyph number (count is this + 1)
2017-09-16 04:31:20 +00:00
font_height := $8802 ; 9 pixels
2017-09-16 03:04:56 +00:00
font_width_table := $8803 ; width in pixels, indexed by ASCII code
2017-09-16 04:31:20 +00:00
font_glyphs := $8883 ; $80 glyphs, organized by row, 9 bytes per
;; So glyph for A $41
;; width is at $8803 + $41 = $8844 which is 7
;; row0 is at $8883 + $41 + (0 * $80) = $88C4 ~ $1E = %00011110
;; row1 is at $8883 + $41 + (1 * $80) = $8944 ~ $33 = %00110011
;; etc
;;
;; 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 $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)
A2D_GLYPH_LARROW := $09
A2D_GLYPH_RARROW := $15
A2D_GLYPH_UARROW := $0B
A2D_GLYPH_DARROW := $0A
A2D_GLYPH_RETURN := $0D
2017-09-28 15:45:05 +00:00
A2D_GLYPH_OAPPLE := $1F
2017-09-30 02:51:11 +00:00
A2D_GLYPH_CAPPLE := $1E