a2d/desktop/sys.s

2642 lines
58 KiB
ArmAsm
Raw Normal View History

2018-03-03 03:56:39 +00:00
.setcpu "6502"
.org $2000
2018-03-03 04:06:58 +00:00
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../inc/prodos.inc"
2018-03-03 03:57:30 +00:00
.include "../macros.inc"
2018-03-04 19:35:04 +00:00
;;; ============================================================
2018-03-07 02:36:51 +00:00
.proc copy_desktop_to_ramcard
2018-03-03 04:06:58 +00:00
2018-03-04 20:04:29 +00:00
jmp start
2018-03-03 04:06:58 +00:00
2018-03-04 20:04:29 +00:00
;;; ============================================================
;;; Data buffers and param blocks
2018-03-03 03:56:39 +00:00
2018-03-04 05:33:40 +00:00
date: .word 0 ; written into file
2018-03-03 04:53:10 +00:00
L2005:
2018-03-04 20:04:29 +00:00
.res 832, 0
2018-03-03 04:53:10 +00:00
2018-03-04 19:35:04 +00:00
.byte $02,$00
2018-03-04 20:04:29 +00:00
.addr L2363
2018-03-04 03:43:41 +00:00
.proc get_prefix_params2
2018-03-04 19:35:04 +00:00
param_count: .byte 2 ; GET_PREFIX, but param_count is 2 ??? Bug???
2018-03-04 03:43:41 +00:00
data_buffer: .addr $0D00
.endproc
2018-03-04 04:03:42 +00:00
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params4, $0D00
2018-03-04 19:35:04 +00:00
.byte $00,$01
2018-03-04 20:04:29 +00:00
.addr L2362
L2362: .byte $00
2018-03-05 03:38:55 +00:00
L2363: .res 15, 0
2018-03-06 05:20:00 +00:00
butn1: .byte 0 ; written, but not read
2018-03-05 03:38:55 +00:00
unit_num:
2018-03-06 05:20:00 +00:00
.byte 0
2018-03-03 17:04:07 +00:00
2018-03-04 19:35:04 +00:00
DEFINE_ON_LINE_PARAMS on_line_params,, on_line_buffer
2018-03-03 17:04:07 +00:00
2018-03-05 03:38:55 +00:00
copy_flag:
.byte 0
2018-03-04 20:04:29 +00:00
L2379: .byte 0
2018-03-04 19:35:04 +00:00
on_line_buffer: .res 17, 0
2018-03-03 17:04:07 +00:00
2018-03-06 05:20:00 +00:00
DEFINE_GET_PREFIX_PARAMS get_prefix_params, buffer
2018-03-05 03:38:55 +00:00
DEFINE_SET_PREFIX_PARAMS set_prefix_params, path0
2018-03-04 19:35:04 +00:00
2018-03-03 17:04:07 +00:00
.byte $0A
2018-03-04 20:04:29 +00:00
.addr L2379
2018-03-04 19:35:04 +00:00
.byte $00,$00,$00,$00,$00,$00
2018-03-03 03:56:39 +00:00
.byte $00,$00,$00,$00,$00,$00,$00,$00
2018-03-04 19:35:04 +00:00
.byte $00,$00,$00
.byte $07,$60,$2B,$C3,$0F
2018-03-03 03:56:39 +00:00
.byte $00,$00,$0D,$00,$00,$00,$00,$04
.byte $00,$00,$03,$00,$01,$00,$00,$01
.byte $00,$03,$F5,$26,$00,$08,$00,$04
2018-03-04 19:35:04 +00:00
.byte $00
2018-03-04 20:04:29 +00:00
.addr L23C9
.byte $04,$00,$00,$00
L23C9: .byte $00
2018-03-03 03:56:39 +00:00
.byte $00,$00,$00,$01,$00,$04,$00,$21
2018-03-04 19:35:04 +00:00
.byte $28,$27,$00,$00,$00,$04,$00
2018-03-04 20:04:29 +00:00
.addr L23DF
.byte $05,$00,$00,$00
L23DF: .byte $00,$00,$00
2018-03-03 03:56:39 +00:00
.byte $00,$00,$00,$00,$00,$00
2018-03-03 17:04:07 +00:00
2018-03-06 04:11:14 +00:00
DEFINE_CLOSE_PARAMS close_srcfile_params
DEFINE_CLOSE_PARAMS close_dstfile_params
2018-03-03 17:04:07 +00:00
2018-03-04 19:35:04 +00:00
.byte $01
2018-03-06 05:20:00 +00:00
.addr buffer
copy_buffer := $4000
max_copy_count := MLI - copy_buffer
DEFINE_OPEN_PARAMS open_srcfile_params, buffer, $0D00
2018-03-06 04:11:14 +00:00
DEFINE_OPEN_PARAMS open_dstfile_params, path0, $1100
2018-03-06 05:20:00 +00:00
DEFINE_READ_PARAMS read_srcfile_params, copy_buffer, max_copy_count
DEFINE_WRITE_PARAMS write_dstfile_params, copy_buffer, max_copy_count
2018-03-04 03:27:31 +00:00
2018-03-06 05:27:41 +00:00
DEFINE_CREATE_PARAMS create_params, path0, ACCESS_DEFAULT, 0, 0
2018-03-04 19:35:04 +00:00
.byte $07
2018-03-05 03:38:55 +00:00
.addr path0
2018-03-04 19:35:04 +00:00
.byte $00
2018-03-03 03:56:39 +00:00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00
2018-03-03 17:04:07 +00:00
2018-03-06 05:20:00 +00:00
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params, buffer
2018-03-03 17:04:07 +00:00
.byte 0
2018-03-04 04:03:42 +00:00
2018-03-06 04:11:14 +00:00
;; Files/Directories to copy
2018-03-04 04:03:42 +00:00
str_f1: PASCAL_STRING "DESKTOP1"
str_f2: PASCAL_STRING "DESKTOP2"
str_f3: PASCAL_STRING "DESK.ACC"
str_f4: PASCAL_STRING "SELECTOR.LIST"
str_f5: PASCAL_STRING "SELECTOR"
str_f6: PASCAL_STRING "PRODOS"
2018-03-05 03:38:55 +00:00
filename_table:
.addr str_f1,str_f2,str_f3,str_f4,str_f5,str_f6
2018-03-04 04:03:42 +00:00
2018-03-05 03:38:55 +00:00
str_copying_to_ramcard:
PASCAL_STRING "Copying Apple II DeskTop into RAMCard"
2018-03-04 20:04:29 +00:00
;; Jump target from filer launcher - why???
rts1: rts
2018-03-06 05:20:00 +00:00
;; Signature of block storage devices ($Cn0x)
sig_bytes:
.byte $20,$00,$03,$00
sig_offsets:
.byte $01,$03,$05,$07
2018-03-04 20:04:29 +00:00
2018-03-06 05:20:00 +00:00
active_device:
.byte 0
2018-03-04 05:33:40 +00:00
;; Selector signature
2018-03-04 20:04:29 +00:00
selector_signature:
.byte $AD,$8B,$C0,$18,$FB,$5C,$04,$D0,$E0
;;; ============================================================
2018-03-04 05:33:40 +00:00
2018-03-04 20:04:29 +00:00
start: sta MIXCLR
2018-03-04 05:33:40 +00:00
sta HIRES
sta TXTCLR
sta CLR80VID
sta AN3_OFF
sta AN3_ON
sta AN3_OFF
sta AN3_ON
sta SET80VID
sta DHIRESON
sta TXTSET
lda DATELO ; Any date set?
ora DATEHI
2018-03-03 03:56:39 +00:00
bne L24EB
2018-03-04 05:33:40 +00:00
copy16 date, DATELO ; Copy timestamp embedded in this file
L24EB: lda MACHID
and #$30 ; bits 4,5 set = 128k
2018-03-03 03:56:39 +00:00
cmp #$30
2018-03-04 05:33:40 +00:00
beq have128k
;; Relocate FILER launch routine to $300 and invoke
2018-03-04 20:04:29 +00:00
.scope
target := $300
length := $D0
ldy #length
2018-03-04 05:33:40 +00:00
: lda launch_filer,y
2018-03-04 20:04:29 +00:00
sta target,y
2018-03-03 03:56:39 +00:00
dey
2018-03-04 20:04:29 +00:00
cpy #$FF ; why not bpl ???
2018-03-04 05:33:40 +00:00
bne :-
2018-03-04 20:04:29 +00:00
jmp target
.endscope
2018-03-03 03:56:39 +00:00
2018-03-04 05:33:40 +00:00
have128k:
lda #$00
sta SHADOW ; IIgs ???
2018-03-06 05:20:00 +00:00
lda DEVNUM ; Most recent device
sta active_device
2018-03-04 05:33:40 +00:00
lda LCBANK2
lda LCBANK2
;; Check quit routine
2018-03-03 03:56:39 +00:00
ldx #$08
2018-03-04 05:33:40 +00:00
: lda SELECTOR,x ; Quit routine?
2018-03-04 20:04:29 +00:00
cmp selector_signature,x
2018-03-04 05:33:40 +00:00
bne nomatch
2018-03-03 03:56:39 +00:00
dex
2018-03-04 05:33:40 +00:00
bpl :-
lda #0
beq match
nomatch:
lda #$80
match: sta $D3AC
2018-03-03 06:44:28 +00:00
lda ROMIN2
2018-03-03 03:56:39 +00:00
ldx #$00
jsr L26A5
2018-03-04 20:04:29 +00:00
;; Point $8 at $C100
2018-03-05 03:38:55 +00:00
lda #0
2018-03-06 05:24:21 +00:00
sta flag
2018-03-03 03:56:39 +00:00
sta $08
lda #$C1
2018-03-04 20:04:29 +00:00
sta $08+1
;; Check slot for signature bytes
check_slot:
ldx #0
: lda sig_offsets,x ; Check $CnXX
2018-03-03 03:56:39 +00:00
tay
lda ($08),y
2018-03-04 20:04:29 +00:00
cmp sig_bytes,x
bne next_slot
2018-03-03 03:56:39 +00:00
inx
2018-03-04 20:04:29 +00:00
cpx #4 ; number of signature bytes
bcc :-
2018-03-03 03:56:39 +00:00
ldy #$FB
2018-03-04 20:04:29 +00:00
lda ($08),y ; Also check $CnFB for low bit
2018-03-03 03:56:39 +00:00
and #$01
2018-03-04 20:04:29 +00:00
beq next_slot
bne found_slot
next_slot:
inc $08+1
lda $08+1
cmp #$C8 ; stop at $C800
bcc check_slot
2018-03-04 05:33:40 +00:00
ldy DEVCNT
L2565: lda DEVLST,y
2018-03-03 03:56:39 +00:00
cmp #$3E
beq L2572
dey
bpl L2565
2018-03-04 20:04:29 +00:00
jmp fail
2018-03-03 03:56:39 +00:00
L2572: lda #$03
bne L257A
2018-03-04 20:04:29 +00:00
found_slot:
lda $08+1
and #$0F ; slot # in A
L257A: sta slot
;; Synthesize unit_num, verify it's a device
2018-03-03 03:56:39 +00:00
asl a
asl a
asl a
asl a
2018-03-03 17:04:07 +00:00
sta on_line_params::unit_num
2018-03-04 20:04:29 +00:00
sta unit_num
2018-03-03 17:04:07 +00:00
MLI_CALL ON_LINE, on_line_params
2018-03-04 20:04:29 +00:00
beq :+
jmp fail
2018-03-03 03:56:39 +00:00
2018-03-04 20:04:29 +00:00
: lda unit_num
cmp #$30 ; make sure it's not slot 3 (aux)
beq :+
2018-03-03 17:04:07 +00:00
sta write_block_params_unit_num
sta write_block_params2_unit_num
MLI_CALL WRITE_BLOCK, write_block_params
2018-03-04 20:04:29 +00:00
bne :+
2018-03-03 17:04:07 +00:00
MLI_CALL WRITE_BLOCK, write_block_params2
2018-03-04 20:04:29 +00:00
: lda on_line_buffer
2018-03-03 03:56:39 +00:00
and #$0F
tay
iny
2018-03-05 03:38:55 +00:00
sty path0
2018-03-04 19:35:04 +00:00
lda #'/'
sta on_line_buffer
2018-03-05 03:38:55 +00:00
sta path0+1
2018-03-04 19:35:04 +00:00
L25BF: lda on_line_buffer,y
2018-03-05 03:38:55 +00:00
sta path0+1,y
2018-03-03 03:56:39 +00:00
dey
bne L25BF
ldx #$C0
jsr L26A5
2018-03-06 16:00:57 +00:00
addr_call copy_to_lc2_b, path0
2018-03-06 05:20:00 +00:00
jsr check_desktop2_on_device
2018-03-03 03:56:39 +00:00
bcs L25E4
ldx #$80
jsr L26A5
jsr L2B57
2018-03-04 20:04:29 +00:00
jmp fail
2018-03-03 03:56:39 +00:00
2018-03-04 19:35:04 +00:00
L25E4: lda BUTN1
2018-03-05 03:38:55 +00:00
sta butn1
2018-03-04 19:35:04 +00:00
lda BUTN0
2018-03-05 03:38:55 +00:00
bpl start_copy
2018-03-04 20:04:29 +00:00
jmp fail
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
str_slash_desktop:
PASCAL_STRING "/DeskTop"
2018-03-06 05:20:00 +00:00
;; Overwrite first bytes of get_file_info_params
.proc file_info_ovl
.byte $A ; param_count
.addr 0 ; pathname
2018-03-06 05:27:41 +00:00
.byte ACCESS_DEFAULT ; access
2018-03-06 05:20:00 +00:00
.byte FT_DIRECTORY ; filetype
.word 0 ; aux_type
.byte ST_LINKED_DIRECTORY ; storage_type
.endproc
2018-03-04 20:04:29 +00:00
2018-03-05 03:38:55 +00:00
start_copy:
2018-03-06 05:20:00 +00:00
jsr show_copying_screen
2018-03-03 17:04:07 +00:00
MLI_CALL GET_PREFIX, get_prefix_params
2018-03-03 03:56:39 +00:00
beq L2611
2018-03-05 03:38:55 +00:00
jmp fail_copy
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
L2611: dec buffer
2018-03-03 03:56:39 +00:00
ldx #$80
jsr L26A5
2018-03-06 05:20:00 +00:00
ldy buffer
L261C: lda buffer,y
2018-03-03 03:56:39 +00:00
sta L2005,y
dey
bpl L261C
2018-03-05 03:38:55 +00:00
ldy path0
2018-03-03 03:56:39 +00:00
ldx #$00
L262A: iny
inx
2018-03-05 03:38:55 +00:00
lda str_slash_desktop,x
sta path0,y
cpx str_slash_desktop
2018-03-03 03:56:39 +00:00
bne L262A
2018-03-05 03:38:55 +00:00
sty path0
2018-03-04 22:01:19 +00:00
ldx #7
2018-03-06 05:20:00 +00:00
L263C: lda file_info_ovl,x
2018-03-03 17:04:07 +00:00
sta get_file_info_params,x
2018-03-03 03:56:39 +00:00
dex
2018-03-04 22:01:19 +00:00
cpx #3
2018-03-03 03:56:39 +00:00
bne L263C
2018-03-06 04:11:14 +00:00
jsr create_file_for_copy
2018-03-05 03:38:55 +00:00
lda path0
sta copy_flag
lda #0
sta filenum
2018-03-06 04:11:14 +00:00
file_loop:
lda filenum
2018-03-03 03:56:39 +00:00
asl a
tax
2018-03-05 03:38:55 +00:00
lda filename_table,x
2018-03-03 03:56:39 +00:00
sta $06
2018-03-05 03:38:55 +00:00
lda filename_table+1,x
2018-03-04 04:03:42 +00:00
sta $06+1
2018-03-05 03:38:55 +00:00
ldy #0
2018-03-03 03:56:39 +00:00
lda ($06),y
tay
2018-03-05 03:38:55 +00:00
: lda ($06),y
sta filename_buf,y
2018-03-03 03:56:39 +00:00
dey
2018-03-05 03:38:55 +00:00
bpl :-
2018-03-06 04:11:14 +00:00
jsr copy_file
2018-03-05 03:38:55 +00:00
inc filenum
lda filenum
2018-03-03 03:56:39 +00:00
cmp #$06
2018-03-05 03:38:55 +00:00
bne file_loop
jmp fail2
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
fail2: lda copy_flag
2018-03-03 03:56:39 +00:00
beq L268F
2018-03-05 03:38:55 +00:00
sta path0
2018-03-03 17:04:07 +00:00
MLI_CALL SET_PREFIX, set_prefix_params
2018-03-04 22:01:19 +00:00
L268F: jsr write_desktop1
2018-03-03 03:56:39 +00:00
jsr L2B57
lda #$00
2018-03-04 19:35:04 +00:00
sta $C071 ; ???
2018-03-04 20:04:29 +00:00
ldy #BITMAP_SIZE-1
: sta BITMAP,y
2018-03-03 03:56:39 +00:00
dey
2018-03-04 20:04:29 +00:00
bpl :-
2018-03-07 02:36:51 +00:00
jmp copy_selector_entries_to_ramcard
2018-03-03 03:56:39 +00:00
2018-03-04 19:35:04 +00:00
L26A5: lda LCBANK2
lda LCBANK2
2018-03-03 03:56:39 +00:00
stx $D3FF
2018-03-03 06:44:28 +00:00
lda ROMIN2
rts
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
.proc copy_to_lc2_b
ptr := $6
target := $D3EE
stax ptr
2018-03-04 19:35:04 +00:00
lda LCBANK2
lda LCBANK2
2018-03-06 16:00:57 +00:00
ldy #0
lda (ptr),y
2018-03-03 03:56:39 +00:00
tay
2018-03-06 16:00:57 +00:00
: lda (ptr),y
sta target,y
2018-03-03 03:56:39 +00:00
dey
2018-03-06 04:11:14 +00:00
bpl :-
2018-03-03 06:44:28 +00:00
lda ROMIN2
rts
2018-03-06 16:00:57 +00:00
.endproc
.proc copy_to_lc2_a
ptr := $6
target := $D3AD
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
stax ptr
2018-03-04 19:35:04 +00:00
lda LCBANK2
lda LCBANK2
2018-03-06 16:00:57 +00:00
ldy #0
lda (ptr),y
2018-03-03 03:56:39 +00:00
tay
2018-03-06 16:00:57 +00:00
: lda (ptr),y
sta target,y
2018-03-03 03:56:39 +00:00
dey
2018-03-06 04:11:14 +00:00
bpl :-
2018-03-03 06:44:28 +00:00
lda ROMIN2
rts
2018-03-06 16:00:57 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 05:24:21 +00:00
fail: lda #0
sta flag
2018-03-05 03:38:55 +00:00
jmp fail2
2018-03-03 03:56:39 +00:00
2018-03-04 20:04:29 +00:00
.byte 0, $D, 0, 0, 0
2018-03-04 03:27:31 +00:00
2018-03-06 05:20:00 +00:00
;; Generic buffer?
buffer: .res 300, 0
2018-03-04 03:27:31 +00:00
2018-03-05 03:38:55 +00:00
filename_buf:
.res 16, 0
2018-03-06 05:20:00 +00:00
file_type: ; written but not read ???
.byte 0
L2832: .res 31, 0 ; unused ???
;;; ============================================================
.proc append_filename_to_buffer
lda filename_buf
bne :+
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
: ldx #0
ldy buffer
2018-03-04 19:35:04 +00:00
lda #'/'
2018-03-06 05:20:00 +00:00
sta buffer+1,y
2018-03-03 03:56:39 +00:00
iny
2018-03-06 05:20:00 +00:00
loop: cpx filename_buf
bcs done
2018-03-05 03:38:55 +00:00
lda filename_buf+1,x
2018-03-06 05:20:00 +00:00
sta buffer+1,y
2018-03-03 03:56:39 +00:00
inx
iny
2018-03-06 05:20:00 +00:00
jmp loop
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
done: sty buffer
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
;;; ============================================================
.proc remove_filename_from_buffer
ldx buffer
bne :+
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
: lda buffer,x
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-06 05:20:00 +00:00
beq done
2018-03-03 03:56:39 +00:00
dex
2018-03-06 05:20:00 +00:00
bne :-
stx buffer
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
done: dex
stx buffer
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
;;; ============================================================
.proc append_filename_to_path0
lda filename_buf
bne :+
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
: ldx #0
ldy path0
2018-03-04 19:35:04 +00:00
lda #'/'
2018-03-05 03:38:55 +00:00
sta path0+1,y
2018-03-03 03:56:39 +00:00
iny
2018-03-05 03:38:55 +00:00
loop: cpx filename_buf
bcs done
lda filename_buf+1,x
sta path0+1,y
2018-03-03 03:56:39 +00:00
inx
iny
2018-03-05 03:38:55 +00:00
jmp loop
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
done: sty path0
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
.proc remove_filename_from_path0
ldx path0
bne :+
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
: lda path0,x
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-05 03:38:55 +00:00
beq done
2018-03-03 03:56:39 +00:00
dex
2018-03-05 03:38:55 +00:00
bne :-
stx path0
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
done: dex
stx path0
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
.proc show_copying_screen
;; Turn on 80-column mode
2018-03-04 20:04:29 +00:00
jsr SLOT3ENTRY
2018-03-03 03:56:39 +00:00
jsr HOME
2018-03-06 05:20:00 +00:00
;; Center string
2018-03-04 19:35:04 +00:00
lda #80
2018-03-03 03:56:39 +00:00
sec
2018-03-04 19:35:04 +00:00
sbc str_copying_to_ramcard
lsr a ; / 2 to center
sta CH
lda #12
sta CV
2018-03-03 04:06:58 +00:00
jsr VTAB
2018-03-04 19:35:04 +00:00
ldy #0
2018-03-04 20:04:29 +00:00
loop: iny
2018-03-04 19:35:04 +00:00
lda str_copying_to_ramcard,y
2018-03-03 03:56:39 +00:00
ora #$80
jsr COUT
2018-03-04 19:35:04 +00:00
cpy str_copying_to_ramcard
2018-03-04 20:04:29 +00:00
bne loop
2018-03-03 03:56:39 +00:00
rts
2018-03-04 20:04:29 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
;;; ============================================================
2018-03-05 03:38:55 +00:00
.proc fail_copy
lda #0
sta copy_flag
2018-03-04 20:04:29 +00:00
jmp fail
2018-03-05 03:38:55 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
;;; ============================================================
;;; Unreferenced ???
.proc copy_input_to_buffer
2018-03-03 03:56:39 +00:00
ldy #$00
2018-03-06 05:20:00 +00:00
loop: lda $0200,y
cmp #$80|CHAR_RETURN
beq done
2018-03-03 03:56:39 +00:00
and #$7F
2018-03-06 05:20:00 +00:00
sta buffer+1,y
2018-03-03 03:56:39 +00:00
iny
2018-03-06 05:20:00 +00:00
jmp loop
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
done: sty buffer
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
;;; ============================================================
.proc copy_file
2018-03-05 03:38:55 +00:00
jsr append_filename_to_path0
2018-03-06 05:20:00 +00:00
jsr append_filename_to_buffer
2018-03-03 17:04:07 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 05:20:00 +00:00
cmp #ERR_FILE_NOT_FOUND
beq cleanup
2018-03-04 20:04:29 +00:00
jmp fail
2018-03-03 03:56:39 +00:00
2018-03-03 17:04:07 +00:00
: lda get_file_info_params::file_type
2018-03-06 05:20:00 +00:00
sta file_type
2018-03-06 04:11:14 +00:00
cmp #FT_DIRECTORY
2018-03-06 05:20:00 +00:00
bne :+
2018-03-06 04:11:14 +00:00
jsr copy_directory
jmp done
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
: jsr create_file_for_copy
cmp #ERR_DUPLICATE_FILENAME
bne :+
2018-03-05 03:38:55 +00:00
lda filenum
2018-03-06 05:20:00 +00:00
bne cleanup
2018-03-03 03:56:39 +00:00
pla
pla
2018-03-05 03:38:55 +00:00
jmp fail2
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
: jsr copy_normal_file
cleanup:
jsr remove_filename_from_buffer
2018-03-05 03:38:55 +00:00
jsr remove_filename_from_path0
2018-03-06 04:11:14 +00:00
done: rts
2018-03-05 03:38:55 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
;;; ============================================================
.proc copy_directory_impl
ptr := $6
dir_buffer := $A400
entry_length_offset := $23
file_count_offset := $25
header_length := $2B
2018-03-06 05:20:00 +00:00
DEFINE_OPEN_PARAMS open_params, buffer, $A000
2018-03-06 04:11:14 +00:00
DEFINE_READ_PARAMS read_params, dir_buffer, $0200
2018-03-03 17:04:07 +00:00
DEFINE_CLOSE_PARAMS close_params
2018-03-06 04:11:14 +00:00
start: jsr create_file_for_copy
2018-03-06 05:20:00 +00:00
cmp #ERR_DUPLICATE_FILENAME
beq bail
2018-03-06 04:11:14 +00:00
MLI_CALL OPEN, open_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-06 05:20:00 +00:00
bail: rts
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
: lda open_params::ref_num
sta read_params::ref_num
2018-03-03 17:04:07 +00:00
sta close_params::ref_num
2018-03-06 04:11:14 +00:00
MLI_CALL READ, read_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
: lda #0
2018-03-03 03:56:39 +00:00
sta L2A10
2018-03-06 04:11:14 +00:00
lda #<(dir_buffer + header_length)
sta ptr
lda #>(dir_buffer + header_length)
sta ptr+1
L2997: lda dir_buffer + file_count_offset
2018-03-03 03:56:39 +00:00
cmp L2A10
bne L29B1
2018-03-03 17:04:07 +00:00
L299F: MLI_CALL CLOSE, close_params
2018-03-06 05:20:00 +00:00
beq :+
2018-03-05 03:38:55 +00:00
jmp fail_copy
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
: jsr remove_filename_from_buffer
2018-03-05 03:38:55 +00:00
jsr remove_filename_from_path0
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
L29B1: ldy #0
2018-03-06 04:11:14 +00:00
lda (ptr),y
2018-03-03 03:56:39 +00:00
bne L29BA
jmp L29F6
L29BA: and #$0F
tay
2018-03-06 04:11:14 +00:00
L29BD: lda (ptr),y
2018-03-05 03:38:55 +00:00
sta filename_buf,y
2018-03-03 03:56:39 +00:00
dey
bne L29BD
2018-03-06 04:11:14 +00:00
lda (ptr),y
2018-03-03 03:56:39 +00:00
and #$0F
2018-03-05 03:38:55 +00:00
sta filename_buf,y
jsr append_filename_to_path0
2018-03-06 05:20:00 +00:00
jsr append_filename_to_buffer
2018-03-03 17:04:07 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-05 03:38:55 +00:00
jmp fail_copy
2018-03-03 03:56:39 +00:00
2018-03-03 17:04:07 +00:00
: lda get_file_info_params::file_type
2018-03-06 05:20:00 +00:00
sta file_type
2018-03-06 04:11:14 +00:00
jsr create_file_for_copy
2018-03-06 05:20:00 +00:00
cmp #ERR_DUPLICATE_FILENAME
2018-03-06 04:11:14 +00:00
beq :+
jsr copy_normal_file
2018-03-06 05:20:00 +00:00
: jsr remove_filename_from_buffer
2018-03-05 03:38:55 +00:00
jsr remove_filename_from_path0
2018-03-03 03:56:39 +00:00
inc L2A10
2018-03-06 04:11:14 +00:00
L29F6: add16_8 ptr, dir_buffer + entry_length_offset, ptr
lda ptr+1
cmp #>(dir_buffer + $200)
2018-03-03 03:56:39 +00:00
bcs L2A0D
jmp L2997
L2A0D: jmp L299F
2018-03-03 03:57:30 +00:00
L2A10: .byte 0
2018-03-06 04:11:14 +00:00
.endproc
copy_directory := copy_directory_impl::start
;;; ============================================================
.proc copy_normal_file
2018-03-06 05:20:00 +00:00
;; Open source
2018-03-06 04:11:14 +00:00
: MLI_CALL OPEN, open_srcfile_params
beq :+
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-06 04:11:14 +00:00
jmp :-
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
;; Open destination
2018-03-06 04:11:14 +00:00
: MLI_CALL OPEN, open_dstfile_params
beq :+
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-06 04:11:14 +00:00
jmp :-
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
: 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
2018-03-06 05:20:00 +00:00
;; Read a chunk
loop: copy16 #max_copy_count, read_srcfile_params::request_count
2018-03-06 04:11:14 +00:00
read: MLI_CALL READ, read_srcfile_params
beq :+
2018-03-06 05:20:00 +00:00
cmp #ERR_END_OF_FILE
2018-03-06 04:11:14 +00:00
beq done
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-06 04:11:14 +00:00
jmp read
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
;; Write the chunk
2018-03-06 04:11:14 +00:00
: 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
2018-03-03 06:44:28 +00:00
beq :+
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-06 04:11:14 +00:00
jmp write
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
;; More to copy?
2018-03-06 04:11:14 +00:00
: lda write_dstfile_params::trans_count
2018-03-06 05:20:00 +00:00
cmp #<max_copy_count
2018-03-06 04:11:14 +00:00
bne done
lda write_dstfile_params::trans_count+1
2018-03-06 05:20:00 +00:00
cmp #>max_copy_count
2018-03-06 04:11:14 +00:00
beq loop
2018-03-06 05:20:00 +00:00
;; Close source and destination
2018-03-06 04:11:14 +00:00
done: MLI_CALL CLOSE, close_srcfile_params
MLI_CALL CLOSE, close_dstfile_params
2018-03-03 03:56:39 +00:00
rts
2018-03-06 04:11:14 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
;;; ============================================================
.proc create_file_for_copy
2018-03-04 03:43:41 +00:00
;; Copy file_type, aux_type, storage_type
2018-03-06 04:11:14 +00:00
ldx #7
2018-03-04 03:43:41 +00:00
: lda get_file_info_params,x
sta create_params,x
2018-03-03 03:56:39 +00:00
dex
2018-03-04 03:43:41 +00:00
cpx #3
bne :-
MLI_CALL CREATE, create_params
2018-03-06 04:11:14 +00:00
beq :+
2018-03-06 05:20:00 +00:00
cmp #ERR_DUPLICATE_FILENAME
2018-03-06 04:11:14 +00:00
beq :+
2018-03-05 03:38:55 +00:00
jsr fail_copy
2018-03-06 04:11:14 +00:00
: rts
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
;;; ============================================================
2018-03-06 05:20:00 +00:00
.proc check_desktop2_on_device
lda active_device
cmp #$3E ; ???
bne :+
jmp next
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
;; Check slot for signature bytes
: and #$70 ; Compute $Cn00
2018-03-03 03:56:39 +00:00
lsr a
lsr a
lsr a
lsr a
ora #$C0
2018-03-04 22:01:19 +00:00
sta $08+1
lda #0
2018-03-03 03:56:39 +00:00
sta $08
2018-03-04 22:01:19 +00:00
ldx #0 ; Compare signature bytes
2018-03-06 05:20:00 +00:00
bloop: lda sig_offsets,x
2018-03-03 03:56:39 +00:00
tay
lda ($08),y
2018-03-04 20:04:29 +00:00
cmp sig_bytes,x
2018-03-06 05:20:00 +00:00
bne error
2018-03-03 03:56:39 +00:00
inx
2018-03-04 22:01:19 +00:00
cpx #4 ; Number of signature bytes
2018-03-06 05:20:00 +00:00
bcc bloop
2018-03-04 22:01:19 +00:00
ldy #$FB ; Also check $CnFB
2018-03-03 03:56:39 +00:00
lda ($08),y
and #$01
2018-03-06 05:20:00 +00:00
bne next
error: sec
2018-03-03 03:56:39 +00:00
rts
2018-03-06 05:20:00 +00:00
next: MLI_CALL GET_PREFIX, get_prefix_params2
bne error
;; Append "DeskTop2" to path at $D00
2018-03-03 03:56:39 +00:00
ldx $0D00
2018-03-05 03:38:55 +00:00
ldy #0
2018-03-06 05:20:00 +00:00
loop: inx
2018-03-03 03:56:39 +00:00
iny
2018-03-05 03:38:55 +00:00
lda str_desktop2,y
2018-03-03 03:56:39 +00:00
sta $0D00,x
2018-03-05 03:38:55 +00:00
cpy str_desktop2
2018-03-06 05:20:00 +00:00
bne loop
2018-03-03 03:56:39 +00:00
stx $0D00
2018-03-06 05:20:00 +00:00
;; ... and get info
2018-03-04 04:03:42 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params4
2018-03-06 05:20:00 +00:00
beq error
clc ; ok
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
str_desktop2:
PASCAL_STRING "DeskTop2"
2018-03-06 04:11:14 +00:00
.endproc
2018-03-04 22:01:19 +00:00
;;; ============================================================
.proc write_desktop1_impl
DEFINE_OPEN_PARAMS open_params, str_desktop1_path, $1000
2018-03-04 03:27:31 +00:00
str_desktop1_path:
PASCAL_STRING "DeskTop/DESKTOP1"
2018-03-04 22:01:19 +00:00
DEFINE_WRITE_PARAMS write_params, $2000, $45
DEFINE_CLOSE_PARAMS close_params
2018-03-03 17:04:07 +00:00
2018-03-04 22:01:19 +00:00
start: MLI_CALL OPEN, open_params
bne :+
lda open_params::ref_num
sta write_params::ref_num
sta close_params::ref_num
MLI_CALL WRITE, write_params
bne :+
MLI_CALL CLOSE, close_params
: rts
.endproc
write_desktop1 := write_desktop1_impl::start
2018-03-03 17:04:07 +00:00
2018-03-04 22:01:19 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
L2B57: addr_call copy_to_lc2_a, L2005
2018-03-03 04:32:55 +00:00
rts
2018-03-03 03:56:39 +00:00
2018-03-03 03:57:30 +00:00
.byte 0
2018-03-04 19:35:04 +00:00
2018-03-05 03:38:55 +00:00
path0: .res 65, 0
2018-03-03 17:04:07 +00:00
;;; ============================================================
2018-03-04 19:35:04 +00:00
;;; Launch FILER - used if machine is not 128k
;;; Relocated to $300 before invoking
2018-03-03 17:04:07 +00:00
2018-03-04 19:35:04 +00:00
saved_org := *
2018-03-04 05:33:40 +00:00
.proc launch_filer
2018-03-03 17:04:07 +00:00
.org $300
sys_start := $2000
MLI_CALL OPEN, open_params
beq :+
2018-03-04 20:04:29 +00:00
jmp rts1
2018-03-03 03:56:39 +00:00
2018-03-03 17:04:07 +00:00
: lda open_params_ref_num
sta read_params_ref_num
MLI_CALL READ, read_params
beq :+
2018-03-04 20:04:29 +00:00
jmp rts1
2018-03-03 06:44:28 +00:00
2018-03-03 17:04:07 +00:00
: MLI_CALL CLOSE, close_params
beq :+
2018-03-04 20:04:29 +00:00
jmp rts1
2018-03-03 03:56:39 +00:00
2018-03-03 17:04:07 +00:00
: jmp sys_start
DEFINE_OPEN_PARAMS open_params, filename, $800
open_params_ref_num := open_params::ref_num
DEFINE_READ_PARAMS read_params, sys_start, MLI - sys_start
read_params_ref_num := read_params::ref_num
DEFINE_CLOSE_PARAMS close_params
2018-03-05 03:38:55 +00:00
filename:
PASCAL_STRING "FILER"
2018-03-03 17:04:07 +00:00
.endproc
2018-03-04 20:04:29 +00:00
.assert .sizeof(launch_filer) <= $D0, error, "Routine length exceeded"
2018-03-03 17:04:07 +00:00
;;; ============================================================
2018-03-04 19:35:04 +00:00
.org (saved_org + .sizeof(launch_filer))
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
filenum:
.byte 0 ; index of file being copied
2018-03-06 05:24:21 +00:00
flag: .byte 0 ; written but not read ???
2018-03-05 03:38:55 +00:00
slot: .byte 0
2018-03-03 17:04:07 +00:00
2018-03-04 20:04:29 +00:00
DEFINE_WRITE_BLOCK_PARAMS write_block_params, prodos_loader_blocks, 0
2018-03-03 17:04:07 +00:00
write_block_params_unit_num := write_block_params::unit_num
2018-03-04 20:04:29 +00:00
DEFINE_WRITE_BLOCK_PARAMS write_block_params2, prodos_loader_blocks + 512, 1
2018-03-03 17:04:07 +00:00
write_block_params2_unit_num := write_block_params2::unit_num
PAD_TO $2C00
2018-03-03 03:56:39 +00:00
2018-03-03 04:32:55 +00:00
;;; ============================================================
2018-03-04 20:04:29 +00:00
prodos_loader_blocks:
2018-03-03 04:32:55 +00:00
.assert * = $2C00, error, "Segment length mismatch"
.incbin "inc/pdload.dat"
2018-03-04 20:04:29 +00:00
2018-03-07 02:36:51 +00:00
.endproc ; copy_desktop_to_ramcard
2018-03-04 20:04:29 +00:00
2018-03-03 04:32:55 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-04 20:04:29 +00:00
.assert * = $3000, error, "Segment length mismatch"
2018-03-06 05:30:13 +00:00
;;; SPECULATION: This copies Selector entries marked
;;; "Down load" / "At boot" to the RAMCard as well
2018-03-07 02:36:51 +00:00
.proc copy_selector_entries_to_ramcard
;; File format:
;; $ 0 - number of entries (max 24?)
;; $ 1 - ???
;; $ 2 - 24 * 16-byte data entries
;; $0 - label (length-prefixed, 15 bytes)
;; $F - active_flag
;; $182 - 24 * 64-byte pathname
;; $782 - EOF
2018-03-06 16:00:57 +00:00
selector_buffer := $4400
selector_buflen := $800
2018-03-07 02:36:51 +00:00
.proc process_selector_list
ptr := $6
2018-03-04 20:04:29 +00:00
jsr SLOT3ENTRY
2018-03-03 03:56:39 +00:00
jsr HOME
2018-03-04 19:35:04 +00:00
lda LCBANK2
lda LCBANK2
2018-03-06 16:00:57 +00:00
lda $D3FF ; ??? last byte of selector routine?
2018-03-03 03:56:39 +00:00
pha
2018-03-04 19:35:04 +00:00
lda ROMIN2
2018-03-03 03:56:39 +00:00
pla
2018-03-06 16:00:57 +00:00
bne :+
2018-03-05 03:38:55 +00:00
jmp invoke_selector_or_desktop
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
: lda LCBANK2
2018-03-04 19:35:04 +00:00
lda LCBANK2
2018-03-03 03:56:39 +00:00
ldx #$17
2018-03-06 16:00:57 +00:00
lda #0
: sta $D395,x
2018-03-03 03:56:39 +00:00
dex
2018-03-06 16:00:57 +00:00
bpl :-
2018-03-04 19:35:04 +00:00
lda ROMIN2
2018-03-07 02:36:51 +00:00
;; Load and iterate over the selector file
2018-03-04 22:01:19 +00:00
jsr read_selector_list
2018-03-05 03:38:55 +00:00
beq :+
2018-03-06 16:00:57 +00:00
jmp bail
2018-03-05 03:38:55 +00:00
: lda #0
2018-03-07 02:36:51 +00:00
sta entry_num
entry_loop:
lda entry_num
cmp selector_buffer ; done?
beq done_entries
jsr compute_label_addr
stax ptr
ldy #$0F ; check active flag
lda (ptr),y
bne next_entry
lda entry_num
jsr compute_path_addr
2018-03-03 03:56:39 +00:00
jsr L38B2
jsr L3489
2018-03-07 02:36:51 +00:00
2018-03-04 19:35:04 +00:00
lda LCBANK2
lda LCBANK2
2018-03-07 02:36:51 +00:00
ldx entry_num
2018-03-03 03:56:39 +00:00
lda #$FF
sta $D395,x
2018-03-04 19:35:04 +00:00
lda ROMIN2
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
next_entry:
inc entry_num
jmp entry_loop
done_entries:
;; Process entries again ???
lda #0
sta entry_num
entry_loop2:
lda entry_num
cmp selector_buffer + 1 ; ???
2018-03-06 16:00:57 +00:00
beq bail
2018-03-03 03:56:39 +00:00
clc
2018-03-07 02:36:51 +00:00
adc #8 ; offset by 8 ???
jsr compute_label_addr
stax ptr
2018-03-03 03:56:39 +00:00
ldy #$0F
2018-03-07 02:36:51 +00:00
lda (ptr),y ; check active flag
bne next_entry2
lda entry_num
2018-03-03 03:56:39 +00:00
clc
2018-03-07 02:36:51 +00:00
adc #8
jsr compute_path_addr
2018-03-03 03:56:39 +00:00
jsr L38B2
jsr L3489
2018-03-07 02:36:51 +00:00
2018-03-04 19:35:04 +00:00
lda LCBANK2
lda LCBANK2
2018-03-07 02:36:51 +00:00
lda entry_num
2018-03-03 03:56:39 +00:00
clc
2018-03-07 02:36:51 +00:00
adc #8
2018-03-03 03:56:39 +00:00
tax
lda #$FF
sta $D395,x
2018-03-04 19:35:04 +00:00
lda ROMIN2
2018-03-07 02:36:51 +00:00
next_entry2:
inc entry_num
jmp entry_loop2
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
bail: jmp invoke_selector_or_desktop
2018-03-07 02:36:51 +00:00
entry_num:
.byte 0
.endproc
2018-03-06 16:00:57 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
DEFINE_OPEN_PARAMS open_path2_params, path2, $0800
DEFINE_READ_PARAMS read_4bytes_params, buf_4_bytes, 4
buf_4_bytes: .res 4, 0
2018-03-04 02:39:21 +00:00
DEFINE_CLOSE_PARAMS close_params5
2018-03-07 02:36:51 +00:00
DEFINE_READ_PARAMS read_39bytes_params, L3150, 39
DEFINE_READ_PARAMS read_5bytes_params, buf_5_bytes, 5
buf_5_bytes: .res 5, 0
.res 4, 0
DEFINE_CLOSE_PARAMS close_srcdir_params
DEFINE_CLOSE_PARAMS close_dstdir_params
.byte 1
2018-03-05 03:38:55 +00:00
.addr path2
2018-03-04 03:27:31 +00:00
2018-03-07 02:36:51 +00:00
dircopy_buffer := $0B00
2018-03-04 03:43:41 +00:00
2018-03-07 02:36:51 +00:00
DEFINE_OPEN_PARAMS open_srcdir_params, path2, $0D00
DEFINE_OPEN_PARAMS open_dstdir_params, path1, $1C00
DEFINE_READ_PARAMS read_srcdir_params, $1100, dircopy_buffer
DEFINE_WRITE_PARAMS write_dstdir_params, $1100, dircopy_buffer
DEFINE_CREATE_PARAMS create_dir_params, path1, ACCESS_DEFAULT
2018-03-05 03:38:55 +00:00
DEFINE_CREATE_PARAMS create_params2, path1, 0
2018-03-04 03:43:41 +00:00
L3124: .byte $00,$00
2018-03-04 04:03:42 +00:00
2018-03-05 03:38:55 +00:00
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params2, path2
2018-03-04 04:03:42 +00:00
.byte $00
2018-03-05 03:38:55 +00:00
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params3, path1
2018-03-07 02:36:51 +00:00
2018-03-04 04:03:42 +00:00
.byte $00,$02,$00,$00,$00
2018-03-04 03:27:31 +00:00
2018-03-07 02:36:51 +00:00
L3150: .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
2018-03-03 04:22:09 +00:00
L3160: .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $40,$35,$3D,$35,$86,$31,$60,$00
2018-03-04 03:27:31 +00:00
2018-03-05 03:38:55 +00:00
path1: .res 65, 0
path2: .res 65, 0
2018-03-04 03:27:31 +00:00
L320A: .res 64, 0
L324A: .res 64, 0
2018-03-07 02:36:51 +00:00
L328A: .res 16, 0
2018-03-03 04:22:09 +00:00
L329A: .byte $00
2018-03-03 03:56:39 +00:00
L329B: .byte $0D
2018-03-03 04:22:09 +00:00
L329C: .byte $00
2018-03-07 02:36:51 +00:00
ref_num:.byte $00
2018-03-03 04:22:09 +00:00
L329E: .byte $00
2018-03-05 03:38:55 +00:00
L329F: .res 170, 0
2018-03-03 04:22:09 +00:00
L3349: .byte $00
L334A: .byte $00
2018-03-07 02:36:51 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
L334B: ldx L3349
lda L329E
sta L329F,x
inx
stx L3349
rts
2018-03-07 02:36:51 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
L3359: ldx L3349
dex
lda L329F,x
sta L329E
stx L3349
rts
2018-03-07 02:36:51 +00:00
;;; ============================================================
.proc L3367
lda #$00
2018-03-03 03:56:39 +00:00
sta L329C
sta L334A
2018-03-07 02:36:51 +00:00
MLI_CALL OPEN, open_path2_params
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
: lda open_path2_params::ref_num
sta ref_num
sta read_4bytes_params::ref_num
MLI_CALL READ, read_4bytes_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 06:44:28 +00:00
: jsr L33A4
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
L3392: lda ref_num
2018-03-04 02:39:21 +00:00
sta close_params5::ref_num
MLI_CALL CLOSE, close_params5
2018-03-07 02:36:51 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-07 02:36:51 +00:00
: rts
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
.proc L33A4
inc L329C
lda ref_num
sta read_39bytes_params::ref_num
MLI_CALL READ, read_39bytes_params
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-07 02:36:51 +00:00
: inc L334A
2018-03-03 03:56:39 +00:00
lda L334A
cmp L329B
2018-03-07 02:36:51 +00:00
bcc done
lda #0
2018-03-03 16:26:04 +00:00
sta L334A
2018-03-07 02:36:51 +00:00
lda ref_num
sta read_5bytes_params::ref_num
MLI_CALL READ, read_5bytes_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-07 02:36:51 +00:00
: lda read_5bytes_params::trans_count
cmp read_5bytes_params::request_count
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
done: return #0
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
L33E3: lda L329C
sta L329E
jsr L3392
jsr L334B
jsr L36FB
jsr L3367
rts
L33F6: jsr L3392
jsr L346E
jsr L3720
jsr L3359
jsr L3367
jsr L340C
jsr L346B
rts
L340C: lda L329C
cmp L329E
2018-03-07 02:36:51 +00:00
beq :+
2018-03-03 03:56:39 +00:00
jsr L33A4
jmp L340C
2018-03-07 02:36:51 +00:00
: rts
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
.proc L341B
lda #$00
2018-03-03 03:56:39 +00:00
sta L329A
jsr L3367
2018-03-07 02:36:51 +00:00
loop: jsr L33A4
bne next
2018-03-03 03:56:39 +00:00
lda L3150
2018-03-07 02:36:51 +00:00
beq loop
2018-03-03 03:56:39 +00:00
lda L3150
sta L346F
and #$0F
sta L3150
lda #$00
sta L3467
jsr L3468
lda L3467
2018-03-07 02:36:51 +00:00
bne loop
2018-03-03 03:56:39 +00:00
lda L3160
cmp #$0F
2018-03-07 02:36:51 +00:00
bne loop
2018-03-03 03:56:39 +00:00
jsr L33E3
inc L329A
2018-03-07 02:36:51 +00:00
jmp loop
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
next: lda L329A
beq done
2018-03-03 03:56:39 +00:00
jsr L33F6
dec L329A
2018-03-07 02:36:51 +00:00
jmp loop
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
done: jsr L3392
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-03 03:57:30 +00:00
L3467: .byte 0
2018-03-07 02:36:51 +00:00
2018-03-03 03:56:39 +00:00
L3468: jmp L3540
L346B: jmp L353D
L346E: rts
2018-03-03 03:57:30 +00:00
L346F: .byte 0
2018-03-07 02:36:51 +00:00
2018-03-03 03:56:39 +00:00
ldy #$00
L3472: lda $0200,y
cmp #$8D
2018-03-07 02:36:51 +00:00
beq :+
2018-03-03 03:56:39 +00:00
and #$7F
2018-03-05 03:38:55 +00:00
sta path2+1,y
2018-03-03 03:56:39 +00:00
iny
jmp L3472
2018-03-07 02:36:51 +00:00
: sty path2
2018-03-03 03:56:39 +00:00
rts
2018-03-03 03:57:30 +00:00
.byte 0
.byte 0
.byte 0
2018-03-07 02:36:51 +00:00
2018-03-03 03:56:39 +00:00
L3489: lda #$FF
sta L353B
jsr L3777
2018-03-05 03:38:55 +00:00
ldx path1
2018-03-04 19:35:04 +00:00
lda #'/'
2018-03-05 03:38:55 +00:00
sta path1+1,x
inc path1
2018-03-03 03:56:39 +00:00
ldy #$00
2018-03-05 03:38:55 +00:00
ldx path1
2018-03-07 02:36:51 +00:00
: iny
2018-03-03 03:56:39 +00:00
inx
lda L328A,y
2018-03-05 03:38:55 +00:00
sta path1,x
2018-03-03 03:56:39 +00:00
cpy L328A
2018-03-07 02:36:51 +00:00
bne :-
2018-03-05 03:38:55 +00:00
stx path1
2018-03-04 04:03:42 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params3
2018-03-06 05:20:00 +00:00
cmp #ERR_FILE_NOT_FOUND
2018-03-03 16:26:04 +00:00
beq L34C4
2018-03-06 05:20:00 +00:00
cmp #ERR_VOL_NOT_FOUND
2018-03-03 16:26:04 +00:00
beq L34C4
2018-03-06 05:20:00 +00:00
cmp #ERR_PATH_NOT_FOUND
2018-03-03 03:56:39 +00:00
beq L34C4
rts
2018-03-04 04:03:42 +00:00
L34C4: MLI_CALL GET_FILE_INFO, get_file_info_params2
2018-03-03 16:26:04 +00:00
beq L34DD
2018-03-06 05:20:00 +00:00
cmp #ERR_VOL_NOT_FOUND
2018-03-03 16:26:04 +00:00
beq L34D4
2018-03-06 05:20:00 +00:00
cmp #ERR_FILE_NOT_FOUND
2018-03-03 03:56:39 +00:00
bne L34DA
2018-03-06 04:11:14 +00:00
L34D4: jsr show_insert_prompt
2018-03-03 03:56:39 +00:00
jmp L34C4
2018-03-06 04:11:14 +00:00
L34DA: jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
.proc L34DD
lda get_file_info_params2::storage_type
2018-03-06 05:24:21 +00:00
cmp #ST_VOLUME_DIRECTORY
2018-03-07 02:36:51 +00:00
beq is_dir
2018-03-06 05:24:21 +00:00
cmp #ST_LINKED_DIRECTORY
2018-03-07 02:36:51 +00:00
beq is_dir
2018-03-03 03:56:39 +00:00
lda #$00
2018-03-07 02:36:51 +00:00
beq :+
is_dir: lda #$FF
: sta is_dir_flag
2018-03-04 03:43:41 +00:00
;; copy file_type, aux_type, storage_type
ldy #7
2018-03-04 04:03:42 +00:00
: lda get_file_info_params2,y
2018-03-04 03:43:41 +00:00
sta create_params2,y
2018-03-03 03:56:39 +00:00
dey
2018-03-04 03:43:41 +00:00
cpy #3
bne :-
2018-03-06 05:27:41 +00:00
lda #ACCESS_DEFAULT
2018-03-04 03:43:41 +00:00
sta create_params2::access
2018-03-03 03:56:39 +00:00
jsr L35A9
bcc L350B
2018-03-06 04:11:14 +00:00
jmp show_no_space_prompt
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;; copy dates
L350B: ldx #3
: lda get_file_info_params2::create_date,x
2018-03-04 03:43:41 +00:00
sta create_params2::create_date,x
2018-03-03 03:56:39 +00:00
dex
2018-03-07 02:36:51 +00:00
bpl :-
;; create the file
2018-03-04 03:43:41 +00:00
lda create_params2::storage_type
2018-03-06 05:27:41 +00:00
cmp #ST_VOLUME_DIRECTORY
2018-03-07 02:36:51 +00:00
bne :+
2018-03-06 05:27:41 +00:00
lda #ST_LINKED_DIRECTORY
2018-03-04 03:43:41 +00:00
sta create_params2::storage_type
2018-03-07 02:36:51 +00:00
: MLI_CALL CREATE, create_params2
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
: lda is_dir_flag
beq do_dir
2018-03-03 03:56:39 +00:00
jmp L341B
2018-03-03 03:57:30 +00:00
.byte 0
2018-03-07 02:36:51 +00:00
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
do_dir: jmp copy_dir
is_dir_flag:
.byte 0
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-03 03:57:30 +00:00
L353B: .byte 0
L353C: .byte 0
2018-03-07 02:36:51 +00:00
L353D: jmp remove_filename_from_path1
2018-03-03 03:56:39 +00:00
L3540: lda L3160
cmp #$0F
bne L3574
jsr L36FB
2018-03-06 04:11:14 +00:00
jsr show_copying_screen
2018-03-04 04:03:42 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params2
2018-03-03 16:26:04 +00:00
beq L3566
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-07 02:36:51 +00:00
L3558: jsr remove_filename_from_path1
2018-03-03 03:56:39 +00:00
jsr L3720
lda #$FF
sta L3467
jmp L35A4
2018-03-07 02:36:51 +00:00
L3566: jsr append_filename_to_path1
jsr create_dir
2018-03-03 03:56:39 +00:00
bcs L3558
jsr L3720
jmp L35A4
2018-03-07 02:36:51 +00:00
L3574: jsr append_filename_to_path1
2018-03-03 03:56:39 +00:00
jsr L36FB
2018-03-06 04:11:14 +00:00
jsr show_copying_screen
2018-03-04 04:03:42 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params2
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-03 06:44:28 +00:00
: jsr L35A9
2018-03-03 03:56:39 +00:00
bcc L3590
2018-03-06 04:11:14 +00:00
jmp show_no_space_prompt
2018-03-03 03:56:39 +00:00
L3590: jsr L3720
2018-03-07 02:36:51 +00:00
jsr create_dir
2018-03-03 03:56:39 +00:00
bcs L35A5
jsr L36FB
2018-03-07 02:36:51 +00:00
jsr copy_dir
2018-03-03 03:56:39 +00:00
jsr L3720
2018-03-07 02:36:51 +00:00
jsr remove_filename_from_path1
2018-03-03 03:56:39 +00:00
L35A4: rts
2018-03-07 02:36:51 +00:00
L35A5: jsr remove_filename_from_path1
2018-03-03 03:56:39 +00:00
rts
2018-03-04 04:03:42 +00:00
L35A9: MLI_CALL GET_FILE_INFO, get_file_info_params2
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-03 06:44:28 +00:00
: lda #$00
2018-03-03 03:56:39 +00:00
sta L3641
sta L3642
2018-03-04 04:03:42 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params3
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 05:20:00 +00:00
cmp #ERR_FILE_NOT_FOUND
2018-03-03 03:56:39 +00:00
beq L35D7
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-04 04:03:42 +00:00
: copy16 get_file_info_params3::blocks_used, L3641
2018-03-05 03:38:55 +00:00
L35D7: lda path1
2018-03-03 03:56:39 +00:00
sta L363F
ldy #$01
L35DF: iny
2018-03-05 03:38:55 +00:00
cpy path1
2018-03-03 03:56:39 +00:00
bcs L3635
2018-03-05 03:38:55 +00:00
lda path1,y
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-03 03:56:39 +00:00
bne L35DF
tya
2018-03-05 03:38:55 +00:00
sta path1
2018-03-03 03:56:39 +00:00
sta L3640
2018-03-04 04:03:42 +00:00
MLI_CALL GET_FILE_INFO, get_file_info_params3
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-04 04:03:42 +00:00
: sub16 get_file_info_params3::aux_type, get_file_info_params3::blocks_used, L363D
2018-03-03 03:57:30 +00:00
sub16 L363D, L3641, L363D
2018-03-04 04:03:42 +00:00
cmp16 L363D, get_file_info_params2::blocks_used
2018-03-03 03:56:39 +00:00
bcs L3635
sec
bcs L3636
L3635: clc
L3636: lda L363F
2018-03-05 03:38:55 +00:00
sta path1
2018-03-03 03:56:39 +00:00
rts
2018-03-03 04:22:09 +00:00
L363D: .byte 0,0
2018-03-03 03:57:30 +00:00
L363F: .byte 0
L3640: .byte 0
L3641: .byte 0
L3642: .byte 0
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
2018-03-04 19:35:04 +00:00
2018-03-07 02:36:51 +00:00
.proc copy_dir
MLI_CALL OPEN, open_srcdir_params
beq :+
jsr handle_error_code
: MLI_CALL OPEN, open_dstdir_params
beq :+
jmp handle_error_code
: lda open_srcdir_params::ref_num
sta read_srcdir_params::ref_num
sta close_srcdir_params::ref_num
lda open_dstdir_params::ref_num
sta write_dstdir_params::ref_num
sta close_dstdir_params::ref_num
loop: copy16 #dircopy_buffer, read_srcdir_params::request_count
MLI_CALL READ, read_srcdir_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 05:20:00 +00:00
cmp #ERR_END_OF_FILE
2018-03-07 02:36:51 +00:00
beq finish
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
: copy16 read_srcdir_params::trans_count, write_dstdir_params::request_count
ora read_srcdir_params::trans_count
beq finish
MLI_CALL WRITE, write_dstdir_params
2018-03-03 06:44:28 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
: lda write_dstdir_params::trans_count
cmp #<dircopy_buffer
bne finish
lda write_dstdir_params::trans_count+1
cmp #>dircopy_buffer
beq loop
finish: MLI_CALL CLOSE, close_dstdir_params
MLI_CALL CLOSE, close_srcdir_params
2018-03-04 19:35:04 +00:00
jsr get_file_info_and_copy
jsr do_set_file_info
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
;; Copy file_type, aux_type, storage_type
.proc create_dir
ldx #7
2018-03-04 04:03:42 +00:00
: lda get_file_info_params2,x
2018-03-07 02:36:51 +00:00
sta create_dir_params,x
2018-03-03 03:56:39 +00:00
dex
2018-03-04 03:43:41 +00:00
cpx #3
bne :-
2018-03-06 05:27:41 +00:00
lda #ACCESS_DEFAULT
2018-03-07 02:36:51 +00:00
sta create_dir_params::access
;; Copy dates
ldx #3
: lda get_file_info_params2::create_date,x
sta create_dir_params::create_date,x
2018-03-03 03:56:39 +00:00
dex
2018-03-07 02:36:51 +00:00
bpl :-
;; Create it
lda create_dir_params::storage_type
2018-03-06 05:27:41 +00:00
cmp #ST_VOLUME_DIRECTORY
2018-03-07 02:36:51 +00:00
bne :+
2018-03-06 05:27:41 +00:00
lda #ST_LINKED_DIRECTORY
2018-03-07 02:36:51 +00:00
sta create_dir_params::storage_type
: MLI_CALL CREATE, create_dir_params
2018-03-03 06:44:28 +00:00
clc
2018-03-07 02:36:51 +00:00
beq :+
2018-03-06 04:11:14 +00:00
jmp handle_error_code
2018-03-07 02:36:51 +00:00
: rts
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-03 03:57:30 +00:00
.byte 0
.byte 0
.byte 0
.byte 0
2018-03-05 03:38:55 +00:00
2018-03-03 03:56:39 +00:00
L36FB: lda L3150
bne L3701
rts
L3701: ldx #$00
2018-03-05 03:38:55 +00:00
ldy path2
2018-03-04 19:35:04 +00:00
lda #'/'
2018-03-05 03:38:55 +00:00
sta path2+1,y
2018-03-03 03:56:39 +00:00
iny
L370C: cpx L3150
bcs L371C
2018-03-07 02:36:51 +00:00
lda L3150+1,x
2018-03-05 03:38:55 +00:00
sta path2+1,y
2018-03-03 03:56:39 +00:00
inx
iny
jmp L370C
2018-03-05 03:38:55 +00:00
L371C: sty path2
2018-03-03 03:56:39 +00:00
rts
2018-03-05 03:38:55 +00:00
L3720: ldx path2
2018-03-03 03:56:39 +00:00
bne L3726
rts
2018-03-05 03:38:55 +00:00
L3726: lda path2,x
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-03 03:56:39 +00:00
beq L3734
dex
bne L3726
2018-03-05 03:38:55 +00:00
stx path2
2018-03-03 03:56:39 +00:00
rts
L3734: dex
2018-03-05 03:38:55 +00:00
stx path2
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
;;; ============================================================
.proc append_filename_to_path1
lda L3150
bne :+
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
: ldx #0
2018-03-05 03:38:55 +00:00
ldy path1
2018-03-04 19:35:04 +00:00
lda #'/'
2018-03-05 03:38:55 +00:00
sta path1+1,y
2018-03-03 03:56:39 +00:00
iny
2018-03-07 02:36:51 +00:00
loop: cpx L3150
bcs done
lda L3150+1,x
2018-03-05 03:38:55 +00:00
sta path1+1,y
2018-03-03 03:56:39 +00:00
inx
iny
2018-03-07 02:36:51 +00:00
jmp loop
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
done: sty path1
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
.proc remove_filename_from_path1
ldx path1
bne loop
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
loop: lda path1,x
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-07 02:36:51 +00:00
beq done
2018-03-03 03:56:39 +00:00
dex
2018-03-07 02:36:51 +00:00
bne loop
2018-03-05 03:38:55 +00:00
stx path1
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
done: dex
2018-03-05 03:38:55 +00:00
stx path1
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;;; ============================================================
.proc L3777
ldy #0
2018-03-03 03:56:39 +00:00
sta L353C
dey
2018-03-07 02:36:51 +00:00
loop: iny
2018-03-03 03:56:39 +00:00
lda L324A,y
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-07 02:36:51 +00:00
bne :+
2018-03-03 03:56:39 +00:00
sty L353C
2018-03-07 02:36:51 +00:00
: sta path2,y
2018-03-03 03:56:39 +00:00
cpy L324A
2018-03-07 02:36:51 +00:00
bne loop
2018-03-03 03:56:39 +00:00
ldy L320A
2018-03-07 02:36:51 +00:00
loop2: lda L320A,y
2018-03-05 03:38:55 +00:00
sta path1,y
2018-03-03 03:56:39 +00:00
dey
2018-03-07 02:36:51 +00:00
bpl loop2
2018-03-03 03:56:39 +00:00
rts
2018-03-07 02:36:51 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-04 19:35:04 +00:00
.proc do_set_file_info
lda #7 ; SET_FILE_INFO param_count
2018-03-04 04:03:42 +00:00
sta get_file_info_params3
MLI_CALL SET_FILE_INFO, get_file_info_params3
2018-03-04 19:35:04 +00:00
lda #10 ; GET_FILE_INFO param_count
2018-03-04 04:03:42 +00:00
sta get_file_info_params3
2018-03-03 03:56:39 +00:00
rts
2018-03-04 19:35:04 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-04 19:35:04 +00:00
.proc get_file_info_and_copy
MLI_CALL GET_FILE_INFO, get_file_info_params2
bne fail
2018-03-03 03:56:39 +00:00
ldx #$0A
2018-03-04 19:35:04 +00:00
: lda get_file_info_params2::access,x
2018-03-04 04:03:42 +00:00
sta get_file_info_params3::access,x
2018-03-03 03:56:39 +00:00
dex
2018-03-04 19:35:04 +00:00
bpl :-
2018-03-03 03:56:39 +00:00
rts
2018-03-04 19:35:04 +00:00
fail: pla
2018-03-03 03:56:39 +00:00
pla
rts
2018-03-04 19:35:04 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
;;; ============================================================
2018-03-07 02:36:51 +00:00
;;; Compute first offset into selector file - A*16 + 2
2018-03-06 16:00:57 +00:00
2018-03-07 02:36:51 +00:00
.proc compute_label_addr
2018-03-06 16:00:57 +00:00
addr := selector_buffer + $2
jsr ax_times_16
2018-03-03 03:56:39 +00:00
clc
2018-03-06 16:00:57 +00:00
adc #<addr
2018-03-03 03:56:39 +00:00
tay
txa
2018-03-06 16:00:57 +00:00
adc #>addr
2018-03-03 03:56:39 +00:00
tax
tya
rts
2018-03-06 16:00:57 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
;;; ============================================================
2018-03-07 02:36:51 +00:00
;;; Compute second offset into selector file - A*64 + $182
2018-03-06 16:00:57 +00:00
2018-03-07 02:36:51 +00:00
.proc compute_path_addr
2018-03-06 16:00:57 +00:00
addr := selector_buffer + $182
jsr ax_times_64
2018-03-03 03:56:39 +00:00
clc
2018-03-06 16:00:57 +00:00
adc #<addr
2018-03-03 03:56:39 +00:00
tay
txa
2018-03-06 16:00:57 +00:00
adc #>addr
2018-03-03 03:56:39 +00:00
tax
tya
rts
2018-03-06 16:00:57 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-04 02:39:21 +00:00
.byte $00,$00
2018-03-03 16:26:04 +00:00
2018-03-04 22:01:19 +00:00
;;; ============================================================
.proc read_selector_list_impl
DEFINE_OPEN_PARAMS open_params, str_selector_list, $4000
2018-03-04 03:27:31 +00:00
str_selector_list:
PASCAL_STRING "Selector.List"
2018-03-06 16:00:57 +00:00
DEFINE_READ_PARAMS read_params, selector_buffer, selector_buflen
2018-03-04 22:01:19 +00:00
DEFINE_CLOSE_PARAMS close_params
start: MLI_CALL OPEN, open_params
bne :+
lda open_params::ref_num
sta read_params::ref_num
MLI_CALL READ, read_params
MLI_CALL CLOSE, close_params
lda #0
: rts
.endproc
read_selector_list := read_selector_list_impl::start
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 16:00:57 +00:00
.proc ax_times_16
ldx #0
stx bits
.repeat 4
2018-03-03 03:56:39 +00:00
asl a
2018-03-06 16:00:57 +00:00
rol bits
.endrepeat
ldx bits
2018-03-03 03:56:39 +00:00
rts
2018-03-06 16:00:57 +00:00
bits: .byte 0
.endproc
;;; ============================================================
.proc ax_times_64
ldx #0
stx bits
.repeat 6
2018-03-03 03:56:39 +00:00
asl a
2018-03-06 16:00:57 +00:00
rol bits
.endrepeat
ldx bits
2018-03-03 03:56:39 +00:00
rts
2018-03-06 16:00:57 +00:00
bits: .byte $00
.endproc
2018-03-05 03:38:55 +00:00
;;; ============================================================
.proc invoke_selector_or_desktop_impl
sys_start := $2000
DEFINE_OPEN_PARAMS open_desktop2_params, str_desktop2, $5000
DEFINE_OPEN_PARAMS open_selector_params, str_selector, $5400
DEFINE_READ_PARAMS read_params, sys_start, $0400
DEFINE_CLOSE_PARAMS close_everything_params
2018-03-04 03:43:41 +00:00
str_selector:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "Selector"
2018-03-04 03:43:41 +00:00
str_desktop2:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "DeskTop2"
2018-03-03 06:44:28 +00:00
2018-03-05 03:38:55 +00:00
start: MLI_CALL CLOSE, close_everything_params
MLI_CALL OPEN, open_selector_params
beq selector
MLI_CALL OPEN, open_desktop2_params
beq desktop2
2018-03-03 03:56:39 +00:00
2018-03-05 03:38:55 +00:00
brk ; just crash
desktop2:
lda open_desktop2_params::ref_num
jmp read
selector:
lda open_selector_params::ref_num
read: sta read_params::ref_num
MLI_CALL READ, read_params
MLI_CALL CLOSE, close_everything_params
jmp sys_start
.endproc
invoke_selector_or_desktop := invoke_selector_or_desktop_impl::start
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-03 03:57:30 +00:00
L38B2: stax $06
2018-03-03 03:56:39 +00:00
ldy #$00
lda ($06),y
tay
L38BB: lda ($06),y
sta L324A,y
dey
bpl L38BB
ldy L324A
L38C6: lda L324A,y
and #$7F
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-03 03:56:39 +00:00
beq L38D2
dey
bne L38C6
L38D2: dey
sty L324A
L38D6: lda L324A,y
and #$7F
2018-03-04 19:35:04 +00:00
cmp #'/'
2018-03-03 03:56:39 +00:00
beq L38E2
dey
bpl L38D6
L38E2: ldx #$00
L38E4: iny
inx
lda L324A,y
sta L328A,x
cpy L324A
bne L38E4
stx L328A
2018-03-04 19:35:04 +00:00
lda LCBANK2
lda LCBANK2
2018-03-03 03:56:39 +00:00
ldy $D3EE
L38FD: lda $D3EE,y
sta L320A,y
dey
bpl L38FD
2018-03-03 06:44:28 +00:00
lda ROMIN2
rts
2018-03-03 03:56:39 +00:00
2018-03-04 04:03:42 +00:00
str_copying:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "Copying:"
2018-03-04 04:03:42 +00:00
str_insert:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "Insert the source disk and press <Return> to continue or <ESC> to cancel"
2018-03-04 04:03:42 +00:00
str_not_enough:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "Not enough room in the RAMCard, press <Return> to continue"
2018-03-04 04:03:42 +00:00
str_error:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "Error $"
2018-03-04 04:03:42 +00:00
str_occured:
2018-03-03 04:53:10 +00:00
PASCAL_STRING " occured when copying "
2018-03-04 04:03:42 +00:00
str_not_completed:
2018-03-03 04:53:10 +00:00
PASCAL_STRING "The copy was not completed, press <Return> to continue."
2018-03-04 04:03:42 +00:00
2018-03-06 04:11:14 +00:00
;;; ============================================================
.proc show_copying_screen
jsr HOME
lda #0
2018-03-03 04:06:58 +00:00
jsr VTABZ
2018-03-06 04:11:14 +00:00
lda #0
jsr set_htab
2018-03-04 05:33:40 +00:00
addr_call cout_string, str_copying
2018-03-05 03:38:55 +00:00
addr_call cout_string_newline, path2
2018-03-03 03:56:39 +00:00
rts
2018-03-06 04:11:14 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
.proc show_insert_prompt
lda #0
2018-03-03 04:06:58 +00:00
jsr VTABZ
2018-03-06 04:11:14 +00:00
lda #0
jsr set_htab
2018-03-04 05:33:40 +00:00
addr_call cout_string, str_insert
jsr wait_enter_escape
cmp #CHAR_ESCAPE
2018-03-06 04:11:14 +00:00
bne :+
jmp finish_and_invoke
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
: jsr HOME
2018-03-03 03:56:39 +00:00
rts
2018-03-06 04:11:14 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
.proc show_no_space_prompt
lda #0
2018-03-03 04:22:09 +00:00
jsr VTABZ
2018-03-06 04:11:14 +00:00
lda #0
jsr set_htab
2018-03-04 05:33:40 +00:00
addr_call cout_string, str_not_enough
jsr wait_enter_escape
2018-03-03 03:56:39 +00:00
jsr HOME
2018-03-05 03:38:55 +00:00
jmp invoke_selector_or_desktop
2018-03-06 04:11:14 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
.proc handle_error_code
2018-03-06 05:20:00 +00:00
cmp #ERR_OVERRUN_ERROR
2018-03-05 03:38:55 +00:00
bne :+
2018-03-06 04:11:14 +00:00
jsr show_no_space_prompt
jmp finish_and_invoke
2018-03-03 03:56:39 +00:00
2018-03-06 05:20:00 +00:00
: cmp #ERR_VOLUME_DIR_FULL
2018-03-04 19:35:04 +00:00
bne show_error
2018-03-06 04:11:14 +00:00
jsr show_no_space_prompt
jmp finish_and_invoke
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-04 19:35:04 +00:00
.proc show_error
;; Show error
pha
2018-03-04 05:33:40 +00:00
addr_call cout_string, str_error
2018-03-03 03:56:39 +00:00
pla
2018-03-03 04:06:58 +00:00
jsr PRBYTE
2018-03-04 05:33:40 +00:00
addr_call cout_string, str_occured
2018-03-05 03:38:55 +00:00
addr_call cout_string_newline, path2
2018-03-04 05:33:40 +00:00
addr_call cout_string, str_not_completed
2018-03-04 19:35:04 +00:00
;; Wait for keyboard
2018-03-04 05:33:40 +00:00
sta KBDSTRB
2018-03-04 19:35:04 +00:00
loop: lda KBD
bpl loop
2018-03-03 03:56:39 +00:00
and #$7F
2018-03-04 05:33:40 +00:00
sta KBDSTRB
2018-03-04 19:35:04 +00:00
cmp #'M'
2018-03-03 03:56:39 +00:00
beq L3A97
2018-03-04 19:35:04 +00:00
cmp #'m'
2018-03-03 03:56:39 +00:00
beq L3A97
2018-03-04 19:35:04 +00:00
cmp #CHAR_RETURN
bne loop
2018-03-03 03:56:39 +00:00
jsr HOME
2018-03-05 03:38:55 +00:00
jmp invoke_selector_or_desktop
2018-03-04 19:35:04 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-03 04:06:58 +00:00
L3A97: jmp MONZ
2018-03-03 03:56:39 +00:00
2018-03-04 19:35:04 +00:00
;;; ============================================================
2018-03-04 05:33:40 +00:00
.proc cout_string_newline
jsr cout_string
lda #$80|CHAR_RETURN
2018-03-03 03:56:39 +00:00
jmp COUT
2018-03-04 05:33:40 +00:00
;; fall through
.endproc
2018-03-03 03:56:39 +00:00
2018-03-04 05:33:40 +00:00
.proc cout_string
ptr := $6
stax ptr
ldy #0
lda (ptr),y
sta len
beq done
loop: iny
2018-03-03 03:56:39 +00:00
lda ($06),y
ora #$80
jsr COUT
2018-03-04 05:33:40 +00:00
len := *+1
2018-03-04 19:35:04 +00:00
cpy #0 ; self-modified
2018-03-04 05:33:40 +00:00
bne loop
done: rts
.endproc
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
.proc set_htab
sta CH
2018-03-03 03:56:39 +00:00
rts
2018-03-06 04:11:14 +00:00
.endproc
2018-03-03 03:56:39 +00:00
2018-03-04 05:33:40 +00:00
;;; ============================================================
.proc wait_enter_escape
lda KBD
bpl wait_enter_escape
sta KBDSTRB
2018-03-03 03:56:39 +00:00
and #$7F
2018-03-04 05:33:40 +00:00
cmp #CHAR_ESCAPE
beq done
cmp #CHAR_RETURN
bne wait_enter_escape
done: rts
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-06 04:11:14 +00:00
.proc finish_and_invoke
jsr HOME
2018-03-05 03:38:55 +00:00
jmp invoke_selector_or_desktop
2018-03-06 04:11:14 +00:00
.endproc
;;; ============================================================
2018-03-03 03:56:39 +00:00
2018-03-07 02:36:51 +00:00
;; unused?
2018-03-04 19:35:04 +00:00
L3AD8: .byte 0 ; ???
2018-03-03 03:56:39 +00:00
.byte $02
2018-03-04 19:35:04 +00:00
L3ADA: iny
2018-03-03 03:56:39 +00:00
inx
dec $0200
2018-03-06 04:11:14 +00:00
bne finish_and_invoke
2018-03-03 03:56:39 +00:00
lda #$A2
sta $0200
rts
2018-03-07 02:36:51 +00:00
.endproc ; copy_selector_entries_to_ramcard
2018-03-04 19:35:04 +00:00
;;; ============================================================
;;; ??? Is this relocated? Part of ProDOS? RAMCard driver?
2018-03-07 02:36:51 +00:00
;;; ============================================================
2018-03-04 19:35:04 +00:00
.proc WTF
2018-03-04 20:04:29 +00:00
;; Branch targets before/after this block
L3AB7 := $3AB7
2018-03-04 19:35:04 +00:00
L400C := $400C
L402B := $402B
L402C := $402C
2018-03-04 20:04:29 +00:00
;; Routines and data outside this block
2018-03-04 19:35:04 +00:00
L9F8C := $9F8C
L9FAB := $9FAB
L9FB0 := $9FB0
LA1F5 := $A1F5
LA24C := $A24C
LA62F := $A62F
LA66C := $A66C
LAB37 := $AB37
LAD46 := $AD46
LB1A0 := $B1A0
LB245 := $B245
LB2FB := $B2FB
LB3EB := $B3EB
LB41F := $B41F
LB462 := $B462
LB4A5 := $B4A5
LB522 := $B522
LB666 := $B666
LB7D0 := $B7D0
LBE50 := $BE50
LBE70 := $BE70
2018-03-03 03:57:30 +00:00
copy16 #$BCBD, $BEC8
2018-03-04 05:33:40 +00:00
lda DEVNUM
2018-03-03 03:56:39 +00:00
sta $BEC7
lda #$C5
jsr LBE70
2018-03-04 19:35:04 +00:00
bcs L3AB7
2018-03-03 03:56:39 +00:00
lda $BCBD
and #$0F
tax
inx
stx $BCBC
lda #$AF
sta $BCBD
jsr LB7D0
2018-03-04 19:35:04 +00:00
bcs L3AB7
2018-03-03 03:56:39 +00:00
jsr LA66C
ldx #$36
jsr L9FB0
jsr LAB37
lda $BEB9
ldx $BEBA
ldy #$3D
jsr LA62F
lda $BEBC
ldx $BEBD
ldy #$26
jsr LA62F
lda $BEB9
sec
sbc $BEBC
pha
lda $BEBA
sbc $BEBD
tax
pla
ldy #$10
jsr LA62F
clc
rts
2018-03-03 03:57:30 +00:00
ldax #$0F01
2018-03-03 03:56:39 +00:00
ldy $BEBB
cpy #$0F
bne L3B58
stx $BEB8
L3B58: jsr LB1A0
bcs L3B93
2018-03-03 03:57:30 +00:00
copy16 #$0259, $BED7
copy16 #$002B, $BED9
2018-03-03 03:56:39 +00:00
lda #$CA
jsr LBE70
bcs L3B93
ldx #$03
L3B7A: lda $027C,x
sta $BCB7,x
dex
bpl L3B7A
sta $BED9
lda #$01
sta $BCBB
lda #$00
sta $BEC9
sta $BECA
L3B93: rts
pha
lda $BE56
and #$04
beq L3B9F
ldx $BE6A
L3B9F: pla
cpx $BEB8
bne L3BC9
and $BEB7
beq L3BCD
lda $BC88
sta $BECF
lda #$0F
2018-03-04 05:33:40 +00:00
sta LEVEL
2018-03-03 03:56:39 +00:00
lda #$C8
jsr LBE70
bcs L3BC8
lda $BED0
sta $BED6
sta $BEDE
sta $BEC7
L3BC8: rts
L3BC9: lda #$0D
sec
rts
L3BCD: lda #$0A
sec
rts
L3BD1: lda $BEC9
and #$FE
sta $BEC9
ldy $BCBB
lda #$00
cpy $BCB8
bcc L3BED
tay
sty $BCBB
inc $BEC9
L3BEA: inc $BEC9
L3BED: dey
clc
bmi L3BF8
adc $BCB7
bcc L3BED
bcs L3BEA
L3BF8: adc #$04
sta $BEC8
lda #$CE
jsr LBE70
bcs L3C1D
lda #$CA
jsr LBE70
bcs L3C1D
inc $BCBB
lda $0259
and #$F0
beq L3BD1
dec $BCB9
bne L3C1D
dec $BCBA
L3C1D: rts
jmp (LBE50)
jsr LB41F
bcs L3C50
bit $BE4E
bpl L3C4C
sta $BEC7
lda #$00
sta $BEC8
sta $BEC9
sta $BECA
lda #$CE
jsr LBE70
bcs L3C45
lda $BEC7
bne L3CC3
L3C45: pha
jsr LB2FB
pla
sec
rts
L3C4C: lda #$14
sec
rts
L3C50: bit $BE43
bpl L3C5A
jsr LB2FB
bcs L3C63
L3C5A: lda $BEB8
cmp #$04
beq L3C65
lda #$0D
L3C63: sec
rts
L3C65: jsr LA1F5
bcs L3C63
lda #$00
sta $BEC8
lda $BC88
sta $BEC9
ldx $BE4D
beq L3C9E
tay
txa
asl a
asl a
adc $BC88
pha
L3C82: cmp $BC93,x
beq L3C8B
dex
bne L3C82
2018-03-03 03:57:30 +00:00
.byte 0
2018-03-03 03:56:39 +00:00
L3C8B: tya
sta $BC93,x
lda $BC9B,x
sta $BEC7
lda #$D2
jsr LBE70
bcc L3C9D
2018-03-03 03:57:30 +00:00
.byte 0
2018-03-03 03:56:39 +00:00
L3C9D: pla
L3C9E: sta $BC88
sta $BECF
lda #$00
2018-03-04 05:33:40 +00:00
sta LEVEL
2018-03-03 03:56:39 +00:00
lda #$C8
jsr LBE70
bcc L3CB7
pha
jsr LA24C
pla
sec
rts
L3CB7: ldx $BECF
stx $BC9B
lda $BED0
sta $BCA3
L3CC3: sta $BED6
sta $BEC7
sta $BED2
ldx $BEB9
stx $BE5F
ldx $BEBA
stx $BE60
jsr LB3EB
lda #$7F
sta $BED3
lda #$C9
jsr LBE70
lda $BE57
and #$03
beq L3CF4
jsr LB522
bcc L3CF4
jmp LB245
L3CF4: lda #$FF
sta $BE43
clc
rts
lda $BE43
bpl L3D0B
sta $BE4E
ldx #$08
lda $BC9B,x
jsr LB4A5
L3D0B: rts
bcs L3D47
lda $BE56
and #$01
bne L3D1D
ldx #$00
jsr L9F8C
jsr L9FAB
L3D1D: clc
rts
lda #$00
beq L3D2F
lda $BE56
and #$01
beq L3D2F
jsr LB41F
bcs L3D37
L3D2F: sta $BEDE
lda #$CD
jsr LBE70
L3D37: rts
php
jsr LB41F
bcs L3D4B
plp
lda #$14
sec
rts
L3D43: lda #$0D
sec
rts
L3D47: lda #$06
L3D49: sec
rts
L3D4B: plp
ldx #$00
ldy #$00
lda $BE57
and #$10
bne L3D5D
stx $BE60
sty $BE5F
L3D5D: lda $BE56
and #$04
eor #$04
beq L3D6B
lda #$04
sta $BE6A
L3D6B: bcc L3D8E
beq L3D47
sta $BEB8
lda #$C3
sta $BEB7
ldx $BE60
ldy $BE5F
stx $BEA6
stx $BEBA
sty $BEA5
sty $BEB9
jsr LAD46
bcs L3D49
L3D8E: lda $BEB8
cmp $BE6A
bne L3D43
cmp #$04
bne L3DAD
ldx $BEBA
ldy $BEB9
lda $BE57
and #$10
bne L3DAD
stx $BE60
sty $BE5F
L3DAD: jsr LA1F5
bcs L3D49
lda $BC88
sta $BECF
lda #$07
2018-03-04 05:33:40 +00:00
sta LEVEL
2018-03-03 03:56:39 +00:00
lda #$C8
jsr LBE70
bcc L3DCB
pha
jsr LA24C
pla
sec
rts
L3DCB: lda $BEB8
cmp #$0F
beq L3DD3
clc
L3DD3: lda #$00
ror a
sta $BE47
ldx $BE4D
lda $BC88
sta $BC94,x
lda $BED0
sta $BC9C,x
inc $BE4D
asl a
asl a
asl a
asl a
asl a
tax
lda $0280
ora $BE47
sta $BCFE,x
and #$7F
tay
cmp #$1E
bcc L3E03
lda #$1D
L3E03: sta $3A
lda $BE5F
sta $BCFF,x
lda $BE60
sta $BD00,x
L3E11: inx
lda $0280,y
sta $BD00,x
dey
dec $3A
bne L3E11
clc
rts
lda $BE56
and #$01
bne L3E2A
lda #$10
sec
rts
L3E2A: ldx $BE4D
beq L3E48
stx $BE4E
L3E32: stx $3B
lda $BC9B,x
jsr LB462
bne L3E43
ldx $3B
L3E3E: lda $BC9B,x
L3E41: clc
rts
L3E43: ldx $3B
dex
bne L3E32
L3E48: lda $BE43
bpl L3E5E
lda $BCA3
jsr LB462
bne L3E5E
lda #$FF
sta $BE4E
ldx #$08
bne L3E3E
L3E5E: lda #$12
sec
rts
asl a
asl a
asl a
asl a
asl a
tax
lda $BCFE,x
sta $BE47
and #$7F
cmp $0280
bne L3E98
tay
cmp #$1E
bcc L3E7C
lda #$1D
L3E7C: sta $3A
lda $BCFF,x
sta $BCA4
lda $BD00,x
sta $BCA5
L3E8A: inx
lda $0280,y
cmp $BD00,x
bne L3E98
dey
dec $3A
bne L3E8A
L3E98: rts
lda $BE56
and #$01
beq L3EF2
jsr LB41F
bcs L3E41
sta $BEDE
lda $BC93,x
sta $BC88
bit $BE4E
bmi L3ECF
ldy $BE4D
pha
lda $BC93,y
sta $BC93,x
pla
sta $BC93,y
lda $BC9B,x
pha
lda $BC9B,y
sta $BC9B,x
pla
sta $BC9B,y
L3ECF: lda #$00
2018-03-04 05:33:40 +00:00
sta LEVEL
2018-03-03 03:56:39 +00:00
lda #$CC
jsr LBE70
bcs L3F02
jsr LA24C
bit $BE4E
bpl L3EEE
pha
lda #$00
sta $BE43
sta $BE4E
pla
rts
L3EEE: dec $BE4D
rts
L3EF2: ldx $BE4D
beq L3F03
stx $BE4E
lda $BC9B,x
jsr LB4A5
bcc L3EF2
L3F02: rts
L3F03: lda #$00
sta $BEDE
lda #$07
2018-03-04 05:33:40 +00:00
sta LEVEL
2018-03-03 03:56:39 +00:00
lda #$CC
jmp LBE70
jsr LB41F
bcs L3F7F
sta $BED6
sta $BED2
bit $BE47
bmi L3F80
.byte $AD
.byte $57
2018-03-03 04:32:55 +00:00
ldx $0329,y
2018-03-03 03:56:39 +00:00
beq L3F7D
cmp #$03
beq L3F7D
and #$01
beq L3F3D
2018-03-03 03:57:30 +00:00
copy16 $BE65, $BE63
L3F3D: copy16 #$00EF, $BED9
2018-03-03 03:56:39 +00:00
sta $BED7
lda #$02
sta $BED8
lda #$7F
sta $BED3
lda #$C9
jsr LBE70
bcs L3F7F
L3F5B: lda $BE63
ora $BE64
clc
beq L3F80
lda #$CA
jsr LBE70
bcs L3F7F
lda $BE63
sbc #$00
sta $BE63
lda $BE64
sbc #$00
sta $BE64
bcs L3F5B
L3F7D: lda #$0B
L3F7F: sec
L3F80: rts
2018-03-03 03:57:30 +00:00
copy16 $BCA4, $BCAF
2018-03-03 03:56:39 +00:00
lda #$00
sta $BCB1
sta $BCB2
sta $BEC8
sta $BEC9
sta $BECA
2018-03-03 03:57:30 +00:00
L3F9E: lsr16 $BE65
2018-03-03 03:56:39 +00:00
ldx #$00
bcc L3FBF
clc
L3FA9: lda $BCAF,x
adc $BEC8,x
sta $BEC8,x
inx
txa
eor #$03
bne L3FA9
bcs L3FD2
ldx $BCB2
bne L3FD2
L3FBF: rol $BCAF,x
inx
txa
eor #$04
bne L3FBF
lda $BE65
ora $BE66
bne L3F9E
clc
rts
L3FD2: lda #$02
sec
rts
jsr LB41F
bcs L402B
sta $BED6
sta $BEC7
sta $BED2
bit $BE47
bmi L402C
jsr LB666
bcs L402B
ldx #$7F
ldy #$EF
lda $BE57
and #$10
beq L400C
ldy $BE5F
ldx $BE60
.byte $D0
2018-03-04 19:35:04 +00:00
.endproc ; WTF