DeskTop internal calls

This commit is contained in:
Joshua Bell 2018-05-24 21:35:22 -07:00
parent 06eb536f08
commit 2d835585c0
3 changed files with 71 additions and 41 deletions

View File

@ -57,8 +57,8 @@ DESKTOP := $8E00
DT_ADD_ICON := $01 ; { .addr icondata } DT_ADD_ICON := $01 ; { .addr icondata }
DT_HIGHLIGHT_ICON := $02 ; { .byte icon } DT_HIGHLIGHT_ICON := $02 ; { .byte icon }
DT_REDRAW_ICON := $03 ; { .addr icondata } DT_REDRAW_ICON := $03 ; { .byte icon }
DT_UNHIGHLIGHT_ICON2 := $04 ; { .byte icon } DT_UNHIGHLIGHT_ICON := $04 ; { .byte icon }
;; $05 ??? ;; $05 ???
DT_UNHIGHLIGHT_ALL := $06 DT_UNHIGHLIGHT_ALL := $06
DT_CLOSE_WINDOW := $07 ; { .byte window_id } DT_CLOSE_WINDOW := $07 ; { .byte window_id }

View File

@ -239,8 +239,8 @@ desktop_jump_table:
.addr ADD_ICON_IMPL .addr ADD_ICON_IMPL
.addr HIGHLIGHT_ICON_IMPL .addr HIGHLIGHT_ICON_IMPL
.addr REDRAW_ICON_IMPL .addr REDRAW_ICON_IMPL
.addr UNHIGHLIGHT_ICON2_IMPL .addr UNHIGHLIGHT_ICON_IMPL
.addr L95A2 ; $05 .addr HIGHLIGHT_ALL_IMPL
.addr UNHIGHLIGHT_ALL_IMPL .addr UNHIGHLIGHT_ALL_IMPL
.addr CLOSE_WINDOW_IMPL .addr CLOSE_WINDOW_IMPL
.addr GET_HIGHLIGHTED_IMPL .addr GET_HIGHLIGHTED_IMPL
@ -324,10 +324,12 @@ ycoord: .word 0
;;; ADD_ICON IMPL ;;; ADD_ICON IMPL
.proc ADD_ICON_IMPL .proc ADD_ICON_IMPL
ptr := $6 PARAM_BLOCK params, $06
ptr_icon: .addr 0
END_PARAM_BLOCK
ldy #0 ldy #0
lda (ptr),y lda (params::ptr_icon),y
ldx num_icons ldx num_icons
beq proceed beq proceed
dex dex
@ -343,7 +345,7 @@ proceed:
jsr L9F98 jsr L9F98
lda #1 lda #1
tay tay
sta (ptr),y sta (params::ptr_icon),y
return #0 return #0
sub: ldx num_icons ; ??? sub: ldx num_icons ; ???
@ -351,7 +353,7 @@ sub: ldx num_icons ; ???
inc num_icons inc num_icons
asl a asl a
tax tax
copy16 ptr, icon_ptrs,x copy16 params::ptr_icon, icon_ptrs,x
rts rts
.endproc .endproc
@ -359,11 +361,16 @@ sub: ldx num_icons ; ???
;;; HIGHLIGHT_ICON IMPL ;;; HIGHLIGHT_ICON IMPL
.proc HIGHLIGHT_ICON_IMPL .proc HIGHLIGHT_ICON_IMPL
PARAM_BLOCK params, $06
ptr_icon: .addr 0
END_PARAM_BLOCK
ptr := $06 ; Overwrites param
ldx num_icons ldx num_icons
beq bail1 beq bail1
dex dex
ldy #0 ldy #0
lda ($06),y lda (params::ptr_icon),y
L945E: cmp icon_table,x L945E: cmp icon_table,x
beq L9469 beq L9469
dex dex
@ -373,9 +380,9 @@ bail1: return #1 ; Not found
L9469: asl a L9469: asl a
tax tax
copy16 icon_ptrs,x, $06 copy16 icon_ptrs,x, ptr
ldy #icon_entry_offset_state ldy #icon_entry_offset_state
lda ($06),y lda (ptr),y
bne L947E ; Already set ??? Routine semantics are incorrect ??? bne L947E ; Already set ??? Routine semantics are incorrect ???
return #2 return #2
@ -384,7 +391,7 @@ L947E: lda has_highlight
;; Already in highlight list? ;; Already in highlight list?
dey dey
lda ($06),y lda (ptr),y
ldx highlight_count ldx highlight_count
dex dex
L948A: cmp highlight_list,x L948A: cmp highlight_list,x
@ -401,15 +408,15 @@ L9498: lda #1
;; Append to highlight list ;; Append to highlight list
L949D: ldx highlight_count L949D: ldx highlight_count
ldy #0 ldy #0
lda ($06),y lda (ptr),y
sta highlight_list,x sta highlight_list,x
inc highlight_count inc highlight_count
lda ($06),y ; icon num lda (ptr),y ; icon num
ldx #1 ; new position ldx #1 ; new position
jsr change_highlight_index jsr change_highlight_index
ldy #0 ldy #0
lda ($06),y lda (ptr),y
ldx #1 ldx #1
jsr LA2E3 jsr LA2E3
jsr L9F9F jsr L9F9F
@ -420,14 +427,17 @@ L949D: ldx highlight_count
;;; REDRAW_ICON IMPL ;;; REDRAW_ICON IMPL
.proc REDRAW_ICON_IMPL .proc REDRAW_ICON_IMPL
ptr := $06 PARAM_BLOCK params, $06
ptr_icon: .addr 0
END_PARAM_BLOCK
ptr := $06 ; Overwrites param
;; Find icon by number ;; Find icon by number
ldx num_icons ldx num_icons
beq bail1 beq bail1
dex dex
ldy #0 ldy #0
lda (ptr),y lda (params::ptr_icon),y
: cmp icon_table,x : cmp icon_table,x
beq found beq found
dex dex
@ -464,17 +474,20 @@ done: jsr L9F98
.endproc .endproc
;;; ============================================================ ;;; ============================================================
;;; UNHIGHLIGHT_ICON2 IMPL ;;; UNHIGHLIGHT_ICON IMPL
.proc UNHIGHLIGHT_ICON2_IMPL .proc UNHIGHLIGHT_ICON_IMPL
ptr := $6 PARAM_BLOCK params, $06
ptr_icon: .addr 0
END_PARAM_BLOCK
ptr := $06 ; Overwrites param
;; Find icon by number ;; Find icon by number
ldy #0 ldy #0
ldx num_icons ldx num_icons
beq bail1 beq bail1
dex dex
lda (ptr),y lda (params::ptr_icon),y
: cmp icon_table,x : cmp icon_table,x
beq found beq found
dex dex
@ -551,14 +564,23 @@ done: return #0 ; Unhighlighted
.endproc .endproc
;;; ============================================================ ;;; ============================================================
;;; HIGHLIGHT_ALL IMPL
;;; DESKTOP $05 IMPL ;;; Highlight all icons in the specified window.
;;; (Unused?)
.proc L95A2 .proc HIGHLIGHT_ALL_IMPL
jmp start jmp start
PARAM_BLOCK params, $06
ptr_window_id: .addr 0
END_PARAM_BLOCK
ptr := $08
;; DT_HIGHLIGHT_ICON params ;; DT_HIGHLIGHT_ICON params
icon: .byte 0 icon: .byte 0
buffer: .res 127, 0 buffer: .res 127, 0
start: lda HIGHLIGHT_ICON_IMPL ; ??? start: lda HIGHLIGHT_ICON_IMPL ; ???
@ -569,8 +591,8 @@ start: lda HIGHLIGHT_ICON_IMPL ; ???
jmp start jmp start
start2: start2:
;; zero out buffer ;; Zero out buffer
ldx #$7E ldx #$7E ; 127 icons
lda #0 lda #0
: sta buffer,x : sta buffer,x
dex dex
@ -578,40 +600,48 @@ start2:
ldx #0 ldx #0
stx icon stx icon
L9648: lda icon_table,x ;; Walk through icons, find ones in the same window
;; as the entry at ($06).
loop: lda icon_table,x
asl a asl a
tay tay
copy16 icon_ptrs,y, $08 copy16 icon_ptrs,y, ptr
ldy #icon_entry_offset_win_type ldy #icon_entry_offset_win_type
lda ($08),y lda (ptr),y
and #icon_entry_winid_mask and #icon_entry_winid_mask
ldy #0 ldy #0
cmp ($06),y cmp (params::ptr_window_id),y
bne L9670 bne :+
;; Append icon number to buffer.
ldy #0 ldy #0
lda ($08),y lda (ptr),y
ldy icon ldy icon
sta buffer,y sta buffer,y
inc icon inc icon
L9670: inx
: inx
cpx num_icons cpx num_icons
bne L9648 bne loop
ldx #0 ldx #0
txa txa
pha pha
L967A: lda buffer,x
bne L9681 ;; Highlight all the icons.
loop2: lda buffer,x
bne :+
pla pla
rts rts
L9681: sta icon : sta icon
DESKTOP_DIRECT_CALL DT_HIGHLIGHT_ICON, icon DESKTOP_DIRECT_CALL DT_HIGHLIGHT_ICON, icon
pla pla
tax tax
inx inx
txa txa
pha pha
jmp L967A jmp loop2
.endproc .endproc
;;; ============================================================ ;;; ============================================================
@ -641,7 +671,7 @@ L969D: ldx L9696
ldy #0 ldy #0
cmp ($06),y cmp ($06),y
bne L969D bne L969D
DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON2, L9695 DESKTOP_DIRECT_CALL DT_UNHIGHLIGHT_ICON, L9695
jmp L969D jmp L969D
L96CF: return #0 L96CF: return #0
.endproc .endproc

View File

@ -3142,7 +3142,7 @@ L5916: lda cached_window_icon_list,x
sta icon_param sta icon_param
lda #$00 lda #$00
sta cached_window_icon_list,x sta cached_window_icon_list,x
DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON2, icon_param DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON, icon_param
lda icon_param lda icon_param
jsr DESKTOP_FREE_ICON jsr DESKTOP_FREE_ICON
dec cached_window_icon_count dec cached_window_icon_count
@ -3289,7 +3289,7 @@ L5A4C: jsr redraw_windows_and_desktop
lda icon_param lda icon_param
jsr DESKTOP_FREE_ICON jsr DESKTOP_FREE_ICON
jsr reset_grafport3 jsr reset_grafport3
DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON2, icon_param DESKTOP_RELAY_CALL DT_UNHIGHLIGHT_ICON, icon_param
L5A7F: lda cached_window_icon_count L5A7F: lda cached_window_icon_count
sta L5AC6 sta L5AC6
inc cached_window_icon_count inc cached_window_icon_count