some of the changes made.
A major difficulty found was that the program was written in 8080
mnemonics, with which I was not familiar. I had to use a book containing the
8080 and Z80 mnemonic equivalents in order first to understand the existing code
and then to make the necessary amendments. The amended program source is thus
still in 8080 mnemonics. I must apologise for the fact that the program source
is a little messy - I simply patched the necessary areas rather than rewriting
them. In spite of the amendments, the program still has a buffer size exceeding
36k thus allowing the complete contents of a disc to be copied with no more
disc changes than DISCCOPY.
CATERING FOR DIFFERENT DISC FORMATS
Amstrad's BIOS routine SELDSK has been written so that if called with
certain parameters, it resets the Disc Parameter Block (DPB) to correspond
with the format of the disc currently in the drive, thus allowing that disc to
be correctly accessed. Thus to cater for different Amstrad-supported disc
formats, it is only necessary to call SELDSK with the appropriate parameters
everytime the disc is changed. Following this BIOS call, it is also necessary to
call BDOS function 13, 'RESET DISC SYSTEM'.
To call BIOS SELDSK it is necessary to know that it is the ninth BIOS
entry point, and is therefore located at (9-1)*3, or 24, bytes from the BIOS
warm-start entry point. The address of the BIOS warm-start entry point is held
in words 1 and 2 under CP/M. The call is therefore implemented by loading the
HL register pair with the contents of words 1 and 2, adding 24 to HL, setting
the necessary parameters (C=0 for drive A, E=0 to reset the DPB), then calling
a routine which jumps to the address in HL. On return from this routine, it is
necessary to call BDOS 'RESET DISC SYSTEM'; this is achieved in the standard
way, by setting C=13 and calling BDOS at location 5. The assembled coding is
shown in Fig 1.
ELIMINATING REPEATED COPYING AND CONFIRMING FILES FOR COPYING
The MFT program works by first creating a table containing all the files
to be copied. Hence to implement these changes it is necessary to control the
filenames which are written to this table.
Possible filename entries for this table are obtained one at a time by
taking each given filename parameter, converting it into standard CP/M FCB (File
Control Block) form, then calling either BDOS function 17 - SEARCH FOR FIRST -
(initially) or BDOS function 18 - SEARCH FOR NEXT - (subsequently) to obtain a
series of names of actual files matching the given parameter. Two new routines
then intercept each filename so obtained to determine whether it should be
placed in the table. The first routine checks if the filename is already in the
table - if it is, the filename is ignored. The second routine is only activated
if confirmation of files to be copied has been requested. In this case, the
filename obtained is displayed on the screen, and the user is asked 'COPY Y/N?'.
If the reply is 'Y' then the filename is moved into the table; if the reply is
'N' the filename is ignored; otherwise a 'beep' is sounded and a further reply
is awaited.
OTHER CHANGES
The other changes were relatively simple and are hence not described
in detail. Ensuring that only valid data is copied, required ensuring that a
successful OPEN (BDOS function 15) is executed before reading from or appending
to a file; a different (larger) buffer area is used for the input parameters
to avoid corruption; if no parameters are given this is detected and an '*.*'
parameter is inserted; and the subroutine for key input checks for [CTRL]
and 'C' - if detected, a jump to the end of the program is executed.