MS-DOS E m u l a t o r f o r CP/M + DEMO version User's Manual Nichita Sandru Copyright (c) SanDES, 1990 - 2 - 1. Introduction The MS-DOS Emulator is a program which allows the user to handle files on MS-DOS disks under the control of CP/M Plus. CP/M commands like DIR, ERA, etc. may be used with MS-DOS disks exactly as with CP/M disks. The MS-DOS Emulator cannot run MS-DOS programs because they need an Intel 8086/88 family processor. They cannot run on a Z80. The MS-DOS Emulator automatically recognizes MS-DOS disks, when they are inserted into the disk drive. The emulator can only be used on a banked CP/M system. It takes about 8 Kbytes in RAM bank 0 and 4 Kbytes in common RAM. It can serve up to 16 disk drives, 5.25" (40 tracks) and 3.5" formats. This demo version is public domain. It contains a subset of the capabilities of the commercial version. It may be freely copied and distributed, together with this manual, but altering the program or the manual is not permitted. The demo version of the emulator may not be sold for profit. Only the cost of materials, copying and postage may be asked. The DEMO version consists of the following files: - MSDOS.DOC - This user's manual. - MSDOS.COM - The emulator. 2. The MS-DOS Format An MS-DOS disk has 4 areas: - The BOOT sector - 1'st sector on track 0 - containing a program which loads the MS-DOS and starts it (on a PC compatible), together with information about the disk format. - The FAT ("File Allocation Table") area containing a "map" of the disk, showing the sectors occupied by the files in the Data area. - The DIR ("DIRectory") area containing a directory of the files on the disk. Each file has an entry in this directory, containing a description of the file. The MS-DOS Emulator designates the DIR area as a directory file with the name "\". - 3 - - The Data area containing the files. Two kinds of files can be found on an MS-DOS disk: Data files and directory files. The data files contain text, programs etc. A directory file has the same structure as the DIR area and it can contain entries for other directory files. A directory file always contains two entries: - An entry with the name ".", describing the directory file itself; - An entry with the name "..", designating the directory where the directory file is listed. This directory may be the DIR area or another directory file. The directory files form a tree structure, with the "\" directory as root. The path to a directory is called "path". The following MS-DOS formats are recognized by the MS- DOS Emulator: - 5.25" 160 Kbytes, SS. - 5.25" 180 Kbytes, SS. - 5.25" 320 Kbytes, DS. - 5.25" 360 Kbytes, DS. (Standard PC/XT); - 3.5" 720 Kbytes (PC/AT). 3. The CP/M Format A CP/M disk has 3 areas: - The system area (the first 0 ... 3 tracks); - The DIR area containing file descriptions. The large files are split into several areas ("extents"), each with its own entry in the directory. These files use several entries in the directory. - The data area, divided into 16 "user" areas. This area may be selected by CP/M's "USER n" command, "n" being the number of the area (0 ... 15). The "USER" commands allow only access to the files in the selected area and to the files in the 0 area which are designated as "system" files. - 4 - 4. File Management by the MS-DOS Emulator The emulator is almost transparent with regard to MS-DOS disk and totally transparent when you deal with CP/M disks. The only differences concern the handling of directory files, time stamping and the use of passwords on MS-DOS disk. The directory files are gathered into the "USER 1" area. They can be listed with: USER 1 DIR Only the files described in the currently selected directory file can be handled with CP/M commmands or BDOS functions. The directory files are selected with the CD command. The DEMO version of the emulator does not time stamp MS- DOS disks. Passwords cannot be used on MS-DOS disks, because MS-DOS doesn't allow it. A special entry, named "other.dir", is present in the "USER 1" area. There is no file with this name on the disk. The entry is created by the emulator in order to allocate the sectors belonging to files with no entries in the current directory. In this way the files are protected against overwriting. 5. Commands The MS-DOS emulator is started by: MSDOS After the program is started, the following message is displayed: MS-DOS Emulator V1.03 # DEMO (c) SanDES 1990 A third line follows, displaying supplementary information (the computer type f. ex.). If the MS-DOS Emulator is already started, the following warning is displayed: *** MS-DOS emulator already started *** - 5 - Another message may be displayed: *** Not enough common memory *** This means that there is not enough room for the emulator's buffers in RAM (it needs at least 2 Kbytes), because there are other programs in the upper area of RAM (SUBMIT, GET or PUT f. ex.). This problem may be solved by starting the MS-DOS Emulator before the other programs. The emulator can be stopped by: MSDOS OFF The emulator has a built-in command for selecting directory files. It can be used as follows: CD directory file "directory file" becomes the current directory. CD .. The directory containing the entry describing the currently selected directory file becomes the new current directory. CD Resets the drive and selects the "\" directory as current directory. This command can be used after a disk change, instead of CTRL/C. CD . Resets the drive and retains the same current directory. The CD command cannot be used on CP/M disks. The use of the USER command before the CD command is not necessary. If the directory file requested by the CD command is not present on the disk, the following error message is displayed: No such directory There are no BDOS/BIOS functions allowing directory selection by the user's programs, but the CD command can be called from programs like TurboPascal (the X command) or WordStar (the R commands). The CTRL/C command or the BDOS functions nr. 13 (Reset - 6 - Disk System) select the "\" directory. The user's programs can use the BDOS function 60 - Call Resident System Extension (RSX) - to check for the emulator's presence or to terminate it: ... LD DE,control ; DE = the control block LD C,60 ; C = the code of the function CALL 5 ; call the BDOS (address 5) ... control: ; control block DEFB command ; the command codes: ; 0 -> stop ; 1: returns 0 in reg. A ; if the emulator is active ; else 0FFh ; 2 ... 7Fh: returns 0FFh in ; reg. A ; 80h ... 0FFh not allowed DEFB 1 ; the number of parameters (1) DEFW name ; the address of the name name: DEFB 'MSDOS ' ; the name must be 8 charactes long The complete version of the emulator has a large set of RSX functions for handling directory files and for other uses. 6. Restrictions concerning the MS-DOS disks: The MS-DOS Emulator has some restrictions compared with the MS-DOS running on a PC compatible. The reason is that the emulator internally converts the current MS-DOS directory into a CP/M directory. The number of entries in an MS-DOS directory is limited to the maximum number allowed into the CP/M directory. This restriction is valid for all directories on MS-DOS disks. - 7 - The maximum number of entries in a directory depends on the format of the disk and is as follows: 160 Kbytes ............. 112 entries (64 in "\") 180 Kbytes ............. 144 entries (64 in "\") 320 Kbytes ............. 160 entries (112 in "\") 360 Kbytes ............. 192 entries (112 in "\") 720 Kbytes ............. 224 entries (112 in "\") If these limits are overflowed at the opening of a new file or when a disk is written to, the emulator returns a BIOS error code 1 (error at writing on the disk). The user must know that the large files use several entries in the CP/M directory because of the internal conversion. 7. Other restrictions There are no restrictions concerning the use of the CP/M disks. The following restrictions are valid for the MS-DOS disks: - Only files in "USER 0" area can be handled by CP/M commands and BDOS functions. All the files which are read or written into the "USER 1" area are converted to MS-DOS directory files and during this conversion the FAT area is modified. Only the following BDOS functions: OPEN, CLOSE and READ, can be used in the "USER 1" area. The use of functions, which write into a file (like WRITE) can lead to data loss on a MS- DOS disk, because the MS-DOS Emulator has no protection against conversion errors. The files written into the "USER 2 ... 15" areas are stored into the "USER 0" area. - Reading a sector from the BOOT, FAT or DIR areas on an MS-DOS disk by a BIOS function returns a converted CP/M sector. A sector to be written into the directory will first be converted to the MS-DOS directory format and written into the selected directory and into the FAT area. This can lead to data loss if the sector to be written is not a correct CP/M directory sector. - The erased files on an MS-DOS disk cannot be rescued by using CP/M programs like "UNERASE" or "DISK UTILITY", because all the information on the sectors which had been allocated to the erased files disappears and even the names of these files are changed. - 8 - - After changing a disk the drive must be reset with CTRL/C or with "CD" without parameter. The MS-DOS Emulator - DEMO version - cannot detect a disk change. - The emulator - DEMO version - is very slow at erasing and writing files on MS-DOS disks. It uses the standard CP/M functions which are not very fast. A reset with "CD" or "CD ." may help - it leads to a reconstruction of the emulator's internal buffers and tables. 8. The MS-DOS Emulator - the complete version The complete version - which can be purchased - has the following features: - New built-in commands for file copying and for handling directory files. - A fast directory search system. - A safety system allowing disk changes without reset and offering a certain degree of protection against data loss. - Possibility of using "path" file descriptions, like under MS-DOS on a PC compatible. - Time stamping. 9. The MS-DOS Emulator on Commodore 128 This version can be used on a Commodore 128 computer with Commodore 1570 or 1571 diskette drive. The 1581 drive is also supported. The program uses the 4000h - 6000h area in RAM 0 and needs at least 2 Kbytes in the Common RAM (over 0E000h). It needs a total of 4 Kbytes in RAM 1 and Common RAM. The program can serve up to 4 disk drives. If Commodore 1541 drives are used, they must be connected to the 1570/71 drives and not directly to the computer. The user must be carefull when disks are swapped between the A: and E: drives (these two logical drives share the A: drive). The messages demanding disk changes must be followed - 9 - carefully. The emulator automatically recognizes the 360 Kbyte format. For the 160 and 180 Kbyte formats the user must select "IBM-8 SS" and for the 320 Kbytes format - "IBM-8 DS". The complete version has special functions and commands for handling files on single or double sided Commodore disks. Further information on MS-DOS Emulator: Nichita Sandru Sandvejen 33 DK-3390 Hundested DENMARK  -----BUGS LIST----- Known bugs in MS-DOS Emulator V1.03 1) WordStar's Run command cannot be used - crashes the system; 2) Trailing garbage in text files not ended with CTRL/Z; 3) Crashes sometimes when more than 2 drives are logged in; 4) Problems with using MS-DOS 720-Kbyte disks on th 1581 drive - the drive has to be turned off and on before inserting the diskette - it may be a bug in CP/M's BIOS. Nicky Sandru | ns@iddth.id.dk Sandvejen 33 | ns@iddth2.id.dk DK-3390 Hundested | DENMARK | +45 47 98 06 27