DA: renames

This commit is contained in:
Joshua Bell 2018-01-29 20:49:42 -08:00
parent 6a2aa90656
commit 76311ce501
6 changed files with 426 additions and 423 deletions

View File

@ -65,7 +65,7 @@ save_stack: .byte 0
;;; ================================================== ;;; ==================================================
.proc exit_da .proc exit_da
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
ldx save_stack ldx save_stack
@ -101,7 +101,7 @@ call_init:
DESKTOP_CALL DESKTOP_REDRAW_ICONS DESKTOP_CALL DESKTOP_REDRAW_ICONS
;; Redraw window after drag ;; Redraw window after drag
lda #window_id lda #da_window_id
jsr check_visibility_and_draw_window jsr check_visibility_and_draw_window
MGTK_CALL MGTK::GetWinPort, getwinport_params MGTK_CALL MGTK::GetWinPort, getwinport_params
@ -129,7 +129,7 @@ offscreen_flag:
;; Called after window drag is complete ;; Called after window drag is complete
;; (called with window_id in A) ;; (called with window_id in A)
.proc check_visibility_and_draw_window .proc check_visibility_and_draw_window
sta query_state_params_id sta getwinport_params_window_id
lda openwindow_params_top lda openwindow_params_top
cmp #screen_height - 1 cmp #screen_height - 1
bcc :+ bcc :+
@ -144,8 +144,8 @@ offscreen_flag:
;; https://github.com/inexorabletash/a2d/issues/34 ;; https://github.com/inexorabletash/a2d/issues/34
MGTK_CALL MGTK::GetWinPort, getwinport_params MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, port_params MGTK_CALL MGTK::SetPort, port_params
lda query_state_params_id lda getwinport_params_window_id
cmp #window_id cmp #da_window_id
bne :+ bne :+
jmp draw_background jmp draw_background
: rts : rts
@ -157,24 +157,24 @@ offscreen_flag:
;; The following params blocks overlap for data re-use ;; The following params blocks overlap for data re-use
.proc screentowindow_params .proc screentowindow_params
id := * window_id := *
screen := * + 1 screen := * + 1
screenx := * + 1 ; aligns with input_state::xcoord screenx := * + 1 ; aligns with input_state::xcoord
screeny := * + 3 ; aligns with input_state::ycoord screeny := * + 3 ; aligns with input_state::ycoord
client := * + 5 window := * + 5
clientx := * + 5 windowx := * + 5
clienty := * + 7 windowy := * + 7
.endproc .endproc
.proc drag_params .proc dragwindow_params
id := * window_id := *
xcoord := * + 1 ; aligns with input_state::xcoord xcoord := * + 1 ; aligns with input_state::xcoord
ycoord := * + 3 ; aligns with input_state::ycoord ycoord := * + 3 ; aligns with input_state::ycoord
moved := * + 5 ; ignored moved := * + 5 ; ignored
.endproc .endproc
.proc event_params .proc event_params
state: .byte 0 kind: .byte 0
xcoord := * ; if state is 0,1,2,4 xcoord := * ; if state is 0,1,2,4
ycoord := * + 2 ; " ycoord := * + 2 ; "
key := * ; if state is 3 key := * ; if state is 3
@ -182,24 +182,24 @@ modifiers := * + 1 ; "
.endproc .endproc
.proc findwindow_params .proc findwindow_params
queryx: .word 0 ; aligns with event_params::xcoord mousex: .word 0 ; aligns with event_params::xcoord
queryy: .word 0 ; aligns with event_params::ycoord mousey: .word 0 ; aligns with event_params::ycoord
elem: .byte 0 area: .byte 0
id: .byte 0 window_id: .byte 0
.endproc .endproc
.byte 0, 0 ; fills out space for screentowindow_params .byte 0, 0 ; fills out space for screentowindow_params
.byte 0, 0 ; ??? .byte 0, 0 ; ???
.proc trackgoaway_params .proc trackgoaway_params
state: .byte 0 goaway: .byte 0
.endproc .endproc
.proc getwinport_params .proc getwinport_params
id: .byte 0 window_id: .byte 0
.addr port_params .addr port_params
.endproc .endproc
query_state_params_id := getwinport_params::id getwinport_params_window_id := getwinport_params::window_id
.proc preserve_zp_params .proc preserve_zp_params
flag: .byte MGTK::zp_preserve flag: .byte MGTK::zp_preserve
@ -242,7 +242,7 @@ flag: .byte MGTK::zp_overwrite
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -250,14 +250,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte 'c' label: .byte 'c'
pos: .word col1_left + 6, row1_bot pos: .word col1_left + 6, row1_bot
box: .word col1_left,row1_top,col1_right,row1_bot port: .word col1_left,row1_top,col1_right,row1_bot
.endproc .endproc
.proc btn_e .proc btn_e
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -265,14 +265,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte 'e' label: .byte 'e'
pos: .word col2_left + 6, row1_bot pos: .word col2_left + 6, row1_bot
box: .word col2_left,row1_top,col2_right,row1_bot port: .word col2_left,row1_top,col2_right,row1_bot
.endproc .endproc
.proc btn_eq .proc btn_eq
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -280,14 +280,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '=' label: .byte '='
pos: .word col3_left + 6, row1_bot pos: .word col3_left + 6, row1_bot
box: .word col3_left,row1_top,col3_right,row1_bot port: .word col3_left,row1_top,col3_right,row1_bot
.endproc .endproc
.proc btn_mul .proc btn_mul
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -295,14 +295,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '*' label: .byte '*'
pos: .word col4_left + 6, row1_bot pos: .word col4_left + 6, row1_bot
box: .word col4_left,row1_top,col4_right,row1_bot port: .word col4_left,row1_top,col4_right,row1_bot
.endproc .endproc
.proc btn_7 .proc btn_7
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -310,14 +310,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '7' label: .byte '7'
pos: .word col1_left + 6, row2_bot pos: .word col1_left + 6, row2_bot
box: .word col1_left,row2_top,col1_right,row2_bot port: .word col1_left,row2_top,col1_right,row2_bot
.endproc .endproc
.proc btn_8 .proc btn_8
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -325,14 +325,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '8' label: .byte '8'
pos: .word col2_left + 6, row2_bot pos: .word col2_left + 6, row2_bot
box: .word col2_left,row2_top,col2_right,row2_bot port: .word col2_left,row2_top,col2_right,row2_bot
.endproc .endproc
.proc btn_9 .proc btn_9
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -340,14 +340,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '9' label: .byte '9'
pos: .word col3_left + 6, row2_bot pos: .word col3_left + 6, row2_bot
box: .word col3_left,row2_top,col3_right,row2_bot port: .word col3_left,row2_top,col3_right,row2_bot
.endproc .endproc
.proc btn_div .proc btn_div
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -355,14 +355,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '/' label: .byte '/'
pos: .word col4_left + 6, row2_bot pos: .word col4_left + 6, row2_bot
box: .word col4_left,row2_top,col4_right,row2_bot port: .word col4_left,row2_top,col4_right,row2_bot
.endproc .endproc
.proc btn_4 .proc btn_4
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -370,14 +370,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '4' label: .byte '4'
pos: .word col1_left + 6, row3_bot pos: .word col1_left + 6, row3_bot
box: .word col1_left,row3_top,col1_right,row3_bot port: .word col1_left,row3_top,col1_right,row3_bot
.endproc .endproc
.proc btn_5 .proc btn_5
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -385,14 +385,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '5' label: .byte '5'
pos: .word col2_left + 6, row3_bot pos: .word col2_left + 6, row3_bot
box: .word col2_left,row3_top,col2_right,row3_bot port: .word col2_left,row3_top,col2_right,row3_bot
.endproc .endproc
.proc btn_6 .proc btn_6
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -400,14 +400,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '6' label: .byte '6'
pos: .word col3_left + 6, row3_bot pos: .word col3_left + 6, row3_bot
box: .word col3_left,row3_top,col3_right,row3_bot port: .word col3_left,row3_top,col3_right,row3_bot
.endproc .endproc
.proc btn_sub .proc btn_sub
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -415,14 +415,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '-' label: .byte '-'
pos: .word col4_left + 6, row3_bot pos: .word col4_left + 6, row3_bot
box: .word col4_left,row3_top,col4_right,row3_bot port: .word col4_left,row3_top,col4_right,row3_bot
.endproc .endproc
.proc btn_1 .proc btn_1
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -430,14 +430,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '1' label: .byte '1'
pos: .word col1_left + 6, row4_bot pos: .word col1_left + 6, row4_bot
box: .word col1_left,row4_top,col1_right,row4_bot port: .word col1_left,row4_top,col1_right,row4_bot
.endproc .endproc
.proc btn_2 .proc btn_2
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -445,14 +445,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '2' label: .byte '2'
pos: .word col2_left + 6, row4_bot pos: .word col2_left + 6, row4_bot
box: .word col2_left,row4_top,col2_right,row4_bot port: .word col2_left,row4_top,col2_right,row4_bot
.endproc .endproc
.proc btn_3 .proc btn_3
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -460,14 +460,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '3' label: .byte '3'
pos: .word col3_left + 6, row4_bot pos: .word col3_left + 6, row4_bot
box: .word col3_left,row4_top,col3_right,row4_bot port: .word col3_left,row4_top,col3_right,row4_bot
.endproc .endproc
.proc btn_0 .proc btn_0
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row5_top - border_lt top: .word row5_top - border_lt
bitmap: .addr wide_button_bitmap bitmap: .addr wide_button_bitmap
stride: .byte 8 ; bitmap_stride (bytes) mapwidth: .byte 8 ; bitmap_stride (bytes)
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -475,14 +475,14 @@ width: .word 49 ; 0 is extra wide
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '0' label: .byte '0'
pos: .word col1_left + 6, row5_bot pos: .word col1_left + 6, row5_bot
box: .word col1_left,row5_top,col2_right,row5_bot port: .word col1_left,row5_top,col2_right,row5_bot
.endproc .endproc
.proc btn_dec .proc btn_dec
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row5_top - border_lt top: .word row5_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -490,14 +490,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '.' label: .byte '.'
pos: .word col3_left + 6 + 2, row5_bot ; + 2 to center the label pos: .word col3_left + 6 + 2, row5_bot ; + 2 to center the label
box: .word col3_left,row5_top,col3_right,row5_bot port: .word col3_left,row5_top,col3_right,row5_bot
.endproc .endproc
.proc btn_add .proc btn_add
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr tall_button_bitmap bitmap: .addr tall_button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -505,7 +505,7 @@ width: .word button_width + border_lt + border_br
height: .word 27 ; + is extra tall height: .word 27 ; + is extra tall
label: .byte '+' label: .byte '+'
pos: .word col4_left + 6, row5_bot pos: .word col4_left + 6, row5_bot
box: .word col4_left,row4_top,col4_right,row5_bot port: .word col4_left,row4_top,col4_right,row5_bot
.endproc .endproc
.byte 0 ; sentinel .byte 0 ; sentinel
@ -642,8 +642,8 @@ height: .word display_height-1
label: .byte 0 ; modified with char to draw label: .byte 0 ; modified with char to draw
.proc drawtext_params1 .proc drawtext_params1
addr: .addr text_buffer1 textptr: .addr text_buffer1
length: .byte 15 textlen: .byte 15
.endproc .endproc
text_buffer_size := 14 text_buffer_size := 14
@ -652,8 +652,8 @@ text_buffer1:
.res text_buffer_size+2, 0 .res text_buffer_size+2, 0
.proc drawtext_params2 .proc drawtext_params2
addr: .addr text_buffer2 textptr: .addr text_buffer2
length: .byte 15 textlen: .byte 15
.endproc .endproc
text_buffer2: text_buffer2:
@ -666,15 +666,15 @@ error_string:
;; used when clearing display; params to a $18 call ;; used when clearing display; params to a $18 call
.proc textwidth_params .proc textwidth_params
addr: .addr text_buffer1 textptr: .addr text_buffer1
len: .byte 15 ; ??? textlen: .byte 15 ; ???
width: .word 0 result: .word 0
.endproc .endproc
window_id = 52 da_window_id = 52
.proc closewindow_params .proc closewindow_params
id: .byte window_id window_id: .byte da_window_id
.endproc .endproc
.proc text_pos_params3 .proc text_pos_params3
@ -698,7 +698,7 @@ farg: .byte $00,$00,$00,$00,$00,$00
left: .word 115 ; overwritten left: .word 115 ; overwritten
top: .word $FFF7 ; overwritten top: .word $FFF7 ; overwritten
bitmap:.addr pixels bitmap:.addr pixels
stride: .byte 1 mapwidth: .byte 1
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -716,8 +716,8 @@ pixels: .byte px(%1000001)
.proc port_params .proc port_params
left: .word 0 left: .word 0
top: .word 0 top: .word 0
addr: .word 0 mapbits: .word 0
stride: .word 0 mapwidth: .word 0
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word 0 width: .word 0
@ -766,8 +766,8 @@ mode: .byte MGTK::notpenXOR
default_left := 210 default_left := 210
default_top := 60 default_top := 60
.proc openwindow_params .proc winfo
id: .byte window_id window_id: .byte da_window_id
flags: .byte MGTK::option_go_away_box flags: .byte MGTK::option_go_away_box
title: .addr window_title title: .addr window_title
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
@ -776,15 +776,16 @@ hs_max: .byte 0
hs_pos: .byte 0 hs_pos: .byte 0
vs_max: .byte 0 vs_max: .byte 0
vs_pos: .byte 0 vs_pos: .byte 0
.byte 0,0 ; ??? status: .byte 0
w1: .word window_width reserved: .byte 0
h1: .word window_height mincontwidth: .word window_width
w2: .word window_width mincontlength: .word window_height
h2: .word window_height maxcontwidth: .word window_width
maxcontlength: .word window_height
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word window_width width: .word window_width
@ -801,7 +802,7 @@ tmask: .byte 0
font: .addr DEFAULT_FONT font: .addr DEFAULT_FONT
next: .addr 0 next: .addr 0
.endproc .endproc
openwindow_params_top := openwindow_params::top openwindow_params_top := winfo::top
window_title: window_title:
PASCAL_STRING "Calc" PASCAL_STRING "Calc"
@ -813,14 +814,14 @@ init: sta ALTZPON
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
MGTK_CALL MGTK::SetZP1, preserve_zp_params MGTK_CALL MGTK::SetZP1, preserve_zp_params
MGTK_CALL MGTK::OpenWindow, openwindow_params MGTK_CALL MGTK::OpenWindow, winfo
MGTK_CALL MGTK::InitPort, port_params MGTK_CALL MGTK::InitPort, port_params
MGTK_CALL MGTK::SetPort, port_params MGTK_CALL MGTK::SetPort, port_params
MGTK_CALL MGTK::FlushEvents MGTK_CALL MGTK::FlushEvents
jsr reset_buffer2 jsr reset_buffer2
lda #window_id lda #da_window_id
jsr check_visibility_and_draw_window jsr check_visibility_and_draw_window
jsr reset_buffers_and_display jsr reset_buffers_and_display
@ -881,7 +882,7 @@ loop: lda adjust_txtptr_copied-1,x
input_loop: input_loop:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::state lda event_params::kind
cmp #MGTK::button_down cmp #MGTK::button_down
bne :+ bne :+
jsr on_click jsr on_click
@ -897,17 +898,17 @@ input_loop:
on_click: on_click:
MGTK_CALL MGTK::FindWindow, findwindow_params MGTK_CALL MGTK::FindWindow, findwindow_params
lda findwindow_params::elem lda findwindow_params::area
cmp #MGTK::area_content ; Less than CLIENT is MENU or DESKTOP cmp #MGTK::area_content ; Less than CLIENT is MENU or DESKTOP
bcc ignore_click bcc ignore_click
lda findwindow_params::id lda findwindow_params::window_id
cmp #window_id ; This window? cmp #da_window_id ; This window?
beq :+ beq :+
ignore_click: ignore_click:
rts rts
: lda findwindow_params::elem : lda findwindow_params::area
cmp #MGTK::area_content ; Client area? cmp #MGTK::area_content ; Client area?
bne :+ bne :+
jsr map_click_to_button ; try to translate click into key jsr map_click_to_button ; try to translate click into key
@ -917,7 +918,7 @@ ignore_click:
: cmp #MGTK::area_close_box ; Close box? : cmp #MGTK::area_close_box ; Close box?
bne :+ bne :+
MGTK_CALL MGTK::TrackGoAway, trackgoaway_params MGTK_CALL MGTK::TrackGoAway, trackgoaway_params
lda trackgoaway_params::state lda trackgoaway_params::goaway
beq ignore_click beq ignore_click
exit: MGTK_CALL MGTK::CloseWindow, closewindow_params exit: MGTK_CALL MGTK::CloseWindow, closewindow_params
DESKTOP_CALL DESKTOP_REDRAW_ICONS DESKTOP_CALL DESKTOP_REDRAW_ICONS
@ -945,9 +946,9 @@ loop: lda routine,x
: cmp #MGTK::area_dragbar ; Title bar? : cmp #MGTK::area_dragbar ; Title bar?
bne ignore_click bne ignore_click
lda #window_id lda #da_window_id
sta drag_params::id sta dragwindow_params::window_id
MGTK_CALL MGTK::DragWindow, drag_params MGTK_CALL MGTK::DragWindow, dragwindow_params
jsr redraw_screen_and_window jsr redraw_screen_and_window
rts rts
@ -983,14 +984,14 @@ rts1: rts ; used by next proc
;;; If a button was clicked, carry is set and accum has key char ;;; If a button was clicked, carry is set and accum has key char
.proc map_click_to_button .proc map_click_to_button
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 ; ensure high bits of coords are 0 lda screentowindow_params::windowx+1 ; ensure high bits of coords are 0
ora screentowindow_params::clienty+1 ora screentowindow_params::windowy+1
bne rts1 bne rts1
lda screentowindow_params::clienty lda screentowindow_params::windowy
ldx screentowindow_params::clientx ldx screentowindow_params::windowx
.proc find_button_row .proc find_button_row
cmp #row1_top+border_lt - 1 ; row 1 ? (- 1 is bug in original?) cmp #row1_top+border_lt - 1 ; row 1 ? (- 1 is bug in original?)
@ -1032,7 +1033,7 @@ rts1: rts ; used by next proc
: cmp #row5_top-border_lt ; special case for tall + button : cmp #row5_top-border_lt ; special case for tall + button
bcs :+ bcs :+
lda screentowindow_params::clientx lda screentowindow_params::windowx
cmp #col4_left-border_lt cmp #col4_left-border_lt
bcc miss bcc miss
cmp #col4_right+border_br-1 ; is -1 bug in original? cmp #col4_right+border_br-1 ; is -1 bug in original?
@ -1048,7 +1049,7 @@ rts1: rts ; used by next proc
lda row5_lookup,x lda row5_lookup,x
rts rts
: lda screentowindow_params::clientx ; special case for wide 0 button : lda screentowindow_params::windowx ; special case for wide 0 button
cmp #col1_left-border_lt cmp #col1_left-border_lt
bcc miss bcc miss
cmp #col2_right+border_br cmp #col2_right+border_br
@ -1120,8 +1121,8 @@ miss: clc
.proc process_key .proc process_key
cmp #'C' ; Clear? cmp #'C' ; Clear?
bne :+ bne :+
ldx #<btn_c::box ldx #<btn_c::port
ldy #>btn_c::box ldy #>btn_c::port
lda #'c' lda #'c'
jsr depress_button jsr depress_button
lda #$00 lda #$00
@ -1141,8 +1142,8 @@ miss: clc
: cmp #'E' ; Exponential? : cmp #'E' ; Exponential?
bne try_eq bne try_eq
ldx #<btn_e::box ldx #<btn_e::port
ldy #>btn_e::box ldy #>btn_e::port
lda #'e' lda #'e'
jsr depress_button jsr depress_button
ldy calc_e ldy calc_e
@ -1162,21 +1163,21 @@ rts1: rts
try_eq: cmp #'=' ; Equals? try_eq: cmp #'=' ; Equals?
bne :+ bne :+
pha pha
ldx #<btn_eq::box ldx #<btn_eq::port
ldy #>btn_eq::box ldy #>btn_eq::port
jmp do_op_click jmp do_op_click
: cmp #'*' ; Multiply? : cmp #'*' ; Multiply?
bne :+ bne :+
pha pha
ldx #<btn_mul::box ldx #<btn_mul::port
ldy #>btn_mul::box ldy #>btn_mul::port
jmp do_op_click jmp do_op_click
: cmp #'.' ; Decimal? : cmp #'.' ; Decimal?
bne try_add bne try_add
ldx #<btn_dec::box ldx #<btn_dec::port
ldy #>btn_dec::box ldy #>btn_dec::port
jsr depress_button jsr depress_button
lda calc_d lda calc_d
ora calc_e ora calc_e
@ -1193,15 +1194,15 @@ rts2: rts
try_add:cmp #'+' ; Add? try_add:cmp #'+' ; Add?
bne :+ bne :+
pha pha
ldx #<btn_add::box ldx #<btn_add::port
ldy #>btn_add::box ldy #>btn_add::port
jmp do_op_click jmp do_op_click
: cmp #'-' ; Subtract? : cmp #'-' ; Subtract?
bne trydiv bne trydiv
pha pha
ldx #<btn_sub::box ldx #<btn_sub::port
ldy #>btn_sub::box ldy #>btn_sub::port
lda calc_e ; negate vs. subtract lda calc_e ; negate vs. subtract
beq :+ beq :+
lda calc_n lda calc_n
@ -1219,78 +1220,78 @@ try_add:cmp #'+' ; Add?
trydiv: cmp #'/' ; Divide? trydiv: cmp #'/' ; Divide?
bne :+ bne :+
pha pha
ldx #<btn_div::box ldx #<btn_div::port
ldy #>btn_div::box ldy #>btn_div::port
jmp do_op_click jmp do_op_click
: cmp #'0' ; Digit 0? : cmp #'0' ; Digit 0?
bne :+ bne :+
pha pha
ldx #<btn_0::box ldx #<btn_0::port
ldy #>btn_0::box ldy #>btn_0::port
jmp do_digit_click jmp do_digit_click
: cmp #'1' ; Digit 1? : cmp #'1' ; Digit 1?
bne :+ bne :+
pha pha
ldx #<btn_1::box ldx #<btn_1::port
ldy #>btn_1::box ldy #>btn_1::port
jmp do_digit_click jmp do_digit_click
: cmp #'2' ; Digit 2? : cmp #'2' ; Digit 2?
bne :+ bne :+
pha pha
ldx #<btn_2::box ldx #<btn_2::port
ldy #>btn_2::box ldy #>btn_2::port
jmp do_digit_click jmp do_digit_click
: cmp #'3' ; Digit 3? : cmp #'3' ; Digit 3?
bne :+ bne :+
pha pha
ldx #<btn_3::box ldx #<btn_3::port
ldy #>btn_3::box ldy #>btn_3::port
jmp do_digit_click jmp do_digit_click
: cmp #'4' ; Digit 4? : cmp #'4' ; Digit 4?
bne :+ bne :+
pha pha
ldx #<btn_4::box ldx #<btn_4::port
ldy #>btn_4::box ldy #>btn_4::port
jmp do_digit_click jmp do_digit_click
: cmp #'5' ; Digit 5? : cmp #'5' ; Digit 5?
bne :+ bne :+
pha pha
ldx #<btn_5::box ldx #<btn_5::port
ldy #>btn_5::box ldy #>btn_5::port
jmp do_digit_click jmp do_digit_click
: cmp #'6' ; Digit 6? : cmp #'6' ; Digit 6?
bne :+ bne :+
pha pha
ldx #<btn_6::box ldx #<btn_6::port
ldy #>btn_6::box ldy #>btn_6::port
jmp do_digit_click jmp do_digit_click
: cmp #'7' ; Digit 7? : cmp #'7' ; Digit 7?
bne :+ bne :+
pha pha
ldx #<btn_7::box ldx #<btn_7::port
ldy #>btn_7::box ldy #>btn_7::port
jmp do_digit_click jmp do_digit_click
: cmp #'8' ; Digit 8? : cmp #'8' ; Digit 8?
bne :+ bne :+
pha pha
ldx #<btn_8::box ldx #<btn_8::port
ldy #>btn_8::box ldy #>btn_8::port
jmp do_digit_click jmp do_digit_click
: cmp #'9' ; Digit 9? : cmp #'9' ; Digit 9?
bne :+ bne :+
pha pha
ldx #<btn_9::box ldx #<btn_9::port
ldy #>btn_9::box ldy #>btn_9::port
jmp do_digit_click jmp do_digit_click
: cmp #$7F ; Delete? : cmp #$7F ; Delete?
@ -1488,18 +1489,18 @@ end: jsr display_buffer1
sec sec
ror button_state ror button_state
invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts box invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port
check_button: check_button:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::state lda event_params::kind
cmp #MGTK::drag ; Button down? cmp #MGTK::drag ; Button down?
bne done ; Nope, done immediately bne done ; Nope, done immediately
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
MGTK_CALL MGTK::MoveTo, screentowindow_params::client MGTK_CALL MGTK::MoveTo, screentowindow_params::window
MGTK_CALL MGTK::InRect, 0, inrect_params MGTK_CALL MGTK::InRect, 0, inrect_params
bne inside bne inside
@ -1576,12 +1577,12 @@ end: rts
.endproc .endproc
.proc pre_display_buffer .proc pre_display_buffer
stx textwidth_params::addr ; text buffer address in x,y stx textwidth_params::textptr ; text buffer address in x,y
sty textwidth_params::addr+1 sty textwidth_params::textptr+1
MGTK_CALL MGTK::TextWidth, textwidth_params MGTK_CALL MGTK::TextWidth, textwidth_params
lda #display_width-15 ; ??? lda #display_width-15 ; ???
sec sec
sbc textwidth_params::width sbc textwidth_params::result
sta text_pos_params3::left sta text_pos_params3::left
MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces
MGTK_CALL MGTK::DrawText, spaces_string MGTK_CALL MGTK::DrawText, spaces_string
@ -1652,16 +1653,16 @@ loop: ldy #0
draw_title_bar: draw_title_bar:
offset_left := 115 ; pixels from left of client area offset_left := 115 ; pixels from left of client area
offset_top := 22 ; pixels from top of client area (up!) offset_top := 22 ; pixels from top of client area (up!)
ldx openwindow_params::left+1 ldx winfo::left+1
lda openwindow_params::left lda winfo::left
clc clc
adc #offset_left adc #offset_left
sta title_bar_decoration::left sta title_bar_decoration::left
bcc :+ bcc :+
inx inx
: stx title_bar_decoration::left+1 : stx title_bar_decoration::left+1
ldx openwindow_params::top+1 ldx winfo::top+1
lda openwindow_params::top lda winfo::top
sec sec
sbc #offset_top sbc #offset_top
sta title_bar_decoration::top sta title_bar_decoration::top
@ -1670,8 +1671,8 @@ draw_title_bar:
: stx title_bar_decoration::top+1 : stx title_bar_decoration::top+1
MGTK_CALL MGTK::SetPortBits, screen_port ; 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 MGTK_CALL MGTK::PaintBits, title_bar_decoration ; Draws decoration in title bar
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, port_params MGTK_CALL MGTK::SetPort, port_params
MGTK_CALL MGTK::ShowCursor MGTK_CALL MGTK::ShowCursor

View File

@ -65,7 +65,7 @@ save_stack: .byte 0
;;; ================================================== ;;; ==================================================
.proc exit_da .proc exit_da
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
ldx save_stack ldx save_stack
@ -96,7 +96,7 @@ call_init:
;; Redraw window after drag ;; Redraw window after drag
lda ROMIN2 lda ROMIN2
lda #window_id lda #da_window_id
jsr check_visibility_and_draw_window jsr check_visibility_and_draw_window
;; ??? ;; ???
@ -137,7 +137,7 @@ offscreen_flag:
;; Called after window drag is complete ;; Called after window drag is complete
;; (called with window_id in A) ;; (called with window_id in A)
.proc check_visibility_and_draw_window .proc check_visibility_and_draw_window
sta get_port_params_id sta getwinport_params_window_id
lda openwindow_params_top lda openwindow_params_top
cmp #screen_height - 1 cmp #screen_height - 1
bcc :+ bcc :+
@ -149,8 +149,8 @@ offscreen_flag:
;; https://github.com/inexorabletash/a2d/issues/34 ;; https://github.com/inexorabletash/a2d/issues/34
: MGTK_CALL MGTK::GetWinPort, getwinport_params : MGTK_CALL MGTK::GetWinPort, getwinport_params
MGTK_CALL MGTK::SetPort, port_params MGTK_CALL MGTK::SetPort, port_params
lda get_port_params_id lda getwinport_params_window_id
cmp #window_id cmp #da_window_id
bne :+ bne :+
jmp draw_background jmp draw_background
: rts : rts
@ -162,17 +162,17 @@ offscreen_flag:
;; The following params blocks overlap for data re-use ;; The following params blocks overlap for data re-use
.proc screentowindow_params .proc screentowindow_params
id := * window_id := *
screen := * + 1 screen := * + 1
screenx := * + 1 ; aligns with input_state::xcoord screenx := * + 1 ; aligns with input_state::xcoord
screeny := * + 3 ; aligns with input_state::ycoord screeny := * + 3 ; aligns with input_state::ycoord
client := * + 5 window := * + 5
clientx := * + 5 windowx := * + 5
clienty := * + 7 windowy := * + 7
.endproc .endproc
.proc drag_params .proc dragwindow_params
id := * window_id := *
xcoord := * + 1 ; aligns with input_state::xcoord xcoord := * + 1 ; aligns with input_state::xcoord
ycoord := * + 3 ; aligns with input_state::ycoord ycoord := * + 3 ; aligns with input_state::ycoord
moved := * + 5 ; ignored moved := * + 5 ; ignored
@ -187,10 +187,10 @@ modifiers := * + 1 ; "
.endproc .endproc
.proc findwindow_params .proc findwindow_params
queryx: .word 0 ; aligns with event_params::xcoord mousex: .word 0 ; aligns with event_params::xcoord
queryy: .word 0 ; aligns with event_params::ycoord mousey: .word 0 ; aligns with event_params::ycoord
which_area: .byte 0 which_area: .byte 0
id: .byte 0 window_id: .byte 0
.endproc .endproc
.byte 0, 0 ; fills out space for screentowindow_params .byte 0, 0 ; fills out space for screentowindow_params
@ -201,10 +201,10 @@ goaway: .byte 0
.endproc .endproc
.proc getwinport_params .proc getwinport_params
id: .byte 0 window_id: .byte 0
.addr port_params .addr port_params
.endproc .endproc
get_port_params_id := getwinport_params::id getwinport_params_window_id := getwinport_params::window_id
.proc preserve_zp_params .proc preserve_zp_params
flag: .byte MGTK::zp_preserve flag: .byte MGTK::zp_preserve
@ -247,7 +247,7 @@ flag: .byte MGTK::zp_overwrite
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -255,14 +255,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte 'c' label: .byte 'c'
pos: .word col1_left + 6, row1_bot pos: .word col1_left + 6, row1_bot
box: .word col1_left,row1_top,col1_right,row1_bot port: .word col1_left,row1_top,col1_right,row1_bot
.endproc .endproc
.proc btn_e .proc btn_e
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -270,14 +270,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte 'e' label: .byte 'e'
pos: .word col2_left + 6, row1_bot pos: .word col2_left + 6, row1_bot
box: .word col2_left,row1_top,col2_right,row1_bot port: .word col2_left,row1_top,col2_right,row1_bot
.endproc .endproc
.proc btn_eq .proc btn_eq
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -285,14 +285,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '=' label: .byte '='
pos: .word col3_left + 6, row1_bot pos: .word col3_left + 6, row1_bot
box: .word col3_left,row1_top,col3_right,row1_bot port: .word col3_left,row1_top,col3_right,row1_bot
.endproc .endproc
.proc btn_mul .proc btn_mul
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row1_top - border_lt top: .word row1_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -300,14 +300,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '*' label: .byte '*'
pos: .word col4_left + 6, row1_bot pos: .word col4_left + 6, row1_bot
box: .word col4_left,row1_top,col4_right,row1_bot port: .word col4_left,row1_top,col4_right,row1_bot
.endproc .endproc
.proc btn_7 .proc btn_7
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -315,14 +315,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '7' label: .byte '7'
pos: .word col1_left + 6, row2_bot pos: .word col1_left + 6, row2_bot
box: .word col1_left,row2_top,col1_right,row2_bot port: .word col1_left,row2_top,col1_right,row2_bot
.endproc .endproc
.proc btn_8 .proc btn_8
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -330,14 +330,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '8' label: .byte '8'
pos: .word col2_left + 6, row2_bot pos: .word col2_left + 6, row2_bot
box: .word col2_left,row2_top,col2_right,row2_bot port: .word col2_left,row2_top,col2_right,row2_bot
.endproc .endproc
.proc btn_9 .proc btn_9
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -345,14 +345,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '9' label: .byte '9'
pos: .word col3_left + 6, row2_bot pos: .word col3_left + 6, row2_bot
box: .word col3_left,row2_top,col3_right,row2_bot port: .word col3_left,row2_top,col3_right,row2_bot
.endproc .endproc
.proc btn_div .proc btn_div
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row2_top - border_lt top: .word row2_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -360,14 +360,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '/' label: .byte '/'
pos: .word col4_left + 6, row2_bot pos: .word col4_left + 6, row2_bot
box: .word col4_left,row2_top,col4_right,row2_bot port: .word col4_left,row2_top,col4_right,row2_bot
.endproc .endproc
.proc btn_4 .proc btn_4
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -375,14 +375,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '4' label: .byte '4'
pos: .word col1_left + 6, row3_bot pos: .word col1_left + 6, row3_bot
box: .word col1_left,row3_top,col1_right,row3_bot port: .word col1_left,row3_top,col1_right,row3_bot
.endproc .endproc
.proc btn_5 .proc btn_5
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -390,14 +390,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '5' label: .byte '5'
pos: .word col2_left + 6, row3_bot pos: .word col2_left + 6, row3_bot
box: .word col2_left,row3_top,col2_right,row3_bot port: .word col2_left,row3_top,col2_right,row3_bot
.endproc .endproc
.proc btn_6 .proc btn_6
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -405,14 +405,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '6' label: .byte '6'
pos: .word col3_left + 6, row3_bot pos: .word col3_left + 6, row3_bot
box: .word col3_left,row3_top,col3_right,row3_bot port: .word col3_left,row3_top,col3_right,row3_bot
.endproc .endproc
.proc btn_sub .proc btn_sub
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row3_top - border_lt top: .word row3_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -420,14 +420,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '-' label: .byte '-'
pos: .word col4_left + 6, row3_bot pos: .word col4_left + 6, row3_bot
box: .word col4_left,row3_top,col4_right,row3_bot port: .word col4_left,row3_top,col4_right,row3_bot
.endproc .endproc
.proc btn_1 .proc btn_1
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -435,14 +435,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '1' label: .byte '1'
pos: .word col1_left + 6, row4_bot pos: .word col1_left + 6, row4_bot
box: .word col1_left,row4_top,col1_right,row4_bot port: .word col1_left,row4_top,col1_right,row4_bot
.endproc .endproc
.proc btn_2 .proc btn_2
left: .word col2_left - border_lt left: .word col2_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -450,14 +450,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '2' label: .byte '2'
pos: .word col2_left + 6, row4_bot pos: .word col2_left + 6, row4_bot
box: .word col2_left,row4_top,col2_right,row4_bot port: .word col2_left,row4_top,col2_right,row4_bot
.endproc .endproc
.proc btn_3 .proc btn_3
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -465,14 +465,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '3' label: .byte '3'
pos: .word col3_left + 6, row4_bot pos: .word col3_left + 6, row4_bot
box: .word col3_left,row4_top,col3_right,row4_bot port: .word col3_left,row4_top,col3_right,row4_bot
.endproc .endproc
.proc btn_0 .proc btn_0
left: .word col1_left - border_lt left: .word col1_left - border_lt
top: .word row5_top - border_lt top: .word row5_top - border_lt
bitmap: .addr wide_button_bitmap bitmap: .addr wide_button_bitmap
stride: .byte 8 ; bitmap_stride (bytes) mapwidth: .byte 8 ; bitmap_stride (bytes)
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -480,14 +480,14 @@ width: .word 49 ; 0 is extra wide
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '0' label: .byte '0'
pos: .word col1_left + 6, row5_bot pos: .word col1_left + 6, row5_bot
box: .word col1_left,row5_top,col2_right,row5_bot port: .word col1_left,row5_top,col2_right,row5_bot
.endproc .endproc
.proc btn_dec .proc btn_dec
left: .word col3_left - border_lt left: .word col3_left - border_lt
top: .word row5_top - border_lt top: .word row5_top - border_lt
bitmap: .addr button_bitmap bitmap: .addr button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -495,14 +495,14 @@ width: .word button_width + border_lt + border_br
height: .word button_height + border_lt + border_br height: .word button_height + border_lt + border_br
label: .byte '.' label: .byte '.'
pos: .word col3_left + 6 + 2, row5_bot ; + 2 to center the label pos: .word col3_left + 6 + 2, row5_bot ; + 2 to center the label
box: .word col3_left,row5_top,col3_right,row5_bot port: .word col3_left,row5_top,col3_right,row5_bot
.endproc .endproc
.proc btn_add .proc btn_add
left: .word col4_left - border_lt left: .word col4_left - border_lt
top: .word row4_top - border_lt top: .word row4_top - border_lt
bitmap: .addr tall_button_bitmap bitmap: .addr tall_button_bitmap
stride: .byte bitmap_stride mapwidth: .byte bitmap_stride
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -510,7 +510,7 @@ width: .word button_width + border_lt + border_br
height: .word 27 ; + is extra tall height: .word 27 ; + is extra tall
label: .byte '+' label: .byte '+'
pos: .word col4_left + 6, row5_bot pos: .word col4_left + 6, row5_bot
box: .word col4_left,row4_top,col4_right,row5_bot port: .word col4_left,row4_top,col4_right,row5_bot
.endproc .endproc
.byte 0 ; sentinel .byte 0 ; sentinel
@ -647,8 +647,8 @@ height: .word display_height-1
label: .byte 0 ; modified with char to draw label: .byte 0 ; modified with char to draw
.proc drawtext_params1 .proc drawtext_params1
addr: .addr text_buffer1 textptr: .addr text_buffer1
length: .byte 15 textlen: .byte 15
.endproc .endproc
text_buffer_size := 14 text_buffer_size := 14
@ -657,8 +657,8 @@ text_buffer1:
.res text_buffer_size+2, 0 .res text_buffer_size+2, 0
.proc drawtext_params2 .proc drawtext_params2
addr: .addr text_buffer2 textptr: .addr text_buffer2
length: .byte 15 textlen: .byte 15
.endproc .endproc
text_buffer2: text_buffer2:
@ -671,15 +671,15 @@ error_string:
;; used when clearing display; params to a $18 call ;; used when clearing display; params to a $18 call
.proc textwidth_params .proc textwidth_params
addr: .addr text_buffer1 textptr: .addr text_buffer1
len: .byte 15 ; ??? textlen: .byte 15 ; ???
width: .word 0 result: .word 0
.endproc .endproc
window_id = 52 da_window_id = 52
.proc closewindow_params .proc closewindow_params
id: .byte window_id window_id: .byte da_window_id
.endproc .endproc
.proc text_pos_params3 .proc text_pos_params3
@ -703,7 +703,7 @@ farg: .byte $00,$00,$00,$00,$00,$00
left: .word 115 ; overwritten left: .word 115 ; overwritten
top: .word $FFF7 ; overwritten top: .word $FFF7 ; overwritten
bitmap:.addr pixels bitmap:.addr pixels
stride: .byte 1 mapwidth: .byte 1
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -722,8 +722,8 @@ pixels: .byte px(%1000001)
.proc port_params .proc port_params
left: .word 0 left: .word 0
top: .word 0 top: .word 0
addr: .word 0 mapbits: .word 0
stride: .word 0 mapwidth: .word 0
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word 0 width: .word 0
@ -751,8 +751,8 @@ font: .addr 0
.proc screen_port .proc screen_port
left: .word 0 left: .word 0
top: .word menu_bar_height top: .word menu_bar_height
addr: .word MGTK::screen_mapbits mapbits: .word MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word screen_width - 1 width: .word screen_width - 1
@ -774,8 +774,8 @@ mode: .byte MGTK::notpenXOR
default_left := 210 default_left := 210
default_top := 60 default_top := 60
.proc openwindow_params .proc winfo
id: .byte window_id window_id: .byte da_window_id
flags: .byte MGTK::option_go_away_box flags: .byte MGTK::option_go_away_box
title: .addr window_title title: .addr window_title
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
@ -784,15 +784,16 @@ hs_max: .byte 0
hs_pos: .byte 0 hs_pos: .byte 0
vs_max: .byte 0 vs_max: .byte 0
vs_pos: .byte 0 vs_pos: .byte 0
.byte 0,0 ; ??? status: .byte 0
w1: .word window_width reserved: .byte 0
h1: .word window_height mincontwidth: .word window_width
w2: .word window_width mincontlength: .word window_height
h2: .word window_height maxcontwidth: .word window_width
maxcontlength: .word window_height
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word window_width width: .word window_width
@ -809,7 +810,7 @@ tmask: .byte $7f
font: .addr DEFAULT_FONT font: .addr DEFAULT_FONT
next: .addr 0 next: .addr 0
.endproc .endproc
openwindow_params_top := openwindow_params::top openwindow_params_top := winfo::top
window_title: window_title:
PASCAL_STRING "Calc" PASCAL_STRING "Calc"
@ -849,7 +850,7 @@ init: sta ALTZPON
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
MGTK_CALL MGTK::SetZP1, preserve_zp_params MGTK_CALL MGTK::SetZP1, preserve_zp_params
MGTK_CALL MGTK::OpenWindow, openwindow_params MGTK_CALL MGTK::OpenWindow, winfo
MGTK_CALL MGTK::InitPort, port_params MGTK_CALL MGTK::InitPort, port_params
MGTK_CALL MGTK::SetPort, port_params ; set clipping bounds? MGTK_CALL MGTK::SetPort, port_params ; set clipping bounds?
MGTK_CALL MGTK::FlushEvents MGTK_CALL MGTK::FlushEvents
@ -859,7 +860,7 @@ init: sta ALTZPON
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda ROMIN2 lda ROMIN2
jsr reset_buffer2 jsr reset_buffer2
lda #window_id lda #da_window_id
jsr check_visibility_and_draw_window jsr check_visibility_and_draw_window
jsr reset_buffers_and_display jsr reset_buffers_and_display
@ -946,8 +947,8 @@ on_click:
lda findwindow_params::which_area lda findwindow_params::which_area
cmp #MGTK::area_content cmp #MGTK::area_content
bcc ignore_click bcc ignore_click
lda findwindow_params::id lda findwindow_params::window_id
cmp #window_id ; This window? cmp #da_window_id ; This window?
beq :+ beq :+
ignore_click: ignore_click:
@ -993,11 +994,11 @@ loop: lda routine,x
: cmp #MGTK::area_dragbar ; Title bar? : cmp #MGTK::area_dragbar ; Title bar?
bne ignore_click bne ignore_click
lda #window_id lda #da_window_id
sta drag_params::id sta dragwindow_params::window_id
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
MGTK_CALL MGTK::DragWindow, drag_params MGTK_CALL MGTK::DragWindow, dragwindow_params
lda ROMIN2 lda ROMIN2
jsr redraw_screen_and_window jsr redraw_screen_and_window
rts rts
@ -1034,14 +1035,14 @@ rts1: rts ; used by next proc
;;; If a button was clicked, carry is set and accum has key char ;;; If a button was clicked, carry is set and accum has key char
.proc map_click_to_button .proc map_click_to_button
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 ; ensure high bits of coords are 0 lda screentowindow_params::windowx+1 ; ensure high bits of coords are 0
ora screentowindow_params::clienty+1 ora screentowindow_params::windowy+1
bne rts1 bne rts1
lda screentowindow_params::clienty lda screentowindow_params::windowy
ldx screentowindow_params::clientx ldx screentowindow_params::windowx
.proc find_button_row .proc find_button_row
cmp #row1_top+border_lt - 1 ; row 1 ? (- 1 is bug in original?) cmp #row1_top+border_lt - 1 ; row 1 ? (- 1 is bug in original?)
@ -1083,7 +1084,7 @@ rts1: rts ; used by next proc
: cmp #row5_top-border_lt ; special case for tall + button : cmp #row5_top-border_lt ; special case for tall + button
bcs :+ bcs :+
lda screentowindow_params::clientx lda screentowindow_params::windowx
cmp #col4_left-border_lt cmp #col4_left-border_lt
bcc miss bcc miss
cmp #col4_right+border_br-1 ; is -1 bug in original? cmp #col4_right+border_br-1 ; is -1 bug in original?
@ -1099,7 +1100,7 @@ rts1: rts ; used by next proc
lda row5_lookup,x lda row5_lookup,x
rts rts
: lda screentowindow_params::clientx ; special case for wide 0 button : lda screentowindow_params::windowx ; special case for wide 0 button
cmp #col1_left-border_lt cmp #col1_left-border_lt
bcc miss bcc miss
cmp #col2_right+border_br cmp #col2_right+border_br
@ -1171,8 +1172,8 @@ miss: clc
.proc process_key .proc process_key
cmp #'C' ; Clear? cmp #'C' ; Clear?
bne :+ bne :+
ldx #<btn_c::box ldx #<btn_c::port
ldy #>btn_c::box ldy #>btn_c::port
lda #'c' lda #'c'
jsr depress_button jsr depress_button
lda #$00 lda #$00
@ -1192,8 +1193,8 @@ miss: clc
: cmp #'E' ; Exponential? : cmp #'E' ; Exponential?
bne try_eq bne try_eq
ldx #<btn_e::box ldx #<btn_e::port
ldy #>btn_e::box ldy #>btn_e::port
lda #'e' lda #'e'
jsr depress_button jsr depress_button
ldy calc_e ldy calc_e
@ -1213,21 +1214,21 @@ rts1: rts
try_eq: cmp #'=' ; Equals? try_eq: cmp #'=' ; Equals?
bne :+ bne :+
pha pha
ldx #<btn_eq::box ldx #<btn_eq::port
ldy #>btn_eq::box ldy #>btn_eq::port
jmp do_op_click jmp do_op_click
: cmp #'*' ; Multiply? : cmp #'*' ; Multiply?
bne :+ bne :+
pha pha
ldx #<btn_mul::box ldx #<btn_mul::port
ldy #>btn_mul::box ldy #>btn_mul::port
jmp do_op_click jmp do_op_click
: cmp #'.' ; Decimal? : cmp #'.' ; Decimal?
bne try_add bne try_add
ldx #<btn_dec::box ldx #<btn_dec::port
ldy #>btn_dec::box ldy #>btn_dec::port
jsr depress_button jsr depress_button
lda calc_d lda calc_d
ora calc_e ora calc_e
@ -1244,15 +1245,15 @@ rts2: rts
try_add:cmp #'+' ; Add? try_add:cmp #'+' ; Add?
bne :+ bne :+
pha pha
ldx #<btn_add::box ldx #<btn_add::port
ldy #>btn_add::box ldy #>btn_add::port
jmp do_op_click jmp do_op_click
: cmp #'-' ; Subtract? : cmp #'-' ; Subtract?
bne trydiv bne trydiv
pha pha
ldx #<btn_sub::box ldx #<btn_sub::port
ldy #>btn_sub::box ldy #>btn_sub::port
lda calc_e ; negate vs. subtract lda calc_e ; negate vs. subtract
beq :+ beq :+
lda calc_n lda calc_n
@ -1270,78 +1271,78 @@ try_add:cmp #'+' ; Add?
trydiv: cmp #'/' ; Divide? trydiv: cmp #'/' ; Divide?
bne :+ bne :+
pha pha
ldx #<btn_div::box ldx #<btn_div::port
ldy #>btn_div::box ldy #>btn_div::port
jmp do_op_click jmp do_op_click
: cmp #'0' ; Digit 0? : cmp #'0' ; Digit 0?
bne :+ bne :+
pha pha
ldx #<btn_0::box ldx #<btn_0::port
ldy #>btn_0::box ldy #>btn_0::port
jmp do_digit_click jmp do_digit_click
: cmp #'1' ; Digit 1? : cmp #'1' ; Digit 1?
bne :+ bne :+
pha pha
ldx #<btn_1::box ldx #<btn_1::port
ldy #>btn_1::box ldy #>btn_1::port
jmp do_digit_click jmp do_digit_click
: cmp #'2' ; Digit 2? : cmp #'2' ; Digit 2?
bne :+ bne :+
pha pha
ldx #<btn_2::box ldx #<btn_2::port
ldy #>btn_2::box ldy #>btn_2::port
jmp do_digit_click jmp do_digit_click
: cmp #'3' ; Digit 3? : cmp #'3' ; Digit 3?
bne :+ bne :+
pha pha
ldx #<btn_3::box ldx #<btn_3::port
ldy #>btn_3::box ldy #>btn_3::port
jmp do_digit_click jmp do_digit_click
: cmp #'4' ; Digit 4? : cmp #'4' ; Digit 4?
bne :+ bne :+
pha pha
ldx #<btn_4::box ldx #<btn_4::port
ldy #>btn_4::box ldy #>btn_4::port
jmp do_digit_click jmp do_digit_click
: cmp #'5' ; Digit 5? : cmp #'5' ; Digit 5?
bne :+ bne :+
pha pha
ldx #<btn_5::box ldx #<btn_5::port
ldy #>btn_5::box ldy #>btn_5::port
jmp do_digit_click jmp do_digit_click
: cmp #'6' ; Digit 6? : cmp #'6' ; Digit 6?
bne :+ bne :+
pha pha
ldx #<btn_6::box ldx #<btn_6::port
ldy #>btn_6::box ldy #>btn_6::port
jmp do_digit_click jmp do_digit_click
: cmp #'7' ; Digit 7? : cmp #'7' ; Digit 7?
bne :+ bne :+
pha pha
ldx #<btn_7::box ldx #<btn_7::port
ldy #>btn_7::box ldy #>btn_7::port
jmp do_digit_click jmp do_digit_click
: cmp #'8' ; Digit 8? : cmp #'8' ; Digit 8?
bne :+ bne :+
pha pha
ldx #<btn_8::box ldx #<btn_8::port
ldy #>btn_8::box ldy #>btn_8::port
jmp do_digit_click jmp do_digit_click
: cmp #'9' ; Digit 9? : cmp #'9' ; Digit 9?
bne :+ bne :+
pha pha
ldx #<btn_9::box ldx #<btn_9::port
ldy #>btn_9::box ldy #>btn_9::port
jmp do_digit_click jmp do_digit_click
: cmp #$7F ; Delete? : cmp #$7F ; Delete?
@ -1539,18 +1540,18 @@ end: jsr display_buffer1
sec sec
ror button_state ror button_state
invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts box invert: MGTK_CALL MGTK::PaintRect, 0, invert_addr ; Inverts port
check_button: check_button:
MGTK_CALL MGTK::GetEvent, event_params MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind lda event_params::kind
cmp #MGTK::drag ; Button down? cmp #MGTK::drag ; Button down?
bne done ; Nope, done immediately bne done ; Nope, done immediately
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
MGTK_CALL MGTK::MoveTo, screentowindow_params::client MGTK_CALL MGTK::MoveTo, screentowindow_params::window
MGTK_CALL MGTK::InRect, 0, inrect_params MGTK_CALL MGTK::InRect, 0, inrect_params
bne inside bne inside
@ -1623,12 +1624,12 @@ loop: lda #' '
.endproc .endproc
.proc pre_display_buffer .proc pre_display_buffer
stx textwidth_params::addr ; text buffer address in x,y stx textwidth_params::textptr ; text buffer address in x,y
sty textwidth_params::addr+1 sty textwidth_params::textptr+1
MGTK_CALL MGTK::TextWidth, textwidth_params MGTK_CALL MGTK::TextWidth, textwidth_params
lda #display_width-15 ; ??? lda #display_width-15 ; ???
sec sec
sbc textwidth_params::width sbc textwidth_params::result
sta text_pos_params3::left sta text_pos_params3::left
MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces MGTK_CALL MGTK::MoveTo, text_pos_params2 ; clear with spaces
MGTK_CALL MGTK::DrawText, spaces_string MGTK_CALL MGTK::DrawText, spaces_string
@ -1699,16 +1700,16 @@ loop: ldy #0
draw_title_bar: draw_title_bar:
offset_left := 115 ; pixels from left of client area offset_left := 115 ; pixels from left of client area
offset_top := 22 ; pixels from top of client area (up!) offset_top := 22 ; pixels from top of client area (up!)
ldx openwindow_params::left+1 ldx winfo::left+1
lda openwindow_params::left lda winfo::left
clc clc
adc #offset_left adc #offset_left
sta title_bar_decoration::left sta title_bar_decoration::left
bcc :+ bcc :+
inx inx
: stx title_bar_decoration::left+1 : stx title_bar_decoration::left+1
ldx openwindow_params::top+1 ldx winfo::top+1
lda openwindow_params::top lda winfo::top
sec sec
sbc #offset_top sbc #offset_top
sta title_bar_decoration::top sta title_bar_decoration::top
@ -1717,8 +1718,8 @@ draw_title_bar:
: stx title_bar_decoration::top+1 : stx title_bar_decoration::top+1
MGTK_CALL MGTK::SetPortBits, screen_port ; 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 MGTK_CALL MGTK::PaintBits, title_bar_decoration ; Draws decoration in title bar
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, port_params MGTK_CALL MGTK::SetPort, port_params
MGTK_CALL MGTK::ShowCursor MGTK_CALL MGTK::ShowCursor

View File

@ -175,7 +175,7 @@ year_rect:
.word $7F,$14,$95,$1E .word $7F,$14,$95,$1E
.proc settextbg_params .proc settextbg_params
mask: .byte 0 backcolor: .byte 0 ; black
.endproc .endproc
.res 7, $00 ; ??? .res 7, $00 ; ???
@ -226,10 +226,10 @@ ycoord := *+2
.endproc .endproc
;; xcoord/ycoord are used to query... ;; xcoord/ycoord are used to query...
.proc findwindow_params .proc findwindow_params
xcoord := * mousex := *
ycoord := *+2 mousey := *+2
element:.byte 0 which_area:.byte 0
id: .byte 0 window_id: .byte 0
.endproc .endproc
window_id := 100 window_id := 100
@ -239,9 +239,9 @@ id: .byte window_id
screen: screen:
screenx:.word 0 screenx:.word 0
screeny:.word 0 screeny:.word 0
client: window:
clientx:.word 0 windowx:.word 0
clienty:.word 0 windowy:.word 0
.endproc .endproc
.proc closewindow_params .proc closewindow_params
@ -254,26 +254,27 @@ mode: .byte $02 ; this should be normal, but we do inverts ???
.endproc .endproc
.byte $06 ; ??? .byte $06 ; ???
.proc openwindow_params .proc winfo
id: .byte window_id id: .byte window_id
flags: .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
vscroll:.byte MGTK::scroll_option_none vscroll:.byte MGTK::scroll_option_none
hsmax: .byte 0 hthumbmax: .byte 0
hspos: .byte 0 hthumbpos: .byte 0
vsmax: .byte 0 vthumbmax: .byte 0
vspos: .byte 0 vthumbpos: .byte 0
.byte 0, 0 ; ??? status: .byte 0
w1: .word 100 reserved: .byte 0
h1: .word 100 mincontwidth: .word 100
w2: .word $1F4 mincontlength: .word 100
h2: .word $1F4 maxcontwidth: .word $1F4
.proc box maxcontlength: .word $1F4
.proc port
left: .word 180 left: .word 180
top: .word 50 top: .word 50
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word $C7 width: .word $C7
@ -321,7 +322,7 @@ init_window:
lsr a lsr a
sta month sta month
MGTK_CALL MGTK::OpenWindow, openwindow_params MGTK_CALL MGTK::OpenWindow, winfo
lda #0 lda #0
sta selected_field sta selected_field
jsr draw_window jsr draw_window
@ -406,10 +407,10 @@ update_selection:
MGTK_CALL MGTK::FindWindow, event_params::xcoord MGTK_CALL MGTK::FindWindow, event_params::xcoord
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::id lda findwindow_params::window_id
cmp #window_id cmp #window_id
bne miss bne miss
lda findwindow_params::element lda findwindow_params::which_area
bne hit bne hit
miss: rts miss: rts
@ -718,7 +719,7 @@ skip: jmp dest
lda event_params::ycoord+1 lda event_params::ycoord+1
sta screentowindow_params::screeny+1 sta screentowindow_params::screeny+1
MGTK_CALL MGTK::ScreenToWindow, screentowindow_params MGTK_CALL MGTK::ScreenToWindow, screentowindow_params
MGTK_CALL MGTK::MoveTo, screentowindow_params::client MGTK_CALL MGTK::MoveTo, screentowindow_params::window
ldx #1 ldx #1
lda #<first_hit_rect lda #<first_hit_rect
sta test_addr sta test_addr
@ -787,7 +788,7 @@ vthick: .byte 1
;;; Render the window contents ;;; Render the window contents
draw_window: draw_window:
MGTK_CALL MGTK::SetPort, openwindow_params::box MGTK_CALL MGTK::SetPort, winfo::port
MGTK_CALL MGTK::FrameRect, border_rect MGTK_CALL MGTK::FrameRect, border_rect
MGTK_CALL MGTK::SetPenSize, setpensize_params MGTK_CALL MGTK::SetPenSize, setpensize_params
MGTK_CALL MGTK::FrameRect, date_rect MGTK_CALL MGTK::FrameRect, date_rect

View File

@ -237,8 +237,8 @@ position_table:
.proc draw_bitmap_params .proc draw_bitmap_params
left: .word 0 left: .word 0
top: .word 0 top: .word 0
addr: .addr 0 mapbits: .addr 0
stride: .byte 4 mapwidth: .byte 4
.byte 0 ; ??? .byte 0 ; ???
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
@ -591,26 +591,26 @@ setport_params:
default_width := $79 default_width := $79
default_height := $44 default_height := $44
.proc openwindow_params .proc winfo
id: .byte window_id id: .byte window_id
flags: .byte MGTK::option_go_away_box flags: .byte MGTK::option_go_away_box
title: .addr name title: .addr name
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none vscroll:.byte MGTK::scroll_option_none
hsmax: .byte 0 hthumbmax: .byte 0
hspos: .byte 0 hthumbpos: .byte 0
vsmax: .byte 0 vthumbmax: .byte 0
vspos: .byte 0 vthumbpos: .byte 0
.byte 0,0 ; ??? .byte 0,0 ; ???
w1: .word default_width mincontwidth: .word default_width
h1: .word default_height mincontlength: .word default_height
w2: .word default_width maxcontwidth: .word default_width
h2: .word default_height maxcontlength: .word default_height
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word default_width width: .word default_width
@ -633,8 +633,8 @@ next: .addr 0
.proc box_cruft ; Unknown usage .proc box_cruft ; Unknown usage
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word default_width width: .word default_width
@ -654,14 +654,14 @@ font: .addr DEFAULT_FONT
name: PASCAL_STRING "Puzzle" name: PASCAL_STRING "Puzzle"
openwindow_params_top := openwindow_params::top openwindow_params_top := winfo::top
;;; ================================================== ;;; ==================================================
;;; Create the window ;;; Create the window
.proc create_window .proc create_window
jsr save_zp jsr save_zp
MGTK_CALL MGTK::OpenWindow, openwindow_params MGTK_CALL MGTK::OpenWindow, winfo
;; init pieces ;; init pieces
ldy #15 ldy #15
@ -742,7 +742,7 @@ bail: rts
bcc bail bcc bail
jmp process_click jmp process_click
;; close box? ;; close port?
: 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
@ -1087,9 +1087,9 @@ loop: tya
asl a asl a
tax tax
lda bitmap_table,x lda bitmap_table,x
sta draw_bitmap_params::addr sta draw_bitmap_params::mapbits
lda bitmap_table+1,x lda bitmap_table+1,x
sta draw_bitmap_params::addr+1 sta draw_bitmap_params::mapbits+1
MGTK_CALL MGTK::PaintBits, draw_bitmap_params MGTK_CALL MGTK::PaintBits, draw_bitmap_params
pla pla
clc clc

View File

@ -199,21 +199,21 @@ flags: .byte MGTK::option_dialog_box
title: .addr window_title title: .addr window_title
hscroll:.byte MGTK::scroll_option_none hscroll:.byte MGTK::scroll_option_none
vscroll:.byte MGTK::scroll_option_none vscroll:.byte MGTK::scroll_option_none
hsmax: .byte 32 hthumbmax: .byte 32
hspos: .byte 0 hthumbpos: .byte 0
vsmax: .byte 32 vthumbmax: .byte 32
vspos: .byte 0 vthumbpos: .byte 0
.byte 0, 0 ; ??? .byte 0, 0 ; ???
w1: .word default_width mincontwidth: .word default_width
h1: .word default_height mincontlength: .word default_height
w2: .word default_width maxcontwidth: .word default_width
h2: .word default_height maxcontlength: .word default_height
.proc box .proc port
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word default_width width: .word default_width
@ -345,7 +345,7 @@ end: rts
MGTK_CALL MGTK::HideCursor MGTK_CALL MGTK::HideCursor
jsr stash_menu jsr stash_menu
MGTK_CALL MGTK::OpenWindow, window_params MGTK_CALL MGTK::OpenWindow, window_params
MGTK_CALL MGTK::SetPort, window_params::box MGTK_CALL MGTK::SetPort, window_params::port
jsr show_file jsr show_file
MGTK_CALL MGTK::ShowCursor MGTK_CALL MGTK::ShowCursor

View File

@ -304,25 +304,25 @@ len: .byte 0 ; length
.proc window_params .proc window_params
id: .byte window_id ; window identifier id: .byte window_id ; window identifier
flags: .byte MGTK::option_go_away_box; window flags (2=include close box) flags: .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
vscroll:.byte MGTK::scroll_option_normal vscroll:.byte MGTK::scroll_option_normal
hsmax: .byte 32 hthumbmax: .byte 32
hspos: .byte 0 hthumbpos: .byte 0
vsmax: .byte 255 vthumbmax: .byte 255
vspos: .byte 0 vthumbpos: .byte 0
.byte 0, 0 ; ??? .byte 0, 0 ; ???
w1: .word 200 mincontwidth: .word 200
h1: .word 51 mincontlength: .word 51
w2: .word default_width maxcontwidth: .word default_width
h2: .word default_height maxcontlength: .word default_height
.proc box .proc port
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .addr MGTK::screen_mapbits mapbits: .addr MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 ; Also used for MGTK::PaintRect hoff: .word 0 ; Also used for MGTK::PaintRect
voff: .word 0 voff: .word 0
width: .word default_width width: .word default_width
@ -342,12 +342,12 @@ font: .addr DEFAULT_FONT
next: .addr 0 next: .addr 0
.endproc .endproc
;; gets copied over window_params::box after mode is drawn ;; gets copied over window_params::port after mode is drawn
.proc default_box .proc default_box
left: .word default_left left: .word default_left
top: .word default_top top: .word default_top
addr: .word MGTK::screen_mapbits mapbits: .word MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word default_width width: .word default_width
@ -498,7 +498,7 @@ loop: lda font_width_table - 1,x
;; create window ;; create window
MGTK_CALL MGTK::OpenWindow, window_params MGTK_CALL MGTK::OpenWindow, window_params
MGTK_CALL MGTK::SetPort, window_params::box MGTK_CALL MGTK::SetPort, window_params::port
jsr calc_window_size jsr calc_window_size
jsr calc_and_draw_mode jsr calc_and_draw_mode
jsr draw_content jsr draw_content
@ -570,23 +570,23 @@ title: jsr on_title_bar_click
max_width := default_width max_width := default_width
lda #>max_width lda #>max_width
cmp window_params::box::width+1 cmp window_params::port::width+1
bne :+ bne :+
lda #<max_width lda #<max_width
cmp window_params::box::width cmp window_params::port::width
: bcs wider : bcs wider
lda #<max_width lda #<max_width
sta window_params::box::width sta window_params::port::width
lda #>max_width lda #>max_width
sta window_params::box::width+1 sta window_params::port::width+1
sec sec
lda window_params::box::width lda window_params::port::width
sbc window_width sbc window_width
sta window_params::box::hoff sta window_params::port::hoff
lda window_params::box::width+1 lda window_params::port::width+1
sbc window_width+1 sbc window_width+1
sta window_params::box::hoff+1 sta window_params::port::hoff+1
wider: lda window_params::hscroll wider: lda window_params::hscroll
ldx window_width ldx window_width
cpx #<max_width cpx #<max_width
@ -672,11 +672,11 @@ end: rts
.endproc .endproc
.proc on_vscroll_above_click .proc on_vscroll_above_click
loop: lda window_params::vspos loop: lda window_params::vthumbpos
beq end beq end
jsr calc_track_scroll_delta jsr calc_track_scroll_delta
sec sec
lda window_params::vspos lda window_params::vthumbpos
sbc track_scroll_delta sbc track_scroll_delta
bcs store bcs store
lda #0 ; underflow lda #0 ; underflow
@ -687,7 +687,7 @@ end: rts
.endproc .endproc
.proc on_vscroll_up_click .proc on_vscroll_up_click
loop : lda window_params::vspos loop : lda window_params::vthumbpos
beq end beq end
sec sec
sbc #1 sbc #1
@ -700,12 +700,12 @@ end: rts
vscroll_max := $FA vscroll_max := $FA
.proc on_vscroll_below_click .proc on_vscroll_below_click
loop: lda window_params::vspos loop: lda window_params::vthumbpos
cmp #vscroll_max ; pos == max ? cmp #vscroll_max ; pos == max ?
beq end beq end
jsr calc_track_scroll_delta jsr calc_track_scroll_delta
clc clc
lda window_params::vspos lda window_params::vthumbpos
adc track_scroll_delta ; pos + delta adc track_scroll_delta ; pos + delta
bcs overflow bcs overflow
cmp #vscroll_max+1 ; > max ? cmp #vscroll_max+1 ; > max ?
@ -719,7 +719,7 @@ end: rts
.endproc .endproc
.proc on_vscroll_down_click .proc on_vscroll_down_click
loop: lda window_params::vspos loop: lda window_params::vthumbpos
cmp #vscroll_max cmp #vscroll_max
beq end beq end
clc clc
@ -782,16 +782,16 @@ loop: inx
lda thumb_drag_params::pos lda thumb_drag_params::pos
jsr mul_by_16 jsr mul_by_16
lda $06 lda $06
sta window_params::box::hoff sta window_params::port::hoff
lda $07 lda $07
sta window_params::box::hoff+1 sta window_params::port::hoff+1
clc clc
lda window_params::box::hoff lda window_params::port::hoff
adc window_width adc window_width
sta window_params::box::width sta window_params::port::width
lda window_params::box::hoff+1 lda window_params::port::hoff+1
adc window_width+1 adc window_width+1
sta window_params::box::width+1 sta window_params::port::width+1
jsr update_hscroll jsr update_hscroll
jsr draw_content jsr draw_content
end: rts end: rts
@ -799,7 +799,7 @@ end: rts
.proc on_hscroll_after_click .proc on_hscroll_after_click
ldx #2 ldx #2
lda window_params::hsmax lda window_params::hthumbmax
jmp hscroll_common jmp hscroll_common
.endproc .endproc
@ -811,7 +811,7 @@ end: rts
.proc on_hscroll_right_click .proc on_hscroll_right_click
ldx #1 ldx #1
lda window_params::hsmax lda window_params::hthumbmax
jmp hscroll_common jmp hscroll_common
.endproc .endproc
@ -824,23 +824,23 @@ end: rts
.proc hscroll_common .proc hscroll_common
sta compare+1 sta compare+1
stx delta+1 stx delta+1
loop: lda window_params::hspos loop: lda window_params::hthumbpos
compare:cmp #$0A ; self-modified compare:cmp #$0A ; self-modified
bne continue bne continue
rts rts
continue: continue:
clc clc
lda window_params::hspos lda window_params::hthumbpos
delta: adc #1 ; self-modified delta: adc #1 ; self-modified
bmi overflow bmi overflow
cmp window_params::hsmax cmp window_params::hthumbmax
beq store beq store
bcc store bcc store
lda window_params::hsmax lda window_params::hthumbmax
jmp store jmp store
overflow: overflow:
lda #0 lda #0
store: sta window_params::hspos store: sta window_params::hthumbpos
jsr adjust_box_width jsr adjust_box_width
jsr update_hscroll jsr update_hscroll
jsr draw_content jsr draw_content
@ -874,44 +874,44 @@ store: sta window_params::hspos
;;; only used from hscroll code? ;;; only used from hscroll code?
.proc adjust_box_width .proc adjust_box_width
lda window_params::hspos lda window_params::hthumbpos
jsr mul_by_16 jsr mul_by_16
clc clc
lda $06 lda $06
sta window_params::box::hoff sta window_params::port::hoff
adc window_width adc window_width
sta window_params::box::width sta window_params::port::width
lda $07 lda $07
sta window_params::box::hoff+1 sta window_params::port::hoff+1
adc window_width+1 adc window_width+1
sta window_params::box::width+1 sta window_params::port::width+1
rts rts
.endproc .endproc
.proc update_voffset .proc update_voffset
lda #0 lda #0
sta window_params::box::voff sta window_params::port::voff
sta window_params::box::voff+1 sta window_params::port::voff+1
ldx updatethumb_params::pos ldx updatethumb_params::pos
loop: beq adjust_box_height loop: beq adjust_box_height
clc clc
lda window_params::box::voff lda window_params::port::voff
adc #50 adc #50
sta window_params::box::voff sta window_params::port::voff
bcc :+ bcc :+
inc window_params::box::voff+1 inc window_params::port::voff+1
: dex : dex
jmp loop jmp loop
.endproc .endproc
.proc adjust_box_height .proc adjust_box_height
clc clc
lda window_params::box::voff lda window_params::port::voff
adc window_height adc window_height
sta window_params::box::height sta window_params::port::height
lda window_params::box::voff+1 lda window_params::port::voff+1
adc window_height+1 adc window_height+1
sta window_params::box::height+1 sta window_params::port::height+1
jsr calc_line_position jsr calc_line_position
lda #0 lda #0
sta L096A sta L096A
@ -932,9 +932,9 @@ end: rts
.proc update_hscroll .proc update_hscroll
lda #2 lda #2
sta updatethumb_params::type sta updatethumb_params::type
lda window_params::box::hoff lda window_params::port::hoff
sta $06 sta $06
lda window_params::box::hoff+1 lda window_params::port::hoff+1
sta $07 sta $07
jsr div_by_16 jsr div_by_16
sta updatethumb_params::pos sta updatethumb_params::pos
@ -951,12 +951,12 @@ end: rts
.proc finish_resize ; only called from dead code .proc finish_resize ; only called from dead code
DESKTOP_CALL DESKTOP_REDRAW_ICONS DESKTOP_CALL DESKTOP_REDRAW_ICONS
MGTK_CALL MGTK::SetPort, window_params::box MGTK_CALL MGTK::SetPort, window_params::port
lda window_params::hscroll lda window_params::hscroll
ror a ; check if low bit (track enabled) is set ror a ; check if low bit (track enabled) is set
bcc :+ bcc :+
jsr update_hscroll jsr update_hscroll
: lda window_params::vspos : lda window_params::vthumbpos
sta updatethumb_params::pos sta updatethumb_params::pos
jsr update_vscroll jsr update_vscroll
jsr draw_content jsr draw_content
@ -965,7 +965,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, window_params::box::hoff MGTK_CALL MGTK::PaintRect, window_params::port::hoff
MGTK_CALL MGTK::SetPattern, black_pattern MGTK_CALL MGTK::SetPattern, black_pattern
rts rts
.endproc .endproc
@ -1275,16 +1275,16 @@ end: rts
.proc calc_window_size .proc calc_window_size
sec sec
lda window_params::box::width lda window_params::port::width
sbc window_params::box::hoff sbc window_params::port::hoff
sta window_width sta window_width
lda window_params::box::width+1 lda window_params::port::width+1
sbc window_params::box::hoff+1 sbc window_params::port::hoff+1
sta window_width+1 sta window_width+1
sec sec
lda window_params::box::height lda window_params::port::height
sbc window_params::box::voff sbc window_params::port::voff
sta window_height sta window_height
;; fall through ;; fall through
.endproc .endproc
@ -1292,9 +1292,9 @@ end: rts
;;; ================================================== ;;; ==================================================
.proc calc_line_position .proc calc_line_position
lda window_params::box::height lda window_params::port::height
sta L0965 sta L0965
lda window_params::box::height+1 lda window_params::port::height+1
sta L0966 sta L0966
lda #0 lda #0
@ -1430,11 +1430,11 @@ fixed_str: DEFINE_STRING "Fixed "
prop_str: DEFINE_STRING "Proportional" prop_str: DEFINE_STRING "Proportional"
label_width := 50 label_width := 50
title_bar_height := 12 title_bar_height := 12
.proc mode_box ; bounding box for mode label .proc mode_box ; bounding port for mode label
left: .word 0 left: .word 0
top: .word 0 top: .word 0
addr: .word MGTK::screen_mapbits mapbits: .word MGTK::screen_mapbits
stride: .word MGTK::screen_mapwidth mapwidth: .word MGTK::screen_mapwidth
hoff: .word 0 hoff: .word 0
voff: .word 0 voff: .word 0
width: .word 80 width: .word 80
@ -1450,14 +1450,14 @@ base: .word 10 ; vertical text offset (to baseline)
.proc calc_and_draw_mode .proc calc_and_draw_mode
sec sec
lda window_params::box::top lda window_params::port::top
sbc #title_bar_height sbc #title_bar_height
sta mode_box::top sta mode_box::top
clc clc
lda window_params::box::left lda window_params::port::left
adc window_width adc window_width
pha pha
lda window_params::box::left+1 lda window_params::port::left+1
adc window_width+1 adc window_width+1
tax tax
sec sec
@ -1481,9 +1481,9 @@ else: MGTK_CALL MGTK::DrawText, prop_str
endif: ldx #$0F endif: ldx #$0F
loop: lda default_box,x loop: lda default_box,x
sta window_params::box,x sta window_params::port,x
dex dex
bpl loop bpl loop
MGTK_CALL MGTK::SetPortBits, window_params::box MGTK_CALL MGTK::SetPortBits, window_params::port
rts rts
.endproc .endproc