da param ids

This commit is contained in:
Joshua Bell 2018-01-31 00:05:54 -08:00
parent 5123cfd702
commit 6135cf2b98
4 changed files with 240 additions and 251 deletions

View File

@ -232,10 +232,10 @@ which_area:.byte 0
window_id: .byte 0 window_id: .byte 0
.endproc .endproc
window_id := 100 da_window_id := 100
.proc screentowindow_params .proc screentowindow_params
id: .byte window_id window_id: .byte da_window_id
screen: screen:
screenx:.word 0 screenx:.word 0
screeny:.word 0 screeny:.word 0
@ -245,7 +245,7 @@ windowy:.word 0
.endproc .endproc
.proc closewindow_params .proc closewindow_params
id: .byte window_id window_id: .byte da_window_id
.endproc .endproc
.byte $00,$01 ; ??? .byte $00,$01 ; ???
@ -255,7 +255,7 @@ penmode: .byte $02 ; this should be normal, but we do inverts ??
.byte $06 ; ??? .byte $06 ; ???
.proc winfo .proc winfo
id: .byte window_id window_id: .byte da_window_id
options:.byte MGTK::option_dialog_box options:.byte MGTK::option_dialog_box
title: .addr 0 title: .addr 0
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
@ -267,23 +267,17 @@ vthumbpos: .byte 0
status: .byte 0 status: .byte 0
reserved: .byte 0 reserved: .byte 0
mincontwidth: .word 100 mincontwidth: .word 100
mincontlength: .word 100 maxcontwidth: .word 100
maxcontwidth: .word $1F4 mincontlength: .word $1F4
maxcontlength: .word $1F4 maxcontlength: .word $1F4
.proc port port:
left: .word 180 viewloc: DEFINE_POINT 180, 50
top: .word 50
mapbits: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 cliprect: DEFINE_RECT 0, 0, $C7, $40
voff: .word 0
width: .word $C7
height: .word $40
.endproc
pattern:.res 8,$00 pattern:.res 8,$00
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
xpos: .word 0 penloc: DEFINE_POINT 0, 0
ypos: .word 0
penwidth: .byte 4 penwidth: .byte 4
penheight: .byte 2 penheight: .byte 2
penmode: .byte 0 penmode: .byte 0
@ -407,7 +401,7 @@ update_selection:
MGTK_CALL MGTK::SetPenMode, penmode_params MGTK_CALL MGTK::SetPenMode, penmode_params
MGTK_CALL MGTK::SetPattern, white_pattern MGTK_CALL MGTK::SetPattern, white_pattern
lda findwindow_params::window_id lda findwindow_params::window_id
cmp #window_id cmp #da_window_id
bne miss bne miss
lda findwindow_params::which_area lda findwindow_params::which_area
bne hit bne hit

View File

@ -76,7 +76,7 @@ stash_stack: .byte 0
jmp create_window jmp create_window
.endproc .endproc
window_id := 51 da_window_id := 51
;;; ================================================== ;;; ==================================================
;;; Redraw the screen (all windows) after a drag ;;; Redraw the screen (all windows) after a drag
@ -94,7 +94,7 @@ loop: lda routine,x
jsr dest jsr dest
;; now check the window pos ;; now check the window pos
lda #window_id lda #da_window_id
jsr check_window_pos jsr check_window_pos
bit window_pos_flag bit window_pos_flag
@ -127,8 +127,8 @@ window_pos_flag:
;; called with window_id in A ;; called with window_id in A
check_window_pos: check_window_pos:
sta query_state_params_id sta getwinport_params_window_id
lda openwindow_params_top ; is top on screen? lda winfo_viewloc_ycoord ; is top on screen?
cmp #screen_height-1 cmp #screen_height-1
bcc :+ ; yes bcc :+ ; yes
lda #$80 ; no, so ... ??? lda #$80 ; no, so ... ???
@ -137,8 +137,8 @@ check_window_pos:
: MGTK_CALL MGTK::GetWinPort, getwinport_params : MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, setport_params MGTK_CALL MGTK::SetPort, setport_params
lda query_state_params_id lda getwinport_params_window_id
cmp #window_id cmp #da_window_id
bne :+ bne :+
jmp draw_window jmp draw_window
@ -148,19 +148,19 @@ check_window_pos:
;;; Param Blocks ;;; Param Blocks
;; following memory space is re-used so x/y overlap ;; following memory space is re-used so x/y overlap
.proc drag_window_params .proc dragwindow_params
id := * + 0 window_id := * + 0
xcoord := * + 1 ; x overlap dragx := * + 1 ; x overlap
ycoord := * + 3 ; y overlap dragy := * + 3 ; y overlap
moved := * + 5 ; ignored it_moved := * + 5 ; ignored
.endproc .endproc
.proc screentowindow_params .proc screentowindow_params
id := * + 0 window_id := * + 0
screenx := * + 1 ; x overlap screenx := * + 1 ; x overlap
screeny := * + 3 ; y overlap screeny := * + 3 ; y overlap
clientx := * + 5 windowx := * + 5
clienty := * + 7 windowy := * + 7
.endproc .endproc
.proc event_params .proc event_params
@ -173,10 +173,10 @@ ycoord := *+2 ; y overlap
.endproc .endproc
.proc findwindow_params .proc findwindow_params
queryx := * ; x overlap mousex := * ; x overlap
queryy := *+2 ; y overlap mousey := *+2 ; y overlap
element := *+4 which_area := *+4
id := *+5 window_id := *+5
.endproc .endproc
.res 8, 0 ; storage for above .res 8, 0 ; storage for above
@ -184,14 +184,14 @@ id := *+5
.byte 0,0 ; ??? .byte 0,0 ; ???
.proc trackgoaway_params .proc trackgoaway_params
clicked:.byte 0 goaway:.byte 0
.endproc .endproc
.proc getwinport_params .proc getwinport_params
id: .byte 0 window_id: .byte 0
addr: .addr setport_params a_grafport: .addr setport_params
.endproc .endproc
query_state_params_id := getwinport_params::id getwinport_params_window_id := getwinport_params::window_id
;; Puzzle piece row/columns ;; Puzzle piece row/columns
cw := 28 cw := 28
@ -234,16 +234,13 @@ space_positions: ; left, top for all 16 holes
position_table: position_table:
.res 16, 0 .res 16, 0
.proc draw_bitmap_params .proc paintbits_params
left: .word 0 left: .word 0
top: .word 0 top: .word 0
mapbits: .addr 0 mapbits: .addr 0
mapwidth: .byte 4 mapwidth: .byte 4
.byte 0 ; ??? .byte 0 ; reserved
hoff: .word 0 DEFINE_RECT 0, 0, 27, 15
voff: .word 0
width: .word 27
height: .word 15
.endproc .endproc
piece1: piece1:
@ -521,17 +518,31 @@ piece16:
.proc fill_rect_params .proc fill_rect_params
.word 1, 0, default_width, default_height DEFINE_RECT 1, 0, default_width, default_height
.endproc .endproc
.proc pattern_speckles .proc pattern_speckles
.byte $77,$DD,$77,$DD,$77,$DD,$77,$DD .byte %01110111
.byte %11011101
.byte %01110111
.byte %11011101
.byte %01110111
.byte %11011101
.byte %01110111
.byte %11011101
.endproc .endproc
.byte $00 ; ??? .byte $00 ; ???
.proc pattern_black .proc pattern_black
.res 8, 0 .byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.byte %00000000
.endproc .endproc
;; ??? ;; ???
@ -565,7 +576,7 @@ draw_end: .byte $00
draw_inc: .byte $00 draw_inc: .byte $00
.proc closewindow_params .proc closewindow_params
id: .byte window_id window_id: .byte da_window_id
.endproc .endproc
.byte $73,$00,$F7,$FF .byte $73,$00,$F7,$FF
@ -592,7 +603,7 @@ setport_params:
default_height := $44 default_height := $44
.proc winfo .proc winfo
id: .byte window_id window_id: .byte da_window_id
options: .byte MGTK::option_go_away_box options: .byte MGTK::option_go_away_box
title: .addr name title: .addr name
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
@ -607,20 +618,14 @@ mincontwidth: .word default_width
mincontlength: .word default_height mincontlength: .word default_height
maxcontwidth: .word default_width maxcontwidth: .word default_width
maxcontlength: .word default_height maxcontlength: .word default_height
port:
left: .word default_left DEFINE_POINT default_left, default_top, viewloc
top: .word default_top
mapbits: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 cliprect: DEFINE_RECT 0, 0, default_width, default_height
voff: .word 0
width: .word default_width
height: .word default_height
pattern:.res 8, $FF pattern:.res 8, $FF
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
xpos: .word 0 penloc: DEFINE_POINT 0, 0
ypos: .word 0
penwidth: .byte 1 penwidth: .byte 1
penheight: .byte 1 penheight: .byte 1
penmode: .byte 0 penmode: .byte 0
@ -628,32 +633,28 @@ textback: .byte $7F
textfont: .addr DEFAULT_FONT textfont: .addr DEFAULT_FONT
nextwinfo: .addr 0 nextwinfo: .addr 0
.endproc .endproc
winfo_viewloc_ycoord := winfo::viewloc::ycoord
;; This is QUERY_STATE/SET_BOX cruft only below ;; This is grafport cruft only below
.proc box_cruft ; Unknown usage .proc port_cruft ; Unknown usage
left: .word default_left viewloc: DEFINE_POINT default_left, default_top
top: .word default_top
mapbits: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 cliprect: DEFINE_RECT 0, 0, default_width, default_height
voff: .word 0
width: .word default_width
height: .word default_height
pattern:.res 8, $FF pattern:.res 8, $FF
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
xpos: .word 0 penloc: DEFINE_POINT 0, 0
ypos: .word 0
penwidth: .byte 1 penwidth: .byte 1
penheight: .byte 1 penheight: .byte 1
penmode: .byte 0 penmode: .byte 0
textback: .byte $7F textback: .byte $7F
textfont: .addr DEFAULT_FONT textfont: .addr DEFAULT_FONT
.byte 0,0 ; ???
.endproc .endproc
.byte 0,0 ; ???
name: PASCAL_STRING "Puzzle" name: PASCAL_STRING "Puzzle"
openwindow_params_top := winfo::top
;;; ================================================== ;;; ==================================================
;;; Create the window ;;; Create the window
@ -669,7 +670,7 @@ loop: tya
dey dey
bpl loop bpl loop
lda #window_id lda #da_window_id
jsr check_window_pos jsr check_window_pos
MGTK_CALL MGTK::FlushEvents MGTK_CALL MGTK::FlushEvents
@ -727,10 +728,10 @@ ploop: lda position_table+1,y
;; click - where? ;; click - where?
on_click: on_click:
MGTK_CALL MGTK::FindWindow, findwindow_params MGTK_CALL MGTK::FindWindow, findwindow_params
lda findwindow_params::id lda findwindow_params::window_id
cmp #window_id cmp #da_window_id
bne bail bne bail
lda findwindow_params::element lda findwindow_params::which_area
bne :+ bne :+
bail: rts bail: rts
@ -745,7 +746,7 @@ bail: rts
: cmp #MGTK::area_close_box : cmp #MGTK::area_close_box
bne check_title bne check_title
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
lda trackgoaway_params::clicked lda trackgoaway_params::goaway
beq bail beq bail
destroy: destroy:
MGTK_CALL MGTK::CloseWindow, closewindow_params MGTK_CALL MGTK::CloseWindow, closewindow_params
@ -770,9 +771,9 @@ loop: lda routine,x
check_title: check_title:
cmp #MGTK::area_dragbar cmp #MGTK::area_dragbar
bne bail bne bail
lda #window_id lda #da_window_id
sta drag_window_params::id sta dragwindow_params::window_id
MGTK_CALL MGTK::DragWindow, drag_window_params MGTK_CALL MGTK::DragWindow, dragwindow_params
ldx #$23 ldx #$23
jsr redraw_screen jsr redraw_screen
rts rts
@ -791,15 +792,15 @@ check_key:
;;; Map click to piece x/y ;;; Map click to piece x/y
.proc find_click_piece .proc find_click_piece
lda #window_id lda #da_window_id
sta screentowindow_params::id sta screentowindow_params::window_id
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
lda screentowindow_params::clientx+1 lda screentowindow_params::windowx+1
ora screentowindow_params::clienty+1 ora screentowindow_params::windowy+1
bne nope ; ensure high bytes are 0 bne nope ; ensure high bytes are 0
lda screentowindow_params::clienty lda screentowindow_params::windowy
ldx screentowindow_params::clientx ldx screentowindow_params::windowx
cmp #r1 cmp #r1
bcc nope bcc nope
@ -996,8 +997,8 @@ draw_window:
jsr draw_all jsr draw_all
lda #window_id lda #da_window_id
sta getwinport_params::id sta getwinport_params::window_id
MGTK_CALL MGTK::GetWinPort, getwinport_params MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, setport_params MGTK_CALL MGTK::SetPort, setport_params
rts rts
@ -1062,8 +1063,8 @@ saved_zp:
tya tya
pha pha
MGTK_CALL MGTK::HideCursor MGTK_CALL MGTK::HideCursor
lda #window_id lda #da_window_id
sta getwinport_params::id sta getwinport_params::window_id
MGTK_CALL MGTK::GetWinPort, getwinport_params MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, setport_params MGTK_CALL MGTK::SetPort, setport_params
pla pla
@ -1075,21 +1076,21 @@ loop: tya
asl a asl a
tax tax
lda space_positions,x lda space_positions,x
sta draw_bitmap_params::left sta paintbits_params::left
lda space_positions+1,x lda space_positions+1,x
sta draw_bitmap_params::left+1 sta paintbits_params::left+1
lda space_positions+2,x lda space_positions+2,x
sta draw_bitmap_params::top sta paintbits_params::top
lda space_positions+3,x lda space_positions+3,x
sta draw_bitmap_params::top+1 sta paintbits_params::top+1
lda position_table,y lda position_table,y
asl a asl a
tax tax
lda bitmap_table,x lda bitmap_table,x
sta draw_bitmap_params::mapbits sta paintbits_params::mapbits
lda bitmap_table+1,x lda bitmap_table+1,x
sta draw_bitmap_params::mapbits+1 sta paintbits_params::mapbits+1
MGTK_CALL MGTK::PaintBits, draw_bitmap_params MGTK_CALL MGTK::PaintBits, paintbits_params
pla pla
clc clc
adc draw_inc adc draw_inc

View File

@ -350,6 +350,7 @@ end: rts
MGTK_CALL MGTK::ShowCursor MGTK_CALL MGTK::ShowCursor
MGTK_CALL MGTK::FlushEvents MGTK_CALL MGTK::FlushEvents
MGTK_CALL MGTK::ObscureCursor
;; fall through ;; fall through
.endproc .endproc

View File

@ -212,7 +212,7 @@ black_pattern:
white_pattern: white_pattern:
.res $8, $FF .res $8, $FF
window_id := 100 da_window_id := 100
L095A: .byte $00 L095A: .byte $00
L095B: .byte $FA L095B: .byte $FA
@ -244,57 +244,59 @@ fixed_mode_flag:
.proc event_params .proc event_params
kind: .byte 0 kind: .byte 0
coords: ; spills into target query coords: ; spills into target query
xcoord: .word 0 mousex: .word 0
ycoord: .word 0 mousey: .word 0
.endproc .endproc
.proc findwindow_params .proc findwindow_params
elem: .byte 0 which_area: .byte 0
win: .byte 0 window_id: .byte 0
.endproc .endproc
.proc growwindow_params .proc growwindow_params
id: .byte window_id window_id: .byte da_window_id
xcoord: .word 0 mousex: .word 0
ycoord: .word 0 mousey: .word 0
.byte 0 ; ??? it_grew: .byte 0
.endproc .endproc
.proc trackgoaway_params ; queried after close clicked to see if aborted/finished .proc trackgoaway_params ; queried after close clicked to see if aborted/finished
goaway: .byte 0 ; 0 = aborted, 1 = clicked goaway: .byte 0 ; 0 = aborted, 1 = clicked
.byte 0,0 ; ???
.endproc .endproc
.byte 0,0 ; ???
.proc findcontrol_params ; queried after a client click to identify target .proc findcontrol_params ; queried after a client click to identify target
xcoord: .word 0 mousex: .word 0
ycoord: .word 0 mousey: .word 0
part: .byte 0 ; 0 = client, 1 = vscroll, 2 = hscroll which_ctl: .byte 0 ; 0 = client, 1 = vscroll, 2 = hscroll
scroll: .byte 0 ; 1 = up, 2 = down, 3 = above, 4 = below, 5 = thumb which_part: .byte 0 ; 1 = up, 2 = down, 3 = above, 4 = below, 5 = thumb
.endproc .endproc
;; param block used in dead code (resize?) ;; param block used in dead code (resize?)
.proc resize_window_params .proc setctlmax_params
part: .byte 0 which_ctl: .byte 0
L0987: .byte 0 ctlmax: .byte 0
;; needs one more byte? ;; needs one more byte?
.endproc .endproc
.proc updatethumb_params ; called to update scroll bar position .proc updatethumb_params ; called to update scroll bar position
type: .byte 0 ; 1 = vscroll, 2 = hscroll which_ctl: .byte 0 ; 1 = vscroll, 2 = hscroll
pos: .byte 0 ; new position thumbpos: .byte 0 ; new position
.endproc .endproc
;;; Used when dragging vscroll thumb ;;; Used when dragging vscroll thumb
.proc thumb_drag_params .proc trackthumb_params
type: .byte 0 ; 1 = vscroll, 2 = hscroll which_ctl: .byte 0 ; 1 = vscroll, 2 = hscroll
xcoord: .word 0 mousex: .word 0
ycoord: .word 0 mousey: .word 0
pos: .byte 0 ; position thumbpos: .byte 0 ; position
moved: .byte 0 ; 0 if not moved, 1 if moved thumbmoved: .byte 0 ; 0 if not moved, 1 if moved
.endproc .endproc
.proc text_string .proc drawtext_params
addr: .addr 0 ; address textptr: .addr 0 ; address
len: .byte 0 ; length textlen: .byte 0 ; length
.endproc .endproc
default_width := 512 default_width := 512
@ -303,7 +305,7 @@ len: .byte 0 ; length
default_top := 28 default_top := 28
.proc winfo .proc winfo
id: .byte window_id ; window identifier window_id: .byte da_window_id ; window identifier
options: .byte MGTK::option_go_away_box; window flags (2=include close port) options: .byte MGTK::option_go_away_box; window flags (2=include close port)
title: .addr $1000 ; overwritten to point at filename title: .addr $1000 ; overwritten to point at filename
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
@ -319,39 +321,30 @@ mincontlength: .word 51
maxcontwidth: .word default_width maxcontwidth: .word default_width
maxcontlength: .word default_height maxcontlength: .word default_height
.proc port port:
left: .word default_left DEFINE_POINT default_left, default_top, viewloc
top: .word default_top
mapbits: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 ; Also used for MGTK::PaintRect DEFINE_RECT 0, 0, default_width, default_height, maprect
voff: .word 0
width: .word default_width
height: .word default_height
.endproc
pattern:.res 8, $00 pattern:.res 8, $00
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
xpos: .word 0 penloc: DEFINE_POINT 0, 0
ypos: .word 0
penwidth: .byte 1 penwidth: .byte 1
penheight: .byte 1 penheight: .byte 1
penmode: .byte 0 penmode: .byte 0
textback: .byte $7F textback: .byte $7F
textfont: .addr DEFAULT_FONT textfont: .addr DEFAULT_FONT
nextwinfo: .addr 0 nextwinfo: .addr 0
.endproc .endproc
;; gets copied over winfo::port after mode is drawn ;; gets copied over winfo::port after mode is drawn
.proc default_box .proc default_port
left: .word default_left viewloc: DEFINE_POINT default_left, default_top
top: .word default_top
mapbits: .word MGTK::screen_mapbits mapbits: .word MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 maprect: DEFINE_RECT 0, 0, default_width, default_height
voff: .word 0
width: .word default_width
height: .word default_height
.endproc .endproc
.proc init .proc init
@ -516,25 +509,25 @@ input_loop:
bne input_loop ; nope, keep waiting bne input_loop ; nope, keep waiting
MGTK_CALL MGTK::FindWindow, event_params::coords MGTK_CALL MGTK::FindWindow, event_params::coords
lda findwindow_params::win ; in our window? lda findwindow_params::window_id ; in our window?
cmp #window_id cmp #da_window_id
bne input_loop bne input_loop
;; which part of the window? ;; which part of the window?
lda findwindow_params::elem lda findwindow_params::which_area
cmp #MGTK::area_close_box cmp #MGTK::area_close_box
beq on_close_click beq on_close_click
;; title and resize clicks need mouse location ;; title and resize clicks need mouse location
ldx event_params::xcoord ldx event_params::mousex
stx growwindow_params::xcoord stx growwindow_params::mousex
stx findcontrol_params::xcoord stx findcontrol_params::mousex
ldx event_params::xcoord+1 ldx event_params::mousex+1
stx growwindow_params::xcoord+1 stx growwindow_params::mousex+1
stx findcontrol_params::xcoord+1 stx findcontrol_params::mousex+1
ldx event_params::ycoord ldx event_params::mousey
stx growwindow_params::ycoord stx growwindow_params::mousey
stx findcontrol_params::ycoord stx findcontrol_params::mousey
cmp #MGTK::area_dragbar cmp #MGTK::area_dragbar
beq title beq title
@ -570,23 +563,23 @@ title: jsr on_title_bar_click
max_width := default_width max_width := default_width
lda #>max_width lda #>max_width
cmp winfo::port::width+1 cmp winfo::maprect::x2+1
bne :+ bne :+
lda #<max_width lda #<max_width
cmp winfo::port::width cmp winfo::maprect::x2
: bcs wider : bcs wider
lda #<max_width lda #<max_width
sta winfo::port::width sta winfo::maprect::x2
lda #>max_width lda #>max_width
sta winfo::port::width+1 sta winfo::maprect::x2+1
sec sec
lda winfo::port::width lda winfo::maprect::x2
sbc window_width sbc window_width
sta winfo::port::hoff sta winfo::maprect::x1
lda winfo::port::width+1 lda winfo::maprect::x2+1
sbc window_width+1 sbc window_width+1
sta winfo::port::hoff+1 sta winfo::maprect::x1+1
wider: lda winfo::hscroll wider: lda winfo::hscroll
ldx window_width ldx window_width
cpx #<max_width cpx #<max_width
@ -608,10 +601,10 @@ enable: ora #MGTK::scroll_option_active ; enable scroll
sbc window_width+1 sbc window_width+1
sta $07 sta $07
jsr div_by_16 jsr div_by_16
sta resize_window_params::L0987 sta setctlmax_params::ctlmax
lda #MGTK::ctl_horizontal_scroll_bar lda #MGTK::ctl_horizontal_scroll_bar
sta resize_window_params::part sta setctlmax_params::which_ctl
MGTK_CALL MGTK::SetCtlMax, resize_window_params ; change to clamped size ??? MGTK_CALL MGTK::SetCtlMax, setctlmax_params ; change to clamped size ???
jsr calc_and_draw_mode jsr calc_and_draw_mode
jmp finish_resize jmp finish_resize
.endproc .endproc
@ -623,7 +616,7 @@ enable: ora #MGTK::scroll_option_active ; enable scroll
.proc on_client_click .proc on_client_click
;; On one of the scroll bars? ;; On one of the scroll bars?
MGTK_CALL MGTK::FindControl, findcontrol_params MGTK_CALL MGTK::FindControl, findcontrol_params
lda findcontrol_params::part lda findcontrol_params::which_ctl
cmp #MGTK::ctl_vertical_scroll_bar cmp #MGTK::ctl_vertical_scroll_bar
beq on_vscroll_click beq on_vscroll_click
cmp #MGTK::ctl_horizontal_scroll_bar cmp #MGTK::ctl_horizontal_scroll_bar
@ -637,9 +630,9 @@ end: rts
.proc on_vscroll_click .proc on_vscroll_click
lda #MGTK::ctl_vertical_scroll_bar lda #MGTK::ctl_vertical_scroll_bar
sta thumb_drag_params::type sta trackthumb_params::which_ctl
sta updatethumb_params::type sta updatethumb_params::which_ctl
lda findcontrol_params::scroll lda findcontrol_params::which_part
cmp #MGTK::part_thumb cmp #MGTK::part_thumb
beq on_vscroll_thumb_click beq on_vscroll_thumb_click
cmp #MGTK::part_page_down cmp #MGTK::part_page_down
@ -655,11 +648,11 @@ end: rts
.endproc .endproc
.proc on_vscroll_thumb_click .proc on_vscroll_thumb_click
jsr do_thumb_drag jsr do_trackthumb
lda thumb_drag_params::moved lda trackthumb_params::thumbmoved
beq end beq end
lda thumb_drag_params::pos lda trackthumb_params::thumbpos
sta updatethumb_params::pos sta updatethumb_params::thumbpos
jsr update_voffset jsr update_voffset
jsr update_vscroll jsr update_vscroll
jsr draw_content jsr draw_content
@ -680,7 +673,7 @@ loop: lda winfo::vthumbpos
sbc track_scroll_delta sbc track_scroll_delta
bcs store bcs store
lda #0 ; underflow lda #0 ; underflow
store: sta updatethumb_params::pos store: sta updatethumb_params::thumbpos
jsr update_scroll_pos jsr update_scroll_pos
bcc loop ; repeat while button down bcc loop ; repeat while button down
end: rts end: rts
@ -691,7 +684,7 @@ loop : lda winfo::vthumbpos
beq end beq end
sec sec
sbc #1 sbc #1
sta updatethumb_params::pos sta updatethumb_params::thumbpos
jsr update_scroll_pos jsr update_scroll_pos
bcc loop ; repeat while button down bcc loop ; repeat while button down
end: rts end: rts
@ -712,7 +705,7 @@ loop: lda winfo::vthumbpos
bcc store ; nope, it's good bcc store ; nope, it's good
overflow: overflow:
lda #vscroll_max ; set to max lda #vscroll_max ; set to max
store: sta updatethumb_params::pos store: sta updatethumb_params::thumbpos
jsr update_scroll_pos jsr update_scroll_pos
bcc loop ; repeat while button down bcc loop ; repeat while button down
end: rts end: rts
@ -724,7 +717,7 @@ loop: lda winfo::vthumbpos
beq end beq end
clc clc
adc #1 adc #1
sta updatethumb_params::pos sta updatethumb_params::thumbpos
jsr update_scroll_pos jsr update_scroll_pos
bcc loop ; repeat while button down bcc loop ; repeat while button down
end: rts end: rts
@ -759,9 +752,9 @@ loop: inx
.proc on_hscroll_click .proc on_hscroll_click
lda #MGTK::ctl_horizontal_scroll_bar lda #MGTK::ctl_horizontal_scroll_bar
sta thumb_drag_params::type sta trackthumb_params::which_ctl
sta updatethumb_params::type sta updatethumb_params::which_ctl
lda findcontrol_params::scroll lda findcontrol_params::which_part
cmp #MGTK::part_thumb cmp #MGTK::part_thumb
beq on_hscroll_thumb_click beq on_hscroll_thumb_click
cmp #MGTK::part_page_right cmp #MGTK::part_page_right
@ -776,22 +769,22 @@ loop: inx
.endproc .endproc
.proc on_hscroll_thumb_click .proc on_hscroll_thumb_click
jsr do_thumb_drag jsr do_trackthumb
lda thumb_drag_params::moved lda trackthumb_params::thumbmoved
beq end beq end
lda thumb_drag_params::pos lda trackthumb_params::thumbpos
jsr mul_by_16 jsr mul_by_16
lda $06 lda $06
sta winfo::port::hoff sta winfo::maprect::x1
lda $07 lda $07
sta winfo::port::hoff+1 sta winfo::maprect::x1+1
clc clc
lda winfo::port::hoff lda winfo::maprect::x1
adc window_width adc window_width
sta winfo::port::width sta winfo::maprect::x2
lda winfo::port::hoff+1 lda winfo::maprect::x1+1
adc window_width+1 adc window_width+1
sta winfo::port::width+1 sta winfo::maprect::x2+1
jsr update_hscroll jsr update_hscroll
jsr draw_content jsr draw_content
end: rts end: rts
@ -853,14 +846,14 @@ store: sta winfo::hthumbpos
;;; UI Helpers ;;; UI Helpers
;; Used at start of thumb drag ;; Used at start of thumb drag
.proc do_thumb_drag .proc do_trackthumb
lda event_params::xcoord lda event_params::mousex
sta thumb_drag_params::xcoord sta trackthumb_params::mousex
lda event_params::xcoord+1 lda event_params::mousex+1
sta thumb_drag_params::xcoord+1 sta trackthumb_params::mousex+1
lda event_params::ycoord lda event_params::mousey
sta thumb_drag_params::ycoord sta trackthumb_params::mousey
MGTK_CALL MGTK::TrackThumb, thumb_drag_params MGTK_CALL MGTK::TrackThumb, trackthumb_params
rts rts
.endproc .endproc
@ -878,45 +871,45 @@ store: sta winfo::hthumbpos
jsr mul_by_16 jsr mul_by_16
clc clc
lda $06 lda $06
sta winfo::port::hoff sta winfo::maprect::x1
adc window_width adc window_width
sta winfo::port::width sta winfo::maprect::x2
lda $07 lda $07
sta winfo::port::hoff+1 sta winfo::maprect::x1+1
adc window_width+1 adc window_width+1
sta winfo::port::width+1 sta winfo::maprect::x2+1
rts rts
.endproc .endproc
.proc update_voffset .proc update_voffset
lda #0 lda #0
sta winfo::port::voff sta winfo::maprect::y1
sta winfo::port::voff+1 sta winfo::maprect::y1+1
ldx updatethumb_params::pos ldx updatethumb_params::thumbpos
loop: beq adjust_box_height loop: beq adjust_box_height
clc clc
lda winfo::port::voff lda winfo::maprect::y1
adc #50 adc #50
sta winfo::port::voff sta winfo::maprect::y1
bcc :+ bcc :+
inc winfo::port::voff+1 inc winfo::maprect::y1+1
: dex : dex
jmp loop jmp loop
.endproc .endproc
.proc adjust_box_height .proc adjust_box_height
clc clc
lda winfo::port::voff lda winfo::maprect::y1
adc window_height adc window_height
sta winfo::port::height sta winfo::maprect::y2
lda winfo::port::voff+1 lda winfo::maprect::y1+1
adc window_height+1 adc window_height+1
sta winfo::port::height+1 sta winfo::maprect::y2+1
jsr calc_line_position jsr calc_line_position
lda #0 lda #0
sta L096A sta L096A
sta L096B sta L096B
ldx updatethumb_params::pos ldx updatethumb_params::thumbpos
loop: beq end loop: beq end
clc clc
lda L096A lda L096A
@ -931,20 +924,20 @@ end: rts
.proc update_hscroll .proc update_hscroll
lda #2 lda #2
sta updatethumb_params::type sta updatethumb_params::which_ctl
lda winfo::port::hoff lda winfo::maprect::x1
sta $06 sta $06
lda winfo::port::hoff+1 lda winfo::maprect::x1+1
sta $07 sta $07
jsr div_by_16 jsr div_by_16
sta updatethumb_params::pos sta updatethumb_params::thumbpos
MGTK_CALL MGTK::UpdateThumb, updatethumb_params MGTK_CALL MGTK::UpdateThumb, updatethumb_params
rts rts
.endproc .endproc
.proc update_vscroll ; updatethumb_params::pos set by caller .proc update_vscroll ; updatethumb_params::thumbpos set by caller
lda #1 lda #1
sta updatethumb_params::type sta updatethumb_params::which_ctl
MGTK_CALL MGTK::UpdateThumb, updatethumb_params MGTK_CALL MGTK::UpdateThumb, updatethumb_params
rts rts
.endproc .endproc
@ -957,7 +950,7 @@ end: rts
bcc :+ bcc :+
jsr update_hscroll jsr update_hscroll
: lda winfo::vthumbpos : lda winfo::vthumbpos
sta updatethumb_params::pos sta updatethumb_params::thumbpos
jsr update_vscroll jsr update_vscroll
jsr draw_content jsr draw_content
jmp input_loop jmp input_loop
@ -965,7 +958,7 @@ end: rts
.proc clear_window .proc clear_window
MGTK_CALL MGTK::SetPattern, white_pattern MGTK_CALL MGTK::SetPattern, white_pattern
MGTK_CALL MGTK::PaintRect, winfo::port::hoff MGTK_CALL MGTK::PaintRect, winfo::maprect::x1
MGTK_CALL MGTK::SetPattern, black_pattern MGTK_CALL MGTK::SetPattern, black_pattern
rts rts
.endproc .endproc
@ -1016,7 +1009,7 @@ do_line:
jsr find_text_run jsr find_text_run
bcs L0ED7 bcs L0ED7
clc clc
lda text_string::len lda drawtext_params::textlen
adc $06 adc $06
sta $06 sta $06
bcc :+ bcc :+
@ -1069,11 +1062,11 @@ L0ED7: jsr restore_proportional_font_table_if_needed
sta run_width sta run_width
sta run_width+1 sta run_width+1
sta L095A sta L095A
sta text_string::len sta drawtext_params::textlen
lda $06 lda $06
sta text_string::addr sta drawtext_params::textptr
lda $07 lda $07
sta text_string::addr+1 sta drawtext_params::textptr+1
loop: lda L0945 loop: lda L0945
bne more bne more
@ -1084,7 +1077,7 @@ loop: lda L0945
rts rts
: jsr ensure_page_buffered : jsr ensure_page_buffered
more: ldy text_string::len more: ldy drawtext_params::textlen
lda ($06),y lda ($06),y
and #$7F ; clear high bit and #$7F ; clear high bit
sta ($06),y sta ($06),y
@ -1115,7 +1108,7 @@ more: ldy text_string::len
lda L095B lda L095B
cmp run_width cmp run_width
: bcc :+ : bcc :+
inc text_string::len inc drawtext_params::textlen
jmp loop jmp loop
: lda #0 : lda #0
@ -1123,21 +1116,21 @@ more: ldy text_string::len
lda L0F9B lda L0F9B
cmp #$FF cmp #$FF
beq :+ beq :+
sta text_string::len sta drawtext_params::textlen
lda L0946 lda L0946
sta L0945 sta L0945
: inc text_string::len : inc drawtext_params::textlen
;; fall through ;; fall through
.endproc .endproc
finish_text_run: jsr draw_text_run finish_text_run: jsr draw_text_run
ldy text_string::len ldy drawtext_params::textlen
lda ($06),y lda ($06),y
cmp #ASCII_TAB cmp #ASCII_TAB
beq tab beq tab
cmp #ASCII_RETURN cmp #ASCII_RETURN
bne :+ bne :+
tab: inc text_string::len tab: inc drawtext_params::textlen
: clc : clc
rts rts
@ -1192,9 +1185,9 @@ times70:.word 70
.proc draw_text_run .proc draw_text_run
lda L0948 lda L0948
beq end beq end
lda text_string::len lda drawtext_params::textlen
beq end beq end
MGTK_CALL MGTK::DrawText, text_string MGTK_CALL MGTK::DrawText, drawtext_params
lda #1 lda #1
sta L0949 sta L0949
end: rts end: rts
@ -1203,7 +1196,7 @@ end: rts
;;; ================================================== ;;; ==================================================
.proc ensure_page_buffered .proc ensure_page_buffered
lda text_string::addr+1 lda drawtext_params::textptr+1
cmp #>default_buffer cmp #>default_buffer
beq read beq read
@ -1214,10 +1207,10 @@ loop: lda $1300,y
iny iny
bne loop bne loop
dec text_string::addr+1 dec drawtext_params::textptr+1
lda text_string::addr lda drawtext_params::textptr
sta $06 sta $06
lda text_string::addr+1 lda drawtext_params::textptr+1
sta $07 sta $07
read: lda #0 read: lda #0
@ -1275,16 +1268,16 @@ end: rts
.proc calc_window_size .proc calc_window_size
sec sec
lda winfo::port::width lda winfo::maprect::x2
sbc winfo::port::hoff sbc winfo::maprect::x1
sta window_width sta window_width
lda winfo::port::width+1 lda winfo::maprect::x2+1
sbc winfo::port::hoff+1 sbc winfo::maprect::x1+1
sta window_width+1 sta window_width+1
sec sec
lda winfo::port::height lda winfo::maprect::y2
sbc winfo::port::voff sbc winfo::maprect::y1
sta window_height sta window_height
;; fall through ;; fall through
.endproc .endproc
@ -1292,9 +1285,9 @@ end: rts
;;; ================================================== ;;; ==================================================
.proc calc_line_position .proc calc_line_position
lda winfo::port::height lda winfo::maprect::y2
sta L0965 sta L0965
lda winfo::port::height+1 lda winfo::maprect::y2+1
sta L0966 sta L0966
lda #0 lda #0
@ -1401,10 +1394,10 @@ end: rts
;;; Title Bar (Proportional/Fixed mode button) ;;; Title Bar (Proportional/Fixed mode button)
.proc on_title_bar_click .proc on_title_bar_click
lda event_params::xcoord+1 ; mouse x high byte? lda event_params::mousex+1 ; mouse x high byte?
cmp mode_box_left+1 cmp mode_box_left+1
bne :+ bne :+
lda event_params::xcoord lda event_params::mousex
cmp mode_box_left cmp mode_box_left
: bcc ignore : bcc ignore
@ -1450,14 +1443,14 @@ base: .word 10 ; vertical text offset (to baseline)
.proc calc_and_draw_mode .proc calc_and_draw_mode
sec sec
lda winfo::port::top lda winfo::viewloc::ycoord
sbc #title_bar_height sbc #title_bar_height
sta mode_box::top sta mode_box::top
clc clc
lda winfo::port::left lda winfo::viewloc::xcoord
adc window_width adc window_width
pha pha
lda winfo::port::left+1 lda winfo::viewloc::xcoord+1
adc window_width+1 adc window_width+1
tax tax
sec sec
@ -1480,7 +1473,7 @@ base: .word 10 ; vertical text offset (to baseline)
else: MGTK_CALL MGTK::DrawText, prop_str else: MGTK_CALL MGTK::DrawText, prop_str
endif: ldx #$0F endif: ldx #$0F
loop: lda default_box,x loop: lda default_port,x
sta winfo::port,x sta winfo::port,x
dex dex
bpl loop bpl loop