icon/window mapping WIP

This commit is contained in:
Joshua Bell 2018-02-07 21:36:53 -08:00
parent b13b1f56d3
commit 7bbdc4ac6b
2 changed files with 127 additions and 91 deletions

View File

@ -90,7 +90,7 @@ path_table := $DFB3 ; window address table
;; each entry is 65 bytes long ;; each entry is 65 bytes long
;; length-prefixed path string (no trailing /) ;; length-prefixed path string (no trailing /)
file_index := $DF22 ; index of selected file (global, not w/in window) file_index := $DF22 ; indexes of selected file (global, not w/in window, up to 127)
file_table := $DD9F ; file address table file_table := $DD9F ; file address table
;; each entry is 27 bytes long ;; each entry is 27 bytes long
;; .byte icon icon index ;; .byte icon icon index

View File

@ -194,7 +194,7 @@ L8672: pha
L867B: lda online_params_buffer L867B: lda online_params_buffer
beq L8672 beq L8672
jsr $8388 ; into dynamically loaded code??? jsr $8388 ; into dynamically loaded code???
jsr DESKTOP_FIND_SPACE ; AUX > MAIN call??? jsr DESKTOP_ALLOC_ICON ; AUX > MAIN call???
ldy L8738 ldy L8738
sta $D464,y sta $D464,y
asl a asl a
@ -290,7 +290,6 @@ L8737: .byte $60 ; file type ???
L8738: .byte $04 L8738: .byte $04
L8739: .byte $00,$00,$00,$00 L8739: .byte $00,$00,$00,$00
;; Desktop icon placements?
L873D: DEFINE_POINT 500, 16 L873D: DEFINE_POINT 500, 16
DEFINE_POINT 500, 41 DEFINE_POINT 500, 41
DEFINE_POINT 500, 66 DEFINE_POINT 500, 66
@ -4199,7 +4198,7 @@ addr: .addr 0
;;; Find first 0 in AUX $1F80 ... $1F7F; if present, ;;; Find first 0 in AUX $1F80 ... $1F7F; if present,
;;; mark it 1 and return index+1 in A ;;; mark it 1 and return index+1 in A
.proc DESKTOP_FIND_SPACE .proc DESKTOP_ALLOC_ICON
sta RAMRDON sta RAMRDON
sta RAMWRTON sta RAMWRTON
ldx #0 ldx #0
@ -4225,7 +4224,7 @@ loop: lda $1F80,x
;;; ================================================== ;;; ==================================================
;;; Zero the AUX $1F80 table entry in A ;;; Zero the AUX $1F80 table entry in A
.proc DESKTOP_FREE_SPACE .proc DESKTOP_FREE_ICON
tay tay
sta RAMRDON sta RAMRDON
sta RAMWRTON sta RAMWRTON
@ -5019,6 +5018,7 @@ LDD9E: .byte 0
icon_entry_offset_iconbits := 7 icon_entry_offset_iconbits := 7
icon_entry_offset_len := 9 icon_entry_offset_len := 9
icon_entry_offset_name := 10 icon_entry_offset_name := 10
icon_entry_name_bufsize := 17
icon_entry_size := 27 icon_entry_size := 27
;; Icon to File mapping table ;; Icon to File mapping table
@ -5043,12 +5043,19 @@ file_address_table:
.assert * = file_table, error, "Entry point mismatch" .assert * = file_table, error, "Entry point mismatch"
.res 256, 0 .res 256, 0
;;; Copy from aux memory of icon list for active window (0=desktop)
;; Used by DESKTOP_COPY_*_BUF ;; Used by DESKTOP_COPY_*_BUF
.assert * = bufnum, error, "Entry point mismatch" .assert * = bufnum, error, "Entry point mismatch"
bufnum: .byte $00
;; which window buffer (see table1, table2) is copied
bufnum: .byte 0
;; number of icons in copied window
buf3len:.byte 0 buf3len:.byte 0
;; list of icons in copied window
buf3: .res 127, 0 buf3: .res 127, 0
selected_window_index: ; index of selected window (used to get prefix) selected_window_index: ; index of selected window (used to get prefix)
.assert * = path_index, error, "Entry point mismatch" .assert * = path_index, error, "Entry point mismatch"
.byte 0 .byte 0
@ -5402,6 +5409,11 @@ LEBFC: .byte 0 ; flag of some sort ???
point14: DEFINE_POINT 0, 0 point14: DEFINE_POINT 0, 0
;; Used by DESKTOP_COPY_*_BUF ;; Used by DESKTOP_COPY_*_BUF
;; Each buffer is a list of icons in each window (0=desktop)
;; table1 = start of buffer = icon count
;; table2 = first entry in buffer (length = 127)
table1: .addr $1B00,$1B80,$1C00,$1C80,$1D00,$1D80,$1E00,$1E80,$1F00 table1: .addr $1B00,$1B80,$1C00,$1C80,$1D00,$1D80,$1E00,$1E80,$1F00
table2: .addr $1B01,$1B81,$1C01,$1C81,$1D01,$1D81,$1E01,$1E81,$1F01 table2: .addr $1B01,$1B81,$1C01,$1C81,$1D01,$1D81,$1E01,$1E81,$1F01
@ -5842,7 +5854,7 @@ L4051: cpx buf3len
inx inx
jmp L4051 jmp L4051
L4069: lda #$00 L4069: lda #0
sta bufnum sta bufnum
jsr DESKTOP_COPY_FROM_BUF jsr DESKTOP_COPY_FROM_BUF
lda #$00 lda #$00
@ -5921,7 +5933,7 @@ L4113: MGTK_RELAY_CALL MGTK::BeginUpdate, event_params+1
MGTK_RELAY_CALL MGTK::EndUpdate MGTK_RELAY_CALL MGTK::EndUpdate
rts rts
L412B: lda #$00 L412B: lda #0
sta bufnum sta bufnum
jsr DESKTOP_COPY_TO_BUF jsr DESKTOP_COPY_TO_BUF
lda L40F0 lda L40F0
@ -7566,7 +7578,7 @@ L4E78: jsr clear_selection
L4EA5: cpx buf3len L4EA5: cpx buf3len
beq L4EB4 beq L4EB4
lda buf3,x lda buf3,x
jsr DESKTOP_FREE_SPACE jsr DESKTOP_FREE_ICON
inx inx
jmp L4EA5 jmp L4EA5
@ -8087,7 +8099,7 @@ L5302: DESKTOP_RELAY_CALL DT_CLOSE_WINDOW, active_window_id
L5320: cpx buf3len L5320: cpx buf3len
beq L5334 beq L5334
lda buf3,x lda buf3,x
jsr DESKTOP_FREE_SPACE jsr DESKTOP_FREE_ICON
lda #$00 lda #$00
sta buf3,x sta buf3,x
inx inx
@ -8861,7 +8873,7 @@ L5916: lda buf3,x
sta buf3,x sta buf3,x
DESKTOP_RELAY_CALL $04, LE22F DESKTOP_RELAY_CALL $04, LE22F
lda LE22F lda LE22F
jsr DESKTOP_FREE_SPACE jsr DESKTOP_FREE_ICON
dec buf3len dec buf3len
dec LDD9E dec LDD9E
pla pla
@ -9002,7 +9014,7 @@ L5A4C: jsr redraw_windows_and_desktop
jsr L8AF4 jsr L8AF4
dec LDD9E dec LDD9E
lda LE22F lda LE22F
jsr DESKTOP_FREE_SPACE jsr DESKTOP_FREE_ICON
jsr reset_grafport3 jsr reset_grafport3
DESKTOP_RELAY_CALL $04, LE22F DESKTOP_RELAY_CALL $04, LE22F
L5A7F: lda buf3len L5A7F: lda buf3len
@ -9799,7 +9811,7 @@ L61DC: lda active_window_id
L6206: cpx buf3len L6206: cpx buf3len
beq L6215 beq L6215
lda buf3,x lda buf3,x
jsr DESKTOP_FREE_SPACE jsr DESKTOP_FREE_ICON
inx inx
jmp L6206 jmp L6206
@ -11620,7 +11632,7 @@ L7569: ldax $08
pla pla
lsr a lsr a
clc clc
adc #$1B adc #icon_entry_size
sta ($06),y sta ($06),y
iny iny
lda #$00 lda #$00
@ -11732,7 +11744,7 @@ L767C: txa
copy16 $E202,x, $06 copy16 $E202,x, $06
lda LCBANK2 lda LCBANK2
lda LCBANK2 lda LCBANK2
ldy #$00 ldy #0
lda ($06),y lda ($06),y
sta L7764 sta L7764
lda LCBANK1 lda LCBANK1
@ -11817,7 +11829,7 @@ L7764: .byte $00,$00,$00
L7767: .byte $14 L7767: .byte $14
L7768: inc LDD9E L7768: inc LDD9E
jsr DESKTOP_FIND_SPACE jsr DESKTOP_ALLOC_ICON
ldx buf3len ldx buf3len
inc buf3len inc buf3len
sta buf3,x sta buf3,x
@ -13821,10 +13833,12 @@ L899A: sta grafport5::cliprect::x1,x
;;; ================================================== ;;; ==================================================
gdi_data_buffer := $800
.proc on_line_params .proc on_line_params
param_count: .byte 2 param_count: .byte 2
unit_num: .byte 0 unit_num: .byte 0
data_buffer: .addr $800 data_buffer: .addr gdi_data_buffer
.endproc .endproc
.proc get_device_info .proc get_device_info
@ -13833,56 +13847,66 @@ data_buffer: .addr $800
and #$F0 and #$F0
sta on_line_params::unit_num sta on_line_params::unit_num
MLI_RELAY_CALL ON_LINE, on_line_params MLI_RELAY_CALL ON_LINE, on_line_params
beq L89DD beq success
L89CC: pha
retry: pha
ldy device_num ldy device_num
lda #$00 lda #0
sta $E1A0,y sta $E1A0,y
dec buf3len dec buf3len
dec LDD9E dec LDD9E
pla pla
rts rts
L89DD: lda L0800 success:
and #$0F lda gdi_data_buffer ; dr/slot/name_len
bne L89EA and #$0F ; mask off name len
lda $0801 bne create_icon
jmp L89CC lda gdi_data_buffer+1 ; if name len is zero, second byte is error
jmp retry
L89EA: jsr push_zp_addrs create_icon:
jsr DESKTOP_FIND_SPACE icon_ptr := $6
jsr push_zp_addrs
jsr DESKTOP_ALLOC_ICON
ldy device_num ldy device_num
sta $E1A0,y sta $E1A0,y
jsr file_address_lookup jsr file_address_lookup
stax $06 stax icon_ptr
ldx #$00
ldy #$09
lda #$20
L8A03: sta ($06),y
iny
inx
cpx #$12
bne L8A03
ldy #$09
lda L0800
and #$0F
sta L0800
sta ($06),y
addr_call L87BA, $800
ldx #$00
ldy #$0B
L8A22: lda $0801,x
sta ($06),y
iny
inx
cpx L0800
bne L8A22
ldy #$09
lda ($06),y
clc
adc #$02
sta ($06),y
;; Fill name with spaces
ldx #0
ldy #icon_entry_offset_len
lda #$20 ; ??? space? shouldn't this be at +1 ?
: sta (icon_ptr),y
iny
inx
cpx #icon_entry_name_bufsize+1
bne :-
;; Copy name, with leading/trailing space
ldy #icon_entry_offset_len
lda gdi_data_buffer
and #$0F
sta gdi_data_buffer
sta (icon_ptr),y
addr_call L87BA, gdi_data_buffer ; ???
ldx #0
ldy #icon_entry_offset_name+1 ; past leading space
: lda gdi_data_buffer+1,x
sta (icon_ptr),y
iny
inx
cpx gdi_data_buffer
bne :-
ldy #icon_entry_offset_len
lda (icon_ptr),y
clc
adc #2 ; leading/trailing space
sta (icon_ptr),y
;; Figure out icon
lda unit_number lda unit_number
cmp #$3E ; ??? Special case? Maybe RamWorks? cmp #$3E ; ??? Special case? Maybe RamWorks?
beq use_ramdisk_icon beq use_ramdisk_icon
@ -13912,67 +13936,72 @@ L8A22: lda $0801,x
;; fall through... ;; fall through...
use_ramdisk_icon: use_ramdisk_icon:
ldy #7 ldy #icon_entry_offset_iconbits
lda #<desktop_aux::ramdisk_icon lda #<desktop_aux::ramdisk_icon
sta ($06),y sta (icon_ptr),y
iny iny
lda #>desktop_aux::ramdisk_icon lda #>desktop_aux::ramdisk_icon
sta ($06),y sta (icon_ptr),y
jmp selected_device_icon jmp selected_device_icon
use_profile_icon: use_profile_icon:
ldy #7 ldy #icon_entry_offset_iconbits
lda #<desktop_aux::profile_icon lda #<desktop_aux::profile_icon
sta ($06),y sta (icon_ptr),y
iny iny
lda #>desktop_aux::profile_icon lda #>desktop_aux::profile_icon
sta ($06),y sta (icon_ptr),y
jmp selected_device_icon jmp selected_device_icon
use_floppy_icon: use_floppy_icon:
cmp #$B ; removable / 4 volumes cmp #$B ; removable / 4 volumes
bne use_floppy140_icon bne use_floppy140_icon
ldy #7 ldy #icon_entry_offset_iconbits
lda #<desktop_aux::floppy800_icon lda #<desktop_aux::floppy800_icon
sta ($06),y sta (icon_ptr),y
iny iny
lda #>desktop_aux::floppy800_icon lda #>desktop_aux::floppy800_icon
sta ($06),y sta (icon_ptr),y
jmp selected_device_icon jmp selected_device_icon
use_floppy140_icon: use_floppy140_icon:
cmp #DT_DISKII ; 0 = Disk II cmp #DT_DISKII ; 0 = Disk II
bne use_profile_icon ; last chance bne use_profile_icon ; last chance
ldy #7 ldy #icon_entry_offset_iconbits
lda #<desktop_aux::floppy140_icon lda #<desktop_aux::floppy140_icon
sta ($06),y sta (icon_ptr),y
iny iny
lda #>desktop_aux::floppy140_icon lda #>desktop_aux::floppy140_icon
sta ($06),y sta (icon_ptr),y
selected_device_icon: selected_device_icon:
;; Assign icon type
ldy #icon_entry_offset_type ldy #icon_entry_offset_type
lda #0 lda #0
sta ($06),y sta (icon_ptr),y
inc device_num inc device_num
;; Assign icon coordinates
lda device_num lda device_num
asl a asl a ; device num * 4 is coordinates index
asl a asl a
tax tax
ldy #$03 ldy #icon_entry_offset_iconx
L8AA7: lda L8AC5,x : lda desktop_icon_coords_table,x
sta ($06),y sta (icon_ptr),y
inx inx
iny iny
cpy #$07 cpy #icon_entry_offset_iconbits
bne L8AA7 bne :-
;; Assign icon number
ldx buf3len ldx buf3len
dex dex
ldy #$00 ldy #icon_entry_offset_index
lda ($06),y lda (icon_ptr),y
sta buf3,x sta buf3,x
jsr pop_zp_addrs jsr pop_zp_addrs
lda #$00 lda #0
rts rts
.endproc .endproc
@ -13981,12 +14010,18 @@ L8AA7: lda L8AC5,x
unit_number: .byte 0 unit_number: .byte 0
device_num: .byte 0 device_num: .byte 0
L8AC5: .byte $00,$00,$00,$00,$EA,$01,$10,$00 desktop_icon_coords_table:
.byte $EA,$01,$2D,$00,$EA,$01,$4B,$00 DEFINE_POINT 0,0
.byte $EA,$01,$67,$00,$EA,$01,$83,$00 DEFINE_POINT $1EA,$10
.byte $90,$01,$A0,$00,$36,$01,$A0,$00 DEFINE_POINT $1EA,$2D
.byte $DC,$00,$A0,$00,$82,$00,$A0,$00 DEFINE_POINT $1EA,$4B
.byte $28,$00,$A0,$00 DEFINE_POINT $1EA,$67
DEFINE_POINT $1EA,$83
DEFINE_POINT $190,$A0
DEFINE_POINT $136,$A0
DEFINE_POINT $DC,$A0
DEFINE_POINT $82,$A0
DEFINE_POINT $28,$A0
.proc get_prefix_params .proc get_prefix_params
param_count: .byte 1 param_count: .byte 1
@ -19526,7 +19561,7 @@ L08DF: txa
sta ($06),y sta ($06),y
lda $06 lda $06
clc clc
adc #$1B adc #icon_entry_size
sta $06 sta $06
bcc L0903 bcc L0903
inc $06+1 inc $06+1
@ -19546,15 +19581,16 @@ L090F: sta $1F00,x
inx inx
bne L090F bne L090F
sta RAMWRTOFF sta RAMWRTOFF
jmp L092F jmp create_trash_icon
L0927: PASCAL_STRING " Trash " trash_name: PASCAL_STRING " Trash "
L092F: lda #0 create_trash_icon:
lda #0
sta bufnum sta bufnum
lda #1 lda #1
sta buf3len sta buf3len
sta LDD9E sta LDD9E
jsr DESKTOP_FIND_SPACE jsr DESKTOP_ALLOC_ICON
sta LEBFB sta LEBFB
sta buf3 sta buf3
jsr desktop_main::file_address_lookup jsr desktop_main::file_address_lookup
@ -19570,13 +19606,13 @@ L092F: lda #0
sta ($06),y sta ($06),y
iny iny
ldx #$00 ldx #$00
L0960: lda L0927,x L0960: lda trash_name,x
sta ($06),y sta ($06),y
iny iny
inx inx
cpx L0927 cpx trash_name
bne L0960 bne L0960
lda L0927,x lda trash_name,x
sta ($06),y sta ($06),y
lda DEVCNT lda DEVCNT
sta L0A01 sta L0A01