# MSX-DOS

MSX-DOS is a discontinued disk operating system developed by Microsoft's Japan subsidiary for the 8-bit home computer standard MSX, and is a cross between MS-DOS v1.25 and CP/M-80 v2.2.

## MSX-DOS

MSX-DOS and the extended BASIC with 3½-inch floppy disk support were simultaneously developed by Microsoft and ASCII Corporation as a software and hardware standard for the MSX home computer standard, to add disk capabilities to BASIC and to give the system a cheaper software medium than Memory Cartridges, and a more powerful storage system than cassette tape. The standard BIOS of an unexpanded MSX computer had no built-in disk support, but provided hooks for a disk extension, so the additional floppy disk expansion system came with its own BIOS extension ROM (built-in on the disk controller) called the BDOS.
This BIOS not only added floppy disk support commands to MSX BASIC, but also a booting system, with which it was possible to boot a real disk operating system.
MSX-DOS was binary compatible with CP/M-80, allowing the MSX computer to easily have access to its vast library of software available for a very small cost for the time.

### Boot processing

Once MSX-DOS has been loaded, the system searches the MSX-DOS disk for the COMMAND.COM file and loads it into memory. In that case, the BDOS bypassed the BASIC ROMs, so that the whole 64 KB of address space of the Z80 microprocessor inside the MSX computer could be used for the DOS or for other boot-able disks, for example disk based games. At the same time, the original BIOS ROMs could still be accessed through a "memory bank switch" mechanism, so that DOS-based software could still use BIOS calls to control the hardware and other software mechanisms the main ROMs supplied. Also, due to the BDOS ROM, basic file access capabilities were available even without a command interpreter by using extended BASIC commands.
At initial startup, COMMAND.COM looks for an optional batch file named AUTOEXEC.BAT and, if it exists, executes the commands specified in there. If MSX-DOS is not invoked and Disk BASIC starts, a BASIC program named "AUTOEXEC.BAS" will be carried out instead, if present.

### Similarities and differences between MSX-DOS and MS-DOS

* MSX-DOS1, much like MS-DOS 1.25, used the FAT ID value from the first byte of the FAT to select file system parameter profiles for its FAT12 file system instead of from the BIOS Parameter Block (BPB) in the boot sector.
* On the MSX, there could be more than one floppy disk controller in two or more cartridge slots, and MSX-DOS could boot from several different floppy disk drives. This meant that it was possible to have both, a 5¼" floppy disk drive and a 3½" disk drive, and the user could boot from either one of them depending on which drive had a bootable floppy in it.
* Like MS-DOS 1.25, the first version of MSX-DOS did not have subdirectories

### Commands

The following is a list of internal commands supported by MSX-DOS.
* BASIC
* COPY
* DATE
* DEL
* DELETE
* DIR
* ERASE
* FORMAT
* MODE
* PAUSE
* REM
* REN
* RENAME
* TIME
* TYPE
* VERIFY

## Development history

MSX-DOS version history :
| Version | Date |
| 1.00 | June 1984 |
| 1.01 | March 1985 |
| 1.02 | July 1985 |
| 1.03 | August 1985 |
| 2.20 | July 1988 |
| 2.22 | |
| 2.30 | November 1990 |
| 2.31 | December 1991 |
On August 10, 1983, Paul Allen called Tim Paterson, original author of 86-DOS and MS-DOS 1.x, asking him to do a "Z80 version of MS-DOS" for the MSX standard. At the time, Paterson was busy trying to get the first product of his startup Falcon Systems ready to go, so he suggested a few other developers, but Allen said he had already asked. Allen was in a hurry to get it done and nobody else could meet his timeline. Allen and Paterson finally agreed, and on August 17, they signed an agreement to do "Z80 MS-DOS 1.25" for US$100,000 and the rights for Paterson's company to distribute MS-DOS 2.0, 2.5, and 3.0 with a hardware product without royalty.
For Paterson, this was mostly a translation process. He had already written a Z80-to-8086 assembly language translation program (TRANS.COM). In this case, he was manually translating in the other direction. Because MS-DOS 1.x was modelled after CP/M's API and was able to run CP/M applications that had been source-level translated to 8086, that would mean, MSX-DOS would be able to run CP/M programs directly.
For this project, Paterson also wrote a Z80 emulator that ran under MS-DOS, which would allow him to do the entire development project under MS-DOS. The MSX-DOS he was writing had an I/O System layer, that interfaced directly to the I/O System layer of the MS-DOS machine, that was running the emulation. This gave MSX-DOS direct access and control of the disk format. Most of the core code was file management, so this was necessary to test it out.
By October 2, 1983, he had Microsoft BASIC and Microsoft M80 macro assembler running under MSX-DOS. He finished coding COMMAND.COM a few days later. He worked out some bugs and demonstrated MSX-DOS to Paul Allen on October 11. The beta test version was officially delivered on October 26, 1983. It included an easter egg, that printed Paterson's name. The name was encoded with FAT code, so it could not be found by simply searching the file. After delivery of the beta version, the code was sent to ASCII in Japan. They created the I/O System for the MSX machine. That code was developed by Jay Suzuki. He figured out the easter egg and added his name to it.
ASCII was having problems getting MSX-DOS working on the actual MSX machine. They had not provided an actual MSX machine to Paterson, and instead flew him to Tokyo on January 28, 1984, to help them. It turned out that ASCII had been modifying the code without telling Paterson, so they were not working from the same codebase. Paterson spent three days in Tokyo figuring out the problems and came back to Seattle.
Chris Larson from Microsoft and Jay Suzuki visited Paterson in Seattle at the end of February and early March 1984. They brought an MSX machine with an in-circuit emulator (ICE) for debugging. They got everything working and on April 23, 1984, Microsoft accepted delivery and made the final payment for MSX-DOS to Paterson.
At the time MSX-DOS was written, there was only one popular disk operating system for 8-bit Intel 8080 compatible microprocessors, which was Digital Research's CP/M-80 system. It was also often used with Z80 systems, because the Z80 used an extended 8080 architecture. Microsoft's own disk operating system was also inspired by CP/M.
To be able to run (slightly modified) CP/M software Microsoft decided to implement functionality similar to major parts of the CP/M BIOS, routines that CP/M systems used to do specific disk operating tasks, such as opening files, etc. Instead of basing the command processor on CP/M's CCP, which was known for some user unfriendliness, a command line interpreter (COMMAND.COM) based on its MS-DOS counterpart was used. Microsoft also chose its own FAT12 file system over CP/M's filing methods. This ensured that MSX-DOS floppies could be used on an MS-DOS machine, and that only one single formatting and filing system would be used. This was an important decision, because CP/M disks were often not interchangeable between machines, incompatible disk formatting schemes being a factor in this.
Microsoft also added a standard set of disk commands to MSX-DOS that were compatible with MS-DOS but not with CP/M. Finally they converted their pipelining system from MS-DOS to MSX-DOS. The resulting DOS was a system that was much user-friendlier than CP/M, but was (in principle) compatible with major CP/M software packages such as WordStar, Turbo Pascal and the "M80" assembler and "L80" linker.

## Improved versions

* MSX-DOS2: released in 1988, it featured many improvements such as subdirectories, memory management up to 16MB and environment strings. Later versions of MSX computers (MSX2) added an internal real-time clock, which MSX-DOS could use for time stamping files.
* Nextor: is an enhanced version of MSX-DOS2 developed by Konamiman based on the original MSX-DOS2 source code.

### Commands

The following commands are supported by MSX-DOS version 2.
* ASSIGN
* ATDIR
* ATTRIB
* BASIC
* BUFFERS
* CD
* CHDIR
* CHKDSK
* CLS
* COMMAND2
* CONCAT
* COPY
* DATE
* DEL
* DIR
* DISKCOPY
* ECHO
* ERA
* ERASE
* EXIT
* FIXDISK
* FORMAT
* HELP
* MD
* MKDIR
* MODE
* MOVE
* MVDIR
* PATH
* PAUSE
* RAMDISK
* RD
* REM
* REN
* RENAME
* RMDIR
* RNDIR
* SET
* TIME
* TYPE
* UNDEL
* VER
* VERIFY
* VOL
* XCOPY
* XDIR
In addition, ASCII provided the following MSX-DOS2 Tools.
* ADDAUX
* BEEP
* BIO
* BODY
* BSAVE
* CAL
* CALC
* DUMP
* EXPAND
* GREP
* HEAD
* KEY
* LIST
* LS
* MENU
* MORE
* PATCH
* SLEEP
* SORT
* SPEED
* TAIL
* TR
* UNIQ
* VIEW
* WC