disasm: volume icon clipping

This commit is contained in:
Joshua Bell 2019-01-25 18:29:42 -08:00
parent 63de8287a7
commit c2f58620e5

View File

@ -1572,7 +1572,9 @@ L9F8F: return #1
icon_flags: ; bit 7 = highlighted, bit 6 = volume icon icon_flags: ; bit 7 = highlighted, bit 6 = volume icon
.byte 0 .byte 0
more_drawing_needed_flag: .byte 0 more_drawing_needed_flag:
.byte 0
L9F94: .byte 0 L9F94: .byte 0
.byte 0 .byte 0
.byte 0 .byte 0
@ -2321,7 +2323,7 @@ LA5CB: pla
;;; ============================================================ ;;; ============================================================
LA627: .word 0 LA627: .word 0 ; written but never read???
LA629: .word 0 LA629: .word 0
LA62B: DEFINE_POINT 0,0 LA62B: DEFINE_POINT 0,0
@ -2378,7 +2380,7 @@ done: MGTK_CALL MGTK::SetPortBits, portbits
.proc calc_window_intersections .proc calc_window_intersections
ptr := $06 ptr := $06
lda #0 ; immediately overwritten??? lda #0 ; BUG: immediately overwritten???
jmp start jmp start
;;; findwindow_params::window_id is used as first part of ;;; findwindow_params::window_id is used as first part of
@ -2410,53 +2412,67 @@ pt4: DEFINE_POINT 0,0,pt4
xcoord: .word 0 xcoord: .word 0
ycoord: .word 0 ycoord: .word 0
start: lda more_drawing_needed_flag ;; Viewport/Cliprect to adjust
beq LA6FA vx := portbits::viewloc::xcoord
vy := portbits::viewloc::ycoord
cr_l := portbits::cliprect::x1
cr_t := portbits::cliprect::y1
cr_r := portbits::cliprect::x2
cr_b := portbits::cliprect::y2
;; portbits::cliprect::x1 = portbits::viewloc::xcoord = porbits::cliprect::x2 start: lda more_drawing_needed_flag
lda portbits::cliprect::x2 beq reclip
;; --------------------------------------------------
;; Re-entry - pick up where we left off
;; cr_l = cr_r
;; vx = cr_r
lda cr_r
clc clc
adc #1 adc #1
sta portbits::cliprect::x1 sta cr_l
sta portbits::viewloc::xcoord sta vx
lda portbits::cliprect::x2+1 lda cr_r+1
adc #0 adc #0
sta portbits::cliprect::x1+1 sta cr_l+1
sta portbits::viewloc::xcoord+1 sta vx+1
;; ??? ;; cr_t = LA629
COPY_BYTES 6, LA629, portbits::cliprect::y1 ;; cr_r = LA62B::xcoord
;; cr_b = LA62B::ycoord
COPY_BYTES 6, LA629, cr_t
;; ??? ;; vy = cr_t
copy16 portbits::cliprect::y1, portbits::viewloc::ycoord copy16 cr_t, vy
;; Corners of bounding rect (clockwise from upper-left) ;; Corners of bounding rect (clockwise from upper-left)
;; pt1::xcoord = pt4::xcoord = portbits::cliprect::x1 ;; pt1::xcoord = pt4::xcoord = cr_l
;; pt1::ycoord = pt2::ycoord = portbits::cliprect::y1 ;; pt1::ycoord = pt2::ycoord = cr_t
;; pt2::xcoord = pt3::xcoord = portbits::cliprect::x2 ;; pt2::xcoord = pt3::xcoord = cr_r
;; pt3::ycoord = pt4::ycoord = portbits::cliprect::y2 ;; pt3::ycoord = pt4::ycoord = cr_b
LA6FA: lda portbits::cliprect::x1 reclip: lda cr_l
sta pt1::xcoord sta pt1::xcoord
sta pt4::xcoord sta pt4::xcoord
lda portbits::cliprect::x1+1 lda cr_l+1
sta pt1::xcoord+1 sta pt1::xcoord+1
sta pt4::xcoord+1 sta pt4::xcoord+1
lda portbits::cliprect::y1 lda cr_t
sta pt1::ycoord sta pt1::ycoord
sta pt2::ycoord sta pt2::ycoord
lda portbits::cliprect::y1+1 lda cr_t+1
sta pt1::ycoord+1 sta pt1::ycoord+1
sta pt2::ycoord+1 sta pt2::ycoord+1
lda portbits::cliprect::x2 lda cr_r
sta pt2::xcoord sta pt2::xcoord
sta pt3::xcoord sta pt3::xcoord
lda portbits::cliprect::x2+1 lda cr_r+1
sta pt2::xcoord+1 sta pt2::xcoord+1
sta pt3::xcoord+1 sta pt3::xcoord+1
lda portbits::cliprect::y2 lda cr_b
sta pt3::ycoord sta pt3::ycoord
sta pt4::ycoord sta pt4::ycoord
lda portbits::cliprect::y2+1 lda cr_b+1
sta pt3::ycoord+1 sta pt3::ycoord+1
sta pt4::ycoord+1 sta pt4::ycoord+1
@ -2477,10 +2493,10 @@ next_pt:
set_bits: set_bits:
MGTK_CALL MGTK::SetPortBits, portbits MGTK_CALL MGTK::SetPortBits, portbits
;; if (cliprect::x2 < LA62B) more drawing is needed ;; if (cliprect::x2 < LA62B) more drawing is needed
lda portbits::cliprect::x2+1 lda cr_r+1
cmp LA62B+1 cmp LA62B+1
bne :+ bne :+
lda portbits::cliprect::x2 lda cr_r
cmp LA62B cmp LA62B
bcc :+ bcc :+
copy #0, more_drawing_needed_flag copy #0, more_drawing_needed_flag
@ -2515,7 +2531,13 @@ do_pt: lda pt_num
MGTK_CALL MGTK::GetWinPort, getwinport_params MGTK_CALL MGTK::GetWinPort, getwinport_params
;; -------------------------------------------------- ;; --------------------------------------------------
;; Compute window bounds (including non-content area) ;; Compute window edges (including non-content area)
;; Window edges
win_l := icon_grafport::viewloc::xcoord
win_t := icon_grafport::viewloc::ycoord
win_r := xcoord
win_b := ycoord
jsr push_pointers jsr push_pointers
@ -2542,23 +2564,29 @@ do_pt: lda pt_num
lsr a lsr a
ora scrollbar_flags ora scrollbar_flags
sta scrollbar_flags sta scrollbar_flags
sub16 icon_grafport::viewloc::xcoord, #2, icon_grafport::viewloc::xcoord
;; win_l -= 2
;; icon_grafport::cliprect::x1 -= 2
sub16 win_l, #2, win_l
sub16 icon_grafport::cliprect::x1, #2, icon_grafport::cliprect::x1 sub16 icon_grafport::cliprect::x1, #2, icon_grafport::cliprect::x1
kTitleBarHeight = 14
kScrollBarWidth = 20
kScrollBarHeight = 12
;; -------------------------------------------------- ;; --------------------------------------------------
;; Adjust window rect to account for title bar ;; Adjust window rect to account for title bar
;; Is dialog? (i.e. no title bar) ;; Is dialog? (i.e. no title bar)
bit dialogbox_flag bit dialogbox_flag
bmi check_scrollbars bmi check_scrollbars
;; viewloc::ycoord -= 14 ;; viewloc::ycoord -= 14
lda icon_grafport::viewloc::ycoord lda win_t
sec sec
sbc #14 sbc #14
sta icon_grafport::viewloc::ycoord sta win_t
bcs :+ bcs :+
dec icon_grafport::viewloc::ycoord+1 dec win_t+1
: :
;; cliprect::y1 -= 14 ;; cliprect::y1 -= 14
@ -2578,10 +2606,10 @@ check_scrollbars:
bit scrollbar_flags bit scrollbar_flags
bpl :+ bpl :+
;; cliprect::y2 += 12 ;; cliprect::y2 += kScrollBarHeight
lda icon_grafport::cliprect::y2 lda icon_grafport::cliprect::y2
clc clc
adc #12 adc #kScrollBarHeight
sta icon_grafport::cliprect::y2 sta icon_grafport::cliprect::y2
bcc :+ bcc :+
inc icon_grafport::cliprect::y2+1 inc icon_grafport::cliprect::y2+1
@ -2590,10 +2618,10 @@ check_scrollbars:
: bit scrollbar_flags : bit scrollbar_flags
bvc :+ bvc :+
;; cliprect::x2 += 20 ;; cliprect::x2 += kScrollBarWidth
lda icon_grafport::cliprect::x2 lda icon_grafport::cliprect::x2
clc clc
adc #20 adc #kScrollBarWidth
sta icon_grafport::cliprect::x2 sta icon_grafport::cliprect::x2
bcc :+ bcc :+
inc icon_grafport::cliprect::x2+1 inc icon_grafport::cliprect::x2+1
@ -2602,81 +2630,76 @@ check_scrollbars:
;; -------------------------------------------------- ;; --------------------------------------------------
;; xcoord = cliprect::x2 - cliprect::x1 ;; win_r = cliprect::x2 - cliprect::x1
sub16 icon_grafport::cliprect::x2, icon_grafport::cliprect::x1, xcoord sub16 icon_grafport::cliprect::x2, icon_grafport::cliprect::x1, win_r
;; ycoord = cliprect::y2 - cliprect::y1 ;; win_b = cliprect::y2 - cliprect::y1
sub16 icon_grafport::cliprect::y2, icon_grafport::cliprect::y1, ycoord sub16 icon_grafport::cliprect::y2, icon_grafport::cliprect::y1, win_b
;; xcoord += viewloc::xcoord ;; win_r += viewloc::xcoord
lda xcoord lda win_r
clc clc
adc icon_grafport::viewloc::xcoord adc win_l
sta xcoord sta win_r
lda icon_grafport::viewloc::xcoord+1 lda win_l+1
adc xcoord+1 adc win_r+1
sta xcoord+1 sta win_r+1
;; ycoord += viewloc::ycoord ;; win_b += viewloc::ycoord
add16 ycoord, icon_grafport::viewloc::ycoord, ycoord add16 win_b, icon_grafport::viewloc::ycoord, win_b
;; ================================================== ;; ==================================================
;; ;; At this point, win_r/t/l/b are the window edges
;; At this point, xcoord,ycoord is the bottom-right corner
;; of the window, and viewloc is the top-left corner.
;;
;; --------------------------------------------------
win_l := icon_grafport::viewloc::xcoord ;; if (cr_r > win_r)
win_t := icon_grafport::viewloc::ycoord ;; cr_r = win_r + 1
win_r := xcoord cmp16 cr_r, win_r
win_b := ycoord
;; if (cliprect::x2 < win_r) cliprect::x2 = win_r + 1
cmp16 portbits::cliprect::x2, win_r
bmi :+ bmi :+
add16 win_r, #1, portbits::cliprect::x2 add16 win_r, #1, cr_r
jmp LA8D4 jmp LA8D4
;; if (win_l < cliprect::x1) cliprect::x2 = win_l ;; if (win_l > cr_l)
: cmp16 win_l, portbits::cliprect::x1 ;; cr_r = win_l
: cmp16 win_l, cr_l
bmi LA8D4 bmi LA8D4
copy16 win_l, portbits::cliprect::x2 copy16 win_l, cr_r
jmp LA6FA jmp reclip
;; if (win_t < cliprect::y1) ;; if (win_t > cr_t)
LA8D4: cmp16 win_t, portbits::cliprect::y1 ;; cr_b = win_t
LA8D4: cmp16 win_t, cr_t
bmi :+ bmi :+
;; cliprect::y2 = win_t copy16 win_t, cr_b
copy16 win_t, portbits::cliprect::y2
copy #1, more_drawing_needed_flag copy #1, more_drawing_needed_flag
jmp LA6FA jmp reclip
;; if (win_b > portbits::cliprect::y2) ;; if (win_b < cr_b)
: cmp16 win_b, portbits::cliprect::y2 ;; cr_t = win_b + 2
;; vy = win_b + 2
: cmp16 win_b, cr_b
bpl LA923 bpl LA923
;; portbits::cliprect::y1 = portbits::viewloc::ycoord = win_b + 2
lda win_b lda win_b
clc clc
adc #2 adc #2
sta portbits::cliprect::y1 sta cr_t
sta portbits::viewloc::ycoord sta vy
lda ycoord+1 lda win_b+1
adc #0 adc #0
sta portbits::cliprect::y1+1 sta cr_t+1
sta portbits::viewloc::ycoord+1 sta vy+1
copy #1, more_drawing_needed_flag copy #1, more_drawing_needed_flag
jmp LA6FA jmp reclip
;; portbits::cliprect::x1 = portview::viewloc::xcoord = portbits::cliprect::x2 ;; cr_l = cr_r
LA923: lda portbits::cliprect::x2 ;; vx = cr_r
sta portbits::cliprect::x1 LA923: lda cr_r
sta portbits::viewloc::xcoord sta cr_l
lda portbits::cliprect::x2+1 sta vx
sta portbits::cliprect::x1+1 lda cr_r+1
sta portbits::viewloc::xcoord+1 sta cr_l+1
sta vx+1
jmp set_bits jmp set_bits
.endproc .endproc