mirror of
https://github.com/mi57730/a2d.git
synced 2025-01-21 02:34:03 +00:00
DAs: rename structs
This commit is contained in:
parent
fa0126feac
commit
6a2aa90656
@ -104,8 +104,8 @@ call_init:
|
||||
lda #window_id
|
||||
jsr check_visibility_and_draw_window
|
||||
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, state_params
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
rts
|
||||
|
||||
.proc routine
|
||||
@ -130,7 +130,7 @@ offscreen_flag:
|
||||
;; (called with window_id in A)
|
||||
.proc check_visibility_and_draw_window
|
||||
sta query_state_params_id
|
||||
lda create_window_params_top
|
||||
lda openwindow_params_top
|
||||
cmp #screen_height - 1
|
||||
bcc :+
|
||||
lda #$80
|
||||
@ -142,8 +142,8 @@ offscreen_flag:
|
||||
|
||||
;; Is skipping this responsible for display redraw bug?
|
||||
;; https://github.com/inexorabletash/a2d/issues/34
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, state_params
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
lda query_state_params_id
|
||||
cmp #window_id
|
||||
bne :+
|
||||
@ -156,7 +156,7 @@ offscreen_flag:
|
||||
|
||||
;; The following params blocks overlap for data re-use
|
||||
|
||||
.proc map_coords_params
|
||||
.proc screentowindow_params
|
||||
id := *
|
||||
screen := * + 1
|
||||
screenx := * + 1 ; aligns with input_state::xcoord
|
||||
@ -173,7 +173,7 @@ ycoord := * + 3 ; aligns with input_state::ycoord
|
||||
moved := * + 5 ; ignored
|
||||
.endproc
|
||||
|
||||
.proc input_state_params
|
||||
.proc event_params
|
||||
state: .byte 0
|
||||
xcoord := * ; if state is 0,1,2,4
|
||||
ycoord := * + 2 ; "
|
||||
@ -181,25 +181,25 @@ key := * ; if state is 3
|
||||
modifiers := * + 1 ; "
|
||||
.endproc
|
||||
|
||||
.proc target_params
|
||||
queryx: .word 0 ; aligns with input_state_params::xcoord
|
||||
queryy: .word 0 ; aligns with input_state_params::ycoord
|
||||
.proc findwindow_params
|
||||
queryx: .word 0 ; aligns with event_params::xcoord
|
||||
queryy: .word 0 ; aligns with event_params::ycoord
|
||||
elem: .byte 0
|
||||
id: .byte 0
|
||||
.endproc
|
||||
|
||||
.byte 0, 0 ; fills out space for map_coords_params
|
||||
.byte 0, 0 ; fills out space for screentowindow_params
|
||||
.byte 0, 0 ; ???
|
||||
|
||||
.proc close_click_params
|
||||
.proc trackgoaway_params
|
||||
state: .byte 0
|
||||
.endproc
|
||||
|
||||
.proc query_state_params
|
||||
.proc getwinport_params
|
||||
id: .byte 0
|
||||
.addr state_params
|
||||
.addr port_params
|
||||
.endproc
|
||||
query_state_params_id := query_state_params::id
|
||||
query_state_params_id := getwinport_params::id
|
||||
|
||||
.proc preserve_zp_params
|
||||
flag: .byte MGTK::zp_preserve
|
||||
@ -611,7 +611,7 @@ white_pattern:
|
||||
.res 8, $FF
|
||||
.byte $00
|
||||
|
||||
.proc text_mask_params
|
||||
.proc settextbg_params
|
||||
mask: .byte $7F
|
||||
.endproc
|
||||
|
||||
@ -635,13 +635,13 @@ height: .word display_height-1
|
||||
.endproc
|
||||
|
||||
;; For drawing 1-character strings (button labels)
|
||||
.proc draw_text_params_label
|
||||
.proc drawtext_params_label
|
||||
.addr label
|
||||
.byte 1
|
||||
.endproc
|
||||
label: .byte 0 ; modified with char to draw
|
||||
|
||||
.proc draw_text_params1
|
||||
.proc drawtext_params1
|
||||
addr: .addr text_buffer1
|
||||
length: .byte 15
|
||||
.endproc
|
||||
@ -651,7 +651,7 @@ text_buffer_size := 14
|
||||
text_buffer1:
|
||||
.res text_buffer_size+2, 0
|
||||
|
||||
.proc draw_text_params2
|
||||
.proc drawtext_params2
|
||||
addr: .addr text_buffer2
|
||||
length: .byte 15
|
||||
.endproc
|
||||
@ -665,7 +665,7 @@ error_string:
|
||||
DEFINE_STRING "Error "
|
||||
|
||||
;; used when clearing display; params to a $18 call
|
||||
.proc measure_text_params
|
||||
.proc textwidth_params
|
||||
addr: .addr text_buffer1
|
||||
len: .byte 15 ; ???
|
||||
width: .word 0
|
||||
@ -673,7 +673,7 @@ width: .word 0
|
||||
|
||||
window_id = 52
|
||||
|
||||
.proc destroy_window_params
|
||||
.proc closewindow_params
|
||||
id: .byte window_id
|
||||
.endproc
|
||||
|
||||
@ -713,7 +713,7 @@ pixels: .byte px(%1000001)
|
||||
.byte px(%1001001)
|
||||
.endproc
|
||||
|
||||
.proc state_params
|
||||
.proc port_params
|
||||
left: .word 0
|
||||
top: .word 0
|
||||
addr: .word 0
|
||||
@ -741,7 +741,7 @@ font: .addr 0
|
||||
screen_height := 192
|
||||
|
||||
;; params for MGTK::SetPortBits when decorating title bar
|
||||
.proc screen_box
|
||||
.proc screen_port
|
||||
.word 0
|
||||
.word menu_bar_height
|
||||
.word MGTK::screen_mapbits
|
||||
@ -751,13 +751,13 @@ font: .addr 0
|
||||
.word screen_height - menu_bar_height - 2
|
||||
.endproc
|
||||
|
||||
.proc fill_mode_normal
|
||||
.proc penmode_normal
|
||||
mode: .byte MGTK::pencopy
|
||||
.endproc
|
||||
|
||||
.byte $01,$02 ; ??
|
||||
|
||||
.proc fill_mode_xor
|
||||
.proc penmode_xor
|
||||
mode: .byte MGTK::notpenXOR
|
||||
.endproc
|
||||
|
||||
@ -766,7 +766,7 @@ mode: .byte MGTK::notpenXOR
|
||||
default_left := 210
|
||||
default_top := 60
|
||||
|
||||
.proc create_window_params
|
||||
.proc openwindow_params
|
||||
id: .byte window_id
|
||||
flags: .byte MGTK::option_go_away_box
|
||||
title: .addr window_title
|
||||
@ -801,7 +801,7 @@ tmask: .byte 0
|
||||
font: .addr DEFAULT_FONT
|
||||
next: .addr 0
|
||||
.endproc
|
||||
create_window_params_top := create_window_params::top
|
||||
openwindow_params_top := openwindow_params::top
|
||||
|
||||
window_title:
|
||||
PASCAL_STRING "Calc"
|
||||
@ -813,9 +813,9 @@ init: sta ALTZPON
|
||||
lda LCBANK1
|
||||
lda LCBANK1
|
||||
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 MGTK::OpenWindow, openwindow_params
|
||||
MGTK_CALL MGTK::InitPort, port_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
MGTK_CALL MGTK::FlushEvents
|
||||
|
||||
jsr reset_buffer2
|
||||
@ -880,8 +880,8 @@ loop: lda adjust_txtptr_copied-1,x
|
||||
;;; Input Loop
|
||||
|
||||
input_loop:
|
||||
MGTK_CALL MGTK::GetEvent, input_state_params
|
||||
lda input_state_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::state
|
||||
cmp #MGTK::button_down
|
||||
bne :+
|
||||
jsr on_click
|
||||
@ -896,18 +896,18 @@ input_loop:
|
||||
;;; On Click
|
||||
|
||||
on_click:
|
||||
MGTK_CALL MGTK::FindWindow, target_params
|
||||
lda target_params::elem
|
||||
MGTK_CALL MGTK::FindWindow, findwindow_params
|
||||
lda findwindow_params::elem
|
||||
cmp #MGTK::area_content ; Less than CLIENT is MENU or DESKTOP
|
||||
bcc ignore_click
|
||||
lda target_params::id
|
||||
lda findwindow_params::id
|
||||
cmp #window_id ; This window?
|
||||
beq :+
|
||||
|
||||
ignore_click:
|
||||
rts
|
||||
|
||||
: lda target_params::elem
|
||||
: lda findwindow_params::elem
|
||||
cmp #MGTK::area_content ; Client area?
|
||||
bne :+
|
||||
jsr map_click_to_button ; try to translate click into key
|
||||
@ -916,10 +916,10 @@ ignore_click:
|
||||
|
||||
: cmp #MGTK::area_close_box ; Close box?
|
||||
bne :+
|
||||
MGTK_CALL MGTK::TrackGoAway, close_click_params
|
||||
lda close_click_params::state
|
||||
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
|
||||
lda trackgoaway_params::state
|
||||
beq ignore_click
|
||||
exit: MGTK_CALL MGTK::CloseWindow, destroy_window_params
|
||||
exit: MGTK_CALL MGTK::CloseWindow, closewindow_params
|
||||
DESKTOP_CALL DESKTOP_REDRAW_ICONS
|
||||
lda ROMIN2
|
||||
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
|
||||
@ -955,9 +955,9 @@ loop: lda routine,x
|
||||
;;; On Key Press
|
||||
|
||||
.proc on_key_press
|
||||
lda input_state_params::modifiers
|
||||
lda event_params::modifiers
|
||||
bne bail
|
||||
lda input_state_params::key
|
||||
lda event_params::key
|
||||
cmp #KEY_ESCAPE
|
||||
bne trydel
|
||||
lda calc_p
|
||||
@ -984,13 +984,13 @@ rts1: rts ; used by next proc
|
||||
|
||||
.proc map_click_to_button
|
||||
lda #window_id
|
||||
sta map_coords_params::id
|
||||
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
|
||||
sta screentowindow_params::id
|
||||
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
|
||||
lda screentowindow_params::clientx+1 ; ensure high bits of coords are 0
|
||||
ora screentowindow_params::clienty+1
|
||||
bne rts1
|
||||
lda map_coords_params::clienty
|
||||
ldx map_coords_params::clientx
|
||||
lda screentowindow_params::clienty
|
||||
ldx screentowindow_params::clientx
|
||||
|
||||
.proc find_button_row
|
||||
cmp #row1_top+border_lt - 1 ; row 1 ? (- 1 is bug in original?)
|
||||
@ -1032,7 +1032,7 @@ rts1: rts ; used by next proc
|
||||
|
||||
: cmp #row5_top-border_lt ; special case for tall + button
|
||||
bcs :+
|
||||
lda map_coords_params::clientx
|
||||
lda screentowindow_params::clientx
|
||||
cmp #col4_left-border_lt
|
||||
bcc miss
|
||||
cmp #col4_right+border_br-1 ; is -1 bug in original?
|
||||
@ -1048,7 +1048,7 @@ rts1: rts ; used by next proc
|
||||
lda row5_lookup,x
|
||||
rts
|
||||
|
||||
: lda map_coords_params::clientx ; special case for wide 0 button
|
||||
: lda screentowindow_params::clientx ; special case for wide 0 button
|
||||
cmp #col1_left-border_lt
|
||||
bcc miss
|
||||
cmp #col2_right+border_br
|
||||
@ -1478,29 +1478,29 @@ end: jsr display_buffer1
|
||||
button_state := $FC
|
||||
|
||||
stx invert_addr
|
||||
stx c13_addr
|
||||
stx inrect_params
|
||||
stx restore_addr
|
||||
sty invert_addr+1
|
||||
sty c13_addr+1
|
||||
sty inrect_params+1
|
||||
sty restore_addr+1
|
||||
MGTK_CALL MGTK::SetPattern, black_pattern
|
||||
MGTK_CALL MGTK::SetPenMode, fill_mode_xor
|
||||
MGTK_CALL MGTK::SetPenMode, penmode_xor
|
||||
sec
|
||||
ror button_state
|
||||
|
||||
invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts box
|
||||
|
||||
check_button:
|
||||
MGTK_CALL MGTK::GetEvent, input_state_params
|
||||
lda input_state_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::state
|
||||
cmp #MGTK::drag ; Button down?
|
||||
bne done ; Nope, done immediately
|
||||
lda #window_id
|
||||
sta map_coords_params::id
|
||||
sta screentowindow_params::id
|
||||
|
||||
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
|
||||
MGTK_CALL MGTK::MoveTo, map_coords_params::client
|
||||
MGTK_CALL MGTK::InRect, 0, c13_addr
|
||||
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
|
||||
MGTK_CALL MGTK::MoveTo, screentowindow_params::client
|
||||
MGTK_CALL MGTK::InRect, 0, inrect_params
|
||||
bne inside
|
||||
|
||||
lda button_state ; outside, not down
|
||||
@ -1520,7 +1520,7 @@ inside: lda button_state ; inside, and down
|
||||
done: lda button_state ; high bit set if button down
|
||||
beq :+
|
||||
MGTK_CALL MGTK::PaintRect, 0, restore_addr ; Inverts back to normal
|
||||
: MGTK_CALL MGTK::SetPenMode, fill_mode_normal ; Normal draw mode??
|
||||
: MGTK_CALL MGTK::SetPenMode, penmode_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
|
||||
MGTK_CALL MGTK::DrawText, draw_text_params1
|
||||
MGTK_CALL MGTK::DrawText, drawtext_params1
|
||||
end: rts
|
||||
.endproc
|
||||
|
||||
@ -1571,17 +1571,17 @@ end: rts
|
||||
ldx #<text_buffer2
|
||||
ldy #>text_buffer2
|
||||
jsr pre_display_buffer
|
||||
MGTK_CALL MGTK::DrawText, draw_text_params2
|
||||
MGTK_CALL MGTK::DrawText, drawtext_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
|
||||
MGTK_CALL MGTK::TextWidth, measure_text_params
|
||||
stx textwidth_params::addr ; text buffer address in x,y
|
||||
sty textwidth_params::addr+1
|
||||
MGTK_CALL MGTK::TextWidth, textwidth_params
|
||||
lda #display_width-15 ; ???
|
||||
sec
|
||||
sbc measure_text_params::width
|
||||
sbc textwidth_params::width
|
||||
sta text_pos_params3::left
|
||||
MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces
|
||||
MGTK_CALL MGTK::DrawText, spaces_string
|
||||
@ -1601,7 +1601,7 @@ end: rts
|
||||
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
|
||||
MGTK_CALL MGTK::SetTextBG, settextbg_params
|
||||
;; fall through
|
||||
.endproc
|
||||
|
||||
@ -1635,7 +1635,7 @@ loop: ldy #0
|
||||
|
||||
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
|
||||
MGTK_CALL MGTK::DrawText, drawtext_params_label ; button label text
|
||||
|
||||
lda ptr ; advance to next record
|
||||
clc
|
||||
@ -1652,28 +1652,28 @@ loop: ldy #0
|
||||
draw_title_bar:
|
||||
offset_left := 115 ; pixels from left of client area
|
||||
offset_top := 22 ; pixels from top of client area (up!)
|
||||
ldx create_window_params::left+1
|
||||
lda create_window_params::left
|
||||
ldx openwindow_params::left+1
|
||||
lda openwindow_params::left
|
||||
clc
|
||||
adc #offset_left
|
||||
sta title_bar_decoration::left
|
||||
bcc :+
|
||||
inx
|
||||
: stx title_bar_decoration::left+1
|
||||
ldx create_window_params::top+1
|
||||
lda create_window_params::top
|
||||
ldx openwindow_params::top+1
|
||||
lda openwindow_params::top
|
||||
sec
|
||||
sbc #offset_top
|
||||
sta title_bar_decoration::top
|
||||
bcs :+
|
||||
dex
|
||||
: stx title_bar_decoration::top+1
|
||||
MGTK_CALL MGTK::SetPortBits, screen_box ; set clipping rect to whole screen
|
||||
MGTK_CALL MGTK::SetPortBits, screen_port ; 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
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, state_params
|
||||
sta getwinport_params::id
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
MGTK_CALL MGTK::ShowCursor
|
||||
jsr display_buffer2
|
||||
rts
|
||||
|
@ -111,8 +111,8 @@ call_init:
|
||||
skip: lda #0
|
||||
sta offscreen_flag
|
||||
lda ROMIN2
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, state_params
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
rts
|
||||
|
||||
.proc routine
|
||||
@ -137,8 +137,8 @@ offscreen_flag:
|
||||
;; Called after window drag is complete
|
||||
;; (called with window_id in A)
|
||||
.proc check_visibility_and_draw_window
|
||||
sta query_state_params_id
|
||||
lda create_window_params_top
|
||||
sta get_port_params_id
|
||||
lda openwindow_params_top
|
||||
cmp #screen_height - 1
|
||||
bcc :+
|
||||
lda #$80
|
||||
@ -147,9 +147,9 @@ offscreen_flag:
|
||||
|
||||
;; Is skipping this responsible for display redraw bug?
|
||||
;; https://github.com/inexorabletash/a2d/issues/34
|
||||
: MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, state_params
|
||||
lda query_state_params_id
|
||||
: MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
lda get_port_params_id
|
||||
cmp #window_id
|
||||
bne :+
|
||||
jmp draw_background
|
||||
@ -161,7 +161,7 @@ offscreen_flag:
|
||||
|
||||
;; The following params blocks overlap for data re-use
|
||||
|
||||
.proc map_coords_params
|
||||
.proc screentowindow_params
|
||||
id := *
|
||||
screen := * + 1
|
||||
screenx := * + 1 ; aligns with input_state::xcoord
|
||||
@ -178,33 +178,33 @@ ycoord := * + 3 ; aligns with input_state::ycoord
|
||||
moved := * + 5 ; ignored
|
||||
.endproc
|
||||
|
||||
.proc input_state_params
|
||||
state: .byte 0
|
||||
.proc event_params
|
||||
kind: .byte 0
|
||||
xcoord := * ; if state is 0,1,2,4
|
||||
ycoord := * + 2 ; "
|
||||
key := * ; if state is 3
|
||||
modifiers := * + 1 ; "
|
||||
.endproc
|
||||
|
||||
.proc target_params
|
||||
queryx: .word 0 ; aligns with input_state_params::xcoord
|
||||
queryy: .word 0 ; aligns with input_state_params::ycoord
|
||||
elem: .byte 0
|
||||
.proc findwindow_params
|
||||
queryx: .word 0 ; aligns with event_params::xcoord
|
||||
queryy: .word 0 ; aligns with event_params::ycoord
|
||||
which_area: .byte 0
|
||||
id: .byte 0
|
||||
.endproc
|
||||
|
||||
.byte 0, 0 ; fills out space for map_coords_params
|
||||
.byte 0, 0 ; fills out space for screentowindow_params
|
||||
.byte 0, 0 ; ???
|
||||
|
||||
.proc close_click_params
|
||||
state: .byte 0
|
||||
.proc trackgoaway_params
|
||||
goaway: .byte 0
|
||||
.endproc
|
||||
|
||||
.proc query_state_params
|
||||
.proc getwinport_params
|
||||
id: .byte 0
|
||||
.addr state_params
|
||||
.addr port_params
|
||||
.endproc
|
||||
query_state_params_id := query_state_params::id
|
||||
get_port_params_id := getwinport_params::id
|
||||
|
||||
.proc preserve_zp_params
|
||||
flag: .byte MGTK::zp_preserve
|
||||
@ -616,7 +616,7 @@ white_pattern:
|
||||
.res 8, $FF
|
||||
.byte $00
|
||||
|
||||
.proc text_mask_params
|
||||
.proc settextbg_params
|
||||
mask: .byte $7F
|
||||
.endproc
|
||||
|
||||
@ -640,13 +640,13 @@ height: .word display_height-1
|
||||
.endproc
|
||||
|
||||
;; For drawing 1-character strings (button labels)
|
||||
.proc draw_text_params_label
|
||||
.proc drawtext_params_label
|
||||
.addr label
|
||||
.byte 1
|
||||
.endproc
|
||||
label: .byte 0 ; modified with char to draw
|
||||
|
||||
.proc draw_text_params1
|
||||
.proc drawtext_params1
|
||||
addr: .addr text_buffer1
|
||||
length: .byte 15
|
||||
.endproc
|
||||
@ -656,7 +656,7 @@ text_buffer_size := 14
|
||||
text_buffer1:
|
||||
.res text_buffer_size+2, 0
|
||||
|
||||
.proc draw_text_params2
|
||||
.proc drawtext_params2
|
||||
addr: .addr text_buffer2
|
||||
length: .byte 15
|
||||
.endproc
|
||||
@ -670,7 +670,7 @@ error_string:
|
||||
DEFINE_STRING "Error "
|
||||
|
||||
;; used when clearing display; params to a $18 call
|
||||
.proc measure_text_params
|
||||
.proc textwidth_params
|
||||
addr: .addr text_buffer1
|
||||
len: .byte 15 ; ???
|
||||
width: .word 0
|
||||
@ -678,7 +678,7 @@ width: .word 0
|
||||
|
||||
window_id = 52
|
||||
|
||||
.proc destroy_window_params
|
||||
.proc closewindow_params
|
||||
id: .byte window_id
|
||||
.endproc
|
||||
|
||||
@ -718,8 +718,8 @@ pixels: .byte px(%1000001)
|
||||
.byte px(%1001001)
|
||||
.endproc
|
||||
|
||||
;; param block for a QUERY_SCREEN and SET_STATE calls, and ref'd in QUERY_STATE call
|
||||
.proc state_params
|
||||
;; param block for a QUERY_SCREEN and SET_STATE calls, and ref'd in GetWinPort call
|
||||
.proc port_params
|
||||
left: .word 0
|
||||
top: .word 0
|
||||
addr: .word 0
|
||||
@ -739,7 +739,7 @@ mode: .byte 0
|
||||
tmask: .byte 0
|
||||
font: .addr 0
|
||||
.endproc
|
||||
.assert * - state_params = 36, error
|
||||
.assert * - port_params = 36, error
|
||||
|
||||
.byte 0 ; ???
|
||||
|
||||
@ -748,7 +748,7 @@ font: .addr 0
|
||||
screen_height := 192
|
||||
|
||||
;; params for MGTK::SetPortBits when decorating title bar
|
||||
.proc screen_box
|
||||
.proc screen_port
|
||||
left: .word 0
|
||||
top: .word menu_bar_height
|
||||
addr: .word MGTK::screen_mapbits
|
||||
@ -759,13 +759,13 @@ width: .word screen_width - 1
|
||||
height: .word screen_height - menu_bar_height - 2
|
||||
.endproc
|
||||
|
||||
.proc fill_mode_normal
|
||||
.proc penmode_normal
|
||||
mode: .byte MGTK::pencopy
|
||||
.endproc
|
||||
|
||||
.byte $01,$02 ; ??
|
||||
|
||||
.proc fill_mode_xor
|
||||
.proc penmode_xor
|
||||
mode: .byte MGTK::notpenXOR
|
||||
.endproc
|
||||
|
||||
@ -774,7 +774,7 @@ mode: .byte MGTK::notpenXOR
|
||||
default_left := 210
|
||||
default_top := 60
|
||||
|
||||
.proc create_window_params
|
||||
.proc openwindow_params
|
||||
id: .byte window_id
|
||||
flags: .byte MGTK::option_go_away_box
|
||||
title: .addr window_title
|
||||
@ -809,7 +809,7 @@ tmask: .byte $7f
|
||||
font: .addr DEFAULT_FONT
|
||||
next: .addr 0
|
||||
.endproc
|
||||
create_window_params_top := create_window_params::top
|
||||
openwindow_params_top := openwindow_params::top
|
||||
|
||||
window_title:
|
||||
PASCAL_STRING "Calc"
|
||||
@ -849,14 +849,14 @@ init: sta ALTZPON
|
||||
lda LCBANK1
|
||||
lda LCBANK1
|
||||
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 MGTK::OpenWindow, openwindow_params
|
||||
MGTK_CALL MGTK::InitPort, port_params
|
||||
MGTK_CALL MGTK::SetPort, port_params ; set clipping bounds?
|
||||
MGTK_CALL MGTK::FlushEvents
|
||||
lda #$01
|
||||
sta input_state_params::state
|
||||
MGTK_CALL MGTK::PostEvent, input_state_params
|
||||
MGTK_CALL MGTK::GetEvent, input_state_params
|
||||
sta event_params::kind
|
||||
MGTK_CALL MGTK::PostEvent, event_params
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda ROMIN2
|
||||
jsr reset_buffer2
|
||||
lda #window_id
|
||||
@ -923,8 +923,8 @@ loop: lda adjust_txtptr_copied-1,x
|
||||
;;; Input Loop
|
||||
|
||||
input_loop:
|
||||
MGTK_CALL MGTK::GetEvent, input_state_params
|
||||
lda input_state_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::kind
|
||||
cmp #MGTK::button_down
|
||||
bne :+
|
||||
jsr on_click
|
||||
@ -941,19 +941,19 @@ input_loop:
|
||||
on_click:
|
||||
lda LCBANK1
|
||||
lda LCBANK1
|
||||
MGTK_CALL MGTK::FindWindow, target_params
|
||||
MGTK_CALL MGTK::FindWindow, findwindow_params
|
||||
lda ROMIN2
|
||||
lda target_params::elem
|
||||
cmp #MGTK::area_content ; Less than CLIENT is MENU or DESKTOP
|
||||
lda findwindow_params::which_area
|
||||
cmp #MGTK::area_content
|
||||
bcc ignore_click
|
||||
lda target_params::id
|
||||
lda findwindow_params::id
|
||||
cmp #window_id ; This window?
|
||||
beq :+
|
||||
|
||||
ignore_click:
|
||||
rts
|
||||
|
||||
: lda target_params::elem
|
||||
: lda findwindow_params::which_area
|
||||
cmp #MGTK::area_content ; Client area?
|
||||
bne :+
|
||||
jsr map_click_to_button ; try to translate click into key
|
||||
@ -962,12 +962,12 @@ ignore_click:
|
||||
|
||||
: cmp #MGTK::area_close_box ; Close box?
|
||||
bne :+
|
||||
MGTK_CALL MGTK::TrackGoAway, close_click_params
|
||||
lda close_click_params::state
|
||||
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
|
||||
lda trackgoaway_params::goaway
|
||||
beq ignore_click
|
||||
exit: lda LCBANK1
|
||||
lda LCBANK1
|
||||
MGTK_CALL MGTK::CloseWindow, destroy_window_params
|
||||
MGTK_CALL MGTK::CloseWindow, closewindow_params
|
||||
DESKTOP_CALL DESKTOP_REDRAW_ICONS
|
||||
lda ROMIN2
|
||||
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
|
||||
@ -1006,9 +1006,9 @@ loop: lda routine,x
|
||||
;;; On Key Press
|
||||
|
||||
.proc on_key_press
|
||||
lda input_state_params::modifiers
|
||||
lda event_params::modifiers
|
||||
bne bail
|
||||
lda input_state_params::key
|
||||
lda event_params::key
|
||||
cmp #KEY_ESCAPE
|
||||
bne trydel
|
||||
lda calc_p
|
||||
@ -1035,13 +1035,13 @@ rts1: rts ; used by next proc
|
||||
|
||||
.proc map_click_to_button
|
||||
lda #window_id
|
||||
sta map_coords_params::id
|
||||
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
|
||||
sta screentowindow_params::id
|
||||
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
|
||||
lda screentowindow_params::clientx+1 ; ensure high bits of coords are 0
|
||||
ora screentowindow_params::clienty+1
|
||||
bne rts1
|
||||
lda map_coords_params::clienty
|
||||
ldx map_coords_params::clientx
|
||||
lda screentowindow_params::clienty
|
||||
ldx screentowindow_params::clientx
|
||||
|
||||
.proc find_button_row
|
||||
cmp #row1_top+border_lt - 1 ; row 1 ? (- 1 is bug in original?)
|
||||
@ -1083,7 +1083,7 @@ rts1: rts ; used by next proc
|
||||
|
||||
: cmp #row5_top-border_lt ; special case for tall + button
|
||||
bcs :+
|
||||
lda map_coords_params::clientx
|
||||
lda screentowindow_params::clientx
|
||||
cmp #col4_left-border_lt
|
||||
bcc miss
|
||||
cmp #col4_right+border_br-1 ; is -1 bug in original?
|
||||
@ -1099,7 +1099,7 @@ rts1: rts ; used by next proc
|
||||
lda row5_lookup,x
|
||||
rts
|
||||
|
||||
: lda map_coords_params::clientx ; special case for wide 0 button
|
||||
: lda screentowindow_params::clientx ; special case for wide 0 button
|
||||
cmp #col1_left-border_lt
|
||||
bcc miss
|
||||
cmp #col2_right+border_br
|
||||
@ -1529,29 +1529,29 @@ end: jsr display_buffer1
|
||||
button_state := $FC
|
||||
|
||||
stx invert_addr
|
||||
stx c13_addr
|
||||
stx inrect_params
|
||||
stx restore_addr
|
||||
sty invert_addr+1
|
||||
sty c13_addr+1
|
||||
sty inrect_params+1
|
||||
sty restore_addr+1
|
||||
MGTK_CALL MGTK::SetPattern, black_pattern
|
||||
MGTK_CALL MGTK::SetPenMode, fill_mode_xor
|
||||
MGTK_CALL MGTK::SetPenMode, penmode_xor
|
||||
sec
|
||||
ror button_state
|
||||
|
||||
invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts box
|
||||
|
||||
check_button:
|
||||
MGTK_CALL MGTK::GetEvent, input_state_params
|
||||
lda input_state_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::kind
|
||||
cmp #MGTK::drag ; Button down?
|
||||
bne done ; Nope, done immediately
|
||||
lda #window_id
|
||||
sta map_coords_params::id
|
||||
sta screentowindow_params::id
|
||||
|
||||
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
|
||||
MGTK_CALL MGTK::MoveTo, map_coords_params::client
|
||||
MGTK_CALL MGTK::InRect, 0, c13_addr
|
||||
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
|
||||
MGTK_CALL MGTK::MoveTo, screentowindow_params::client
|
||||
MGTK_CALL MGTK::InRect, 0, inrect_params
|
||||
bne inside
|
||||
|
||||
lda button_state ; outside, not down
|
||||
@ -1571,7 +1571,7 @@ inside: lda button_state ; inside, and down
|
||||
done: lda button_state ; high bit set if button down
|
||||
beq :+
|
||||
MGTK_CALL MGTK::PaintRect, 0, restore_addr ; Inverts back to normal
|
||||
: MGTK_CALL MGTK::SetPenMode, fill_mode_normal ; Normal draw mode??
|
||||
: MGTK_CALL MGTK::SetPenMode, penmode_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
|
||||
MGTK_CALL MGTK::DrawText, draw_text_params1
|
||||
MGTK_CALL MGTK::DrawText, drawtext_params1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
@ -1618,17 +1618,17 @@ loop: lda #' '
|
||||
ldx #<text_buffer2
|
||||
ldy #>text_buffer2
|
||||
jsr pre_display_buffer
|
||||
MGTK_CALL MGTK::DrawText, draw_text_params2
|
||||
MGTK_CALL MGTK::DrawText, drawtext_params2
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc pre_display_buffer
|
||||
stx measure_text_params::addr ; text buffer address in x,y
|
||||
sty measure_text_params::addr+1
|
||||
MGTK_CALL MGTK::TextWidth, measure_text_params
|
||||
stx textwidth_params::addr ; text buffer address in x,y
|
||||
sty textwidth_params::addr+1
|
||||
MGTK_CALL MGTK::TextWidth, textwidth_params
|
||||
lda #display_width-15 ; ???
|
||||
sec
|
||||
sbc measure_text_params::width
|
||||
sbc textwidth_params::width
|
||||
sta text_pos_params3::left
|
||||
MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces
|
||||
MGTK_CALL MGTK::DrawText, spaces_string
|
||||
@ -1648,7 +1648,7 @@ loop: lda #' '
|
||||
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
|
||||
MGTK_CALL MGTK::SetTextBG, settextbg_params
|
||||
;; fall through
|
||||
.endproc
|
||||
|
||||
@ -1682,7 +1682,7 @@ loop: ldy #0
|
||||
|
||||
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
|
||||
MGTK_CALL MGTK::DrawText, drawtext_params_label ; button label text
|
||||
|
||||
lda ptr ; advance to next record
|
||||
clc
|
||||
@ -1699,28 +1699,28 @@ loop: ldy #0
|
||||
draw_title_bar:
|
||||
offset_left := 115 ; pixels from left of client area
|
||||
offset_top := 22 ; pixels from top of client area (up!)
|
||||
ldx create_window_params::left+1
|
||||
lda create_window_params::left
|
||||
ldx openwindow_params::left+1
|
||||
lda openwindow_params::left
|
||||
clc
|
||||
adc #offset_left
|
||||
sta title_bar_decoration::left
|
||||
bcc :+
|
||||
inx
|
||||
: stx title_bar_decoration::left+1
|
||||
ldx create_window_params::top+1
|
||||
lda create_window_params::top
|
||||
ldx openwindow_params::top+1
|
||||
lda openwindow_params::top
|
||||
sec
|
||||
sbc #offset_top
|
||||
sta title_bar_decoration::top
|
||||
bcs :+
|
||||
dex
|
||||
: stx title_bar_decoration::top+1
|
||||
MGTK_CALL MGTK::SetPortBits, screen_box ; set clipping rect to whole screen
|
||||
MGTK_CALL MGTK::SetPortBits, screen_port ; 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
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, state_params
|
||||
sta getwinport_params::id
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
MGTK_CALL MGTK::ShowCursor
|
||||
jsr display_buffer2
|
||||
rts
|
||||
|
@ -174,7 +174,7 @@ month_rect:
|
||||
year_rect:
|
||||
.word $7F,$14,$95,$1E
|
||||
|
||||
.proc text_mask_params
|
||||
.proc settextbg_params
|
||||
mask: .byte 0
|
||||
.endproc
|
||||
|
||||
@ -214,7 +214,7 @@ year_pos:
|
||||
year_string:
|
||||
DEFINE_STRING " "
|
||||
|
||||
.proc get_input_params
|
||||
.proc event_params
|
||||
state: .byte 0
|
||||
|
||||
key := *
|
||||
@ -225,7 +225,7 @@ ycoord := *+2
|
||||
.byte 0,0,0,0
|
||||
.endproc
|
||||
;; xcoord/ycoord are used to query...
|
||||
.proc query_target_params
|
||||
.proc findwindow_params
|
||||
xcoord := *
|
||||
ycoord := *+2
|
||||
element:.byte 0
|
||||
@ -234,7 +234,7 @@ id: .byte 0
|
||||
|
||||
window_id := 100
|
||||
|
||||
.proc map_coords_params
|
||||
.proc screentowindow_params
|
||||
id: .byte window_id
|
||||
screen:
|
||||
screenx:.word 0
|
||||
@ -244,17 +244,17 @@ clientx:.word 0
|
||||
clienty:.word 0
|
||||
.endproc
|
||||
|
||||
.proc destroy_window_params
|
||||
.proc closewindow_params
|
||||
id: .byte window_id
|
||||
.endproc
|
||||
.byte $00,$01 ; ???
|
||||
|
||||
.proc fill_mode_params
|
||||
.proc penmode_params
|
||||
mode: .byte $02 ; this should be normal, but we do inverts ???
|
||||
.endproc
|
||||
.byte $06 ; ???
|
||||
|
||||
.proc create_window_params
|
||||
.proc openwindow_params
|
||||
id: .byte window_id
|
||||
flags: .byte MGTK::option_dialog_box
|
||||
title: .addr 0
|
||||
@ -321,7 +321,7 @@ init_window:
|
||||
lsr a
|
||||
sta month
|
||||
|
||||
MGTK_CALL MGTK::OpenWindow, create_window_params
|
||||
MGTK_CALL MGTK::OpenWindow, openwindow_params
|
||||
lda #0
|
||||
sta selected_field
|
||||
jsr draw_window
|
||||
@ -332,8 +332,8 @@ init_window:
|
||||
;;; Input loop
|
||||
|
||||
.proc input_loop
|
||||
MGTK_CALL MGTK::GetEvent, get_input_params
|
||||
lda get_input_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::state
|
||||
cmp #MGTK::button_down
|
||||
bne :+
|
||||
jsr on_click
|
||||
@ -344,9 +344,9 @@ init_window:
|
||||
.endproc
|
||||
|
||||
.proc on_key
|
||||
lda get_input_params::modifiers
|
||||
lda event_params::modifiers
|
||||
bne input_loop
|
||||
lda get_input_params::key
|
||||
lda event_params::key
|
||||
cmp #KEY_RETURN
|
||||
bne :+
|
||||
jmp on_ok
|
||||
@ -403,13 +403,13 @@ update_selection:
|
||||
;;; ==================================================
|
||||
|
||||
.proc on_click
|
||||
MGTK_CALL MGTK::FindWindow, get_input_params::xcoord
|
||||
MGTK_CALL MGTK::SetPenMode, fill_mode_params
|
||||
MGTK_CALL MGTK::FindWindow, event_params::xcoord
|
||||
MGTK_CALL MGTK::SetPenMode, penmode_params
|
||||
MGTK_CALL MGTK::SetPattern, white_pattern
|
||||
lda query_target_params::id
|
||||
lda findwindow_params::id
|
||||
cmp #window_id
|
||||
bne miss
|
||||
lda query_target_params::element
|
||||
lda findwindow_params::element
|
||||
bne hit
|
||||
miss: rts
|
||||
|
||||
@ -491,8 +491,8 @@ on_field_click:
|
||||
|
||||
.proc on_up_or_down
|
||||
stx hit_rect_index
|
||||
loop: MGTK_CALL MGTK::GetEvent, get_input_params ; Repeat while mouse is down
|
||||
lda get_input_params::state
|
||||
loop: MGTK_CALL MGTK::GetEvent, event_params ; Repeat while mouse is down
|
||||
lda event_params::state
|
||||
cmp #MGTK::button_up
|
||||
beq :+
|
||||
jsr do_inc_or_dec
|
||||
@ -538,7 +538,7 @@ go: lda selected_field
|
||||
sta gosub+2
|
||||
|
||||
gosub: jsr $1000 ; self modified
|
||||
MGTK_CALL MGTK::SetTextBG, text_mask_params
|
||||
MGTK_CALL MGTK::SetTextBG, settextbg_params
|
||||
jmp draw_selected_field
|
||||
.endproc
|
||||
|
||||
@ -666,7 +666,7 @@ month_name_table:
|
||||
dialog_result: .byte 0
|
||||
|
||||
.proc destroy
|
||||
MGTK_CALL MGTK::CloseWindow, destroy_window_params
|
||||
MGTK_CALL MGTK::CloseWindow, closewindow_params
|
||||
DESKTOP_CALL DESKTOP_REDRAW_ICONS
|
||||
|
||||
;; Copy the relay routine to the zero page
|
||||
@ -709,16 +709,16 @@ skip: jmp dest
|
||||
;;; Index returned in X.
|
||||
|
||||
.proc find_hit_target
|
||||
lda get_input_params::xcoord
|
||||
sta map_coords_params::screenx
|
||||
lda get_input_params::xcoord+1
|
||||
sta map_coords_params::screenx+1
|
||||
lda get_input_params::ycoord
|
||||
sta map_coords_params::screeny
|
||||
lda get_input_params::ycoord+1
|
||||
sta map_coords_params::screeny+1
|
||||
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
|
||||
MGTK_CALL MGTK::MoveTo, map_coords_params::client
|
||||
lda event_params::xcoord
|
||||
sta screentowindow_params::screenx
|
||||
lda event_params::xcoord+1
|
||||
sta screentowindow_params::screenx+1
|
||||
lda event_params::ycoord
|
||||
sta screentowindow_params::screeny
|
||||
lda event_params::ycoord+1
|
||||
sta screentowindow_params::screeny+1
|
||||
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
|
||||
MGTK_CALL MGTK::MoveTo, screentowindow_params::client
|
||||
ldx #1
|
||||
lda #<first_hit_rect
|
||||
sta test_addr
|
||||
@ -778,7 +778,7 @@ label_uparrow_pos:
|
||||
label_downarrow_pos:
|
||||
.word $AC,$27
|
||||
|
||||
.proc thickness_params
|
||||
.proc setpensize_params
|
||||
hthick: .byte 1
|
||||
vthick: .byte 1
|
||||
.endproc
|
||||
@ -787,9 +787,9 @@ vthick: .byte 1
|
||||
;;; Render the window contents
|
||||
|
||||
draw_window:
|
||||
MGTK_CALL MGTK::SetPort, create_window_params::box
|
||||
MGTK_CALL MGTK::SetPort, openwindow_params::box
|
||||
MGTK_CALL MGTK::FrameRect, border_rect
|
||||
MGTK_CALL MGTK::SetPenSize, thickness_params
|
||||
MGTK_CALL MGTK::SetPenSize, setpensize_params
|
||||
MGTK_CALL MGTK::FrameRect, date_rect
|
||||
MGTK_CALL MGTK::FrameRect, ok_button_rect
|
||||
MGTK_CALL MGTK::FrameRect, cancel_button_rect
|
||||
@ -815,7 +815,7 @@ draw_window:
|
||||
jsr draw_day
|
||||
jsr draw_month
|
||||
jsr draw_year
|
||||
MGTK_CALL MGTK::SetPenMode, fill_mode_params
|
||||
MGTK_CALL MGTK::SetPenMode, penmode_params
|
||||
MGTK_CALL MGTK::SetPattern, white_pattern
|
||||
lda #1
|
||||
jmp highlight_selected_field
|
||||
|
@ -128,15 +128,15 @@ window_pos_flag:
|
||||
;; called with window_id in A
|
||||
check_window_pos:
|
||||
sta query_state_params_id
|
||||
lda create_window_params_top ; is top on screen?
|
||||
lda openwindow_params_top ; is top on screen?
|
||||
cmp #screen_height-1
|
||||
bcc :+ ; yes
|
||||
lda #$80 ; no, so ... ???
|
||||
sta window_pos_flag
|
||||
rts
|
||||
|
||||
: MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, set_state_params
|
||||
: MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, setport_params
|
||||
lda query_state_params_id
|
||||
cmp #window_id
|
||||
bne :+
|
||||
@ -155,7 +155,7 @@ ycoord := * + 3 ; y overlap
|
||||
moved := * + 5 ; ignored
|
||||
.endproc
|
||||
|
||||
.proc map_coords_params
|
||||
.proc screentowindow_params
|
||||
id := * + 0
|
||||
screenx := * + 1 ; x overlap
|
||||
screeny := * + 3 ; y overlap
|
||||
@ -163,7 +163,7 @@ clientx := * + 5
|
||||
clienty := * + 7
|
||||
.endproc
|
||||
|
||||
.proc get_input_params
|
||||
.proc event_params
|
||||
state: .byte 0
|
||||
key := *
|
||||
modifiers := *+1
|
||||
@ -172,7 +172,7 @@ xcoord := * ; x overlap
|
||||
ycoord := *+2 ; y overlap
|
||||
.endproc
|
||||
|
||||
.proc query_target_params
|
||||
.proc findwindow_params
|
||||
queryx := * ; x overlap
|
||||
queryy := *+2 ; y overlap
|
||||
element := *+4
|
||||
@ -183,15 +183,15 @@ id := *+5
|
||||
|
||||
.byte 0,0 ; ???
|
||||
|
||||
.proc close_click_params
|
||||
.proc trackgoaway_params
|
||||
clicked:.byte 0
|
||||
.endproc
|
||||
|
||||
.proc query_state_params
|
||||
.proc getwinport_params
|
||||
id: .byte 0
|
||||
addr: .addr set_state_params
|
||||
addr: .addr setport_params
|
||||
.endproc
|
||||
query_state_params_id := query_state_params::id
|
||||
query_state_params_id := getwinport_params::id
|
||||
|
||||
;; Puzzle piece row/columns
|
||||
cw := 28
|
||||
@ -544,7 +544,7 @@ piece16:
|
||||
xcoord: .word 5
|
||||
ycoord: .word 2
|
||||
.endproc
|
||||
.proc draw_line_params
|
||||
.proc line_params
|
||||
xdelta: .word 112
|
||||
ydelta: .word 0
|
||||
.endproc
|
||||
@ -564,7 +564,7 @@ draw_rc: .byte $00
|
||||
draw_end: .byte $00
|
||||
draw_inc: .byte $00
|
||||
|
||||
.proc destroy_window_params
|
||||
.proc closewindow_params
|
||||
id: .byte window_id
|
||||
.endproc
|
||||
|
||||
@ -576,7 +576,7 @@ id: .byte window_id
|
||||
str: .byte $41,$35,$47,$37,$36,$49 ; "A#G%#I" ?
|
||||
|
||||
;; SET_STATE params (filled in by QUERY_STATE)
|
||||
set_state_params:
|
||||
setport_params:
|
||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||
@ -591,7 +591,7 @@ set_state_params:
|
||||
default_width := $79
|
||||
default_height := $44
|
||||
|
||||
.proc create_window_params
|
||||
.proc openwindow_params
|
||||
id: .byte window_id
|
||||
flags: .byte MGTK::option_go_away_box
|
||||
title: .addr name
|
||||
@ -654,14 +654,14 @@ font: .addr DEFAULT_FONT
|
||||
|
||||
name: PASCAL_STRING "Puzzle"
|
||||
|
||||
create_window_params_top := create_window_params::top
|
||||
openwindow_params_top := openwindow_params::top
|
||||
|
||||
;;; ==================================================
|
||||
;;; Create the window
|
||||
|
||||
.proc create_window
|
||||
jsr save_zp
|
||||
MGTK_CALL MGTK::OpenWindow, create_window_params
|
||||
MGTK_CALL MGTK::OpenWindow, openwindow_params
|
||||
|
||||
;; init pieces
|
||||
ldy #15
|
||||
@ -698,8 +698,8 @@ ploop: lda position_table+1,y
|
||||
stx position_table+1
|
||||
.endproc
|
||||
|
||||
MGTK_CALL MGTK::GetEvent, get_input_params
|
||||
lda get_input_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::state
|
||||
beq scramble
|
||||
jsr check_victory
|
||||
bcs scramble
|
||||
@ -712,8 +712,8 @@ ploop: lda position_table+1,y
|
||||
;;; Input loop and processing
|
||||
|
||||
.proc input_loop
|
||||
MGTK_CALL MGTK::GetEvent, get_input_params
|
||||
lda get_input_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::state
|
||||
cmp #MGTK::button_down
|
||||
bne :+
|
||||
jsr on_click
|
||||
@ -727,11 +727,11 @@ ploop: lda position_table+1,y
|
||||
|
||||
;; click - where?
|
||||
on_click:
|
||||
MGTK_CALL MGTK::FindWindow, query_target_params
|
||||
lda query_target_params::id
|
||||
MGTK_CALL MGTK::FindWindow, findwindow_params
|
||||
lda findwindow_params::id
|
||||
cmp #window_id
|
||||
bne bail
|
||||
lda query_target_params::element
|
||||
lda findwindow_params::element
|
||||
bne :+
|
||||
bail: rts
|
||||
|
||||
@ -745,11 +745,11 @@ bail: rts
|
||||
;; close box?
|
||||
: cmp #MGTK::area_close_box
|
||||
bne check_title
|
||||
MGTK_CALL MGTK::TrackGoAway, close_click_params
|
||||
lda close_click_params::clicked
|
||||
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
|
||||
lda trackgoaway_params::clicked
|
||||
beq bail
|
||||
destroy:
|
||||
MGTK_CALL MGTK::CloseWindow, destroy_window_params
|
||||
MGTK_CALL MGTK::CloseWindow, closewindow_params
|
||||
DESKTOP_CALL DESKTOP_REDRAW_ICONS
|
||||
|
||||
target = $20 ; copy following to ZP and run it
|
||||
@ -780,9 +780,9 @@ check_title:
|
||||
|
||||
;; on key press - exit if Escape
|
||||
check_key:
|
||||
lda get_input_params::modifiers
|
||||
lda event_params::modifiers
|
||||
bne :+
|
||||
lda get_input_params::key
|
||||
lda event_params::key
|
||||
cmp #KEY_ESCAPE
|
||||
beq destroy
|
||||
: rts
|
||||
@ -793,14 +793,14 @@ check_key:
|
||||
|
||||
.proc find_click_piece
|
||||
lda #window_id
|
||||
sta map_coords_params::id
|
||||
MGTK_CALL MGTK::ScreenToWindow, map_coords_params
|
||||
lda map_coords_params::clientx+1
|
||||
ora map_coords_params::clienty+1
|
||||
sta screentowindow_params::id
|
||||
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
|
||||
lda screentowindow_params::clientx+1
|
||||
ora screentowindow_params::clienty+1
|
||||
bne nope ; ensure high bytes are 0
|
||||
|
||||
lda map_coords_params::clienty
|
||||
ldx map_coords_params::clientx
|
||||
lda screentowindow_params::clienty
|
||||
ldx screentowindow_params::clientx
|
||||
|
||||
cmp #r1
|
||||
bcc nope
|
||||
@ -993,14 +993,14 @@ draw_window:
|
||||
MGTK_CALL MGTK::SetPattern, pattern_black
|
||||
|
||||
MGTK_CALL MGTK::MoveTo, set_pos_params
|
||||
MGTK_CALL MGTK::Line, draw_line_params
|
||||
MGTK_CALL MGTK::Line, line_params
|
||||
|
||||
jsr draw_all
|
||||
|
||||
lda #window_id
|
||||
sta query_state_params::id
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, set_state_params
|
||||
sta getwinport_params::id
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, setport_params
|
||||
rts
|
||||
|
||||
;;; ==================================================
|
||||
@ -1064,9 +1064,9 @@ saved_zp:
|
||||
pha
|
||||
MGTK_CALL MGTK::HideCursor
|
||||
lda #window_id
|
||||
sta query_state_params::id
|
||||
MGTK_CALL MGTK::GetWinPort, query_state_params
|
||||
MGTK_CALL MGTK::SetPort, set_state_params
|
||||
sta getwinport_params::id
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, setport_params
|
||||
pla
|
||||
tay
|
||||
|
||||
|
@ -170,7 +170,7 @@ base: .word 0
|
||||
.endproc
|
||||
|
||||
|
||||
.proc input_params ; queried to track mouse-up
|
||||
.proc event_params ; queried to track mouse-up
|
||||
state: .byte $00
|
||||
|
||||
;;; if state is MGTK::key_down
|
||||
@ -357,8 +357,8 @@ end: rts
|
||||
;;; Main Input Loop
|
||||
|
||||
.proc input_loop
|
||||
MGTK_CALL MGTK::GetEvent, input_params
|
||||
lda input_params::state
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params::state
|
||||
cmp #MGTK::button_down ; was clicked?
|
||||
beq exit
|
||||
cmp #MGTK::key_down ; any key?
|
||||
@ -366,9 +366,9 @@ end: rts
|
||||
bne input_loop
|
||||
|
||||
on_key:
|
||||
lda input_params::modifiers
|
||||
lda event_params::modifiers
|
||||
bne input_loop
|
||||
lda input_params::key
|
||||
lda event_params::key
|
||||
cmp #KEY_ESCAPE
|
||||
beq exit
|
||||
bne input_loop
|
||||
|
@ -241,30 +241,30 @@ track_scroll_delta:
|
||||
fixed_mode_flag:
|
||||
.byte $00 ; 0 = proportional, otherwise = fixed
|
||||
|
||||
.proc input_params
|
||||
.proc event_params
|
||||
state: .byte 0
|
||||
coords: ; spills into target query
|
||||
xcoord: .word 0
|
||||
ycoord: .word 0
|
||||
.endproc
|
||||
.proc target_params
|
||||
.proc findwindow_params
|
||||
elem: .byte 0
|
||||
win: .byte 0
|
||||
.endproc
|
||||
|
||||
.proc resize_drag_params
|
||||
.proc growwindow_params
|
||||
id: .byte window_id
|
||||
xcoord: .word 0
|
||||
ycoord: .word 0
|
||||
.byte 0 ; ???
|
||||
.endproc
|
||||
|
||||
.proc close_btn_params ; queried after close clicked to see if aborted/finished
|
||||
.proc trackgoaway_params ; queried after close clicked to see if aborted/finished
|
||||
state: .byte 0 ; 0 = aborted, 1 = clicked
|
||||
.byte 0,0 ; ???
|
||||
.endproc
|
||||
|
||||
.proc query_client_params ; queried after a client click to identify target
|
||||
.proc findcontrol_params ; queried after a client click to identify target
|
||||
xcoord: .word 0
|
||||
ycoord: .word 0
|
||||
part: .byte 0 ; 0 = client, 1 = vscroll, 2 = hscroll
|
||||
@ -278,7 +278,7 @@ L0987: .byte 0
|
||||
;; needs one more byte?
|
||||
.endproc
|
||||
|
||||
.proc update_scroll_params ; called to update scroll bar position
|
||||
.proc updatethumb_params ; called to update scroll bar position
|
||||
type: .byte 0 ; 1 = vscroll, 2 = hscroll
|
||||
pos: .byte 0 ; new position
|
||||
.endproc
|
||||
@ -510,31 +510,31 @@ loop: lda font_width_table - 1,x
|
||||
;;; Main Input Loop
|
||||
|
||||
input_loop:
|
||||
MGTK_CALL MGTK::GetEvent, input_params
|
||||
lda input_params
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params
|
||||
cmp #1 ; was clicked?
|
||||
bne input_loop ; nope, keep waiting
|
||||
|
||||
MGTK_CALL MGTK::FindWindow, input_params::coords
|
||||
lda target_params::win ; in our window?
|
||||
MGTK_CALL MGTK::FindWindow, event_params::coords
|
||||
lda findwindow_params::win ; in our window?
|
||||
cmp #window_id
|
||||
bne input_loop
|
||||
|
||||
;; which part of the window?
|
||||
lda target_params::elem
|
||||
lda findwindow_params::elem
|
||||
cmp #MGTK::area_close_box
|
||||
beq on_close_click
|
||||
|
||||
;; title and resize clicks need mouse location
|
||||
ldx input_params::xcoord
|
||||
stx resize_drag_params::xcoord
|
||||
stx query_client_params::xcoord
|
||||
ldx input_params::xcoord+1
|
||||
stx resize_drag_params::xcoord+1
|
||||
stx query_client_params::xcoord+1
|
||||
ldx input_params::ycoord
|
||||
stx resize_drag_params::ycoord
|
||||
stx query_client_params::ycoord
|
||||
ldx event_params::xcoord
|
||||
stx growwindow_params::xcoord
|
||||
stx findcontrol_params::xcoord
|
||||
ldx event_params::xcoord+1
|
||||
stx growwindow_params::xcoord+1
|
||||
stx findcontrol_params::xcoord+1
|
||||
ldx event_params::ycoord
|
||||
stx growwindow_params::ycoord
|
||||
stx findcontrol_params::ycoord
|
||||
|
||||
cmp #MGTK::area_dragbar
|
||||
beq title
|
||||
@ -550,8 +550,8 @@ title: jsr on_title_bar_click
|
||||
;;; Close Button
|
||||
|
||||
.proc on_close_click
|
||||
MGTK_CALL MGTK::TrackGoAway, close_btn_params ; wait to see if the click completes
|
||||
lda close_btn_params::state ; did click complete?
|
||||
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
|
||||
lda trackgoaway_params::state ; did click complete?
|
||||
beq input_loop ; nope
|
||||
jsr close_file
|
||||
MGTK_CALL MGTK::CloseWindow, window_params
|
||||
@ -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
|
||||
MGTK_CALL MGTK::GrowWindow, resize_drag_params
|
||||
MGTK_CALL MGTK::GrowWindow, growwindow_params
|
||||
jsr redraw_screen
|
||||
jsr calc_window_size
|
||||
|
||||
@ -622,8 +622,8 @@ enable: ora #MGTK::scroll_option_active ; enable scroll
|
||||
;;; Non-title (client) area clicked
|
||||
.proc on_client_click
|
||||
;; On one of the scroll bars?
|
||||
MGTK_CALL MGTK::FindControl, query_client_params
|
||||
lda query_client_params::part
|
||||
MGTK_CALL MGTK::FindControl, findcontrol_params
|
||||
lda findcontrol_params::part
|
||||
cmp #MGTK::ctl_vertical_scroll_bar
|
||||
beq on_vscroll_click
|
||||
cmp #MGTK::ctl_horizontal_scroll_bar
|
||||
@ -638,8 +638,8 @@ end: rts
|
||||
.proc on_vscroll_click
|
||||
lda #MGTK::ctl_vertical_scroll_bar
|
||||
sta thumb_drag_params::type
|
||||
sta update_scroll_params::type
|
||||
lda query_client_params::scroll
|
||||
sta updatethumb_params::type
|
||||
lda findcontrol_params::scroll
|
||||
cmp #MGTK::part_thumb
|
||||
beq on_vscroll_thumb_click
|
||||
cmp #MGTK::part_page_down
|
||||
@ -659,7 +659,7 @@ end: rts
|
||||
lda thumb_drag_params::moved
|
||||
beq end
|
||||
lda thumb_drag_params::pos
|
||||
sta update_scroll_params::pos
|
||||
sta updatethumb_params::pos
|
||||
jsr update_voffset
|
||||
jsr update_vscroll
|
||||
jsr draw_content
|
||||
@ -680,7 +680,7 @@ loop: lda window_params::vspos
|
||||
sbc track_scroll_delta
|
||||
bcs store
|
||||
lda #0 ; underflow
|
||||
store: sta update_scroll_params::pos
|
||||
store: sta updatethumb_params::pos
|
||||
jsr update_scroll_pos
|
||||
bcc loop ; repeat while button down
|
||||
end: rts
|
||||
@ -691,7 +691,7 @@ loop : lda window_params::vspos
|
||||
beq end
|
||||
sec
|
||||
sbc #1
|
||||
sta update_scroll_params::pos
|
||||
sta updatethumb_params::pos
|
||||
jsr update_scroll_pos
|
||||
bcc loop ; repeat while button down
|
||||
end: rts
|
||||
@ -712,7 +712,7 @@ loop: lda window_params::vspos
|
||||
bcc store ; nope, it's good
|
||||
overflow:
|
||||
lda #vscroll_max ; set to max
|
||||
store: sta update_scroll_params::pos
|
||||
store: sta updatethumb_params::pos
|
||||
jsr update_scroll_pos
|
||||
bcc loop ; repeat while button down
|
||||
end: rts
|
||||
@ -724,7 +724,7 @@ loop: lda window_params::vspos
|
||||
beq end
|
||||
clc
|
||||
adc #1
|
||||
sta update_scroll_params::pos
|
||||
sta updatethumb_params::pos
|
||||
jsr update_scroll_pos
|
||||
bcc loop ; repeat while button down
|
||||
end: rts
|
||||
@ -760,8 +760,8 @@ loop: inx
|
||||
.proc on_hscroll_click
|
||||
lda #MGTK::ctl_horizontal_scroll_bar
|
||||
sta thumb_drag_params::type
|
||||
sta update_scroll_params::type
|
||||
lda query_client_params::scroll
|
||||
sta updatethumb_params::type
|
||||
lda findcontrol_params::scroll
|
||||
cmp #MGTK::part_thumb
|
||||
beq on_hscroll_thumb_click
|
||||
cmp #MGTK::part_page_right
|
||||
@ -854,11 +854,11 @@ store: sta window_params::hspos
|
||||
|
||||
;; Used at start of thumb drag
|
||||
.proc do_thumb_drag
|
||||
lda input_params::xcoord
|
||||
lda event_params::xcoord
|
||||
sta thumb_drag_params::xcoord
|
||||
lda input_params::xcoord+1
|
||||
lda event_params::xcoord+1
|
||||
sta thumb_drag_params::xcoord+1
|
||||
lda input_params::ycoord
|
||||
lda event_params::ycoord
|
||||
sta thumb_drag_params::ycoord
|
||||
MGTK_CALL MGTK::TrackThumb, thumb_drag_params
|
||||
rts
|
||||
@ -866,8 +866,8 @@ store: sta window_params::hspos
|
||||
|
||||
;;; Checks button state; z clear if button was released, set otherwise
|
||||
.proc was_button_released
|
||||
MGTK_CALL MGTK::GetEvent, input_params
|
||||
lda input_params
|
||||
MGTK_CALL MGTK::GetEvent, event_params
|
||||
lda event_params
|
||||
cmp #2
|
||||
rts
|
||||
.endproc
|
||||
@ -892,7 +892,7 @@ store: sta window_params::hspos
|
||||
lda #0
|
||||
sta window_params::box::voff
|
||||
sta window_params::box::voff+1
|
||||
ldx update_scroll_params::pos
|
||||
ldx updatethumb_params::pos
|
||||
loop: beq adjust_box_height
|
||||
clc
|
||||
lda window_params::box::voff
|
||||
@ -916,7 +916,7 @@ loop: beq adjust_box_height
|
||||
lda #0
|
||||
sta L096A
|
||||
sta L096B
|
||||
ldx update_scroll_params::pos
|
||||
ldx updatethumb_params::pos
|
||||
loop: beq end
|
||||
clc
|
||||
lda L096A
|
||||
@ -931,21 +931,21 @@ end: rts
|
||||
|
||||
.proc update_hscroll
|
||||
lda #2
|
||||
sta update_scroll_params::type
|
||||
sta updatethumb_params::type
|
||||
lda window_params::box::hoff
|
||||
sta $06
|
||||
lda window_params::box::hoff+1
|
||||
sta $07
|
||||
jsr div_by_16
|
||||
sta update_scroll_params::pos
|
||||
MGTK_CALL MGTK::UpdateThumb, update_scroll_params
|
||||
sta updatethumb_params::pos
|
||||
MGTK_CALL MGTK::UpdateThumb, updatethumb_params
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc update_vscroll ; update_scroll_params::pos set by caller
|
||||
.proc update_vscroll ; updatethumb_params::pos set by caller
|
||||
lda #1
|
||||
sta update_scroll_params::type
|
||||
MGTK_CALL MGTK::UpdateThumb, update_scroll_params
|
||||
sta updatethumb_params::type
|
||||
MGTK_CALL MGTK::UpdateThumb, updatethumb_params
|
||||
rts
|
||||
.endproc
|
||||
|
||||
@ -957,7 +957,7 @@ end: rts
|
||||
bcc :+
|
||||
jsr update_hscroll
|
||||
: lda window_params::vspos
|
||||
sta update_scroll_params::pos
|
||||
sta updatethumb_params::pos
|
||||
jsr update_vscroll
|
||||
jsr draw_content
|
||||
jmp input_loop
|
||||
@ -1401,10 +1401,10 @@ end: rts
|
||||
;;; Title Bar (Proportional/Fixed mode button)
|
||||
|
||||
.proc on_title_bar_click
|
||||
lda input_params::xcoord+1 ; mouse x high byte?
|
||||
lda event_params::xcoord+1 ; mouse x high byte?
|
||||
cmp mode_box_left+1
|
||||
bne :+
|
||||
lda input_params::xcoord
|
||||
lda event_params::xcoord
|
||||
cmp mode_box_left
|
||||
: bcc ignore
|
||||
|
||||
|
@ -3640,7 +3640,7 @@ loop: lda version,y
|
||||
major: .byte 1 ; 1.0.0
|
||||
minor: .byte 0
|
||||
patch: .byte 0
|
||||
status: .byte 70 ; ???
|
||||
status: .byte 'F' ; Final???
|
||||
release:.byte 1 ; ???
|
||||
.byte 0 ; ???
|
||||
.endproc
|
||||
|
Loading…
x
Reference in New Issue
Block a user