This commit is contained in:
Joshua Bell 2018-03-05 20:11:14 -08:00
parent 8795ba330a
commit 65e19dcb5e

View File

@ -69,15 +69,15 @@ L23C9: .byte $00
L23DF: .byte $00,$00,$00 L23DF: .byte $00,$00,$00
.byte $00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00
DEFINE_CLOSE_PARAMS close_params2 DEFINE_CLOSE_PARAMS close_srcfile_params
DEFINE_CLOSE_PARAMS close_params3 DEFINE_CLOSE_PARAMS close_dstfile_params
.byte $01 .byte $01
.addr L26F5 .addr L26F5
DEFINE_OPEN_PARAMS open_params3, L26F5, $0D00 DEFINE_OPEN_PARAMS open_srcfile_params, L26F5, $0D00
DEFINE_OPEN_PARAMS open_params4, path0, $1100 DEFINE_OPEN_PARAMS open_dstfile_params, path0, $1100
DEFINE_READ_PARAMS read_params3, $4000, $7F00 DEFINE_READ_PARAMS read_srcfile_params, $4000, $7F00
DEFINE_WRITE_PARAMS write_params, $4000, $7F00 DEFINE_WRITE_PARAMS write_dstfile_params, $4000, $7F00
DEFINE_CREATE_PARAMS create_params, path0, %11000011, 0, 0 DEFINE_CREATE_PARAMS create_params, path0, %11000011, 0, 0
.byte $07 .byte $07
@ -89,6 +89,8 @@ L23DF: .byte $00,$00,$00
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, L26F5 DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, L26F5
.byte 0 .byte 0
;; Files/Directories to copy
str_f1: PASCAL_STRING "DESKTOP1" str_f1: PASCAL_STRING "DESKTOP1"
str_f2: PASCAL_STRING "DESKTOP2" str_f2: PASCAL_STRING "DESKTOP2"
str_f3: PASCAL_STRING "DESK.ACC" str_f3: PASCAL_STRING "DESK.ACC"
@ -307,13 +309,14 @@ L263C: lda L25FB,x
dex dex
cpx #3 cpx #3
bne L263C bne L263C
jsr L2A95 jsr create_file_for_copy
lda path0 lda path0
sta copy_flag sta copy_flag
lda #0 lda #0
sta filenum sta filenum
file_loop: lda filenum file_loop:
lda filenum
asl a asl a
tax tax
lda filename_table,x lda filename_table,x
@ -327,7 +330,7 @@ file_loop: lda filenum
sta filename_buf,y sta filename_buf,y
dey dey
bpl :- bpl :-
jsr L2912 jsr copy_file
inc filenum inc filenum
lda filenum lda filenum
cmp #$06 cmp #$06
@ -360,10 +363,10 @@ L26B2: stax $06
ldy #$00 ldy #$00
lda ($06),y lda ($06),y
tay tay
L26C1: lda ($06),y : lda ($06),y
sta $D3EE,y sta $D3EE,y
dey dey
bpl L26C1 bpl :-
lda ROMIN2 lda ROMIN2
rts rts
@ -373,10 +376,10 @@ L26CD: stax $06
ldy #$00 ldy #$00
lda ($06),y lda ($06),y
tay tay
L26DC: lda ($06),y : lda ($06),y
sta $D3AD,y sta $D3AD,y
dey dey
bpl L26DC bpl :-
lda ROMIN2 lda ROMIN2
rts rts
@ -496,6 +499,8 @@ loop: iny
rts rts
.endproc .endproc
;;; ============================================================
.proc fail_copy .proc fail_copy
lda #0 lda #0
sta copy_flag sta copy_flag
@ -514,7 +519,9 @@ L28FE: lda $0200,y
L290E: sty L26F5 L290E: sty L26F5
rts rts
.proc L2912 ;;; ============================================================
.proc copy_file
jsr append_filename_to_path0 jsr append_filename_to_path0
jsr L2851 jsr L2851
MLI_CALL GET_FILE_INFO, get_file_info_params MLI_CALL GET_FILE_INFO, get_file_info_params
@ -525,12 +532,12 @@ L290E: sty L26F5
: lda get_file_info_params::file_type : lda get_file_info_params::file_type
sta L2831 sta L2831
cmp #$0F cmp #FT_DIRECTORY
bne L2937 bne L2937
jsr L2962 jsr copy_directory
jmp L2951 jmp done
L2937: jsr L2A95 L2937: jsr create_file_for_copy
cmp #PDERR_DUPLICATE_FILENAME cmp #PDERR_DUPLICATE_FILENAME
bne L2948 bne L2948
lda filenum lda filenum
@ -539,39 +546,50 @@ L2937: jsr L2A95
pla pla
jmp fail2 jmp fail2
L2948: jsr L2A11 L2948: jsr copy_normal_file
L294B: jsr L2876 L294B: jsr L2876
jsr remove_filename_from_path0 jsr remove_filename_from_path0
L2951: rts done: rts
.endproc .endproc
DEFINE_OPEN_PARAMS open_params2, L26F5, $A000 ;;; ============================================================
DEFINE_READ_PARAMS read_params2, $A400, $0200
.proc copy_directory_impl
ptr := $6
dir_buffer := $A400
entry_length_offset := $23
file_count_offset := $25
header_length := $2B
DEFINE_OPEN_PARAMS open_params, L26F5, $A000
DEFINE_READ_PARAMS read_params, dir_buffer, $0200
DEFINE_CLOSE_PARAMS close_params DEFINE_CLOSE_PARAMS close_params
L2962: jsr L2A95 start: jsr create_file_for_copy
cmp #PDERR_DUPLICATE_FILENAME cmp #PDERR_DUPLICATE_FILENAME
beq L2974 beq L2974
MLI_CALL OPEN, open_params2 MLI_CALL OPEN, open_params
beq :+ beq :+
jsr fail_copy jsr fail_copy
L2974: rts L2974: rts
: lda open_params2::ref_num : lda open_params::ref_num
sta read_params2::ref_num sta read_params::ref_num
sta close_params::ref_num sta close_params::ref_num
MLI_CALL READ, read_params2 MLI_CALL READ, read_params
beq :+ beq :+
jsr fail_copy jsr fail_copy
rts rts
: lda #$00 : lda #$00
sta L2A10 sta L2A10
lda #<$A42B lda #<(dir_buffer + header_length)
sta $06 sta ptr
lda #>$A42B lda #>(dir_buffer + header_length)
sta $06+1 sta ptr+1
L2997: lda $A425 L2997: lda dir_buffer + file_count_offset
cmp L2A10 cmp L2A10
bne L29B1 bne L29B1
L299F: MLI_CALL CLOSE, close_params L299F: MLI_CALL CLOSE, close_params
@ -583,17 +601,17 @@ L29AA: jsr L2876
rts rts
L29B1: ldy #$00 L29B1: ldy #$00
lda ($06),y lda (ptr),y
bne L29BA bne L29BA
jmp L29F6 jmp L29F6
L29BA: and #$0F L29BA: and #$0F
tay tay
L29BD: lda ($06),y L29BD: lda (ptr),y
sta filename_buf,y sta filename_buf,y
dey dey
bne L29BD bne L29BD
lda ($06),y lda (ptr),y
and #$0F and #$0F
sta filename_buf,y sta filename_buf,y
jsr append_filename_to_path0 jsr append_filename_to_path0
@ -604,79 +622,94 @@ L29BD: lda ($06),y
: lda get_file_info_params::file_type : lda get_file_info_params::file_type
sta L2831 sta L2831
jsr L2A95 jsr create_file_for_copy
cmp #PDERR_DUPLICATE_FILENAME cmp #PDERR_DUPLICATE_FILENAME
beq L29ED beq :+
jsr L2A11 jsr copy_normal_file
L29ED: jsr L2876 : jsr L2876
jsr remove_filename_from_path0 jsr remove_filename_from_path0
inc L2A10 inc L2A10
L29F6: add16_8 $06, $A423, $06 L29F6: add16_8 ptr, dir_buffer + entry_length_offset, ptr
lda $06+1 lda ptr+1
cmp #$A6 cmp #>(dir_buffer + $200)
bcs L2A0D bcs L2A0D
jmp L2997 jmp L2997
L2A0D: jmp L299F L2A0D: jmp L299F
L2A10: .byte 0 L2A10: .byte 0
L2A11: MLI_CALL OPEN, open_params3 .endproc
beq L2A1F copy_directory := copy_directory_impl::start
jsr fail_copy
jmp L2A11
L2A1F: MLI_CALL OPEN, open_params4 ;;; ============================================================
beq L2A2D
jsr fail_copy
jmp L2A1F
L2A2D: lda open_params3::ref_num .proc copy_normal_file
sta read_params3::ref_num : MLI_CALL OPEN, open_srcfile_params
sta close_params2::ref_num
lda open_params4::ref_num
sta write_params::ref_num
sta close_params3::ref_num
L2A3F: copy16 #$7F00, read_params3::request_count
L2A49: MLI_CALL READ, read_params3
beq L2A5B
cmp #PDERR_END_OF_FILE
beq L2A88
jsr fail_copy
jmp L2A49
L2A5B: copy16 read_params3::trans_count, write_params::request_count
ora read_params3::trans_count
beq L2A88
L2A6C: MLI_CALL WRITE, write_params
beq :+ beq :+
jsr fail_copy jsr fail_copy
jmp L2A6C jmp :-
: lda write_params::trans_count : MLI_CALL OPEN, open_dstfile_params
beq :+
jsr fail_copy
jmp :-
: lda open_srcfile_params::ref_num
sta read_srcfile_params::ref_num
sta close_srcfile_params::ref_num
lda open_dstfile_params::ref_num
sta write_dstfile_params::ref_num
sta close_dstfile_params::ref_num
loop: copy16 #$7F00, read_srcfile_params::request_count
read: MLI_CALL READ, read_srcfile_params
beq :+
cmp #PDERR_END_OF_FILE
beq done
jsr fail_copy
jmp read
: copy16 read_srcfile_params::trans_count, write_dstfile_params::request_count
ora read_srcfile_params::trans_count
beq done
write: MLI_CALL WRITE, write_dstfile_params
beq :+
jsr fail_copy
jmp write
: lda write_dstfile_params::trans_count
cmp #<$7F00 cmp #<$7F00
bne L2A88 bne done
lda write_params::trans_count+1 lda write_dstfile_params::trans_count+1
cmp #>$7F00 cmp #>$7F00
beq L2A3F beq loop
L2A88: MLI_CALL CLOSE, close_params2 done: MLI_CALL CLOSE, close_srcfile_params
MLI_CALL CLOSE, close_params3 MLI_CALL CLOSE, close_dstfile_params
rts rts
.endproc
;;; ============================================================
.proc create_file_for_copy
;; Copy file_type, aux_type, storage_type ;; Copy file_type, aux_type, storage_type
L2A95: ldx #7 ldx #7
: lda get_file_info_params,x : lda get_file_info_params,x
sta create_params,x sta create_params,x
dex dex
cpx #3 cpx #3
bne :- bne :-
MLI_CALL CREATE, create_params MLI_CALL CREATE, create_params
beq L2AB1 beq :+
cmp #PDERR_DUPLICATE_FILENAME cmp #PDERR_DUPLICATE_FILENAME
beq L2AB1 beq :+
jsr fail_copy jsr fail_copy
L2AB1: rts : rts
.endproc
L2AB2: lda L24AC ;;; ============================================================
.proc L2AB2
lda L24AC
cmp #$3E cmp #$3E
bne L2ABC bne L2ABC
jmp L2AE6 jmp L2AE6
@ -724,6 +757,7 @@ L2AF3: inx
str_desktop2: str_desktop2:
PASCAL_STRING "DeskTop2" PASCAL_STRING "DeskTop2"
.endproc
;;; ============================================================ ;;; ============================================================
@ -974,14 +1008,14 @@ L3367: lda #$00
sta L334A sta L334A
MLI_CALL OPEN, open_params6 MLI_CALL OPEN, open_params6
beq L337A beq L337A
jmp L3A43 jmp handle_error_code
L337A: lda open_params6::ref_num L337A: lda open_params6::ref_num
sta L329D sta L329D
sta read_params4::ref_num sta read_params4::ref_num
MLI_CALL READ, read_params4 MLI_CALL READ, read_params4
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: jsr L33A4 : jsr L33A4
rts rts
@ -990,7 +1024,7 @@ L3392: lda L329D
sta close_params5::ref_num sta close_params5::ref_num
MLI_CALL CLOSE, close_params5 MLI_CALL CLOSE, close_params5
beq L33A3 beq L33A3
jmp L3A43 jmp handle_error_code
L33A3: rts L33A3: rts
@ -999,7 +1033,7 @@ L33A4: inc L329C
sta read_params5::ref_num sta read_params5::ref_num
MLI_CALL READ, read_params5 MLI_CALL READ, read_params5
beq L33B8 beq L33B8
jmp L3A43 jmp handle_error_code
L33B8: inc L334A L33B8: inc L334A
lda L334A lda L334A
@ -1011,7 +1045,7 @@ L33B8: inc L334A
sta read_params6::ref_num sta read_params6::ref_num
MLI_CALL READ, read_params6 MLI_CALL READ, read_params6
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: lda read_params6::trans_count : lda read_params6::trans_count
cmp read_params6::request_count cmp read_params6::request_count
@ -1130,10 +1164,10 @@ L34C4: MLI_CALL GET_FILE_INFO, get_file_info_params2
beq L34D4 beq L34D4
cmp #PDERR_FILE_NOT_FOUND cmp #PDERR_FILE_NOT_FOUND
bne L34DA bne L34DA
L34D4: jsr L3A0A L34D4: jsr show_insert_prompt
jmp L34C4 jmp L34C4
L34DA: jmp L3A43 L34DA: jmp handle_error_code
L34DD: lda get_file_info_params2::storage_type L34DD: lda get_file_info_params2::storage_type
cmp #$0F cmp #$0F
@ -1156,7 +1190,7 @@ L34EE: sta L353A
sta create_params2::access sta create_params2::access
jsr L35A9 jsr L35A9
bcc L350B bcc L350B
jmp L3A29 jmp show_no_space_prompt
L350B: ldx #$03 L350B: ldx #$03
L350D: lda get_file_info_params2::create_date,x L350D: lda get_file_info_params2::create_date,x
@ -1170,7 +1204,7 @@ L350D: lda get_file_info_params2::create_date,x
sta create_params2::storage_type sta create_params2::storage_type
L3522: MLI_CALL CREATE, create_params2 L3522: MLI_CALL CREATE, create_params2
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: lda L353A : lda L353A
beq L3537 beq L3537
@ -1190,10 +1224,10 @@ L3540: lda L3160
cmp #$0F cmp #$0F
bne L3574 bne L3574
jsr L36FB jsr L36FB
jsr L39EE jsr show_copying_screen
MLI_CALL GET_FILE_INFO, get_file_info_params2 MLI_CALL GET_FILE_INFO, get_file_info_params2
beq L3566 beq L3566
jmp L3A43 jmp handle_error_code
L3558: jsr L375E L3558: jsr L375E
jsr L3720 jsr L3720
lda #$FF lda #$FF
@ -1208,14 +1242,14 @@ L3566: jsr L3739
L3574: jsr L3739 L3574: jsr L3739
jsr L36FB jsr L36FB
jsr L39EE jsr show_copying_screen
MLI_CALL GET_FILE_INFO, get_file_info_params2 MLI_CALL GET_FILE_INFO, get_file_info_params2
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: jsr L35A9 : jsr L35A9
bcc L3590 bcc L3590
jmp L3A29 jmp show_no_space_prompt
L3590: jsr L3720 L3590: jsr L3720
jsr L36C1 jsr L36C1
@ -1231,7 +1265,7 @@ L35A5: jsr L375E
L35A9: MLI_CALL GET_FILE_INFO, get_file_info_params2 L35A9: MLI_CALL GET_FILE_INFO, get_file_info_params2
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: lda #$00 : lda #$00
sta L3641 sta L3641
@ -1240,7 +1274,7 @@ L35A9: MLI_CALL GET_FILE_INFO, get_file_info_params2
beq :+ beq :+
cmp #PDERR_FILE_NOT_FOUND cmp #PDERR_FILE_NOT_FOUND
beq L35D7 beq L35D7
jmp L3A43 jmp handle_error_code
: copy16 get_file_info_params3::blocks_used, L3641 : copy16 get_file_info_params3::blocks_used, L3641
L35D7: lda path1 L35D7: lda path1
@ -1257,7 +1291,7 @@ L35DF: iny
sta L3640 sta L3640
MLI_CALL GET_FILE_INFO, get_file_info_params3 MLI_CALL GET_FILE_INFO, get_file_info_params3
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: sub16 get_file_info_params3::aux_type, get_file_info_params3::blocks_used, L363D : sub16 get_file_info_params3::aux_type, get_file_info_params3::blocks_used, L363D
sub16 L363D, L3641, L363D sub16 L363D, L3641, L363D
@ -1277,10 +1311,10 @@ L3641: .byte 0
L3642: .byte 0 L3642: .byte 0
L3643: MLI_CALL OPEN, open_params7 L3643: MLI_CALL OPEN, open_params7
beq L364E beq L364E
jsr L3A43 jsr handle_error_code
L364E: MLI_CALL OPEN, open_params8 L364E: MLI_CALL OPEN, open_params8
beq L3659 beq L3659
jmp L3A43 jmp handle_error_code
L3659: lda open_params7::ref_num L3659: lda open_params7::ref_num
sta read_params7::ref_num sta read_params7::ref_num
@ -1294,14 +1328,14 @@ L366B: copy16 #$0B00, read_params7::request_count
beq :+ beq :+
cmp #PDERR_END_OF_FILE cmp #PDERR_END_OF_FILE
beq L36AE beq L36AE
jmp L3A43 jmp handle_error_code
: copy16 read_params7::trans_count, write_params3::request_count : copy16 read_params7::trans_count, write_params3::request_count
ora read_params7::trans_count ora read_params7::trans_count
beq L36AE beq L36AE
MLI_CALL WRITE, write_params3 MLI_CALL WRITE, write_params3
beq :+ beq :+
jmp L3A43 jmp handle_error_code
: lda write_params3::trans_count : lda write_params3::trans_count
cmp #<$0B00 cmp #<$0B00
@ -1337,7 +1371,7 @@ L36D5: lda get_file_info_params2::create_date,x
L36EA: MLI_CALL CREATE, create_params3 L36EA: MLI_CALL CREATE, create_params3
clc clc
beq L36F6 beq L36F6
jmp L3A43 jmp handle_error_code
L36F6: rts L36F6: rts
@ -1637,46 +1671,64 @@ str_occured:
str_not_completed: str_not_completed:
PASCAL_STRING "The copy was not completed, press <Return> to continue." PASCAL_STRING "The copy was not completed, press <Return> to continue."
L39EE: jsr HOME ;;; ============================================================
lda #$00
.proc show_copying_screen
jsr HOME
lda #0
jsr VTABZ jsr VTABZ
lda #$00 lda #0
jsr L3ABC jsr set_htab
addr_call cout_string, str_copying addr_call cout_string, str_copying
addr_call cout_string_newline, path2 addr_call cout_string_newline, path2
rts rts
.endproc
L3A0A: lda #$00 ;;; ============================================================
.proc show_insert_prompt
lda #0
jsr VTABZ jsr VTABZ
lda #$00 lda #0
jsr L3ABC jsr set_htab
addr_call cout_string, str_insert addr_call cout_string, str_insert
jsr wait_enter_escape jsr wait_enter_escape
cmp #CHAR_ESCAPE cmp #CHAR_ESCAPE
bne L3A25 bne :+
jmp L3AD2 jmp finish_and_invoke
L3A25: jsr HOME : jsr HOME
rts rts
.endproc
L3A29: lda #$00 ;;; ============================================================
.proc show_no_space_prompt
lda #0
jsr VTABZ jsr VTABZ
lda #$00 lda #0
jsr L3ABC jsr set_htab
addr_call cout_string, str_not_enough addr_call cout_string, str_not_enough
jsr wait_enter_escape jsr wait_enter_escape
jsr HOME jsr HOME
jmp invoke_selector_or_desktop jmp invoke_selector_or_desktop
.endproc
L3A43: cmp #PDERR_OVERRUN_ERROR ;;; ============================================================
.proc handle_error_code
cmp #PDERR_OVERRUN_ERROR
bne :+ bne :+
jsr L3A29 jsr show_no_space_prompt
jmp L3AD2 jmp finish_and_invoke
: cmp #PDERR_VOLUME_DIR_FULL : cmp #PDERR_VOLUME_DIR_FULL
bne show_error bne show_error
jsr L3A29 jsr show_no_space_prompt
jmp L3AD2 jmp finish_and_invoke
.endproc
;;; ============================================================
.proc show_error .proc show_error
;; Show error ;; Show error
@ -1733,8 +1785,10 @@ loop: iny
done: rts done: rts
.endproc .endproc
L3ABC: sta $24 .proc set_htab
sta CH
rts rts
.endproc
;;; ============================================================ ;;; ============================================================
@ -1752,8 +1806,12 @@ done: rts
;;; ============================================================ ;;; ============================================================
L3AD2: jsr HOME .proc finish_and_invoke
jsr HOME
jmp invoke_selector_or_desktop jmp invoke_selector_or_desktop
.endproc
;;; ============================================================
L3AD8: .byte 0 ; ??? L3AD8: .byte 0 ; ???
.byte $02 .byte $02
@ -1761,7 +1819,7 @@ L3AD8: .byte 0 ; ???
L3ADA: iny L3ADA: iny
inx inx
dec $0200 dec $0200
bne L3AD2 bne finish_and_invoke
lda #$A2 lda #$A2
sta $0200 sta $0200
rts rts