By Konamiman, 8/2011
Nextor 2.0 Alpha 2 User Manual
2.2. Standardized and documented driver development system
2.3. Drive to device/partition mapping management
2.5. Reduced allocation information mode
2.8. Extended mapper support routines
2.10. Built-in partitionning tool
3.3.1. Media changes in MSX-DOS 1 mode
3.4.1. MAPDRV: the drive mapping tool
3.4.2. DRIVERS: the driver information tool
3.4.3. DEVINFO: the device information tool
3.4.4. DRVINFO: the drive information tool
3.4.5. LOCK: the drive lock and unlock tool
3.4.6. RALLOC: the reduced allocation information mode tool
3.4.7. Z80MODE: the Z80 access mode tool
3.4.8. FASTOUT: the fast STROUT mode tool
3.4.9. DELALL: the partition quick format tool
3.5. The built-in partitioning tool
3.6.2. The CALL MAPDRV command
3.6.4. The CALL LOCKDRV command
Nextor is an enhanced version of MSX-DOS 2, the disk operating system for MSX computers. It is based on MSX-DOS 2.31, with which it is 100% compatible.
This document provides a description of the features that Nextor adds to MSX-DOS 2 and is intended primarily for end users, but it explains basic concepts that will be useful for developers as well. There are however two other documents aimed specifically at developers: Nextor 2.0 Alpha 2 Programmers Reference and Nextor 2.0 Alpha 2 Driver Development Guide. The reader of this document is assumed to have experience with MSX-DOS 2 at least at the user level.
WARNING: Nextor is in alpha state. This means that it has not been thoroughly tested, so please backup your valuable data before using it. Also, not all the planned features are implemented yet.
MSX-DOS is the only official disk operating system for MSX computers. The last version, labeled 2.31, appeared in 1990 accompanying MSX Turbo-R computers.
MSX-DOS was developed in a time in which the only option for massive storage in MSX computers was the floppy disk, and when used as a “floppy disk only operating system” MSX-DOS works indeed just fine. Over the years, however, more modern massive storage options have appeared in the form of amateur-made hardware -- from the early 90’s SCSI and IDE hard disk controllers to today’s multimedia card readers. MSX-DOS has been used to manage these devices, but not without some problems:
The primary goal of Nextor is to solve the aforementioned problems, by using MSX-DOS 2 as the basis for implementing the features that are needed for a MSX computer equipped with 21th century storage devices. More specifically, the main goals that Nextor development efforts aim to are:
Aside from the main goals, Nextor offers other secondary but also useful new features not present in MSX-DOS. Keep on reading for more details.
Nextor will run on any MSX computer (from MSX1 onwards) having at least 128K of mapped memory. In computers with no mapped memory or having less than 128K in the largest mapper, Nextor will boot in MSX-DOS 1 mode (the DOS prompt is available only if the computer has 64K of RAM).
You can simply burn a standalone version of Nextor (with a dummy device driver) and use it together with storage controllers associated to a MSX-DOS kernel. You will then benefit from features such as the FAT16 filesystem support or the Z80 access mode; note however that the drive to device/partition mapping management feature requires a device driver specifically made for Nextor.
This section overviews the features that actually make Nextor an enhanced version of MSX-DOS 2. Operational details are provided in further sections.
2.1. FAT16 filesystem support
Nextor provides built-in support for the FAT16 filesystem. There is no need to install any patch, and it is perfectly possible to boot the system from a FAT16 volume. Volumes up to 2GB in size can be used.
Additionally, standard boot sectors (those present in factory-formatted or partitioned devices, or in devices formatted or partitioned by PC computers) are fully supported as well. In contrast, MSX-DOS 2 treated all disks not formatted by itself as MSX-DOS 1 disks.
Developers of custom storage controller hardware now have a standardized and well-documented system for developing custom drivers. The driver structure, the details about the routines to be implemented and the “recipe” for embedding the driver within the Nextor kernel are provided so that no more reverse-engineering is needed.
The driver main purpose is to enumerate and access storage devices, but it also contains some extensibility points to add custom BASIC statements (via CALL command), extended BIOS commands, or a timer interrupt service routine.
The following resources are available for Nextor device driver developers:
Note: at this time it is not possible to invoke the FORMAT command on a drive mapped to a device controlled by a Nextor device-based driver. This will change in a future version of Nextor.
Driver developers can choose between two driver styles when developing a Nextor device driver: the drive-based driver and the device-based driver. The former mimics the MSX-DOS drivers by providing a one-to-one mapping between OS drive letters and driver units; it is still the responsibility of the driver to manage the drive to device and partition mapping. The latter is way more interesting.
Device-based drivers do not work in terms of driver units but directly in terms of devices. This means that the driver has no routines like “Read sector X of unit N” but rather “Return information of device X” and “Read raw data from device X”. A device-based driver can handle up to seven devices, and each device can have from one to seven logical units.
The best part is that when using device-based drivers, Nextor will handle the assignment of devices and partitions to drive letters, both automatically (at boot time) and manually (by using a mapping utility that in turn invokes a new function call). The driver developer only needs to implement raw access to the device.
Nextor allows marking drives as locked. When a drive is locked, the kernel code will not ask the driver if the media in the drive has changed; instead, it will assume that the user will never change the media. This is useful when a removable device such as a multimedia card is used as the main storage device, as it prevents the kernel to waste time executing media verification code. Also, locking is necessary to achieve proper drive to partition mapping when a driver cannot provide appropriate media change status information.
The drive from within NEXTOR.SYS is loaded (both at boot time and via CALL SYSTEM command) will be automatically locked. Other drives can be locked manually by using the supplied tool LOCK.COM.
All drives can be locked, even those belonging to MSX-DOS drivers (including floppy disk drives).
Nextor allows putting drives in reduced allocation information mode. When in this mode, the ALLOC function, which returns information about the total and free space available in a drive, will return fake information if necessary, so that the calculated total or free sector count will always fit in 16 bits. In other words, on drives with the reduced allocation information mode active, when the total or free space is greater than 32MB (which is possible in FAT16 volumes), ALLOC will return 32MB.
This feature is intended to avoid compatibility issues with applications that assume the underlying filesystem to be always FAT12 and therefore expect a total or free space information of up to 32MB. However it is also useful for the end user, since calculating the free space on a device (at the end of a DIR command, for example) takes a lot of time on large devices. When the reduced allocation information mode is active for a drive, Nextor will stop calculating free space as soon as it reaches a count of 32MB. Of course, when the space information is less than 32MB, then the actual value will be returned.
The reduced allocation information mode can be activated for all drives, however it makes sense only for drives mapped to a FAT16 filesystem (FAT12 drives will never have a size of more than 32MB).
In MSX Turbo-R computers MSX-DOS 2 always switches to the Z80 CPU when accessing a disk driver. Nextor will never change the CPU when accessing drivers attached to a Nextor kernel, but when accessing drivers attached to a MSX-DOS kernel it is possible to have the Z80 access mode active or not. When active, Nextor will switch to Z80 before accessing the driver, as MSX-DOS does.
The Z80 access mode is active by default for all MSX-DOS drivers. It is possible to switch it on or off on a per driver basis (it is not possible to change it for specific drive letters).
The MSX-DOS function STROUT prints a string terminated with a “$” character. What this function actually does is to perform one separate call to the CONOUT function (which prints one single character) for every character of the string.
Nextor introduces the fast STROUT mode. When this mode is active, the string will be copied to a 512 byte buffer in page 3 and then it will be printed in one single call to the kernel code, which increases the speed of the printing process. The drawback is that the string length is limited to 511 bytes when this mode is active; longer strings will be truncated before being displayed.
MSX-DOS 2 provides a set mapper support routines, which allow applications to allocate 16K RAM segments. Nextor maintains the original routines, but provides two new ones that allow allocating a contiguous block of memory (from 1 byte to 16K) inside a given segment.
2.9. Boot keys
MSX-DOS 2 provided the boot keys SHIFT (to disable the disk system) and CTRL (to disable the second floppy disk drive emulation). Nextor provides the following additional keys:
1: Force boot in MSX-DOS 1 mode. This key was already available in MSX Turbo-R computers, but with Nextor it can be used in all MSX computers.
3: Force boot to the BASIC prompt, ignoring any existing boot code (that is, do not try to load and run NEXTOR.SYS, AUTOEXEC.BAS or the code in the boot sector).
The Nextor kernel has a built-in device partitioning tool that can be started by just executing CALL FDISK in the BASIC prompt. It can be used to create partitions of any size between 100KB and 2GB on devices controlled by Nextor device based drivers.
The Nextor kernel contains the MSX-DOS 1 kernel, so that it is possible to boot in this environment when necessary. The Nextor version of MSX-DOS 1 does not provide any additional functionality to users or developers relative to the original version, however it has been modified internally so that it can access devices attached to Nextor drivers.
Disk BASIC has been extended with new commands. Also, some of the existing commands have been improved.
This section explains the operational details of Nextor and the associated utilities.
Nextor consists of the following components:
In order to boot in the MSX-DOS 1 prompt, you need the usual MSXDOS.SYS and COMMAND.COM files. Also, if you have just the kernel and no NEXTOR.SYS or MSXDOS.SYS files, Nextor will boot in the BASIC prompt (running AUTOEXEC.BAS if present).
Therefore, in order to “install” Nextor, you have two options:
Also, you need to copy at least NEXTOR.SYS and COMMAND2.COM to your boot device (it is recommended to have the associated utilities available as well) unless you are happy in the BASIC prompt. More details about the boot procedure follow.
The Nextor booting procedure is similar to the one performed by MSX-DOS 2. However, if Nextor device-based drivers are present, things are a little different since it is necessary to perform a drive to device and partition mapping for all the drives attached to Nextor drivers (if you are not using any Nextor kernel with a device-based driver attached, then the booting procedure is identical to MSX-DOS 2).
At boot time, Nextor will assign two drives to each Nextor device-based driver found. Then it will perform a device and partition to drive automatic mapping procedure for each of these drives. The procedure is as follows:
In short: the first two available devices having a FAT12 or FAT16 partition are assigned to the two drives, but partitions having a NEXTOR.DAT file in the root directory have preference. Note that the contents of the NEXTOR.DAT file is irrelevant, it may even be an empty file (in future versions of Nextor this file is likely to contain some system configuration information). Also, note that only primary partitions are examined in the automatic mapping procedure.
After the automatic mapping is finished, the boot procedure will continue with the following steps:
Note that step 3 will not be done if the disk has a standard boot sector (not created by MSX-DOS 1 or MSX-DOS 2). The built-in disk partitioning tool will create MSX-DOS 2 boot sectors for all partitions of 32MB or less, and standard boot sectors for larger partitions.
Nextor kernel can boot in MSX-DOS 1 mode. This will happen if anything of the following conditions is met:
The boot procedure for MSX-DOS 1 mode is the same as for the normal (MSX-DOS 2 compatible) mode, with the following differences:
Partitions of 16MB or less created with the built-in disk partitioning tool will have three sectors per FAT or less, so these can be used in MSX-DOS 1 mode.
Remember that MSX-DOS 1 can boot the DOS environment (MSXDOS.SYS and COMMAND.COM) if the computer as 64K of RAM. Otherwise, only Disk BASIC can be used.
At this time there is no way to change the drive mapping performed at boot time in MSX-DOS 1 mode. This capability will be added in a future version of Nextor.
Note: when booting directly in the BASIC prompt in MSX-DOS 1 mode, it is no longer necessary to execute “POKE &HF346,1” prior to CALL SYSTEM.
Before trying to read or write data from a device, MSX-DOS asks the device driver if the media has changed, in order to update its internal information about the accessed filesystem. Nextor does the same, but if the drive being accessed is mapped to a device-based driver, things get a little trickier because disk partitioning is involved.
When Nextor detects a media change in a drive mapped to a device-based driver, the following procedure is performed:
It is recommended to lock drives mapped to removable media in order to avoid unnecessary media checks. Also, if the driver always returns “unknown change status” for a device, locking is the only way to keep the desired partition mapped to the drive.
When Nextor is running in MSX-DOS 1 mode, media changes are not managed for drives mapped to device-based drivers. For these drives, Nextor will assume that the medium does never change, and therefore will never ask for change status information to the driver; if the medium is changed, it is necessary to manually inform Nextor about the change by issuing a CALL MAPDRV command from the BASIC prompt.
Nextor is supplied with a set of tools that allow managing the new capabilities available. All of these tools are .COM files intended to be executed from within the DOS prompt.
This section explains how to use these tools. Note however that you can also get help by displaying the desired file directly with the TYPE command (for example: TYPE MAPDRV.COM).
All the tools rely on the new function calls provided by Nextor for its behavior. If you are a developer and want to know more details, please refer to the Nextor 2.0 Alpha 2 Programmers Reference document.
Please note that none of these tools work in MSX-DOS 1 mode.
MAPDRV.COM is a tool that allows mapping a drive letter to a partition on a device controlled by a Nextor device-based driver. It is possible to map any drive, even those initially unmapped or associated to a MSX-DOS driver or a Nextor drive-based driver.
The usage syntax for MAPDRV is:
MAPDRV [/L] <drive>: <partition>|<primary>-<extended>|d|u
[<driver slot>[-<driver subslot>] <device index> [<LUN index>]]
The partition number can be specified in two ways:
Note that if partitions 2 to 4 are not extended, the only way to map then is to use the syntax <primary>-0.
If logical partition number 0 is specified, then the drive is mapped to the absolute sector zero of the device.
There are two options for specifying the device where the partition is located:
If “d” is specified instead of a partition number, then the drive will be mapped to its default state, which can be one of the following:
If “u” is specified instead of a partition number, then the drive will be left unmapped
The optional parameter “/L” locks the drive immediately after doing the mapping (recommended for removable devices that will not be changed).
The DRIVERS.COM utility, which is ran without parameters, displays information about the available MSX-DOS and Nextor drivers. It will display the name and version (for Nextor drivers only), the slot number, and the assigned drives at boot time. MSX-DOS drivers will be identified as “Legacy driver”.
This tool is useful mainly to get the slot numbers of the drivers, in order to supply them as parameters to the other tools.
The DEVINFO.COM utility displays information about the devices controlled by a given Nextor device-based driver. The information displayed includes the device name and manufacturer (when available), the device index, and the associated logical units types and sizes.
The usage syntax for DEVINFO is:
DEVINFO <driver slot>[-<driver subslot>]
This tool is useful mainly to get the device and logical unit indexes, in order to supply them as parameters to the MAPDRV tool.
The DRVINFO.COM utility, which is ran without parameters, displays information about all the available drive letters (those that are not unmapped). The displayed information includes the associated driver slot and other information that depends on the associated driver type (driver name and version for Nextor drivers; device and logical unit numbers for Nextor device-based drivers; relative unit for MSX-DOS and Nextor drive-based drivers). MSX-DOS drivers are identified as “Legacy driver”.
The LOCK.COM utility allows locking and unlocking drive letters. The usage syntax for LOCK is:
LOCK [<drive letter>: [ON|OFF]]
When ran without parameters, a list of the drive letters currently locked is shown. If only a drive letters is specified, the current lock status for the drive is shown.
When a drive is marked as locked, Nextor will never check the media change status for the drive; instead, the inserted media is assumed to never change. This speeds up media access, but be careful since data corruption may happen if the media is changed while it is locked.
The drive from within NEXTOR.SYS is loaded (both at boot time and via CALL SYSTEM command) will be automatically locked.
Any disk error which is aborted will automatically unlock the involved drive. Other than that, drives will be unlocked only when the LOCK utility is ran with the OFF parameter.
The RALLOC.COM utility allows activating and deactivating the reduced allocation information mode for a drive. The usage syntax for RALLOC is:
RALLOC [<drive letter>: ON|OFF]
If no parameters are specified, a list of drives currently in reduced allocation information mode will be shown.
When a drive is in this mode, the ALLOC function, which returns information about the total and free space available in a drive, will return fake information if necessary, so that the calculated total or free sector count will always fit in 16 bits. In other words, on drives with the reduced allocation information mode active, when the total or free space is greater than 32MB (which is possible in FAT16 volumes), ALLOC will return 32MB.
Nextor will never modify the reduced allocation information mode status for a drive automatically, it is the user who always controls this behavior. Disk errors or media changes do not modify the reduced allocation information mode status either.
The Z80MODE.COM utility, which works on MSX Turbo-R computers only, allows activating and deactivating the Z80 access mode for a MSX-DOS driver. The usage syntax for Z80MODE is:
Z80MODE <driver slot>[-<driver subslot>]] [ON|OFF]
If only a driver slot is specified, the current Z80 access mode state for the driver will be shown. The Z80 access mode is set or unset on a per driver basis (it is not possible to change it for specific drive letters).
The Z80 access mode can be set or unset on MSX-DOS drivers only (Nextor will never switch the current CPU when accessing a Nextor driver). When set, Nextor will switch the current CPU to Z80 prior to performing any operation with the driver. When not set, Nextor will not change the current CPU when accessing the driver.
Whether a given MSX-DOS driver needs the Z80 access mode to be set or not depends on each driver; when in doubt, look at the driver documentation or ask the driver developer if at all possible. Floppy disk drives are likely to need the Z80 access mode to be active.
At boot time Nextor will activate the Z80 access mode for all MSX-DOS drivers. Other than that, Nextor will never automatically change the Z80 access mode for any driver, it is the user who always controls this behavior.
The FASTOUT.COM utility allows to switch on an off the fast STROUT mode. The usage syntax for FASTOUT is:
FASTOUT [ON|OFF]
When invoked without parameters, it will show the current status of the FASTOUT mode.
The MSX-DOS function STROUT prints a string terminated with a “$” character. What this function actually does is to perform one separate call to the CONOUT function (which prints one single character) for every character of the string.
When the fast STROUT mode is active, the string will be copied to a 512 byte buffer in page 3 and then it will be printed in one single call to the kernel code, which increases the speed of the printing process. The drawback is that the string length is limited to 511 bytes when this mode is active; longer strings will be truncated (only the first 511 characters will be displayed).
The DELALL.COM utility will perform a quick format on the filesystem visible on a given drive letter. The usage syntax for DELALL is:
DELALL <drive letter>:
What this tool does is to clean the FAT and root directory areas of the filesystem, thus effectively deleting all the information on the filesystem. There is no way to undo the operation; the files will be permanently lost so please use with care.
This tool can be used on any drive, even those attached to MSX-DOS drivers. Note that the drive must be mapped to a valid FAT12 or FAT16 filesystem, otherwise this tool will not work.
The Nextor kernel has an embedded utility for partitioning storage devices attached to Nextor device-based drivers. To start it, just invoke CALL FDISK from the BASIC prompt. It works properly on both 40 columns and 80 columns mode.
The tool has a user interface based on menus, so anyone should be able to use it by just following the indications provided in the screen (when in doubt, look for an indication on what to do next in the lower line of the screen). There are however some points of interest to consider that are not mentioned in the tool itself:
Remember that Nextor can handle devices with FAT16 partitions and standard boot sectors; if you use a factory-partitioned device of 2GB or less you probably don’t need to partition it, unless you want to create MSX-DOS 1 compatible partitions.
The partitioning tool works in MSX-DOS 1 mode too. Note however that the tool will always allow you to create partitions larger than 16M, which are not compatible with MSX-DOS 1.
Nextor adds some new commands to Disk BASIC, mainly to ease the management of devices and partitions from this environment. Also, some of the commands that already existed in MSX-DOS have been extended or improved.
Unless otherwise stated, the Nextor modifications of Disk BASIC are not available in MSX-DOS 1 mode.
The DSKF command, which tells the free space available on a drive, returns a free cluster count in MSX-DOS. In Nextor the behavior of this command has been changed: now returns a free KB count.
This behavior represents a breaking change relative to MSX-DOS. However, most of the existing programs that use this command do not actually calculate the free space count in KB, displaying the raw cluster count to the user instead. Also, for many years the most popular storage media for MSX computers has been the 2DD floppy disk, in which the cluster size is 1K, so many users were incorrectly assuming that the DSKF command was returning a KB count anyway.
A new command has been added that allows changing the drive to device and partition mapping from the BASIC environment: CALL MAPDRV. This command is available in MSX-DOS 1 mode too.
The CALL MAPDRV syntax is explained below. Some of the parameters are optional, therefore all the possible variations are explained, starting with the most complete (using all parameters) one. Details about the possible values for each parameter are explained later.
Maps the specified drive to the specified partition of the specified device, which is controlled by the driver on the specified slot.
Maps the specified drive to the specified partition of the specified device. The driver slot is assumed to be the same of the device which contains the partition already mapped to the drive; if the drive is not currently mapped to a device-based driver, an “Invalid device driver” error will be thrown.
Maps the specified drive to the specified partition. The device is assumed to be the same one that contains the partition already mapped to the drive; if the drive is not currently mapped to a device-based driver, an “Invalid device driver” error will be thrown.
Leaves the specified drive unmapped. Further attempts to access the drive will throw a “Bad drive name” error (“Disk I/O error” in MSX-DOS 1 mode).
Maps the specified drive to its default value. If at boot time the drive was unmapped or was mapped to a MSX-DOS driver or to a Nextor drive-based driver, then the drive will be reverted to its original mapping state. Otherwise, and automatic mapping procedure (as explained in Section 3.2) will be performed; this may result or not on the drive having the same mapping it had at boot time, depending on which devices are available and how the other drives are mapped.
The command parameters syntax is as follows:
In MSX-DOS 1 mode there are some additional restrictions imposed by the Nextor architecture:
Also, please note that in MSX-DOS 1 mode, if you map a drive to an unsupported partition type (a FAT16 partition or a FAT12 partition having more than 3 sectors per FAT) you will always get a “Disk I/O error” when accessing that drive. This does not mean that the device is actually faulty, only that Nextor refuses to access it.
3.6.3. The CALL MAPDRVL command
The CALL MAPDRVL command is identical to the CALL MAPDRV command, except that it will perform a drive lock (see Sections 2.4 and 3.4.5) immediately after changing the drive mapping.
Note that this command is NOT available in MSX-DOS 1 mode, in which the concept of “drive lock” does not exist.
A new command has been added that allows to lock and unlock drives (see Sections 2.4 and 3.4.5). It is used as follows:
Displays the current lock status of the drive.
Unlocks the drive.
Locks the drive.
<drive> is a string with the drive letter followed by a colon. For example “A:”.
The following new BASIC error codes are defined to handle the possible errors of the new BASIC commands. These errors are available in MSX-DOS 1 mode as well for the commands that work in this environment. The numbers in parenthesis are the error codes.
This error will be thrown by the CALL MAPDRV command in any of these events:
This error will be thrown by the CALL MAPDRV command in any of these events:
This error will be thrown by the CALL MAPDRV command if the specified partition does not exist on the specified or implicit device.
This error will be thrown by the CALL MAPDRV command if you try to map a combination of partition, device and driver that is already mapped on another drive. You can however map the same combination to the same drive again.
This section contains the change history for the different versions of Nextor. Only the changes that are meaningful from the end user point of view are listed; for information on internal changes, please look at the Nextor 2.0 Alpha 2 Programmers Reference and Nextor 2.0 Alpha 2 Driver Development Guide documents.
You can get the latest version of Nextor and the associated tools at Konamiman’s MSX page:
For bug reports or suggestions, please write at: