TEXT_BOX -> SET_BOX, and speculate $80 is stride

This commit is contained in:
Joshua Bell 2017-09-09 18:28:15 -07:00
parent 4b9f4f2cc3
commit ba55d8d8f4
4 changed files with 92 additions and 86 deletions

View File

@ -7,6 +7,7 @@ A2D := $4000
UNKNOWN_CALL := $8E00
;; These must be called from main memory (RAMRDON/RAMWRTON)
JUMP_TABLE_03 := $4003 ; ???
JUMP_TABLE_06 := $4006 ; ???
@ -31,12 +32,12 @@ JUMP_TABLE_3F := $403F ; ???
A2D_UNK_03 := $03 ; Unknown - used in calculator after frame is drawn
A2D_TEXT_BOX1 := $04 ; Not sure what BOX1 vs. BOX2 is for
A2D_TEXT_BOX2 := $06 ; Not sure what BOX1 vs. BOX2 is for
A2D_SET_BOX1 := $04 ; Not sure what BOX1 vs. BOX2 is for
A2D_SET_BOX2 := $06 ; Not sure what BOX1 vs. BOX2 is for
;; .word left pixels from screen edge
;; .word top
;; .word $2000 hires?
;; .word $80 ???
;; .word addr A2D_SCREEN_ADDR ($2000)
;; .word stride A2D_SCREEN_STRIDE ($80)
;; .word hoffset pixels scrolled
;; .word voffset
;; .word width pixels
@ -136,11 +137,11 @@ A2D_CREATE_WINDOW := $38
;; .word height_a ???
;; .word width_b (of scroll area?)
;; .word height_b (of scroll area?)
;; - next section is identical to that for TEXT_BOX
;; - next section is identical to that for A2D_SET_BOX
;; .word left pixels from screen edge
;; .word top
;; .word $2000 hires?
;; .word $80 ???
;; .word screen_addr
;; .word screen_stride
;; .word hoffset pixels scrolled
;; .word voffset
;; .word width pixels
@ -151,7 +152,7 @@ A2D_DESTROY_WINDOW := $39
A2D_QUERY_BOX := $3C ; get client "box" of window
;; .byte id window
;; .addr box box definition to populate, like A2D_TEXT_BOX1
;; .addr box box definition to populate, like A2D_SET_BOX1
A2D_QUERY_TARGET := $40
;; .word queryx (relative to screen)
@ -209,6 +210,10 @@ A2D_UPDATE_SCROLL:= $4B
;; .byte type (1 = vertical, 2 = horizontal)
;; .byte pos (new position 0...250)
;;; Used in A2D_QUERY_BOX / A2D_SET_BOX
A2D_SCREEN_ADDR := $2000 ; Screen address
A2D_SCREEN_STRIDE := $80 ; Stride in bytes (???)
;;; Used in A2D_GET_INPUT
A2D_INPUT_NONE := 0 ; No mouse or keypress
A2D_INPUT_DOWN := 1 ; Mouse button was depressed

View File

@ -118,7 +118,7 @@ skip: lda #0
sta L089D
lda ROMIN2
A2D_CALL A2D_QUERY_BOX, query_box_params
A2D_CALL A2D_TEXT_BOX1, box_params
A2D_CALL A2D_SET_BOX1, box_params
rts
.proc routine
@ -148,7 +148,7 @@ L089E: sta query_box_params_id
rts
: A2D_CALL A2D_QUERY_BOX, query_box_params
A2D_CALL A2D_TEXT_BOX1, box_params
A2D_CALL A2D_SET_BOX1, box_params
lda query_box_params_id
cmp #window_id
bne :+
@ -667,12 +667,12 @@ pixels: .byte px(%1000001)
.byte px(%1001001)
.endproc
;; param block for a $03 and TEXT_BOX1 calls, and ref'd in A2D_QUERY_BOX call
;; param block for a $03 and SET_BOX1 calls, and ref'd in A2D_QUERY_BOX call
.proc box_params
left: .word 0
top: .word 0
.word 0 ; $03 call sets to $2000 (hires)
.word 0 ; ??? $03 call sets to $80
addr: .word 0
stride: .word 0
hoffset:.word 0
voffset:.word 0
width: .word 0 ; $03 call sets to screen_width-1
@ -690,14 +690,13 @@ height: .word 0 ; $03 call sets to screen_height-1
menu_bar_height := 13
screen_width := 560
screen_height := 192
hires := $2000
;; params for A2D_TEXT_BOX2 when decorating title bar
;; params for A2D_SET_BOX2 when decorating title bar
.proc screen_box
.word 0
.word menu_bar_height
.word hires
.word $80 ; ??
.word A2D_SCREEN_ADDR
.word A2D_SCREEN_STRIDE
.word 0, 0 ; hoffset/voffset
.word screen_width - 1
.word screen_height - menu_bar_height - 2
@ -730,8 +729,8 @@ width_b: .word window_width
height_b:.word window_height
left: .word default_left
top: .word default_top
.word hires
.word $80
.word A2D_SCREEN_ADDR
.word A2D_SCREEN_STRIDE
hoffset:.word 0
voffset:.word 0
width: .word window_width
@ -768,7 +767,7 @@ L0D18: sta ALTZPON
A2D_CALL $1A, L08D4
A2D_CALL A2D_CREATE_WINDOW, create_window_params
A2D_CALL $03, box_params ; get display state?
A2D_CALL A2D_TEXT_BOX1, box_params ; set clipping bounds?
A2D_CALL A2D_SET_BOX1, box_params ; set clipping bounds?
A2D_CALL $2B, 0
lda #$01
sta input_state_params::state
@ -1625,12 +1624,12 @@ draw_title_bar:
bcs :+
dex
: stx title_bar_decoration::top+1
A2D_CALL A2D_TEXT_BOX2, screen_box ; set clipping rect to whole screen
A2D_CALL A2D_SET_BOX2, screen_box ; set clipping rect to whole screen
A2D_CALL A2D_DRAW_PATTERN, title_bar_decoration ; Draws decoration in title bar
lda #window_id
sta query_box_params::id
A2D_CALL A2D_QUERY_BOX, query_box_params ; get client rect
A2D_CALL A2D_TEXT_BOX1, box_params ; clip rect?
A2D_CALL A2D_SET_BOX1, box_params ; clip rect?
A2D_CALL A2D_SHOW_CURSOR
jsr display_buffer2
rts

View File

@ -233,16 +233,18 @@ vscroll_pos:
.byte 0
;; ???
.byte $00,$00,$C8,$00,$33,$00
.byte 0, 0
width: .word default_width
height: .word default_height
widtha: .word default_width
heighta:.word default_height
widthb: .word default_width
heightb:.word default_height
.proc text_box
.proc box
left: .word default_left
top: .word default_top
.word $2000 ; ??? never changed
.word $80 ; ??? never changed
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
hoffset:.word 0 ; Also used for A2D_CLEAR_BOX
voffset:.word 0
width: .word default_width
@ -368,7 +370,7 @@ end: rts
;; create window
A2D_CALL A2D_CREATE_WINDOW, window_params
A2D_CALL A2D_TEXT_BOX1, window_params::text_box
A2D_CALL A2D_SET_BOX1, window_params::box
jsr show_file

View File

@ -326,17 +326,17 @@ vscroll_pos:
width: .word default_width
height: .word default_height
.endproc
;; window_params continues into text_box
.proc text_box ; or whole window ??
.proc box ; or whole window ??
left: .word default_left
top: .word default_top
.word $2000 ; ??? never changed
.word $80 ; ??? never changed
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
hoffset:.word 0 ; Also used for A2D_FILL_RECT
voffset:.word 0
width: .word default_width
height: .word default_height
.endproc
.endproc
;; unused?
@ -344,12 +344,12 @@ height: .word default_height
.byte $00,$FF,$00,$00,$00,$00,$00,$01
.byte $01,$00,$7F,$00,$88,$00,$00
;; gets copied over text_box after mode is drawn
;; gets copied over window_params::box after mode is drawn
.proc default_box
left: .word default_left
top: .word default_top
.word $2000
.word $80
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
hoffset:.word 0
voffset:.word 0
width: .word default_width
@ -499,7 +499,7 @@ loop: lda $8802,x
;; create window
A2D_CALL A2D_CREATE_WINDOW, window_params
A2D_CALL A2D_TEXT_BOX1, text_box
A2D_CALL A2D_SET_BOX1, window_params::box
jsr calc_window_size
jsr calc_and_draw_mode
jsr draw_content
@ -575,23 +575,23 @@ title: jsr on_title_bar_click
max_width := default_width
lda #>max_width
cmp text_box::width+1
cmp window_params::box::width+1
bne :+
lda #<max_width
cmp text_box::width
cmp window_params::box::width
: bcs wider
lda #<max_width
sta text_box::width
sta window_params::box::width
lda #>max_width
sta text_box::width+1
sta window_params::box::width+1
sec
lda text_box::width
lda window_params::box::width
sbc window_width
sta text_box::hoffset
lda text_box::width+1
sta window_params::box::hoffset
lda window_params::box::width+1
sbc window_width+1
sta text_box::hoffset+1
sta window_params::box::hoffset+1
wider: lda window_params::hscroll
ldx window_width
cpx #<max_width
@ -786,16 +786,16 @@ loop: inx
lda thumb_drag_params::pos
jsr mul_by_16
lda $06
sta text_box::hoffset
sta window_params::box::hoffset
lda $07
sta text_box::hoffset+1
sta window_params::box::hoffset+1
clc
lda text_box::hoffset
lda window_params::box::hoffset
adc window_width
sta text_box::width
lda text_box::hoffset+1
sta window_params::box::width
lda window_params::box::hoffset+1
adc window_width+1
sta text_box::width+1
sta window_params::box::width+1
jsr update_hscroll
jsr draw_content
end: rts
@ -882,41 +882,41 @@ store: sta window_params::hscroll_pos
jsr mul_by_16
clc
lda $06
sta text_box::hoffset
sta window_params::box::hoffset
adc window_width
sta text_box::width
sta window_params::box::width
lda $07
sta text_box::hoffset+1
sta window_params::box::hoffset+1
adc window_width+1
sta text_box::width+1
sta window_params::box::width+1
rts
.endproc
.proc update_voffset
lda #0
sta text_box::voffset
sta text_box::voffset+1
sta window_params::box::voffset
sta window_params::box::voffset+1
ldx update_scroll_params::pos
loop: beq L0D9B
clc
lda text_box::voffset
lda window_params::box::voffset
adc #50
sta text_box::voffset
sta window_params::box::voffset
bcc :+
inc text_box::voffset+1
inc window_params::box::voffset+1
: dex
jmp loop
.endproc
.proc L0D9B ; ?? part of vscroll
;; increase text_box height to cover full window (offset + height)
;; increase window_params::box height to cover full window (offset + height)
clc
lda text_box::voffset
lda window_params::box::voffset
adc window_height
sta text_box::height
lda text_box::voffset+1
sta window_params::box::height
lda window_params::box::voffset+1
adc window_height+1
sta text_box::height+1
sta window_params::box::height+1
jsr L10A5
lda #0
sta L096A
@ -937,9 +937,9 @@ end: rts
.proc update_hscroll
lda #2
sta update_scroll_params::type
lda text_box::hoffset
lda window_params::box::hoffset
sta $06
lda text_box::hoffset+1
lda window_params::box::hoffset+1
sta $07
jsr div_by_16
sta update_scroll_params::pos
@ -958,7 +958,7 @@ end: rts
jsr UNKNOWN_CALL
.byte $0C
.addr 0
A2D_CALL A2D_TEXT_BOX1, text_box
A2D_CALL A2D_SET_BOX1, window_params::box
lda window_params::hscroll
ror a ; check if low bit (track enabled) is set
bcc :+
@ -972,7 +972,7 @@ end: rts
;; called on scroll
L0E1D: A2D_CALL A2D_SET_PATTERN, white_pattern
A2D_CALL A2D_FILL_RECT, text_box::hoffset
A2D_CALL A2D_FILL_RECT, window_params::box::hoffset
A2D_CALL A2D_SET_PATTERN, black_pattern
rts
@ -1253,25 +1253,25 @@ end: rts
.proc calc_window_size
sec
lda text_box::width
sbc text_box::hoffset
lda window_params::box::width
sbc window_params::box::hoffset
sta window_width
lda text_box::width+1
sbc text_box::hoffset+1
lda window_params::box::width+1
sbc window_params::box::hoffset+1
sta window_width+1
sec
lda text_box::height
sbc text_box::voffset
lda window_params::box::height
sbc window_params::box::voffset
sta window_height
;; fall through
.endproc
;; calculate line offset ?
.proc L10A5
lda text_box::height
lda window_params::box::height
sta L0965
lda text_box::height+1
lda window_params::box::height+1
sta L0966
lda #0
@ -1398,8 +1398,8 @@ prop_str: A2D_DEFSTRING "Proportional"
.proc mode_box ; bounding box for mode label
left: .word 0
top: .word 0
.word $2000 ; ??
.word $80 ; ??
addr: .word A2D_SCREEN_ADDR
stride: .word A2D_SCREEN_STRIDE
hoffset:.word 0
voffset:.word 0
width: .word 80
@ -1415,14 +1415,14 @@ base: .word 10 ; vertical text offset (to baseline)
.proc calc_and_draw_mode
sec
lda text_box::top
lda window_params::box::top
sbc #title_bar_height
sta mode_box::top
clc
lda text_box::left
lda window_params::box::left
adc window_width
pha
lda text_box::left+1
lda window_params::box::left+1
adc window_width+1
tax
sec
@ -1436,7 +1436,7 @@ base: .word 10 ; vertical text offset (to baseline)
.endproc
.proc draw_mode
A2D_CALL A2D_TEXT_BOX2, mode_box ; guess: setting up draw location ???
A2D_CALL A2D_SET_BOX2, mode_box ; guess: setting up draw location ???
A2D_CALL A2D_SET_POS, mode_pos
lda fixed_mode_flag
beq else ; is proportional?
@ -1446,9 +1446,9 @@ else: A2D_CALL A2D_DRAW_TEXT, prop_str
endif: ldx #$0F
loop: lda default_box,x
sta text_box,x
sta window_params::box,x
dex
bpl loop
A2D_CALL A2D_TEXT_BOX2, text_box
A2D_CALL A2D_SET_BOX2, window_params::box
rts
.endproc