Home » CEEFAX disks » telesoftware7.adl » 06-05-88/DISCCPY

06-05-88/DISCCPY

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware7.adl
Filename: 06-05-88/DISCCPY
Read OK:
File size: 1FEA bytes
Load address: FFFF0E00
Exec address: FFFF802B
File contents
  100REM DCOPY By Jagdish Sah
  110REM (c) The Micro User
  120REM call format: *DCOPY 0 1 FILE1 D.FILE2 B.FILE3
  130:
  140namelength=7:filestore=&1900:newname=&404
  150himem=&6:namelength=namelength+3:fileinfo=newname+namelength
  160osfile=&FFDD:osbyte=&FFF4:osrdch=&FFE0:osnewl=&FFE7:osasci=&FFE3
  170cmd_ptr=&70:fileinfo_ptr=&72:filename_ptr=&74:filestore_ptr=&76
  180temp=&78:oldrtn=&7A:no_of_files=&7C:last_file=&7D:param_blk=&7E
  190code%=&900
  200:
  210FOR I% =0 TO 2 STEP 2
  220P%=code%
  230[ OPT I%
  240.init
  250LDA &209:CMP #start DIV256:BEQ exit
  260STA oldrtn+1:LDA &208:STA oldrtn
  270 \  set up new oscli routine
  280SEI:LDA #start MOD256:STA &208
  290LDA #start DIV256:STA &209:CLI
  300.exit RTS
  310:
  320.out PLA:TAY:PLA:TAX:PLA
  330.old_cli JMP (oldrtn)
  340:
  350.start
  360PHA:TXA:PHA:TYA:PHA
  370STX cmd_ptr:STY cmd_ptr+1
  380LDX #(cmdend-command):LDY #0
  390STY no_of_files:STY last_file
  400\  check the command
  410JSR skipsp \ ignore leading spaces
  420.chkcmd
  430LDA (cmd_ptr),Y \ get typed command
  440CMP command,Y \ compare with the correct value
  450BNE out \ exit if command mis_match
  460INY:DEX:BNE chkcmd \ check for all characters
  470:
  480PLA:PLA:PLA \ command correct,so tidy stack
  490JSR osnewl:JSR update_cmdptr \ update command pointer
  500JSR init_pointers \ set pointers for file storage etc
  510JSR get_drive:STA in_dr \ get input drive no.
  520JSR get_drive:STA out_dr \ get output drive no.
  530LDX #input_drive MOD 256:LDY #input_drive DIV 256
  540JSR old_cli \ issue *DRIVE X command
  550JSR osnewl
  560:
  570.load_loop
  580:
  590\ check if enough room for file information exits
  600LDA fileinfo_ptr:CLC:ADC #10:STA temp
  610LDA fileinfo_ptr+1:ADC #0
  620CMP #8:BCC ok
  630LDA temp:BNE noroom \ info block <= &800
  640.ok
  650JSR get_filename:BCS nxt_file
  660JSR get_filesize:BCS nxt_file
  670:
  680 \ check if enough room in file store
  690JSR end_addr
  700SEC:LDA himem:SBC temp
  710LDA himem+1:SBC temp+1
  720BMI noroom
  730:
  740JSR load_file
  750JSR update_pointers
  760INC no_of_files
  770.nxt_file JSR osnewl
  780LDA last_file:BEQ load_loop:BNE set_for_save
  790:
  800.noroom
  810JSR message
  820OPT FNequs(" _ No room")
  830OPT FNequb(&0D)
  840OPT FNequb(255)
  850.set_for_save
  860LDA no_of_files:BEQ end
  870STA last_file:JSR init_pointers:JSR osnewl
  880JSR output_drive \ set output drive
  890.save_loop
  900JSR check_presence:JSR message
  910OPT FNequs("Save ")
  920OPT FNequb(255)
  930JSR print_filename
  940JSR message
  950OPT FNequs(" (Y/N) ? ")
  960OPT FNequb(255)
  970JSR end_addr
  980JSR get_yn
  990CPY #ASC"Y":BNE no_save
 1000JSR save_file
 1010.no_save
 1020JSR update_pointers
 1030DEC last_file:BNE save_loop
 1040JSR message
 1050OPT FNequb(&0D)
 1060OPT FNequb(&0D)
 1070OPT FNequs("Another copy (Y/N) ? ")
 1080OPT FNequb(255)
 1090JSR get_yn
 1100CPY #ASC"Y":BEQ set_for_save
 1110.end RTS
 1120:
 1130 \  *** SUBROUTINES ***
 1140:
 1150.skipsp
 1160LDA (cmd_ptr),Y:INY
 1170CMP #ASC" ":BEQ skipsp
 1180DEY:BEQ ucp2
 1190:
 1200 \ update command pointer
 1210.update_cmdptr
 1220INC cmd_ptr:BNE ucp:INC cmd_ptr+1
 1230.ucp DEY:BNE update_cmdptr
 1240.ucp2 RTS
 1250:
 1260 \ set file storage area etc
 1270.init_pointers
 1280 \ filestore_ptr = filestore
 1290LDA #filestore MOD 256:STA filestore_ptr
 1300LDA #filestore DIV 256:STA filestore_ptr+1
 1310 \ filename_ptr = fileinfo
 1320 \ fileinfo_ptr = fileinfo + namelength
 1330LDA #fileinfo MOD 256:STA filename_ptr
 1340CLC:ADC #namelength:STA fileinfo_ptr
 1350LDA #fileinfo DIV 256:STA filename_ptr+1
 1360ADC #0:STA fileinfo_ptr+1
 1370RTS
 1380:
 1390 \ find end addr+1 of the file
 1400.end_addr
 1410LDY #8:LDA (fileinfo_ptr),Y:INY \ get file size
 1420CLC:ADC filestore_ptr:STA temp
 1430LDA (fileinfo_ptr),Y
 1440ADC filestore_ptr+1:STA temp+1
 1450RTS
 1460:
 1470 \ update pointers for file storage etc
 1480.update_pointers
 1490 \ filename_ptr = fileinfo_ptr + 10
 1500CLC:LDA fileinfo_ptr:ADC #10:STA filename_ptr
 1510LDA fileinfo_ptr+1:ADC #0:STA filename_ptr+1
 1520 \ fileinfo_ptr = filename_ptr + namelength
 1530CLC:LDA filename_ptr:ADC #namelength:STA fileinfo_ptr
 1540LDA filename_ptr+1:ADC #0:STA fileinfo_ptr+1
 1550LDA temp:STA filestore_ptr
 1560LDA temp+1:STA filestore_ptr+1
 1570RTS
 1580:
 1590 \ get next file name from the command line
 1600.get_filename
 1610LDY #0:STY newname:JSR skipsp \ ignore leading spaces
 1620.gfname
 1630LDA (cmd_ptr),Y
 1640CMP #&0D:BEQ lastfile2 \ last file terminated by &0D
 1650CMP #ASC" ":BEQ got_file
 1660JSR osasci:CMP #ASC"*":BEQ asterisk
 1670STA (filename_ptr),Y
 1680INY:BNE gfname
 1690.lastfile2 INC last_file
 1700.got_file
 1710LDA #&0D:STA (filename_ptr),Y \ &0D as file name terminator
 1720TYA:INY:JSR update_cmdptr
 1730CMP #namelength:BCS len_err
 1740RTS
 1750.asterisk
 1760LDA #&0D:STA (filename_ptr),Y
 1770TYA:PHA:INY:JSR update_cmdptr
 1780.asterisk2
 1790LDA (cmd_ptr),Y
 1800CMP #&0D:BEQ lastfile3
 1810CMP #ASC" ":BEQ got_file2
 1820STA newname,Y:JSR osasci
 1830INY:BNE asterisk2
 1840.lastfile3 INC last_file
 1850.got_file2
 1860LDA #&0D:STA newname,Y
 1870TYA:INY:JSR update_cmdptr
 1880TAX:PLA:CMP #namelength:BCS len_err
 1890CPX #namelength:BCS len_err
 1900RTS
 1910.len_err
 1920JSR message
 1930OPT FNequs(" _ Bad filename")
 1940OPT FNequb(255)
 1950SEC:RTS
 1960:
 1970.get_drive
 1980JSR get_filename:JSR osnewl:LDY #0
 1990LDA (filename_ptr),Y
 2000CMP #ASC"0":BCC dr_err
 2010CMP #ASC"4":BCS dr_err
 2020RTS
 2030.dr_err
 2040BRK
 2050OPT FNequb(&CD)
 2060OPT FNequb(&0D)
 2070OPT FNequs("Bad drive")
 2080OPT FNequb(&0D)
 2090OPT FNequb(0)
 2100:
 2110 \ call osfile with A=5
 2120 \ save load addr, exec. addr and file size
 2130.get_filesize
 2140JSR set_blk
 2150LDA #5:JSR osfile
 2160CMP #1:BNE file_not_found
 2170LDY #0
 2180.gfs2 LDA param_blk+2,Y:STA (fileinfo_ptr),Y
 2190INY:CPY #10:BNE gfs2
 2200CLC:RTS
 2210.file_not_found
 2220JSR message
 2230OPT FNequs(" _ not found")
 2240OPT FNequb(255)
 2250SEC:RTS
 2260:
 2270.set_blk
 2280LDA filename_ptr:STA param_blk
 2290LDA filename_ptr+1:STA param_blk+1
 2300LDA #0:LDY #2
 2310.sb STA param_blk,Y:INY:CPY #18:BNE sb
 2320LDX #param_blk MOD 256:LDY #param_blk DIV 256
 2330RTS
 2340:
 2350.load_file
 2360JSR set_blk:LDA filestore_ptr:STA param_blk+2
 2370LDA filestore_ptr+1:STA param_blk+3
 2380LDA #&FF:JSR osfile \ load file
 2390LDA newname:BEQ no_rename:LDY #0
 2400.yes_rename
 2410LDA newname,Y:STA (filename_ptr),Y
 2420INY:CMP #&0D:BNE yes_rename
 2430.no_rename
 2440RTS
 2450:
 2460.check_presence
 2470JSR set_blk:LDA #5:JSR osfile
 2480CMP #1:BNE not_present
 2490JSR message
 2500OPT FNequb(&0D)
 2510OPT FNequb(129)
 2520OPT FNequs("It exists on the destination disk.")
 2530OPT FNequb(&0D)
 2540OPT FNequb(255)
 2550.not_present
 2560RTS
 2570:
 2580.save_file
 2590JSR set_blk:LDY #0
 2600.sf
 2610LDA (fileinfo_ptr),Y:STA param_blk+2,Y
 2620INY:CPY #8:BNE sf
 2630LDA filestore_ptr:STA param_blk+10
 2640LDA filestore_ptr+1:STA param_blk+11
 2650LDA temp:STA param_blk+14
 2660LDA temp+1:STA param_blk+15
 2670LDY #param_blk DIV 256:LDA #0:JMP osfile
 2680:
 2690 \ get 'Y' or 'N'
 2700.get_yn
 2710LDA #15:LDX #1:JSR osbyte \ flush input buffer
 2720.yn
 2730JSR getkey
 2740AND #&5F:CMP #ASC"Y":BEQ yn2
 2750CMP #ASC"N":BNE yn
 2760.yn2
 2770TAY:JSR osasci:JMP osnewl
 2780.getkey
 2790JSR osrdch \ get a char in A
 2800CMP #&1B:BEQ escape:RTS
 2810.escape
 2820BRK
 2830OPT FNequb(17)
 2840OPT FNequb(&0D)
 2850OPT FNequs("Escape")
 2860OPT FNequb(&0D)
 2870OPT FNequb(0)
 2880:
 2890.print_filename
 2900LDY #0
 2910.pfn
 2920LDA (filename_ptr),Y
 2930CMP #&0D:BEQ pfn2
 2940JSR osasci:INY:BNE pfn
 2950.pfn2
 2960RTS
 2970:
 2980.message
 2990PLA:STA temp:PLA:STA temp+1
 3000LDY #1
 3010.mes
 3020LDA (temp),Y
 3030CMP #255:BEQ mes2
 3040JSR osasci:INY:BNE mes
 3050.mes2
 3060INY:TYA:CLC:ADC temp:STA temp
 3070LDA #0:ADC temp+1:STA temp+1
 3080JMP (temp)
 3090:
 3100.command
 3110OPT FNequs("*DCOPY")
 3120.cmdend
 3130:
 3140.input_drive
 3150OPT FNequs("DRIVE ")
 3160.in_dr
 3170OPT FNequs("0")
 3180OPT FNequb(&0D)
 3190:
 3200.output_drive
 3210LDA in_dr:CMP out_dr:BNE output_dr2
 3220JSR message
 3230OPT FNequb(131)
 3240OPT FNequs("Insert destination disk & tap a key")
 3250OPT FNequb(&0D)
 3260OPT FNequb(255)
 3270LDA #15:LDX #1:JSR osbyte:JMP getkey
 3280.output_dr2
 3290LDX #output_dr MOD 256:LDY #output_dr DIV 256
 3300JMP old_cli \ issue *DRIVE X command & return
 3310.output_dr
 3320OPT FNequs("DRIVE ")
 3330.out_dr
 3340OPT FNequs("0")
 3350OPT FNequb(&0D)
 3360]:NEXT
 3370:
 3380C%=0
 3390FOR I%=code% TO P%-1
 3400C%=C%+?I%
 3410NEXT:PRINT''"Checksum=";C%
 3420DIM X% 30:Y%=X% DIV 256
 3430$X%="S.DCOPYMC "+STR$~(code%)+" "+STR$~(P%)
 3440PRINT'"Do you want to save the machine code"'"(Y/N) ?";
 3450A$=GET$:PRINTA$:IF A$="Y":CALL &FFF7
 3460END
 3470:
 3480DEFFNequb(A%)
 3490?P%=A%:P%=P%+1
 3500=I%
 3510:
 3520DEFFNequs(A$)
 3530$P%=A$:P%=P%+LEN(A$)
 3540=I%
d� DCOPY By Jagdish Sah
n� (c) The Micro User
x3� call format: *DCOPY 0 1 FILE1 D.FILE2 B.FILE3
�:
�-namelength=7:filestore=&1900:newname=&404
�@himem=&6:namelength=namelength+3:fileinfo=newname+namelength
�Dosfile=&FFDD:osbyte=&FFF4:osrdch=&FFE0:osnewl=&FFE7:osasci=&FFE3
�Ccmd_ptr=&70:fileinfo_ptr=&72:filename_ptr=&74:filestore_ptr=&76
�Ctemp=&78:oldrtn=&7A:no_of_files=&7C:last_file=&7D:param_blk=&7E
�code%=&900
�:
�� I% =0 � 2 � 2
�P%=code%
�[ OPT I%
�	.init
�%LDA &209:CMP #start �256:BEQ exit
$STA oldrtn+1:LDA &208:STA oldrtn
  \  set up new oscli routine
 SEI:LDA #start �256:STA &208
" LDA #start �256:STA &209:CLI
,
.exit RTS
6:
@.out PLA:TAY:PLA:TAX:PLA
J.old_cli JMP (oldrtn)
T:
^
.start
hPHA:TXA:PHA:TYA:PHA
rSTX cmd_ptr:STY cmd_ptr+1
| LDX #(cmdend-command):LDY #0
�!STY no_of_files:STY last_file
�\  check the command
�&JSR skipsp \ ignore leading spaces
�.chkcmd
�'LDA (cmd_ptr),Y \ get typed command
�2CMP command,Y \ compare with the correct value
�'BNE out \ exit if command mis_match
�1INY:DEX:BNE chkcmd \ check for all characters
�:
�/PLA:PLA:PLA \ command correct,so tidy stack
�9JSR osnewl:JSR update_cmdptr \ update command pointer
�9JSR init_pointers \ set pointers for file storage etc
�1JSR get_drive:STA in_dr \ get input drive no.
3JSR get_drive:STA out_dr \ get output drive no.
1LDX #input_drive � 256:LDY #input_drive � 256
(JSR old_cli \ issue *DRIVE X command
&JSR osnewl
0:
:.load_loop
D:
N5\ check if enough room for file information exits
X)LDA fileinfo_ptr:CLC:ADC #10:STA temp
bLDA fileinfo_ptr+1:ADC #0
lCMP #8:BCC ok
v,LDA temp:BNE noroom \ info block <= &800
�.ok
�!JSR get_filename:BCS nxt_file
�!JSR get_filesize:BCS nxt_file
�:
�) \ check if enough room in file store
�JSR end_addr
�SEC:LDA himem:SBC temp
�LDA himem+1:SBC temp+1
�BMI noroom
�:
�JSR load_file
�JSR update_pointers
�INC no_of_files
.nxt_file JSR osnewl
0LDA last_file:BEQ load_loop:BNE set_for_save
:
 .noroom
*JSR message
4OPT �equs(" _ No room")
>OPT �equb(&0D)
HOPT �equb(255)
R.set_for_save
\LDA no_of_files:BEQ end
f.STA last_file:JSR init_pointers:JSR osnewl
p'JSR output_drive \ set output drive
z.save_loop
�"JSR check_presence:JSR message
�OPT �equs("Save ")
�OPT �equb(255)
�JSR print_filename
�JSR message
�OPT �equs(" (Y/N) ? ")
�OPT �equb(255)
�JSR end_addr
�JSR get_yn
�CPY #�"Y":BNE no_save
�JSR save_file
�.no_save
�JSR update_pointers
DEC last_file:BNE save_loop
JSR message
OPT �equb(&0D)
$OPT �equb(&0D)
.&OPT �equs("Another copy (Y/N) ? ")
8OPT �equb(255)
BJSR get_yn
LCPY #�"Y":BEQ set_for_save
V.end RTS
`:
j \  *** SUBROUTINES ***
t:
~.skipsp
�LDA (cmd_ptr),Y:INY
�CMP #�" ":BEQ skipsp
�DEY:BEQ ucp2
�:
� \ update command pointer
�.update_cmdptr
�%INC cmd_ptr:BNE ucp:INC cmd_ptr+1
�.ucp DEY:BNE update_cmdptr
�
.ucp2 RTS
�:
�  \ set file storage area etc
�.init_pointers
  \ filestore_ptr = filestore

*LDA #filestore � 256:STA filestore_ptr
,LDA #filestore � 256:STA filestore_ptr+1
 \ filename_ptr = fileinfo
(+ \ fileinfo_ptr = fileinfo + namelength
2(LDA #fileinfo � 256:STA filename_ptr
<(CLC:ADC #namelength:STA fileinfo_ptr
F*LDA #fileinfo � 256:STA filename_ptr+1
PADC #0:STA fileinfo_ptr+1
ZRTS
d:
n" \ find end addr+1 of the file
x
.end_addr
�3LDY #8:LDA (fileinfo_ptr),Y:INY \ get file size
�"CLC:ADC filestore_ptr:STA temp
�LDA (fileinfo_ptr),Y
�"ADC filestore_ptr+1:STA temp+1
�RTS
�:
�+ \ update pointers for file storage etc
�.update_pointers
�' \ filename_ptr = fileinfo_ptr + 10
�1CLC:LDA fileinfo_ptr:ADC #10:STA filename_ptr
�0LDA fileinfo_ptr+1:ADC #0:STA filename_ptr+1
�/ \ fileinfo_ptr = filename_ptr + namelength
�9CLC:LDA filename_ptr:ADC #namelength:STA fileinfo_ptr
0LDA filename_ptr+1:ADC #0:STA fileinfo_ptr+1
LDA temp:STA filestore_ptr
"LDA temp+1:STA filestore_ptr+1
"RTS
,:
6/ \ get next file name from the command line
@.get_filename
J9LDY #0:STY newname:JSR skipsp \ ignore leading spaces
T.gfname
^LDA (cmd_ptr),Y
h8CMP #&0D:BEQ lastfile2 \ last file terminated by &0D
rCMP #�" ":BEQ got_file
|%JSR osasci:CMP #�"*":BEQ asterisk
�STA (filename_ptr),Y
�INY:BNE gfname
�.lastfile2 INC last_file
�
.got_file
�?LDA #&0D:STA (filename_ptr),Y \ &0D as file name terminator
�TYA:INY:JSR update_cmdptr
�CMP #namelength:BCS len_err
�RTS
�
.asterisk
�!LDA #&0D:STA (filename_ptr),Y
�!TYA:PHA:INY:JSR update_cmdptr
�.asterisk2
�LDA (cmd_ptr),Y
CMP #&0D:BEQ lastfile3
CMP #�" ":BEQ got_file2
STA newname,Y:JSR osasci
&INY:BNE asterisk2
0.lastfile3 INC last_file
:.got_file2
DLDA #&0D:STA newname,Y
NTYA:INY:JSR update_cmdptr
X'TAX:PLA:CMP #namelength:BCS len_err
bCPX #namelength:BCS len_err
lRTS
v.len_err
�JSR message
� OPT �equs(" _ Bad filename")
�OPT �equb(255)
�SEC:RTS
�:
�.get_drive
�&JSR get_filename:JSR osnewl:LDY #0
�LDA (filename_ptr),Y
�CMP #�"0":BCC dr_err
�CMP #�"4":BCS dr_err
�RTS
�.dr_err
�BRK
OPT �equb(&CD)
OPT �equb(&0D)
OPT �equs("Bad drive")
 OPT �equb(&0D)
*OPT �equb(0)
4:
> \ call osfile with A=5
H/ \ save load addr, exec. addr and file size
R.get_filesize
\JSR set_blk
fLDA #5:JSR osfile
pCMP #1:BNE file_not_found
z
LDY #0
�0.gfs2 LDA param_blk+2,Y:STA (fileinfo_ptr),Y
�INY:CPY #10:BNE gfs2
�CLC:RTS
�.file_not_found
�JSR message
�OPT �equs(" _ not found")
�OPT �equb(255)
�SEC:RTS
�:
�.set_blk
�"LDA filename_ptr:STA param_blk
�&LDA filename_ptr+1:STA param_blk+1
�LDA #0:LDY #2
	*.sb STA param_blk,Y:INY:CPY #18:BNE sb
	-LDX #param_blk � 256:LDY #param_blk � 256
	RTS
	$:
	..load_file
	81JSR set_blk:LDA filestore_ptr:STA param_blk+2
	B'LDA filestore_ptr+1:STA param_blk+3
	L#LDA #&FF:JSR osfile \ load file
	V$LDA newname:BEQ no_rename:LDY #0
	`.yes_rename
	j&LDA newname,Y:STA (filename_ptr),Y
	tINY:CMP #&0D:BNE yes_rename
	~.no_rename
	�RTS
	�:
	�.check_presence
	�!JSR set_blk:LDA #5:JSR osfile
	�CMP #1:BNE not_present
	�JSR message
	�OPT �equb(&0D)
	�OPT �equb(129)
	�3OPT �equs("It exists on the destination disk.")
	�OPT �equb(&0D)
	�OPT �equb(255)
	�.not_present
RTS

:
.save_file
JSR set_blk:LDY #0
(.sf
2*LDA (fileinfo_ptr),Y:STA param_blk+2,Y
<INY:CPY #8:BNE sf
F&LDA filestore_ptr:STA param_blk+10
P(LDA filestore_ptr+1:STA param_blk+11
ZLDA temp:STA param_blk+14
dLDA temp+1:STA param_blk+15
n*LDY #param_blk � 256:LDA #0:JMP osfile
x:
� \ get 'Y' or 'N'
�.get_yn
�2LDA #15:LDX #1:JSR osbyte \ flush input buffer
�.yn
�JSR getkey
�� #&5F:CMP #�"Y":BEQ yn2
�CMP #�"N":BNE yn
�.yn2
�TAY:JSR osasci:JMP osnewl
�.getkey
� JSR osrdch \ get a char in A
�CMP #&1B:BEQ escape:RTS
�.escape
BRK
OPT �equb(17)
OPT �equb(&0D)
"OPT �equs("Escape")
,OPT �equb(&0D)
6OPT �equb(0)
@:
J.print_filename
T
LDY #0
^.pfn
hLDA (filename_ptr),Y
rCMP #&0D:BEQ pfn2
|JSR osasci:INY:BNE pfn
�	.pfn2
�RTS
�:
�.message
�PLA:STA temp:PLA:STA temp+1
�
LDY #1
�.mes
�LDA (temp),Y
�CMP #255:BEQ mes2
�JSR osasci:INY:BNE mes
�	.mes2
�!INY:TYA:CLC:ADC temp:STA temp
� LDA #0:ADC temp+1:STA temp+1
JMP (temp)
:
.command
&OPT �equs("*DCOPY")
0.cmdend
::
D.input_drive
NOPT �equs("DRIVE ")
X
.in_dr
bOPT �equs("0")
lOPT �equb(&0D)
v:
�.output_drive
�'LDA in_dr:CMP out_dr:BNE output_dr2
�JSR message
�OPT �equb(131)
�4OPT �equs("Insert destination disk & tap a key")
�OPT �equb(&0D)
�OPT �equb(255)
�(LDA #15:LDX #1:JSR osbyte:JMP getkey
�.output_dr2
�-LDX #output_dr � 256:LDY #output_dr � 256
�1JMP old_cli \ issue *DRIVE X command & return
�.output_dr
�OPT �equs("DRIVE ")

.out_dr

OPT �equs("0")

OPT �equb(&0D)

 ]:�

*:

4C%=0

>� I%=code% � P%-1

H
C%=C%+?I%

R�:�''"Checksum=";C%

\� X% 30:Y%=X% � 256

f)$X%="S.DCOPYMC "+�~(code%)+" "+�~(P%)

p7�'"Do you want to save the machine code"'"(Y/N) ?";

zA$=�:�A$:� A$="Y":� &FFF7

��

�:

�ݤequb(A%)

�?P%=A%:P%=P%+1

�=I%

�:

�ݤequs(A$)

�$P%=A$:P%=P%+�(A$)

�=I%
�
00000000  0d 00 64 1a f4 20 44 43  4f 50 59 20 42 79 20 4a  |..d.. DCOPY By J|
00000010  61 67 64 69 73 68 20 53  61 68 0d 00 6e 18 f4 20  |agdish Sah..n.. |
00000020  28 63 29 20 54 68 65 20  4d 69 63 72 6f 20 55 73  |(c) The Micro Us|
00000030  65 72 0d 00 78 33 f4 20  63 61 6c 6c 20 66 6f 72  |er..x3. call for|
00000040  6d 61 74 3a 20 2a 44 43  4f 50 59 20 30 20 31 20  |mat: *DCOPY 0 1 |
00000050  46 49 4c 45 31 20 44 2e  46 49 4c 45 32 20 42 2e  |FILE1 D.FILE2 B.|
00000060  46 49 4c 45 33 0d 00 82  05 3a 0d 00 8c 2d 6e 61  |FILE3....:...-na|
00000070  6d 65 6c 65 6e 67 74 68  3d 37 3a 66 69 6c 65 73  |melength=7:files|
00000080  74 6f 72 65 3d 26 31 39  30 30 3a 6e 65 77 6e 61  |tore=&1900:newna|
00000090  6d 65 3d 26 34 30 34 0d  00 96 40 68 69 6d 65 6d  |me=&404...@himem|
000000a0  3d 26 36 3a 6e 61 6d 65  6c 65 6e 67 74 68 3d 6e  |=&6:namelength=n|
000000b0  61 6d 65 6c 65 6e 67 74  68 2b 33 3a 66 69 6c 65  |amelength+3:file|
000000c0  69 6e 66 6f 3d 6e 65 77  6e 61 6d 65 2b 6e 61 6d  |info=newname+nam|
000000d0  65 6c 65 6e 67 74 68 0d  00 a0 44 6f 73 66 69 6c  |elength...Dosfil|
000000e0  65 3d 26 46 46 44 44 3a  6f 73 62 79 74 65 3d 26  |e=&FFDD:osbyte=&|
000000f0  46 46 46 34 3a 6f 73 72  64 63 68 3d 26 46 46 45  |FFF4:osrdch=&FFE|
00000100  30 3a 6f 73 6e 65 77 6c  3d 26 46 46 45 37 3a 6f  |0:osnewl=&FFE7:o|
00000110  73 61 73 63 69 3d 26 46  46 45 33 0d 00 aa 43 63  |sasci=&FFE3...Cc|
00000120  6d 64 5f 70 74 72 3d 26  37 30 3a 66 69 6c 65 69  |md_ptr=&70:filei|
00000130  6e 66 6f 5f 70 74 72 3d  26 37 32 3a 66 69 6c 65  |nfo_ptr=&72:file|
00000140  6e 61 6d 65 5f 70 74 72  3d 26 37 34 3a 66 69 6c  |name_ptr=&74:fil|
00000150  65 73 74 6f 72 65 5f 70  74 72 3d 26 37 36 0d 00  |estore_ptr=&76..|
00000160  b4 43 74 65 6d 70 3d 26  37 38 3a 6f 6c 64 72 74  |.Ctemp=&78:oldrt|
00000170  6e 3d 26 37 41 3a 6e 6f  5f 6f 66 5f 66 69 6c 65  |n=&7A:no_of_file|
00000180  73 3d 26 37 43 3a 6c 61  73 74 5f 66 69 6c 65 3d  |s=&7C:last_file=|
00000190  26 37 44 3a 70 61 72 61  6d 5f 62 6c 6b 3d 26 37  |&7D:param_blk=&7|
000001a0  45 0d 00 be 0e 63 6f 64  65 25 3d 26 39 30 30 0d  |E....code%=&900.|
000001b0  00 c8 05 3a 0d 00 d2 13  e3 20 49 25 20 3d 30 20  |...:..... I% =0 |
000001c0  b8 20 32 20 88 20 32 0d  00 dc 0c 50 25 3d 63 6f  |. 2 . 2....P%=co|
000001d0  64 65 25 0d 00 e6 0c 5b  20 4f 50 54 20 49 25 0d  |de%....[ OPT I%.|
000001e0  00 f0 09 2e 69 6e 69 74  0d 00 fa 25 4c 44 41 20  |....init...%LDA |
000001f0  26 32 30 39 3a 43 4d 50  20 23 73 74 61 72 74 20  |&209:CMP #start |
00000200  81 32 35 36 3a 42 45 51  20 65 78 69 74 0d 01 04  |.256:BEQ exit...|
00000210  24 53 54 41 20 6f 6c 64  72 74 6e 2b 31 3a 4c 44  |$STA oldrtn+1:LD|
00000220  41 20 26 32 30 38 3a 53  54 41 20 6f 6c 64 72 74  |A &208:STA oldrt|
00000230  6e 0d 01 0e 20 20 5c 20  20 73 65 74 20 75 70 20  |n...  \  set up |
00000240  6e 65 77 20 6f 73 63 6c  69 20 72 6f 75 74 69 6e  |new oscli routin|
00000250  65 0d 01 18 20 53 45 49  3a 4c 44 41 20 23 73 74  |e... SEI:LDA #st|
00000260  61 72 74 20 83 32 35 36  3a 53 54 41 20 26 32 30  |art .256:STA &20|
00000270  38 0d 01 22 20 4c 44 41  20 23 73 74 61 72 74 20  |8.." LDA #start |
00000280  81 32 35 36 3a 53 54 41  20 26 32 30 39 3a 43 4c  |.256:STA &209:CL|
00000290  49 0d 01 2c 0d 2e 65 78  69 74 20 52 54 53 0d 01  |I..,..exit RTS..|
000002a0  36 05 3a 0d 01 40 1c 2e  6f 75 74 20 50 4c 41 3a  |6.:..@..out PLA:|
000002b0  54 41 59 3a 50 4c 41 3a  54 41 58 3a 50 4c 41 0d  |TAY:PLA:TAX:PLA.|
000002c0  01 4a 19 2e 6f 6c 64 5f  63 6c 69 20 4a 4d 50 20  |.J..old_cli JMP |
000002d0  28 6f 6c 64 72 74 6e 29  0d 01 54 05 3a 0d 01 5e  |(oldrtn)..T.:..^|
000002e0  0a 2e 73 74 61 72 74 0d  01 68 17 50 48 41 3a 54  |..start..h.PHA:T|
000002f0  58 41 3a 50 48 41 3a 54  59 41 3a 50 48 41 0d 01  |XA:PHA:TYA:PHA..|
00000300  72 1d 53 54 58 20 63 6d  64 5f 70 74 72 3a 53 54  |r.STX cmd_ptr:ST|
00000310  59 20 63 6d 64 5f 70 74  72 2b 31 0d 01 7c 20 4c  |Y cmd_ptr+1..| L|
00000320  44 58 20 23 28 63 6d 64  65 6e 64 2d 63 6f 6d 6d  |DX #(cmdend-comm|
00000330  61 6e 64 29 3a 4c 44 59  20 23 30 0d 01 86 21 53  |and):LDY #0...!S|
00000340  54 59 20 6e 6f 5f 6f 66  5f 66 69 6c 65 73 3a 53  |TY no_of_files:S|
00000350  54 59 20 6c 61 73 74 5f  66 69 6c 65 0d 01 90 18  |TY last_file....|
00000360  5c 20 20 63 68 65 63 6b  20 74 68 65 20 63 6f 6d  |\  check the com|
00000370  6d 61 6e 64 0d 01 9a 26  4a 53 52 20 73 6b 69 70  |mand...&JSR skip|
00000380  73 70 20 5c 20 69 67 6e  6f 72 65 20 6c 65 61 64  |sp \ ignore lead|
00000390  69 6e 67 20 73 70 61 63  65 73 0d 01 a4 0b 2e 63  |ing spaces.....c|
000003a0  68 6b 63 6d 64 0d 01 ae  27 4c 44 41 20 28 63 6d  |hkcmd...'LDA (cm|
000003b0  64 5f 70 74 72 29 2c 59  20 5c 20 67 65 74 20 74  |d_ptr),Y \ get t|
000003c0  79 70 65 64 20 63 6f 6d  6d 61 6e 64 0d 01 b8 32  |yped command...2|
000003d0  43 4d 50 20 63 6f 6d 6d  61 6e 64 2c 59 20 5c 20  |CMP command,Y \ |
000003e0  63 6f 6d 70 61 72 65 20  77 69 74 68 20 74 68 65  |compare with the|
000003f0  20 63 6f 72 72 65 63 74  20 76 61 6c 75 65 0d 01  | correct value..|
00000400  c2 27 42 4e 45 20 6f 75  74 20 5c 20 65 78 69 74  |.'BNE out \ exit|
00000410  20 69 66 20 63 6f 6d 6d  61 6e 64 20 6d 69 73 5f  | if command mis_|
00000420  6d 61 74 63 68 0d 01 cc  31 49 4e 59 3a 44 45 58  |match...1INY:DEX|
00000430  3a 42 4e 45 20 63 68 6b  63 6d 64 20 5c 20 63 68  |:BNE chkcmd \ ch|
00000440  65 63 6b 20 66 6f 72 20  61 6c 6c 20 63 68 61 72  |eck for all char|
00000450  61 63 74 65 72 73 0d 01  d6 05 3a 0d 01 e0 2f 50  |acters....:.../P|
00000460  4c 41 3a 50 4c 41 3a 50  4c 41 20 5c 20 63 6f 6d  |LA:PLA:PLA \ com|
00000470  6d 61 6e 64 20 63 6f 72  72 65 63 74 2c 73 6f 20  |mand correct,so |
00000480  74 69 64 79 20 73 74 61  63 6b 0d 01 ea 39 4a 53  |tidy stack...9JS|
00000490  52 20 6f 73 6e 65 77 6c  3a 4a 53 52 20 75 70 64  |R osnewl:JSR upd|
000004a0  61 74 65 5f 63 6d 64 70  74 72 20 5c 20 75 70 64  |ate_cmdptr \ upd|
000004b0  61 74 65 20 63 6f 6d 6d  61 6e 64 20 70 6f 69 6e  |ate command poin|
000004c0  74 65 72 0d 01 f4 39 4a  53 52 20 69 6e 69 74 5f  |ter...9JSR init_|
000004d0  70 6f 69 6e 74 65 72 73  20 5c 20 73 65 74 20 70  |pointers \ set p|
000004e0  6f 69 6e 74 65 72 73 20  66 6f 72 20 66 69 6c 65  |ointers for file|
000004f0  20 73 74 6f 72 61 67 65  20 65 74 63 0d 01 fe 31  | storage etc...1|
00000500  4a 53 52 20 67 65 74 5f  64 72 69 76 65 3a 53 54  |JSR get_drive:ST|
00000510  41 20 69 6e 5f 64 72 20  5c 20 67 65 74 20 69 6e  |A in_dr \ get in|
00000520  70 75 74 20 64 72 69 76  65 20 6e 6f 2e 0d 02 08  |put drive no....|
00000530  33 4a 53 52 20 67 65 74  5f 64 72 69 76 65 3a 53  |3JSR get_drive:S|
00000540  54 41 20 6f 75 74 5f 64  72 20 5c 20 67 65 74 20  |TA out_dr \ get |
00000550  6f 75 74 70 75 74 20 64  72 69 76 65 20 6e 6f 2e  |output drive no.|
00000560  0d 02 12 31 4c 44 58 20  23 69 6e 70 75 74 5f 64  |...1LDX #input_d|
00000570  72 69 76 65 20 83 20 32  35 36 3a 4c 44 59 20 23  |rive . 256:LDY #|
00000580  69 6e 70 75 74 5f 64 72  69 76 65 20 81 20 32 35  |input_drive . 25|
00000590  36 0d 02 1c 28 4a 53 52  20 6f 6c 64 5f 63 6c 69  |6...(JSR old_cli|
000005a0  20 5c 20 69 73 73 75 65  20 2a 44 52 49 56 45 20  | \ issue *DRIVE |
000005b0  58 20 63 6f 6d 6d 61 6e  64 0d 02 26 0e 4a 53 52  |X command..&.JSR|
000005c0  20 6f 73 6e 65 77 6c 0d  02 30 05 3a 0d 02 3a 0e  | osnewl..0.:..:.|
000005d0  2e 6c 6f 61 64 5f 6c 6f  6f 70 0d 02 44 05 3a 0d  |.load_loop..D.:.|
000005e0  02 4e 35 5c 20 63 68 65  63 6b 20 69 66 20 65 6e  |.N5\ check if en|
000005f0  6f 75 67 68 20 72 6f 6f  6d 20 66 6f 72 20 66 69  |ough room for fi|
00000600  6c 65 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 65  |le information e|
00000610  78 69 74 73 0d 02 58 29  4c 44 41 20 66 69 6c 65  |xits..X)LDA file|
00000620  69 6e 66 6f 5f 70 74 72  3a 43 4c 43 3a 41 44 43  |info_ptr:CLC:ADC|
00000630  20 23 31 30 3a 53 54 41  20 74 65 6d 70 0d 02 62  | #10:STA temp..b|
00000640  1d 4c 44 41 20 66 69 6c  65 69 6e 66 6f 5f 70 74  |.LDA fileinfo_pt|
00000650  72 2b 31 3a 41 44 43 20  23 30 0d 02 6c 11 43 4d  |r+1:ADC #0..l.CM|
00000660  50 20 23 38 3a 42 43 43  20 6f 6b 0d 02 76 2c 4c  |P #8:BCC ok..v,L|
00000670  44 41 20 74 65 6d 70 3a  42 4e 45 20 6e 6f 72 6f  |DA temp:BNE noro|
00000680  6f 6d 20 5c 20 69 6e 66  6f 20 62 6c 6f 63 6b 20  |om \ info block |
00000690  3c 3d 20 26 38 30 30 0d  02 80 07 2e 6f 6b 0d 02  |<= &800.....ok..|
000006a0  8a 21 4a 53 52 20 67 65  74 5f 66 69 6c 65 6e 61  |.!JSR get_filena|
000006b0  6d 65 3a 42 43 53 20 6e  78 74 5f 66 69 6c 65 0d  |me:BCS nxt_file.|
000006c0  02 94 21 4a 53 52 20 67  65 74 5f 66 69 6c 65 73  |..!JSR get_files|
000006d0  69 7a 65 3a 42 43 53 20  6e 78 74 5f 66 69 6c 65  |ize:BCS nxt_file|
000006e0  0d 02 9e 05 3a 0d 02 a8  29 20 5c 20 63 68 65 63  |....:...) \ chec|
000006f0  6b 20 69 66 20 65 6e 6f  75 67 68 20 72 6f 6f 6d  |k if enough room|
00000700  20 69 6e 20 66 69 6c 65  20 73 74 6f 72 65 0d 02  | in file store..|
00000710  b2 10 4a 53 52 20 65 6e  64 5f 61 64 64 72 0d 02  |..JSR end_addr..|
00000720  bc 1a 53 45 43 3a 4c 44  41 20 68 69 6d 65 6d 3a  |..SEC:LDA himem:|
00000730  53 42 43 20 74 65 6d 70  0d 02 c6 1a 4c 44 41 20  |SBC temp....LDA |
00000740  68 69 6d 65 6d 2b 31 3a  53 42 43 20 74 65 6d 70  |himem+1:SBC temp|
00000750  2b 31 0d 02 d0 0e 42 4d  49 20 6e 6f 72 6f 6f 6d  |+1....BMI noroom|
00000760  0d 02 da 05 3a 0d 02 e4  11 4a 53 52 20 6c 6f 61  |....:....JSR loa|
00000770  64 5f 66 69 6c 65 0d 02  ee 17 4a 53 52 20 75 70  |d_file....JSR up|
00000780  64 61 74 65 5f 70 6f 69  6e 74 65 72 73 0d 02 f8  |date_pointers...|
00000790  13 49 4e 43 20 6e 6f 5f  6f 66 5f 66 69 6c 65 73  |.INC no_of_files|
000007a0  0d 03 02 18 2e 6e 78 74  5f 66 69 6c 65 20 4a 53  |.....nxt_file JS|
000007b0  52 20 6f 73 6e 65 77 6c  0d 03 0c 30 4c 44 41 20  |R osnewl...0LDA |
000007c0  6c 61 73 74 5f 66 69 6c  65 3a 42 45 51 20 6c 6f  |last_file:BEQ lo|
000007d0  61 64 5f 6c 6f 6f 70 3a  42 4e 45 20 73 65 74 5f  |ad_loop:BNE set_|
000007e0  66 6f 72 5f 73 61 76 65  0d 03 16 05 3a 0d 03 20  |for_save....:.. |
000007f0  0b 2e 6e 6f 72 6f 6f 6d  0d 03 2a 0f 4a 53 52 20  |..noroom..*.JSR |
00000800  6d 65 73 73 61 67 65 0d  03 34 1b 4f 50 54 20 a4  |message..4.OPT .|
00000810  65 71 75 73 28 22 20 5f  20 4e 6f 20 72 6f 6f 6d  |equs(" _ No room|
00000820  22 29 0d 03 3e 12 4f 50  54 20 a4 65 71 75 62 28  |")..>.OPT .equb(|
00000830  26 30 44 29 0d 03 48 12  4f 50 54 20 a4 65 71 75  |&0D)..H.OPT .equ|
00000840  62 28 32 35 35 29 0d 03  52 11 2e 73 65 74 5f 66  |b(255)..R..set_f|
00000850  6f 72 5f 73 61 76 65 0d  03 5c 1b 4c 44 41 20 6e  |or_save..\.LDA n|
00000860  6f 5f 6f 66 5f 66 69 6c  65 73 3a 42 45 51 20 65  |o_of_files:BEQ e|
00000870  6e 64 0d 03 66 2e 53 54  41 20 6c 61 73 74 5f 66  |nd..f.STA last_f|
00000880  69 6c 65 3a 4a 53 52 20  69 6e 69 74 5f 70 6f 69  |ile:JSR init_poi|
00000890  6e 74 65 72 73 3a 4a 53  52 20 6f 73 6e 65 77 6c  |nters:JSR osnewl|
000008a0  0d 03 70 27 4a 53 52 20  6f 75 74 70 75 74 5f 64  |..p'JSR output_d|
000008b0  72 69 76 65 20 5c 20 73  65 74 20 6f 75 74 70 75  |rive \ set outpu|
000008c0  74 20 64 72 69 76 65 0d  03 7a 0e 2e 73 61 76 65  |t drive..z..save|
000008d0  5f 6c 6f 6f 70 0d 03 84  22 4a 53 52 20 63 68 65  |_loop..."JSR che|
000008e0  63 6b 5f 70 72 65 73 65  6e 63 65 3a 4a 53 52 20  |ck_presence:JSR |
000008f0  6d 65 73 73 61 67 65 0d  03 8e 16 4f 50 54 20 a4  |message....OPT .|
00000900  65 71 75 73 28 22 53 61  76 65 20 22 29 0d 03 98  |equs("Save ")...|
00000910  12 4f 50 54 20 a4 65 71  75 62 28 32 35 35 29 0d  |.OPT .equb(255).|
00000920  03 a2 16 4a 53 52 20 70  72 69 6e 74 5f 66 69 6c  |...JSR print_fil|
00000930  65 6e 61 6d 65 0d 03 ac  0f 4a 53 52 20 6d 65 73  |ename....JSR mes|
00000940  73 61 67 65 0d 03 b6 1a  4f 50 54 20 a4 65 71 75  |sage....OPT .equ|
00000950  73 28 22 20 28 59 2f 4e  29 20 3f 20 22 29 0d 03  |s(" (Y/N) ? ")..|
00000960  c0 12 4f 50 54 20 a4 65  71 75 62 28 32 35 35 29  |..OPT .equb(255)|
00000970  0d 03 ca 10 4a 53 52 20  65 6e 64 5f 61 64 64 72  |....JSR end_addr|
00000980  0d 03 d4 0e 4a 53 52 20  67 65 74 5f 79 6e 0d 03  |....JSR get_yn..|
00000990  de 19 43 50 59 20 23 97  22 59 22 3a 42 4e 45 20  |..CPY #."Y":BNE |
000009a0  6e 6f 5f 73 61 76 65 0d  03 e8 11 4a 53 52 20 73  |no_save....JSR s|
000009b0  61 76 65 5f 66 69 6c 65  0d 03 f2 0c 2e 6e 6f 5f  |ave_file.....no_|
000009c0  73 61 76 65 0d 03 fc 17  4a 53 52 20 75 70 64 61  |save....JSR upda|
000009d0  74 65 5f 70 6f 69 6e 74  65 72 73 0d 04 06 1f 44  |te_pointers....D|
000009e0  45 43 20 6c 61 73 74 5f  66 69 6c 65 3a 42 4e 45  |EC last_file:BNE|
000009f0  20 73 61 76 65 5f 6c 6f  6f 70 0d 04 10 0f 4a 53  | save_loop....JS|
00000a00  52 20 6d 65 73 73 61 67  65 0d 04 1a 12 4f 50 54  |R message....OPT|
00000a10  20 a4 65 71 75 62 28 26  30 44 29 0d 04 24 12 4f  | .equb(&0D)..$.O|
00000a20  50 54 20 a4 65 71 75 62  28 26 30 44 29 0d 04 2e  |PT .equb(&0D)...|
00000a30  26 4f 50 54 20 a4 65 71  75 73 28 22 41 6e 6f 74  |&OPT .equs("Anot|
00000a40  68 65 72 20 63 6f 70 79  20 28 59 2f 4e 29 20 3f  |her copy (Y/N) ?|
00000a50  20 22 29 0d 04 38 12 4f  50 54 20 a4 65 71 75 62  | ")..8.OPT .equb|
00000a60  28 32 35 35 29 0d 04 42  0e 4a 53 52 20 67 65 74  |(255)..B.JSR get|
00000a70  5f 79 6e 0d 04 4c 1e 43  50 59 20 23 97 22 59 22  |_yn..L.CPY #."Y"|
00000a80  3a 42 45 51 20 73 65 74  5f 66 6f 72 5f 73 61 76  |:BEQ set_for_sav|
00000a90  65 0d 04 56 0c 2e 65 6e  64 20 52 54 53 0d 04 60  |e..V..end RTS..`|
00000aa0  05 3a 0d 04 6a 1b 20 5c  20 20 2a 2a 2a 20 53 55  |.:..j. \  *** SU|
00000ab0  42 52 4f 55 54 49 4e 45  53 20 2a 2a 2a 0d 04 74  |BROUTINES ***..t|
00000ac0  05 3a 0d 04 7e 0b 2e 73  6b 69 70 73 70 0d 04 88  |.:..~..skipsp...|
00000ad0  17 4c 44 41 20 28 63 6d  64 5f 70 74 72 29 2c 59  |.LDA (cmd_ptr),Y|
00000ae0  3a 49 4e 59 0d 04 92 18  43 4d 50 20 23 97 22 20  |:INY....CMP #." |
00000af0  22 3a 42 45 51 20 73 6b  69 70 73 70 0d 04 9c 10  |":BEQ skipsp....|
00000b00  44 45 59 3a 42 45 51 20  75 63 70 32 0d 04 a6 05  |DEY:BEQ ucp2....|
00000b10  3a 0d 04 b0 1d 20 5c 20  75 70 64 61 74 65 20 63  |:.... \ update c|
00000b20  6f 6d 6d 61 6e 64 20 70  6f 69 6e 74 65 72 0d 04  |ommand pointer..|
00000b30  ba 12 2e 75 70 64 61 74  65 5f 63 6d 64 70 74 72  |...update_cmdptr|
00000b40  0d 04 c4 25 49 4e 43 20  63 6d 64 5f 70 74 72 3a  |...%INC cmd_ptr:|
00000b50  42 4e 45 20 75 63 70 3a  49 4e 43 20 63 6d 64 5f  |BNE ucp:INC cmd_|
00000b60  70 74 72 2b 31 0d 04 ce  1e 2e 75 63 70 20 44 45  |ptr+1.....ucp DE|
00000b70  59 3a 42 4e 45 20 75 70  64 61 74 65 5f 63 6d 64  |Y:BNE update_cmd|
00000b80  70 74 72 0d 04 d8 0d 2e  75 63 70 32 20 52 54 53  |ptr.....ucp2 RTS|
00000b90  0d 04 e2 05 3a 0d 04 ec  20 20 5c 20 73 65 74 20  |....:...  \ set |
00000ba0  66 69 6c 65 20 73 74 6f  72 61 67 65 20 61 72 65  |file storage are|
00000bb0  61 20 65 74 63 0d 04 f6  12 2e 69 6e 69 74 5f 70  |a etc.....init_p|
00000bc0  6f 69 6e 74 65 72 73 0d  05 00 20 20 5c 20 66 69  |ointers...  \ fi|
00000bd0  6c 65 73 74 6f 72 65 5f  70 74 72 20 3d 20 66 69  |lestore_ptr = fi|
00000be0  6c 65 73 74 6f 72 65 0d  05 0a 2a 4c 44 41 20 23  |lestore...*LDA #|
00000bf0  66 69 6c 65 73 74 6f 72  65 20 83 20 32 35 36 3a  |filestore . 256:|
00000c00  53 54 41 20 66 69 6c 65  73 74 6f 72 65 5f 70 74  |STA filestore_pt|
00000c10  72 0d 05 14 2c 4c 44 41  20 23 66 69 6c 65 73 74  |r...,LDA #filest|
00000c20  6f 72 65 20 81 20 32 35  36 3a 53 54 41 20 66 69  |ore . 256:STA fi|
00000c30  6c 65 73 74 6f 72 65 5f  70 74 72 2b 31 0d 05 1e  |lestore_ptr+1...|
00000c40  1e 20 5c 20 66 69 6c 65  6e 61 6d 65 5f 70 74 72  |. \ filename_ptr|
00000c50  20 3d 20 66 69 6c 65 69  6e 66 6f 0d 05 28 2b 20  | = fileinfo..(+ |
00000c60  5c 20 66 69 6c 65 69 6e  66 6f 5f 70 74 72 20 3d  |\ fileinfo_ptr =|
00000c70  20 66 69 6c 65 69 6e 66  6f 20 2b 20 6e 61 6d 65  | fileinfo + name|
00000c80  6c 65 6e 67 74 68 0d 05  32 28 4c 44 41 20 23 66  |length..2(LDA #f|
00000c90  69 6c 65 69 6e 66 6f 20  83 20 32 35 36 3a 53 54  |ileinfo . 256:ST|
00000ca0  41 20 66 69 6c 65 6e 61  6d 65 5f 70 74 72 0d 05  |A filename_ptr..|
00000cb0  3c 28 43 4c 43 3a 41 44  43 20 23 6e 61 6d 65 6c  |<(CLC:ADC #namel|
00000cc0  65 6e 67 74 68 3a 53 54  41 20 66 69 6c 65 69 6e  |ength:STA filein|
00000cd0  66 6f 5f 70 74 72 0d 05  46 2a 4c 44 41 20 23 66  |fo_ptr..F*LDA #f|
00000ce0  69 6c 65 69 6e 66 6f 20  81 20 32 35 36 3a 53 54  |ileinfo . 256:ST|
00000cf0  41 20 66 69 6c 65 6e 61  6d 65 5f 70 74 72 2b 31  |A filename_ptr+1|
00000d00  0d 05 50 1d 41 44 43 20  23 30 3a 53 54 41 20 66  |..P.ADC #0:STA f|
00000d10  69 6c 65 69 6e 66 6f 5f  70 74 72 2b 31 0d 05 5a  |ileinfo_ptr+1..Z|
00000d20  07 52 54 53 0d 05 64 05  3a 0d 05 6e 22 20 5c 20  |.RTS..d.:..n" \ |
00000d30  66 69 6e 64 20 65 6e 64  20 61 64 64 72 2b 31 20  |find end addr+1 |
00000d40  6f 66 20 74 68 65 20 66  69 6c 65 0d 05 78 0d 2e  |of the file..x..|
00000d50  65 6e 64 5f 61 64 64 72  0d 05 82 33 4c 44 59 20  |end_addr...3LDY |
00000d60  23 38 3a 4c 44 41 20 28  66 69 6c 65 69 6e 66 6f  |#8:LDA (fileinfo|
00000d70  5f 70 74 72 29 2c 59 3a  49 4e 59 20 5c 20 67 65  |_ptr),Y:INY \ ge|
00000d80  74 20 66 69 6c 65 20 73  69 7a 65 0d 05 8c 22 43  |t file size..."C|
00000d90  4c 43 3a 41 44 43 20 66  69 6c 65 73 74 6f 72 65  |LC:ADC filestore|
00000da0  5f 70 74 72 3a 53 54 41  20 74 65 6d 70 0d 05 96  |_ptr:STA temp...|
00000db0  18 4c 44 41 20 28 66 69  6c 65 69 6e 66 6f 5f 70  |.LDA (fileinfo_p|
00000dc0  74 72 29 2c 59 0d 05 a0  22 41 44 43 20 66 69 6c  |tr),Y..."ADC fil|
00000dd0  65 73 74 6f 72 65 5f 70  74 72 2b 31 3a 53 54 41  |estore_ptr+1:STA|
00000de0  20 74 65 6d 70 2b 31 0d  05 aa 07 52 54 53 0d 05  | temp+1....RTS..|
00000df0  b4 05 3a 0d 05 be 2b 20  5c 20 75 70 64 61 74 65  |..:...+ \ update|
00000e00  20 70 6f 69 6e 74 65 72  73 20 66 6f 72 20 66 69  | pointers for fi|
00000e10  6c 65 20 73 74 6f 72 61  67 65 20 65 74 63 0d 05  |le storage etc..|
00000e20  c8 14 2e 75 70 64 61 74  65 5f 70 6f 69 6e 74 65  |...update_pointe|
00000e30  72 73 0d 05 d2 27 20 5c  20 66 69 6c 65 6e 61 6d  |rs...' \ filenam|
00000e40  65 5f 70 74 72 20 3d 20  66 69 6c 65 69 6e 66 6f  |e_ptr = fileinfo|
00000e50  5f 70 74 72 20 2b 20 31  30 0d 05 dc 31 43 4c 43  |_ptr + 10...1CLC|
00000e60  3a 4c 44 41 20 66 69 6c  65 69 6e 66 6f 5f 70 74  |:LDA fileinfo_pt|
00000e70  72 3a 41 44 43 20 23 31  30 3a 53 54 41 20 66 69  |r:ADC #10:STA fi|
00000e80  6c 65 6e 61 6d 65 5f 70  74 72 0d 05 e6 30 4c 44  |lename_ptr...0LD|
00000e90  41 20 66 69 6c 65 69 6e  66 6f 5f 70 74 72 2b 31  |A fileinfo_ptr+1|
00000ea0  3a 41 44 43 20 23 30 3a  53 54 41 20 66 69 6c 65  |:ADC #0:STA file|
00000eb0  6e 61 6d 65 5f 70 74 72  2b 31 0d 05 f0 2f 20 5c  |name_ptr+1.../ \|
00000ec0  20 66 69 6c 65 69 6e 66  6f 5f 70 74 72 20 3d 20  | fileinfo_ptr = |
00000ed0  66 69 6c 65 6e 61 6d 65  5f 70 74 72 20 2b 20 6e  |filename_ptr + n|
00000ee0  61 6d 65 6c 65 6e 67 74  68 0d 05 fa 39 43 4c 43  |amelength...9CLC|
00000ef0  3a 4c 44 41 20 66 69 6c  65 6e 61 6d 65 5f 70 74  |:LDA filename_pt|
00000f00  72 3a 41 44 43 20 23 6e  61 6d 65 6c 65 6e 67 74  |r:ADC #namelengt|
00000f10  68 3a 53 54 41 20 66 69  6c 65 69 6e 66 6f 5f 70  |h:STA fileinfo_p|
00000f20  74 72 0d 06 04 30 4c 44  41 20 66 69 6c 65 6e 61  |tr...0LDA filena|
00000f30  6d 65 5f 70 74 72 2b 31  3a 41 44 43 20 23 30 3a  |me_ptr+1:ADC #0:|
00000f40  53 54 41 20 66 69 6c 65  69 6e 66 6f 5f 70 74 72  |STA fileinfo_ptr|
00000f50  2b 31 0d 06 0e 1e 4c 44  41 20 74 65 6d 70 3a 53  |+1....LDA temp:S|
00000f60  54 41 20 66 69 6c 65 73  74 6f 72 65 5f 70 74 72  |TA filestore_ptr|
00000f70  0d 06 18 22 4c 44 41 20  74 65 6d 70 2b 31 3a 53  |..."LDA temp+1:S|
00000f80  54 41 20 66 69 6c 65 73  74 6f 72 65 5f 70 74 72  |TA filestore_ptr|
00000f90  2b 31 0d 06 22 07 52 54  53 0d 06 2c 05 3a 0d 06  |+1..".RTS..,.:..|
00000fa0  36 2f 20 5c 20 67 65 74  20 6e 65 78 74 20 66 69  |6/ \ get next fi|
00000fb0  6c 65 20 6e 61 6d 65 20  66 72 6f 6d 20 74 68 65  |le name from the|
00000fc0  20 63 6f 6d 6d 61 6e 64  20 6c 69 6e 65 0d 06 40  | command line..@|
00000fd0  11 2e 67 65 74 5f 66 69  6c 65 6e 61 6d 65 0d 06  |..get_filename..|
00000fe0  4a 39 4c 44 59 20 23 30  3a 53 54 59 20 6e 65 77  |J9LDY #0:STY new|
00000ff0  6e 61 6d 65 3a 4a 53 52  20 73 6b 69 70 73 70 20  |name:JSR skipsp |
00001000  5c 20 69 67 6e 6f 72 65  20 6c 65 61 64 69 6e 67  |\ ignore leading|
00001010  20 73 70 61 63 65 73 0d  06 54 0b 2e 67 66 6e 61  | spaces..T..gfna|
00001020  6d 65 0d 06 5e 13 4c 44  41 20 28 63 6d 64 5f 70  |me..^.LDA (cmd_p|
00001030  74 72 29 2c 59 0d 06 68  38 43 4d 50 20 23 26 30  |tr),Y..h8CMP #&0|
00001040  44 3a 42 45 51 20 6c 61  73 74 66 69 6c 65 32 20  |D:BEQ lastfile2 |
00001050  5c 20 6c 61 73 74 20 66  69 6c 65 20 74 65 72 6d  |\ last file term|
00001060  69 6e 61 74 65 64 20 62  79 20 26 30 44 0d 06 72  |inated by &0D..r|
00001070  1a 43 4d 50 20 23 97 22  20 22 3a 42 45 51 20 67  |.CMP #." ":BEQ g|
00001080  6f 74 5f 66 69 6c 65 0d  06 7c 25 4a 53 52 20 6f  |ot_file..|%JSR o|
00001090  73 61 73 63 69 3a 43 4d  50 20 23 97 22 2a 22 3a  |sasci:CMP #."*":|
000010a0  42 45 51 20 61 73 74 65  72 69 73 6b 0d 06 86 18  |BEQ asterisk....|
000010b0  53 54 41 20 28 66 69 6c  65 6e 61 6d 65 5f 70 74  |STA (filename_pt|
000010c0  72 29 2c 59 0d 06 90 12  49 4e 59 3a 42 4e 45 20  |r),Y....INY:BNE |
000010d0  67 66 6e 61 6d 65 0d 06  9a 1c 2e 6c 61 73 74 66  |gfname.....lastf|
000010e0  69 6c 65 32 20 49 4e 43  20 6c 61 73 74 5f 66 69  |ile2 INC last_fi|
000010f0  6c 65 0d 06 a4 0d 2e 67  6f 74 5f 66 69 6c 65 0d  |le.....got_file.|
00001100  06 ae 3f 4c 44 41 20 23  26 30 44 3a 53 54 41 20  |..?LDA #&0D:STA |
00001110  28 66 69 6c 65 6e 61 6d  65 5f 70 74 72 29 2c 59  |(filename_ptr),Y|
00001120  20 5c 20 26 30 44 20 61  73 20 66 69 6c 65 20 6e  | \ &0D as file n|
00001130  61 6d 65 20 74 65 72 6d  69 6e 61 74 6f 72 0d 06  |ame terminator..|
00001140  b8 1d 54 59 41 3a 49 4e  59 3a 4a 53 52 20 75 70  |..TYA:INY:JSR up|
00001150  64 61 74 65 5f 63 6d 64  70 74 72 0d 06 c2 1f 43  |date_cmdptr....C|
00001160  4d 50 20 23 6e 61 6d 65  6c 65 6e 67 74 68 3a 42  |MP #namelength:B|
00001170  43 53 20 6c 65 6e 5f 65  72 72 0d 06 cc 07 52 54  |CS len_err....RT|
00001180  53 0d 06 d6 0d 2e 61 73  74 65 72 69 73 6b 0d 06  |S.....asterisk..|
00001190  e0 21 4c 44 41 20 23 26  30 44 3a 53 54 41 20 28  |.!LDA #&0D:STA (|
000011a0  66 69 6c 65 6e 61 6d 65  5f 70 74 72 29 2c 59 0d  |filename_ptr),Y.|
000011b0  06 ea 21 54 59 41 3a 50  48 41 3a 49 4e 59 3a 4a  |..!TYA:PHA:INY:J|
000011c0  53 52 20 75 70 64 61 74  65 5f 63 6d 64 70 74 72  |SR update_cmdptr|
000011d0  0d 06 f4 0e 2e 61 73 74  65 72 69 73 6b 32 0d 06  |.....asterisk2..|
000011e0  fe 13 4c 44 41 20 28 63  6d 64 5f 70 74 72 29 2c  |..LDA (cmd_ptr),|
000011f0  59 0d 07 08 1a 43 4d 50  20 23 26 30 44 3a 42 45  |Y....CMP #&0D:BE|
00001200  51 20 6c 61 73 74 66 69  6c 65 33 0d 07 12 1b 43  |Q lastfile3....C|
00001210  4d 50 20 23 97 22 20 22  3a 42 45 51 20 67 6f 74  |MP #." ":BEQ got|
00001220  5f 66 69 6c 65 32 0d 07  1c 1c 53 54 41 20 6e 65  |_file2....STA ne|
00001230  77 6e 61 6d 65 2c 59 3a  4a 53 52 20 6f 73 61 73  |wname,Y:JSR osas|
00001240  63 69 0d 07 26 15 49 4e  59 3a 42 4e 45 20 61 73  |ci..&.INY:BNE as|
00001250  74 65 72 69 73 6b 32 0d  07 30 1c 2e 6c 61 73 74  |terisk2..0..last|
00001260  66 69 6c 65 33 20 49 4e  43 20 6c 61 73 74 5f 66  |file3 INC last_f|
00001270  69 6c 65 0d 07 3a 0e 2e  67 6f 74 5f 66 69 6c 65  |ile..:..got_file|
00001280  32 0d 07 44 1a 4c 44 41  20 23 26 30 44 3a 53 54  |2..D.LDA #&0D:ST|
00001290  41 20 6e 65 77 6e 61 6d  65 2c 59 0d 07 4e 1d 54  |A newname,Y..N.T|
000012a0  59 41 3a 49 4e 59 3a 4a  53 52 20 75 70 64 61 74  |YA:INY:JSR updat|
000012b0  65 5f 63 6d 64 70 74 72  0d 07 58 27 54 41 58 3a  |e_cmdptr..X'TAX:|
000012c0  50 4c 41 3a 43 4d 50 20  23 6e 61 6d 65 6c 65 6e  |PLA:CMP #namelen|
000012d0  67 74 68 3a 42 43 53 20  6c 65 6e 5f 65 72 72 0d  |gth:BCS len_err.|
000012e0  07 62 1f 43 50 58 20 23  6e 61 6d 65 6c 65 6e 67  |.b.CPX #nameleng|
000012f0  74 68 3a 42 43 53 20 6c  65 6e 5f 65 72 72 0d 07  |th:BCS len_err..|
00001300  6c 07 52 54 53 0d 07 76  0c 2e 6c 65 6e 5f 65 72  |l.RTS..v..len_er|
00001310  72 0d 07 80 0f 4a 53 52  20 6d 65 73 73 61 67 65  |r....JSR message|
00001320  0d 07 8a 20 4f 50 54 20  a4 65 71 75 73 28 22 20  |... OPT .equs(" |
00001330  5f 20 42 61 64 20 66 69  6c 65 6e 61 6d 65 22 29  |_ Bad filename")|
00001340  0d 07 94 12 4f 50 54 20  a4 65 71 75 62 28 32 35  |....OPT .equb(25|
00001350  35 29 0d 07 9e 0b 53 45  43 3a 52 54 53 0d 07 a8  |5)....SEC:RTS...|
00001360  05 3a 0d 07 b2 0e 2e 67  65 74 5f 64 72 69 76 65  |.:.....get_drive|
00001370  0d 07 bc 26 4a 53 52 20  67 65 74 5f 66 69 6c 65  |...&JSR get_file|
00001380  6e 61 6d 65 3a 4a 53 52  20 6f 73 6e 65 77 6c 3a  |name:JSR osnewl:|
00001390  4c 44 59 20 23 30 0d 07  c6 18 4c 44 41 20 28 66  |LDY #0....LDA (f|
000013a0  69 6c 65 6e 61 6d 65 5f  70 74 72 29 2c 59 0d 07  |ilename_ptr),Y..|
000013b0  d0 18 43 4d 50 20 23 97  22 30 22 3a 42 43 43 20  |..CMP #."0":BCC |
000013c0  64 72 5f 65 72 72 0d 07  da 18 43 4d 50 20 23 97  |dr_err....CMP #.|
000013d0  22 34 22 3a 42 43 53 20  64 72 5f 65 72 72 0d 07  |"4":BCS dr_err..|
000013e0  e4 07 52 54 53 0d 07 ee  0b 2e 64 72 5f 65 72 72  |..RTS.....dr_err|
000013f0  0d 07 f8 07 42 52 4b 0d  08 02 12 4f 50 54 20 a4  |....BRK....OPT .|
00001400  65 71 75 62 28 26 43 44  29 0d 08 0c 12 4f 50 54  |equb(&CD)....OPT|
00001410  20 a4 65 71 75 62 28 26  30 44 29 0d 08 16 1a 4f  | .equb(&0D)....O|
00001420  50 54 20 a4 65 71 75 73  28 22 42 61 64 20 64 72  |PT .equs("Bad dr|
00001430  69 76 65 22 29 0d 08 20  12 4f 50 54 20 a4 65 71  |ive").. .OPT .eq|
00001440  75 62 28 26 30 44 29 0d  08 2a 10 4f 50 54 20 a4  |ub(&0D)..*.OPT .|
00001450  65 71 75 62 28 30 29 0d  08 34 05 3a 0d 08 3e 1b  |equb(0)..4.:..>.|
00001460  20 5c 20 63 61 6c 6c 20  6f 73 66 69 6c 65 20 77  | \ call osfile w|
00001470  69 74 68 20 41 3d 35 0d  08 48 2f 20 5c 20 73 61  |ith A=5..H/ \ sa|
00001480  76 65 20 6c 6f 61 64 20  61 64 64 72 2c 20 65 78  |ve load addr, ex|
00001490  65 63 2e 20 61 64 64 72  20 61 6e 64 20 66 69 6c  |ec. addr and fil|
000014a0  65 20 73 69 7a 65 0d 08  52 11 2e 67 65 74 5f 66  |e size..R..get_f|
000014b0  69 6c 65 73 69 7a 65 0d  08 5c 0f 4a 53 52 20 73  |ilesize..\.JSR s|
000014c0  65 74 5f 62 6c 6b 0d 08  66 15 4c 44 41 20 23 35  |et_blk..f.LDA #5|
000014d0  3a 4a 53 52 20 6f 73 66  69 6c 65 0d 08 70 1d 43  |:JSR osfile..p.C|
000014e0  4d 50 20 23 31 3a 42 4e  45 20 66 69 6c 65 5f 6e  |MP #1:BNE file_n|
000014f0  6f 74 5f 66 6f 75 6e 64  0d 08 7a 0a 4c 44 59 20  |ot_found..z.LDY |
00001500  23 30 0d 08 84 30 2e 67  66 73 32 20 4c 44 41 20  |#0...0.gfs2 LDA |
00001510  70 61 72 61 6d 5f 62 6c  6b 2b 32 2c 59 3a 53 54  |param_blk+2,Y:ST|
00001520  41 20 28 66 69 6c 65 69  6e 66 6f 5f 70 74 72 29  |A (fileinfo_ptr)|
00001530  2c 59 0d 08 8e 18 49 4e  59 3a 43 50 59 20 23 31  |,Y....INY:CPY #1|
00001540  30 3a 42 4e 45 20 67 66  73 32 0d 08 98 0b 43 4c  |0:BNE gfs2....CL|
00001550  43 3a 52 54 53 0d 08 a2  13 2e 66 69 6c 65 5f 6e  |C:RTS.....file_n|
00001560  6f 74 5f 66 6f 75 6e 64  0d 08 ac 0f 4a 53 52 20  |ot_found....JSR |
00001570  6d 65 73 73 61 67 65 0d  08 b6 1d 4f 50 54 20 a4  |message....OPT .|
00001580  65 71 75 73 28 22 20 5f  20 6e 6f 74 20 66 6f 75  |equs(" _ not fou|
00001590  6e 64 22 29 0d 08 c0 12  4f 50 54 20 a4 65 71 75  |nd")....OPT .equ|
000015a0  62 28 32 35 35 29 0d 08  ca 0b 53 45 43 3a 52 54  |b(255)....SEC:RT|
000015b0  53 0d 08 d4 05 3a 0d 08  de 0c 2e 73 65 74 5f 62  |S....:.....set_b|
000015c0  6c 6b 0d 08 e8 22 4c 44  41 20 66 69 6c 65 6e 61  |lk..."LDA filena|
000015d0  6d 65 5f 70 74 72 3a 53  54 41 20 70 61 72 61 6d  |me_ptr:STA param|
000015e0  5f 62 6c 6b 0d 08 f2 26  4c 44 41 20 66 69 6c 65  |_blk...&LDA file|
000015f0  6e 61 6d 65 5f 70 74 72  2b 31 3a 53 54 41 20 70  |name_ptr+1:STA p|
00001600  61 72 61 6d 5f 62 6c 6b  2b 31 0d 08 fc 11 4c 44  |aram_blk+1....LD|
00001610  41 20 23 30 3a 4c 44 59  20 23 32 0d 09 06 2a 2e  |A #0:LDY #2...*.|
00001620  73 62 20 53 54 41 20 70  61 72 61 6d 5f 62 6c 6b  |sb STA param_blk|
00001630  2c 59 3a 49 4e 59 3a 43  50 59 20 23 31 38 3a 42  |,Y:INY:CPY #18:B|
00001640  4e 45 20 73 62 0d 09 10  2d 4c 44 58 20 23 70 61  |NE sb...-LDX #pa|
00001650  72 61 6d 5f 62 6c 6b 20  83 20 32 35 36 3a 4c 44  |ram_blk . 256:LD|
00001660  59 20 23 70 61 72 61 6d  5f 62 6c 6b 20 81 20 32  |Y #param_blk . 2|
00001670  35 36 0d 09 1a 07 52 54  53 0d 09 24 05 3a 0d 09  |56....RTS..$.:..|
00001680  2e 0e 2e 6c 6f 61 64 5f  66 69 6c 65 0d 09 38 31  |...load_file..81|
00001690  4a 53 52 20 73 65 74 5f  62 6c 6b 3a 4c 44 41 20  |JSR set_blk:LDA |
000016a0  66 69 6c 65 73 74 6f 72  65 5f 70 74 72 3a 53 54  |filestore_ptr:ST|
000016b0  41 20 70 61 72 61 6d 5f  62 6c 6b 2b 32 0d 09 42  |A param_blk+2..B|
000016c0  27 4c 44 41 20 66 69 6c  65 73 74 6f 72 65 5f 70  |'LDA filestore_p|
000016d0  74 72 2b 31 3a 53 54 41  20 70 61 72 61 6d 5f 62  |tr+1:STA param_b|
000016e0  6c 6b 2b 33 0d 09 4c 23  4c 44 41 20 23 26 46 46  |lk+3..L#LDA #&FF|
000016f0  3a 4a 53 52 20 6f 73 66  69 6c 65 20 5c 20 6c 6f  |:JSR osfile \ lo|
00001700  61 64 20 66 69 6c 65 0d  09 56 24 4c 44 41 20 6e  |ad file..V$LDA n|
00001710  65 77 6e 61 6d 65 3a 42  45 51 20 6e 6f 5f 72 65  |ewname:BEQ no_re|
00001720  6e 61 6d 65 3a 4c 44 59  20 23 30 0d 09 60 0f 2e  |name:LDY #0..`..|
00001730  79 65 73 5f 72 65 6e 61  6d 65 0d 09 6a 26 4c 44  |yes_rename..j&LD|
00001740  41 20 6e 65 77 6e 61 6d  65 2c 59 3a 53 54 41 20  |A newname,Y:STA |
00001750  28 66 69 6c 65 6e 61 6d  65 5f 70 74 72 29 2c 59  |(filename_ptr),Y|
00001760  0d 09 74 1f 49 4e 59 3a  43 4d 50 20 23 26 30 44  |..t.INY:CMP #&0D|
00001770  3a 42 4e 45 20 79 65 73  5f 72 65 6e 61 6d 65 0d  |:BNE yes_rename.|
00001780  09 7e 0e 2e 6e 6f 5f 72  65 6e 61 6d 65 0d 09 88  |.~..no_rename...|
00001790  07 52 54 53 0d 09 92 05  3a 0d 09 9c 13 2e 63 68  |.RTS....:.....ch|
000017a0  65 63 6b 5f 70 72 65 73  65 6e 63 65 0d 09 a6 21  |eck_presence...!|
000017b0  4a 53 52 20 73 65 74 5f  62 6c 6b 3a 4c 44 41 20  |JSR set_blk:LDA |
000017c0  23 35 3a 4a 53 52 20 6f  73 66 69 6c 65 0d 09 b0  |#5:JSR osfile...|
000017d0  1a 43 4d 50 20 23 31 3a  42 4e 45 20 6e 6f 74 5f  |.CMP #1:BNE not_|
000017e0  70 72 65 73 65 6e 74 0d  09 ba 0f 4a 53 52 20 6d  |present....JSR m|
000017f0  65 73 73 61 67 65 0d 09  c4 12 4f 50 54 20 a4 65  |essage....OPT .e|
00001800  71 75 62 28 26 30 44 29  0d 09 ce 12 4f 50 54 20  |qub(&0D)....OPT |
00001810  a4 65 71 75 62 28 31 32  39 29 0d 09 d8 33 4f 50  |.equb(129)...3OP|
00001820  54 20 a4 65 71 75 73 28  22 49 74 20 65 78 69 73  |T .equs("It exis|
00001830  74 73 20 6f 6e 20 74 68  65 20 64 65 73 74 69 6e  |ts on the destin|
00001840  61 74 69 6f 6e 20 64 69  73 6b 2e 22 29 0d 09 e2  |ation disk.")...|
00001850  12 4f 50 54 20 a4 65 71  75 62 28 26 30 44 29 0d  |.OPT .equb(&0D).|
00001860  09 ec 12 4f 50 54 20 a4  65 71 75 62 28 32 35 35  |...OPT .equb(255|
00001870  29 0d 09 f6 10 2e 6e 6f  74 5f 70 72 65 73 65 6e  |).....not_presen|
00001880  74 0d 0a 00 07 52 54 53  0d 0a 0a 05 3a 0d 0a 14  |t....RTS....:...|
00001890  0e 2e 73 61 76 65 5f 66  69 6c 65 0d 0a 1e 16 4a  |..save_file....J|
000018a0  53 52 20 73 65 74 5f 62  6c 6b 3a 4c 44 59 20 23  |SR set_blk:LDY #|
000018b0  30 0d 0a 28 07 2e 73 66  0d 0a 32 2a 4c 44 41 20  |0..(..sf..2*LDA |
000018c0  28 66 69 6c 65 69 6e 66  6f 5f 70 74 72 29 2c 59  |(fileinfo_ptr),Y|
000018d0  3a 53 54 41 20 70 61 72  61 6d 5f 62 6c 6b 2b 32  |:STA param_blk+2|
000018e0  2c 59 0d 0a 3c 15 49 4e  59 3a 43 50 59 20 23 38  |,Y..<.INY:CPY #8|
000018f0  3a 42 4e 45 20 73 66 0d  0a 46 26 4c 44 41 20 66  |:BNE sf..F&LDA f|
00001900  69 6c 65 73 74 6f 72 65  5f 70 74 72 3a 53 54 41  |ilestore_ptr:STA|
00001910  20 70 61 72 61 6d 5f 62  6c 6b 2b 31 30 0d 0a 50  | param_blk+10..P|
00001920  28 4c 44 41 20 66 69 6c  65 73 74 6f 72 65 5f 70  |(LDA filestore_p|
00001930  74 72 2b 31 3a 53 54 41  20 70 61 72 61 6d 5f 62  |tr+1:STA param_b|
00001940  6c 6b 2b 31 31 0d 0a 5a  1d 4c 44 41 20 74 65 6d  |lk+11..Z.LDA tem|
00001950  70 3a 53 54 41 20 70 61  72 61 6d 5f 62 6c 6b 2b  |p:STA param_blk+|
00001960  31 34 0d 0a 64 1f 4c 44  41 20 74 65 6d 70 2b 31  |14..d.LDA temp+1|
00001970  3a 53 54 41 20 70 61 72  61 6d 5f 62 6c 6b 2b 31  |:STA param_blk+1|
00001980  35 0d 0a 6e 2a 4c 44 59  20 23 70 61 72 61 6d 5f  |5..n*LDY #param_|
00001990  62 6c 6b 20 81 20 32 35  36 3a 4c 44 41 20 23 30  |blk . 256:LDA #0|
000019a0  3a 4a 4d 50 20 6f 73 66  69 6c 65 0d 0a 78 05 3a  |:JMP osfile..x.:|
000019b0  0d 0a 82 15 20 5c 20 67  65 74 20 27 59 27 20 6f  |.... \ get 'Y' o|
000019c0  72 20 27 4e 27 0d 0a 8c  0b 2e 67 65 74 5f 79 6e  |r 'N'.....get_yn|
000019d0  0d 0a 96 32 4c 44 41 20  23 31 35 3a 4c 44 58 20  |...2LDA #15:LDX |
000019e0  23 31 3a 4a 53 52 20 6f  73 62 79 74 65 20 5c 20  |#1:JSR osbyte \ |
000019f0  66 6c 75 73 68 20 69 6e  70 75 74 20 62 75 66 66  |flush input buff|
00001a00  65 72 0d 0a a0 07 2e 79  6e 0d 0a aa 0e 4a 53 52  |er.....yn....JSR|
00001a10  20 67 65 74 6b 65 79 0d  0a b4 1c 80 20 23 26 35  | getkey..... #&5|
00001a20  46 3a 43 4d 50 20 23 97  22 59 22 3a 42 45 51 20  |F:CMP #."Y":BEQ |
00001a30  79 6e 32 0d 0a be 14 43  4d 50 20 23 97 22 4e 22  |yn2....CMP #."N"|
00001a40  3a 42 4e 45 20 79 6e 0d  0a c8 08 2e 79 6e 32 0d  |:BNE yn.....yn2.|
00001a50  0a d2 1d 54 41 59 3a 4a  53 52 20 6f 73 61 73 63  |...TAY:JSR osasc|
00001a60  69 3a 4a 4d 50 20 6f 73  6e 65 77 6c 0d 0a dc 0b  |i:JMP osnewl....|
00001a70  2e 67 65 74 6b 65 79 0d  0a e6 20 4a 53 52 20 6f  |.getkey... JSR o|
00001a80  73 72 64 63 68 20 5c 20  67 65 74 20 61 20 63 68  |srdch \ get a ch|
00001a90  61 72 20 69 6e 20 41 0d  0a f0 1b 43 4d 50 20 23  |ar in A....CMP #|
00001aa0  26 31 42 3a 42 45 51 20  65 73 63 61 70 65 3a 52  |&1B:BEQ escape:R|
00001ab0  54 53 0d 0a fa 0b 2e 65  73 63 61 70 65 0d 0b 04  |TS.....escape...|
00001ac0  07 42 52 4b 0d 0b 0e 11  4f 50 54 20 a4 65 71 75  |.BRK....OPT .equ|
00001ad0  62 28 31 37 29 0d 0b 18  12 4f 50 54 20 a4 65 71  |b(17)....OPT .eq|
00001ae0  75 62 28 26 30 44 29 0d  0b 22 17 4f 50 54 20 a4  |ub(&0D)..".OPT .|
00001af0  65 71 75 73 28 22 45 73  63 61 70 65 22 29 0d 0b  |equs("Escape")..|
00001b00  2c 12 4f 50 54 20 a4 65  71 75 62 28 26 30 44 29  |,.OPT .equb(&0D)|
00001b10  0d 0b 36 10 4f 50 54 20  a4 65 71 75 62 28 30 29  |..6.OPT .equb(0)|
00001b20  0d 0b 40 05 3a 0d 0b 4a  13 2e 70 72 69 6e 74 5f  |..@.:..J..print_|
00001b30  66 69 6c 65 6e 61 6d 65  0d 0b 54 0a 4c 44 59 20  |filename..T.LDY |
00001b40  23 30 0d 0b 5e 08 2e 70  66 6e 0d 0b 68 18 4c 44  |#0..^..pfn..h.LD|
00001b50  41 20 28 66 69 6c 65 6e  61 6d 65 5f 70 74 72 29  |A (filename_ptr)|
00001b60  2c 59 0d 0b 72 15 43 4d  50 20 23 26 30 44 3a 42  |,Y..r.CMP #&0D:B|
00001b70  45 51 20 70 66 6e 32 0d  0b 7c 1a 4a 53 52 20 6f  |EQ pfn2..|.JSR o|
00001b80  73 61 73 63 69 3a 49 4e  59 3a 42 4e 45 20 70 66  |sasci:INY:BNE pf|
00001b90  6e 0d 0b 86 09 2e 70 66  6e 32 0d 0b 90 07 52 54  |n.....pfn2....RT|
00001ba0  53 0d 0b 9a 05 3a 0d 0b  a4 0c 2e 6d 65 73 73 61  |S....:.....messa|
00001bb0  67 65 0d 0b ae 1f 50 4c  41 3a 53 54 41 20 74 65  |ge....PLA:STA te|
00001bc0  6d 70 3a 50 4c 41 3a 53  54 41 20 74 65 6d 70 2b  |mp:PLA:STA temp+|
00001bd0  31 0d 0b b8 0a 4c 44 59  20 23 31 0d 0b c2 08 2e  |1....LDY #1.....|
00001be0  6d 65 73 0d 0b cc 10 4c  44 41 20 28 74 65 6d 70  |mes....LDA (temp|
00001bf0  29 2c 59 0d 0b d6 15 43  4d 50 20 23 32 35 35 3a  |),Y....CMP #255:|
00001c00  42 45 51 20 6d 65 73 32  0d 0b e0 1a 4a 53 52 20  |BEQ mes2....JSR |
00001c10  6f 73 61 73 63 69 3a 49  4e 59 3a 42 4e 45 20 6d  |osasci:INY:BNE m|
00001c20  65 73 0d 0b ea 09 2e 6d  65 73 32 0d 0b f4 21 49  |es.....mes2...!I|
00001c30  4e 59 3a 54 59 41 3a 43  4c 43 3a 41 44 43 20 74  |NY:TYA:CLC:ADC t|
00001c40  65 6d 70 3a 53 54 41 20  74 65 6d 70 0d 0b fe 20  |emp:STA temp... |
00001c50  4c 44 41 20 23 30 3a 41  44 43 20 74 65 6d 70 2b  |LDA #0:ADC temp+|
00001c60  31 3a 53 54 41 20 74 65  6d 70 2b 31 0d 0c 08 0e  |1:STA temp+1....|
00001c70  4a 4d 50 20 28 74 65 6d  70 29 0d 0c 12 05 3a 0d  |JMP (temp)....:.|
00001c80  0c 1c 0c 2e 63 6f 6d 6d  61 6e 64 0d 0c 26 17 4f  |....command..&.O|
00001c90  50 54 20 a4 65 71 75 73  28 22 2a 44 43 4f 50 59  |PT .equs("*DCOPY|
00001ca0  22 29 0d 0c 30 0b 2e 63  6d 64 65 6e 64 0d 0c 3a  |")..0..cmdend..:|
00001cb0  05 3a 0d 0c 44 10 2e 69  6e 70 75 74 5f 64 72 69  |.:..D..input_dri|
00001cc0  76 65 0d 0c 4e 17 4f 50  54 20 a4 65 71 75 73 28  |ve..N.OPT .equs(|
00001cd0  22 44 52 49 56 45 20 22  29 0d 0c 58 0a 2e 69 6e  |"DRIVE ")..X..in|
00001ce0  5f 64 72 0d 0c 62 12 4f  50 54 20 a4 65 71 75 73  |_dr..b.OPT .equs|
00001cf0  28 22 30 22 29 0d 0c 6c  12 4f 50 54 20 a4 65 71  |("0")..l.OPT .eq|
00001d00  75 62 28 26 30 44 29 0d  0c 76 05 3a 0d 0c 80 11  |ub(&0D)..v.:....|
00001d10  2e 6f 75 74 70 75 74 5f  64 72 69 76 65 0d 0c 8a  |.output_drive...|
00001d20  27 4c 44 41 20 69 6e 5f  64 72 3a 43 4d 50 20 6f  |'LDA in_dr:CMP o|
00001d30  75 74 5f 64 72 3a 42 4e  45 20 6f 75 74 70 75 74  |ut_dr:BNE output|
00001d40  5f 64 72 32 0d 0c 94 0f  4a 53 52 20 6d 65 73 73  |_dr2....JSR mess|
00001d50  61 67 65 0d 0c 9e 12 4f  50 54 20 a4 65 71 75 62  |age....OPT .equb|
00001d60  28 31 33 31 29 0d 0c a8  34 4f 50 54 20 a4 65 71  |(131)...4OPT .eq|
00001d70  75 73 28 22 49 6e 73 65  72 74 20 64 65 73 74 69  |us("Insert desti|
00001d80  6e 61 74 69 6f 6e 20 64  69 73 6b 20 26 20 74 61  |nation disk & ta|
00001d90  70 20 61 20 6b 65 79 22  29 0d 0c b2 12 4f 50 54  |p a key")....OPT|
00001da0  20 a4 65 71 75 62 28 26  30 44 29 0d 0c bc 12 4f  | .equb(&0D)....O|
00001db0  50 54 20 a4 65 71 75 62  28 32 35 35 29 0d 0c c6  |PT .equb(255)...|
00001dc0  28 4c 44 41 20 23 31 35  3a 4c 44 58 20 23 31 3a  |(LDA #15:LDX #1:|
00001dd0  4a 53 52 20 6f 73 62 79  74 65 3a 4a 4d 50 20 67  |JSR osbyte:JMP g|
00001de0  65 74 6b 65 79 0d 0c d0  0f 2e 6f 75 74 70 75 74  |etkey.....output|
00001df0  5f 64 72 32 0d 0c da 2d  4c 44 58 20 23 6f 75 74  |_dr2...-LDX #out|
00001e00  70 75 74 5f 64 72 20 83  20 32 35 36 3a 4c 44 59  |put_dr . 256:LDY|
00001e10  20 23 6f 75 74 70 75 74  5f 64 72 20 81 20 32 35  | #output_dr . 25|
00001e20  36 0d 0c e4 31 4a 4d 50  20 6f 6c 64 5f 63 6c 69  |6...1JMP old_cli|
00001e30  20 5c 20 69 73 73 75 65  20 2a 44 52 49 56 45 20  | \ issue *DRIVE |
00001e40  58 20 63 6f 6d 6d 61 6e  64 20 26 20 72 65 74 75  |X command & retu|
00001e50  72 6e 0d 0c ee 0e 2e 6f  75 74 70 75 74 5f 64 72  |rn.....output_dr|
00001e60  0d 0c f8 17 4f 50 54 20  a4 65 71 75 73 28 22 44  |....OPT .equs("D|
00001e70  52 49 56 45 20 22 29 0d  0d 02 0b 2e 6f 75 74 5f  |RIVE ").....out_|
00001e80  64 72 0d 0d 0c 12 4f 50  54 20 a4 65 71 75 73 28  |dr....OPT .equs(|
00001e90  22 30 22 29 0d 0d 16 12  4f 50 54 20 a4 65 71 75  |"0")....OPT .equ|
00001ea0  62 28 26 30 44 29 0d 0d  20 07 5d 3a ed 0d 0d 2a  |b(&0D).. .]:...*|
00001eb0  05 3a 0d 0d 34 08 43 25  3d 30 0d 0d 3e 15 e3 20  |.:..4.C%=0..>.. |
00001ec0  49 25 3d 63 6f 64 65 25  20 b8 20 50 25 2d 31 0d  |I%=code% . P%-1.|
00001ed0  0d 48 0d 43 25 3d 43 25  2b 3f 49 25 0d 0d 52 17  |.H.C%=C%+?I%..R.|
00001ee0  ed 3a f1 27 27 22 43 68  65 63 6b 73 75 6d 3d 22  |.:.''"Checksum="|
00001ef0  3b 43 25 0d 0d 5c 17 de  20 58 25 20 33 30 3a 59  |;C%..\.. X% 30:Y|
00001f00  25 3d 58 25 20 81 20 32  35 36 0d 0d 66 29 24 58  |%=X% . 256..f)$X|
00001f10  25 3d 22 53 2e 44 43 4f  50 59 4d 43 20 22 2b c3  |%="S.DCOPYMC "+.|
00001f20  7e 28 63 6f 64 65 25 29  2b 22 20 22 2b c3 7e 28  |~(code%)+" "+.~(|
00001f30  50 25 29 0d 0d 70 37 f1  27 22 44 6f 20 79 6f 75  |P%)..p7.'"Do you|
00001f40  20 77 61 6e 74 20 74 6f  20 73 61 76 65 20 74 68  | want to save th|
00001f50  65 20 6d 61 63 68 69 6e  65 20 63 6f 64 65 22 27  |e machine code"'|
00001f60  22 28 59 2f 4e 29 20 3f  22 3b 0d 0d 7a 1d 41 24  |"(Y/N) ?";..z.A$|
00001f70  3d be 3a f1 41 24 3a e7  20 41 24 3d 22 59 22 3a  |=.:.A$:. A$="Y":|
00001f80  d6 20 26 46 46 46 37 0d  0d 84 05 e0 0d 0d 8e 05  |. &FFF7.........|
00001f90  3a 0d 0d 98 0e dd a4 65  71 75 62 28 41 25 29 0d  |:......equb(A%).|
00001fa0  0d a2 12 3f 50 25 3d 41  25 3a 50 25 3d 50 25 2b  |...?P%=A%:P%=P%+|
00001fb0  31 0d 0d ac 07 3d 49 25  0d 0d b6 05 3a 0d 0d c0  |1....=I%....:...|
00001fc0  0e dd a4 65 71 75 73 28  41 24 29 0d 0d ca 16 24  |...equs(A$)....$|
00001fd0  50 25 3d 41 24 3a 50 25  3d 50 25 2b a9 28 41 24  |P%=A$:P%=P%+.(A$|
00001fe0  29 0d 0d d4 07 3d 49 25  0d ff                    |)....=I%..|
00001fea
06-05-88/DISCCPY.m0
06-05-88/DISCCPY.m1
06-05-88/DISCCPY.m2
06-05-88/DISCCPY.m4
06-05-88/DISCCPY.m5