Merge remote-tracking branch 'origin/disasm'

This commit is contained in:
Joshua Bell 2019-02-13 20:26:59 -08:00
commit 3770d0f24c

View File

@ -4418,12 +4418,12 @@ L638B: .byte 0
jsr L644C
sta L63E8
sub16_8 grafport2::cliprect::y1, L63E8, L63EA
cmp16 L63EA, L7B61
cmp16 L63EA, iconbb_rect+MGTK::Rect::y1
bmi L63C1
ldax L63EA
jmp L63C7
L63C1: ldax L7B61
L63C1: ldax iconbb_rect+MGTK::Rect::y1
L63C7: stax grafport2::cliprect::y1
add16_8 grafport2::cliprect::y1, L63E9, grafport2::cliprect::y2
jsr assign_active_window_cliprect
@ -4444,12 +4444,12 @@ L63EA: .word 0
jsr L644C
sta L6448
add16_8 grafport2::cliprect::y2, L6448, L644A
cmp16 L644A, L7B65
cmp16 L644A, iconbb_rect+MGTK::Rect::y2
bpl L6421
ldax L644A
jmp L6427
L6421: ldax L7B65
L6421: ldax iconbb_rect+MGTK::Rect::y2
L6427: stax grafport2::cliprect::y2
sub16_8 grafport2::cliprect::y2, L6449, grafport2::cliprect::y1
jsr assign_active_window_cliprect
@ -4476,12 +4476,12 @@ L644A: .word 0
jsr L650F
stax L64AC
sub16 grafport2::cliprect::x1, L64AC, L64AE
cmp16 L64AE, L7B5F
cmp16 L64AE, iconbb_rect+MGTK::Rect::x1
bmi L6484
ldax L64AE
jmp L648A
L6484: ldax L7B5F
L6484: ldax iconbb_rect+MGTK::Rect::x1
L648A: stax grafport2::cliprect::x1
add16 grafport2::cliprect::x1, L64AC, grafport2::cliprect::x2
jsr assign_active_window_cliprect
@ -4498,12 +4498,12 @@ L64AE: .word 0
jsr L650F
stax L650B
add16 grafport2::cliprect::x2, L650B, L650D
cmp16 L650D, L7B63
cmp16 L650D, iconbb_rect+MGTK::Rect::x2
bpl L64E3
ldax L650D
jmp L64E9
L64E3: ldax L7B63
L64E3: ldax iconbb_rect+MGTK::Rect::x2
L64E9: stax grafport2::cliprect::x2
sub16 grafport2::cliprect::x2, L650B, grafport2::cliprect::x1
jsr assign_active_window_cliprect
@ -4519,7 +4519,7 @@ L650D: .word 0
bmi :+
jsr cached_icons_window_to_screen
: jsr L6523
jsr L7B6B
jsr compute_icons_bbox
lda active_window_id
jmp L7D5D
.endproc
@ -4573,15 +4573,15 @@ L650D: .word 0
ldy #$06
lda ($06),y
tay
sub16 L7B63, L7B5F, L6602
sub16 iconbb_rect+MGTK::Rect::x2, iconbb_rect+MGTK::Rect::x1, L6602
sub16 L6602, L6600, L6602
lsr16 L6602
ldx L6602
sub16 grafport2::cliprect::x1, L7B5F, L6602
sub16 grafport2::cliprect::x1, iconbb_rect+MGTK::Rect::x1, L6602
bpl L65D0
lda #$00
beq L65EB
L65D0: cmp16 grafport2::cliprect::x2, L7B63
L65D0: cmp16 grafport2::cliprect::x2, iconbb_rect+MGTK::Rect::x2
bmi L65E2
tya
jmp L65EE
@ -4611,16 +4611,16 @@ L6602: .word 0
ldy #$08
lda ($06),y
tay
sub16 L7B65, L7B61, L66A0
sub16 iconbb_rect+MGTK::Rect::y2, iconbb_rect+MGTK::Rect::y1, L66A0
sub16_8 L66A0, L669F, L66A0
lsr16 L66A0
lsr16 L66A0
ldx L66A0
sub16 grafport2::cliprect::y1, L7B61, L66A0
sub16 grafport2::cliprect::y1, iconbb_rect+MGTK::Rect::y1, L66A0
bpl L6669
lda #$00
beq L668A
L6669: cmp16 grafport2::cliprect::y2, L7B65
L6669: cmp16 grafport2::cliprect::y2, iconbb_rect+MGTK::Rect::y2
bmi L667B
tya
jmp L668D
@ -5386,11 +5386,11 @@ L6DB0: .byte 0
dex
lda win_view_by_table,x
bmi :+
jsr L7B6B
jsr compute_icons_bbox
jmp config_port
: jsr cached_icons_window_to_screen
jsr L7B6B
jsr compute_icons_bbox
jsr cached_icons_screen_to_window
config_port:
@ -5398,9 +5398,9 @@ config_port:
jsr get_set_port2
;; check horizontal bounds
cmp16 L7B5F, grafport2::cliprect::x1
cmp16 iconbb_rect+MGTK::Rect::x1, grafport2::cliprect::x1
bmi activate_hscroll
cmp16 grafport2::cliprect::x2, L7B63
cmp16 grafport2::cliprect::x2, iconbb_rect+MGTK::Rect::x2
bmi activate_hscroll
;; deactivate horizontal scrollbar
@ -5423,9 +5423,9 @@ activate_hscroll:
check_vscroll:
;; check vertical bounds
cmp16 L7B61, grafport2::cliprect::y1
cmp16 iconbb_rect+MGTK::Rect::y1, grafport2::cliprect::y1
bmi activate_vscroll
cmp16 grafport2::cliprect::y2, L7B65
cmp16 grafport2::cliprect::y2, iconbb_rect+MGTK::Rect::y2
bmi activate_vscroll
;; deactivate vertical scrollbar
@ -6431,23 +6431,23 @@ L76BB: bit flag
jsr pop_pointers
rts
: jsr L7B6B
: jsr compute_icons_bbox
lda window_id
jsr window_lookup
stax $06
ldy #$16
lda L7B65
lda iconbb_rect+MGTK::Rect::y2
sec
sbc ($06),y
sta L7B65
lda L7B65+1
sta iconbb_rect+MGTK::Rect::y2
lda iconbb_rect+MGTK::Rect::y2+1
sbc #0
sta L7B65+1
cmp16 L7B63, #170
sta iconbb_rect+MGTK::Rect::y2+1
cmp16 iconbb_rect+MGTK::Rect::x2, #170
bmi L7705
cmp16 L7B63, #450
cmp16 iconbb_rect+MGTK::Rect::x2, #450
bpl L770C
ldax L7B63
ldax iconbb_rect+MGTK::Rect::x2
jmp L7710
L7705: addr_jump L7710, $00AA
@ -6459,11 +6459,11 @@ L7710: ldy #$20
iny
sta ($06),y
cmp16 L7B65, #50
cmp16 iconbb_rect+MGTK::Rect::y2, #50
bmi L7739
cmp16 L7B65, #108
cmp16 iconbb_rect+MGTK::Rect::y2, #108
bpl L7740
ldax L7B65
ldax iconbb_rect+MGTK::Rect::y2
jmp L7744
L7739: addr_jump L7744, $0032
@ -6925,30 +6925,40 @@ nonzero_flag: ; high bit set once a non-zero digit seen
.endproc ; int_to_string
;;; ============================================================
;;; Compute bounding box for icons within cached window
L7B5F: .word 0
L7B61: .word 0
iconbb_rect:
DEFINE_RECT 0,0,0,0,iconbb_rect
L7B63: .word 0
L7B65: .word 0
.proc compute_icons_bbox_impl
L7B67: .word 0
L7B69: .word 0
cur_icon_pos:
DEFINE_POINT 0,0,cur_icon_pos
.proc L7B6B
ldx #3
entry_ptr := $06
kIntMax = $7FFF
kPadTop = 15
kPadLeft = 50
kPadBottom = 32
kPadRight = 50
start: ldx #3
lda #0
: sta L7B63,x
: sta iconbb_rect::x2,x
dex
bpl :-
sta L7D5B
lda #<$7FFF
sta L7B5F
sta L7B61
lda #>$7FFF
sta L7B5F+1
sta L7B61+1
sta icon_num
lda #<kIntMax
sta iconbb_rect::x1
sta iconbb_rect+MGTK::Rect::y1
lda #>kIntMax
sta iconbb_rect::x1+1
sta iconbb_rect+MGTK::Rect::y1+1
ldx cached_window_id
dex
lda win_view_by_table,x
@ -6956,139 +6966,181 @@ L7B69: .word 0
lda cached_window_icon_count
bne L7BA1
L7B96: ldax #$0300
L7B9A: sta L7B5F,x
L7B9A: sta iconbb_rect::x1,x
dex
bpl L7B9A
rts
;; iconbb_rect::x2 = 360
;; iconbb_rect::y2 = (A + 2) * 8
L7BA1: clc
adc #2
ldx #0
stx L7D5C
stx hi
asl a
rol L7D5C
rol hi
asl a
rol L7D5C
rol hi
asl a
rol L7D5C
sta L7B65
lda L7D5C
sta L7B65+1
copy16 #360, L7B63
rol hi
sta iconbb_rect::y2
lda hi
sta iconbb_rect::y2+1
copy16 #360, iconbb_rect::x2
jmp L7B96
L7BCB: lda cached_window_icon_count
cmp #1
bne L7BEF
bne check_icon
;; First icon - copy coords
lda cached_window_icon_list
jsr icon_entry_lookup
stax $06
ldy #6
ldx #3
L7BE0: lda ($06),y
sta L7B5F,x
sta L7B63,x
stax entry_ptr
ldy #IconEntry::iconx+.sizeof(MGTK::Point)-1
ldx #.sizeof(MGTK::Point)-1
: lda (entry_ptr),y
sta iconbb_rect::x1,x
sta iconbb_rect::x2,x
dey
dex
bpl L7BE0
jmp L7BF7
bpl :-
L7BEF: lda L7D5B
jmp finish
check_icon:
lda icon_num
cmp cached_window_icon_count
bne L7C36
L7BF7: lda L7B63
bne more
finish: lda iconbb_rect::x2
clc
adc #50
sta L7B63
bcc L7C05
inc L7B63+1
L7C05: lda L7B65
adc #kPadRight
sta iconbb_rect::x2
bcc :+
inc iconbb_rect::x2+1
: lda iconbb_rect::y2
clc
adc #32
sta L7B65
bcc L7C13
inc L7B65+1
L7C13: sub16 L7B5F, #50, L7B5F
sub16 L7B61, #15, L7B61
adc #kPadBottom
sta iconbb_rect::y2
bcc :+
inc iconbb_rect::y2+1
: sub16 iconbb_rect::x1, #kPadLeft, iconbb_rect::x1
sub16 iconbb_rect::y1, #kPadTop, iconbb_rect::y1
rts
L7C36: tax
more: tax
lda cached_window_icon_list,x
jsr icon_entry_lookup
stax $06
stax entry_ptr
ldy #IconEntry::win_type
lda ($06),y
lda (entry_ptr),y
and #icon_entry_winid_mask
cmp L7D5C
bne L7C52
inc L7D5B
jmp L7BEF
cmp hi ; BUG: from old code that iterated all icons???
bne :+
inc icon_num
jmp check_icon
L7C52: ldy #6
ldx #3
L7C56: lda ($06),y
sta L7B67,x
: ldy #IconEntry::iconx+.sizeof(MGTK::Point)-1
ldx #.sizeof(MGTK::Point)-1
: lda (entry_ptr),y
sta cur_icon_pos::xcoord,x
dey
dex
bpl L7C56
bit L7B5F+1
bmi L7C88
bit L7B67+1
bmi L7CCE
cmp16 L7B67, L7B5F
bmi L7CCE
cmp16 L7B67, L7B63
bpl L7CBF
jmp L7CDA
bpl :-
L7C88: bit L7B67+1
bmi L7CA3
bit L7B63+1
bmi L7CDA
cmp16 L7B67, L7B63
bmi L7CDA
jmp L7CBF
;; --------------------------------------------------
;; Compare X coords
L7CA3: cmp16 L7B67, L7B5F
bmi L7CCE
cmp16 L7B67, L7B63
bmi L7CDA
L7CBF: copy16 L7B67, L7B63
jmp L7CDA
bit iconbb_rect::x1+1 ; negative?
bmi pt0x_neg
L7CCE: copy16 L7B67, L7B5F
L7CDA: bit L7B61+1
bmi L7D03
bit L7B69+1
bmi L7D49
cmp16 L7B69, L7B61
bmi L7D49
cmp16 L7B69, L7B65
bpl L7D3A
jmp L7D55
bit cur_icon_pos::xcoord+1
bmi adjust_pt0_x
L7D03: bit L7B69+1
bmi L7D1E
bit L7B65+1
bmi L7D55
cmp16 L7B69, L7B65
bmi L7D55
jmp L7D3A
;; X: cur and pt0 are positive
cmp16 cur_icon_pos::xcoord, iconbb_rect::x1
bmi adjust_pt0_x
cmp16 cur_icon_pos::xcoord, iconbb_rect::x2
bpl adjust_pt1_x
jmp compare_y
L7D1E: cmp16 L7B69, L7B61
bmi L7D49
cmp16 L7B69, L7B65
bmi L7D55
L7D3A: copy16 L7B69, L7B65
jmp L7D55
pt0x_neg:
bit cur_icon_pos::xcoord+1
bmi bothx_neg
L7D49: copy16 L7B69, L7B61
L7D55: inc L7D5B
jmp L7BEF
;; X: cur positive, pt0 negative
bit iconbb_rect::x2+1
bmi compare_y
cmp16 cur_icon_pos::xcoord, iconbb_rect::x2
bmi compare_y
jmp adjust_pt1_x
L7D5B: .byte 0
L7D5C: .byte 0
;; X: cur and pt0 are negative
bothx_neg:
cmp16 cur_icon_pos::xcoord, iconbb_rect::x1
bmi adjust_pt0_x
cmp16 cur_icon_pos::xcoord, iconbb_rect::x2
bmi compare_y
adjust_pt1_x:
copy16 cur_icon_pos::xcoord, iconbb_rect::x2
jmp compare_y
adjust_pt0_x:
copy16 cur_icon_pos::xcoord, iconbb_rect::x1
;; --------------------------------------------------
;; Compare Y coords
compare_y:
bit iconbb_rect::y1+1
bmi pt0y_neg
bit cur_icon_pos::ycoord+1
bmi adjust_pt0_y
;; Y: cur and pt0 are positive
cmp16 cur_icon_pos::ycoord, iconbb_rect::y1
bmi adjust_pt0_y
cmp16 cur_icon_pos::ycoord, iconbb_rect::y2
bpl adjust_pt1_y
jmp next
pt0y_neg:
bit cur_icon_pos::ycoord+1
bmi bothy_neg
;; Y: cur positive, pt0 negative
bit iconbb_rect::y2+1
bmi next
cmp16 cur_icon_pos::ycoord, iconbb_rect::y2
bmi next
jmp adjust_pt1_y
;; Y: cur and pt0 are negative
bothy_neg:
cmp16 cur_icon_pos::ycoord, iconbb_rect::y1
bmi adjust_pt0_y
cmp16 cur_icon_pos::ycoord, iconbb_rect::y2
bmi next
adjust_pt1_y:
copy16 cur_icon_pos::ycoord, iconbb_rect::y2
jmp next
adjust_pt0_y:
copy16 cur_icon_pos::ycoord, iconbb_rect::y1
next: inc icon_num
jmp check_icon
icon_num:
.byte 0
hi: .byte 0
.endproc
compute_icons_bbox := compute_icons_bbox_impl::start
;;; ============================================================
@ -8087,10 +8139,10 @@ L850E: sta L85F1
tay
lda ($06),y
pha
jsr L7B6B
jsr compute_icons_bbox
ldx L85F1
sub16 L7B63,x, L7B5F,x, L85F2
sub16 iconbb_rect::x2,x, iconbb_rect::x1,x, L85F2
ldx L85F1
@ -8118,10 +8170,10 @@ L8562: lsr16 L85F2
ldx L85F1
clc
adc L7B5F,x
adc iconbb_rect::x1,x
sta grafport2::cliprect::x1,x
lda L85F2
adc L7B5F+1,x
adc iconbb_rect::x1+1,x
sta grafport2::cliprect::x1+1,x
lda active_window_id