Date: Identify SET_LINE_WIDTH call, thickness and pattern params for window state

This commit is contained in:
Joshua Bell 2017-09-13 20:09:36 -07:00
parent cc82e3a1f0
commit 40026a0f46
9 changed files with 131 additions and 93 deletions

View File

@ -1,8 +1,8 @@
Disassembly of the desk accessories:
* [Show Text File](show_text_file.s) - in progress! 90% complete
* [Show Text File](show_text_file.s) - in progress! 75% complete
* [Calculator](calculator.s) - in progress! 90% complete
* [Date](date.s) - in progress! 50% complete
* [Date](date.s) - in progress! 95% complete
* [Puzzle](puzzle.s) - in progress! 75% complete
* Sort Directory - _not started_

View File

@ -55,12 +55,13 @@ A2D_QUERY_SCREEN := $03 ; Get screen info
;; .word width 560-1
;; .word height 192-1
;; -- next part is ???
;; .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ???
;; .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ??? pattern + ?
;; .byte 0,0,0,0 ???
;; .byte 1,1,0,$7F,0,$88
;; .byte 1,1,0,$7F,0,$88 line w,h, ???
A2D_SET_BOX1 := $04 ; Not sure what BOX1 vs. BOX2 is for
;; (input length 36 bytes)
;; (first bit is like SET_BOX2, think rest is full draw state)
A2D_SET_BOX2 := $06 ; set vs. intersect? (not quite)
;; (input length 16 bytes)
;; .word left pixels from screen edge
@ -80,8 +81,10 @@ A2D_SET_PATTERN := $08
;; (input length 8 bytes)
;; .byte r0...r7 8x8 pixel pattern for A2D_FILL_RECT calls
;; $0A used in Date
A2D_SET_LINE_WIDTH := $0A
;; (input length 2 bytes)
;; .byte hthick horizontal pen thickness
;; .byte vthick vertical pen thickness
A2D_UNK_0C := $0C ; Unknown - used in calculator
;; (input length 1 byte)
@ -178,17 +181,17 @@ A2D_CREATE_WINDOW := $38
;; .addr title
;; .byte hscroll bits: 7 = enable, 6 = show thumb, 0 = show track
;; .byte vscroll
;; .byte hscroll_max
;; .byte hscroll_pos
;; .byte vscroll_max
;; .byte vscroll_pos
;; .byte hsmax
;; .byte hspos
;; .byte vsmax
;; .byte vspos
;; .byte ???
;; .byte ???
;; .word width_a ??? possibly size of scroll area within window of scroll area?
;; .word height_a ???
;; .word width_b (of scroll area?)
;; .word height_b (of scroll area?)
;; - next section is identical to that for A2D_SET_BOX
;; - next section is identical to that for A2D_SET_BOX1
;; .word left pixels from screen edge
;; .word top
;; .word screen_addr
@ -197,6 +200,11 @@ A2D_CREATE_WINDOW := $38
;; .word voffset
;; .word width pixels
;; .word height
;; .byte pattern (8 bytes)
;; .byte $FF,$00,$00,$00,$00,$00 ???
;; .byte hthick
;; .byte vthick
;; .byte $00,$7F,$00,$88,$00,$00 ???
A2D_DESTROY_WINDOW := $39
;; (input length 1 byte)

View File

@ -8,8 +8,6 @@
.include "a2d.inc"
L0020 := $0020
adjust_txtptr := $B1
ROMIN2 := $C082
@ -740,10 +738,10 @@ hs_pos: .byte 0
vs_max: .byte 0
vs_pos: .byte 0
.byte 0,0 ; ???
width_a: .word window_width
height_a:.word window_height
width_b: .word window_width
height_b:.word window_height
w1: .word window_width
h1: .word window_height
w2: .word window_width
h2: .word window_height
left: .word default_left
top: .word default_top
.word A2D_SCREEN_ADDR
@ -752,17 +750,21 @@ hoffset:.word 0
voffset:.word 0
width: .word window_width
height: .word window_height
.endproc
create_window_params_top := create_window_params::top
;; ???
;; Same as latter part of box_params block after QUERY_SCREEN call fills it in
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
pattern:.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF
.byte $00,$00
.byte $00,$00,$00,$01,$01,$00,$7F,$00
.byte $00,$00,$00
hthick: .byte 1
vthick: .byte 1
.byte $00,$7F,$00
.byte $88,$00
.byte $00
.endproc
create_window_params_top := create_window_params::top
title: PASCAL_STRING "Calc"

View File

@ -203,17 +203,17 @@ spaces_string:
A2D_DEFSTRING " "
day_pos:
.word $2B,$1E
.word 43, 30
day_string:
A2D_DEFSTRING " "
month_pos:
.word $57,$1E
.word 87, 30
month_string:
A2D_DEFSTRING " "
year_pos:
.word $85,$1E
.word 133, 30
year_string:
A2D_DEFSTRING " "
@ -259,7 +259,7 @@ mode: .byte $02 ; this should be normal, but we do inverts ???
.proc create_window_params
id: .byte window_id
flags: .byte $01
flags: .byte A2D_CWF_NOTITLE
title: .addr 0
hscroll:.byte 0
vscroll:.byte 0
@ -282,11 +282,12 @@ voff: .word 0
width: .word $C7
height: .word $40
.endproc
.endproc
;; ???
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $FF,$00,$00,$00,$00,$00,$04,$02
pattern:.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $FF,$00,$00,$00,$00,$00
hthick: .byte 4
vthick: .byte 2
.byte $00,$7F,$00,$88,$00,$00
.endproc
;;; ==================================================
;;; Initialize window, unpack the date.
@ -320,7 +321,7 @@ init_window:
A2D_CALL A2D_CREATE_WINDOW, create_window_params
lda #0
sta selected_field
jsr L0CF0
jsr draw_window
A2D_CALL $2B
;; fall through
@ -332,7 +333,7 @@ init_window:
lda get_input_params::state
cmp #A2D_INPUT_DOWN
bne :+
jsr L0A45
jsr on_click
jmp input_loop
: cmp #A2D_INPUT_KEY
@ -398,7 +399,7 @@ update_selection:
;;; ==================================================
.proc L0A45
.proc on_click
A2D_CALL A2D_QUERY_TARGET, get_input_params::xcoord
A2D_CALL A2D_SET_FILL_MODE, fill_mode_params
A2D_CALL A2D_SET_PATTERN, white_pattern
@ -406,10 +407,10 @@ update_selection:
cmp #window_id
bne miss
lda query_target_params::element
bne L0A64
bne hit
miss: rts
L0A64: cmp #A2D_ELEM_CLIENT
hit: cmp #A2D_ELEM_CLIENT
bne miss
jsr find_hit_target
cpx #0
@ -776,15 +777,18 @@ label_uparrow_pos:
label_downarrow_pos:
.word $AC,$27
;; Params for $0A call
L0CEE: .byte $01,$01
.proc line_width_params
hthick: .byte 1
vthick: .byte 1
.endproc
;;; ==================================================
;;; Render the window contents
L0CF0: A2D_CALL A2D_SET_BOX1, create_window_params::box
draw_window:
A2D_CALL A2D_SET_BOX1, create_window_params::box
A2D_CALL A2D_DRAW_RECT, border_rect
A2D_CALL $0A, L0CEE ; ????
A2D_CALL A2D_SET_LINE_WIDTH, line_width_params
A2D_CALL A2D_DRAW_RECT, date_rect
A2D_CALL A2D_DRAW_RECT, ok_button_rect
A2D_CALL A2D_DRAW_RECT, cancel_button_rect

View File

@ -14,14 +14,27 @@ function verify {
|| (tput setaf 1 ; tput blink ; echo -e "DIFF $1 BAD" ; tput sgr0 ; return 1)
}
function stats {
echo "$1: "$(res/stats.pl < "$1")
}
#do_make clean
do_make all
# Verify original and output match
echo "Verifying diffs:"
verify "calculator"
verify "show_text_file"
verify "date"
verify "puzzle"
echo "Unidentified symbols:"
stats "calculator.s"
stats "show_text_file.s"
stats "date.s"
stats "puzzle.s"
cat show_image_file.F1 > mount/SHOW.IMAGE.FILE.\$F1 \
&& echo "Updated mountable file"

View File

@ -610,13 +610,17 @@ voffset:.word 0
width: .word default_width
height: .word default_height
;; This is QUERY_BOX/SET_BOX cruft
.byte $FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$00
.byte $00,$00,$00,$00,$01,$01,$00,$7F
pattern:.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$00
.byte $00,$00,$00,$00
hthick: .byte 1
vthick: .byte 1
.byte $00,$7F
.byte $00,$88
.byte $00,$00
;; This is QUERY_BOX/SET_BOX cruft only below
.word default_left
.word default_top
.addr A2D_SCREEN_ADDR
@ -624,9 +628,12 @@ height: .word default_height
.byte $00,$00,$00,$00
.word default_width
.word default_height
.byte $FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$00,$00,$00
.byte $00,$00,$01,$01,$00,$7F,$00,$88
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$00,$00,$00
.byte $00,$00
.byte 1
.byte 1
.byte $00,$7F,$00,$88
.byte $00,$00
.endproc

13
desk.acc/res/stats.pl Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env perl
use strict;
use warnings;
my %terms;
while (<STDIN>) {
foreach my $term (split /\b/, $_) {
$terms{$term} = 1 if $term =~ /^L[0-9A-F]{4}$/;
}
}
print scalar(keys %terms), "\n";

View File

@ -223,18 +223,11 @@ title: .addr window_title
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_NOSCROLL
hscroll_max:
.byte 32
hscroll_pos:
.byte 0
vscroll_max:
.byte 32
vscroll_pos:
.byte 0
;; ???
.byte 0, 0
hsmax: .byte 32
hspos: .byte 0
vsmax: .byte 32
vspos: .byte 0
.byte 0, 0 ; ???
widtha: .word default_width
heighta:.word default_height
widthb: .word default_width
@ -249,13 +242,14 @@ hoffset:.word 0 ; Also used for A2D_CLEAR_BOX
voffset:.word 0
width: .word default_width
height: .word default_height
.endproc
.endproc
;; unused?
.byte $00,$00,$00,$00,$00,$00,$00
.byte $00,$FF,$00,$00,$00,$00,$00,$01
.byte $01,$00,$7F,$00,$88,$00,$00
pattern:.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $FF,$00,$00,$00,$00,$00
hthick: .byte 1
vthick: .byte 1
.byte $00,$7F,$00,$88,$00,$00
.endproc
.proc init

View File

@ -312,14 +312,10 @@ title: .addr $1000 ; overwritten to point at filename
hscroll:.byte A2D_CWS_NOSCROLL
vscroll:.byte A2D_CWS_SCROLL_NORMAL
hscroll_max:
.byte 32
hscroll_pos:
.byte 0
vscroll_max:
.byte 255
vscroll_pos:
.byte 0
hsmax: .byte 32
hspos: .byte 0
vsmax: .byte 255
vspos: .byte 0
;; ???
.byte $00,$00,$C8,$00,$33,$00
@ -336,13 +332,14 @@ hoffset:.word 0 ; Also used for A2D_FILL_RECT
voffset:.word 0
width: .word default_width
height: .word default_height
.endproc
.endproc
;; unused?
.byte $00,$00,$00,$00,$00,$00,$00
.byte $00,$FF,$00,$00,$00,$00,$00,$01
.byte $01,$00,$7F,$00,$88,$00,$00
pattern:.byte $00,$00,$00,$00,$00,$00,$00
.byte $00,$FF,$00,$00,$00,$00,$00
hthick: .byte 1
vthick: .byte 1
.byte $00,$7F,$00,$88,$00,$00
.endproc
;; gets copied over window_params::box after mode is drawn
.proc default_box
@ -483,7 +480,7 @@ end: rts
ldx $8801
sta RAMWRTOFF
loop: lda $8802,x
sta L10FD+2,x
sta call_jt15+2,x
dex
bne loop
sta RAMWRTON
@ -570,7 +567,7 @@ title: jsr on_title_bar_click
;;; This is dead code (no resize handle!) and may be buggy
.proc on_resize_click
A2D_CALL A2D_DRAG_RESIZE, resize_drag_params
jsr L10FD ; call $4015 on main
jsr call_jt15 ; call $4015 on main
jsr calc_window_size
max_width := default_width
@ -676,11 +673,11 @@ end: rts
.endproc
.proc on_vscroll_above_click
loop: lda window_params::vscroll_pos
loop: lda window_params::vspos
beq end
jsr calc_track_scroll_delta
sec
lda window_params::vscroll_pos
lda window_params::vspos
sbc track_scroll_delta
bcs store
lda #0 ; underflow
@ -691,7 +688,7 @@ end: rts
.endproc
.proc on_vscroll_up_click
loop : lda window_params::vscroll_pos
loop : lda window_params::vspos
beq end
sec
sbc #1
@ -704,12 +701,12 @@ end: rts
vscroll_max := $FA
.proc on_vscroll_below_click
loop: lda window_params::vscroll_pos
loop: lda window_params::vspos
cmp #vscroll_max ; pos == max ?
beq end
jsr calc_track_scroll_delta
clc
lda window_params::vscroll_pos
lda window_params::vspos
adc track_scroll_delta ; pos + delta
bcs overflow
cmp #vscroll_max+1 ; > max ?
@ -723,7 +720,7 @@ end: rts
.endproc
.proc on_vscroll_down_click
loop: lda window_params::vscroll_pos
loop: lda window_params::vspos
cmp #vscroll_max
beq end
clc
@ -803,7 +800,7 @@ end: rts
.proc on_hscroll_after_click
ldx #2
lda window_params::hscroll_max
lda window_params::hsmax
jmp hscroll_common
.endproc
@ -815,7 +812,7 @@ end: rts
.proc on_hscroll_right_click
ldx #1
lda window_params::hscroll_max
lda window_params::hsmax
jmp hscroll_common
.endproc
@ -828,23 +825,23 @@ end: rts
.proc hscroll_common
sta compare+1
stx delta+1
loop: lda window_params::hscroll_pos
loop: lda window_params::hspos
compare:cmp #$0A ; self-modified
bne continue
rts
continue:
clc
lda window_params::hscroll_pos
lda window_params::hspos
delta: adc #1 ; self-modified
bmi overflow
cmp window_params::hscroll_max
cmp window_params::hsmax
beq store
bcc store
lda window_params::hscroll_max
lda window_params::hsmax
jmp store
overflow:
lda #0
store: sta window_params::hscroll_pos
store: sta window_params::hspos
jsr L0D5E
jsr update_hscroll
jsr draw_content
@ -878,7 +875,7 @@ store: sta window_params::hscroll_pos
;;; only used from hscroll code?
.proc L0D5E
lda window_params::hscroll_pos
lda window_params::hspos
jsr mul_by_16
clc
lda $06
@ -963,7 +960,7 @@ end: rts
ror a ; check if low bit (track enabled) is set
bcc :+
jsr update_hscroll
: lda window_params::vscroll_pos
: lda window_params::vspos
sta update_scroll_params::pos
jsr update_vscroll
jsr draw_content
@ -1319,7 +1316,7 @@ loop: clc
rts
.endproc
.proc L10FD
.proc call_jt15
lda #<JUMP_TABLE_15
sta call_main_addr ; self-modified
lda #>JUMP_TABLE_15