Rename A2D to MGTK

This commit is contained in:
Joshua Bell 2018-01-28 21:18:00 -08:00
parent 2e61ed294d
commit 1ae615fb20
18 changed files with 1252 additions and 1184 deletions

View File

@ -13,7 +13,7 @@ New desk accessories:
* Loaded at $800 through (at least) $14FF
* Copy themselves from Main into Aux memory (same location)
* Can call into ProDOS MLI and A2D entry points ($4000, etc)
* Can call into ProDOS MLI and MGTK/A2D entry points ($4000, etc)
## Files

View File

@ -1,32 +1,32 @@
# A2D API
# MGTK API
There are three distinct API classes that need to be used:
* Main A2D API - entry point $4000 AUX, called MLI-style (JSR followed by command type and address of param block)
* Main MGTK API - entry point $4000 AUX, called MLI-style (JSR followed by command type and address of param block)
* DeskTop Jump Table - simple JSR calls starting at $4003 MAIN, no arguments
* DeskTop API - another MLI-style interface starting at $8E00 AUX
## Main A2D API
## Main MGTK API
### Concepts
#### Box
#### GrafPort
The _box_ block is reused in several places. It has the following structure:
The _port_ block is reused in several places. It has the following structure:
```
.word left pixels from screen left edge
.word top pixels from screen top edge
.addr addr A2D_SCREEN_ADDR ($2000)
.word stride A2D_SCREEN_STRIDE ($80)
.addr addr screen address $2000
.word stride screen stride $80
.word hoff pixels scrolled left
.word voff pixels scrolled up
.word width pixels wide
.word height pixels tall
```
Drawing state can be set to a box (A2D_SET_BOX) and then subsequent operations will occur
within the box: they will be clipped to the bounds and the offset will be taken into account.
Drawing state can be set to a port (SetPort) and then subsequent operations will occur
within the port: they will be clipped to the bounds and the offset will be taken into account.
For example, if hoffset is 15 and voffset is 5 then a pixel plotted at 40, 40 will appear
at 40 - 15 = 25 pixels from the left edge and 40 - 5 = 35 pixels from the top edge.
@ -48,12 +48,12 @@ optional _resize box_ and optional _scroll bars_.
* Copy DA code from MAIN to AUX (e.g. using AUXMOVE)
* Transfer control to AUX
* Turn on ALTZP and LCBANK1
* Create window (A2D_CREATE_WINDOW)
* Create window (OpenWindow)
* Draw everything
* Call $2B (no idea what this does!)
* Enter [input loop](#input-loop)
* ...
* Destroy window (A2D_DESTROY_WINDOW)
* Destroy window (CloseWindow)
* Redraw desktop icons (DESKTOP_REDRAW_ICONS)
* Switch control back to MAIN (RAMRDOFF/RAMWRTOFF)
* Ensure ALTZP and LCBANK1 are on
@ -66,26 +66,26 @@ optional _resize box_ and optional _scroll bars_.
#### Input Loop
* Call A2D_GET_INPUT.
* If a key (A2D_INPUT_KEY), then check modifiers (Open/Closed Apple) and key code, ignore or take action.
* If a click, call A2D_QUERY_TARGET.
* Call GetEvent.
* If a key, then check modifiers (Open/Closed Apple) and key code, ignore or take action.
* If a click, call FindWindow.
* If target id not the window id, ignore.
* If target element is desktop (A2D_ELEM_DESKTOP) or menu (A2D_ELEM_MENU) then ignore.
* If target element is close box (A2D_ELEM_CLOSE) then initiate [window close](#window-close).
* If target element is title bar (A2D_ELEM_TITLE) then initiate [window drag](#window-drag).
* If target element is resize box (A2D_ELEM_RESIZE) then initiate [window resize](#window-resize).
* Otherwise, it is client area (A2D_ELEM_CLIENT); call A2D_QUERY_CLIENT.
* If client part is a scrollbar (A2D_VSCROLL or A2D_HSCROLL) then initiate a [scroll](#window-scroll).
* If target element is desktop or menu then ignore.
* If target element is close box then initiate [window close](#window-close).
* If target element is title bar then initiate [window drag](#window-drag).
* If target element is resize box then initiate [window resize](#window-resize).
* Otherwise, it is client area; call FindControl.
* If client part is a scrollbar then initiate a [scroll](#window-scroll).
* Otherwise, handle a client click using custom logic (e.g. hit testing buttons, etc)
#### Window Close
* Call A2D_CLOSE_CLICK, which enters a modal loop to handle the mouse moving out/in the box.
* Call TrackGoAway, which enters a modal loop to handle the mouse moving out/in the box.
* Result indicates clicked or canceled; if clicked, exit the DA, otherwise ignore.
#### Window Drag
* Call A2D_DRAG_WINDOW.
* Call DragWindow.
* Call JUMP_TABLE_REDRAW_ALL.
* If _offscreen flag_ was not set, redraw desktop icons (DESKTOP_REDRAW_ICONS).
* Set _offscreen flag_ if window's `top` is greater than or equal to the screen bottom (191), clear otherwise.
@ -93,10 +93,10 @@ optional _resize box_ and optional _scroll bars_.
#### Window Resize
* Call A2D_DRAG_RESIZE.
* Call GrowWindow.
* Call JUMP_TABLE_REDRAW_ALL.
* Call DESKTOP_REDRAW_ICONS.
* Call A2D_RESIZE_WINDOW if needed to adjust scroll bar settings. (Details TBD).
* Call UpdateThumb if needed to adjust scroll bar settings. (Details TBD).
* Redraw window.
#### Window Scroll
@ -155,6 +155,6 @@ Parameters: none (pass $0000 as address)
Redraws the icons on the desktop (mounted volumes, trash). This call is required in these cases:
* After destroying a window (A2D_DESTROY_WINDOW)
* After repainting the desktop (JUMP_TABLE_REDRAW_ALL) following a drag (A2D_DRAG_WINDOW)
* After repainting the desktop (JUMP_TABLE_REDRAW_ALL) following a resize (A2D_DRAG_RESIZE/A2D_RESIZE_WINDOW)
* After destroying a window (CloseWindow)
* After repainting the desktop (JUMP_TABLE_REDRAW_ALL) following a drag (DragWindow)
* After repainting the desktop (JUMP_TABLE_REDRAW_ALL) following a resize (GrowWindow)

View File

@ -6,7 +6,7 @@
.include "../inc/applesoft.inc"
.include "../inc/prodos.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move; font
.org $800
@ -104,8 +104,8 @@ call_init:
lda #window_id
jsr check_visibility_and_draw_window
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, state_params
rts
.proc routine
@ -142,8 +142,8 @@ offscreen_flag:
;; Is skipping this responsible for display redraw bug?
;; https://github.com/inexorabletash/a2d/issues/34
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, state_params
lda query_state_params_id
cmp #window_id
bne :+
@ -202,11 +202,11 @@ id: .byte 0
query_state_params_id := query_state_params::id
.proc preserve_zp_params
flag: .byte A2D_CZP_PRESERVE
flag: .byte MGTK::zp_preserve
.endproc
.proc overwrite_zp_params
flag: .byte A2D_CZP_OVERWRITE
flag: .byte MGTK::zp_overwrite
.endproc
;;; ==================================================
@ -660,9 +660,9 @@ text_buffer2:
.res text_buffer_size+2, 0
spaces_string:
A2D_DEFSTRING " "
DEFINE_STRING " "
error_string:
A2D_DEFSTRING "Error "
DEFINE_STRING "Error "
;; used when clearing display; params to a $18 call
.proc measure_text_params
@ -694,7 +694,7 @@ base: .word 16
farg: .byte $00,$00,$00,$00,$00,$00
.proc title_bar_decoration ; Params for A2D_DRAW_BITMAP
.proc title_bar_decoration ; Params for MGTK::PaintBits
left: .word 115 ; overwritten
top: .word $FFF7 ; overwritten
bitmap:.addr pixels
@ -740,25 +740,25 @@ font: .addr 0
screen_width := 560
screen_height := 192
;; params for A2D_SET_BOX when decorating title bar
;; params for MGTK::SetPortSite when decorating title bar
.proc screen_box
.word 0
.word menu_bar_height
.word A2D_SCREEN_ADDR
.word A2D_SCREEN_STRIDE
.word MGTK::screen_mapbits
.word MGTK::screen_mapwidth
.word 0, 0 ; hoff/voff
.word screen_width - 1
.word screen_height - menu_bar_height - 2
.endproc
.proc fill_mode_normal
mode: .byte A2D_SFM_NORMAL
mode: .byte MGTK::pencopy
.endproc
.byte $01,$02 ; ??
.proc fill_mode_xor
mode: .byte A2D_SFM_XOR
mode: .byte MGTK::notpenXOR
.endproc
window_width := 130
@ -768,10 +768,10 @@ mode: .byte A2D_SFM_XOR
.proc create_window_params
id: .byte window_id
flags: .byte A2D_CWF_ADDCLOSE
flags: .byte MGTK::option_go_away_box
title: .addr window_title
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_NOSCROLL
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hs_max: .byte 0
hs_pos: .byte 0
vs_max: .byte 0
@ -783,15 +783,15 @@ w2: .word window_width
h2: .word window_height
left: .word default_left
top: .word default_top
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word window_width
height: .word window_height
pattern:.res 8, $FF
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -812,11 +812,11 @@ window_title:
init: sta ALTZPON
lda LCBANK1
lda LCBANK1
A2D_CALL A2D_CONFIGURE_ZP_USE, preserve_zp_params
A2D_CALL A2D_CREATE_WINDOW, create_window_params
A2D_CALL A2D_QUERY_SCREEN, state_params
A2D_CALL A2D_SET_STATE, state_params
A2D_CALL $2B ; reset drawing state?
MGTK_CALL MGTK::SetZP1, preserve_zp_params
MGTK_CALL MGTK::OpenWindow, create_window_params
MGTK_CALL MGTK::InitPort, state_params
MGTK_CALL MGTK::SetPort, state_params
MGTK_CALL $2B ; reset drawing state?
jsr reset_buffer2
@ -880,14 +880,14 @@ loop: lda adjust_txtptr_copied-1,x
;;; Input Loop
input_loop:
A2D_CALL A2D_GET_INPUT, input_state_params
MGTK_CALL MGTK::GetEvent, input_state_params
lda input_state_params::state
cmp #A2D_INPUT_DOWN
cmp #MGTK::button_down
bne :+
jsr on_click
jmp input_loop
: cmp #A2D_INPUT_KEY
: cmp #MGTK::key_down
bne input_loop
jsr on_key_press
jmp input_loop
@ -896,9 +896,9 @@ input_loop:
;;; On Click
on_click:
A2D_CALL A2D_QUERY_TARGET, target_params
MGTK_CALL MGTK::FindWindow, target_params
lda target_params::elem
cmp #A2D_ELEM_CLIENT ; Less than CLIENT is MENU or DESKTOP
cmp #MGTK::area_content ; Less than CLIENT is MENU or DESKTOP
bcc ignore_click
lda target_params::id
cmp #window_id ; This window?
@ -908,21 +908,21 @@ ignore_click:
rts
: lda target_params::elem
cmp #A2D_ELEM_CLIENT ; Client area?
cmp #MGTK::area_content ; Client area?
bne :+
jsr map_click_to_button ; try to translate click into key
bcc ignore_click
jmp process_key
: cmp #A2D_ELEM_CLOSE ; Close box?
: cmp #MGTK::area_close_box ; Close box?
bne :+
A2D_CALL A2D_CLOSE_CLICK, close_click_params
MGTK_CALL MGTK::TrackGoAway, close_click_params
lda close_click_params::state
beq ignore_click
exit: A2D_CALL A2D_DESTROY_WINDOW, destroy_window_params
exit: MGTK_CALL MGTK::CloseWindow, destroy_window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS
lda ROMIN2
A2D_CALL A2D_CONFIGURE_ZP_USE, overwrite_zp_params
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
.proc do_close
;; Copy following routine to ZP and invoke it
@ -943,11 +943,11 @@ loop: lda routine,x
sizeof_routine := * - routine ; Can't use .sizeof before the .proc definition
.endproc
: cmp #A2D_ELEM_TITLE ; Title bar?
: cmp #MGTK::area_dragbar ; Title bar?
bne ignore_click
lda #window_id
sta drag_params::id
A2D_CALL A2D_DRAG_WINDOW, drag_params
MGTK_CALL MGTK::DragWindow, drag_params
jsr redraw_screen_and_window
rts
@ -985,7 +985,7 @@ rts1: rts ; used by next proc
.proc map_click_to_button
lda #window_id
sta map_coords_params::id
A2D_CALL A2D_MAP_COORDS, map_coords_params
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
lda map_coords_params::clientx+1 ; ensure high bits of coords are 0
ora map_coords_params::clienty+1
bne rts1
@ -1483,24 +1483,24 @@ end: jsr display_buffer1
sty invert_addr+1
sty c13_addr+1
sty restore_addr+1
A2D_CALL A2D_SET_PATTERN, black_pattern
A2D_CALL A2D_SET_FILL_MODE, fill_mode_xor
MGTK_CALL MGTK::SetPattern, black_pattern
MGTK_CALL MGTK::SetPenMode, fill_mode_xor
sec
ror button_state
invert: A2D_CALL A2D_FILL_RECT, 0, invert_addr ; Inverts box
invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts box
check_button:
A2D_CALL A2D_GET_INPUT, input_state_params
MGTK_CALL MGTK::GetEvent, input_state_params
lda input_state_params::state
cmp #A2D_INPUT_HELD ; Button down?
cmp #MGTK::drag ; Button down?
bne done ; Nope, done immediately
lda #window_id
sta map_coords_params::id
A2D_CALL A2D_MAP_COORDS, map_coords_params
A2D_CALL A2D_SET_POS, map_coords_params::client
A2D_CALL A2D_TEST_BOX, 0, c13_addr
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
MGTK_CALL MGTK::MoveTo, map_coords_params::client
MGTK_CALL MGTK::InRect, 0, c13_addr
bne inside
lda button_state ; outside, not down
@ -1519,8 +1519,8 @@ inside: lda button_state ; inside, and down
done: lda button_state ; high bit set if button down
beq :+
A2D_CALL A2D_FILL_RECT, 0, restore_addr ; Inverts back to normal
: A2D_CALL A2D_SET_FILL_MODE, fill_mode_normal ; Normal draw mode??
MGTK_CALL MGTK::PaintRect, 0, restore_addr ; Inverts back to normal
: MGTK_CALL MGTK::SetPenMode, fill_mode_normal ; Normal draw mode??
lda button_state
rts
.endproc
@ -1561,7 +1561,7 @@ loop: lda #' '
ldx #<text_buffer1
ldy #>text_buffer1
jsr pre_display_buffer
A2D_CALL A2D_DRAW_TEXT, draw_text_params1
MGTK_CALL MGTK::DrawText, draw_text_params1
end: rts
.endproc
@ -1571,21 +1571,21 @@ end: rts
ldx #<text_buffer2
ldy #>text_buffer2
jsr pre_display_buffer
A2D_CALL A2D_DRAW_TEXT, draw_text_params2
MGTK_CALL MGTK::DrawText, draw_text_params2
end: rts
.endproc
.proc pre_display_buffer
stx measure_text_params::addr ; text buffer address in x,y
sty measure_text_params::addr+1
A2D_CALL A2D_MEASURE_TEXT, measure_text_params
MGTK_CALL MGTK::TextWidth, measure_text_params
lda #display_width-15 ; ???
sec
sbc measure_text_params::width
sta text_pos_params3::left
A2D_CALL A2D_SET_POS, text_pos_params2 ; clear with spaces
A2D_CALL A2D_DRAW_TEXT, spaces_string
A2D_CALL A2D_SET_POS, text_pos_params3 ; set up for display
MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces
MGTK_CALL MGTK::DrawText, spaces_string
MGTK_CALL MGTK::MoveTo, text_pos_params3 ; set up for display
rts
.endproc
@ -1594,14 +1594,14 @@ end: rts
.proc draw_background
;; Frame
A2D_CALL A2D_HIDE_CURSOR
A2D_CALL A2D_SET_PATTERN, background_pattern
A2D_CALL A2D_FILL_RECT, background_box_params
A2D_CALL A2D_SET_PATTERN, black_pattern
A2D_CALL A2D_DRAW_RECT, frame_display_params
A2D_CALL A2D_SET_PATTERN, white_pattern
A2D_CALL A2D_FILL_RECT, clear_display_params
A2D_CALL A2D_SET_TEXT_MASK, text_mask_params
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::SetPattern, background_pattern
MGTK_CALL MGTK::PaintRect, background_box_params
MGTK_CALL MGTK::SetPattern, black_pattern
MGTK_CALL MGTK::FrameRect, frame_display_params
MGTK_CALL MGTK::SetPattern, white_pattern
MGTK_CALL MGTK::PaintRect, clear_display_params
MGTK_CALL MGTK::SetTextBG, text_mask_params
;; fall through
.endproc
@ -1633,9 +1633,9 @@ loop: ldy #0
lda (ptr),y
sta label
A2D_CALL A2D_DRAW_BITMAP, 0, bitmap_addr ; draw shadowed rect
A2D_CALL A2D_SET_POS, 0, text_addr ; button label pos
A2D_CALL A2D_DRAW_TEXT, draw_text_params_label ; button label text
MGTK_CALL MGTK::PaintBits, 0, bitmap_addr ; draw shadowed rect
MGTK_CALL MGTK::MoveTo, 0, text_addr ; button label pos
MGTK_CALL MGTK::DrawText, draw_text_params_label ; button label text
lda ptr ; advance to next record
clc
@ -1668,13 +1668,13 @@ draw_title_bar:
bcs :+
dex
: stx title_bar_decoration::top+1
A2D_CALL A2D_SET_BOX, screen_box ; set clipping rect to whole screen
A2D_CALL A2D_DRAW_BITMAP, title_bar_decoration ; Draws decoration in title bar
MGTK_CALL MGTK::SetPortSite, screen_box ; set clipping rect to whole screen
MGTK_CALL MGTK::PaintBits, title_bar_decoration ; Draws decoration in title bar
lda #window_id
sta query_state_params::id
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params
A2D_CALL A2D_SHOW_CURSOR
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, state_params
MGTK_CALL MGTK::ShowCursor
jsr display_buffer2
rts
@ -1686,8 +1686,8 @@ draw_title_bar:
jsr reset_buffers_and_display
bit offscreen_flag
bmi :+
A2D_CALL A2D_SET_POS, error_pos
A2D_CALL A2D_DRAW_TEXT, error_string
MGTK_CALL MGTK::MoveTo, error_pos
MGTK_CALL MGTK::DrawText, error_string
: jsr reset_buffer1_and_state
lda #'='
sta calc_op

View File

@ -6,7 +6,7 @@
.include "../inc/applesoft.inc"
.include "../inc/prodos.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move, font
.org $800
@ -111,8 +111,8 @@ call_init:
skip: lda #0
sta offscreen_flag
lda ROMIN2
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, state_params
rts
.proc routine
@ -147,8 +147,8 @@ offscreen_flag:
;; Is skipping this responsible for display redraw bug?
;; https://github.com/inexorabletash/a2d/issues/34
: A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params
: MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, state_params
lda query_state_params_id
cmp #window_id
bne :+
@ -207,11 +207,11 @@ id: .byte 0
query_state_params_id := query_state_params::id
.proc preserve_zp_params
flag: .byte A2D_CZP_PRESERVE
flag: .byte MGTK::zp_preserve
.endproc
.proc overwrite_zp_params
flag: .byte A2D_CZP_OVERWRITE
flag: .byte MGTK::zp_overwrite
.endproc
;;; ==================================================
@ -665,9 +665,9 @@ text_buffer2:
.res text_buffer_size+2, 0
spaces_string:
A2D_DEFSTRING " "
DEFINE_STRING " "
error_string:
A2D_DEFSTRING "Error "
DEFINE_STRING "Error "
;; used when clearing display; params to a $18 call
.proc measure_text_params
@ -699,7 +699,7 @@ base: .word 16
farg: .byte $00,$00,$00,$00,$00,$00
.proc title_bar_decoration ; Params for A2D_DRAW_BITMAP
.proc title_bar_decoration ; Params for MGTK::PaintBits
left: .word 115 ; overwritten
top: .word $FFF7 ; overwritten
bitmap:.addr pixels
@ -747,12 +747,12 @@ font: .addr 0
screen_width := 560
screen_height := 192
;; params for A2D_SET_BOX when decorating title bar
;; params for MGTK::SetPortSite when decorating title bar
.proc screen_box
left: .word 0
top: .word menu_bar_height
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .word MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word screen_width - 1
@ -760,13 +760,13 @@ height: .word screen_height - menu_bar_height - 2
.endproc
.proc fill_mode_normal
mode: .byte A2D_SFM_NORMAL
mode: .byte MGTK::pencopy
.endproc
.byte $01,$02 ; ??
.proc fill_mode_xor
mode: .byte A2D_SFM_XOR
mode: .byte MGTK::notpenXOR
.endproc
window_width := 130
@ -776,10 +776,10 @@ mode: .byte A2D_SFM_XOR
.proc create_window_params
id: .byte window_id
flags: .byte A2D_CWF_ADDCLOSE
flags: .byte MGTK::option_go_away_box
title: .addr window_title
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_NOSCROLL
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hs_max: .byte 0
hs_pos: .byte 0
vs_max: .byte 0
@ -791,15 +791,15 @@ w2: .word window_width
h2: .word window_height
left: .word default_left
top: .word default_top
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word window_width
height: .word window_height
pattern:.res 8, $FF
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -848,15 +848,15 @@ cursor: .byte px(%0000000),px(%0000000) ; cursor
init: sta ALTZPON
lda LCBANK1
lda LCBANK1
A2D_CALL A2D_CONFIGURE_ZP_USE, preserve_zp_params
A2D_CALL A2D_CREATE_WINDOW, create_window_params
A2D_CALL A2D_QUERY_SCREEN, state_params
A2D_CALL A2D_SET_STATE, state_params ; set clipping bounds?
A2D_CALL $2B ; reset drawing state?
MGTK_CALL MGTK::SetZP1, preserve_zp_params
MGTK_CALL MGTK::OpenWindow, create_window_params
MGTK_CALL MGTK::InitPort, state_params
MGTK_CALL MGTK::SetPort, state_params ; set clipping bounds?
MGTK_CALL $2B ; reset drawing state?
lda #$01
sta input_state_params::state
A2D_CALL A2D_SET_INPUT, input_state_params
A2D_CALL A2D_GET_INPUT, input_state_params
MGTK_CALL MGTK::PostEvent, input_state_params
MGTK_CALL MGTK::GetEvent, input_state_params
lda ROMIN2
jsr reset_buffer2
lda #window_id
@ -916,21 +916,21 @@ loop: lda adjust_txtptr_copied-1,x
jsr process_key
;; previous draws mangle the cursor (why???)
A2D_CALL A2D_SET_CURSOR, cursor ; Why not use JUMP_TABLE_CUR_POINTER ?
MGTK_CALL MGTK::SetCursor, cursor ; Why not use JUMP_TABLE_CUR_POINTER ?
;; fall through
;;; ==================================================
;;; Input Loop
input_loop:
A2D_CALL A2D_GET_INPUT, input_state_params
MGTK_CALL MGTK::GetEvent, input_state_params
lda input_state_params::state
cmp #A2D_INPUT_DOWN
cmp #MGTK::button_down
bne :+
jsr on_click
jmp input_loop
: cmp #A2D_INPUT_KEY
: cmp #MGTK::key_down
bne input_loop
jsr on_key_press
jmp input_loop
@ -941,10 +941,10 @@ input_loop:
on_click:
lda LCBANK1
lda LCBANK1
A2D_CALL A2D_QUERY_TARGET, target_params
MGTK_CALL MGTK::FindWindow, target_params
lda ROMIN2
lda target_params::elem
cmp #A2D_ELEM_CLIENT ; Less than CLIENT is MENU or DESKTOP
cmp #MGTK::area_content ; Less than CLIENT is MENU or DESKTOP
bcc ignore_click
lda target_params::id
cmp #window_id ; This window?
@ -954,23 +954,23 @@ ignore_click:
rts
: lda target_params::elem
cmp #A2D_ELEM_CLIENT ; Client area?
cmp #MGTK::area_content ; Client area?
bne :+
jsr map_click_to_button ; try to translate click into key
bcc ignore_click
jmp process_key
: cmp #A2D_ELEM_CLOSE ; Close box?
: cmp #MGTK::area_close_box ; Close box?
bne :+
A2D_CALL A2D_CLOSE_CLICK, close_click_params
MGTK_CALL MGTK::TrackGoAway, close_click_params
lda close_click_params::state
beq ignore_click
exit: lda LCBANK1
lda LCBANK1
A2D_CALL A2D_DESTROY_WINDOW, destroy_window_params
MGTK_CALL MGTK::CloseWindow, destroy_window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS
lda ROMIN2
A2D_CALL A2D_CONFIGURE_ZP_USE, overwrite_zp_params
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
.proc do_close
;; Copy following routine to ZP and invoke it
@ -991,13 +991,13 @@ loop: lda routine,x
sizeof_routine := * - routine ; Can't use .sizeof before the .proc definition
.endproc
: cmp #A2D_ELEM_TITLE ; Title bar?
: cmp #MGTK::area_dragbar ; Title bar?
bne ignore_click
lda #window_id
sta drag_params::id
lda LCBANK1
lda LCBANK1
A2D_CALL A2D_DRAG_WINDOW, drag_params
MGTK_CALL MGTK::DragWindow, drag_params
lda ROMIN2
jsr redraw_screen_and_window
rts
@ -1036,7 +1036,7 @@ rts1: rts ; used by next proc
.proc map_click_to_button
lda #window_id
sta map_coords_params::id
A2D_CALL A2D_MAP_COORDS, map_coords_params
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
lda map_coords_params::clientx+1 ; ensure high bits of coords are 0
ora map_coords_params::clienty+1
bne rts1
@ -1534,24 +1534,24 @@ end: jsr display_buffer1
sty invert_addr+1
sty c13_addr+1
sty restore_addr+1
A2D_CALL A2D_SET_PATTERN, black_pattern
A2D_CALL A2D_SET_FILL_MODE, fill_mode_xor
MGTK_CALL MGTK::SetPattern, black_pattern
MGTK_CALL MGTK::SetPenMode, fill_mode_xor
sec
ror button_state
invert: A2D_CALL A2D_FILL_RECT, 0, invert_addr ; Inverts box
invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts box
check_button:
A2D_CALL A2D_GET_INPUT, input_state_params
MGTK_CALL MGTK::GetEvent, input_state_params
lda input_state_params::state
cmp #A2D_INPUT_HELD ; Button down?
cmp #MGTK::drag ; Button down?
bne done ; Nope, done immediately
lda #window_id
sta map_coords_params::id
A2D_CALL A2D_MAP_COORDS, map_coords_params
A2D_CALL A2D_SET_POS, map_coords_params::client
A2D_CALL A2D_TEST_BOX, 0, c13_addr
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
MGTK_CALL MGTK::MoveTo, map_coords_params::client
MGTK_CALL MGTK::InRect, 0, c13_addr
bne inside
lda button_state ; outside, not down
@ -1570,8 +1570,8 @@ inside: lda button_state ; inside, and down
done: lda button_state ; high bit set if button down
beq :+
A2D_CALL A2D_FILL_RECT, 0, restore_addr ; Inverts back to normal
: A2D_CALL A2D_SET_FILL_MODE, fill_mode_normal ; Normal draw mode??
MGTK_CALL MGTK::PaintRect, 0, restore_addr ; Inverts back to normal
: MGTK_CALL MGTK::SetPenMode, fill_mode_normal ; Normal draw mode??
lda button_state
rts
.endproc
@ -1610,7 +1610,7 @@ loop: lda #' '
ldx #<text_buffer1
ldy #>text_buffer1
jsr pre_display_buffer
A2D_CALL A2D_DRAW_TEXT, draw_text_params1
MGTK_CALL MGTK::DrawText, draw_text_params1
rts
.endproc
@ -1618,21 +1618,21 @@ loop: lda #' '
ldx #<text_buffer2
ldy #>text_buffer2
jsr pre_display_buffer
A2D_CALL A2D_DRAW_TEXT, draw_text_params2
MGTK_CALL MGTK::DrawText, draw_text_params2
rts
.endproc
.proc pre_display_buffer
stx measure_text_params::addr ; text buffer address in x,y
sty measure_text_params::addr+1
A2D_CALL A2D_MEASURE_TEXT, measure_text_params
MGTK_CALL MGTK::TextWidth, measure_text_params
lda #display_width-15 ; ???
sec
sbc measure_text_params::width
sta text_pos_params3::left
A2D_CALL A2D_SET_POS, text_pos_params2 ; clear with spaces
A2D_CALL A2D_DRAW_TEXT, spaces_string
A2D_CALL A2D_SET_POS, text_pos_params3 ; set up for display
MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces
MGTK_CALL MGTK::DrawText, spaces_string
MGTK_CALL MGTK::MoveTo, text_pos_params3 ; set up for display
rts
.endproc
@ -1641,14 +1641,14 @@ loop: lda #' '
.proc draw_background
;; Frame
A2D_CALL A2D_HIDE_CURSOR
A2D_CALL A2D_SET_PATTERN, background_pattern
A2D_CALL A2D_FILL_RECT, background_box_params
A2D_CALL A2D_SET_PATTERN, black_pattern
A2D_CALL A2D_DRAW_RECT, frame_display_params
A2D_CALL A2D_SET_PATTERN, white_pattern
A2D_CALL A2D_FILL_RECT, clear_display_params
A2D_CALL A2D_SET_TEXT_MASK, text_mask_params
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::SetPattern, background_pattern
MGTK_CALL MGTK::PaintRect, background_box_params
MGTK_CALL MGTK::SetPattern, black_pattern
MGTK_CALL MGTK::FrameRect, frame_display_params
MGTK_CALL MGTK::SetPattern, white_pattern
MGTK_CALL MGTK::PaintRect, clear_display_params
MGTK_CALL MGTK::SetTextBG, text_mask_params
;; fall through
.endproc
@ -1680,9 +1680,9 @@ loop: ldy #0
lda (ptr),y
sta label
A2D_CALL A2D_DRAW_BITMAP, 0, bitmap_addr ; draw shadowed rect
A2D_CALL A2D_SET_POS, 0, text_addr ; button label pos
A2D_CALL A2D_DRAW_TEXT, draw_text_params_label ; button label text
MGTK_CALL MGTK::PaintBits, 0, bitmap_addr ; draw shadowed rect
MGTK_CALL MGTK::MoveTo, 0, text_addr ; button label pos
MGTK_CALL MGTK::DrawText, draw_text_params_label ; button label text
lda ptr ; advance to next record
clc
@ -1715,13 +1715,13 @@ draw_title_bar:
bcs :+
dex
: stx title_bar_decoration::top+1
A2D_CALL A2D_SET_BOX, screen_box ; set clipping rect to whole screen
A2D_CALL A2D_DRAW_BITMAP, title_bar_decoration ; Draws decoration in title bar
MGTK_CALL MGTK::SetPortSite, screen_box ; set clipping rect to whole screen
MGTK_CALL MGTK::PaintBits, title_bar_decoration ; Draws decoration in title bar
lda #window_id
sta query_state_params::id
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params
A2D_CALL A2D_SHOW_CURSOR
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, state_params
MGTK_CALL MGTK::ShowCursor
jsr display_buffer2
rts
@ -1729,8 +1729,8 @@ draw_title_bar:
;; and returns to the input loop.
.proc error_hook
jsr reset_buffers_and_display
A2D_CALL A2D_SET_POS, error_pos
A2D_CALL A2D_DRAW_TEXT, error_string
MGTK_CALL MGTK::MoveTo, error_pos
MGTK_CALL MGTK::DrawText, error_string
jsr reset_buffer1_and_state
lda #'='
sta calc_op

View File

@ -5,7 +5,7 @@
.include "../inc/prodos.inc"
.include "../inc/auxmem.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move; font; glyphs
.org $800
@ -197,22 +197,22 @@ month: .byte 2 ; The date this was written?
year: .byte 85
spaces_string:
A2D_DEFSTRING " "
DEFINE_STRING " "
day_pos:
.word 43, 30
day_string:
A2D_DEFSTRING " "
DEFINE_STRING " "
month_pos:
.word 87, 30
month_string:
A2D_DEFSTRING " "
DEFINE_STRING " "
year_pos:
.word 133, 30
year_string:
A2D_DEFSTRING " "
DEFINE_STRING " "
.proc get_input_params
state: .byte 0
@ -256,10 +256,10 @@ mode: .byte $02 ; this should be normal, but we do inverts ???
.proc create_window_params
id: .byte window_id
flags: .byte A2D_CWF_NOTITLE
flags: .byte MGTK::option_dialog_box
title: .addr 0
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_NOSCROLL
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hsmax: .byte 0
hspos: .byte 0
vsmax: .byte 0
@ -272,16 +272,16 @@ h2: .word $1F4
.proc box
left: .word 180
top: .word 50
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word $C7
height: .word $40
.endproc
pattern:.res 8,$00
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 4
@ -321,25 +321,25 @@ init_window:
lsr a
sta month
A2D_CALL A2D_CREATE_WINDOW, create_window_params
MGTK_CALL MGTK::OpenWindow, create_window_params
lda #0
sta selected_field
jsr draw_window
A2D_CALL $2B
MGTK_CALL $2B
;; fall through
;;; ==================================================
;;; Input loop
.proc input_loop
A2D_CALL A2D_GET_INPUT, get_input_params
MGTK_CALL MGTK::GetEvent, get_input_params
lda get_input_params::state
cmp #A2D_INPUT_DOWN
cmp #MGTK::button_down
bne :+
jsr on_click
jmp input_loop
: cmp #A2D_INPUT_KEY
: cmp #MGTK::key_down
bne input_loop
.endproc
@ -364,19 +364,19 @@ init_window:
bne input_loop
on_key_up:
A2D_CALL A2D_FILL_RECT, up_arrow_rect
MGTK_CALL MGTK::PaintRect, up_arrow_rect
lda #up_rect_index
sta hit_rect_index
jsr do_inc_or_dec
A2D_CALL A2D_FILL_RECT, up_arrow_rect
MGTK_CALL MGTK::PaintRect, up_arrow_rect
jmp input_loop
on_key_down:
A2D_CALL A2D_FILL_RECT, down_arrow_rect
MGTK_CALL MGTK::PaintRect, down_arrow_rect
lda #down_rect_index
sta hit_rect_index
jsr do_inc_or_dec
A2D_CALL A2D_FILL_RECT, down_arrow_rect
MGTK_CALL MGTK::PaintRect, down_arrow_rect
jmp input_loop
on_key_left:
@ -403,9 +403,9 @@ update_selection:
;;; ==================================================
.proc on_click
A2D_CALL A2D_QUERY_TARGET, get_input_params::xcoord
A2D_CALL A2D_SET_FILL_MODE, fill_mode_params
A2D_CALL A2D_SET_PATTERN, white_pattern
MGTK_CALL MGTK::FindWindow, get_input_params::xcoord
MGTK_CALL MGTK::SetPenMode, fill_mode_params
MGTK_CALL MGTK::SetPattern, white_pattern
lda query_target_params::id
cmp #window_id
bne miss
@ -413,7 +413,7 @@ update_selection:
bne hit
miss: rts
hit: cmp #A2D_ELEM_CLIENT
hit: cmp #MGTK::area_content
bne miss
jsr find_hit_target
cpx #0
@ -437,7 +437,7 @@ hit_target_jump_table:
;;; ==================================================
.proc on_ok
A2D_CALL A2D_FILL_RECT, ok_button_rect
MGTK_CALL MGTK::PaintRect, ok_button_rect
;; Pack the date bytes and store
sta RAMWRTOFF
@ -460,7 +460,7 @@ hit_target_jump_table:
.endproc
on_cancel:
A2D_CALL A2D_FILL_RECT, cancel_button_rect
MGTK_CALL MGTK::PaintRect, cancel_button_rect
lda #0
sta dialog_result
jmp destroy
@ -468,7 +468,7 @@ on_cancel:
on_up:
txa
pha
A2D_CALL A2D_FILL_RECT, up_arrow_rect
MGTK_CALL MGTK::PaintRect, up_arrow_rect
pla
tax
jsr on_up_or_down
@ -477,7 +477,7 @@ on_up:
on_down:
txa
pha
A2D_CALL A2D_FILL_RECT, down_arrow_rect
MGTK_CALL MGTK::PaintRect, down_arrow_rect
pla
tax
jsr on_up_or_down
@ -491,9 +491,9 @@ on_field_click:
.proc on_up_or_down
stx hit_rect_index
loop: A2D_CALL A2D_GET_INPUT, get_input_params ; Repeat while mouse is down
loop: MGTK_CALL MGTK::GetEvent, get_input_params ; Repeat while mouse is down
lda get_input_params::state
cmp #A2D_INPUT_UP
cmp #MGTK::button_up
beq :+
jsr do_inc_or_dec
jmp loop
@ -502,10 +502,10 @@ loop: A2D_CALL A2D_GET_INPUT, get_input_params ; Repeat while mouse is down
cmp #up_rect_index
beq :+
A2D_CALL A2D_FILL_RECT, down_arrow_rect
MGTK_CALL MGTK::PaintRect, down_arrow_rect
rts
: A2D_CALL A2D_FILL_RECT, up_arrow_rect
: MGTK_CALL MGTK::PaintRect, up_arrow_rect
rts
.endproc
@ -538,7 +538,7 @@ go: lda selected_field
sta gosub+2
gosub: jsr $1000 ; self modified
A2D_CALL A2D_SET_TEXT_MASK, text_mask_params
MGTK_CALL MGTK::SetTextBG, text_mask_params
jmp draw_selected_field
.endproc
@ -666,7 +666,7 @@ month_name_table:
dialog_result: .byte 0
.proc destroy
A2D_CALL A2D_DESTROY_WINDOW, destroy_window_params
MGTK_CALL MGTK::CloseWindow, destroy_window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS
;; Copy the relay routine to the zero page
@ -717,8 +717,8 @@ skip: jmp dest
sta map_coords_params::screeny
lda get_input_params::ycoord+1
sta map_coords_params::screeny+1
A2D_CALL A2D_MAP_COORDS, map_coords_params
A2D_CALL A2D_SET_POS, map_coords_params::client
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
MGTK_CALL MGTK::MoveTo, map_coords_params::client
ldx #1
lda #<first_hit_rect
sta test_addr
@ -727,7 +727,7 @@ skip: jmp dest
loop: txa
pha
A2D_CALL A2D_TEST_BOX, $1000, test_addr
MGTK_CALL MGTK::InRect, $1000, test_addr
bne done
clc
@ -760,13 +760,13 @@ date_rect:
.word $20,$0F,$9A,$23
label_ok:
A2D_DEFSTRING {"OK ",GLYPH_RETURN} ;
DEFINE_STRING {"OK ",GLYPH_RETURN} ;
label_cancel:
A2D_DEFSTRING "Cancel ESC"
DEFINE_STRING "Cancel ESC"
label_uparrow:
A2D_DEFSTRING GLYPH_UARROW
DEFINE_STRING GLYPH_UARROW
label_downarrow:
A2D_DEFSTRING GLYPH_DARROW
DEFINE_STRING GLYPH_DARROW
label_cancel_pos:
.word $15,$38
@ -787,26 +787,26 @@ vthick: .byte 1
;;; Render the window contents
draw_window:
A2D_CALL A2D_SET_STATE, create_window_params::box
A2D_CALL A2D_DRAW_RECT, border_rect
A2D_CALL A2D_SET_THICKNESS, thickness_params
A2D_CALL A2D_DRAW_RECT, date_rect
A2D_CALL A2D_DRAW_RECT, ok_button_rect
A2D_CALL A2D_DRAW_RECT, cancel_button_rect
MGTK_CALL MGTK::SetPort, create_window_params::box
MGTK_CALL MGTK::FrameRect, border_rect
MGTK_CALL MGTK::SetPenSize, thickness_params
MGTK_CALL MGTK::FrameRect, date_rect
MGTK_CALL MGTK::FrameRect, ok_button_rect
MGTK_CALL MGTK::FrameRect, cancel_button_rect
A2D_CALL A2D_SET_POS, label_ok_pos
A2D_CALL A2D_DRAW_TEXT, label_ok
MGTK_CALL MGTK::MoveTo, label_ok_pos
MGTK_CALL MGTK::DrawText, label_ok
A2D_CALL A2D_SET_POS, label_cancel_pos
A2D_CALL A2D_DRAW_TEXT, label_cancel
MGTK_CALL MGTK::MoveTo, label_cancel_pos
MGTK_CALL MGTK::DrawText, label_cancel
A2D_CALL A2D_SET_POS, label_uparrow_pos
A2D_CALL A2D_DRAW_TEXT, label_uparrow
A2D_CALL A2D_DRAW_RECT, up_arrow_rect
MGTK_CALL MGTK::MoveTo, label_uparrow_pos
MGTK_CALL MGTK::DrawText, label_uparrow
MGTK_CALL MGTK::FrameRect, up_arrow_rect
A2D_CALL A2D_SET_POS, label_downarrow_pos
A2D_CALL A2D_DRAW_TEXT, label_downarrow
A2D_CALL A2D_DRAW_RECT, down_arrow_rect
MGTK_CALL MGTK::MoveTo, label_downarrow_pos
MGTK_CALL MGTK::DrawText, label_downarrow
MGTK_CALL MGTK::FrameRect, down_arrow_rect
jsr prepare_day_string
jsr prepare_month_string
@ -815,8 +815,8 @@ draw_window:
jsr draw_day
jsr draw_month
jsr draw_year
A2D_CALL A2D_SET_FILL_MODE, fill_mode_params
A2D_CALL A2D_SET_PATTERN, white_pattern
MGTK_CALL MGTK::SetPenMode, fill_mode_params
MGTK_CALL MGTK::SetPattern, white_pattern
lda #1
jmp highlight_selected_field
@ -830,22 +830,22 @@ draw_window:
.endproc
.proc draw_day
A2D_CALL A2D_SET_POS, day_pos
A2D_CALL A2D_DRAW_TEXT, day_string
MGTK_CALL MGTK::MoveTo, day_pos
MGTK_CALL MGTK::DrawText, day_string
rts
.endproc
.proc draw_month
A2D_CALL A2D_SET_POS, month_pos
A2D_CALL A2D_DRAW_TEXT, spaces_string ; variable width, so clear first
A2D_CALL A2D_SET_POS, month_pos
A2D_CALL A2D_DRAW_TEXT, month_string
MGTK_CALL MGTK::MoveTo, month_pos
MGTK_CALL MGTK::DrawText, spaces_string ; variable width, so clear first
MGTK_CALL MGTK::MoveTo, month_pos
MGTK_CALL MGTK::DrawText, month_string
rts
.endproc
.proc draw_year
A2D_CALL A2D_SET_POS, year_pos
A2D_CALL A2D_DRAW_TEXT, year_string
MGTK_CALL MGTK::MoveTo, year_pos
MGTK_CALL MGTK::DrawText, year_string
rts
.endproc
@ -878,15 +878,15 @@ update: pla ; update selection
beq fill_month
fill_year:
A2D_CALL A2D_FILL_RECT, year_rect
MGTK_CALL MGTK::PaintRect, year_rect
rts
fill_day:
A2D_CALL A2D_FILL_RECT, day_rect
MGTK_CALL MGTK::PaintRect, day_rect
rts
fill_month:
A2D_CALL A2D_FILL_RECT, month_rect
MGTK_CALL MGTK::PaintRect, month_rect
rts
.endproc

View File

@ -5,7 +5,7 @@
.include "../inc/auxmem.inc"
.include "../inc/prodos.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; redraw icons after window move, font
.org $800
@ -135,8 +135,8 @@ check_window_pos:
sta window_pos_flag
rts
: A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, set_state_params
: MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, set_state_params
lda query_state_params_id
cmp #window_id
bne :+
@ -593,10 +593,10 @@ set_state_params:
.proc create_window_params
id: .byte window_id
flags: .byte A2D_CWF_ADDCLOSE
flags: .byte MGTK::option_go_away_box
title: .addr name
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_NOSCROLL
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hsmax: .byte 0
hspos: .byte 0
vsmax: .byte 0
@ -609,16 +609,16 @@ h2: .word default_height
left: .word default_left
top: .word default_top
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word default_width
height: .word default_height
pattern:.res 8, $FF
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -633,15 +633,15 @@ next: .addr 0
.proc box_cruft ; Unknown usage
left: .word default_left
top: .word default_top
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word default_width
height: .word default_height
pattern:.res 8, $FF
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -661,7 +661,7 @@ name: PASCAL_STRING "Puzzle"
.proc create_window
jsr save_zp
A2D_CALL A2D_CREATE_WINDOW, create_window_params
MGTK_CALL MGTK::OpenWindow, create_window_params
;; init pieces
ldy #15
@ -672,7 +672,7 @@ loop: tya
lda #window_id
jsr check_window_pos
A2D_CALL $2B ; ???
MGTK_CALL $2B ; ???
;; Scramble?
.proc scramble
@ -698,7 +698,7 @@ ploop: lda position_table+1,y
stx position_table+1
.endproc
A2D_CALL A2D_GET_INPUT, get_input_params
MGTK_CALL MGTK::GetEvent, get_input_params
lda get_input_params::state
beq scramble
jsr check_victory
@ -712,22 +712,22 @@ ploop: lda position_table+1,y
;;; Input loop and processing
.proc input_loop
A2D_CALL A2D_GET_INPUT, get_input_params
MGTK_CALL MGTK::GetEvent, get_input_params
lda get_input_params::state
cmp #A2D_INPUT_DOWN
cmp #MGTK::button_down
bne :+
jsr on_click
jmp input_loop
;; key?
: cmp #A2D_INPUT_KEY
: cmp #MGTK::key_down
bne input_loop
jsr check_key
jmp input_loop
;; click - where?
on_click:
A2D_CALL A2D_QUERY_TARGET, query_target_params
MGTK_CALL MGTK::FindWindow, query_target_params
lda query_target_params::id
cmp #window_id
bne bail
@ -736,20 +736,20 @@ on_click:
bail: rts
;; client area?
: cmp #A2D_ELEM_CLIENT
: cmp #MGTK::area_content
bne :+
jsr find_click_piece
bcc bail
jmp process_click
;; close box?
: cmp #A2D_ELEM_CLOSE
: cmp #MGTK::area_close_box
bne check_title
A2D_CALL A2D_CLOSE_CLICK, close_click_params
MGTK_CALL MGTK::TrackGoAway, close_click_params
lda close_click_params::clicked
beq bail
destroy:
A2D_CALL A2D_DESTROY_WINDOW, destroy_window_params
MGTK_CALL MGTK::CloseWindow, destroy_window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS
target = $20 ; copy following to ZP and run it
@ -769,11 +769,11 @@ loop: lda routine,x
;; title bar?
check_title:
cmp #A2D_ELEM_TITLE
cmp #MGTK::area_dragbar
bne bail
lda #window_id
sta drag_window_params::id
A2D_CALL A2D_DRAG_WINDOW, drag_window_params
MGTK_CALL MGTK::DragWindow, drag_window_params
ldx #$23
jsr redraw_screen
rts
@ -794,7 +794,7 @@ check_key:
.proc find_click_piece
lda #window_id
sta map_coords_params::id
A2D_CALL A2D_MAP_COORDS, map_coords_params
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
lda map_coords_params::clientx+1
ora map_coords_params::clienty+1
bne nope ; ensure high bytes are 0
@ -988,19 +988,19 @@ after_click:
;;; Clear the background
draw_window:
A2D_CALL A2D_SET_PATTERN, pattern_speckles
A2D_CALL A2D_FILL_RECT, fill_rect_params
A2D_CALL A2D_SET_PATTERN, pattern_black
MGTK_CALL MGTK::SetPattern, pattern_speckles
MGTK_CALL MGTK::PaintRect, fill_rect_params
MGTK_CALL MGTK::SetPattern, pattern_black
A2D_CALL A2D_SET_POS, set_pos_params
A2D_CALL A2D_DRAW_LINE, draw_line_params
MGTK_CALL MGTK::MoveTo, set_pos_params
MGTK_CALL MGTK::Line, draw_line_params
jsr draw_all
lda #window_id
sta query_state_params::id
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, set_state_params
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, set_state_params
rts
;;; ==================================================
@ -1062,11 +1062,11 @@ saved_zp:
.proc draw_selected
tya
pha
A2D_CALL A2D_HIDE_CURSOR
MGTK_CALL MGTK::HideCursor
lda #window_id
sta query_state_params::id
A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, set_state_params
MGTK_CALL MGTK::GetWinPort, query_state_params
MGTK_CALL MGTK::SetPort, set_state_params
pla
tay
@ -1090,14 +1090,14 @@ loop: tya
sta draw_bitmap_params::addr
lda bitmap_table+1,x
sta draw_bitmap_params::addr+1
A2D_CALL A2D_DRAW_BITMAP, draw_bitmap_params
MGTK_CALL MGTK::PaintBits, draw_bitmap_params
pla
clc
adc draw_inc
tay
cpy draw_end
bcc loop
A2D_CALL A2D_SHOW_CURSOR
MGTK_CALL MGTK::ShowCursor
rts
.endproc

View File

@ -1,7 +1,7 @@
#!/usr/bin/env perl
# Input: HCRG-style Font (768 bytes)
# Output: A2D font definition
# Output: MGTK font definition
# Usage: perl convert.pl < font_data > font.inc

View File

@ -1,6 +1,6 @@
#!/usr/bin/env perl
# Convert $xx into px(bbbbbbb) - input to A2D_DRAW_PATTERN
# Convert $xx into px(bbbbbbb) - MGTK pattern/bits
use strict;
use warnings;

View File

@ -5,7 +5,7 @@
.include "../inc/prodos.inc"
.include "../inc/auxmem.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; get selection, font
.org $800
@ -173,7 +173,7 @@ base: .word 0
.proc input_params ; queried to track mouse-up
state: .byte $00
;;; if state is A2D_INPUT_KEY
;;; if state is MGTK::key_down
key := *
modifiers := *+1
@ -195,10 +195,10 @@ ycoord := *+2
.proc window_params
id: .byte window_id ; window identifier
flags: .byte A2D_CWF_NOTITLE
flags: .byte MGTK::option_dialog_box
title: .addr window_title
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_NOSCROLL
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none
hsmax: .byte 32
hspos: .byte 0
vsmax: .byte 32
@ -212,8 +212,8 @@ h2: .word default_height
.proc box
left: .word default_left
top: .word default_top
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word default_width
@ -221,8 +221,8 @@ height: .word default_height
.endproc
pattern:.res 8, 0
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -342,14 +342,14 @@ end: rts
sta read_params::ref_num
sta close_params::ref_num
A2D_CALL A2D_HIDE_CURSOR
MGTK_CALL MGTK::HideCursor
jsr stash_menu
A2D_CALL A2D_CREATE_WINDOW, window_params
A2D_CALL A2D_SET_STATE, window_params::box
MGTK_CALL MGTK::OpenWindow, window_params
MGTK_CALL MGTK::SetPort, window_params::box
jsr show_file
A2D_CALL A2D_SHOW_CURSOR
MGTK_CALL MGTK::ShowCursor
A2D_CALL $2B ; ???
MGTK_CALL $2B ; ???
;; fall through
.endproc
@ -357,11 +357,11 @@ end: rts
;;; Main Input Loop
.proc input_loop
A2D_CALL A2D_GET_INPUT, input_params
MGTK_CALL MGTK::GetEvent, input_params
lda input_params::state
cmp #A2D_INPUT_DOWN ; was clicked?
cmp #MGTK::button_down ; was clicked?
beq exit
cmp #A2D_INPUT_KEY ; any key?
cmp #MGTK::key_down ; any key?
beq on_key
bne input_loop
@ -374,11 +374,11 @@ on_key:
bne input_loop
exit:
A2D_CALL A2D_HIDE_CURSOR
A2D_CALL A2D_DESTROY_WINDOW, window_params
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::CloseWindow, window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS
jsr unstash_menu
A2D_CALL A2D_SHOW_CURSOR
MGTK_CALL MGTK::ShowCursor
rts ; exits input loop
.endproc

View File

@ -5,7 +5,7 @@
.include "../inc/prodos.inc"
.include "../inc/auxmem.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc" ; get/clear selection, font
.org $800
@ -304,10 +304,10 @@ len: .byte 0 ; length
.proc window_params
id: .byte window_id ; window identifier
flags: .byte A2D_CWF_ADDCLOSE; window flags (2=include close box)
flags: .byte MGTK::option_go_away_box; window flags (2=include close box)
title: .addr $1000 ; overwritten to point at filename
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_SCROLL_NORMAL
hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_normal
hsmax: .byte 32
hspos: .byte 0
vsmax: .byte 255
@ -321,17 +321,17 @@ h2: .word default_height
.proc box
left: .word default_left
top: .word default_top
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
hoff: .word 0 ; Also used for A2D_FILL_RECT
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0 ; Also used for MGTK::PaintRect
voff: .word 0
width: .word default_width
height: .word default_height
.endproc
pattern:.res 8, $00
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -346,8 +346,8 @@ next: .addr 0
.proc default_box
left: .word default_left
top: .word default_top
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .word MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word default_width
@ -497,12 +497,12 @@ loop: lda font_width_table - 1,x
jsr get_file_eof
;; create window
A2D_CALL A2D_CREATE_WINDOW, window_params
A2D_CALL A2D_SET_STATE, window_params::box
MGTK_CALL MGTK::OpenWindow, window_params
MGTK_CALL MGTK::SetPort, window_params::box
jsr calc_window_size
jsr calc_and_draw_mode
jsr draw_content
A2D_CALL $2B ; ???
MGTK_CALL $2B ; ???
;; fall through
.endproc
@ -510,19 +510,19 @@ loop: lda font_width_table - 1,x
;;; Main Input Loop
input_loop:
A2D_CALL A2D_GET_INPUT, input_params
MGTK_CALL MGTK::GetEvent, input_params
lda input_params
cmp #1 ; was clicked?
bne input_loop ; nope, keep waiting
A2D_CALL A2D_QUERY_TARGET, input_params::coords
MGTK_CALL MGTK::FindWindow, input_params::coords
lda target_params::win ; in our window?
cmp #window_id
bne input_loop
;; which part of the window?
lda target_params::elem
cmp #A2D_ELEM_CLOSE
cmp #MGTK::area_close_box
beq on_close_click
;; title and resize clicks need mouse location
@ -536,9 +536,9 @@ input_loop:
stx resize_drag_params::ycoord
stx query_client_params::ycoord
cmp #A2D_ELEM_TITLE
cmp #MGTK::area_dragbar
beq title
cmp #A2D_ELEM_RESIZE ; not enabled, so this will never match
cmp #MGTK::area_grow_box ; not enabled, so this will never match
beq input_loop
jsr on_client_click
jmp input_loop
@ -550,11 +550,11 @@ title: jsr on_title_bar_click
;;; Close Button
.proc on_close_click
A2D_CALL A2D_CLOSE_CLICK, close_btn_params ; wait to see if the click completes
MGTK_CALL MGTK::TrackGoAway, close_btn_params ; wait to see if the click completes
lda close_btn_params::state ; did click complete?
beq input_loop ; nope
jsr close_file
A2D_CALL A2D_DESTROY_WINDOW, window_params
MGTK_CALL MGTK::CloseWindow, window_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS
rts ; exits input loop
.endproc
@ -564,7 +564,7 @@ title: jsr on_title_bar_click
;;; This is dead code (no resize handle!) and may be buggy
.proc on_resize_click
A2D_CALL A2D_DRAG_RESIZE, resize_drag_params
MGTK_CALL MGTK::GrowWindow, resize_drag_params
jsr redraw_screen
jsr calc_window_size
@ -594,10 +594,10 @@ wider: lda window_params::hscroll
ldx window_width+1
cpx #>max_width
bne enable
and #(<~A2D_CWS_SCROLL_TRACK) ; disable scroll
and #(<~MGTK::scroll_option_active) ; disable scroll
jmp :+
enable: ora #A2D_CWS_SCROLL_TRACK ; enable scroll
enable: ora #MGTK::scroll_option_active ; enable scroll
: sta window_params::hscroll
sec
@ -609,9 +609,9 @@ enable: ora #A2D_CWS_SCROLL_TRACK ; enable scroll
sta $07
jsr div_by_16
sta resize_window_params::L0987
lda #A2D_HSCROLL
lda #MGTK::ctl_horizontal_scroll_bar
sta resize_window_params::part
A2D_CALL A2D_RESIZE_WINDOW, resize_window_params ; change to clamped size ???
MGTK_CALL MGTK::SetCtlMax, resize_window_params ; change to clamped size ???
jsr calc_and_draw_mode
jmp finish_resize
.endproc
@ -622,11 +622,11 @@ enable: ora #A2D_CWS_SCROLL_TRACK ; enable scroll
;;; Non-title (client) area clicked
.proc on_client_click
;; On one of the scroll bars?
A2D_CALL A2D_QUERY_CLIENT, query_client_params
MGTK_CALL MGTK::FindControl, query_client_params
lda query_client_params::part
cmp #A2D_VSCROLL
cmp #MGTK::ctl_vertical_scroll_bar
beq on_vscroll_click
cmp #A2D_HSCROLL
cmp #MGTK::ctl_horizontal_scroll_bar
bne end
jmp on_hscroll_click
end: rts
@ -636,19 +636,19 @@ end: rts
;;; Vertical Scroll Bar
.proc on_vscroll_click
lda #A2D_VSCROLL
lda #MGTK::ctl_vertical_scroll_bar
sta thumb_drag_params::type
sta update_scroll_params::type
lda query_client_params::scroll
cmp #A2D_SCROLL_PART_THUMB
cmp #MGTK::part_thumb
beq on_vscroll_thumb_click
cmp #A2D_SCROLL_PART_BELOW
cmp #MGTK::part_page_down
beq on_vscroll_below_click
cmp #A2D_SCROLL_PART_ABOVE
cmp #MGTK::part_page_up
beq on_vscroll_above_click
cmp #A2D_SCROLL_PART_UP
cmp #MGTK::part_up_arrow
beq on_vscroll_up_click
cmp #A2D_SCROLL_PART_DOWN
cmp #MGTK::part_down_arrow
bne end
jmp on_vscroll_down_click
end: rts
@ -758,19 +758,19 @@ loop: inx
;;; (Unused in STF DA, so most of this is speculation)
.proc on_hscroll_click
lda #A2D_HSCROLL
lda #MGTK::ctl_horizontal_scroll_bar
sta thumb_drag_params::type
sta update_scroll_params::type
lda query_client_params::scroll
cmp #A2D_SCROLL_PART_THUMB
cmp #MGTK::part_thumb
beq on_hscroll_thumb_click
cmp #A2D_SCROLL_PART_AFTER
cmp #MGTK::part_page_right
beq on_hscroll_after_click
cmp #A2D_SCROLL_PART_BEFORE
cmp #MGTK::part_page_left
beq on_hscroll_before_click
cmp #A2D_SCROLL_PART_LEFT
cmp #MGTK::part_left_arrow
beq on_hscroll_left_click
cmp #A2D_SCROLL_PART_RIGHT
cmp #MGTK::part_right_arrow
beq on_hscroll_right_click
rts
.endproc
@ -860,13 +860,13 @@ store: sta window_params::hspos
sta thumb_drag_params::xcoord+1
lda input_params::ycoord
sta thumb_drag_params::ycoord
A2D_CALL A2D_DRAG_SCROLL, thumb_drag_params
MGTK_CALL MGTK::TrackThumb, thumb_drag_params
rts
.endproc
;;; Checks button state; z clear if button was released, set otherwise
.proc was_button_released
A2D_CALL A2D_GET_INPUT, input_params
MGTK_CALL MGTK::GetEvent, input_params
lda input_params
cmp #2
rts
@ -938,20 +938,20 @@ end: rts
sta $07
jsr div_by_16
sta update_scroll_params::pos
A2D_CALL A2D_UPDATE_SCROLL, update_scroll_params
MGTK_CALL MGTK::UpdateThumb, update_scroll_params
rts
.endproc
.proc update_vscroll ; update_scroll_params::pos set by caller
lda #1
sta update_scroll_params::type
A2D_CALL A2D_UPDATE_SCROLL, update_scroll_params
MGTK_CALL MGTK::UpdateThumb, update_scroll_params
rts
.endproc
.proc finish_resize ; only called from dead code
DESKTOP_CALL DESKTOP_REDRAW_ICONS
A2D_CALL A2D_SET_STATE, window_params::box
MGTK_CALL MGTK::SetPort, window_params::box
lda window_params::hscroll
ror a ; check if low bit (track enabled) is set
bcc :+
@ -964,9 +964,9 @@ end: rts
.endproc
.proc clear_window
A2D_CALL A2D_SET_PATTERN, white_pattern
A2D_CALL A2D_FILL_RECT, window_params::box::hoff
A2D_CALL A2D_SET_PATTERN, black_pattern
MGTK_CALL MGTK::SetPattern, white_pattern
MGTK_CALL MGTK::PaintRect, window_params::box::hoff
MGTK_CALL MGTK::SetPattern, black_pattern
rts
.endproc
@ -1005,7 +1005,7 @@ do_line:
bne :+
jsr clear_window
inc L0948
: A2D_CALL A2D_SET_POS, line_pos
: MGTK_CALL MGTK::MoveTo, line_pos
sec
lda #250
sbc line_pos::left
@ -1194,7 +1194,7 @@ times70:.word 70
beq end
lda text_string::len
beq end
A2D_CALL A2D_DRAW_TEXT, text_string
MGTK_CALL MGTK::DrawText, text_string
lda #1
sta L0949
end: rts
@ -1426,15 +1426,15 @@ ignore: clc ; Click ignored
rts
.endproc
fixed_str: A2D_DEFSTRING "Fixed "
prop_str: A2D_DEFSTRING "Proportional"
fixed_str: DEFINE_STRING "Fixed "
prop_str: DEFINE_STRING "Proportional"
label_width := 50
title_bar_height := 12
.proc mode_box ; bounding box for mode label
left: .word 0
top: .word 0
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .word MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word 80
@ -1471,19 +1471,19 @@ base: .word 10 ; vertical text offset (to baseline)
.endproc
.proc draw_mode
A2D_CALL A2D_SET_BOX, mode_box
A2D_CALL A2D_SET_POS, mode_pos
MGTK_CALL MGTK::SetPortSite, mode_box
MGTK_CALL MGTK::MoveTo, mode_pos
lda fixed_mode_flag
beq else ; is proportional?
A2D_CALL A2D_DRAW_TEXT, fixed_str
MGTK_CALL MGTK::DrawText, fixed_str
jmp endif
else: A2D_CALL A2D_DRAW_TEXT, prop_str
else: MGTK_CALL MGTK::DrawText, prop_str
endif: ldx #$0F
loop: lda default_box,x
sta window_params::box,x
dex
bpl loop
A2D_CALL A2D_SET_BOX, window_params::box
MGTK_CALL MGTK::SetPortSite, window_params::box
rts
.endproc

View File

@ -11,7 +11,7 @@ DA_MAX_SIZE := $1C00 - DA_LOAD_ADDRESS
;;; * = Used by Desk Accessories
JUMP_TABLE_00 := $4000 ; ???
JUMP_TABLE_A2D_RELAY := $4003 ; A2D relay call (main>aux)
JUMP_TABLE_MGTK_RELAY := $4003 ; MGTK relay call (main>aux)
JUMP_TABLE_06 := $4006 ; ???
JUMP_TABLE_09 := $4009 ; ???
JUMP_TABLE_0C := $400C ; ???
@ -39,7 +39,7 @@ JUMP_TABLE_RESTORE_SEG := $403F ; Restore from dynamic routine
;;; NOTE: Some of these are used by Desk Accessories
DESKTOP := $8E00
;; MLI-style call (jsr A2D ; .byte call ; .addr params)
;; MLI-style call (jsr DEKSTOP ; .byte call ; .addr params)
;; Call from AUX (RAMRDON/RAMWRTON)
;; Implementation bounces to $93BC, uses jump table at $939E

View File

@ -3,7 +3,7 @@ CC65 = ~/dev/cc65/bin
CAFLAGS = --target apple2enh --list-bytes 0
CCFLAGS = --config asm.cfg
TARGETS = loader.built a2d.built desktop.built invoker.built
TARGETS = loader.built mgtk.built desktop.built invoker.built
.PHONY: clean all
all: $(TARGETS)
@ -22,6 +22,6 @@ clean:
check:
diff loader.built orig/DESKTOP2_loader
diff a2d.built orig/DESKTOP2_a2d
diff mgtk.built orig/DESKTOP2_mgtk
diff desktop.built orig/DESKTOP2_desktop
diff invoker.built orig/DESKTOP2_invoker

View File

@ -16,7 +16,7 @@ segments swapped in dynamically.
The file is broken down into multiple segments:
* segment 0: load - A$2000-$257F, L$0580, mark $000000 (Loader)
* segment 1: aux - A$4000-$BFFF, L$8000, mark $000580 (A2D, DeskTop)
* segment 1: aux - A$4000-$BFFF, L$8000, mark $000580 (MGTK, DeskTop)
* segment 2: auxlc - A$D000-$ECFF, L$1D00, mark $008580 (DeskTop)
* segment 3: auxlc - A$FB00-$FFFF, L$0500, mark $00A280 (DeskTop)
* segment 4: main - A$4000-$BEFF, L$7F00, mark $00A780 (DeskTop)
@ -77,7 +77,7 @@ Loaded at $800-$FFF, this does one-time initialization of the
DeskTop. It is later overwritten when any desk accessories are
run.
### GUI Library "A2D"
### Mouse Graphics Tool Kit (MGTK)
`a2d.s`
@ -140,8 +140,8 @@ $9000 | +------+ | |
$8800 | | | Font |
| | | |
$851F | | +-------------+
| | | A2D GUI |
| | | Library |
| | | MGTK |
| | | |
| | | |
| | | |
$7800 | +------+ | |

File diff suppressed because it is too large Load Diff

View File

@ -286,7 +286,7 @@ pathname:
;;; then relocated to |dest| according to |type|.
;;; Segments are:
;;; $4000 aux - A2D GUI library and DeskTop code
;;; $4000 aux - MGTK and DeskTop code
;;; $D000 aux/banked - DeskTop code callable from main, and resources
;;; $FB00 aux/banked - more DeskTop resources (icons, strings, etc)
;;; $4000 main - more DeskTop code

View File

@ -5,14 +5,14 @@
.include "../inc/auxmem.inc"
.include "../inc/prodos.inc"
.include "../inc/mouse.inc"
.include "../a2d.inc"
.include "../mgtk.inc"
.include "../desktop.inc"
;;; ==================================================
;;; A2D - the GUI library
;;; Mouse Graphics Tool Kit
;;; ==================================================
.proc a2d
.proc mgtk
.org $4000
;;; ==================================================
@ -96,10 +96,10 @@
glyph_height_p := $FF ; glyph height
;;; ==================================================
;;; A2D
;;; MGTK
.proc a2d_dispatch
.assert * = A2D, error, "A2D entry point must be at $4000"
.proc mgtk_dispatch
.assert * = MGTK::MLI, error, "Entry point must be at $4000"
lda LOWSCR
sta SET80COL
@ -107,7 +107,7 @@
bit preserve_zp_flag ; save ZP?
bpl adjust_stack
;; Save $80...$FF, swap in what A2D needs at $F4...$FF
;; Save $80...$FF, swap in what MGTK needs at $F4...$FF
ldx #$7F
: lda $80,x
sta zp_saved,x
@ -140,9 +140,9 @@ adjust_stack: ; Adjust stack to account for params
lda (params_addr),y
asl a
tax
lda a2d_jump_table,x
lda mgtk_jump_table,x
sta jump+1
lda a2d_jump_table+1,x
lda mgtk_jump_table+1,x
sta jump+2
iny ; Point params_addr at params
@ -225,9 +225,9 @@ rts1: rts
;;; ==================================================
;;; Routines can jmp here to exit with A set
a2d_exit_with_a:
mgtk_exit_with_a:
pha
jsr a2d_dispatch::cleanup
jsr mgtk_dispatch::cleanup
pla
ldx stack_ptr_stash
txs
@ -275,17 +275,25 @@ hide_cursor_count:
.endproc
;;; ==================================================
;;; Jump table for A2D entry point calls
;;; Jump table for MGTK entry point calls
;; jt_rts can be used if the only thing the
;; routine needs to do is copy params into
;; the zero page (state)
jt_rts := a2d_dispatch::rts1
jt_rts := mgtk_dispatch::rts1
a2d_jump_table:
mgtk_jump_table:
.addr jt_rts ; $00 NOOP
;; ----------------------------------------
;; Graphics Primitives
;; Initialization Commands
.addr L5E51 ; $01
.addr CFG_DISPLAY_IMPL ; $02 CFG_DISPLAY
;; GrafPort Commands
.addr QUERY_SCREEN_IMPL ; $03 QUERY_SCREEN
.addr SET_STATE_IMPL ; $04 SET_STATE
.addr GET_STATE_IMPL ; $05 GET_STATE
@ -296,6 +304,8 @@ a2d_jump_table:
.addr jt_rts ; $0A SET_THICKNESS
.addr SET_FONT_IMPL ; $0B SET_FONT
.addr jt_rts ; $0C SET_TEXT_MASK
;; Drawing Commands
.addr OFFSET_POS_IMPL ; $0D OFFSET_POS
.addr jt_rts ; $0E SET_POS
.addr DRAW_LINE_IMPL ; $0F DRAW_LINE
@ -307,11 +317,20 @@ a2d_jump_table:
.addr L537E ; $15
.addr DRAW_POLYGONS_IMPL ; $16 DRAW_POLYGONS
.addr L537A ; $17
;; Text Commands
.addr MEASURE_TEXT_IMPL ; $18 MEASURE_TEXT
.addr DRAW_TEXT_IMPL ; $19 DRAW_TEXT
;; Utility Commands
.addr CONFIGURE_ZP_IMPL ; $1A CONFIGURE_ZP_USE
.addr LOW_ZP_STASH_IMPL ; $1B LOW_ZP_STASH
.addr L5F0A ; $1C
;; ----------------------------------------
;; Mouse Graphics Tool Kit
;; Initialization Calls
.addr INIT_SCREEN_AND_MOUSE_IMPL ; $1D INIT_SCREEN_AND_MOUSE
.addr DISABLE_MOUSE_IMPL ; $1E DISABLE_MOUSE
.addr L64D2 ; $1F
@ -319,17 +338,23 @@ a2d_jump_table:
.addr L8427 ; $21
.addr L7D61 ; $22
.addr GET_INT_HANDLER_IMPL; $23 GET_INT_HANDLER
;; Cursor Manager Calls
.addr SET_CURSOR_IMPL ; $24 SET_CURSOR
.addr SHOW_CURSOR_IMPL ; $25 SHOW_CURSOR
.addr HIDE_CURSOR_IMPL ; $26 HIDE_CURSOR
.addr ERASE_CURSOR_IMPL ; $27 ERASE_CURSOR
.addr GET_CURSOR_IMPL ; $28 GET_CURSOR
.addr L6663 ; $29
;; Event Manager Calls
.addr GET_INPUT_IMPL ; $2A GET_INPUT
.addr CALL_2B_IMPL ; $2B
.addr L65D4 ; $2C
.addr SET_INPUT_IMPL ; $2D SET_INPUT
.addr SET_KBD_FLAG_IMPL ; $2E SET_KBD_FLAG
;; Menu Manager Calls
.addr L6ECD ; $2F
.addr SET_MENU_IMPL ; $30 SET_MENU
.addr MENU_CLICK_IMPL ; $31 MENU_CLICK
@ -339,6 +364,8 @@ a2d_jump_table:
.addr L6BA9 ; $35
.addr L6BB5 ; $36
.addr L6F1C ; $37
;; Window Manager Calls
.addr CREATE_WINDOW_IMPL ; $38 CREATE_WINDOW
.addr DESTROY_WINDOW_IMPL ; $39 DESTROY_WINDOW
.addr L7836 ; $3A
@ -355,6 +382,8 @@ a2d_jump_table:
.addr DRAG_RESIZE_IMPL ; $45 DRAG_RESIZE
.addr MAP_COORDS_IMPL ; $46 MAP_COORDS
.addr L78E1 ; $47
;; Control Manager Calls
.addr QUERY_CLIENT_IMPL ; $48 QUERY_CLIENT
.addr RESIZE_WINDOW_IMPL ; $49 RESIZE_WINDOW
.addr DRAG_SCROLL_IMPL ; $4A DRAG_SCROLL
@ -1531,7 +1560,7 @@ L5043: jsr L50A9
bcc :+
bne fail
: lda #$80 ; success!
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
fail: rts
.endproc
@ -1663,7 +1692,7 @@ L514C: sec
rts
L5163: lda #$81
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
;;; ==================================================
@ -2005,7 +2034,7 @@ L5390: jsr L5354
jmp L546F
L5398: lda #$82
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L539D: ldy #1
sty $AF
@ -2739,7 +2768,7 @@ loop: sta glyph_row_lo,y
rts
end: lda #$83
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
.endproc
glyph_row_lo:
@ -3547,7 +3576,7 @@ rts3: rts
beq rts3
sta preserve_zp_flag
bcc rts3
jmp a2d_dispatch::cleanup
jmp mgtk_dispatch::cleanup
.endproc
;;; ==================================================
@ -3615,7 +3644,7 @@ table: .byte $01,$00,$00,$46,$01,$00
;;; ==================================================
preserve_zp_flag: ; if high bit set, ZP saved during A2D calls
preserve_zp_flag: ; if high bit set, ZP saved during MGTK calls
.byte $80
low_zp_stash_flag:
@ -3631,15 +3660,15 @@ stack_ptr_stash:
.proc screen_state
left: .word 0
top: .word 0
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word 560-1
height: .word 192-1
pattern:.res 8, $FF
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -3655,15 +3684,15 @@ font: .addr 0
.proc saved_state
left: .word 0
top: .word 0
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoff: .word 0
voff: .word 0
width: .word 560-1
height: .word 192-1
pattern:.res 8, $FF
mskand: .byte A2D_DEFAULT_MSKAND
mskor: .byte A2D_DEFAULT_MSKOR
mskand: .byte MGTK::colormask_and
mskor: .byte MGTK::colormask_or
xpos: .word 0
ypos: .word 0
hthick: .byte 1
@ -4213,7 +4242,7 @@ L63D1: ldx L6338
cpx #$00
bne L63E5
lda #$92
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L63E5: lda L6338
and #$7F
@ -4221,7 +4250,7 @@ L63E5: lda L6338
cpx L6338
beq L63F6
lda #$91
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L63F6: stx L6338
lda #$80
@ -4264,8 +4293,8 @@ L643F: jsr call_mouse
L6454: jsr L653F
jsr L6588
;; Fills the desktop background on startup (menu left black)
A2D_CALL A2D_SET_PATTERN, checkerboard_pattern
A2D_CALL A2D_FILL_RECT, fill_rect_params
MGTK_CALL MGTK::SetPattern, checkerboard_pattern
MGTK_CALL MGTK::PaintRect, fill_rect_params
jmp L6556
.proc alloc_interrupt_params
@ -4295,7 +4324,7 @@ L6486: lda #$80
L648B: rts
L648C: lda #$93
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L6491:
lda L6337
@ -4303,7 +4332,7 @@ L6491:
cmp #$01
beq L64A4
lda #$90
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L649F: lda #$80
sta L6337
@ -4371,7 +4400,7 @@ L64FF: lda #$00
rts
L6508: lda #$94
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L650D: lda L6522
beq L651D
@ -4495,7 +4524,7 @@ checkerboard_pattern:
jmp store_xa_at_params_y
fail: lda #$95
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
mouse_state_addr:
.addr mouse_state
@ -4577,7 +4606,7 @@ L663B: lda #$98
bmi L6641
L663F: lda #$99
L6641: plp
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L6645: lda #0
bit mouse_status
@ -4615,7 +4644,7 @@ modifiers := * + 3
bit L6339
bpl L666D
lda #$97
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L666D:
sec ; called from interrupt handler
@ -4652,20 +4681,20 @@ L666D:
lda input::modifiers
sta input::kmods
lda #A2D_INPUT_KEY
lda #MGTK::key_down
sta input::state
bne L66D8
L66B9: bcc up
lda input::modifiers
beq :+
lda #A2D_INPUT_DOWN_MOD
lda #MGTK::apple_key
bne set_state
: lda #A2D_INPUT_DOWN
: lda #MGTK::button_down
bne set_state
up: lda #A2D_INPUT_UP
up: lda #MGTK::button_up
set_state:
sta input::state
@ -4702,7 +4731,7 @@ int_stash_rd80store:
.proc interrupt_handler
cld ; required for interrupt handlers
body: ; returned by A2D_GET_INT_HANDLER
body: ; returned by MGTK_GET_INT_HANDLER
lda RDPAGE2 ; record softswitch state
sta int_stash_rdpage2
@ -5012,7 +5041,7 @@ L6910: sta $A1
sta $A3
rts
L691B: A2D_CALL A2D_GET_INPUT, $82
L691B: MGTK_CALL MGTK::GetEvent, $82
lda $82
rts
@ -5170,7 +5199,7 @@ L6A3C: lda #$00
sbc L633E
bpl L6A5B
lda #$9C
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L6A5B: rts
@ -5187,17 +5216,17 @@ L6A5C: ldx $A7
stx draw_params+1
lda #0
jsr set_fill_mode
A2D_CALL A2D_FILL_RECT, 0, fill_params
MGTK_CALL MGTK::PaintRect, 0, fill_params
lda #4
jsr set_fill_mode
A2D_CALL A2D_DRAW_RECT, 0, draw_params
MGTK_CALL MGTK::FrameRect, 0, draw_params
rts
.endproc
L6A89: jsr L6A94
bne L6A93
lda #$9A
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L6A93: rts
@ -5305,7 +5334,7 @@ loop: lda $B7,x
bpl loop
lda #$02
jsr set_fill_mode
A2D_CALL A2D_FILL_RECT, fill_rect_params2
MGTK_CALL MGTK::PaintRect, fill_rect_params2
rts
.endproc
@ -5353,7 +5382,7 @@ L6B9E: rts
L6B9F: jsr L6B96
bne L6B9E
lda #$9B
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
;;; ==================================================
@ -5425,12 +5454,12 @@ L6BFD: bit L7D81
bpl L6C05
jmp L8149
L6C05: A2D_CALL A2D_SET_POS, $83
A2D_CALL A2D_TEST_BOX, test_box_params
L6C05: MGTK_CALL MGTK::MoveTo, $83
MGTK_CALL MGTK::InRect, test_box_params
bne L6C58
lda L6BD9
beq L6C23
A2D_CALL A2D_TEST_BOX, test_box_params2
MGTK_CALL MGTK::InRect, test_box_params2
bne L6C73
jsr L6EA1
L6C23: jsr L691B
@ -5702,11 +5731,11 @@ L6E36: ldx $A9
lda $BE
sbc #$00
sta fill_rect_params3_right+1
A2D_CALL A2D_SET_PATTERN, light_speckle_pattern
MGTK_CALL MGTK::SetPattern, light_speckle_pattern
lda #$01
jsr set_fill_mode
A2D_CALL A2D_FILL_RECT, fill_rect_params3
A2D_CALL A2D_SET_PATTERN, screen_state::pattern
MGTK_CALL MGTK::PaintRect, fill_rect_params3
MGTK_CALL MGTK::SetPattern, screen_state::pattern
lda #$02
jsr set_fill_mode
rts
@ -5756,7 +5785,7 @@ L6EAA: ldx L6BDA
jsr HIDE_CURSOR_IMPL
lda #$02
jsr set_fill_mode
A2D_CALL A2D_FILL_RECT, fill_rect_params4
MGTK_CALL MGTK::PaintRect, fill_rect_params4
jmp SHOW_CURSOR_IMPL
;;; ==================================================
@ -6020,20 +6049,20 @@ end: rts
;; Look up window state by id (in $82); $A9/$AA will point at
;; window params (also X,A).
;; This will exit the A2D call directly (restoring stack, etc)
;; This will exit the MGTK call directly (restoring stack, etc)
;; if the window is not found.
.proc window_by_id_or_exit
jsr window_by_id
beq nope
rts
nope: lda #$9F
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
.endproc
L707F: A2D_CALL A2D_DRAW_RECT, $C7
L707F: MGTK_CALL MGTK::FrameRect, $C7
rts
L7086: A2D_CALL A2D_TEST_BOX, $C7
L7086: MGTK_CALL MGTK::InRect, $C7
rts
L708D: ldx #$03
@ -6230,10 +6259,10 @@ L71EE: jsr L7157
lda $C9
and #$01
beq L71FE
A2D_CALL A2D_SET_PATTERN, stripes_pattern
MGTK_CALL MGTK::SetPattern, stripes_pattern
rts
L71FE: A2D_CALL A2D_SET_PATTERN, stripes_pattern_alt
L71FE: MGTK_CALL MGTK::SetPattern, stripes_pattern_alt
rts
L7205: lda #$01
@ -6332,7 +6361,7 @@ L72A0: jsr FILL_RECT_IMPL ; Draw title bar stripes between close box and t
sbc #$00
sta $97
jsr FILL_RECT_IMPL ; Draw title bar stripes to right of title
A2D_CALL A2D_SET_PATTERN, screen_state::pattern
MGTK_CALL MGTK::SetPattern, screen_state::pattern
L72C9: jsr next_window::L703E
bit $B0
bpl L7319
@ -6491,7 +6520,7 @@ L73F0: sta state_ypos
QUERY_TARGET_IMPL:
jsr L653F
A2D_CALL A2D_TEST_BOX, test_box_params
MGTK_CALL MGTK::InRect, test_box_params
beq L7416
lda #$01
L7406: ldx #$00
@ -6561,13 +6590,13 @@ CREATE_WINDOW_IMPL:
lda ($A9),y
bne L748E
lda #$9E
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L748E: sta $82
jsr window_by_id
beq L749A
lda #$9D
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L749A: lda params_addr
sta $A9
@ -6661,12 +6690,12 @@ L750C: .res 38,0
jsr L6588
lda L7871
bne :+
A2D_CALL A2D_SET_BOX, set_box_params
MGTK_CALL MGTK::SetPortSite, set_box_params
: jsr L718E
jsr L6588
lda L7871
bne :+
A2D_CALL A2D_SET_BOX, set_box_params
MGTK_CALL MGTK::SetPortSite, set_box_params
: jsr next_window::L703E
lda active_state
sta L750C
@ -6686,7 +6715,7 @@ L750C: .res 38,0
.endproc
L7585: lda #$A3
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
;;; ==================================================
@ -6841,12 +6870,12 @@ toggle: sta in_close_box
lda #$02
jsr set_fill_mode
jsr HIDE_CURSOR_IMPL
A2D_CALL A2D_FILL_RECT, $C7
MGTK_CALL MGTK::PaintRect, $C7
jsr SHOW_CURSOR_IMPL
loop: jsr L691B
cmp #$02
beq L768B
A2D_CALL A2D_SET_POS, set_pos_params
MGTK_CALL MGTK::MoveTo, set_pos_params
jsr L7086
eor in_close_box
bpl loop
@ -6912,7 +6941,7 @@ L76D1: jsr L653C
jsr L784C
lda #$02
jsr set_fill_mode
A2D_CALL A2D_SET_PATTERN, checkerboard_pattern
MGTK_CALL MGTK::SetPattern, checkerboard_pattern
L76E2: jsr next_window::L703E
jsr L7749
jsr L70B7
@ -7121,11 +7150,11 @@ L7871: .byte 0
L7872: sta L7010
lda #$00
sta L7871
A2D_CALL A2D_SET_BOX, set_box_params
MGTK_CALL MGTK::SetPortSite, set_box_params
lda #$00
jsr set_fill_mode
A2D_CALL A2D_SET_PATTERN, checkerboard_pattern
A2D_CALL A2D_FILL_RECT, set_box_params_box
MGTK_CALL MGTK::SetPattern, checkerboard_pattern
MGTK_CALL MGTK::PaintRect, set_box_params_box
jsr L6553
jsr top_window
beq L78CA
@ -7161,8 +7190,8 @@ L78CF: .byte $0D,$00
.proc set_box_params
left: .word 0
top: .word $D
addr: .addr A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
addr: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth
hoffset:.word 0
voffset:.word 0
width: .word 0
@ -7302,7 +7331,7 @@ L7990: eor $8D
L79A0: bne L79AF
jsr L79F1
jsr L657E
A2D_CALL A2D_FILL_RECT, $C7
MGTK_CALL MGTK::PaintRect, $C7
rts
L79AF: bit $8C
@ -7315,9 +7344,9 @@ L79B8: bit $B0
bpl L79B7
L79BC: jsr L657E
jsr L79F1
A2D_CALL A2D_SET_PATTERN, light_speckles_pattern
A2D_CALL A2D_FILL_RECT, $C7
A2D_CALL A2D_SET_PATTERN, screen_state::pattern
MGTK_CALL MGTK::SetPattern, light_speckles_pattern
MGTK_CALL MGTK::PaintRect, $C7
MGTK_CALL MGTK::SetPattern, screen_state::pattern
bit $8C
bmi L79DD
bit $AF
@ -7458,7 +7487,7 @@ QUERY_CLIENT_IMPL:
jsr top_window
bne L7ACE
lda #$A0
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7ACE: bit $B0
bpl L7B15
@ -7557,12 +7586,12 @@ L7B81: cmp #$02
sta $82
beq L7B90
L7B8B: lda #$A4
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7B90: jsr top_window
bne L7B9A
lda #$A0
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7B9A: ldy #$06
bit $82
@ -7590,7 +7619,7 @@ L7BB6: cmp #$02
sta $82
beq L7BC5
L7BC0: lda #$A4
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7BC5: lda $82
sta $8C
@ -7603,14 +7632,14 @@ L7BCB: lda $83,x
jsr top_window
bne L7BE0
lda #$A0
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7BE0: jsr L7A73
jsr L653F
jsr L6588
lda #$02
jsr set_fill_mode
A2D_CALL A2D_SET_PATTERN, light_speckles_pattern
MGTK_CALL MGTK::SetPattern, light_speckles_pattern
jsr HIDE_CURSOR_IMPL
L7BF7: jsr L707F
jsr SHOW_CURSOR_IMPL
@ -7779,12 +7808,12 @@ L7D30: cmp #$02
sta $8C
beq L7D3F
L7D3A: lda #$A4
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7D3F: jsr top_window
bne L7D49
lda #$A0
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L7D49: ldy #$07
bit $8C
@ -8340,7 +8369,7 @@ L81D9: lda #$00
sta L7D74
lda #$A2
plp
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L81E4: lda $AC
and #$01
@ -8348,7 +8377,7 @@ L81E4: lda $AC
lda #$00
sta L7D74
lda #$A1
jmp a2d_exit_with_a
jmp mgtk_exit_with_a
L81F4: ldx #$00
L81F6: clc
@ -8513,11 +8542,11 @@ L8333: lda $0600,x
L8346: rts
L8347: A2D_CALL A2D_SET_INPUT, set_input_params
L8347: MGTK_CALL MGTK::PostEvent, set_input_params
rts
.proc set_input_params ; 1 byte shorter than normal, since KEY
state: .byte A2D_INPUT_KEY
state: .byte MGTK::key_down
key: .byte 0
modifiers:
.byte 0
@ -8797,4 +8826,4 @@ mouse_firmware_hi: ; e.g. if mouse is in slot 4, this is $C4
mouse_operand: ; e.g. if mouse is in slot 4, this is $40
.byte 0
.endproc ; a2d
.endproc ; mgtk

View File

@ -1,25 +1,24 @@
;;; ==================================================
;;; A2Desktop - GUI Library
;;; Mouse Graphics Tool Kit (w/ Graphics Primitives)
;;; ==================================================
;;; ==================================================
;;; A2D Calls
.scope MGTK
A2D := $4000
;; MLI-style call (jsr A2D ; .byte call ; .addr params)
MLI := $4000
;; MLI-style call (jsr MLI ; .byte call ; .addr params)
;; Call from AUX (RAMRDON/RAMWRTON)
;;; ==================================================
;;; Graphics Primitives
;;; ==================================================
;;; $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.
;;; --------------------------------------------------
;;; Initialization Commands
A2D_NOOP := $00 ; No-op
NoOp := $00 ; No-op
;; (input length 0 bytes)
A2D_CFG_DISPLAY := $02 ; Configure display switches
SetSwitches := $02 ; Configure display switches
;; (input length 1 byte)
;; Turns on 80 col/DHR, and then:
;; bit 0: LoRes if clear, HiRes if set
@ -27,13 +26,16 @@ A2D_CFG_DISPLAY := $02 ; Configure display switches
;; bit 2: Full screen if clear, split screen if set
;; bit 3: Graphics if clear, text if set
A2D_QUERY_SCREEN := $03 ; Get screen state
;;; --------------------------------------------------
;;; GrafPort Commands
InitPort := $03 ; Get screen state
;; (input length 0 bytes)
;; (output length 36 bytes)
;; .word left
;; .word top
;; .addr addr A2D_SCREEN_ADDR
;; .word stride A2D_SCREEN_STRIDE
;; .addr addr screen_mapbits
;; .word stride screen_mapwidth
;; .word hoff
;; .word voff
;; .word width 560-1
@ -49,12 +51,12 @@ A2D_QUERY_SCREEN := $03 ; Get screen state
;; .byte tmask AND mask for text, default $7F
;; .addr font
A2D_SET_STATE := $04 ; Set full drawing state
SetPort := $04 ; Set full drawing state
;; (input length 36 bytes)
;; .word left pixels from screen edge
;; .word top
;; .addr addr A2D_SCREEN_ADDR
;; .word stride A2D_SCREEN_STRIDE
;; .addr addr screen_mapbits
;; .word stride screen_mapwidth
;; .word hoff pixels scrolled
;; .word voff
;; .word width pixels
@ -70,92 +72,95 @@ A2D_SET_STATE := $04 ; Set full drawing state
;; .byte tmask AND mask for text, default $7F
;; .addr font
A2D_GET_STATE := $05 ; Get pointer to active drawing state
GetPort := $05 ; Get pointer to active drawing state
;; (input length 0 bytes)
;; (output length 2 bytes)
;; .addr state (out)
A2D_SET_BOX := $06 ; Set just the drawing box, subset of full state
SetPortSite := $06 ; Set just the drawing box, subset of full state
;; (input length 16 bytes)
;; .word left pixels from screen edge
;; .word top
;; .addr addr A2D_SCREEN_ADDR ($2000)
;; .word stride A2D_SCREEN_STRIDE ($80)
;; .addr addr screen_mapbits ($2000)
;; .word stride screen_mapwidth ($80)
;; .word hoff pixels scrolled
;; .word voff
;; .word width pixels
;; .word height
A2D_SET_FILL_MODE := $07
SetPenMode := $07
;; (input length 1 byte)
;; .byte mode (>=4 also sets eor mask to $7f)
;; 0 = white (???)
;; 2 = black (???)
A2D_SET_PATTERN := $08
SetPattern := $08
;; (input length 8 bytes)
;; .res 8 pattern 8x8 pixel pattern for A2D_FILL_RECT calls
;; .res 8 pattern 8x8 pixel pattern for PaintRect calls
A2D_SET_MSK := $09
SetColorMasks := $09
;; (input length 2 bytes)
;; .byte mskand
;; .byte mskor
A2D_SET_THICKNESS := $0A
SetPenSize := $0A
;; (input length 2 bytes)
;; .byte hthick horizontal pen thickness
;; .byte vthick vertical pen thickness
A2D_SET_FONT := $0B
SetFont := $0B
;; (input length 2 bytes)
;; .addr font font definition (see below)
A2D_SET_TEXT_MASK := $0C ; Stored to background before XORing glyph
SetTextBG := $0C ; Stored to background before XORing glyph
;; (input length 1 byte)
;; .byte mask
A2D_OFFSET_POS := $0D ; Adjust start of subsequent DRAW_TEXT, DRAW_LINE
;;; --------------------------------------------------
;;; Drawing Commands
Move := $0D ; Adjust start of subsequent DRAW_TEXT, DRAW_LINE
;; (input length 4 bytes)
;; .word xdelta
;; .word ydelta
A2D_SET_POS := $0E ; Start of subsequent DRAW_TEXT, DRAW_LINE
MoveTo := $0E ; Start of subsequent DRAW_TEXT, DRAW_LINE
;; (input length 4 bytes)
;; .word xcoord
;; .word ycoord
A2D_DRAW_LINE := $0F ; Draw line (from SET_POS)
Line := $0F ; Draw line (from SET_POS)
;; (input length 4 bytes)
;; .word xdelta signed, delta in pixels
;; .word ydelta
A2D_DRAW_LINE_ABS := $10 ; Draw line (from SET_POS)
LineTo := $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
PaintRect := $11 ; Fill rectangle with selected simple pattern/thickness
;; (input length 8 bytes)
;; .word left (includes scroll pos)
;; .word top
;; .word right pixels
;; .word bottom
A2D_DRAW_RECT := $12 ; Draw rectangle with selected simple pattern/thickness
FrameRect := $12 ; Draw rectangle with selected simple pattern/thickness
;; (input length 8 bytes)
;; .word left pixels
;; .word top
;; .word right
;; .word bottom
A2D_TEST_BOX := $13 ; Is pos (via SET_POS) in bounds? Returns true/false in A
InRect := $13 ; Is pos (via SET_POS) in bounds? Returns true/false in A
;; (input length 8 bytes)
;; .word left
;; .word top
;; .word right
;; .word bottom
A2D_DRAW_BITMAP := $14 ; Draw pattern
PaintBits := $14 ; Draw pattern
;; (input length 16 bytes)
;; .word left
;; .word top
@ -170,7 +175,7 @@ A2D_DRAW_BITMAP := $14 ; Draw pattern
;; $15 used in DeskTop but not DAs - icon redraw
;; (input length 0 bytes)
A2D_DRAW_POLYGONS := $16 ; Draw multiple closed polygons
FramePoly := $16 ; Draw multiple closed polygons
;; (input length 0 bytes)
;; Address points at struct:
;; .byte points count
@ -182,97 +187,120 @@ A2D_DRAW_POLYGONS := $16 ; Draw multiple closed polygons
;; $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
;;; --------------------------------------------------
;;; Text Commands
TextWidth := $18 ; Measure the width of a string in pixels
;; (input length 3 bytes)
;; .addr data
;; .byte length
;; .word width result in pixels
A2D_DRAW_TEXT := $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
;; .byte length
A2D_CONFIGURE_ZP_USE := $1A ; Configure ZP usage by API (speed vs. convenience)
;;; --------------------------------------------------
;;; Utility Commands
SetZP1 := $1A ; Configure ZP usage by API (speed vs. convenience)
;; (input length 1 byte)
;; .byte flag (AWS_CZP_*; high bit set = preserve ZP during calls)
A2D_LOW_ZP_STASH := $1B ; Stash or restore lower 128 bytes of ZP; calls are idempotent
SetZP2 := $1B ; Stash or restore lower 128 bytes of ZP; calls are idempotent
;; (input length 1 byte)
;; .byte flag (high bit set = stash ZP, clear = unstash ZP)
A2D_INIT_SCREEN_AND_MOUSE := $1D; Inits state, registers interrupt handler, draws desktop
;;; ==================================================
;;; Mouse Graphics Tool Kit Calls
;;; ==================================================
;;; --------------------------------------------------
;;; Initialization Calls
StartDeskTop := $1D; Inits state, registers interrupt handler, draws desktop
;; (input length 12 byte)
;; ???
A2D_DISABLE_MOUSE := $1E ; Deallocates interrupt, hides cursor
StopDeskTop := $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
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 mouse_state (out) Address of mouse state (.word x, y; .byte status)
A2D_GET_INT_HANDLER := $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)
A2D_SET_CURSOR := $24 ; Set cursor definition
;;; --------------------------------------------------
;;; Cursor Manager Calls
SetCursor := $24 ; Set cursor definition
;; (input not copied)
;; .res 24 bitmap 2x12 byte bitmap
;; .res 24 mask 2x12 byte mask
;; .byte hotx hotspot coords
;; .byte hoty
A2D_SHOW_CURSOR := $25 ; Return cursor to visibility
ShowCursor := $25 ; Return cursor to visibility
;; (no parameters; pass $0000 as address)
A2D_HIDE_CURSOR := $26 ; Cursor hidden until A2D_SHOW_CURSOR call
HideCursor := $26 ; Cursor hidden until ShowCursor call
;; (no parameters; pass $0000 as address)
A2D_ERASE_CURSOR := $27 ; Cursor hidden until moved or other A2D call
ObscureCursor := $27 ; Cursor hidden until moved
;; (no parameters; pass $0000 as address)
A2D_GET_CURSOR := $28 ; Get cursor definition
GetCursorAddr := $28 ; Get cursor definition
;; (input length 0 bytes)
;; (output length 2 bytes)
;; .addr definition See A2D_SET_CURSOR
;; .addr definition See SetCursor
A2D_GET_INPUT := $2A
;;; --------------------------------------------------
;;; Event Manager Calls
GetEvent := $2A
;; (input length 0 bytes)
;; (output length 5 bytes)
;; .byte state (A2D_INPUT_*)
;; if state is A2D_INPUT_KEY:
;; .byte state
;; if state is key_down:
;; .byte key (ASCII code; high bit clear)
;; .byte modifiers (0=none, 1=open-apple, 2=closed-apple, 3=both)
;; if state otherwise:
;; .word xcoord
;; .word ycoord
A2D_UNK_2B := $2B ; Unknown - possibly "reset drawing state"
FlushEvents := $2B
;; (no parameters; pass $0000 as address)
;; $2C used in DeskTop but not DAs - icon drag
;; (input length 0 bytes)
A2D_SET_INPUT := $2D ; Set pending input state (mouse or keyboard)
PostEvent := $2D ; Set pending input state (mouse or keyboard)
;; (input length 5 bytes)
;; .byte state A2D_INPUT_*
;; if state is A2D_INPUT_KEY:
;; .byte state
;; if state is key_down:
;; .byte key ASCII code; high bit clear
;; .byte modifiers 0=none, 1=open-apple, 2=closed-apple, 3=both
;; if state otherwise:
;; .word xcoord
;; .word ycoord
A2D_SET_KBD_FLAG := $2E ; When set, keyboard is ignored in $29 calls
SetKeyEvent := $2E ; When set, keyboard is ignored in $29 calls
;; (input length 1 byte)
;; .byte flag high bit set = ignore keyboard, otherwise check
A2D_SET_MENU := $30 ; Configure (and draw) menu
;;; --------------------------------------------------
;;; Menu Manager Calls
SetMenu := $30 ; Configure (and draw) menu
;; (input not copied)
;; .word count Number of top-level menus
;;
@ -294,19 +322,22 @@ A2D_SET_MENU := $30 ; Configure (and draw) menu
;; or for a separator:
;; .word $40, $13, $0
A2D_MENU_CLICK := $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)
;; (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
A2D_CREATE_WINDOW := $38
;;; --------------------------------------------------
;;; Window Manager Calls
OpenWindow := $38
;; (input not copied)
;; .byte id 0 = desktop, 1-...n = DeskTop windows, DAs use 51, 52, 100
;; .byte flags A2D_CWF_*
;; .byte id
;; .byte options option_*
;; .addr title
;; .byte hscroll A2D_CWS_*
;; .byte vscroll A2D_CWS_*
;; .byte hscroll scroll_option_*
;; .byte vscroll scroll_option_*
;; .byte hsmax
;; .byte hspos
;; .byte vsmax
@ -317,7 +348,7 @@ A2D_CREATE_WINDOW := $38
;; .word height_a ???
;; .word width_b (of scroll area?)
;; .word height_b (of scroll area?)
;; - next section is identical to that for A2D_SET_STATE
;; - next section is identical to that for SetPort
;; .word left pixels from screen edge
;; .word top
;; .word screen_addr
@ -338,69 +369,69 @@ A2D_CREATE_WINDOW := $38
;; .addr font
;; .addr next address of next lower window in stack (filled in by call)
A2D_DESTROY_WINDOW := $39
CloseWindow := $39
;; (input length 1 byte)
;; .byte id
A2D_QUERY_WINDOW := $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)
;; (output length 3 bytes)
;; .byte id of window
;; .addr window (out) window params
A2D_QUERY_STATE := $3C ; get drawing state of window
GetWinPort := $3C ; get drawing state of window
;; (input length 3 bytes)
;; .byte id window
;; .addr state state definition to populate, like A2D_SET_STATE
;; .addr state state definition to populate, like SetPort
A2D_UPDATE_STATE := $3D ; Update drawing state by passed window id
SetWinPort := $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
BeginUpdate := $3E ; Draws window border, background, title bar, scroll bars
;; (input length 1 byte)
;; .byte id
A2D_QUERY_TARGET := $40
FindWindow := $40
;; (input length 4 bytes)
;; .word queryx relative to screen
;; .word queryy
;; .byte element (out) A2D_ELEM_*
;; .byte element (out) area_*
;; .byte id (out) of window
A2D_QUERY_TOP := $41 ; Get id of top window
FrontWindow := $41 ; Get id of top window
;; (input length 0 bytes)
;; (output length 1 byte)
;; .byte id (out) window, or 0 if none
A2D_RAISE_WINDOW := $42 ; Make window topmost
SelectWindow := $42 ; Make window topmost
;; (input length 1 byte)
;; .byte id window
A2D_CLOSE_CLICK := $43
TrackGoAway := $43
;; (input length 0 bytes)
;; .byte clicked (out) 0 = cancelled, 1 = clicked
;; .byte ?? (out)
;; .byte ?? (out)
A2D_DRAG_WINDOW := $44
DragWindow := $44
;; (input length 5 bytes)
;; .byte id window
;; .word xcoord mouse coords
;; .word ycoord
;; .byte moved high bit set if moved, clear if not
A2D_DRAG_RESIZE := $45
GrowWindow := $45
;; (input length 5 bytes)
;; .byte id window
;; .word xcoord mouse coords
;; .word ycoord
;; .byte ?? likely: moved? 0 = no change, 1 = moved
A2D_MAP_COORDS := $46 ; Map screen coords to client coords
ScreenToWindow := $46 ; Map screen coords to client coords
;; (input length 5 bytes)
;; .byte window_id
;; .word screenx
@ -408,108 +439,116 @@ A2D_MAP_COORDS := $46 ; Map screen coords to client coords
;; .word clientx
;; .word clienty
A2D_QUERY_CLIENT:= $48
;;; --------------------------------------------------
;;; Control Manager Calls
FindControl := $48
;; (input length 4 bytes)
;; .word xcoord
;; .word ycoord
;; .byte part A2D_CLIENT, A2D_HSCROLL or A2D_VSCROLL
;; .byte scroll A2D_SCROLL_PART_*
;; .byte part ctl_*
;; .byte scroll part_*
A2D_RESIZE_WINDOW := $49 ; ???
SetCtlMax := $49 ; ???
;; (input length 3 bytes)
;; .byte ??? maybe part (i.e. HSCROLL or VSCROLL) ???
;; .byte ??? width fraction ??
;; .byte ???
A2D_DRAG_SCROLL := $4A
TrackThumb := $4A
;; (input length 5 bytes)
;; .byte type A2D_HSCROLL or A2D_VSCROLL
;; .byte type ctl_horizontal_scroll_bar or ctl_vertical_scroll_bar
;; .word mouse xcoord
;; .word mouse ycoord
;; .byte position 0...255
;; .byte moved 0 = no change, 1 = moved
A2D_UPDATE_SCROLL:= $4B
UpdateThumb := $4B
;; (input length 3 bytes)
;; .byte type A2D_HSCROLL or A2D_VSCROLL
;; .byte type ctl_horizontal_scroll_bar or ctl_vertical_scroll_bar
;; .byte pos new position 0...250
;; .byte ???
;;; $4E looks like last call
;;; $4E is last call
;;; ==================================================
;;; Constants
;;; Graphics Primitives Constants
;;; Used in A2D_QUERY_STATE / A2D_SET_BOX
A2D_SCREEN_ADDR := $2000 ; Screen address
A2D_SCREEN_STRIDE := $80 ; Stride in bytes
;;; Used in GetWinPort / SetPortSite
screen_mapbits := $2000 ; Screen address
screen_mapwidth := $80 ; Stride in bytes
;;; 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
;;; Used in SetPenMode
pencopy := 0
notpenXOR := 6
;;; Used in A2D_GET_MOUSE
A2D_ELEM_DESKTOP:= 0
A2D_ELEM_MENU := 1
A2D_ELEM_CLIENT := 2 ; Includes scroll bars
A2D_ELEM_TITLE := 3
A2D_ELEM_RESIZE := 4
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
;;; Used in A2D_SET_FILL_MODE
A2D_SFM_NORMAL := 0
A2D_SFM_XOR := 6
;;; Used in A2D_CREATE_WINDOW
A2D_CWF_NOTITLE := 1 << 0
A2D_CWF_ADDCLOSE := 1 << 1
A2D_CWF_ADDRESIZE := 1 << 2
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
;;; Used in A2D_CONFIGURE_ZP_USE
A2D_CZP_PRESERVE := 1<<7
A2D_CZP_OVERWRITE := 0
;;; Used in SetZP1
zp_overwrite := 0
zp_preserve := 1<<7
;;; Used in various state blocks
A2D_DEFAULT_MSKAND := $FF
A2D_DEFAULT_MSKOR := $00
A2D_DEFAULT_TMASK := $7F
colormask_and := $FF
colormask_or := $00
textbg_white := $7F
;;; ==================================================
;;; Mouse Graphics Tool Kit Constants
;;; Used in GetEvent
no_event := 0 ; No mouse or keypress
button_down := 1 ; Mouse button was depressed
button_up := 2 ; Mouse button was released
key_down := 3 ; Key was pressed
drag := 4 ; Mouse button still down
apple_key := 5 ; Mouse button was depressed, modifier key down
;;; Used in FindWindow
area_desktop := 0
area_menubar := 1
area_content := 2 ; Includes scroll bars
area_dragbar := 3
area_grow_box := 4
area_close_box := 5
;;; Used in FindControl, TrackThumb, UpdateThumb
ctl_not_a_control := 0
ctl_vertical_scroll_bar := 1
ctl_horizontal_scroll_bar := 2
;;; Used in FindControl
part_up_arrow := 1
part_left_arrow := 1
part_down_arrow := 2
part_right_arrow := 2
part_page_up := 3
part_page_left := 3
part_page_down := 4
part_page_right := 4
part_thumb := 5
;;; Used in OpenWindow
option_dialog_box := 1 << 0
option_go_away_box := 1 << 1
option_grow_box := 1 << 2
scroll_option_none := 0
scroll_option_present := 1 << 7
scroll_option_thumb := 1 << 6
scroll_option_active := 1 << 0
scroll_option_normal := scroll_option_present | scroll_option_thumb | scroll_option_active
.endscope ; MGTK
;;; ==================================================
;;; 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
;;; Call an MGTK entry point:
;;; MGTK_CALL n - params is $0000
;;; MGTK_CALL n, params_addr
;;; MGTK_CALL m, params_addr, label - params_addr is labeled for modifying
.macro A2D_CALL op, addr, label
jsr A2D
.macro MGTK_CALL op, addr, label
jsr MGTK::MLI
.byte op
.if .paramcount > 2
@ -525,10 +564,10 @@ A2D_DEFAULT_TMASK := $7F
;;; ------------------------------------
.macro A2D_DEFSTRING str, label ; String definition, for use with A2D_TEXT
.local data ; Call as A2D_DEFSTRING "abc"
.macro DEFINE_STRING str, label ; String definition, for use with TextWidth/DrawText
.local data ; Call as DEFINE_STRING "abc"
.local end ; Can include control chars by using:
.addr data ; A2D_DEFSTRING {"abc",$0D,"def"}
.addr data ; DEFINE_STRING {"abc",$0D,"def"}
.if .paramcount > 1
label:
@ -539,7 +578,7 @@ end:
.endmacro
;;; Define pattern for A2D_DRAW_BITMAP - low 7 bits are reversed
;;; Define pattern for PaintBits - low 7 bits are reversed
;;; e.g. .byte px(%1000000)
;;; 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))