diff --git a/.gitignore b/.gitignore index 2aa4680b..e5fb2f49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ syntax: glob +.vs/ bin/** *.sym *.SYM @@ -22,25 +23,26 @@ dos250ba.dat kernel.dat nextor2.rom info/*.pdf -source/msxdos25/bank*/**.inc -source/msxdos25/drivers/**.inc -source/msxdos25/bank5/**.dat -source/msxdos25/bank5/**.asm -source/command25/msxdos/**.inc -source/command25/msxdos/codes.mac -source/command25/msxdos/data.mac +source/kernel/bank*/*.inc +source/kernel/drivers/*.inc +source/kernel/drivers/**/*.inc +source/kernel/drivers/**/*.lst +!source/kernel/drivers/MegaFlashRomSD/*.bin +source/kernel/drivers/**/*.rom +source/kernel/drivers/**/*.ROM +source/kernel/bank5/*.dat +source/kernel/bank5/*.asm +source/command/msxdos/*.inc +source/command/msxdos/codes.mac +source/command/msxdos/data.mac source/tools/**.inc source/tools/**.asm source/tools/**.com source/tools/**.COM source/tools/codes.mac source/tools/data.mac -source\tools\C\*.asm -source\tools\C\*.com *conflicto*.* *.sln *.suo NEXTOR.SYS NEXTORK.SYS - - diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..2d4c4abb --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,16 @@ +MSX-DOS is (c) 2018 The MSX Licensing Corporation +Nextor is (c) 2018 Nestor Soriano Vilchez + +Nextor is a fork of MSX-DOS and as such it makes extensive use of the MSX-DOS source code. The MSX Licensing Corporation authorizes this usage under the following terms: + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +- Commercial usage of the Software is not allowed without explicit permission from the copyright holders. "Commercial usage" means selling copies of the Software, either in source code form or in binary form. + +- Producing and distributing hardware that includes the Software in ROM (or in an equivalent built-in storage media) is allowed as long as no fee is charged for the Software itself. That is, the selling price of the hardware must be the same it would be if it didn't include the Software. + +- Derivative works are not allowed without explicit permission from the copyright holders. "Derivative works" means independent projects that are created as forks of the original source code for the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index ae7fda4f..3eef2fe5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,60 @@ # Nextor -This branch is a bit outdated, it needs some cleanup and syncrhonization work. In the mean time please see: +Nextor is a disk operating system for MSX computers. It is built on top of the source code of MSX-DOS 2.31, released in 1991. -* The README.md file for the `v.2.0` branch +The source code of Nextor is published with permission from the MSX Licensing Corporation under certain terms. **Please take a moment to read [the license terms](LICENSE.md) for details**. -* The `Nextor-2.1-alpha-1.txt` and `Nextor-2.1-alpha-2.txt` files in the `info` folder of this branch +Please visit [the Nextor section in Konamiman's MSX page](https://www.konamiman.com/msx/msx-e.html#nextor) for binaries. + +## Repository structure + +Note that there is no `master` branch, but branches for each major version of Nextor (v2.0 and v2.1 currently). + +* [**source**](/source): The source code of Nextor itself. + + * [**kernel**](source/kernel): The kernel ROM, includes the FDISK tool. + + * [**command**](source/command): `NEXTOR.SYS`, `COMMAND2.COM` and the command line tools that were originally supplied with MSX-DOS. + + * [**tools**](source/tools): The new command line tools created for Nextor. + +* [**wintools**](/wintools): Windows tools needed for building Nextor. Includes the source for two custom made tools: [`mknexrom`](/wintools/mknexrom.c) (C) and [`SymToEqus`](/wintools/SymToEqus.cs) (C#). + +* [**docs**](/docs): Documentation for both users and developers. + +## How to build Nextor + +You need: + +1. A Windows machine (if you don't have one see ["No Windows?"](#no-windows) below) +2. SDCC ([http://sdcc.sourceforge.net](http://sdcc.sourceforge.net)), targetting the Z80 processor, to build FDISK. +3. .NET Framework 2.0 or higher (for the `SymToEqus` tool in the `wintools` folder) +4. The `wintools` folder must be added to the `PATH` environment variable + +### To build the Nextor kernel + +Run the `compile.bat` script located in the `source\kernel` folder. If the FDISK tool has not been compiled already (the `fdisk.dat` and `fdisk2.dat` files do not exist in the `bank5` folder), they will be compiled on the fly. + +The generated kernel base file and the complete ROM files will be generated in the `bin\kernels` folder. One ROM file will be generated for each folder existing in the `source\kernel\drivers` folder. + +### To build the FDISK tool only + +If you make a change in the FDISK tool, you can compile it without having to compile the full kernel again. Just run the `compile.bat` script in the `source\kernel\bank5` folder (do NOT run `compfdsk.bat`). The ROM files in `bin\kernels` will be appropriately updated. + +### To build the command line tools + +Run the `compile.bat` script in the `source\tools` folder. The tools will be generated in the `bin\tools` folder. + +### To build `NEXTOR.SYS` + +Run the `compile.bat` script in the `source\command\msxdos` folder. The file will be generated in the `bin\tools` folder. + +### To build `COMMAND2.COM` + +Run the `compile.bat` script in the `source\command\command` folder. The file will be generated in the `bin\tools` folder. + +At this time there's no specific script (other than the original makefile) for building the original MSX-DOS command line tools. + +### No Windows? + +If your machine doesn't run Windows you can still build Nextor by using Xesco's [Nextor builder](https://github.com/xesco/NextorBuilder). \ No newline at end of file diff --git a/docs/DOS2-FCS.TXT b/docs/DOS2-FCS.TXT new file mode 100644 index 00000000..3255f2d5 --- /dev/null +++ b/docs/DOS2-FCS.TXT @@ -0,0 +1,2624 @@ +MSX-DOS 2 FUNCTION CODES SPECIFICATION + +By ASCII corporation Japan + +Supplied with COMPASS v1.0 by COMPJOETANIA + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + + This manual describes in detail the MSX-DOS function calls provided by +MSX-DOS version 2.20. + + +1. INTRODUCTION + + This document describes in detail each of the MSX-DOS 2 function calls. It +should be read in conjunction with the "Program Interface specification" +which describes system features such as file handles, fileinfo blocks and +environment strings in general terms. + + There are two ways of doing MSX-DOS function calls, reflecting the two +different environments (MSX-DOS and disk BASIC) in which the system can run. +Transient programs running in the MSX-DOS environment must access the func- +tions with a "CALL 00005h" instruction. Disk BASIC and other MSX programs +running in the disk BASIC environment (usually executing from ROM) must ac- +cess the system via a "CALL 0F37Dh" instruction. + + There are some limitations when calling the system via 0F37Dh, particu- +larly to do with error handling and abort routines. Also no parameters may be +passed in page-1, unless they are in the master disk ROM (as they will be for +disk BASIC) since the master disk ROM will be paged into page-1 when such a +function call is made. The individual function descriptions mention the dif- +ferences for particular functions. + + +2. LIST OF FUNCTIONS + + Below there is a complete list of the functions calls. "CPM" indicates +that the function is compatible with the equivalent CP/M 2.2 function, "MSX1" +indicates compatibility with MSX-DOS version 1, and "NEW" indicates a func- +tion which is new to the MSX DOS 2.xx system. An asterisk ("*") indicates +that the function may be safely called from a user disk error routine (see +function 64h and function 70h). + + + List of MSX-DOS 2 Function Calls + + CPM MSX1 00h - Program terminate + CPM MSX1* 01h - Console input + CPM MSX1* 02h - Console output + CPM MSX1* 03h - Auxiliary input + CPM MSX1* 04h - Auxiliary output + CPM MSX1* 05h - Printer output + CPM MSX1* 06h - Direct console I/O + MSX1* 07h - Direct console input + MSX1* 08h - Console input without echo + CPM MSX1* 09h - String output + CPM MSX1* 0Ah - Buffered line input + CPM MSX1* 0Bh - Console status + + CPM MSX1* 0Ch - Return version number + CPM MSX1 0Dh - Disk reset + CPM MSX1 0Eh - Select disk + + CPM MSX1 0Fh - Open file (FCB) + CPM MSX1 10h - Close file (FCB) + CPM MSX1 11h - Search for first entry (FCB) + CPM MSX1 12h - Search for next entry (FCB) + CPM MSX1 13h - Delete file (FCB) + CPM MSX1 14h - Sequential read (FCB) + CPM MSX1 15h - Sequential write FCB) + CPM MSX1 16h - Create file (FCB) + CPM MSX1 17h - Rename file (FCB) + + CPM MSX1* 18h - Get login vector + CPM MSX1* 19h - Get current drive + CPM MSX1 1Ah - Set disk transfer address + MSX1 1Bh - Get allocation information + + 1Ch - Unused + 1Dh - Unused + 1Eh - Unused + 1Fh - Unused + 20h - Unused + + CPM MSX1 21h - Random read (FCB) + CPM MSX1 22h - Random write(FCB) + CPM MSX1 23h - Get file size (FCB) + CPM MSX1 24h - Set random record (FCB) + 25h - Unused + MSX1 26h - Random block write (FCB) + MSX1 27h - Random block read (FCB) + CPM MSX1 28h - Random write with zero fill (FCB) + 29h - Unused + + MSX1* 2Ah - Get date + MSX1* 2Bh - Set date + MSX1* 2Ch - Get time + MSX1* 2Dh - Set time + MSX1* 2Eh - Set/reset verify flag + + MSX1* 2Fh - Absolute sector read + MSX1* 30h - Absolute sector write + NEW * 31h - Get disk parameters + + 32h - \ + . . \ Unused + . . / + 3Fh - / + + NEW 40h - Find first entry + NEW 41h - Find next entry + NEW 42h - Find new entry + + NEW 43h - Open file handle + NEW 44h - Create file handle + NEW 45h - Close file handle + NEW 46h - Ensure file handle + NEW 47h - Duplicate file handle + NEW 48h - Read from file handle + NEW 49h - Write to file handle + NEW 4Ah - Move file handle pointer + NEW 4Bh - I/O control for devices + NEW 4Ch - Test file handle + + NEW 4Dh - Delete file or subdirectory + NEW 4Eh - Rename file or subdirectory + NEW 4Fh - Move file or subdirectory + NEW 50h - Get/set file attributes + NEW 51h - Get/set file date and time + + NEW 52h - Delete file handle + NEW 53h - Rename file handle + NEW 54h - Move file handle + NEW 55h - Get/set file handle attributes + NEW 56h - Get/set file handle date and time + + NEW * 57h - Get disk transfer address + NEW * 58h - Get verify flag setting + NEW 59h - Get current directory + NEW 5Ah - Change current directory + NEW 5Bh - Parse pathname + NEW 5Ch - Parse filename + NEW * 5Dh - Check character + NEW 5Eh - Get whole path string + NEW 5Fh - Flush disk buffers + + NEW 60h - Fork a child process + NEW 61h - Rejoin parent process + NEW 62h - Terminate with error code + NEW 63h - Define abort exit routine + NEW 64h - Define disk error handler routine + NEW * 65h - Get previous error code + NEW * 66h - Explain error code + + NEW 67h - Format a disk + NEW 68h - Create or destroy RAM disk + NEW 69h - Allocate sector buffers + NEW * 6Ah - Logical drive assignment + NEW * 6Bh - Get environment item + NEW * 6Ch - Set environment item + NEW * 6Dh - Find environment item + + NEW * 6Eh - Get/set disk check status + NEW * 6Fh - Get MSX-DOS version number + NEW * 70h - Get/set redirection status + + +3. FUNCTION BY FUNCTION DEFINITIONS + + Below are detailed descriptions of each of the MSX-DOS functions including +both the old and new ones. The names in brackets after the function numbers +are the public labels for the function codes which are defined in +"CODES.MAC". Programs should use these names whenever possible. + + Many of the functions below 40h return an error flag rather than an error +code. If the error flag is set then the actual error code indicating the +cause of the error can be obtained by the "get previous error code" function +(function 65h). All of the functions above 40h return an error code in regis- +ter A. The "Program Interface Specification" document describes the general +errors which can be returned from many of the functions. The individual func- +tion specifications here describe the main error conditions which are speci- +fic to particular functions. + + Note that many of the function calls which modify the information on a +disk do not automatically flush disk buffers and so the disk is not neces- +sarily correctly updated immediately after the function call is made. Such +calls include all types of "create", "write", "delete", "rename", "change +file attributes" and "change file date and time" function calls. The only +functions which always flush disk buffers are "flush buffers", "close" and +"ensure". After these ope rations the disk will always be correctly updated. + + + +3.1 PROGRAM TERMINATE (00H) + +Parameters: C = 00H (_TERM0) +Results: Does not return + + + This function terminates program with a zero return code. It is provided +for compatibility with MSX-DOS 1 and CP/M, the preferred method of exiting a +program is to use the "terminate with error code" function call (function +62h), passing a zero error code if that is what is desired. See the descrip- +tion of that function call, and also the "Program Interface Specification", +for details of what happens when a program terminates. This function call +never returns to the caller. + + + +3.2 CONSOLE INPUT (01H) + +Parameters: C = 01H (_CONIN) +Results: L=A = Character from keyboard + + + A character will be read from the standard input (file handle 0 - usually +the keyboard) and echoed to the standard output (file handle 1 - usually the +screen). If no character is ready then this function will wait for one. +Various control characters, as specified for the "console status" function +(function 0Bh), will be trapped by this function for various control pur- +poses. If one of these characters is detected then it will be processed and +wait for another character. Thus these characters will never be returned to +the user by this function. + + + +3.3 CONSOLE OUTPUT (02H) + +Parameters: C = 02H (_CONOUT) + E = Character to be output +Results: None + + + The character passed in register E is written to the standard output (file +handle 1 - usually the screen). If printer echo is enabled then the character +is also written to the printer. Various control codes and escape sequences +are interpreted as screen control codes. A list of these is included in the +"Program Interface Specification", they are a sub-set of the standard VT-52 +control codes. TABs will be expanded to every eighth column. + + A console input status check is done, and if any of the special control +characters described for the "console status" function (function 0Bh) is +found then it will be processed as for that function. Any other character +will be saved internally for a later "console input" function call. + + + +3.4 AUXILIARY INPUT (03H) + +Parameters: C = 03H (_AUXIN) +Results: L=A = Input character + + + A character is read from the auxiliary input device (file handle 3) and if +no character is ready then it will wait for one. The auxiliary input device +must have been installed before this function may be used. If no such device +has been installed then this function will always return the end of file +character ("Ctrl-Z"). + + + +3.5 AUXILIARY OUTPUT (04H) + +Parameters: C = 04H (_AUXOUT) + E = Character to be output +Results: None + + + The character passed in register E will be written to the auxiliary output +device (file handle 3). The auxiliary output device must have been installed +before this function may be used. If no such device has been installed then +this function will simply throw the character away. + + + +3.6 PRINTER OUTPUT (05H) + +Parameters: C = 05H (_LSTOUT) + E = Character to be output +Results: None + + + The character passed in register E will be sent to the standard printer +device (file handle 4 - usually the parallel printer). The same channel is +used for console output which is echoed to the printer. TABs are not expanded +by thisfunction, although they are expanded when screen output is echoed to +the printer with "Ctrl-P". + + + +3.7 DIRECT CONSOLE I/O (06H) + +Parameters: C = 06H (_DIRIO) + E = 00H...FEH - character for output + = FFH - requests input +Results: A=L = input : 00H - no character ready + else input character + undefined for output + + + If E=FFh on entry then the keyboard will be examined for a character from +the standard input (file handle 0) and 00h returned if no character is ready. +If a character is ready then it will be read from the standard input (file +handle 0) and returned in register A without being echoed and with no check +for control characters. + + If E<>FFh on entry then the character in register E will be printed direc- +tly to the standard output (file handle 1) with no TAB expansion or printer +echo. Also no console status check is done by this function. Note that +although this function does not expand TABs, the VT-52 control codes include +TAB expansion so the effect on the screen is the same. + + + +3.8 DIRECT CONSOLE INPUT (07H) + +Parameters: C = 07H (_DIRIN) +Results: L=A = Input character + + + This function is identical to the input option of function 06h, except +that if no character is ready it will wait for one. Like function 06h, no +echo or control characters checks will be done. This function is not compa- +tible with CP/M which uses this function number for "get I/O byte". + + + +3.9 CONSOLE INPUT WITHOUT ECHO (08H) + +Parameters: C = 08H (_INNOE) +Results: L=A = Input character + + + This function is identical to function 01h except that the input character +will not be echoed to the standard output. The same control character checks +will be done. This function is not compatible with CP/M which uses this func- +tion number for "set I/O byte". + + + +3.10 STRING OUTPUT (09H) + +Parameters: C = 09H (_STROUT) + DE = Address of string +Results: None + + + The characters of the string pointed to by register DE will be output +using the normal console output routine (function call 02h). The string is +terminated by "$" (ASCII 24h). + + + +3.11 BUFFERED LINE INPUT (0AH) + +Parameters: C = 0AH (_BUFIN) + DE = Address of an input buffer +Results: None + + + DE must point to a buffer to be used for input. The first byte of this +buffer must contain the number of characters which the buffer can hold +(0...255). A line of input will be read from the standard input device (file +handle 0 - usually the keyboard) and stored in the buffer. The input will be +terminated when a CR is read from the standard input. The number of charac- +ters entered, which does not include the CR itself, will be stored at (DE+1). +If there is room in the buffer then the CR will be stored after the last +character. + + When inputting from the keyboard (which will normally be the case), a +simple line editor is provided, and also a 256 byte circular buffer of pre- +vious lines which can be edited and re-entered. The details of these editing +facilities are described in the separate "Command Specification" document, so +they are not included here. When the input buffer becomes full, the console +bell will be rung for each character typed which cannot be put in the buffer. +Each character entered will be echoed to the standard output and also to the +printer if printer echo is enabled. + + + +3.12 CONSOLE STATUS (0BH) + +Parameters: C = 0BH (_CONST) +Results: L=A = 00H if no key was pressed + = FFH if a key was pressed + + + A flag is returned in register A to indicate whether a character is ready +(that is, a key was pressed) for input from the keyboard. If a character is +ready then it will be read and tested for certain special control characters. +If it is not one of these then it is stored in an internal single byte buffer +and subsequent call to this function will return "character ready" immedia- +tely without checking the keyboard. If this function says that a character is +ready then the character may be read by function 02h or 08h. + + If the character is "Ctrl-C" then the program will be terminated with a +".CTRLC" error via the user's abort routine if one is defined. If the charac- +ter is "Ctrl-P" then printer echo will be enabled and it will be disabled if +it is "Ctrl-N". If the character is "Ctrl-S" then the routine will hang up +waiting for another character to be pressed and thenreturn "no character +ready", thus providing a "wait" facility. The character typed to continue +operation will be ignored, except that of it is "Ctrl-C" then the program +will be terminated. These same input checks are also done for functions 01h, +02h, 08h, 09h and 0Ah. + + + +3.13 RETURN VERSION NUMBER (0CH) + +Parameters: C = 0CH (_CPMVER) +Results: L=A = 22H + H=B = 00H + + + This function simply returns the CP/M version number which is being emu- +lated. This is always version 2.2 in current systems. + + + +3.14 DISK RESET (0DH) + +Parameters: C = 0DH (_DSKRST) +Results: None + + + Any data which is waiting in internal buffers is written out to disk. It +is not necessary to call this function in order to allow a disk change as is +the case with CP/M. The disk transfer address is also set back to its default +value of 80h by this function. + + + +3.15 SELECT DISK (0EH) + +Parameters: C = 0EH (_SELDSK) + E = Drive number. 0=A: 1=B: etc. +Results: L=A = Number of drives (1...8) + + + This function simply selects the specified drive as the default drive. The +current drive is also stored at address 0004h for CP/M compatibility. The +number of drives available is returned in register A but this will not in- +clude the RAMdisk. + + + +3.16 OPEN FILE [FCB] (0FH) + +Parameters: C = 0FH (_FOPEN) + DE = Pointer to unopened FCB +Results: L=A = 0FFH if file not found + = 0 if file is found + + + The unopened FCB must contain a drive which may be zero to indicate the +current drive and a filename and extension which may be ambiguous. The cur- +rent directory of the specified drive will be searched for a matching file +and if found it will be opened. Matching entries which are sub-directories or +system files will be ignored, and if the filename is ambiguous then the first +suitable matching entry will be opened. + + Device names may be put in the FCB (without a colon) to allow devices to +be accessed as if they were actually disk files. The standard device names +are defined in the "Program Interface Specification". + + The low byte of the extent number is not altered by this function, and a +file will only be opened if it is big enough to contain the specified extent. +Normally the transient program will set the extent number to zero before +calling this function. The high byte of the extent number will be set to zero +to ensure compatibility with CP/M. + + The filename and extension in the FCB will be replaced by the actual name +of the file opened from the directory entry. This will normally be the same +as what was there before but may be different if an ambiguous filename or one +with lower case letters in was used. + + The record count will be set to the number of 128 byte records in the +specified extent, which is calculated from the file size. The file size field +itself, the volume-id and the 8 reserved bytes will also be set up. The cur- +rent record and random record fields will not be altered by this function, it +is the application program's responsibility to initialize them before using +the read or write functions. + + If the file cannot be found, then the "APPEND" environment item will be +examined. If this is set then it is interpreted as a drive/path string which +specifies a second directory in which to look for the file. The specified +directory will be searched for the file and if found it will be opened as +above. In this case the drive byte of the FCB will be set to the drive on +which the file was found to ensure correct accessing of the file if the ori- +ginal drive byte was zero (default). + + + +3.17 CLOSE FILE [FCB] (10H) + +Parameters: C = 10H (_FCLOSE) + DE = Pointer to opened FCB +Results: L=A = 0FFH if not successful + = 0 if successful + + + The FCB must have previously been opened with either an OPEN or a CREATE +function call. If the file has only been read then this function does +nothing. If the file has been written to then any buffered data will be writ- +ten to disk and the directory entry updated appropriately. The file may still +be accessed after a close, so the function can be regarded as doing an +"ensure" function. + + + +3.18 SEARCH FOR FIRST [FCB] (11H) + +Parameters: C = 11H (_SFIRST) + DE = Pointer to unopened FCB +Results: L=A = 0FFH if file not found + = 0 if file found. + + + This function searches the current directory of the drive specified in the +FCB (default drive if FCB contains zero) for a file which matches the file- +name and extension in the FCB. The filename may be ambiguous (containing "?" +characters) in which case the first match will be found. The low byte of the +extent field will be used, and a file will only be found if it is big enough +to contain this extent number. Normally the extent field will be set to zero +by the program before calling this function. System file and sub-directory +entries will not be found. + + If a suitable match is found (A=0) then the directory entry will be copied +to the DTA address, preceded by the drive number. This can be used directly +as an FCB for an OPEN function call if desired. The extent number will be set +to the low byte of the extent from the search FCB, and the record count will +be initialized appropriately (as for OPEN). The attributes byte from the +directory entry will be stored in the S1 byte position, since its normal +position (immediately after the filename extension field) is used for the +extent byte. + + If no match is found (A=0FFh) then the DTA will not be altered. In no case +will the FCB pointed to by DE be modified at all. This function remembers +sufficient information internally to allow it to continue the search with a +SEARCH FOR NEXT function, so it is not necessary for the FCB to be preserved +if doing a SEARCH FOR NEXT function. + + In CP/M, if the drive number is set to "?" in this function then all +directory entries, allocated or free will be matched. Also if the extent +field is set to "?" then any extent of a file will be matched. Both of these +features are normally only used by special purpose CP/M programs which are +generally specific to the CP/M filing system (such as "STAT"). Neither fea- +ture is present in MSX-DOS 1/2. + + + +3.19 SEARCH FOR NEXT [FCB] (12H) + +Parameters: C = 12H (_SNEXT) +Results: L=A = 0FFH if file not found + = 0 if file found. + + + It continues the search to look for the next match with the filename. The +results returned from this function are identical to SEARCH FOR FIRST and all +the same comments apply. The information used to continue the search is held +internally within MSX-DOS and so the original FCB used in the SEARCH FOR +FIRST need not still exist. + + + +3.20 DELETE FILE [FCB] (13H) + +Parameters: C = 13H (_FDEL) + DE = Pointer to unopened FCB +Results: L=A = 0FFH if no files deleted + = 0 if files deleted OK + + + All files in the current directory of the disk specified by the FCB, and +which match the ambiguous filename in the FCB, are deleted. Sub-directories, +system files, hidden files and read only files are not deleted. If any files +at all are successfully deleted then this function returns with A=0. A return +with A=FFh indicates that no files were deleted. + + + +3.21 SEQUENTIAL READ [FCB] (14H) + +Parameters: C = 14H (_RDSEQ) + DE = Pointer to opened FCB +Results: L=A = 01H if error (end of file) + = 0 if read was successful + + + This function reads the next sequential 128 byte record from the file into +the current disk transfer address. The record is defined by the current ex- +tent (high and low bytes) and the current record. After successfully reading +the record, this function increments the current record and if it reaches +080h, sets it back to zero and increments the extent number. The record count +field is also kept updated when necessary. + + Unlike CP/M it is possible to have partially filled records, since the +file size is not necessarily a multiple of 128 bytes. If this occurs then the +partial record is padded out with zeroes when it is copied to the transient +program's DTA address. + + + +3.22 SEQUENTIAL WRITE [FCB] (15H) + +Parameters: C = 15H (_WRSEQ) + DE = Pointer to opened FCB +Results: L=A = 01H if error (disk full) + = 0 if write was successful + + + This function writes the 128 bytes from the current disk transfer address +to the file at the position defined by the current record and extent, which +are then incremented appropriately. The record count byte is kept updated +correctly if the file is extended or if the write moves into a new extent. +The file size in the FCB is also updated if the file is extended. + + + +3.23 CREATE FILE [FCB] (16H) + +Parameters: C = 16H (_FMAKE) + DE = Pointer to unopened FCB +Results: L=A = 0FFH if unsuccessful + = 0 if successful + + + This function creates a new file in the current directory of the specified +drive and opens it ready for reading and writing. The drive, filename and low +byte of the extent number must be set up in the FCB and the filename must not +be ambiguous. Checks will be done to ensure that invalid filenames are not +created. + + If there is already a file of the required name then the action depends on +the value of the extent number byte. Normally this will be zero and in this +case the old file will be deleted and a new one created. However if the ex- +tent number is non-zero then the existing file will be opened without crea- +ting a new file. This ensures compatibility with early versions of CP/M where +each extent had to be explicitly created. + + In all cases the resulting file will be opened with the required extent +number exactly as if an OPEN function call had been done. + + + +3.24 RENAME FILE [FCB] (17H) + +Parameters: C = 17H (_FREN) + DE = Pointer to unopened FCB +Results: L=A = 0FFH if not successful + = 0 if successful + + + The unopened FCB has the normal drive and filename, and also a second +filename starting at (DE+17). Every file in the current directory of the +specified drive which matches the first filename, is changed to the second +filename with "?" characters in the second filename leaving the appropriate +character unchanged. Checks are done to prevent duplicate or illegal file- +names from being created. Entries for sub-directories, hidden files and sys- +tem files will not be renamed. + + + +3.25 GET LOGIN VECTOR (18H) + +Parameters: C = 18H (_LOGIN) +Results: HL = Login vector + + + This function returns a bit set in HL for each drive which is available, +bit-0 of L corresponding to drive "A:". Up to eight drives ("A:" to "H:") are +supported by the system currently, so register H will usually be zero on +return. + + + +3.26 GET CURRENT DRIVE (19H) + +Parameters: C = 19H (_CURDRV) +Results: L=A = Current drive (0=A: etc) + + + This function just returns the current drive number. + + + +3.27 SET DISK TRANSFER ADDRESS (1AH) + +Parameters: C = 1AH (_SETDTA) + DE = Required Disk Transfer Address +Results: None + + + + This function simply records the address passed in DE as the disk transfer +address. This address will be used for all subsequent FCB read and write +calls, for "search for first" and "search for next" calls to store the direc- +tory entry, and for absolute read and write calls. It is not used by the new +MSX-DOS read and write functions. The address is set back to 80h by a DISK +RESET call. + + + +3.28 GET ALLOCATION INFORMATION (1BH) + +Parameters: C = 1BH (_ALLOC) + E = Drive number (0=current, 1=A: etc) +Results: A = Sectors per cluster + BC = Sector size (always 512) + DE = Total clusters on disk + HL = Free clusters on disk + IX = Pointer to DPB + IY = Pointer to first FAT sector + + + This function returns various information about the disk in the specified +drive. It is not compatible with CP/M which uses this function number to +return the address of an allocation vector. Note that unlike MSX-DOS 1, only +the first sector of the FAT may be accessed from the address in IY, and the +data there will only remain valid until the next MSX-DOS call. + + + +3.29 RANDOM READ [FCB] (21H) + +Parameters: C = 21H (_RDRND) + DE = Pointer to opened FCB +Results: L=A = 01H if error (end of file) + = 0 if read was successful + + + This function reads a 128 byte record from the file to the current disk +transfer address. The file position is defined by the three byte random re- +cord number in the FCB (bytes 21h...23h). Unlike CP/M all three bytes of the +random record number are used. A partial record at the end of the file will +be padded with zeroes before being copied to the user's DTA. + + The random record number is not altered so successive calls to this func- +tion will read the same record unless the transient program alters the random +record number. A side effect is that the current record and extent are set up +to refer to the same record as the random record number. This means that +sequential reads (or writes) can follow a random read and will start from the +same record. The record count byte is also set up correctly for the extent. + + + +3.30 RANDOM WRITE [FCB] (22H) + +Parameters: C = 22H (_WRRND) + DE = Pointer to opened FCB +Results: L=A = 01H if error (disk full) + = 0 if no error + + + This function writes a 128 byte record from the current disk transfer +address to the file, at the record position specified by the three byte ran- +dom record number (bytes 21h...23h). All three bytes of the random record +number are used. If the record position is beyond the current end of file +then un-initialized disk space will be allocated to fill the gap. + + The random record number field will not be changed, but the current record +and extent fields will be set up to refer to the same record. The record +count byte will be adjusted as necessary if the file is being extended or if +the write goes into a new extent. + + + +3.31 GET FILE SIZE [FCB] (23H) + +Parameters: C = 23H (_FSIZE) + DE = Pointer to unopened FCB +Results: L=A = 0FFH if file not found + = 0 if file found OK + + + This function searches for the first match with the filename in the FCB, +exactly the same as OPEN FILE (function 0FH). The size of the located file is +rounded up to the nearest 128 bytes and the number of records determined. The +three byte random record field of the FCB is set to the number of records, so +it is the number of the first record which does not exist. The fourth byte of +the random record number is not altered. + + + +3.32 SET RANDOM RECORD [FCB] (24H) + +Parameters: C = 24H (_SETRND) + DE = Pointer to opened FCB +Results: None + + + This function simply sets the three byte random record field in the FCB to +the record determined by the current record and extent number. The fourth +byte of the random record number is not altered. No check is done as to whe- +ther the record actually exists in the file. + + + +3.33 RANDOM BLOCK WRITE [FCB] (26H) + +Parameters: C = 26H (_WRBLK) + DE = Pointer to opened FCB + HL = Number of records to write +Results: A = 01H if error + = 0 if no error + + + Data is written from the current disk transfer address to the position in +the file defined by the random record number. The record size is determined +by the record size field in the FCB (bytes 0Eh and 0Fh) which must be set by +the user after opening the file and before calling this function. If the +record size is less than 64 bytes then all four bytes of the random record +number are used, otherwise only the first three are used. + + The number of records to be written is specified by HL, and together with +the record size this determines the amount of data to be written. An error +will be returned if the size exceeds 64k, thus limiting the maximum size of a +transfer. + + After writing the data, the random record field is adjusted to the next +record number in the file (ie. HL is added on to it). The current record and +extent fields are not used or altered. The file size field is updated if the +file has been extended. + + The record size can be any value from 1...0FFFFh. Small record sizes are +no less efficient that large record sizes so if desired the record size can +be set to one and the record count then becomes a byte count. It is desirable +to write as much as possible with one function call since one large transfer +will be quicker than several small ones. + + If the number of records to write (HL) is zero then no data will be writ- +ten, but the size of the file will be altered to the value specified by the +random record field. This may be either longer or shorter than the file's +current size and disk space will be allocated or freed as required. Additio- +nal disk space allocated in this way will not be initialized to any particu- +lar value. + + + +3.34 RANDOM BLOCK READ [FCB] (27H) + +Parameters: C = 27H (_RDBLK) + DE = Pointer to opened FCB + HL = Number of records to read +Results: A = 01H if error (usually caused by + end-of-file) + = 0 if no error + HL = Number of records actually read + + + This function is the complement of the BLOCK WRITE function described +above and most of the same comments apply as regards its use. Again if large +blocks are read then it will be much faster than the normal CP/M operation. + + For example if it is desired to read 20k from a file, it is better to read +the 20k with one function call rather than 20 separate function calls of 1k +each. However it makes no difference whether the 20k read is done with a +record size of 1 and a record count of 20k, with a record size of 20k and a +record count of 1, or any intermediate combination. + + The number of records actually read is returned in HL. This may be smaller +than the number of records requested if the end of the file was encountered. +In this case any partial record will be padded out with zeroes before being +copied to the users DTA. The random record field is adjusted to the first +record not read, ie. the value returned in HL is added on to it. + + + +3.35 RANDOM WRITE WITH ZERO FILL [FCB] (28H) + +Parameters: C = 28H (_WRZER) + DE = Pointer to opened FCB +Results: L=A = 01H if error + = 00H if no error + + + This function is identical to RANDOM WRITE (function 22h) except that if +the file has to be extended, any extra allocated disk clusters will be filled +with zeroes before writing the data. + + + +3.36 GET DATE (2AH) + +Parameters: C = 2AH (_GDATE) +Results: HL = Year 1980...2079 + D = Month (1=Jan...12=Dec) + E = Date (1...31) + A = Day of week (0=Sun...6=Sat) + + + This function simply returns the current value of the internal calender in +the format shown. + + + +3.37 SET DATE (2BH) + +Parameters: C = 2BH (_SDATE) + HL = Year 1980...2079 + D = Month (1=Jan...12=Dec) + E = Date (1...31) +Results: A = 00H if date was valid + FFH if date was invalid + + + The supplied date is checked for validity and if it is valid then it is +stored as the new date. The validity checks include full checking for the +number of days in each month and leap years. If the date is invalid then the +current date will be left unaltered. The date is stored in the real time +clock chip so it will be remembered when the machine is turned off. + + + +3.38 GET TIME (2CH) + +Parameters: C = 2CH (_GTIME) +Results: H = Hours (0...23) + L = Minutes (0...59) + D = Seconds (0...59) + E = Centiseconds (always zero) + + + This function returns the current value of the system clock in the format +shown. + + + +3.39 SET TIME (2DH) + +Parameters: C = 2DH (_STIME) + H = Hours (0...23) + L = Minutes (0...59) + D = Seconds (0...59) + E = Centiseconds (ignored) +Results: A = 00H if time was valid + FFH if time was invalid + + + This function sets the internal system clock to the specified time value. +If the time is invalid then register A will be returned as 0FFh to indicate +an error and the current time will be left unaltered. The time is stored in +the real time clock chip and so it will be remembered and kept correct when +the machine is turned off. + + + +3.40 SET/RESET VERIFY FLAG (2EH) + +Parameters: C = 2EH (_VERIFY) + E = 0 to disable verify + <> 0 to enable verify +Results: None + + + This function simply enables or disables automatic verification of all +writes. It defaults to off when MSX-DOS is started up. Enabling verify im- +proves system reliability but also slows down write operations. Note that +this function depends on the disk driver and the verification will not be +done if the driver does not support it. + + + +3.41 ABSOLUTE SECTOR READ (2FH) + +Parameters: C = 2FH (_RDABS) + DE = Sector number + L = Drive number (0=A: etc.) + H = Number of sectors to read +Results: A = Error code (0=> no error) + + + This function reads sectors directly from the disk without interpreting +them as files. The disk must be a valid DOS disk in order for the sector +number to be translated into a physical position on the disk. The sectors +will be read to the current disk transfer address. Any disk error will be +reported by the system in the usual way. + + + +3.42 ABSOLUTE SECTOR WRITE (30H) + +Parameters: C = 30H (_WRABS) + DE = Sector number + L = Drive number (0=A: etc.) + H = Number of sectors to write +Results: A = Error code + + + This function writes sectors directly to the disk without interpreting +them as files. The disk must be a valid DOS disk in order for the sector +number to be translated into a physical position on the disk. The sectors +will be written from the current disk transfer address. Any disk errors are +reported by the system in the usual way. + + + +3.43 GET DISK PARAMETERS (31H) + +Parameters: C = 31H (_DPARM) + DE = Pointer to 32 byte buffer + L = Drive number (0=default, 1=A: etc.) +Results: A = Error code + DE = Preserved + + + This functions returns a series of parameters relating to the format of +the disk in the specified drive, to the buffer allocated within the user's +program. It is useful for programs which are going to do absolute sector +reads and writes, in order for them to be able to interpret the absolute +sector numbers. The parameters returned contain some redundant information in +order to provide parameters which are most useful to transient programs. The +format of the returned parameter block is: + + + DE+0 - Physical drive number (1=A: etc) + DE+1,2 - Sector size (always 512 currently) + DE+3 - Sectors per cluster (non-zero power of 2) + DE+4,5 - Number of reserved sectors (usually 1) + DE+6 - Number of copies of the FAT (usually 2) + DE+7,8 - Number of root directory entries + DE+9,10 - Total number of logical sectors + DE+11 - Media descriptor byte + DE+12 - Number of sectors per FAT + DE+13..14 - First root directory sector number + DE+15..16 - First data sector number + DE+17..18 - Maximum cluster number + DE+19 - Dirty disk flag + DE+20..23 - Volume id. (-1 => no volume id.) + DE+24..31 - Reserved (currently always zero) + + + The dirty disk flag indicates whether in the disk there is a file which +can be recovered by UNDEL command. It is reset when the file allocation is +done. + + + +3.44 FIND FIRST ENTRY (40H) + +Parameters: C = 40H (_FFIRST) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + HL = filename ASCIIZ string (only if + DE = fileinfo pointer) + B = Search attributes + IX = Pointer to new fileinfo block +Results: A = Error + (IX) = Filled in with matching entry + + + The "drive/path" portion of the string, or the fileinfo block, specifies a +directory which is to be searched. A ".IATTR" error will be returned if a +fileinfo block which specifies a file is passed. The "file" portion of the +string, or the filename ASCIIZ string in HL, determines what filenames will +be matched. If no match is found then a ".NOFIL" error is returned, otherwise +the fileinfo block pointed to by IX is filled in with the details of the +matching entry. + + The filename may contain ambiguous filename characters ("?" or "*") in +which case the first matching entry will be returned. If the filename is null +(either the ASCIIZ string pointed to by DE is null or ends in a "\" or the +filename string pointed to by HL is null), then this function will behave +exactly as if the filename was "*.*" so any name will match. + + The attributes byte in register B specifies what type of entry will be +matched. If it is zero then only non-hidden, non-system files will be found. +If the directory, hidden or system bits in register B are set then entries +with these attributes will be matched as well as ordinary files. The read +only and archive bits of register B are ignored. + + If the volume name bit of register B is set then the search is exclusive, +only the volume label entry will be found. In this case also the fileinfo +block and filename or the drive/path/file string are ignored apart from spe- +cifying the drive. This means that the volume name will always be found in +the root directory if it exists whether or not it matches the filename given. + + If DE points to a fileinfo block, then if desired, IX can point to the +same fileinfo block. In this case when a match is found the new fileinfo +block will overwrite the old one. + + + +3.45 FIND NEXT ENTRY (41H) + +Parameters: C = 41H (_FNEXT) + IX = Pointer to fileinfo block from + previous find first function. +Results: A = Error + (IX) = Filled in with next matching entry + + + This function should only be used after a "find first entry" function +call. It searches the directory for the next match to the (presumably ambi- +guous) filename which was given to the "find first entry" function call. If +there are no more matching entries then a ".NOFIL" error is returned, other- +wise the fileinfo block is filled in with the information about the new +matching entry. + + + +3.46 FIND NEW ENTRY (42H) + +Parameters: C = 42H (_FNEW) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + HL = filename ASCIIZ string (only if + DE = fileinfo pointer) + B = b0..b6 = Required attributes + b7 = Create new flag + IX = Pointer to new fileinfo block + containing template filename +Results: A = Error + (IX) = Filled in with new entry + + + This function is very similar to the "find first entry" function described +above. The parameters in HL and DE are used in exactly the same way to speci- +fy a directory entry. However instead of searching the selected directory for +an entry which matches the specified name, a new entry will be created with +this name. The fileinfo block pointed to by IX will be filled in with infor- +mation about the new entry just as if it had been found with a "find first +entry" call. + + If there are any ambiguous characters ("?" or "*") in the filename, then +they will be replaced by the appropriate character from a "template filename" +in the filename position of the new fileinfo block pointed to by IX. If the +result is still ambiguous, or otherwise illegal, then a ".IFNM" error is +returned. This is useful for copy operations which do an automatic rename. + + Like "find first entry", if the filename is null, then it will be treated +exactly as if it was "*.*". For this function that means that the template +filename will be used as the new filename to create. + + A ".DRFUL" error will be returned if there is no room in the root direc- +tory, and a ".DKFUL" if a sub-directory must be extended and the disk is +already full. + + The attribute byte passed in register B is the attribute which the new +entry will be given. If the volume name bit is set then a volume name will be +created in the root directory. If the directory bit is set then the entry +created will be for a sub-directory, otherwise it will be for a file. The +system, hidden and read only bits may be set for a file, and the hidden bit +for a sub-directory. A file will always be created with the archive attribute +bit set. + + A file will be created as zero length with the current date and time. A +sub-directory will have a single cluster allocated to it and the "." and ".." +entries will be initialized appropriately. + + If there is already an entry with the specified name in the directory then +the action depends on the "create new" flag (bit-7 of register B) and also on +the type of the entry. If the "create new" flag is set then a ".FILEX" error +will always be returned. Setting this flag therefore ensures that an +existing file will not be deleted. + + If an entry already exists and the "create new" flag is not set then the +type of the existing entry is examined to see whether it can be deleted to +make room for the new file. An error will be returned if the entry is a read +only file (".FILRO" error), a system file (".SYSX" error) or a sub-directory +(".DIRX" error) or there is a file handle already open to this file (".FOPEN" +error). If we are trying to create a sub-directory then even an ordinary file +will not be deleted (".FILEX" error). + + For all of these error codes (".FILEX", ".FILRO", ".SYSX", ".DIRX", +".FOPEN"), the fileinfo block will be filed in with the details of the alrea- +dy existing entry and this fileinfo block may be used exactly as if it had +been returned from a "find first" function. + + + +3.47 OPEN FILE HANDLE (43H) + +Parameters: C = 43H (_OPEN) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + A = Open mode. b0 set => no write + b1 set => no read + b2 set => inheritable + b3..b7 - must be clear +Results: A = Error + B = New file handle + + + The drive/path/file string or the fileinfo block should normally refer to +a file rather than a sub-directory or volume name. If it is a volume name +then a ".IATTR" error will be returned. If it is a sub-directory then ".DIRX" +error will be returned. + + Assuming that a file is specified then it will be opened ready for reading +and/or writing (depending on the open mode in A) and a new file handle for it +will be returned in register B. The lowest available file handle number will +be used and an error will result if there are no spare file handles (".NHAND" +error), or insufficient memory (".NORAM" error). + + If the "no read" bit of register A is set then reads from the file handle +will be rejected and if the "no write" bit is set then writes will be rejec- +ted, in both cases with an ".ACCV" error. Writes will also be rejected if the +file is read only (".FILRO" error). If the "inheritable" bit of register A is +set then the file handle will be inherited by a new process created by the +"fork" function call (see function 60h). + + If a device file handle is opened by giving a filename which matches one +of the built in devices (for example "CON" or "NUL"), then it will always be +opened initially in ASCII mode. The IOCTL function (function 4Bh) can be used +to change this to binary mode but great care must be taken in reading from +devices in binary mode because there is no end of file condition. + + + +3.48 CREATE FILE HANDLE (44H) + +Parameters: C = 44H (_CREATE) + DE = Drive/path/file ASCIIZ string + A = Open mode. b0 set => no write + b1 set => no read + b2 set => inheritable + b3..b7 - must be clear + B = b0..b6 = Required attributes + b7 = Create new flag +Results: A = Error + B = New file handle + + + A file or sub-directory, as specified by the attributes in register B, +will be created with the name and in the directory specified by the +drive/path/file string. A ".IATTR" error is returned if register B specifies +a volume name. + + An error will be returned if the file or sub-directory cannot be created. +The error conditions in this case are the same as for the "find new entry" +function (function 42h) with the main error codes being ".FILEX", ".DIRX", +".SYSX", ".FILRO", ".FOPEN", ".DRFUL" and ".DKFUL". Like the "find new" func- +tion, if the "create new" flag (bit-7 of register B) is set then an existing +file will not be deleted and will always return a ".FILEX" error. + + If the attributes byte specifies a sub-directory then the hidden bit may +also be set to create a hidden sub-directory. For a file, the hidden, system +or read only bits may be set to create a file with the appropriate attribu- +tes. An invalid attributes bits will simply be ignored. A file will always be +created with the archive attribute bit set. + + A file will automatically be opened just as for the "open" function des- +cribed above, and a file handle returned in register B. The "open mode" para- +meter is interpreted in the same way as for the "open" function. A sub-direc- +tory will not be opened (because this is meaningless) so register B will be +returned as 0FFh which can never be a valid file handle. + + + +3.49 CLOSE FILE HANDLE (45H) + +Parameters: C = 45H (_CLOSE) + B = File handle +Results: A = Error + + + This function releases the specified file handle for re-use. If the asso- +ciated file has been written to then its directory entry will be updated with +a new date and time, the archive attributes bit will be set, and any buffered +data will be flushed to disk. Any subsequent attempt to use this file handle +will return an error. If there are any other copies of this file handle, +created by "duplicate file handle" or "fork", then these other copies may +still be used. + + + +3.50 ENSURE FILE HANDLE (46H) + +Parameters: C = 46H (_ENSURE) + B = File handle +Results: A = Error + + + If the file associated with the file handle has been written to then its +directory entry will be updated with a new date and time, the archive attri- +butes bit will be set, and any buffered data will be flushed to disk. The +file handle is not released and so it can still be used for accessing the +file, and the current file pointer setting will not be altered. + + + +3.51 DUPLICATE FILE HANDLE (47H) + +Parameters: C = 47H (_DUP) + B = File handle +Results: A = Error + B = New file handle + + + This function creates a copy of the specified file handle. The lowest +available file handle number will always be used and a ".NHAND" error retur- +ned if there are none available. The new file handle will refer to the same +file as the original and either one may be used. If the file pointer of one +handle is moved, the other one will also be moved. If either handle is closed +the other one may still be used. + + Note that because duplicate file handles created by this function are not +"separately opened", they do not count as separate file handles for the pur- +poses of generating ".FOPEN" errors. So for example a "DUP"ed file handle may +be renamed (function 53h) or have its attributes changed (function 55h) and +the effect will apply to both file handles. Note in particular that if one +copy of a "DUP"ed file handle is deleted (function 54h) then the file really +will be deleted and the other file handle, although still open, can no longer +be used safely. If it is used (other than being closed, ensured or deleted) +then an ".FDEL" error will be returned. + + + +3.52 READ FROM FILE HANDLE (48H) + +Parameters: C = 48H (_READ) + B = File handle + DE = Buffer address + HL = Number of bytes to read +Results: A = Error + HL = Number of bytes actually read + + + The specified number of bytes are read from the file at the current file +pointer position and copied to the buffer address specified in register DE. +The file pointer is then updated to the next sequential byte. A ".ACCV" error +will be returned if the file handle was opened with the "no read" access bit +set. + + The number of bytes read may be less than the number requested for various +reasons, and the number read will be returned in register HL if there is no +error. In general if less is read than requested then this should not be +treated as an error condition but another read should be done to read the +next portion, until a ".EOF" error is returned. An ".EOF" error will never be +returned for a partial read, only for a read which reads zero bytes. Reading +files in this way ensures that device file handles will work correctly (see +below). + + For disk files the number of bytes read will only be less than the number +requested if the end of the file is reached and in this case the next read +operation will read zero bytes and will return an ".EOF" error. When reading +from a device file handle (for example the standard file handles 0 to 4), the +behaviour depends on the particular device, and on whether it is being read +in ASCII or binary mode (see function 4Bh below). The "CON" device will be +described as an example because it is the most commonly used device, but +other devices behave similarly. + + When reading from the "CON" device in binary mode, characters will be read +from the keyboard, without any interpretation and without being echoed to the +screen or printer. The exact number of characters requested will always be +read and there is no end of file condition. Because of the lack of any end of +file indication, great care must be taken when reading from devices in binary +mode. + + A read function call to the "CON" device in ASCII mode (the default mode +and that which normally applies to the standard input channel), will only +read one line of input. The input line will be read from the keyboard with +the normal line editing facilities available to the user, and the character +typed will be echoed to the screen and to the printer if Ctrl-P is enabled. +Special control characters "Ctrl-P", "Ctrl-N", "Ctrl-S" and "Ctrl-C" will be +tested for and will be treated exactly as for the console status function +0Bh. + + When the user types a carriage return the line will be copied to the read +buffer, terminated with a CR-LF sequence and the read function will return +with an appropriate byte count. The next read will start another buffered +line input operation. If the number of bytes requested in the read was less +than the length of the line input then as many character as requested will be +returned, and the next read function call will return immediately with the +next portion of the line until it has all been read. + + If the user types a line which starts with a "Ctrl-Z" character then this +will be interpreted as indicating end of file. The line will be discarded and +the read function call will read zero bytes and return an ".EOF" error. A +subsequent read after this will be back to normal and will start another line +input. The end of file condition is thus not permanent. + + + +3.53 WRITE TO FILE HANDLE (49H) + +Parameters: C = 49H (_WRITE) + B = File handle + DE = Buffer address + HL = Number of bytes to write +Results: A = Error + HL = Number of bytes actually written + + + This function is very similar to the "read" function above (function 48h). +The number of bytes specified will be written to the current file pointer +position in the file, and the file pointer will be adjusted to point to just +after the last byte written. If the file was opened with the "no write" ac- +cess bit set then a ".ACCV" error will be returned, and if the file is read +only then a ".FILRO" error will be returned. + + If the write goes beyond the current end of file then the file will be +extended as necessary. If the file pointer is already beyond the end of the +file then disk space will be allocated to fill the gap and will not be ini- +tialized. If there is insufficient disk space then a ".DKFUL" error will be +returned and no data will be written, even if there was room for some of the +data. + + The number of bytes written can usually be ignored since it will either be +zero if an error is returned or it will be equal to the number requested if +the write was successful. It is very much more efficient to write files in a +few large blocks rather than many small ones, so programs should always try +to write in as large blocks as possible. + + This function sets a "modified" bit for the file handle which ensures that +when the file handle is closed or ensured, either explicitly or implicitly, +the directory entry will be updated with the new date, time and allocation +information. Also the archive bit will be set to indicate that this file has +been modified since it was last archived. + + Writing to device file handles is not a complicated as reading from them +because there are no end of file conditions or line input to worry about. +There are some differences between ASCII and binary mode when writing to the +"CON" device, in that a console status check is done in ASCII mode only. Also +printer echo if enabled will only be done in ASCII mode. + + + +3.54 MOVE FILE HANDLE POINTER (4AH) + +Parameters: C = 4AH (_SEEK) + B = File handle + A = Method code + DE:HL = Signed offset +Results: A = Error + DE:HL = New file pointer + + + The file pointer associated with the specified file handle will be altered +according to the method code and offset, and the new pointer value returned +in DE:HL. The method code specifies where the signed offset is relative to as +follows: + + + A=0 Relative to the beginning of the file + A=1 Relative to the current position + A=2 Relative to the end of the file. + + + Note that an offset of zero with an method code of 1 will simply return +the current pointer value, and with a method code of 2 will return the size +of the file. No end of file check is done so it is quite possible (and some- +times useful) to set the file pointer beyond the end of the file. If there +are any copies of this file handle created by the "duplicate file handle" +function (function 47h) or the "fork" function (function 60h) then their file +pointer will also be changed. + + The file pointer only has any real meaning on disk files since random +access is possible. On device files the file pointer is updated appropriately +when any read or write is done, and can be examined or altered by this func- +tion. However changing will have no effect and examining it is very unlikely +to be useful. + + + +3.55 I/O CONTROL FOR DEVICES (4BH) + +Parameters: C = 4BH (_IOCTL) + B = File handle + A = Sub-function code + 00H => get file handle status + 01H => set ASCII/binary mode + 02H => test input ready + 03H => test output ready + 04H => find screen size + DE = Other parameters +Results: A = Error + DE = Other results + + + This function allows various aspects of file handles to be examined and +altered. In particular it can be used to determine whether a file handle +refers to a disk file or a device. This is useful for programs which want to +behave differently for disk files and device I/O. + + This function is passed the file handle in register B and a sub-function +code in register A which specifies one of various different operations. Any +other parameters required by the particular sub-function are passed in regis- +ter DE and results are returned in register DE. If the sub-function code is +invalid then a ".ISBFN" error will be returned. + + If A=0 then the operation is "get file handle status". This returns a word +of flags which give various information about the file handle. The format of +this word is different for device file handles and disk file handles, and +bit-7 specifies which it is. The format of the word is as follows: + + +For devices: DE - b0 set => console input device + b1 set => console output device + b2..b4 reserved + b5 set => ASCII mode + clear=> binary mode + b6 set => end of file + b7 always set (=> device) + b8..b15 reserved + + +For disk files: DE - b0..b5 drive number (0=A: etc) + b6 set => end of file + b7 always clear (=> disk file) + b8..b15 reserved + + + Note that the end of file flag is the same for devices as for disk files. +For devices it will be set if the previous attempt to read from the device +produced a ".EOF" error and will be cleared by the next read. For disk files +it is worked out by comparing the file pointer with the file size. + + If A=1 then the operation is a "set ASCII/binary mode". This operation is +only allowed for device file handles. An ASCII/binary flag must be passed in +bit-5 of register E (exactly where it is returned by "get file handle +status"). This is set for ASCII mode and clear for binary mode. All other +bits of register DE are ignored. + + If A=2 or 3 then the operation is "test input ready" or "test output +ready" respectively. In both cases a flag is returned in register E which is +FFh if the file handle is ready for a character and 00h if not. The exact +meaning of "ready for a character" depends on the device. Disk file handles +are always ready for output, and are always ready for input unless the file +pointer is at the end of file. The "CON" device checks the keyboard status to +determine whether it is ready for input or not. + + If A=4 the the operation is "get screen size". This returns the logical +screen size for the file handle with the number of rows in register D and the +number of columns in register E. For devices with no screen size (such as +disk files) both D and E will be zero. Zero for either result should there- +fore be interpreted as "unlimited". For example this function is used by the +"DIR /W" command to decide how many files to print per line, and a value of +zero for register E is defaulted to 80. + + + +3.56 TEST FILE HANDLE (4CH) + +Parameters: C = 4CH (_HTEST) + B = File handle + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer +Results: A = Error + B = 00H => not the same file + FFH => same file + + + This rather specialist function is passed a file handle and either a dri- +ve/path/file string or a fileinfo block which identifies a file. It determi- +nes if the two files are actually the same file and returns a flag indicating +the result. Note that if the file handle is for a device rather than a disk +file then it will always return "B=00h" to indicate "not the same file". + + This function allows the "COPY" command to detect certain error conditions +such as copying file onto themselves and give the user informative error +messages. It may also be useful for other programs which need to do similar +tests. + + + +3.57 DELETE FILE OR SUBDIRECTORY (4DH) + +Parameters: C = 4DH (_DELETE) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer +Results: A = Error + + + This function deletes the object (file or sub-directory) specified by the +drive/path/file string or the fileinfo block. Global filename characters are +not allowed so only one file or sub-directory can be deleted with this func- +tion. A sub-directory can only be deleted if it is empty or an error +(".DIRNE") occurs if not. The "." and ".." entries in a sub-directory cannot +be deleted (".DOT" error) and neither can the root directory. A file cannot +be deleted if there is a file handle open to it (.FOPEN error) or if it is +read only (.FILRO error). + + If it is a file then any disk space which was allocated to it will be +freed. If the disk is an MSX-DOS 2 disk then enough information is retained +on the disk to allow the "UNDEL" utility program do undelete the file. This +information is only retained until the next disk space allocation (usually a +write to a file) is done on this disk. After making this function call, if a +fileinfo block was passed then it must not be used again (other than passing +it to a "find next entry" function) since the file to which it refers no +longer exists. + + If a device name such as "CON" is specified then no error will be returned +but the device will not actually be deleted. + + + +3.58 RENAME FILE OR SUBDIRECTORY (4EH) + +Parameters: C = 4EH (_RENAME) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + HL = New filename ASCIIZ string +Results: A = Error + + + This function renames the object (file or sub-directory) specified by the +drive/path/file string or the fileinfo block, with the new name in the string +pointed to by HL. The new filename string must not contain a drive letter or +directory path (".IFNM" error if it does). If a device name such as "CON" is +specified then no error will be returned but the device will not actually be +renamed. + + Global filename characters are not allowed in the drive/path/file string, +so only one object can be renamed by this function. However global filename +characters are allowed in the new filename passed in HL and where they occur +the existing filename character will be left unaltered. Checks are done to +avoid creating an illegal filename, for example a file called "XYZ" cannot be +renamed with a new filename string of "????A" because the new filename would +be "XYZ A" which is illegal. In this case a ".IFNM" error will be returned. + + If there is already an entry with the new filename then an error (".DUPF") +is returned to avoid creating duplicate filenames. The "." and ".." entries +in a sub-directory cannot be renamed (".IDOT" error) and neither can the root +directory (it has no name). A file cannot be renamed if there is a file +handle open to it (".FOPEN" error) although a read only file can be renamed. + + Note that if DE pointed to a fileinfo block, this is not updated with the +new name of the file. Therefore care must be taken in using the fileinfo +block after making this function call. + + + +3.59 MOVE FILE OR SUBDIRECTORY (4FH) + +Parameters: C = 4FH (_MOVE) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + HL = New path ASCIIZ string +Results: A = Error + + + This function moves the object (file or sub-directory) specified by the +drive/path/file string or the fileinfo block, to the directory specified by +the new path string pointed to by HL. There must not be a drive name in the +new path string. If a device name such as "CON" is specified then no error +will be returned but the device will not actually be moved. + + Global filename characters are not allowed in any of the strings so only +one object (file or sub-directory) can be moved by this function, although if +a sub-directory is moved, all its descendants will be moved with it. If there +is already an entry of the required name in the target directory then a +".DUPF" error is returned to prevent creating duplicate filenames. The "." +and ".." entries in a sub-directory cannot be moved (".DOT" error) and also a +directory cannot be moved into one of its own descendants (".DIRE" error) +since this would create an isolated loop in the filing system. A file cannot +be moved if there is a file handle open to it (".FOPEN" error). + + Note that if a fileinfo block is passed to this function, the internal +information in the fileinfo block is not updated to reflect the new location +of the file. This is necessary because otherwise the fileinfo block could not +be used for a subsequent "find next" function call. However it does mean that +the fileinfo block no longer refers to the moved file and so must not be used +for any operations on it such as "rename" or "open". + + + +3.60 GET/SET FILE ATTRIBUTES (50H) + +Parameters: C = 50H (_ATTR) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + A = 0 => get attributes + 1 => set attributes + L = New attributes byte (only if A=1) +Results: A = Error + L = Current attributes byte + + + This function is normally used to change the attributes of a file or sub- +directory. It can also be used to find out the current attributes but this is +more usually done with the "find first entry" function (function 40h). If A=0 +then the current attributes byte for the file or sub-directory will just be +returned in register L. + + If A=1 then the attributes byte will be set to the new value specified in +register L, and this new value will also be returned in register L. Only the +system, hidden, read only and archive bits may be altered for a file, and +only the hidden bit for a sub-directory. An ".IATTR" error will be returned +if an attempt is made to alter any other attribute bits. If a fileinfo block +is passed then the attributes byte in it will not be updated with the new +setting. + + Global filename characters are not allowed so only one object (file or +sub-directory) can have its attributes set by this function. The attributes +of the root directory cannot be changed because it does not have any. The +attributes of a file cannot be changed if there is a file handle open to it +(".FOPEN" error). The attributes of the "." and ".." directory entries howe- +ver can be changed. If a device name such as "CON" is specified then no error +will be returned but the device's attributes will not actually be changed +(since it does not have any). + + + +3.61 GET/SET FILE DATE AND TIME (51H) + +Parameters: C = 51H (_FTIME) + DE = Drive/path/file ASCIIZ string + or fileinfo block pointer + A = 0 => get date and time + 1 => set date and time + IX = New time value (only if A=1) + HL = New date value (only if A=1) +Results: A = Error + DE = Current file time value + HL = Current file date value + + + If A=1 then this function sets the date and time of last modification of +the file or sub-directory specified by the drive/path/file string or fileinfo +block. Global filename characters are not allowed in any part of the string +so only one file can have its date and time modified by this function. If a +device name such as "CON" is specified then no error will be returned but the +device's date and time will not actually be changed. + + The date and time format are exactly as contained in the directory entry +and fileinfo blocks (see the "Program Interface Specification"). No checks +are done for sensible dates or times, the values are simply stored. Note that +if a fileinfo block is passed then the date and time stored in it will not be +updated by this function. + + If A=0 then the current values are just returned. Note that although the +time value is passed in IX, it is returned in DE. The date and time of a file +cannot be altered (although it can be read) if there is a file handle open to +the file (".FOPEN" error). + + + +3.62 DELETE FILE HANDLE (52H) + +Parameters: C = 52H (_HDELETE) + B = File handle +Results: A = Error + + + This function deletes the file handle associated with the specified file +and closes the file handle. A file handle cannot be deleted if there are any +other separately opened file handles open to the same file (".FOPEN" error). +If there are any duplicates of the file handle (created by a "duplicate file +handle" or "fork" function), then these duplicates will be marked as invalid +and any attempt to use them will produce an ".HDEAD" error. + + The error conditions for this function are the same as for the "delete +file or sub-directory" function (function 4Dh). The file handle will always +be closed, even if there is an error condition such as ".FILRO" or ".FOPEN". + + + +3.63 RENAME FILE HANDLE (53H) + +Parameters: C = 53H (_HRENAME) + B = File handle + HL = New filename ASCIIZ string +Results: A = Error + + + This function renames the file associated with the specified file handle +with the new name in the string pointed to by HL. Apart from the fact that +the file is specified by a file handle rather than an ASCIIZ string or a +fileinfo block, this function is identical to the "rename file or subdirec- +tory" function (function 4Eh), and has the same error conditions. + + A file handle cannot be renamed if there are any other separately opened +file handles for this file (".FOPEN" error), although it can be renamed if +there are copies of this file handle, and in this case the copies will be +renamed. Renaming a file handle will not alter the file pointer but it will +do an implicit "ensure" operation. + + + +3.64 MOVE FILE HANDLE (54H) + +Parameters: C = 54H (_HMOVE) + B = File handle + HL = New path ASCIIZ string +Results: A = Error + + + This function moves the file associated with the specified file handle to +the directory specified by the new path string pointed to by HL. Apart from +the fact that the file is specified by a file handle rather than an ASCIIZ +string or a fileinfo block, this function is identical to the "move file or +subdirectory" function (function 4Fh), and has the same error conditions. + + A file handle cannot be moved if there are any other separately opened +file handles for this file (".FOPEN" error), although it can be moved if +there are copies of this file handle, and in this case the copies will also +be moved. Moving a file handle will not alter the file pointer but it will do +an implicit "ensure" operation. + + + +3.65 GET/SET FILE HANDLE ATTRIBUTES (55H) + +Parameters: C = 55H (_HATTR) + B = File handle + A = 0 => get attributes + 1 => set attributes + L = New attributes byte (only if A=1) +Results: A = Error + L = Current attributes byte + + + This function gets or sets the attributes byte of the file associated with +the specified file handle. Apart from the fact that the file is specified by +a file handle rather than an ASCIIZ string or a fileinfo block, this function +is identical to the "get/set file attributes" function (function 50h), and +has the same error conditions. + + A file handle cannot have its attributes changed (although they can be +read) if there are any other separately opened file handles for this file +(".FOPEN" error). The file pointer will not be altered but an implicit +"ensure" operation will be done. + + + +3.66 GET/SET FILE HANDLE DATE AND TIME (56H) + +Parameters: C = 56H (_HFTIME) + B = File handle + A = 0 => get date and time + 1 => set date and time + IX = New time value (only if A=1) + HL = New date value (only if A=1) +Results: A = Error + DE = Current file time value + HL = Current file date value + + + This function gets or sets the date and time of the file associated with +the specified file handle. Apart from the fact that the file is specified by +a file handle rather than an ASCIIZ string or a fileinfo block, this function +is identical to the "get/set file date and time" function (function 51h), and +has the same error conditions. + + A file handle cannot have its date and time changed (although they can be +read) if there are any other separately opened file handles for this file +(".FOPEN" error). The file pointer will not be altered but an implicit +"ensure" operation will be done. + + + +3.67 GET DISK TRANSFER ADDRESS (57H) + +Parameters: C = 57H (_GETDTA) +Results: DE = Current disk transfer address + + + This function returns the current disk transfer address. This address is +only used for the "traditional" CP/M style FCB functions and the absolute +sector read and write functions. + + + +3.68 GET VERIFY FLAG SETTING (58H) + +Parameters: C = 58H (_GETVFY) +Results: B = 00H => verify disabled + FFH => verify enabled + + + This function simply returns the current state of the verify flag which +can be set with MSX-DOS function 2Eh. + + + +3.69 GET CURRENT DIRECTORY (59H) + +Parameters: C = 59H (_GETCD) + B = Drive number (0=current, 1=A: etc) + DE = Pointer to 64 byte buffer +Results: A = Error + DE = Filled in with current path + + + This function simply gets an ASCIIZ string representing the current direc- +tory of the specified drive into the buffer pointed to by DE. The string will +not include a drive name or a leading or trailing "\" character, so the root +directory is represented by a null string. The drive will be accessed to make +sure that the current directory actually exists on the current disk, and if +not then the current directory will be set back to the root and a null string +returned. + + + +3.70 CHANGE CURRENT DIRECTORY (5AH) + +Parameters: C = 5AH (_CHDIR) + DE = Drive/path/file ASCIIZ string +Results: A = Error + + + The drive/path/file string must specify a directory rather than a file. +The current directory of the drive will be changed to be this directory. If +the specified directory does not exist then the current setting will be unal- +tered and a ".NODIR" error returned. + + + +3.71 PARSE PATHNAME (5BH) + +Parameters: C = 5BH (_PARSE) + B = Volume name flag (bit 4) + DE = ASCIIZ string for parsing +Results: A = Error + DE = Pointer to termination character + HL = Pointer to start of last item + B = Parse flags + C = Logical drive number (1=A: etc) + + + This function is purely a string manipulation function, it will not access +the disks at all and it will not modify the user's string at all. It is in- +tended to help transient programs in parsing command lines. + + The volume name flag (bit 4 of register B; it is in the same bit position +as the volume name bit in an attributes byte) determines whether the string +will be parsed as a "drive/path/file" string (if the bit is cleared) or a +"drive/volume" string (if the bit is set). + + The pointer returned in DE will point to the first character which is not +valid in a pathname string, and may be the null at the end of the string. See +the "Command Specification" for details of the syntax of pathname strings and +also for a list of valid characters. + + The pointer returned in HL will point to the first character of the last +item of a string (filename portion). For example, when a string "A:\XYZ\P.Q +/F" was passed, DE will point to the white space character before "/F" and HL +will point to "P". If the parsed string ends with a character "\" or is null +(apart from drive name), then there will be no "last item", thus HL and DE +will point to the same character. In this case, some special procedures will +be needed to all the programs which use this function. + + The drive number returned in register C is the logical drive specified in +the string. If the string did not start with a drive letter then register C +will contain the default drive number, since the default drive has been im- +plicitly specified. Register C will never be zero. + + The parse flags returned in register B indicate various useful things +about the string. For a volume name bits 1, 4, 5, 6 and 7 will always be +clear. For a filename, bits 3 to 7 relate to the last item on the string (the +"filename" component). The bit assignments are as follows: + + +b0 - set if any characters parsed other than drive name +b1 - set if any directory path specified +b2 - set if drive name specified +b3 - set if main filename specified in last item +b4 - set if filename extension specified in last item +b5 - set if last item is ambiguous +b6 - set if last item is "." or ".." +b7 - set if last item is ".." + + + +3.72 PARSE FILENAME (5CH) + +Parameters: C = 5CH (_PFILE) + DE = ASCIIZ string for parsing + HL = Pointer to 11 byte buffer +Results: A = Error (always zero) + DE = Pointer to termination character + HL = Preserved, buffer filled in + B = Parse flags + + + This function is purely a string manipulation function, it will not access +disks at all and will not modify the string at all. It is intended mainly to +help transient programs in printing out filenames in a formatted way. The +ASCIIZ string will be parsed as a single filename item, and the filename will +be stored in the user's 11 byte buffer in expanded form, with both the file- +name and the extension padded out with spaces. + + The parse flags returned in register B are identical to those for the +"parse pathname" function above (function 5Bh), except that bits 0, 1 and 2 +will always be clear. The user's buffer will always be filled in, even if +there is no valid filename in the string, in which case the buffer will be +filled with spaces. "*" characters will be expanded to the appropriate number +of "?"s. If either the filename or the filename extension is too long then +the excess characters will be ignored. + + The pointer returned in register DE will point to the first character in +the string which was not part of the filename, which may be the null at the +end of the string. This character will never be a valid filename character +(see the "Command Specification" for details of valid filename characters). + + + +3.73 CHECK CHARACTER (5DH) + +Parameters: C = 5DH (_CHKCHR) + D = Character flags + E = Character to be checked +Results: A = 0 (never returns an error) + D = Updated character flags + E = Checked (upper cased) character + + + This function allow language independent upper casing of characters and +also helps with handling 16-bit characters and manipulation of filenames. The +bit assignments in the character flags are as follows: + + + b0 - set to suppress upper casing + b1 - set if first byte of 16-bit character + b2 - set if second byte of 16-bit character + b3 - set => volume name (rather than filename) + b4 - set => not a valid file/volume name character +b5...b7 - reserved (always clear) + + + Bit 0 is used to control upper casing. If it is clear then the character +will be upper cased according to the language setting of the machine. If this +bit is set then the returned character will always be the same as the charac- +ter passed. + + The two 16-bit character flags (bits 1 and 2) can both be clear when the +first character of a string is checked and the settings returned can be pas- +sed straight back to this function for each subsequent character. Care must +be taken with these flags when moving backwards through strings which may +contain 16-bit characters. + + Bit 4 is set on return if the character is one of the set of filename or +volume name terminator characters. Bit 3 is simply used to determine whether +to test for filename or volume name characters since the sets are different. +16-bit characters (either byte) are never considered as volume or filename +terminators. + + + +3.74 GET WHOLE PATH STRING (5EH) + +Parameters: C = 5EH (_WPATH) + DE = Pointer to 64 byte buffer +Results: A = Error + DE = Filled in with whole path string + HL = Pointer to start of last item + + + This function simply copies an ASCIIZ path string from an internal buffer +into the user's buffer. The string represents the whole path and filename, +from the root directory, of a file or sub-directory located by a previous +"find first entry" or "find new entry" function. The returned string will not +include a drive, or an initial "\" character. Register HL will point at the +first character of the last item on the string, exactly as for the "parse +path" function (function 5Bh). + + If a "find first entry" or "find new entry" function call is done with DE +pointing to an ASCIIZ string then a subsequent "get whole path" function call +will return a string representing the sub-directory or file corresponding to +the fileinfo block returned by the "find" function. If this is a sub-direc- +tory then the fileinfo block may be passed back in register DE to another +"find first entry" function call, which will locate a file within this sub- +directory. In this case the newly located file will be added onto the already +existing whole path string internally, and so a subsequent "get whole path +string" function call will return a correct whole path string for the located +file. + + Great care must be taken in using this function because the internal whole +path string is modified by many of the function calls, and in many cases can +be invalid. The "get whole path" function call should be done immediately +after the "find first entry" or "find new entry" function to which it +relates. + + + +3.75 FLUSH DISK BUFFERS (5FH) + +Parameters: C = 5FH (_FLUSH) + B = Drive number (0=current, FFH=all) + D = 00H => Flush only + = FFH => Flush and invalidate +Results: A = Error + + + This function flushes any dirty disk buffers for the specified drive, or +for all drives if B=FFh. If register D is FFh then all buffers for that drive +will also be invalidated. + + + +3.76 FORK TO CHILD PROCESS (60H) + +Parameters: C = 60H (_FORK) +Results: A = Error + B = Process id of parent process + + + This function informs the system that a child process is about to be star- +ted. Typically this is a new program or sub-command being executed. For exam- +ple COMMAND2.COM does a "fork" function call before executing any command or +transient program. + + A new set of file handles is created, and any current file handles which +were opened with the "inheritable" access mode bit set (see the "open file +handle" function - function 43h), are copied into the new set of file hand- +les. Any file handles which were opened with the "inheritable" bit clear will +not be copied and so will not be available to the child process. The standard +file handles (00h...05h) are inheritable and so these will be copied. + + A new process id is allocated for the child process and the process id. of +the parent process is returned so that a later "join" function call can +switch back to the parent process. A ".NORAM" error can be produced by this +function if there is insufficient memory to duplicate the file handles. + + Because the child process now has a copy of the previous file handles +rather than the originals, if one of them is closed then the original will +remain open. So for example if the child process closes the standard output +file handle (file handle number 1) an re-opens it to a new file, then when a +"join" function is done to return to the parent process the original standard +output channel will still be there. + + + +3.77 REJOIN PARENT PROCESS (61H) + +Parameters: C = 61H (_JOIN) + B = Process id of parent, or zero +Results: A = Error + B = Primary error code from child + C = Secondary error code from child + + + This function switches back to the specified parent process and returns +the error code which the child process terminated with in register B, and a +secondary error code from the child in register C. Although the relationship +between parent and child processes is strictly one-to-one, this function can +jump back several levels by giving it a suitable process id. A ".IPROC" error +will be returned if the process id is invalid. + + The child process's set of file handles are automatically closed and the +parent process's set of file handles becomes active again. Also any user RAM +segments which the child process had allocated will be freed. + + If the process id passed to this function is zero then a partial system +re-initialisatin is done. All file handles are closed and the standard input +and output handles re-opened and all user segments are freed. This should not +normally be done by a user program if it intends to return to the command +interpreter since the command interpreter will not be in a consistent state +after this. + + This function takes great care that the freeing of memory and adjusting of +process id is done before actually closing any file handles and thus before +accessing the disk. This ensures that if a disk error occurs and is aborted, +the join operation will have been done successfully. However if a "join 0" +produces a disk error which is aborted, then the re-initialization of default +file handles will not have been done. In this case another "join 0" function +call should be done and this will not attempt access disk (because all the +files have been closed) and so will be successful. + + Note that if this function call is made via 0F37Dh then registers B and C +will not return the error codes. This is because program termination and +abort handling must be done by the application program. The error code will +have been passed to the abort vector and code there must remember the error +code if it needs to. See the "terminate with error code" function (function +62h) for the meaning of the primary and secondary error code. + + + +3.78 TERMINATE WITH ERROR CODE (62H) + +Parameters: C = 62H (_TERM) + B = Error code for termination +Results: Does not return + + + This function terminates the program with the specified error code, which +may be zero indicating no error. This function call will never return to the +caller (unless a user abort routine executes forces it to - see function +63h). The operation of this function is different depending on whether it was +called from the MSX-DOS environment via 00005h or from the disk BASIC envi- +ronment via 0F37Dh. + + If called via 00005h then if a user abort routine has been defined by +function 63h it will be called with the specified error code (and a zero +secondary error code). Assuming that this routine returns, or if there was no +user abort routine defined, then control will be passed back to whatever +loaded the transient program via a jump at location 00000h. This will almost +always be the command interpreter, but in some cases it may be another tran- +sient program. The error code will be remembered by the system and the next +"join" function (function 61h) which is done will return this error code. The +command interpreter will print an error message for any code in the range +20h...FFh, but will not print a message for errors below this. + + If this function is called from the disk BASIC environment via 0F37Dh then +control will be passed to the abort vector at location "BREAKVECT". In this +environment there is no separately defined user abort routine and the error +code must be remembered by the code at "BREAKVECT" because "join" will not +return the error code. + + + +3.79 DEFINE ABORT EXIT ROUTINE (63H) + +Parameters: C = 63H (_DEFAB) + DE = Address of abort exit routine + 0000H to un-define routine +Results: A = 0 (never generates errors) + + + This function is only available when called via location 00005h in the +MSX-DOS environment. It cannot be called at location 0F37Dh from the disk +BASIC environment. + + If register DE is zero then a previously defined abort routine will be +undefined, otherwise a new one will be defined. The abort routine will be +called by the system whenever the transient program is about to terminate for +any reason other than a direct jump to location 0000h. Programs written for +MSX-DOS 2 should exit with a "terminate with error code" function call (func- +tion 061h) rather than a jump to location 0000h. + + The user abort routine will be entered with the user stack active, with +IX, IY and the alternate register set as it was when the function call was +made and with the whole TPA paged in. The termination error code will be +passed to the routine in register A with a secondary error code in register B +and if the routine executes a "RET" then the values returned in registers A +and B will be stored as the error codes to be returned by the "join" func- +tion, and normally printed out by the command interpreter. Alternatively the +routine may jumpto some warm start code in the transient program rather than +returning. The system will be in a perfectly stable state able to accept any +function calls. + + The primary error code passed to the routine in register A will be the +code which the program itself passed to the "terminate with error code" func- +tion (which may be zero) if this is the reason for the termination. The rou- +tine will also be called if a Ctrl-C or Ctrl-STOP is detected (".CTRLC" or +".STOP" error), if a disk error is aborted (".ABORT" error), or if an error +occurred on one of the standard input or output channels being accessed +through MSX-DOS function calls 01h...0Bh (".INERR" or ".OUTERR"). + + The errors ".ABORT", ".INERR" and ".OUTERR" are generated by the system as +a result of some other error. For example a ".ABORT" can result from a +".NRDY" error, or a ".INERR" can result from a ".EOF" error. In these cases +the original error code (".NRDY" or ".EOF") is passed to the abort routine in +register B as the secondary error code. For all other errors there is no +secondary error code and register B will be zero. + + If the abort routine executes "POP HL : RET" (or equivalent) rather than a +simple return, then control will pass to the instruction immediately follo- +wing the MSX-DOS call or BIOS call in which the error occurred. This may be +useful in conjunction with a disk error handler routine (see function 64h) to +allow an option to abort the current MSX-DOS call when a disk error occurs. + + + +3.80 DEFINE DISK ERROR HANDLER ROUTINE (64H) + +Parameters: C = 64H (_DEFER) + DE = Address of disk error routine + 0000H to un-define routine +Results: A = 0 (never generates errors) + + + This function specifies the address of a user routine which will be called +if a disk error occurs. The routine will be entered with the full TPA paged +in, but with the system stack in page-3 active and none of the registers will +be preserved from when the MSX-DOS function call was made. + + The error routine can make MSX-DOS calls but must be very careful to avoid +recursion. The list of function calls in section 2 of this document indicates +which function calls can be safely made from a user error routine. This rou- +tine is called with the redirection status being temporarily invalidated in +case the standard I/O channels have been redirected. See the "get/set +redirection state" function (function 70h) for details of this. + + The specification of parameters and results for the routine itself is as +below. All registers including IX, IY and the alternate register set may be +destroyed but the paging and stack must be preserved. The routine must return +to the system, it must not jump away to continue the transient program. If it +wants to do this then it should return A=1 ("abort") and a user abort routine +will then get control and this may do whatever it wants to. + + + Parameters: A = Error code which caused error + B = Physical drive + C = b0 - set if writing + b1 - set if ignore not recommended + b2 - set if auto-abort suggested + b3 - set if sector number is valid + DE = Sector number (if b3 of C is set) + + Results: A = 0 => Call system error routine + 1 => Abort + 2 => Retry + 3 => Ignore + + + +3.81 GET PREVIOUS ERROR CODE (65H) + +Parameters: C = 65H (_ERROR) +Results: A = 0 + B = Error code from previous function + + + + This function allows a user program to find out the error code which cau- +sed the previous MSX-DOS function call to fail. It is intended for use with +the old CP/M compatible functions which do not return an error code. For +example if a "create file FCB" function returns A=0FFh thee could be many +reasons for the failure and doing this function call will return the +appropriate on, for example ".DRFUL" or ".SYSX". + + + +3.82 EXPLAIN ERROR CODE (66H) + +Parameters: C = 66H (_EXPLAIN) + B = Error code to be explained + DE = Pointer to 64 byte string buffer +Results: A = 0 + B = 0 or unchanged + DE = Filled in with error message + + + This function allows a user program to get an ASCIIZ explanation string +for a particular error code returned by any of the MSX-DOS functions. If an +error comes from one of the old functions then "get previous error code" must +be called first to get the real error code and then this function can be +called to get an explanation string. + + The "Program Interface Specification" contains a list of all the currently +defined error codes and the messages for them. Foreign language versions of +the system will of course have different messages. If the error code does +have a built in explanation string then this string will be returned and +register B will be set to zero. If there is no explanation string then a +string of the form: "System error 194" or "User error 45" will be returned, +and register B will be unchanged. (System errors are those in the range +40h...FFh and user errors are 00h...3Fh.) + + + +3.83 FORMAT A DISK (67H) + +Parameters: C = 67H (_FORMAT) + B = Drive number (0=>current, 1=>A:) + A = 00H => return choice string + 01H...09H => format this choice + 0AH...FDH => illegal + FEH, FFH => new boot sector + HL = Pointer to buffer (if A=1...9) + DE = Size of buffer (if A=1...9) +Results: A = Error + B = Slot of choice string (only if A=0 on + entry) + HL = Address of choice string (only if A=0 + on entry) + + + This function is used to format disks and is really only provided for the +"FORMAT" command although other programs may use it (with care) if they find +it useful. It has three different options which are selected by the code +passed in register A. + + If A=0 then registers B and HL return the slot number and address respec- +tively of an ASCIIZ string which specifies the choice of formats which is +available. A ".IFORM" error will be returned if this disk cannot be formatted +(for example the RAM disk). Normally the string will be read using the +"RDSLT" routine and displayed on the screen followed by a "? " prompt. The +user then specifies a choice "1"..."9" and this choice is passed back to the +"format" function, after a suitable warning prompt, to actually format the +disk. If A=0, in some cases zero is returned in HL. This means that there is +only one kind of the format and no prompt is required. There is no way of +knowing what disk format a particular choice refers to since this is depen- +dant on the particular disk driver. + + If A=01h...09h then this is interpreted as a format choice and a disk will +be formatted in the specified drive with no further prompting. Register HL +and DE must specify a buffer area to be used by the disk driver. There is no +way of knowing how big this buffer should be so it is best to make it as big +as possible. If the buffer crosses page boundaries then this function will +select the largest portion of it which is in one page for passing to the disk +driver. Many disk drivers do not use this buffer at all. + + If A=FFh then the disk will not actually be formatted, but it will be +given a new boot sector to make the disk a true MSX-DOS 2 disk. This is +designed to update old MSX-DOS 1.0 disks to have a volume id and thus allow +the full disk checking and undeletion which MSX-DOS 2 allows. The case A=FEh +is the same as A=FFh except that only the disk parameters are updated correc- +tly and the volume id does not overwrite the boot program. Also there are +some MSX-DOS 1.0 implementations which put an incorrect boot sector on the +disk and these disks cannot be used by MSX-DOS 2 until they have been correc- +ted by this function. + + The "new boot sector" function is mainly intended for the "FIXDISK" utili- +ty program, but may be used by other programs if they find it useful. If it +is used then a "get format choice" function call (A=0) should be done first +and if this returns an error (typically ".IFORM") then the operation should +be aborted because this is a drive which does not like to be formatted and +the disk could be damaged by this function. + + + +3.84 CREATE OR DESTROY RAMDISK (68H) + +Parameters: C = 68H (_RAMD) + B = 00H => destroy RAM disk + 1...FEH => create new RAM disk + FFH => return RAM disk size +Results: A = Error + B = RAM disk size + + + If register B=0FFh then this routine just returns the number of 16k RAM +segments which are allocated to the RAM disk currently. A value of zero indi- +cates that there is no RAM disk currently defined. If B=0 then the current +RAM disk will be destroyed, loosing all data which it contained and no error +will be returned if there was no RAM disk. + + Otherwise, if B is in the range 01h...FEh then this function will attempt +to create a new RAM disk using the number of 16k segments specified in regis- +ter B. An error will be returned if there is already a RAM disk (".RAMDX") or +if there is not even one segment free (".NORAM"). If there are insufficient +free RAM segments to make a RAM disk of the specified size then the largest +one possible will be created. No error is returned in this case. + + In all cases the size of the RAM disk will be returned in register B as a +number of segments. Note that some of the RAM is used for the file allocation +tables and the root directory so the size of the RAM disk as indicated by +"DIR" or "CHKDSK" will be somewhat smaller than the total amount of RAM used. +The RAM will always be assigned the drive letter "H:" regardless of the num- +ber of drives in the system. + + + +3.85 ALLOCATE SECTOR BUFFERS (69H) + +Parameters: C = 69H (_BUFFER) + B = 0 => return number of buffers + else number of buffers required +Results: A = Error + B = Current number of buffers + + + If B=0 then this function just returns the number of sector buffers which +are currently allocated. If B<>0 then this function will attempt to use this +number of sector buffers (must always be at least 2). If it cannot allocate +as many as requested then it will allocate as many as possible and return the +number in register B but will not return an error. The number of sector buf- +fers can be reduced as well as increased. + + The sector buffers are allocated in a 16k RAM segment outside the normal +64k so the number of buffers does not detract from the size of the TPA. Howe- +ver the number of buffers does affect efficiency since with more buffers +allow more FAT and directory sectors to be kept resident. The maximum number +of buffers will be about 20. + + + +3.86 LOGICAL DRIVE ASSIGNMENT (6AH) + +Parameters: C = 6AH (_ASSIGN) + B = Logical drive number (1=A: etc) + D = Physical drive number (1=A: etc) +Results: A = Error + D = Physical drive number (1=A: etc) + + + This function controls the logical to physical drive assignment facility. +It is primarily intended for the "ASSIGN" command although user programs may +want to use it to translate logical drive numbers to physical drive numbers. + + If both B and D are non-zero then a new assignment will be set up. If +register B is non-zero and register D is zero then any assignment for the +logical drive specified by B will be cancelled. If both register B and D are +zero then all assignments will be cancelled. If register B is non-zero and +register D is FFh then the current assignment for the logical drive specified +by register B will simply be returned in register D. + + All drives used in the various function calls, including drive names in +strings and drive numbers as parameters to function calls, are logical dri- +ves. However the drive number passed to disk error routines is a physical +drive so if "ASSIGN" has been used these may be different from the correspon- +ding logical drive. + + + +3.87 GET ENVIRONMENT ITEM (6BH) + +Parameters: C = 6BH (_GENV) + HL = ASCIIZ name string + DE = Pointer to buffer for value + B = Size of buffer +Results: A = Error + DE = Preserved, buffer filled in if A=0 + + + This function gets the current value of the environment item whose name is +passed in register HL. A ".IENV" error is returned if the name string is +invalid. If there is no environment item of that name then a null string will +be returned in the buffer. If there is an item of that name then its value +string will be copied to the buffer. If the buffer is too small then the +value string will be truncated with no terminating null and a ".ELONG" error +will be returned. A buffer 255 bytes will always be large enough since value +strings cannot be longer than this (including the terminating null). + + + +3.88 SET ENVIRONMENT ITEM (6CH) + +Parameters: C = 6CH (_SENV) + HL = ASCIIZ name string + DE = ASCIIZ value string +Results: A = Error + + + This function sets a new environment item. If the name string is invalid +then a ".IENV" error is returned, otherwise the value string is checked and a +".ELONG" error returned if it is longer than 255 characters, or a ".NORAM" +error if there is insufficient memory to store the new item. If all is well +then any old item of this name is deleted and the new item is added to the +beginning of the environment list. If the value string is null then the envi- +ronment item will be removed. + + + +3.89 FIND ENVIRONMENT ITEM (6DH) + +Parameters: C = 6DH (_FENV) + DE = Environment item number + HL = Pointer to buffer for name string +Results: A = Error + HL = Preserved, buffer filled in + + + This function is used to find out what environment items are currently +set. The item number in register DE identifies which item in the list is to +be found (the first item corresponds to DE=1). If there is an item number + then the name string of this item will be copied into the buffer pointed +to by HL. If the buffer is too small then the name will be truncated with no +terminating null, and a ".ELONG" error returned. A 255 byte buffer will never +be too small. If there is no item number then a null string will be +returned, since an item can never have a null name string. + + + +3.90 GET/SET DISK CHECK STATUS (6EH) + +Parameters: C = 6EH (_DSKCHK) + A = 00H => get disk check status + 01H => set disk check status + B = 00H => enable (only if A=01H) + FFH => disable (only if A=01H) +Results: A = Error + B = Current disk check setting + + + If A=0 then the current value of the disk check variable is returned in +register B. If A=01h then the variable is set to the value in register B. A +value of 00h means that disk checking is enabled and a non-zero means that it +is disabled. The default state is enabled. + + The disk check variable controls whether the system will re-check the boot +sector of a disk to see whether it has changed, each time a file handle, +fileinfo block or FCB is accessed. If it is enabled then it will be impos- +sible to accidentally access the wrong disk by changing a disk in the middle +of an operation, otherwise this will be possible and may result in a corrup- +ted disk. Depending on the type of disk interface, there may be some additio- +nal overhead in having this feature enabled although with many types of disk +(those with explicit disk change detection hardware) it will make no diffe- +rence and the additional security is well worth having. + + + +3.91 GET MSX-DOS VERSION NUMBER (6FH) + +Parameters: C = 6FH (_DOSVER) +Results: A = Error (always zero) + BC = MSX-DOS kernel version + DE = MSXDOS2.SYS version number + + + This function allows a program to determine which version of MSX-DOS it is +running under. Two version numbers are returned, one in BC for the MSX-DOS +kernel in ROM and the other is DE for the MSXDOS2.SYS system file. Both of +these version numbers are BCD values with the major version number in the +high byte and the two digit version number in the low byte. For example if +there were a version 2.34 of the system, it would be represented as 0234h. + + For compatibility with MSX-DOS 1.0, the following procedure should always +be followed in using this function. Firstly if there is any error (A<>0) then +it is not MSX-DOS at all. Next look at register B. If this is less than 2 +then the system is earlier than 2.00 and registers C and DE are undefined. If +register B is 2 or greater then registers BC and DE can be used as described +above. In general the version number which should be checked (after this +procedure) is the MSXDOS2.SYS version in register DE. + + + +3.92 GET/SET REDIRECTION STATE (70H) + +Parameters: C = 70H (_REDIR) + A = 00H => get redirection state + 01H => set redirection state + B = New state. b0 - standard input + b1 - standard output +Results: A = Error + B = Redirection state before command + b0 set => input is redirected + b1 set => output is redirected + + + This function is provided primarily for disk error routines and other +character I/O which must always go to the console regardless of any redirec- +tion. When the CP/M character functions (functions 01h...0Bh) are used, they +normally refer to the console. However if the standard input or output file +handles (file handles 0 and 1) have been closed and reopened to a disk file, +then the CP/M character functions will also go to the disk file. However +certain output such as disk error output must always go to the screen +regardless. + + This function allows any such redirection to be temporarily cancelled by +calling this function with A=1 and B=0. This will ensure that any subsequent +CP/M console I/O will go to the console, and will also return the previous +setting so that this can be restored afterwards. The system is a somewhat +unstable state when the redirection state has been altered like this and +there are many function calls which will reset the redirection to its real +state over-riding this function. In general any function call which manipu- +lates file handles, such as "open", "close", "duplicate" and so on, will +reset the redirection state. The effect of this function is therefore purely +temporary. diff --git a/docs/DOS2-PIS.TXT b/docs/DOS2-PIS.TXT new file mode 100644 index 00000000..f60c95e8 --- /dev/null +++ b/docs/DOS2-PIS.TXT @@ -0,0 +1,2063 @@ +MSX-DOS 2 PROGRAM INTERFACE SPECIFICATION + +By ASCII corporation Japan + +Supplied with COMPASS v1.0 by COMPJOETANIA + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + This document describes the interface to transient programs provided by +MSX-DOS version 2.xx. + + + CONTENTS + +1. Introduction + +2. Transient Program Environment + + 2.1 Entry from MSX-DOS + 2.2 Return to MSX-DOS + 2.3 Page Zero Usage + 2.4 BIOS Jump Table + 2.5 RAM Paging + +3. MSX-DOS calls + + 3.1 Calling Conventions + 3.2 Devices and Character I/O + 3.3 File Handles + 3.4 File Info Blocks + 3.5 Environment Strings + 3.6 File Control Blocks + +4. Screen Control Codes + +5. Mapper Support Routines + + 5.1 Mapper Initialization + 5.2 Mapper Variables and Routines + 5.3 Using Mapper Routines + 5.4 Allocating and Freeing Segments + 5.5 Inter-Segment Read and Write + 5.6 Inter-Segment Calls + 5.7 Direct paging routines + +6. Errors + + 6.1 Disk Errors + 6.2 MSX-DOS Function Errors + 6.3 Program Termination Errors + 6.4 Command Errors + + + + +1. INTRODUCTION +================= + + + This manual describes the environment which MSX-DOS 2 provides for trans- +ient programs on MSX 2 computers. It is intended as a guide for writing new +programs to run under MSX-DOS 2 and also to assist in converting existing +CP/M and MSX-DOS 1 programs to take advantage of the advanced features. + + + MSX-DOS 2 provides many enhancements to the standard CP/M and MSX-DOS 1 +environment, but is largely compatible with existing programs. The main fea- +tures include: + + + MS-DOS style tree structured directories + File handles + Environment Strings + Proper error handling + + + Many extra DOS calls are implemented, and these are accessed via the DOS +entry jump at address 5 (the 'BDOS' jump in CP/M). The descriptions of the +individual functions can be found in the MSX-DOS 2 Function Specification. + + + Throughout this manual, the term MSX-DOS is used generally to refer to +MSX-DOS 2 unless otherwise stated. + + + + +2. TRANSIENT PROGRAM ENVIRONMENT +================================== + + + This chapter describes the environment in which transient programs are +executed under MSX-DOS, including entry and exit to the program and memory +usage. + + +2.1 ENTRY FROM MSX-DOS + + + A transient program will be loaded at address 0100h, the start of the TPA +(Transient Program Area), and is CALLed by MSX-DOS with the stack pointer set +to the end of the TPA. If the stack pointer points to that location, as much +RAM as possible can be used as the stack. If it is undesirable, then the +transient program must set up its own stack in the TPA. + + + The contents of the Z-80 registers when a transient program is entered are +undefined. The first 256 bytes of RAM starting at the address 0 will have +been set up with various parameters and code as described in section 2.3. + + + Interrupts are enabled when a transient program is entered and should +generally be left enabled. MSX-DOS function calls will generally reenable +interrupts if the transient program has disabled them. + + +2.2 RETURN TO MSX-DOS + + + A transient program can terminate itself in any of the following four ways: + + + 1. Returning, with the original stack pointer. + 2. Jump to location 0000h. + 3. MSX-DOS "Program Terminate" function call. + 4. MSX-DOS "Terminate with Error Code" function call. + + + The first two of these methods are identical as far as MSX-DOS is concer- +ned, and are compatible with CP/M and MSX-DOS 1. The third method is also +compatible with CP/M and MSX-DOS 1 and is equivalent to doing a "Terminate +with Error Code" function call with an error code of zero. + + + The new "Terminate with Error Code" function allows the program to return +an error code to MSX-DOS, the first three terminating methods always retur- +ning an error code of zero (no error). All specially written programs and +converted CP/M programs should use this new function, even for returning an +error code of zero. + + + Various other events outside the control of a program can cause it to +terminate. For example, typing "Ctrl-C" or "CTRL-STOP" at the keyboard, by +the user selecting "Abort" as the response to an "Abort/Retry/Ignore" disk +error message or by an error on the standard I/O channels. In these cases an +appropriate error code will be returned to MSX-DOS. + + + A transient program can define an "abort routine". This will be called to +treat the abnormal termination of the program appropriately when the program +terminates by a "Program Terminate" or "Terminate with error code" function, +or after an abort error (see above). How to define this routine and for what +may be used is described in the MSX-DOS Function Specification. + + +2.3 PAGE ZERO USAGE + + + On entry, various parameter areas are set up for the transient program in +the first 256 bytes of RAM. The layout of this area is as below and is compa- +tible with MSX-DOS 1 and with CP/M apart from the area used for MSX slot +switching calls. + + + +-------+-----+------+------+------+------+------+------+ + 0000h | Reboot entry | Reserved | MSX-DOS entry | + +------+------+------+------+------+------+------+------+ + 0008h | RST 08h not used | RDSLT routine entry point | + +------+------+------+------+------+------+------+------+ + 0010h | RST 10h not used | WRSLT routine entry point | + +------+------+------+------+------+------+------+------+ + 0018h | RST 18h not used | CALSLT routine entry point | + +------+------+------+------+------+------+------+------+ + 0020h | RST 20h not use | ENASLT routine entry point | + +------+------+------+------+------+------+------+------+ + 0028h | RST 28h not used | not used | + +------+------+------+------+------+------+------+------+ + 0030h | CALLF routine entry point | not used | + +------+------+------+------+------+------+------+------+ + 0038h | Interrupt vector | | + +------+------+------+ + + 0040h | | + + + + 0048h | Used by secondary slot switching code | + + + + 0050h | | + + +------+------+------+------+ + 0058h | | | + +------+------+------+------+ + + 0060h | Unopened CP/M FCB for first parameter | + + +------+------+------+------+ + 0068h | | | + +------+------+------+------+ + + 0070h | Unopened CP/M FCB for second parameter | + + +------+------+------+------+ + 0078h | | Space for end of FCB | + +------+------+------+------+------+------+------+------+ + 0080h | | + . . . + . . Default Disk transfer address. Initialized to . + . . original command line parameters. . + . . . + 00F8h | | + +------+------+------+------+------+------+------+------+ + + + At address 0000h is a jump instruction which can be used for terminating +the transient program. The destination of this jump can also be used to +locate the BIOS jump vector (see section 2.4). The low byte of this jump +address will always be 03h for CP/M compatibility. + + + The two reserved bytes at addresses 0003h and 0004h are the IOBYTE and +current drive/user in CP/M. Although MSX-DOS keeps the current drive byte up +to date for CP/M compatibility, new programs are not recommended to use this +but instead to use the "Get current drive" MSX-DOS function call. The user +number and IOBYTE are not supported since I/O redirection is not done in the +same way as CP/M and there is no concept of user numbers. At address 0005h is +a jump instruction to the start of the resident part of MSX-DOS which is used +for making MSX-DOS calls. In addition the address of this jump defines the +top of the TPA which the program may use. The size of the TPA depends on what +cartridges are used on the MSX machine and the number of them, but is typi- +cally 53K. The low byte of the destination of this jump will always be 06h +for CP/M compatibility, and the six bytes immediately preceding it will con- +tain the CP/M version number and a serial number. + + + Four bytes are reserved for the user at each Z80 restart location +(0008h-0028h), which is sufficient for a jump. The bytes between the restart +locations however are used for the entry points to various MSX slot switching +routines. + + + The whole area from 0038h to 005Bh is used for MSX interrupt and secondary +slot switching code, and must not be modified. Note that most CP/M debuggers +(such as ZSID and DDT) use address 38h as a breakpoint entry, and these pro- +grams will have to be modified to use a different restart. RST 28h is +recommended. + + + The two FCBs set up at addresses 005Ch and 006Ch are valid unopened FCBs +containing the first two command line parameters interpreted as filenames. If +both filenames are to be used then the second one must be copied to a sepa- +rate FCB elsewhere in memory because it will be overwritten when the first +one is opened. See section 3.6 for the format of FCBs. + + + The whole of the command line, with the initial command removed, is stored +in the default disk transfer area at address 0080h, with a length byte first +and a terminating null (neither the null nor the length byte are included in +the length). This string will have been upper-cased (when the environment +string UPPER is ON) and will include any leading spaces typed to ensure CP/M +compatibility. + + + New programs for MSX-DOS should not use the CP/M FCBs, since other MSX-DOS +calls are available which are generally easier to use and which allow pro- +grams to access directories and handle path names (see section 3 for details +of these facilities). + + + Improved methods are also available for accessing the command line. An +environment string called "PARAMETERS" is set up which contains the command +line not upper-cased. Another environment string called "PROGRAM" allows +programs to find out the drive, directory and filename from which they were +loaded. See section 3.5 for details of these environment strings and of envi- +ronment strings in general. + + +2.4 BIOS JUMP TABLE + + + The jump at address 0000h will always jump to an address whose low byte is +03h. At this address will be another jump instruction which is the second +entry in a seventeen entry jump table. This corresponds exactly to the BIOS +jump table in CP/M 2.2. + + The first eight entries in the table are for rebooting and for character +I/O. These routines are implemented with the same specification as CP/M. The +remaining jumps are low level disk related functions in CP/M and have no +equivalent in MSX-DOS since its filing system is totally different. These +routines simply return without doing anything apart from corrupting the main +registers and returning an error where possible. + + + MSX-DOS switches to an internal stack while executing a BIOS call and so +only a small amount of space (8 bytes) is required on the user's stack. + + + Note that although the jump table is always on a 256 byte page boundary, +it is not the "correct" distance above the top of the TPA (as defined by the +contents of address 0006h) to correspond with CP/M 2.2. This should not mat- +ter to well behaved CP/M programs but it is rumoured that some programs rely +on the size of the BDOS in CP/M 2.2. These programs will need modification. + + + The entries in the BIOS jump vector are as below: + + xx00h - JMP WBOOT ;Warm boot + xx03h - JMP WBOOT ;Warm boot + xx06h - JMP CONST ;Console status + xx09h - JMP CONIN ;Console input + xx0Ch - JMP CONOUT ;Console output + xx0Fh - JMP LIST ;List output + xx12h - JMP PUNCH ;Punch (auxiliary) output + xx15h - JMP READER ;Reader (auxiliary) input + + + xx18h - JMP RETURN ;Home in CP/M + xx1Bh - JMP RETURN ;Select disk in CP/M + xx1Eh - JMP RETURN ;Set track in CP/M + xx21h - JMP RETURN ;Set sector in CP/M + xx24h - JMP RETURN ;Set DMA address in CP/M + xx27h - JMP RETURN ;Read sector in CP/M + xx2Ah - JMP RETURN ;Write sector in CP/M + xx2Dh - JMP LSTST ;List status + xx30h - JMP RETURN ;Sector translate in CP/M + + +2.5 RAM PAGING + + + When a transient program is loaded, the mapper RAM slot will be enabled in +all four pages and the four RAM segments which make up the basic 64k will be +paged in. There will be MSX BIOS ROM compatible slot handling entry points +available in page-0 and various mapper support routines available in page-3 +(see section 5 for specifications of these). + + + A program may do any slot switching and paging which it likes while it is +running and need not restore either the slot selections or the RAM paging +before it exits, since COMMAND2.COM will handle this. A program must of +course take the usual precautions with the interrupt and the slot entry +points if it alters page-0, and must never alter page-3 (nothing is allowed +to do that!). + + + Pages 0, 1 and 2 can contain any slot when doing a function call and will +be preserved. Any parameters can be passed from the slot being selected, +except that environment strings and disk transfer areas must be in the mapper +RAM slot. + + + Any RAM segments can be selected in pages 0, 1 and 2 when an MSX-DOS func- +tion call or an MSX-DOS BIOS function call is made, and also the stack can be +in any page. The current paging state will be preserved by all function calls +even in error conditions. Any disk transfers will be done to the RAM segments +which are paged in when the function call is made, even if they are not the +original TPA segments. + + + If a transient program wants to use more RAM than the TPA then it can use +the mapper support routines (described in section 5) to obtain more RAM. +Before using any RAM other than the four TPA segments, the program must ask +the mapper routines to allocate a new segment. This ensures that there is no +contention with the program trying to use a segment which is already in use +(by the RAM disk for example). The segments should normally be allocated as +"user segments" since these will automatically be freed when the program +terminates. "system segments" should only be allocated if it is necessary for +them to remain in use after the transient program has terminated. + + + Having allocated additional segments, the program may page them in and use +any of the mapper support routines to accessthem. It will normally be neces- +sary for a transient program to remember the segment numbers of the TPA seg- +ments in order to page them back in when they are required. The segment num- +bers will normally be 0, 1, 2 and 3 but this must NOT be assumed by transient +programs, they must use the "GET_Pn" mapper routines to find out the segment +numbers before paging anything else in. + + + + +3. MSX-DOS FUNCTION CALLS +=========================== + + +3.1 CALLING CONVENTIONS + + + MSX-DOS function calls are made by putting the function code in register C +with any other parameters required in the other main registers and then exe- +cuting a "CALL 5" instruction. The operation will be performed and the +results will be returned in various registers depending on the function. + + + Generally all the main registers (AF, BC, DE and HL) will be corrupted by +MSX-DOS calls or will return results. The alternate register set (AF', BC', +DE' and HL') are always preserved, whilst the index registers (IX and IY) are +preserved except in the one or two cases where they return results. + + + Only a small amount of space (8 bytes) is needed on the transient pro- +gram's stack because MSX-DOS switches to an internal stack when it is called. + + + For compatibility all functions which have a CP/M counterpart return with +A=L and B=H. Frequently A returns an error flag, with zero indicating success +and 01h or FFh indicating failure. + + + All of the new MSX-DOS functions (function code above 40h) return with an +error code in A and any other results in the other main registers. An error +code of 0 means no error, whilst any non-zero code means an error occurred, +the exact nature of which can be found by looking at the value. A list of +error codes and messages is given in section 6. An "explain" function is +provided which will give an ASCII explanation string for an error code (see +Function Specification for details). + + + The actual functions available are documented in the MSX-DOS Function +Specification. + + +3.2 DEVICES AND CHARACTER I/O + + + Wherever a filename is given to an MSX-DOS function, a device name may +also be given. These devices are used for character based I/O and allow a +program to access a disk file or a character device in exactly the same way +without having to know which it is using. + + + The syntax of device names is identical to that of filenames so programs +do not need any special handling to use device names. This applies both to +the new MSX-DOS 2 functions and the CP/M compatible FCB functions. The reser- +ved filenames used for devices are: + + + CON - screen output, keyboard input + PRN - printer output + LST - printer output + AUX - auxiliary output/input + NUL - null device + + + When any of these appear as the main part of a filename, it actually re- +fers to the device; the extension is ignored. Most function calls that use +files can also use devices. For example, a filename of CON can be success- +fully given to the "rename file" function or to the "delete file" function. +No error will be returned but the device will be unaffected. + + + The AUX device mentioned above does not do anything by default, but a +routine may be hooked into it so that it refers for example to a serial dri- +ver. The NUL device does not actually do anything; output characters are +ignored and an end-of-file is always input. The LST and PRN devices are +identical. + + + The CON device is used to read from the keyboard or write to the screen. +When reading from the CON device, the system will read a line at a time allo- +wing the user to use line editing facilities. Only when the user types a CR +(carriage return) will the line be entered. End of input is signified by a +Ctrl-Z character at the start of a line. + + + The system automatically opens several file handles to these standard +devices (see section 3.3 for details). These file handles may be used by +programs for accessing the standard devices. Alternatively a program can do +character I/O by using the traditional CP/M character functions (functions +01h...0Bh). These two methods are both acceptable but they should not norma- +lly be mixed since they use separate buffering schemes and so characters can +get lost in these buffers. + + + The redirection is specified at the command line, both of these methods +(standard file handles and character functions) will be redirected. However +it is preferable to use the standard file handles and to read and write in +large blocks because when accessing disk files these will be very much faster +than using the character functions. + + + Even if the redirection was specified at the command line, programs may +sometimes need to do screen output and keyboard input which will bypass any +redirection. For example disk error handling routines may need to do this. To +facilitate this, there is a function provided which allows redirection of the +character functions to be temporarily cancelled. This is described in the +"Function Specification" document (function number 70h). + + +3.3 FILE HANDLES + + + File handles are the method by which files are read from and written to +using the new MSX-DOS functions. File handles may also be used to manipulate +files in other ways (e.g. the manipulation of the file attributes). + + + A file handle is an 8 bit number which refers to a particular open file or +device. A new file handle is allocated when the "open file handle" (function +43H) or "create file handle" (function 44H) function is used. The file handle +can be used to read and write data to the file and remains in existence until +the "close file handle" (function 45H) or "delete file handle" (function 52H) +function is called. Other operations can be done on files using file handles, +such as changing the attributes or renaming the files to which they refer. + + + Whenever MSX-DOS allocates a new file handle, it will use the lowest num- +ber available. The maximum file handle number in the current version is 63. +In future versions this may be increased but will never be greater than 127, +so file handles can never be negative. + + + Space for the internal data structures used for file handles is allocated +dynamically within a 16K RAM segment (the "data segment") so there is no +fixed limit to the number of file handles which can be open at one time. This +segment is kept outside the TPA, so anything stored there does not reduce TPA +size. As well as keeping internal file handle information, the system also +keeps disk buffers and environment strings in the data segment. + + + Various file handles are pre-defined and are already open when a transient +program is executed. These file handles refer to the standard input and out- +put devices (see section 3.2). The "traditional" CP/M style MSX-DOS character +I/O functions actually refer to these file handles. + + + A transient program actually gets a copy of the standard input and output +file handles which the command interpreter was using, rather than the origi- +nals. This means that the program can freely close these file handles and +re-open them to different destinations and need not reset them before +terminating. + + + The default file handles and their destinations are: + + + 0 - Standard input (CON) + 1 - Standard output (CON) + 2 - Standard error input/output (CON) + 3 - Standard auxiliary input/output (AUX) + 4 - Standard printer output (PRN) + + + When the command interpreter is about to execute a command (for example a +transient program), it executes a "fork" function call (function 60H). This +informs the system that a new program is being executed as a "subroutine" and +amongst other things, all of the currently open file handles are duplicated, +so that the new program will be using copies of the original handles, rather +than the command interpreter's. + + + If the transient program changes any of the file handles, by closing any +existing ones or opening new ones, it will be the program's own set of file +handles which are modified, the original set will remain unaltered. After the +program has terminated, the command interpreter executes a "join" function +call (function 61H), passing to it a process id which was returned from the +original "fork". This tells the system that the new program has terminated +and so all its file handles can be thrown away. + + + Reference counts are kept of how many copies of each handle there are +which enables the system to tidy up any file handles which are no longer +needed when a program terminates. This ensures that the system will not run +out of file handles because of badly behaved programs not closing them. + + + These "fork" and "join" functions are available for user programs if they +find them useful. In addition to tidying up file handles, "join" will also +free up any user allocated RAM segments which the program has not freed. + + +3.4 FILE INFO BLOCKS + + + All new MSX-DOS functions that act on files on disk can be passed a simple +pointer to a null-terminated string (called an ASCIIZ string), which can +contain a drive, path and unambiguous filename. These are typically the ope- +rations which a transient program will perform, often through a high level +language interface. The Command Specification gives details of these. + + + To any of these ASCIIZ functions, a File Info Block (FIB) may passed ins- +tead. FIBs are used for more complex operations such as the searching of +directories for unknown files or sub-directories. + + + A FIB is a 64 byte area of the user's memory which contains information +about the directory entry on disk for a particular file or sub-directory. The +information in a FIB is filled in by the new MSX-DOS "find" functions ("find +first entry" (function 40H), "find new entry" (function 42H) and "find next +entry" (function 41H)). The format of a File Info +Block is as follows: + + + 0 - Always 0FFh + 1..13 - Filename as an ASCIIZ string + 14 - File attributes byte +15..16 - Time of last modification +17..18 - Date of last modification +19..20 - Start cluster +21..24 - File size + 25 - Logical drive +26..63 - Internal information, must not be modified + + + The 0FFh at the start of the fileinfo block must be there to distinguish +it from a pathname string, since some functions can take either type of +parameter. + + + The filename is stored in a suitable format for directly printing, and is +in the form of an ASCIIZ string. Any spaces will have been removed, the file- +name extension (if present) will be preceded by a dot and the name will have +been uppercased. If the entry is a volume label then the name will be stored +without the "." separator, with spaces left in and not uppercased. + + + The file attributes byte is a byte of flags concerning the file. The for- +mat of this byte is: + + +* Bit 0 - READ ONLY. If set then the file cannot be written to or deleted, +but can be read, renamed or moved. + + +* Bit 1 - HIDDEN FILE. If set then the file will only be found by the "Find +First" function if the "hidden file" bit is set in the search attributes +byte. All the commands implemented by the command interpreter that access +files and directories on disk can take a "/H" option which allows the command +to find hidden files. + + +* Bit 2 - SYSTEM FILE. As far as MSX-DOS functions are concerned, this bit +has exactly the same effect as the "HIDDEN FILE" bit except that the "Find +New" and "Create" function calls will not automatically delete a system file. +None of the commands implemented by the command interpreter allow system +files to be accessed. + + +* Bit 3 - VOLUME NAME. If set then this entry defines the name of the volume. +Can only occur in the root directory, and only once. All other bits are +ignored. + + +* Bit 4 - DIRECTORY. If set then the entry is a sub-directory rather than a +file and so cannot be opened for reading and writing. Only the hidden bit has +any meaning for sub-directories. + + +* Bit 5 - ARCHIVE BIT. Whenever a file has been written to and closed this +bit is set. This bit can be examined by, for example, the XCOPY command to +determine whether the file has been changed. + + +* Bit 6 - Reserved (always 0). + + +* Bit 7 - DEVICE BIT. This is set to indicate that the FIB refers to a cha- +racter device (eg. "CON") rather than a disk file. All of the other attri- +butes bits are ignored. + + + The time of last modification is encoded into two bytes as follows: + + + Bits 15..11 - HOURS (0..23) + Bits 10...5 - MINUTES (0..59) + Bits 4...0 - SECONDS/2 (0..29) + + + The date of last modification is encoded into two bytes as follows. If all +bits are zero then there is no valid date set. + + + Bits 15...9 - YEAR (0..99 corresponding to 1980..2079) + Bits 8...5 - MONTH (1..12 corresponding to Jan..Dec) + Bits 4...0 - DAY (1..31) + + + The file size is a 32 bit number stored with the lowest byte first, and is +zero for sub-directories. + + + The logical drive is a single byte drive number, with 1 corresponding to +A:, 2 to B: etc. It will never be zero, since if zero was specified in the +original function, this means the default drive and the driven number of the +default drive will be filled in here. + + + The internal information tells MSX-DOS where on the disk the directory +entry is stored. This enables functions to which the fileinfo block is passed +to operate on the directory entry, for example deleting it, renaming it or +opening it. Data stored here also enables the "find next entry" function +(function 41H) to carry on the search to find the next matching file. The +user should not access or modify the internal information at all. + + + Fileinfo blocks are filled in by the "find first entry", "find new entry" +and "find next entry" MSX-DOS functions. Each of these functions locates a +directory entry and fills in the fileinfo block with the relevant information + + + In the case of "find first entry" a directory will be searched for the +first entry which matches a given filename and which has suitable attributes +(see the Function Specification for details). "Find next entry" carries on a +search started by a previous "find first entry" function and updates the +fileinfo block with the next matching entry. + + + "Find new entry" is just like "find first entry" except that instead of +looking for a matching entry, it will create a new one and then return a +fileinfo block just as if "find first" had found it. + + + Having created a fileinfo block using one of the "find" functions there +are two ways in which it can be used. The first way is to simply use the +information which it contains such as the filename and size. For example the +"DIR" command simply prints out the information on the screen. + + + The more interesting way of using a fileinfo block is to pass it back to +another MSX-DOS function in order to carry out some operation on the direc- +tory entry. Many of the MSX-DOS functions described in the Function Specifi- +cation take a pointer in register DE which can either point to drive/path/fi- +le string or a fileinfo block. In either case a particular file or directory +is being specified for the function to act on. + + + The functions which can take such a parameter are "Delete File or Subdi- +rectory" (function 4DH), "Rename file or Subdirectory" (function 4EH), "Move +File or Subdirectory" (function 4FH), "Get/Set File Attributes" (function +50H), "Get/Set File Date and Time" (function 51H) and "Open File handle" +(function 43H). All of these carry out the obvious function on the specified +file or directory. + + + A fileinfo block can also be passed to a "find first" or "find new" func- +tion in place of the drive/path/file string. In this case the fileinfo block +must refer to a directory rather than a file and a filename string must also +be passed in register HL (typically null which is equivalent to "*.*"). The +directory specified by the fileinfo block will be searched for matches with +the filename, subject to the usual attribute checking. This feature is neces- +sary for the command interpreter so that a command such as "DIR A:UTIL" can +have the required action if UTIL is a directory. + + +3.5 ENVIRONMENT STRINGS + + + MSX-DOS maintains a list of "environment strings" in it's data segment. An +environment string is a named item which has a value associated with it. Both +the name and the value are user-defined. Environment strings are accessed at +the function call level via the "Get Environment String" (function 6BH), "Set +Environment String" (function 6CH) and "Find Environment String" (function +6DH) functions. + + + The name of an environment string is a non-null string consisting of any +characters that are valid in filenames. The name can be up to 255 characters +long. The characters of the name are upper-cased when the string is defined, +although for name comparisons case is not significant. + + + The value of an environment string consists of a string of non-null cha- +racters and can be up to 255 characters long. If the value of an environment +string is set to a null string, then the name is removed from the list of +environment strings. Similarly, if the value of an environment string that +has not been defined is read, then a null string is returned. The value is +not upper-cased and no interpretation is placed on the characters in the +value string. + + + When a transient program is loaded and executed from COMMAND2.COM, two +special environment strings are set up, which it can read. + + + An environment string called PARAMETERS is set up to the command line not +including the actual command name. This is similar to the one set up at 80h +for CP/M compatibility, but has not been upper-cased. + + + Another environment string called PROGRAM is also set up and this is the +whole path used to locate the program on disk. The drive is first, followed +by the path from the root and then the actual filename of the program. The +drive, path and filename can be separated if desired using the "Parse Path- +name" function call (function 5CH). + + + The PROGRAM environment string has several uses. The main use is that a +program can use it to load overlay files from the same directory as it was +loaded from. The last item in PROGRAM (ie. the actual program filename) is +replaced with the name of the overlay file, and then the new string can be +passed to any of the new MSX-DOS 2 functions that take ASCIIZ strings (such +as "Open File"). + + + Note that some CP/M programs are capable of loading and running transient +programs, and in this case they obviously will not have set up the PROGRAM +and PARAMETERS environment strings, and they will in fact still be set up +from when the CP/M program was loaded. If a program wishes to use PROGRAM and +PARAMETERS and still be loadable from a CP/M program, then it can look at a +variable called "LOAD_FLAG", which is in page 0 at address 0037h. It is set +to zero on every MSX-DOS 2 function call but is set to non-zero immediately +before a transient program is executed by the command interpreter. Similarly, +if a new transient program has the ability to load other transient programs +and it sets up PROGRAM and PARAMETERS, then it should also set LOAD_FLAG to +non-zero. + + + Another special environment string is one called APPEND. This can be set +up by the user from the command interpreter and is used by the CP/M "Open +File (FCB)" function. When this function call is done and the file is not +found, an alternative directory, specified by APPEND, is searched. It is not +anticipated however that new transient programs will use this function call +or the APPEND environment string. + + + Several environment strings are set up by the command interpreter when it +starts up and are altered by the user to control various system features and +options, and it may be useful for transient programs to read some of these. +For example, it may be useful to read the PATH environment string or the DATE +and TIME environment strings if the program prints out dates and times. The +Command Specification contains details of these default environment strings. + + +3.6 FILE CONTROL BLOCKS + + + It is not anticipated that specially written MSX-DOS 2 transient programs +or MSX-DOS 1 or CP/M programs which are modified for MSX-DOS 2 will use the +CP/M-compatible FCB functions, but the format of the FCBs used for these +functions is given here for reference. This format is, of course, very simi- +lar to the FCBs used by CP/M and MSX-DOS 1 but the use of some of the fields +within the FCB are different (though generally compatible). + + + A basic FCB is 33 bytes long. This type of FCB can be used for file mana- +gement operations (delete, rename etc.) and also for sequential reading and +writing. The random read and write functions use an extra 3 bytes on the end +of the FCB to store a random record number. The MSX-DOS 1 compatible block +read and write functions also use this additional three (or in some cases +four) bytes - see the Function Specification for details. + + + The layout of an FCB is given below. A general description of each of the +fields is included here. The individual function description given in the +Function Specification details of how the fields are used for each function +where this is not obvious. + + +* 00h Drive number 1...8. 0 => default drive. Must be set up in all FCBs +used, never modified by MSX-DOS function calls (except "Open File" if APPEND +was used). + + +* 01h...08h Filename, left justified with trailing blanks. Can contain "?" +characters if ambiguous filename is allowed (see Function Specification). +When doing comparisons case will be ignored. When creating new files, name +will be uppercased. + + +* 09h...0Bh Filename extension. Identical to filename. Note that bit-7 of the +filename extension characters are NOT interpreted as flags as they are in +CP/M. + + +* 0Ch Extent number (low byte). Must be set (usually to zero) by the tran- +sient program before open or create. It is used and updated by sequential +read and write, and also set by random read and write. This is compatible +with CP/M and MSX-DOS 1. + + +* 0Dh File attributes. Set by "open", "create" or "find". + + +* 0Eh Extent number (high byte) for CP/M functions. Zeroed by open and cre- +ate. For sequential read and write it is used and updated as an extension to +the extent number to allow larger files to be accessed. Although this is +different from CP/M it does not interfere with CP/Ms use of FCBs and is the +same as MSX-DOS 1. + + Record size (low byte) for MSX-DOS 1 compatible block functions. Must be +set to the required record size before using the block read or write +functions. + + +* 0Fh Record count for CP/M functions. Set up by open and create and modified +when necessary by sequential and random reads and writes. This is the same as +CP/M and MSX-DOS 1. + + Record size (high byte) for MSX-DOS 1 compatible block functions. Must be +set to the required record size before using the block read and write +functions. + + +* 10h...13h File size in bytes, lowest byte first. File size is exact, not +rounded up to 128 bytes. This field is set up by open and create and updated +when the file is extended by write operations. Should not be modified by the +transient program as it is written back to disk by a close function call. +This is the same as MSX-DOS 1 but different from CP/M which stores allocation +information here. + + +* 14h...17h Volume-id. This is a four byte number identifying the particular +disk which this FCB is accessing. It is set up by open and create and is +checked on read, write and close calls. Should not be modified by the pro- +gram. Note that this is different from MSX-DOS 1 which stores the date and +time of last update here, and from CP/M which stores allocation information. + + +* 18h...1Fh Internal information. These bytes contain information to enable +the file to be located on the disk. Should not be modified at all by the +transient program. The internal information kept here is similar but not +identical to that kept by MSX-DOS 1 and totally different from CP/M. + + +* 20h Current record within extent (0...127). Must be set (normally to zero) +by the transient program before first sequential read or write. Used and +modified by sequential read and write. Also set up by random read and write. +This is compatible with CP/M and MSX-DOS 1. + + +* 21h...24h Random record number, low byte first. This field is optional, it +is only required if random or block reads or writes are used. It must be set +up before doing these operations and is updated by block read and write but +not by random read or write. Also set up by the "set random record" function. + + + For the block operations, which are in MSX-DOS 1 but not in CP/M, all four +bytes are used if the record size is less than 64 bytes, and only the first +three bytes are used if the record size is 64 bytes or more. For random read +and write only the first three bytes are used (implied record size is 128 +bytes). This is compatible with CP/M and with MSX-DOS 1. + + + + +4. SCREEN CONTROL CODES +========================= + + + Below is a list of all control codes and escape sequences which may be +used when doing character output by MSX-DOS character functions, BIOS calls +or writing to the device CON. These are all compatible with MSX-DOS 1 and +contain the VT-52 control codes. + + + The screen is 24 lines of 2 to 80 characters. When a printing character is +displayed the cursor is moved to the next position and to the start of the +next line at the end of a line. If a character is written in the bottom right +position then the screen will be scrolled to allow the cursor to be positio- +ned at the start of the next line. The letters in escape sequences must be in +the correct case, the spaces are inserted for readability they are not part +of the sequence. Numbers (indicated by or ) are included in the se- +quence as a single byte usually with an offset of 20h added. + + +Ctrl-G 07h = Bell. + + +Ctrl-H 08h = Cursor left, wraps around to previous line, stop + at top left of screen. + + +Ctrl-I 09h = Tab, overwrites with spaces up to next 8th + column, wraps around to start of next line, scrolls at bottom + right of screen. + + +Ctrl-J 0Ah = Line feed, scrolls if at bottom of screen. + + +Ctrl-K 0Bh = Cursor home. + + +Ctrl-L 0Ch = Clear screen and home cursor. + + +Ctrl-M 0Dh = Carriage return. + + +Ctrl-[ 1Bh = ESC - see below for escape sequences. + + +Ctrl-\ 1Ch = Cursor right, wrap around to next line, stop at + bottom right of screen. + + +Ctrl-] 1Dh = Cursor left, wrap around to previous line, stop + at top left of screen. + + +Ctrl-^ 1Eh = Cursor up, stop at top of screen. + + +Ctrl-_ 1Fh = Cursor down, stop at bottom of screen. + + + 7Fh = Delete character and move cursor left, wrap + around to previous line, stop at top of screen. + + +Esc A = Cursor up, stops at top of screen. + + +Esc B = Cursor down, stops at bottom of screen. + + +Esc C = Cursor right, stops at end of line. + + +Esc D = Cursor left, stops at start of line. + + +Esc E = Clear screen and home cursor. + + +Esc H = Cursor home. + + +Esc J = Erase to end of screen, don't move cursor. + + +Esc j = Clear screen and home cursor. + + +Esc K = Erase to end of line, don't move cursor. + + +Esc L = Insert a line above cursor line, scroll rest of + screen down. Leave cursor at start of new blank line. + + +Esc l = Erase entire line, don't move cursor. + + +Esc M = Delete cursor line, scrolling rest of screen up. + Leave cursor at start of next line. + + +Esc x 4 = Select block cursor. + + +Esc x 5 = Cursor off. + + +Esc Y = Position cursor at row column . Top left + of screen is n=m=20h (ASCII space). + + +Esc y 4 = Select underscore cursor. + + +Esc y 5 = Cursor on. + + + + +5. MAPPER SUPPORT ROUTINES +============================ + + + MSX-DOS 2 contains routines to provide support for the memory mapper. This +allows MSX application programs or MSX-DOS transient programs to utilize more +than the basic 64k of memory, without conflicting with the RAM disk or any +other system software. + + + 5.1 MAPPER INITIALIZATION + + + When the DOS kernel is initialized it checks that there is the memory +mapper in the system, and that there is at least 128k of RAM available. If +the kernel has found at least one slot which contains 128k of the mapper RAM, +it selects the slot which contains the largest amount of RAM (or the slot +with the smallest slot number, if there are two or more mapper slots which +have the same amount of RAM) and makes that slot usable as the system RAM. +When there is not enough memory on the memory mapper, MSX-DOS 2 won't start. + + + Next the kernel builds up a table of all the 16k RAM segments available to +this slot (primary mapper slot). The first four segments (64k) for the user +and the two highest numbered segments are allocated to the system, one for +the DOS kernel code and one for the DOS kernel workspace. All other segments +(at least two) are marked as free initially. Then the kernel builds up the +similar tables for other RAM slots, if any. All of these segments are marked +as free initially. + + + 5.2 MAPPER VARIABLES AND ROUTINES + + + The mapper support routines use some variables in the DOS system area. +These tables may be referred and used by the user programs for the various +purposes, but must not be altered. The contents of the tables are as follows: + + +address function ++0 Slot address of the mapper slot. ++1 Total number of 16k RAM segments. 1...255 (8...255 + for the primary) ++2 Number of free 16k RAM segments. ++3 Number of 16k RAM segments allocated to the system + (at least 6 for the primay) ++4 Number of 16k RAM segments allocated to the user. ++5...+7 Unused. Always zero. ++8... Entries for other mapper slots. If there is + none, +8 will be zero. + + + A program uses the mapper support code by calling various subroutines. +These are accessed through a jump table which is located in the MSX-DOS sys- +tem area. The contents of the jump table are as follows: + + +ad. entry name function ++0H ALL_SEG Allocate a 16k segment. ++3H FRE_SEG Free a 16k segment. ++6H RD_SEG Read byte from address A:HL to A. ++9H WR_SEG Write byte from E to address A:HL. ++CH CAL_SEG Inter-segment call. Address in IYh:IX ++FH CALLS Inter-segment call. Address in line after + the call instruction. ++12H PUT_PH Put segment into page (HL). ++15H GET_PH Get current segment for page (HL) ++18H PUT_P0 Put segment into page 0. ++1BH GET_P0 Get current segment for page 0. ++1EH PUT_P1 Put segment into page 1. ++21H GET_P1 Get current segment for page 1. ++24H PUT_P2 Put segment into page 2. ++27H GET_P2 Get current segment for page 2. ++2AH PUT_P3 Not supported since page-3 must never be + changed. Acts like a "NOP" if called. ++2DH GET_P3 Get current segment for page 3. + + + A program can use the extended BIOS calls for the mapper support to obtain +these addresses. The calls are provided because these addresses may be chan- +ged in the future version, or to use mapper routines other than MSX-DOS map- +per support routines. + + + To use the extended BIOS, the program should test "HOKVLD" flag at FB20h +in page-3. If bit-0 (LSB) is 0, there is no extended BIOS nor the mapper +support. Otherwise, "EXTBIO" entry (see below) has been set up and it can be +called with various parameters. Note that this test is unnecessary for the +applications which are based on MSX-DOS (such as the program which is loaded +from the disk), and the program may proceed to the next step. + + + Next, the program sets the device number of the extended BIOS in register +D, the function number in register E, and required parameters in other regis- +ters, and then calls "EXTBIO" at FFCAh in page-3. In this case, the stack +pointer must be in page-3. If there is the extended BIOS for the specified +device number, the contents of the registers AF, BC and HL are modified +according to the function; otherwise, they are preserved. Register DE is +always preserved. Note that in any cases the contents of the alternative +registers (AF', BC', DE' and HL') and the index registers (IX and IY) are +corrupted. + + + The functions available in the mapper support extended BIOS are: + + +* Get mapper variable table + + Parameter: A = 0 + D = 4 (device number of mapper support) + E = 1 + + Result: A = slot address of primary mapper + DE = reserved + HL = start address of mapper variable table + + +* Get mapper support routine address + + Parameter: A = 0 + D = 4 + E = 2 + + Result: A = total number of memory mapper segments + B = slot number of primary mapper + C = number of free segments of primary mapper + DE = reserved + HL = start address of jump table + + + In these mapper support extended BIOS, register A is not required to be +zero. Note that, however, if there is no mapper support routine, the contents +of registers will not be modified, and the value which is not zero will be +returned in A otherwise. Thus, the existence of the mapper support routine +can be determined by setting zero in A at the calling and examining the +returned value of A. + + + The slot address of the primary mapper returned by the extended BIOS is +the same as the current RAM slot address in page-3, and, in the ordinary +environment (DISK-BASIC and MSX-DOS), the same RAM slot is also selected in +page-2. In MSX-DOS, this is also true in page-0 and page-1. + + + 5.3 USING MAPPER ROUTINES + + + A program can request a 16k RAM segment at any time by calling the +"ALL_SEG" routine. This either returns an error if there are no free seg- +ments, or the segment number of a new segment which the program can use. A +program must not use any segment which it has not explicitly allocated, ex- +cept for the four segments which make up the basic 64k of RAM. + + + A segment can be allocated either as a user segment or as a system seg- +ment. User segments will be automatically freed when the program terminates, +whereas system segments are never freed unless the program frees them expli- +citly. Normally, programs should allocate user segments. + + + RAM segments can be accessed by the "RD_SEG" and "WR_SEG" routines which +read and write bytes to specified segments. The routines "CAL_SEG" and +"CALLS" allow inter-segment calls to be done in much the same way as inter- +slot calls in the current MSX system. + + + Routines are provided to explicitly page a segment in, or to find out +which segment is in a particular page. There are routines in which the page +(0...3) is specified by the top two bits of an address in HL ("PUT_PH" and +"GET_PH"). And there are also specific routines for accessing each page +("GET_Pn" and "PUT_Pn"). These routines are very fast so a program should not +suffer in performance by using them. + + + Note that page-3 should never be altered since this contains the mapper +support routines and all the other system variables. Also great care must be +taken if page-0 is altered since this contains the interrupt and the slot +switching entry points. Pages 1 and 2 can be altered in any way. + + + None of the mapper support routines will disturb the slot selection mecha- +nism at all. For example when "PUT_P1" is called, the specified RAM segment +will only appear at address 4000h...7FFFh if the mapper slot is selected in +page-1. The "RD_SEG" and "WR_SEG" routines will always access the RAM segment +regardless of the current slot selection in the specified page, but the map- +per RAM slot must be selected in page-2. + + + 5.4 ALLOCATING and FREEING SEGMENTS + + + The following two routines can be called to allocate or free segments. All +registers apart from AF and BC are preserved. An error is indicated by the +carry flag being set on return. The slot selection and RAM paging may be in +any state when these routines are called and both will be preserved. The +stack must not be in page-0 or page-2 when either of these routines are +called. + + + A program must not use any segment (apart from the four which make up the +basic 64k) unless it has specifically allocated it, and must not continue to +use a segment after it has been freed. + + + A segment may be allocated either as a user or a system segment. The only +difference is that user segments will be automatically freed when the program +terminates whereas system segments will not be. In general a program should +allocate a user segment unless it needs the data in the segment to outlast +the program itself. User segments are always allocated from the lowest numbe- +red free segment and system segments from the highest numbered one. + + + An error from "allocate segment" usually indicates that there are no free +segments, although it can also mean that an invalid parameter was passed in +register A and B. An error from "free segment" indicates that the specified +segment number does not exist or is already free. + + +ALL_SEG - Parameters: A=0 => allocate user segment + A=1 => allocate system segment + B=0 => allocate primary mapper + B!=0 => allocate FxxxSSPP slot address + (primary mapper, if 0) + xxx=000 allocate specified slot only + xxx=001 allocate other slots than + specified + xxx=010 try to allocate specified slot + and, if it failed, try another slot + (if any) + xxx=011 try to allocate other slots + than specified and, if it failed, + try specified slot + + Results: Carry set => no free segments + Carry clear => segment allocated + A=new segment number + B=slot address of + mapper slot (0 if called as B=0) + + +FRE_SEG - Parameters: A=segment number to free + B =0 primary mapper + B!=0 mapper other than primary + + Returns: Carry set => error + Carry clear => segment freed OK + + + 5.5 INTER-SEGMENT READ AND WRITE + + + The following two routines can be called to read or write a single byte +from any mapper RAM segment. The calling sequence is very similar to the +inter-slot read and write routines provided by the MSX system ROM. All regis- +ters apart from AF are preserved and no checking is done to ensure that the +segment number is valid. + + + The top two bits of the address are ignored and the data will be always +read or written via page-2, since the segment number specifies a 16k segment +which could appear in any of the four pages. The data will be read or written +from the correct segment regardless of the current paging or slot selection +in page-0 or page-1, but note that the mapper RAM slot must be selected in +page-2 when either of these routines are called. This is so that the routines +do not have to do any slot switching and so can be fast. Also the stack must +not be in page-2. These routines will return disabling interrupts. + + +RD_SEG - Parameters: A = segment number to read from + HL = address within this segment + + Results: A = value of byte at that address + All other registers preserved + + +WR_SEG - Parameters: A = segment number to write to + HL = address within this segment + E = value to write + + Returns: A = corrupted + All other registers preserved + + + 5.6 INTER-SEGMENT CALLS + + + Two routines are provided for doing inter-segment calls. These are mode- +lled very closely on the two inter-slot call routines provided by the MSX +system ROM, and the specification of their usage is very similar. + + + No check is done that the called segment actually exists so it is the +user's responsibility to ensure this. The called segment will be paged into +the specified address page, but it is the user's responsibility to ensure +that the mapper slot is enabled in this page, since neither of these routines +will alter the slot selection at all. This is to ensure that they can be +fast. + + + The routine cannot be used to do an inter-segment call into page-3. If +this is attempted then the specified address in page-3 will simply be called +without any paging, since page-3 must never be altered. Calling into page-0 +must be done with some care because of the interrupt and other entry point. +Also care must be taken that the stack is not paged out by these calls. + + + These routines, unlike inter-slot calls, do not disable interrupts before +passing control to the called routine. So they return to the caller in the +same state as before, unless the interrupt flag was modified by the called +routine. + + + Parameters cannot be passed in registers IX, IY, AF', BC', DE' or HL' +since these are used internally in the routine. These registers will be co- +rrupted by the inter-segment call and may also be corrupted by the called +routine. All other registers (AF, BC, DE and HL) will be passed intact to the +called routine and returned from it to the caller. + + +CAL_SEG - Parameters: IY = segment number to be called + IX = address to call + AF, BC, DE, HL passed to called routine + Other registers corrupted + + Results: AF, BC, DE, HL, IX and IY returned from + called routine. All others corrupted. + + +CALLS - Parameters: AF, BC, DE, HL passed to called routine + Other registers corrupted + Calling sequence: CALL CALLS + DB SEGMENT + DW ADDRESS + + Results: AF, BC, DE, HL, IX and IY returned from + called routine. All others corrupted. + + + 5.7 DIRECT PAGING ROUTINES + + + The following routines are provided to allow programs to directly manipu- +late the current paging state without having to access the hardware. Using +these routines ensures compatibility with any changes to the details of the +hardware. The routines are very fast and so using them will not compromise +the performance of programs. + + + Routines are provided to directly read or write to any of the four page +registers. No checking of the validity of the segment number is done so this +is the user's responsibility. Note that the value written in the register is +also written in memory and, if the register value is requested, the value +stored in memory will be returned and the one in the register will never be +read directly. This is done to avoid errors from hardware conflicts when +there are two or more mapper registers in the system. The user should always +manipulate the memory mapper through these routines. + + + The "GET" routines return values from internal images of the registers +without actually reading the registers themselves. This ensures that if a +segment is enabled by, for example, "PUT_P1" then a subsequent "GET_P1" call +will return the actual value. Reading the mapper register may produce a dif- +ferent value because the top bits of the segment numbers are generally not +recorded. + + + Although a "PUT_P3" routine is provided, it is in fact a dummy routine and +will not alter the page-3 register. This is because the contents of the +page-3 register should never be altered. The "GET_P3" routine does behave as +expected to allow the user to determine what segment is in page-3. + + + Another pair of routines ("GET_PH" and "PUT_PH") is provided which are +identical in function except that the page is specified by the top two bits +of register H. This is useful when register HL contains an address, and these +routines do not corrupt register HL. "PUT_PH" will never alter the page-3 +register. + + +PUT_Pn - Parameters: n = 0,1,2 or 3 to select page + A = segment number + Results: None + All registers preserved + + +GET_Pn - Parameters: n = 0,1,2 or 3 to select page + Results: A = segment number + All other registers preserved + + +PUT_PH - Parameters: H = high byte of address + A = segment number + Results: None + All registers preserved + + +GET_PH - Parameters: H = high byte of address + Results: A = segment number + All other registers preserved + + + Before using these direct paging routines to alter the paging state, a +program should first use the "GET_Pn" routines to determine the initial four +segments for when it needs to restore these. No program should assume fixed +values for these initial segments since they are likely to change in future +versions of the system. + + + + +6. ERRORS +=========== + + + All the new MSX-DOS 2 functions (function codes above 40h) return an +"error code" in A. This is zero if the operation was successful. If non-zero, +then the error code explains the exact nature of the error. + + + Since MSX-DOS 2 performs an "OR A" instruction immediately before retur- +ning from a function call, a "JR NZ" instruction is often used in the tran- +sient program immediately after the "CALL 5" instruction to test whether an +error occurred. Frequently the destination of this error jump just loads the +error code into B and does a "Terminate with Error Code" function. This then +passes the error code back to the command interpreter which prints the appro- +priate message. + + + A transient program may also itself get the actual message for any error +returned by an MSX-DOS 2 function call by using the "Explain Error Code" +function. See the Function Specification for details. + + + The error codes start at 0FFh and descend in value. Values less than 40h +are 'user errors' and will never be used by the system and can be used by +transient programs to return their own errors. User errors below 20h returned +to the command interpreter will not have any message printed. + + + If the "Explain Error Code" function call (see the Function Specification) +is asked to explain an error code for which it does not have a message, then +the string returned will be "System error " or "User error " as appro- +priate, where is the error number. + + + Below is a list of all currently defined error numbers and their messages +and meanings. Also given is the mnemonic, which is often used as a symbol in +a source file and is used throughout the MSX-DOS 2 system to refer to a par- +ticular error. + + + 6.1 DISK ERRORS + + + The errors in this group are those which are usually passed to disk error +handling routines. By default they will be reported as "Abort, Retry" errors. +These errors except the one from "format disk" will be passed to the error +handling routine, so they will not be returned as the return value from BDOS. + + + +Incompatible disk (.NCOMP, 0FFh) + + The disk cannot be accessed in that drive (eg. a double sided disk in a +single sided drive). + + + +Write error (.WRERR, 0FEh) + + General error occurred during a disk write. + + + +Disk error (.DISK, 0FDh) + + General unknown disk error occurred. + + + +Not ready (.NRDY, 0FCh) + + Disk drive did not respond, usually means there is no disk in the drive. + + + +Verify error (.VERFY, 0FBh) + + With VERIFY enabled, a sector could not be read correctly after being +written. + + + +Data error (.DATA, 0FAh) + + A disk sector could not be read because the CRC error checking was inco- +rrect, usually indicating a damaged disk. + + + +Sector not found (.RNF, 0F9h) + + The required sector could not be found on the disk, usually means a dama- +ged disk. + + + +Write protected disk (.WPROT, 0F8h) + + Attempt to write to a disk with the write protect tab on. + + + +Unformatted disk (.UFORM, 0F7h) + + The disk has not been formatted, or it is a disk using a different recor- +ding technique. + + + +Not a DOS disk (.NDOS, 0F6h) + + The disk is formatted for another operating system and cannot be accessed +by MSX-DOS. + + + +Wrong disk (.WDISK, 0F5h) + + The disk has been changed while MSX-DOS was accessing it. Must replace the +correct disk. + + + +Wrong disk for file (.WFILE, 0F4h) + + The disk has been changed while there is an open file on it. Must replace +the correct disk. + + + +Seek error (.SEEK, 0F3h) + + The required track of the disk could not be found. + + + +Bad file allocation table (.IFAT, 0F2h) + + The file allocation table on the disk has got corrupted. CHKDSK may be +able to recover some of the data on the disk. + + + +(.NOUPB, 0F1h) + + This error has no message because it is always trapped internally in +MSX-DOS as part of the disk change handling. + + + +Cannot format this drive (.IFORM, 0F0h) + + Attempt to format a drive which does not allow formatting. Usually as a +result of trying to format the RAM disk. + + + + 6.2 MSX-DOS FUNCTION ERRORS + + + The following errors are those which are normally returned from MSX-DOS +function calls. See the Function Specification document for details of errors +from particular MSX-DOS functions. + + + +Internal error (.INTER, 0DFh) + + Should never occur. + + + +Not enough memory (.NORAM, 0DEh) + + MSX-DOS has run out of memory in its 16k kernel data segment. Try reducing +the number of sector buffers or removing some environment strings. Also oc- +curs if there are no free segments for creating the RAMdisk. + + + +Invalid MSX-DOS call (.IBDOS, 0DCh) + + An MSX-DOS call was made with an illegal function number. Most illegal +function calls return no error, but this error may be returned if a "get +previous error code" function call is made. + + + +Invalid drive (.IDRV, 0DBh) + + A drive number parameter, or a drive letter in a drive/path/file string is +one which does not exist in the current system. + + + +Invalid filename (.IFNM, 0DAh) + + A filename string is illegal. This is only generated for pure filename +strings, not drive/path/file strings. + + + +Invalid pathname (.IPATH, 0D9h) + + Can be returned by any function call which is given an ASCIIZ +drive/path/file string. Indicates that the syntax of the string is incorrect +in some way. + + + +Pathname too long (.PLONG, 0D8h) + + Can be returned by any function call which is given an ASCIIZ +drive/path/file string. Indicates that the complete path being specified +(including current directory if used) is longer than 63 characters. + + + +File not found (.NOFIL, 0D7h) + + Can be returned by any function which looks for files on a disk if it does +not find one. This error is also returned if a directory was specified but +not found. In other cases, .NODIR error (see below) will be returned. + + + +Directory not found (.NODIR, 0D6h) + + Returned if a directory item in a drive/path/file string could not be +found. + + + +Root directory full (.DRFUL, 0D5h) + + Returned by "create" or "move" if a new entry is required in the root +directory and it is already full. The root directory cannot be extended. + + + +Disk full (.DKFUL, 0D4h) + + Usually results from a write operation if there was insufficient room on +the disk for the amount of data being written. May also result from trying to +create or extend a sub-directory if the disk is completely full. + + + +Duplicate filename (.DUPF, 0D3h) + + Results from "rename" or "move" if the destination filename already exists +in the destination directory. + + + +Invalid directory move (.DIRE, 0D2h) + + Results from an attempt to move a sub-directory into one of its own des- +cendants. This is not allowed as it would create an isolated loop in the +directory structure. + + + +Read only file (.FILRO, 0D1h) + + Attempt to write to or delete a file which has the "read only" attribute +bit set. + + + +Directory not empty (.DIRNE, 0D0h) + + Attempt to delete a sub-directory which is not empty. + + + +Invalid attributes (.IATTR, 0CFh) + + Can result from an attempt to change a file's attributes in an illegal +way, or trying to do an operation on a file which is only possible on a sub- +directory. Also results from illegal use of volume name fileinfo blocks. + + + +Invalid . or .. operation (.DOT, 0CEh) + + Attempt to do an illegal operation on the "." or ".." entries in a sub- +directory, such as rename or move them. + + + +System file exists (.SYSX, 0CDh) + + Attempt to create a file or sub-directory of the same name as an existing +system file. System files are not automatically deleted. + + + +Directory exists (.DIRX, 0CCh) + + Attempt to create a file or sub-directory of the same name as an existing +sub-directory. Sub-directories are not automatically deleted. + + + +File exists (.FILEX, 0CBh) + + Attempt to create a sub-directory of the same name as an existing file. +Files are not automatically deleted when creating sub-directories. + + + +File already in use (.FOPEN, 0CAh) + + Attempt to delete, rename, move, or change the attributes or date and time +of a file which has a file handle already open to it, other than by using the +file handle itself. + + + +Cannot transfer above 64K (.OV64K, 0C9h) + + Disk transfer area would have extended above 0FFFFh. + + + +File allocation error (.FILE, 0C8h) + + The cluster chain for a file was corrupt. Use CHKDSK to recover as much of +the file as possible. + + + +End of file (.EOF, 0C7h) + + Attempt to read from a file when the file pointer is already at or beyond +the end of file. + + + +File access violation (.ACCV, 0C6h) + + Attempt to read or write to a file handle which was opened with the appro- +priate access bit set. Some of the standard file handles are opened in read +only or write only mode. + + + +Invalid process id (.IPROC, 0C5h) + + Process id number passed to "join" function is invalid. + + + +No spare file handles (.NHAND, 0C4h) + + Attempt to open or create a file handle when all file handles are already +in use. There are 64 file handles available in the current version. + + + +Invalid file handle (.IHAND, 0C3h) + + The specified file handle is greater than the maximum allowed file handle +number. + + + +File handle not open (.NOPEN, 0C2h) + + The specified file handle is not currently open. + + + +Invalid device operation (.IDEV, 0C1h) + + Attempt to use a device file handle or fileinfo block for an invalid ope- +ration such as searching in it or moving it. + + + +Invalid environment string (.IENV, 0C0h) + + Environment item name string contains an invalid character. + + + +Environment string too long (.ELONG, 0BFh) + + Environment item name or value string is either longer than the maximum +allowed length of 255, or is too long for the user's buffer. + + + +Invalid date (.IDATE, 0BEh) + + Date parameters passed to "set date" are invalid. + + + +Invalid time (.ITIME, 0BDh) + + Time parameters passed to "set time" are invalid. + + + +RAM disk (drive H:) already exists (.RAMDX, 0BCh) + + Returned from the "ramdisk" function if trying to create a RAM disk when +one already exists. + + + +RAM disk does not exist (.NRAMD, 0BBh) + + Attempt to delete the RAM disk when it does not currently exist. A func- +tion which tries to access a non-existent RAM disk will get a .IDRV error. + + + +File handle has been deleted (.HDEAD, 0BAh) + + The file associate with a file handle has been deleted so the file handle +can no longer be used. + + + +(.EOL, 0B9h) + + Internal error should never occur. + + + +Invalid sub-function number (.ISBFN, 0B8h) + + The sub-function number passed to the IOCTL function (function 4Bh) was +invalid. + + + + 6.3 PROGRAM TERMINATION ERRORS + + + The following errors are those which may be generated internally in the +system and passed to "abort" routines. They will not normally be returned +from function calls. Note that an abort routine can also be passed any error +which a transient program passes to the "terminate with error code" function +call. + + + +Ctrl-STOP pressed (.STOP, 09Fh) + + The Ctrl-STOP key is tested in almost all places in the system including +all character I/O. + + + +Ctrl-C pressed (.CTRLC, 09Eh) + + Ctrl-C is only tested for on those character functions which specify sta- +tus checks. + + + +Disk operation aborted (.ABORT, 09Dh) + + This error occurs when any disk error is aborted by the user or automati- +cally by the system. The original disk error code will be passed to the abort +routine in B as the secondary error code. + + + +Error on standard output (.OUTERR, 09Ch) + + Returned if any error occurred on a standard output channel while it was +being accessed through the character functions (functions 01h...0Bh). The +original error code is passed to the abort routine in register B as the se- +condary error code. This error will normally only occur if a program has +altered the standard file handles. + + + +Error on standard input (.INERR, 09Bh) + + Returned if any error occurred on a standard input channel while it was +being accessed through the character functions (functions 01h...0Bh). The +original error code is passed to the abort routine in register B as the se- +condaryerror code. The most likely error is end of file (.EOF). This error +will normally only occur if a program has altered the standard file handles. + + + + 6.4 COMMAND ERRORS + + + The following errors will not be returned from an MSX-DOS function call, +but are used by the command interpreter. They are included here because a +transient program may find it useful to return some of them. The "Command +Specification" document gives more details of what these errors means from +the command interpreter. + + + +Wrong version of COMMAND (.BADCOM, 08Fh) + + COMMAND2.COM loaded it's transient part from disk but it's checksum was +not what was expected. + + + +Unrecognized command (.BADCM, 08Eh) + + A given command was not an internal command and a .COM or .BAT file was +not found with the same name. + + + +Command too long (.BUFUL, 08Dh) + + The command in a batch file exceeded 127 characters in length. + + + +(.OKCMD, 08Ch) + + An internal error used after executing a command passed to COMMAND2.COM on +the command line. (There is no message for this error code.) + + + +Invalid parameter (.IPARM, 08Bh) + + The parameter to a command was invalid in some way eg. a number out of +range. + + + +Too many parameters (.INP, 08Ah) + + After parsing all the parameters required for a command, there were still +more non-separator characters on the command line. + + + +Missing parameter (.NOPAR, 089h) + + Where a parameter was expected the end of line was found. + + + +Invalid option (.IOPT, 088h) + + The letter given after a / on the command line was invalid for that +command. + + + +Invalid number (.BADNO, 087h) + + Non-digit characters appeared where a number was expected. + + + +File for HELP not found (.NOHELP, 086h) + + The help file was not found or the parameter was not a valid HELP +parameter. + + + +Wrong version of MSX-DOS (.BADVER, 085h) + + This error is never used by the command interpreter, it has its own inter- +nal message for this error. However it is provided for transient programs +which may find it useful to return this error. + + + +Cannot concatenate destination file (.NOCAT, 084h) + + The destination file in CONCAT is matched by the source specification. + + + +Cannot create destination file (.BADEST, 083h) + + In COPY, creating the destination file would overwrite one of the source +files (or another file that is already in use). + + + +File cannot be copied onto itself (.COPY, 082h) + + In COPY, the destination file if created would overwrite the source file. + + + +Cannot overwrite previous destination file (.OVDEST, 081h) + + In COPY, an ambiguous source was specified with a non-ambiguous, +non-directory, non-device destination. diff --git a/info/DRIVER.ASM b/docs/DRIVER.ASM similarity index 89% rename from info/DRIVER.ASM rename to docs/DRIVER.ASM index 0f4d3ca9..3daaf7ec 100644 --- a/info/DRIVER.ASM +++ b/docs/DRIVER.ASM @@ -1,649 +1,693 @@ - ; Dummy disk driver for Nextor 2.0 - ; By Konamiman, 2/2014 - ; - ; This code can be used as the basis for developing - ; a real disk driver: just set DRV_TYPE appropriately, - ; change the driver name and version at DRV_NAME and VER_*, and - ; implement the required routines depending on the driver type. - ; - ; See the Nextor driver development guide for more details. - - ;org 4100h - - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Miscellaneous constants -; - -;This is a 2 byte buffer to store the address of code to be executed. -;It is used by some of the kernel page 0 routines. - -CODE_ADD: equ 0F84Ch - - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL equ 0B5h -.IPARM equ 08Bh - -endif - - -;----------------------------------------------------------------------------- -; -; Routines and information available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a, -; ld hl, -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel main bank -; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), -; then invokes the routine whose address is at (CODE_ADD). -; It is necessary to use this routine to invoke CALBAS -; (so that kernel bank is correct in case of BASIC error) -; and to invoke DOS functions via F37Dh hook. -; -; Input: Address of code to invoke in (CODE_ADD). -; AF, BC, DE, HL, IX, IY passed to the called routine. -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALLB0 equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; -; Input: A = bank number -; IX = routine address -; AF' = AF for the routine -; HL' = Ix for the routine -; BC, DE, HL, IY = input for the routine -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a, (xor a for current page 1 slot) -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* This address contains one byte that tells how many banks -; form the Nextor kernel (or alternatively, the first bank -; number of the driver). - -K_SIZE equ 40FEh - - -;* This address contains one byte with the current bank number. - -CUR_BANK equ 40FFh - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 781Fh ;Null string (disk can't be formatted) -SING_DBL equ 7820h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "NEXTOR_DRIVER",0 - - -;----------------------------------------------------------------------------- -; -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1 -endif - - -;----------------------------------------------------------------------------- -; -; Reserved byte -; - - db 0 - - -;----------------------------------------------------------------------------- -; -; Driver name -; - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - - -;----------------------------------------------------------------------------- -; -; Jump table for the driver public routines -; - - ; These routines are mandatory for all drivers - ; (but probably you need to implement only DRV_INIT) - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - - ; These routines are mandatory for drive-based drivers - - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - - ; These routines are mandatory for device-based drivers - - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO -endif - - -;===== -;===== END of data that must be at fixed addresses -;===== - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization routine, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7850h, 7853h, 7856h, 7859h and 785Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; C = First sector number to read/write (bits 22-16) if bit 7 = 0 -; Media ID if bit 7 = 1 -; DE = First sector number to read/write (bits 15-0) -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors -; B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical -; units (which is functionally equivalent to having only one). -;+1 (1): Device flags, always zero in Beta 2. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. -; -; The returned status is always relative to the previous invokation of -; DEV_STATUS itself. Please read the Driver Developer Guide for more info. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; End of the driver code - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end + ; Dummy disk driver for Nextor 2.0 + ; By Konamiman, 8/2018 + ; + ; This code can be used as the basis for developing + ; a real disk driver: just set DRV_TYPE appropriately, + ; change the driver name and version at DRV_NAME and VER_*, and + ; implement the required routines depending on the driver type. + ; + ; See the Nextor driver development guide for more details. + + ;org 4100h + + +DRV_START: + +;----------------------------------------------------------------------------- +; +; Miscellaneous constants +; + +;This is a 2 byte buffer to store the address of code to be executed. +;It is used by some of the kernel page 0 routines. + +CODE_ADD: equ 0F84Ch + + +;----------------------------------------------------------------------------- +; +; Driver configuration constants +; + +;Driver type: +; 0 for drive-based +; 1 for device-based + +DRV_TYPE equ 0 + + +;Driver version + +VER_MAIN equ 1 +VER_SEC equ 0 +VER_REV equ 0 + + +;----------------------------------------------------------------------------- +; +; Error codes for DEV_RW +; + +if DRV_TYPE eq 1 + +.NCOMP equ 0FFh +.WRERR equ 0FEh +.DISK equ 0FDh +.NRDY equ 0FCh +.DATA equ 0FAh +.RNF equ 0F9h +.WPROT equ 0F8h +.UFORM equ 0F7h +.SEEK equ 0F3h +.IFORM equ 0F0h +.IDEVL equ 0B5h +.IPARM equ 08Bh + +endif + + +;----------------------------------------------------------------------------- +; +; Routines and information available on kernel page 0 +; + +;* Get in A the current slot for page 1. Corrupts F. +; Must be called by using CALBNK to bank 0: +; xor a +; ld ix,GSLOT1 +; call CALBNK + +GSLOT1 equ 402Dh + + +;* This routine reads a byte from another bank. +; Must be called by using CALBNK to the desired bank, +; passing the address to be read in HL: +; ld a, +; ld hl, +; ld ix,RDBANK +; call CALBNK + +RDBANK equ 403Ch + + +;* This routine temporarily switches kernel main bank +; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), +; then invokes the routine whose address is at (CODE_ADD). +; It is necessary to use this routine to invoke CALBAS +; (so that kernel bank is correct in case of BASIC error) +; and to invoke DOS functions via F37Dh hook. +; +; Input: Address of code to invoke in (CODE_ADD). +; AF, BC, DE, HL, IX, IY passed to the called routine. +; Output: AF, BC, DE, HL, IX, IY returned from the called routine. + +CALLB0 equ 403Fh + + +;* Call a routine in another bank. +; Must be used if the driver spawns across more than one bank. +; +; Input: A = bank number +; IX = routine address +; AF' = AF for the routine +; HL' = Ix for the routine +; BC, DE, HL, IY = input for the routine +; Output: AF, BC, DE, HL, IX, IY returned from the called routine. + +CALBNK equ 4042h + + +;* Get in IX the address of the SLTWRK entry for the slot passed in A, +; which will in turn contain a pointer to the allocated page 3 +; work area for that slot (0 if no work area was allocated). +; If A=0, then it uses the slot currently switched in page 1. +; Returns A=current slot for page 1, if A=0 was passed. +; Corrupts F. +; Must be called by using CALBNK to bank 0: +; ld a, (xor a for current page 1 slot) +; ex af,af' +; xor a +; ld ix,GWORK +; call CALBNK + +GWORK equ 4045h + + +;* This address contains one byte that tells how many banks +; form the Nextor kernel (or alternatively, the first bank +; number of the driver). + +K_SIZE equ 40FEh + + +;* This address contains one byte with the current bank number. + +CUR_BANK equ 40FFh + + +;----------------------------------------------------------------------------- +; +; Built-in format choice strings +; + +NULL_MSG equ 781Fh ;Null string (disk can't be formatted) +SING_DBL equ 7820h ;"1-Single side / 2-Double side" + + +;----------------------------------------------------------------------------- +; +; Driver signature +; + db "NEXTOR_DRIVER",0 + + +;----------------------------------------------------------------------------- +; +; Driver flags: +; bit 0: 0 for drive-based, 1 for device-based +; bit 2: 1 if the driver implements the DRV_CONFIG routine +; (used by Nextor from v2.0.5) + +if DRV_TYPE eq 0 + db 0+4 +endif + +if DRV_TYPE eq 1 + db 1+4 +endif + + +;----------------------------------------------------------------------------- +; +; Reserved byte +; + + db 0 + + +;----------------------------------------------------------------------------- +; +; Driver name +; + +DRV_NAME: + db "Dummy driver" + ds 32-($-DRV_NAME)," " + + +;----------------------------------------------------------------------------- +; +; Jump table for the driver public routines +; + + ; These routines are mandatory for all drivers + ; (but probably you need to implement only DRV_INIT) + + jp DRV_TIMI + jp DRV_VERSION + jp DRV_INIT + jp DRV_BASSTAT + jp DRV_BASDEV + jp DRV_EXTBIO + jp DRV_DIRECT0 + jp DRV_DIRECT1 + jp DRV_DIRECT2 + jp DRV_DIRECT3 + jp DRV_DIRECT4 + jp DRV_CONFIG + + ds 12 + +if DRV_TYPE eq 0 + +; These routines are mandatory for drive-based drivers + + jp DRV_DSKIO + jp DRV_DSKCHG + jp DRV_GETDPB + jp DRV_CHOICE + jp DRV_DSKFMT + jp DRV_MTOFF +endif + +if DRV_TYPE eq 1 + + ; These routines are mandatory for device-based drivers + + jp DEV_RW + jp DEV_INFO + jp DEV_STATUS + jp LUN_INFO +endif + + +;===== +;===== END of data that must be at fixed addresses +;===== + + +;----------------------------------------------------------------------------- +; +; Timer interrupt routine, it will be called on each timer interrupt +; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. + +DRV_TIMI: + ret + + +;----------------------------------------------------------------------------- +; +; Driver initialization routine, it is called twice: +; +; 1) First execution, for information gathering. +; Input: +; A = 0 +; B = number of available drives +; HL = maximum size of allocatable work area in page 3 +; C: bit 5 set if user is requesting reduced drive count +; (by pressing the 5 key) +; Output: +; A = number of required drives (for drive-based driver only) +; HL = size of required work area in page 3 +; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise +; +; 2) Second execution, for work area and hardware initialization. +; Input: +; A = 1 +; B = number of allocated drives for this controller +; C: bit 5 set if user is requesting reduced drive count +; (by pressing the 5 key) +; +; The work area address can be obtained by using GWORK. +; +; If first execution requests more work area than available, +; second execution will not be done and DRV_TIMI will not be hooked +; to the timer interrupt. +; +; If first execution requests more drives than available, +; as many drives as possible will be allocated, and the initialization +; procedure will continue the normal way +; (for drive-based drivers only. Device-based drivers always +; get two allocated drives.) + +DRV_INIT: + xor a + ld hl,0 + ret + + +;----------------------------------------------------------------------------- +; +; Obtain driver version +; +; Input: - +; Output: A = Main version number +; B = Secondary version number +; C = Revision number + +DRV_VERSION: + ld a,VER_MAIN + ld b,VER_SEC + ld c,VER_REV + ret + + +;----------------------------------------------------------------------------- +; +; BASIC expanded statement ("CALL") handler. +; Works the expected way, except that if invoking CALBAS is needed, +; it must be done via the CALLB0 routine in kernel page 0. + +DRV_BASSTAT: + scf + ret + + +;----------------------------------------------------------------------------- +; +; BASIC expanded device handler. +; Works the expected way, except that if invoking CALBAS is needed, +; it must be done via the CALLB0 routine in kernel page 0. + +DRV_BASDEV: + scf + ret + + +;----------------------------------------------------------------------------- +; +; Extended BIOS hook. +; Works the expected way, except that it must return +; D'=1 if the old hook must be called, D'=0 otherwise. +; It is entered with D'=1. + +DRV_EXTBIO: + ret + + +;----------------------------------------------------------------------------- +; +; Direct calls entry points. +; Calls to addresses 7850h, 7853h, 7856h, 7859h and 785Ch +; in kernel banks 0 and 3 will be redirected +; to DIRECT0/1/2/3/4 respectively. +; Receives all register data from the caller except IX and AF'. + +DRV_DIRECT0: +DRV_DIRECT1: +DRV_DIRECT2: +DRV_DIRECT3: +DRV_DIRECT4: + ret + + +;----------------------------------------------------------------------------- +; +; Get driver configuration +; (bit 2 of driver flags must be set if this routine is implemented) +; +; Input: +; A = Configuration index +; BC, DE, HL = Depends on the configuration +; +; Output: +; A = 0: Ok +; 1: Configuration not available for the supplied index +; BC, DE, HL = Depends on the configuration +; +; * Get number of drives at boot time (for device-based drivers only): +; Input: +; A = 1 +; B = 0 for DOS 2 mode, 1 for DOS 1 mode +; C: bit 5 set if user is requesting reduced drive count +; (by pressing the 5 key) +; Output: +; B = number of drives +; +; * Get default configuration for drive +; Input: +; A = 2 +; B = 0 for DOS 2 mode, 1 for DOS 1 mode +; C = Relative drive number at boot time +; Output: +; B = Device index +; C = LUN index + +DRV_CONFIG: + ld a,1 + ret + + +;===== +;===== BEGIN of DRIVE-BASED specific routines +;===== + +if DRV_TYPE eq 0 + +;----------------------------------------------------------------------------- +; +; Read/write disk sectors +; +;Input: A = Drive number, starting at 0 +; Cy = 0 for reading sectors, 1 for writing sectors +; B = Number of sectors to read/write +; C = First sector number to read/write (bits 22-16) if bit 7 = 0 +; Media ID if bit 7 = 1 +; DE = First sector number to read/write (bits 15-0) +; HL = source/destination address for the transfer +;Output: Cy = 0 on success, 1 on error +; A = Error code (on error only): +; 0 Write protected +; 2 Not ready +; 4 Data (CRC) error +; 6 Seek error +; 8 Record not found +; 10 Write fault +; 12 Other errors +; B = Number of sectors actually read (in case of error only) + +DRV_DSKIO: + ld a,12 + scf + ret + + +;----------------------------------------------------------------------------- +; +; Get disk change status +; +;Input: A = Drive number, starting at 0 +; B = C = Media descriptor +; HL = Base address for DPB -1 +;Output: Cy = 0 on success, 1 on error +; A = Error code (on error only) +; Same codes as DRV_DSKIO +; B = Disk status (on success only) +; 1 Disk not changed +; 0 Unknown +; -1 Disk changed + +DRV_DSKCHG: + ld a,12 + scf + ret + + +;----------------------------------------------------------------------------- +; +; Get DPB for disk +; +;Input: A = Drive number, starting at 0 +; B = C = Media descriptor +; HL = Base address for DPB -1 +;Output: - + +DRV_GETDPB: + ld a,12 + scf + ret + + +;----------------------------------------------------------------------------- +; +; Return format choice string +; +;Input: - +;Output: HL = Address of the choice string in the kernel slot + +DRV_CHOICE: + ld hl,NULL_MSG + ret + + +;----------------------------------------------------------------------------- +; +; Format a disk +; +;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). +; D = Drive number, starting at 0 +; HL = Address of work area in memory +; DE = Size of work area +;Output: Cy = 0 on success, 1 on error +; A = Error code (on error only): +; 0 Write protected +; 2 Not ready +; 4 Data (CRC) error +; 6 Seek error +; 8 Record not found +; 10 Write fault +; 12 Bad parameter +; 14 Insufficient memory +; 16 Other errors + +DRV_DSKFMT: + ld a,16 + scf + ret + + +;----------------------------------------------------------------------------- +; +; Turn off the floppy disk drive motor +; +;Input: - +;Output: - + +DRV_MTOFF: + ret + +endif + + +;===== +;===== END of DRIVE-BASED specific routines +;===== + + +;===== +;===== BEGIN of DEVICE-BASED specific routines +;===== + +if DRV_TYPE eq 1 + +;----------------------------------------------------------------------------- +; +; Read or write logical sectors from/to a logical unit +; +;Input: Cy=0 to read, 1 to write +; A = Device number, 1 to 7 +; B = Number of sectors to read or write +; C = Logical unit number, 1 to 7 +; HL = Source or destination memory address for the transfer +; DE = Address where the 4 byte sector number is stored. +;Output: A = Error code (the same codes of MSX-DOS are used): +; 0: Ok +; .IDEVL: Invalid device or LUN +; .NRDY: Not ready +; .DISK: General unknown disk error +; .DATA: CRC error when reading +; .RNF: Sector not found +; .UFORM: Unformatted disk +; .WPROT: Write protected media, or read-only logical unit +; .WRERR: Write error +; .NCOMP: Incompatible disk. +; .SEEK: Seek error. + B = Number of sectors actually read (in case of error only) + +DEV_RW: + ld a,.NRDY + ld b,0 + ret + + +;----------------------------------------------------------------------------- +; +; Device information gathering +; +;Input: A = Device index, 1 to 7 +; B = Information to return: +; 0: Basic information +; 1: Manufacturer name string +; 2: Device name string +; 3: Serial number string +; HL = Pointer to a buffer in RAM +;Output: A = Error code: +; 0: Ok +; 1: Device not available or invalid device index +; 2: Information not available, or invalid information index +; When basic information is requested, +; buffer filled with the following information: +; +;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical +; units (which is functionally equivalent to having only one). +;+1 (1): Device flags, always zero in Beta 2. +; +; The strings must be printable ASCII string (ASCII codes 32 to 126), +; left justified and padded with spaces. All the strings are optional, +; if not available, an error must be returned. +; If a string is provided by the device in binary format, it must be reported +; as an hexadecimal, upper-cased string, preceded by the prefix "0x". +; The maximum length for a string is 64 characters; +; if the string is actually longer, the leftmost 64 characters +; should be provided. +; +; In the case of the serial number string, the same rules for the strings +; apply, except that it must be provided right-justified, +; and if it is too long, the rightmost characters must be +; provided, not the leftmost. + +DEV_INFO: + ld a,1 + ret + + +;----------------------------------------------------------------------------- +; +; Obtain device status +; +;Input: A = Device index, 1 to 7 +; B = Logical unit number, 1 to 7 +; 0 to return the status of the device itself. +;Output: A = Status for the specified logical unit, +; or for the whole device if 0 was specified: +; 0: The device or logical unit is not available, or the +; device or logical unit number supplied is invalid. +; 1: The device or logical unit is available and has not +; changed since the last status request. +; 2: The device or logical unit is available and has changed +; since the last status request +; (for devices, the device has been unplugged and a +; different device has been plugged which has been +; assigned the same device index; for logical units, +; the media has been changed). +; 3: The device or logical unit is available, but it is not +; possible to determine whether it has been changed +; or not since the last status request. +; +; Devices not supporting hot-plugging must always return status value 1. +; Non removable logical units may return values 0 and 1. +; +; The returned status is always relative to the previous invokation of +; DEV_STATUS itself. Please read the Driver Developer Guide for more info. + +DEV_STATUS: + xor a + ret + + +;----------------------------------------------------------------------------- +; +; Obtain logical unit information +; +;Input: A = Device index, 1 to 7 +; B = Logical unit number, 1 to 7 +; HL = Pointer to buffer in RAM. +;Output: A = 0: Ok, buffer filled with information. +; 1: Error, device or logical unit not available, +; or device index or logical unit number invalid. +; On success, buffer filled with the following information: +; +;+0 (1): Medium type: +; 0: Block device +; 1: CD or DVD reader or recorder +; 2-254: Unused. Additional codes may be defined in the future. +; 255: Other +;+1 (2): Sector size, 0 if this information does not apply or is +; not available. +;+3 (4): Total number of available sectors. +; 0 if this information does not apply or is not available. +;+7 (1): Flags: +; bit 0: 1 if the medium is removable. +; bit 1: 1 if the medium is read only. A medium that can dinamically +; be write protected or write enabled is not considered +; to be read-only. +; bit 2: 1 if the LUN is a floppy disk drive. +;+8 (2): Number of cylinders +;+10 (1): Number of heads +;+11 (1): Number of sectors per track +; +; Number of cylinders, heads and sectors apply to hard disks only. +; For other types of device, these fields must be zero. + +LUN_INFO: + ld a,1 + ret + +endif + + +;===== +;===== END of DEVICE-BASED specific routines +;===== + + +;----------------------------------------------------------------------------- +; +; End of the driver code + +DRV_END: + + ;ds 3FD0h-(DRV_END-DRV_START) + + end diff --git a/docs/Nextor 2.1 Driver Development Guide.md b/docs/Nextor 2.1 Driver Development Guide.md new file mode 100644 index 00000000..b32343d2 --- /dev/null +++ b/docs/Nextor 2.1 Driver Development Guide.md @@ -0,0 +1,1023 @@ +# Nextor 2.1 Driver Development Guide + +## Index + +[1. Introduction](#1-introduction) + +[2. The Nextor kernel architecture](#2-the-nextor-kernel-architecture) + +[2.1. The MSX-DOS 1 kernel](#21-the-msx-dos-1-kernel) + +[2.2. The MSX-DOS 2 kernel](#22-the-msx-dos-2-kernel) + +[2.3. The Nextor kernel](#23-the-nextor-kernel) + +[3. Creating a Nextor kernel with embedded driver](#3-creating-a-nextor-kernel-with-embedded-driver) + +[3.1. Manual creation](#31-manual-creation) + +[3.2. Using the MKNEXROM utility](#32-using-the-mknexrom-utility) + +[3.3. Rules for the bank switching code](#33-rules-for-the-bank-switching-code) + +[4. Nextor driver structure](#4-nextor-driver-structure) + +[4.1. Drive-based and device-based drivers](#41-drive-based-and-device-based-drivers) + +[4.2. Page 0 routines and data](#42-page-0-routines-and-data) + +[4.2.1. GSLOT1 (402Dh)](#421-gslot1-402dh) + +[4.2.2. RDBANK (403Ch)](#422-rdbank-403ch) + +[4.2.3. CALLB0 (403Fh)](#423-callb0-403fh) + +[4.2.4. CALBNK (4042h)](#424-calbnk-4042h) + +[4.2.5. GWORK (4045h)](#425-gwork-4045h) + +[4.2.6. K_SIZE (40FEh)](#426-k_size-40feh) + +[4.2.7. CUR_BANK (40FFh)](#427-cur_bank-40ffh) + +[4.2.8. CHGBNK (7FD0h)](#428-chgbnk-7fd0h) + +[4.3. The driver header](#43-the-driver-header) + +[4.3.1. DRV_SIGN (4100h)](#431-drv_sign-4100h) + +[4.3.2. DRV_FLAGS (410Eh)](#432-drv_flags-410eh) + +[4.3.3. RESERVED (410Fh)](#433-reserved-410fh) + +[4.3.4. DRV_NAME (4110h)](#434-drv_name-4110h) + +[4.4. Common routines](#44-common-routines) + +[4.4.1. DRV_TIMI (4130h)](#441-drv_timi-4130h) + +[4.4.2. DRV_VERSION (4133h)](#442-drv_version-4133h) + +[4.4.3. DRV_INIT (4136h)](#443-drv_init-4136h) + +[4.4.4. DRV_BASSTAT (4139h)](#444-drv_basstat-4139h) + +[4.4.5. DRV_BASDEV (413Ch)](#445-drv_basdev-413ch) + +[4.4.6. DRV_EXTBIO (413Fh)](#446-drv_extbio-413fh) + +[4.4.7. DRV_DIRECT0/1/2/3/4 (4142h, 4145h, 4148h, 414Bh, 414Eh)](#447-drv_direct01234-4142h-4145h-4148h-414bh-414eh) + +[4.4.8. DRV_CONFIG (4151h)](#448-drv_config-4151h) + +[4.4.9. RESERVED (4155h to 415Fh)](#449-reserved-4155h-to-415fh) + +[4.5. Routines for drive-based drivers](#45-routines-for-drive-based-drivers) + +[4.5.1. DRV_DSKIO (4160h)](#451-drv_dskio-4160h) + +[4.5.2. DRV_DSKCHG (4163h)](#452-drv_dskchg-4163h) + +[4.5.3. DRV_GETDPB (4166h)](#453-drv_getdpb-4166h) + +[4.5.4. DRV_CHOICE (4169h)](#454-drv_choice-4169h) + +[4.5.5. DRV_FORMAT (416Ch)](#455-drv_format-416ch) + +[4.5.6. DRV_MTOFF (416Fh)](#456-drv_mtoff-416fh) + +[4.6. Routines for device-based drivers](#46-routines-for-device-based-drivers) + +[4.6.1. DEV_RW (4160h)](#461-dev_rw-4160h) + +[4.6.2. DEV_INFO (4163h)](#462-dev_info-4163h) + +[4.6.3. DEV_STATUS (4166h)](#463-dev_status-4166h) + +[4.6.4. LUN_INFO (4169h)](#464-lun_info-4169h) + +[4.7. Other](#47-other) + +[4.7.1. The free space at kernel main bank](#471-the-free-space-at-kernel-main-bank) + +[5. Change history](#5-change-history) + +[5.1. v2.1.0 beta 1](#51-v210-beta-1) + + +## 1. Introduction + +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 complete guide for programmers willing to develop storage device drivers for Nextor. It is a good idea to get acquainted with Nextor by reading _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ prior to this document. Also, although not strictly necessary, it is recommended to take a look at the _[Nextor 2.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ document, which is a reference of the new features that Nextor adds to MSX-DOS 2 from a developer point of view other that the driver development. + +## 2. The Nextor kernel architecture + +This section explains some basic concepts about the Nextor kernel architecture, including a short explanation on how the MSX-DOS kernel worked and how things have changed in Nextor. The information provided will help driver developers to understand the context in which the driver code is executed. + +### 2.1. The MSX-DOS 1 kernel + +The original MSX-DOS kernel (labeled as version 1) was present as a ROM embedded in the external MSX floppy disk controllers first, and later as an internal ROM in the MSX computers with built-in floppy disk drive as well. It is a 16K ROM that uses the page 1 address space (addresses 4000h to 7FFFh) of its slot. + +The MSX-DOS 1 kernel is divided in two main parts: + +* The kernel common code. It contains the hardware-independent code, such as the code for all the function calls or the FAT filesystem management code. Most of the code in the ROM accounts for this part. + +* The disk driver. This is the code that physically accesses the massive storage devices, mainly to read and write disk sectors, as requested by the kernel code when necessary. It consists of a series of routines with standardized input and output parameters. + +The kernel common code part is not 100% driver independent. It contains a couple of points that must be patched depending on the disk driver used: one that specifies how many driver units will be controlled by the driver, and another one that specifies how many page 3 work area is needed by the driver. + +Figure 1 shows a diagram with the structure of a MSX-DOS 1 kernel. + +``` +4000h +---------------------+ + | | + | | + | | + | Kernel | + | common code | + | | + | | + +---------------------+ + | | + | Disk driver | + | | +7FFFh +---------------------+ +``` + +_Figure 1 - MSX-DOS 1 kernel structure_ + +A MSX computer can have up to four MSX-DOS kernel ROMs active. If more than one is present, then the one with the smallest slot number becomes the "master" (the one whose kernel common code is actually executed), and the others are the "slaves" (only their driver code is executed). + +MSX-DOS views the storage devices as drive letters, while the disk driver presents one or more driver units. The mapping between both entities is fixed and one-by-one, so for example drive A: is mapped to driver unit 0 of the first kernel, drive B: is mapped to driver unit 1, and so on. + +### 2.2. The MSX-DOS 2 kernel + +The MSX-DOS 2 kernel first appeared as a cartridge with no associated storage hardware, and it was intended to be used together with existing storage controllers associated to MSX-DOS 1 kernel. Later it was included internally in MSX Turbo-R computers. + +The MSX-DOS 2 kernel uses the page 1 address space of its slot, as the MSX-DOS 1 kernel does. However the MSX-DOS 2 kernel has a size of 64K. This space is divided in four 16K banks and a bank mapping mechanism is used so that only one of the banks is visible at the same time. The contents of the banks are as follows: + +* Bank 0 contains kernel common code and the disk driver code. + +* Banks 1 and 2 contain kernel common code. + +* Bank 3 contains a copy of the MSX-DOS 1 kernel, with a copy of the disk driver code (only in MSX Turbo-R machines). + +Figure 2 shows a diagram with the structure of a MSX-DOS 2 kernel. + +``` + Bank 0 Banks 1 and 2 Bank 3 +4000h +---------------------+---------------------+---------------------+ + | Page 0 code | Page 0 code | | +40FFh +---------------------+---------------------+ | + | 0 (bank ID) | 1/2 (bank ID) | | +4100h +---------------------+---------------------+ | + | | | | + | Bank 0 | Banks 1/2 | Bank 3 | + | kernel code | kernel code | kernel code | + | | | (MSX-DOS 1 kernel) | + | | | | + +---------------------+ |---------------------+ + | | | | + | Disk driver | | Disk driver | + | | | | +7FD0h +---------------------+---------------------+---------------------+ + | Bank switching code | Bank switching code | Bank switching code | +7FFFh +---------------------+---------------------+---------------------+ +``` + +_Figure 2 - MSX-DOS 2 kernel structure_ + +There are three parts that are common to all banks (bank 3 contains the bank switching code only): + +* The page 0 code is 255 bytes long and contains an entry point for the timer interrupt routine, a routine for calling code on another bank, and other useful utility code. + +* The bank ID is just one byte with the bank number, it is needed for doing inter-bank calls. + +* The bank switching code is needed for changing the visible bank. The exact code placed here depends on the ROM mapper type used (the original DOS 2 cartridge mapping is ASCII16). + +When booting in DOS 2 mode, bank 0 is permanently switched, and other banks are only temporarily switched when bank 0 code needs to call a routine or access data on one of these banks. When booting in DOS 1 mode, bank 3 is switched at boot time, and it remains switched forever. + +As it was the case of the MSX-DOS 1 kernel, up to four MSX-DOS kernel ROMs can be active at the same time, being one of them the "master" and the others the "slaves". However, this time the master will not be the kernel with the smallest slot number, but the kernel with the highest version number (the kernel with the smallest slot number is still selected as the master in case of two or more kernels having the same version number). + +### 2.3. The Nextor kernel + +The Nextor kernel has an architecture that is based on the one of the MSX-DOS 2 kernel, but introduces significant changes: + +* The number of banks has grown. In the current version there is one extra bank for partition management code, and two extra banks for the built-in partitioning tool. + +* The disk driver ("device driver" in Nextor terminology) code is no longer embedded at the end of the kernel banks 0 and 3. Instead, now the driver has a whole bank for itself, which is located immediately after the last bank of the kernel common code. If necessary, the driver can spawn across more than one bank. + +* The device driver structure is completely new. It of course contains routines to access storage devices, but it also contains extensibility points so that it is easy to add BASIC extended commands ("CALL" commands), extended BIOS commands, and a timer interrupt service routine. + +* The page 0 code has been modified to contain extra utility routines. These routines can be used by the driver code. + +* A new information byte is added at address 4FFEh of all banks, which contains the size of the kernel common code in 16K banks (alternatively, this value can be seen as the bank number of the driver). + +* The MSX-DOS 1 kernel at bank 3 has been modified (by adding the page 0 code and the bank Id, amongst other things) so that it can perform calls to the device driver. + +* There is a 1K unused space at banks 0 and 3 (visible at addresses 7BD0h to 7FCFh). This space does not contain any kernel code and can be used to put any code or data that is required by the driver to be here. See _[4.7.1. The free space at kernel main bank](#471-the-free-space-at-kernel-main-bank)_ for more details. + +* There are five entry points at kernel banks 0 and 3 (starting at addresses 7850h) that will be redirected to another five entry points in the driver bank. This way, the driver can provide code that will be accessible via direct inter-slot call to the kernel slot. See _[4.4.7. DRV_DIRECT0/1/2/3/4 (4142h, 4145h, 4148h, 414Bh, 414Eh)](#447-drv_direct01234-4142h-4145h-4148h-414bh-414eh)_ for more details. + +Figure 3 shows a diagram with the structure of a Nextor kernel. + +``` + Banks 0-(K-1) Bank K Banks (K+1)-... (optional) +4000h +---------------------+---------------------+---------------------+ + | Page 0 code | Page 0 code | Page 0 code | + +---------------------+---------------------+---------------------+ +40FEh | K | K | K | + +---------------------+---------------------+---------------------+ +40FFh | Bank ID | K (bank ID) | Bank ID | +4100h +---------------------+---------------------+---------------------+ + | | | | + | Bank | | Additional | + | kernel code | Driver code | driver code | + | | | | + | | | | + | | | | +7BD0h +---------------------+ | | + | Available 1K space | | | + | (on banks 0 and 3) | | | +7FD0h +---------------------+---------------------+---------------------+ + | Bank switching code | Bank switching code | Bank switching code | +7FFFh +---------------------+---------------------+---------------------+ +``` + +_Figure 3 - Nextor kernel structure ("K" is the kernel common code bank count)_ + +Nextor will use the same rule of MSX-DOS 2 to decide which kernel will be the master if more than one kernel is found (the kernel with the highest version number will win). However this applies to other Nextor kernels only; Nextor will always override other MSX-DOS 1 or 2 kernels present in the system, regardless of their version number. + +## 3. Creating a Nextor kernel with embedded driver + +In order to create a complete Nextor kernel ROM that can be used in a MSX computer, up to four components are needed: + +* The Nextor kernel base file. This file contains the kernel common code, that is, the "Banks 0-(K-1)" portion shown in Figure 3. Its bank switching code is for the ASCII16 mapper (the original mapper used by the MSX-DOS 2 kernel). + +* The device driver file. It must be created conforming to the rules and structure detailed in section 4. Its size must be exactly 16080 bytes (16K minus the size of the page 0 code minus the size of the bank switching code). If the driver spawns across more than one bank, this applies to each bank. + +* The bank switching code file (only if the mapper to be used by the target hardware is not ASCII16). This code depends on the mapping type supported by the ROM cartridge where the complete kernel will be burned. Compiled bank switching code files are provided for the ASCII8 and ASCII16 mappers; for other type of mappers, custom code files must be made, following the rules detailed in _[3.3. Rules for the bank switching code](#33-rules-for-the-bank-switching-code)_. + +NOTE: ROM mappers that work with 8K banks instead of 16K banks are supported only if it is possible to select the bank visible at the first half of page 1 (4000h-5FFFh) by writing a single byte in a memory mapped port with a LD(xxxx),A instruction. This is the case of ASCII8, for example. + +* Optionally, the code that will be placed in the 1K unused space at banks 0 and 3 (see _[4.7.1. The free space at kernel main bank](#471-the-free-space-at-kernel-main-bank)_ for more details). + +The procedure for creating the complete Nextor kernel ROM file consists basically on appending the driver code the kernel base file, and then patching the resulting file with the appropriate bank switching code. This can be done manually, or by using the MKNEXROM utility. Both options are explained below. + +### 3.1. Manual creation + +In order to manually create a complete Nextor ROM file, the following recipe must be followed. The file positions mentioned are zero based. + +1. Create a copy of the kernel base file (NEXTOR.BASE.DAT). + +2. Append the page 0 code at the end of the file. This code can be simply copied from the first 255 bytes of the kernel base file itself. + +3. Append one byte with value K (the kernel base file bank count) at the end of the resulting file (this will be the bank ID of the driver bank). The value of K can be read from position 254 of the kernel base file itself. + +4. Append the driver file (which must be exactly 16080 bytes long, otherwise padding is required) at the end of the file obtained in step 3. + +5. Append the bank switching code at the end of the resulting file. If a file suitable for hardware supporting the ASCII16 mapper is desired, then this code can be simply copied from the last 48 bytes of the kernel base file itself. Otherwise, custom mapping code must be provided. + +6. If the driver code does not fit in one single bank, repeat steps 2-5 to append extra banks, increasing the bank ID for each bank as appropriate. + +7. If necessary, patch the resulting file to add custom code or data at the 1K free space on banks 0 and 3. Put the contents of the file (up to 1K long) twice, at positions 3BD0h and FBD0h in the file. + +8. If the mapper type of the target hardware is not ASCII16, patch the bank switching code of the kernel common code banks (the last 48 bytes of the first "K" 16K blocks of the resulting file, where "K" is the value obtained in step 3) with custom bank switching code. + +9. If the mapper type of the target hardware is not ASCII16, put the same custom bank switching code used in steps 5 and 8 in the file position 2012. + +10. **Only** if the ROM mapper uses 8K banks: + + a. Write a LD(xxxxh),A instruction at position F7h of the generated file, where xxxx is the memory mapped port that selects the 8K bank visible in the first half of page 1 (4000h-5FFFh). This is a 32h byte followed by xxxxh itself in little-endian format. + + b. Repeat the previous step for all the 16K portions of the file. That is, you must write the LD(xxxxh),A instruction at file positions (4000h*n)+F7h, where n goes from zero to the number of 16K banks in the file minus one. + +The result of this procedure is a ready to use complete Nextor ROM file with your device driver properly embedded. There is no need to further patch or otherwise modify the generated ROM file. + +### 3.2. Using the MKNEXROM utility + +Instead of manually performing all the steps needed to build a complete Nextor kernel ROM, it is usually more convenient to use the supplied MKNEXROM utility. This tool can be used to create a new Nextor kernel ROM file, but it also allows modifying an existing file by changing the mapper code and/or adding extra content in the free 1K areas present in banks 0 and 3. + +MKNEXROM is supplied as a command-line executable file for Windows only, but the source code in standard C is provided as well, so it should be easy to port it to other platforms. + +The MKNEXROM tool usage syntax is as follows: + +``` +MKNEXROM [/d:] [/m:] + [/e:] [/8:<8K bank selection port address>] +``` + +_``_ can be one of the following: + +* The Nextor kernel base file, that is, the file that contains the kernel common code only. + +* A complete Nextor kernel ROM file with the driver bank(s) already appended. + +__ is the file containing the driver code. It must be a valid driver according to the rules and structure explained in section 4. The contents of this file are expected to be as follows: + +1. 256 dummy bytes. +2. The driver signature +3. The driver jump table +4. The driver code itself + +And optionally, if the driver spawns across more than one 16K bank, for each additional 16K block: + +5. 256 dummy bytes. +6. The additional driver code or data. +7. Dummy space up to 16K (not needed for the last bank). + +Specifying a driver file is mandatory if a kernel base file without driver is specified in _``_, and prohibited if a complete kernel ROM file is specified. + +_``_ is the file containing the bank switching code. If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. + +_``_ is the file containing the extra code or data for the resulting ROM file. This extra data can be up to 1K long and will be placed at position 0x3BD0 of banks 0 and 3 at address 0x3BD0, this means that this code or data will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel slot, at address 0x7BD0. See _[4.7.1. The free space at kernel main bank](#471-the-free-space-at-kernel-main-bank)_ for more details. + +/8 must be used only if the ROM mapper uses 8K banks. _`<8K bank selection port address>` is the memory mapped port address that selects the 8K bank visible in the first half of page 1 (4000h-5FFFh); for example 6000h for the ASCII8 mapper. This will appropriately patch the generated ROM boot code to support this kind of mappers. + +As an alternative to using the /8 parameter when using ROM mappers with 8K banks, MKNEXROM can be instructed to appropriately patch the generated ROM by adding a header to the mapper file itself. This header consists of a FFh byte followed by the bank selection port addess in little-endian format. See below for an example. + + +### 3.3. Rules for the bank switching code + +If the mapper type of the target hardware where the resulting ROM will be burned is not ASCII16, then a file containing compiled custom mapping code must be supplied. This code must follow the following rules: + +1. It must be at most 48 bytes long. +2. It must switch in page 1 the 16K ROM bank whose number is passed in register A (banks are numbered starting at zero). The ROM slot is assumed to be already switched on page 1. +3. It can corrupt register pair AF only. All other registers must be preserved. +4. It must be prepared to run at any address (so it can't contain absolute jumps or references to itself). + +For illustration purposes, this is the source code of valid bank switching code for the ASCII8 mapper: + +``` +rlca +ld (6000h),a +inc a +ld (6800h),a +ret +``` + +If a file with the previous code is passed to MKNEXROM as the mapper file to be used, it is necessary to add a `/8:6000` parameter to the command line so that the generated ROM file includes the appropriate patch for 8K bank based ROM mappers. The same file with a header that renders the /8 parameter unnecessary would be as follows: + +``` +db 0FFh +dw 6000h +rlca +ld (6000h),a +inc a +ld (6800h),a +ret +``` + +## 4. Nextor driver structure + +This section contains all the details needed in order to develop a device driver for Nextor. The necessary elements, their locations, and the required routine input and output parameters are explained. + +Note that [the source code of a dummy driver](DRIVER.ASM) (a valid driver that manages no devices) is supplied as well. You can use that file as the skeleton for developing your own driver. + +### 4.1. Drive-based and device-based drivers + +When developing a Nextor device driver, the developer must choose between two driver styles: **drive-based** and **device-based**. + +_Drive-based drivers_ have the same idiosyncrasy of MSX-DOS drivers for accessing the storage devices: they expose a set of driver units and Nextor assigns one fixed drive letter for each unit; any necessary drive to device or partition mapping must be performed by the driver itself. The set of routines for storage device access exposed by these drivers is the same that was used by MSX-DOS drivers (DSKIO, DSKCHG, GETDPB, CHOICE, DSKFMT and MTOFF). + +_Device-based drivers_ use a completely different approach. They do not expose driver units, but directly storage devices. Also, they expose routines for raw access to the devices, and it is the Nextor kernel itself who manages the drive to device and partition mapping. + +In general it is recommended to develop device-based drivers, as the routines to implement are easier and the driver code needs to just read and write absolute device sectors without having to worry about partitions; also, the Nextor built-in device partitioning tool can be used to create partitions on devices controlled by device-based drivers only. Developing a drive-based driver may however be a good option to easily convert an existing MSX-DOS driver to Nextor. + +Nextor will perform an automatic drive to device and partition mapping at boot time for the drives assigned to device-based drivers, this mapping can be later modified by using the MAPDRV utility (the driver can, however, bypass part of this automatic assignment by implementing [DRV_CONFIG](#448-drv_config-4151h)). More details are provided in the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_. + +### 4.2. Page 0 routines and data + +This section explains the routines and data that are available at page 0 (addresses 4000h-40FFh) of all the Nextor banks, including the driver bank(s). These routines may be useful helpers for the driver code. + +Remember that as explained in _[3. Creating a Nextor kernel with embedded driver](#3-creating-a-nextor-kernel-with-embedded-driver)_, the page 0 code becomes part of all the driver banks when the complete Nextor kernel ROM is generated. + +#### 4.2.1. GSLOT1 (402Dh) + +Obtains in register A the slot currently switched on page 1 (that is, the slot of current driver code). Preserves all other registers except F. + +Note: This routine can't be called directly. It must be called via an inter-bank call to bank 0, in this way: + +``` +XOR A +LD IX,GSLOT1 +CALL CALBNK +``` + +#### 4.2.2. RDBANK (403Ch) + +This routine reads a byte from another bank. It must be called via an inter-bank call to the bank to be read, passing the address to be read in HL: + +``` +LD A, +LD HL, (must be a page 1 address) +LD IX,RDBANK +CALL CALBNK +``` + +It returns the read byte in A and preserves all other registers except F. + +#### 4.2.3. CALLB0 (403Fh) + +This routine temporarily switches then kernel main bank (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), then invokes the routine whose address is at (CODE_ADD). It is necessary to use this routine to invoke CALBAS (so that kernel bank is correct in case of BASIC error) and to invoke DOS functions via F37Dh hook. + +``` +Input: Address of code to invoke in (CODE_ADD). + AF, BC, DE, HL, IX, IY passed to the called routine. +Output: AF, BC, DE, HL, IX, IY returned from the called routine. +``` + +Note: the address of CODE_ADD is F84Ch. + + #### 4.2.4. CALBNK (4042h) + +Calls a routine in another bank. This is useful if the driver spawns across two or more banks, and is needed for using the GSLOT1, GWORK and RDBANK routines. + +``` +Input: A = Bank number + IX = Routine address (must be a page 1 address) + AF'= Input parameter for the called routine + (will be passed as AF to the called routine) + BC, DE, HL, IY = Input parameters for the called routine +Output: AF, BC, DE, HL, IX, IY = Output parameters from the called routine +``` + +#### 4.2.5. GWORK (4045h) + +Gets the address of the 8 byte SLTWRK entry for the passed slot, or for the current slot in page 1. The first two bytes of this area will contain a pointer to the allocated page 3 work area for this driver (as requested in the DRV_INIT routine), or zero if no work area has been allocated. + +``` +Input: A = Slot number + (0, for the current slot in page 1) +Output: A = Current slot switched on page 1 (if 0 at input) + Unchanged (if not 0 at input) + IX = Address of the 8 byte SLTWRK entry for the specified slot +Corrupts: F +``` + +Please see _4.4.3. DRV_INIT_ for an explanation about how to use this routine and the SLTWRK area. + +Note: This routine can't be called directly. It must be called via an inter-bank call to bank 0, in this way: + +``` +LD A, +EX AF,AF' +XOR A +LD IX,GWORK +CALL CALBNK +``` + +#### 4.2.6. K_SIZE (40FEh) + +This address contains one byte that tells how many banks form the Nextor kernel (or alternatively, the first bank number of the driver). + +When a driver spawns across more than one bank and needs to read data or call a routine in another driver bank (by using RDBANK and CALBNK), it should calculate the bank number by adding the appropriate offset to K_SIZE (or alternatively, to the value of CUR_BANK) instead of assuming a fixed bank number. When done this way, compiled drivers can still be used with future versions of the Nextor kernel even if they have more banks for the kernel common code. + +#### 4.2.7. CUR_BANK (40FFh) + +This address contains one byte with the current bank number. For the first driver bank this value is the same of K_SIZE, and it increases by one for each additional driver bank (if any). + +#### 4.2.8. CHGBNK (7FD0h) + +This is not strictly a page 0 routine, but is available on all banks as well. It will simply make the specified bank visible on Z80 page 1. Usually, driver code will not need to use this routine, but will use CALBNK instead. + +``` +Input: A = Bank number +Output: - +Corrupts: AF +``` + +### 4.3. The driver header + +The driver header is the first part of a Nextor driver. It contains some information that helps Nextor to identify the driver and determine its type. + +This section explains the parts of the driver header. Addresses start at 4100h since this is the address at which the driver will be visible. + +#### 4.3.1. DRV_SIGN (4100h) + +This is the valid driver signature, it is used by the kernel code at boot time to check that the driver bank effectively contains a valid driver. It consists of the verbatim string "NEXTOR_DRIVER" (without the quotes), zero-terminated, and uppercased. + +#### 4.3.2. DRV_FLAGS (410Eh) + +This is a flags byte that contains information about the driver: + +``` +bit 0: 0 = the driver is a drive-base driver + 1 = the driver is a device-based driver +bit 1: Reserved, must be zero +bit 2: 1 if the driver implements the DRV_CONFIG routine +bits 3-7: Reserved, must be zero +```` + +Note that [DRV_CONFIG](#448-drv_config-4151h) is used by Nextor starting at version 2.0.5. + +#### 4.3.3. RESERVED (410Fh) + +Reserved byte, must be zero. + +#### 4.3.4. DRV_NAME (4110h) + +This is a string containing the driver name. It must consist of 32 printable ASCII characters (ASCII codes 32 to 126). The string must be left justified and padded at the right with spaces. + +### 4.4. Common routines + +The next part of the driver is a jump table to a set of routines that are mandatory for all drives regardless of its type (drive-based or device-based). Except for DRV_INIT, a driver does not need to provide a full implementation of all of these routines, and usually it will be enough a simple RET instruction, sometimes returning an error code. + +None of these routines need to preserve any of the registers not used to return data. The same applies to the drive-based a device-based specific routines. + +#### 4.4.1. DRV_TIMI (4130h) + +This is the entry point for the timer interrupt routine of the driver, it will be called 50 or 60 times per second depending on the VDP frequency selected. If the driver does not need to handle the timer interrupt, it should fill this entry with RETs. + +Note that this entry will only called if DRV_INIT returns Cy=1 on its first execution. See _4.4.3. DRV_INIT_ for more details. + +#### 4.4.2. DRV_VERSION (4133h) + +This routine returns the driver version. Three version numbers must be returned, one byte each: main version number, secondary version number, and revision number. + +``` +Input: - +Output: A = Main version number + B = Secondary version number + C = Revision number +``` + +#### 4.4.3. DRV_INIT (4136h) + +This is the driver initialization routine. It will be called by the kernel twice: + + 1. First execution, for information gathering. + +``` +Input: A = 0 + B = Number of available drive letters + HL = Maximum size of allocatable work area in page 3 + C = Initialization flags + bit 5: User is requesting reduced drive count +Output: A = Number of controlled drive units (for drive-based drivers only) + HL = Size of required work area in page 3 + C = Initialization flags + bit 5: User is requesting reduced drive count + Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise +``` + + 2. Second execution, for work area and hardware initialization. + +``` +Input: A = 1 + B = Number of drive letters actually allocated for this controller +``` + +Drive-based drivers must return the number of required drive units in the output of the the first execution of this routine. Device-base drivers can optionally request an initial number of drives to be allocated at boot time by implementing [the DRV_CONFIG routine](#448-drv_config-4151h), thus overriding [the automatic mapping procedure](Nextor%202.1%20User%20Manual.md#32-booting-nextor). + +The "User is requesting reduced drive count" flag will be set if the user wants one single drive to be allocated per driver. +In the current version of Nextor this happens when the user keeps the 5 key pressed at boot time, but this could change in future versions (a different key could be used or an alternative mechanism for the same function could be provided); therefore the driver should **not** scan the keyboard directly, instead it should just look at the supplied flag and act accordingly (if appropriate). Note also that the same flag is passed to [the DRV_CONFIG routine](#448-drv_config-4151h) as well. + +Starting at the second execution of this routine, the GWORK routine can be used at any time to obtain the address of the space reserved for the current slot at SLTWRK. The driver should act as follows regarding the page 3 work area: + +* If 8 bytes or less are required, this routine should return HL=0 on its first execution, and the 8 byte space reserved by the system for this slot at SLTWRK should be used as work area: + +``` +XOR A +EX AF,AF' +XOR A +LD IX,GWORK +CALL CALBNK +;Use the 8 byte space pointed by IX as work area +``` + + +* If more than 8 bytes are required, this routine should return the required space in HL, and should obtain the pointer to the allocated space from the first two bytes of the space reserved by the system for this slot at SLTWRK: + +``` +XOR A +EX AF,AF' +XOR A +LD IX,GWORK +CALL CALBNK +LD L,(IX) +LD H,(IX+1) +;Use the space pointed by HL as work area +``` + +Please note also the following: + +* If the first execution requests more page 3 work area than available, the second execution will not be done, no drives will be allocated and DRV_TIMI will not be hooked to the timer interrupt; in other words, Nextor will ignore the involved controller. The size of the work area required should always be within the available limits. + +* For drive-based drivers, the operating system will assign to the driver as many drive letters as driver units are controlled. However, if there are more drive units than drive letters are available, then as many drives as possible will be allocated, and the initialization procedure will continue the normal way. This applies to device-based drivers too, except that Nextor will always try to allocate two drive letters for these drivers. + +* For drive-based drivers: unlike MSX-DOS, the timer interrupt routine will be executed (if requested) even if the driver has zero driver units. + +#### 4.4.4. DRV_BASSTAT (4139h) + +This is the entry for the BASIC extended statements ("CALLs") handler. It works the same way as the standard handlers (see _MSX2 Technical Handbook_, chapter 2, for details), except that if the handled statements have parameters, the MSX BIOS routine CALBAS (needed to invoke the MSX BASIC interpreter helper routines) can't be used directly; instead, it must be invoked via the CALLB0 entry in kernel page 0. + +If the driver does not handle BASIC extended statements, it must simply set the carry flag and return. + +#### 4.4.5. DRV_BASDEV (413Ch) + +This is the entry for the BASIC extended devices handler. It works the same way as the standard handlers (see _MSX2 Technical Handbook_, chapter 2, for details), but see the note on DRV_BASSTAT about CALBAS. + +If the driver does not handle BASIC extended devices, it must simply set the carry flag and return. + +#### 4.4.6. DRV_EXTBIO (413Fh) + +This is the extended BIOS handler. It works the same way as the standard handlers, except that it must return a value in D' (D in the alternative registers set) that tells the kernel what to do after the driver handler has finished: + +``` +D'=0: Return immediately. +D'=1: Execute the kernel and/or the system extended BIOS handler. +``` + +The driver extended BIOS handler is always entered with D'=1. Therefore, if the driver does not handle extended BIOS at all, it can simply fill this entry point with RETs. + +#### 4.4.7. DRV_DIRECT0/1/2/3/4 (4142h, 4145h, 4148h, 414Bh, 414Eh) + +These are the entries for direct calls to the driver. Calls to any of the five entry points available at addresses 7850h to 785Ch in the kernel ROM (bank 0 or bank 3) will be mapped to a call to the corresponding DRV_DIRECT entry point. This is useful when the driver wants to provide extra functionality for configuration, returning information, or other purposes. When these routines are entered, paging state will be the same as when the bank 0/3 entry was invoked, except of course that the driver bank will be switched on page 1 instead of the kernel bank. All registers except IX and AF' are passed unmodified from the caller. + +If the driver does not implement any direct call code, it can simply fill these entry points with RETs. + +#### 4.4.8. DRV_CONFIG (4151h) + +This routine, introduced in Nextor 2.0.5, allows the driver to provide information about its preferred configuration at boot time. If this routine is implemented, the appropriate bit of [the driver flags](#432-drv_flags-410eh) must be set. + +Nextor will specify the required configuration type by passing a configuration index when invoking this routine. For compatibility with future versions of Nextor, which could define new configuration indexes, this routine should always return an error when an unknown configuration index is supplied (also when the configuration index is known but the driver is unable to supply meaningful configuration). + +All the configurations are optional: the driver may choose to implement all of them or only some. Nextor will always resort to default or automatically calculated values for the configuration indexes for which the driver returns an error. + +**Note:** Currently, all the defined configurations apply to device-based drivers only. + +``` +Input: + A = Configuration index + BC, DE, HL = Depends on the configuration + +Output: + A = 0: Ok + 1: Configuration not available for the supplied index, + or unknown configuration index + BC, DE, HL = Depends on the configuration + +* Get number of drives at boot time + Input: + A = 1 + B = 0 for DOS 2 mode, 1 for DOS 1 mode + C = Initialization flags + bit 5: User is requesting reduced drive count + Output: + B = number of drives + +* Get default configuration for drive + Input: + A = 2 + B = 0 for DOS 2 mode, 1 for DOS 1 mode + C = Relative drive number at boot time + Output: + B = Device index + C = LUN index +``` + +See [DRV_INIT](#443-drv_init-4136h) for an explanation about the "User is requesting reduced drive count" flag. + +For "Get default configuration for drive", Nextor will assign the specified device and LUN to the appropriate drive at boot time, and the partition will be selected automatically. If the device is not ready at boot time, the drive will still be assigned, and Nextor will try to search for a partition every time the drive is accessed until the device is available. This is useful for having drives assigned to removable devices even if they don't have a volume inserted at boot time. + +Also, "Get default configuration for drive" will be invoked for relative units 0 to N-1, where N is either the value returned by "Get number of drives at boot time", or (if the routine returns an error for that configuration) the value calculated automatically by Nextor from the number of available devices. + +#### 4.4.9. RESERVED (4155h to 415Fh) + +This area is reserved for future expansion, it must be filled with zeros. + +### 4.5. Routines for drive-based drivers + +The next part of the driver after the common routines is jump table to a set of storage device access routines that are different for drive-based drivers and device-based drivers. This section explains the routines needed for drive-base drivers, which are actually a clone of the routines used by MSX-DOS drivers. + +Drive-based drivers are assumed to control N drive units, numbered from 0 to N-1, where N is returned by the driver when its DRV_INIT routine is invoked. The operating system will assign one drive letter directly to each drive unit, therefore drive units are expected to always hold a valid filesystem. It is the responsibility of the driver to perform the appropriate drive unit to device and partition mapping (perhaps with the help of external tools). + +#### 4.5.1. DRV_DSKIO (4160h) + +Reads or writes sectors from the massive storage device associated to a given driver unit. + +``` +Input: A = Driver unit, starting at 0 + Cy = 0 for reading sectors, 1 for writing sectors + B = Number of sectors to read/write + C = First sector number to read/write (bits 22-16) if bit 7 is not set + Media ID byte if bit 7 is set + DE = First sector number to read/write (bits 15-0) + HL = source/destination address for the transfer + +Output: Cy = 0 on success, 1 on error + A = Error code (on error only): + 0 Write protected + 2 Not ready + 4 Data (CRC) error + 6 Seek error + 8 Record not found + 10 Write fault + 12 Other errors + B = Number of sectors actually read (in case of error only) +``` + +Unlike the counterpart of this routine in the old MSX-DOS drivers, this routine will never receive a request to transfer data from/to page 1. If the kernel code requires data to be transferred to page 1, it will split the transfer in several 1 sector transfers and use a temporary buffer in page 3; the driver code does not need to worry about this and can do always direct transfers from/to memory. + +If Nextor detects that the drive contains a FAT16 filesystem, then register C will be used to hold bits 22 to 16 of the sector number, thus the complete sector number will be a 23 bit value hold by registers CDE. Otherwise, register C will contain the device media ID (which will always have its MSB set), and the complete sector number will be a 16 bit value hold by registers DE. + +#### 4.5.2. DRV_DSKCHG (4163h) + +Returns information about the change status for the media associated to a given driver unit. + +``` +Input: A = Driver unit, starting at 0 + B = C = Media descriptor + HL = Base address for DPB -1 + +Output: Cy = 0 on success, 1 on error + A = Error code (on error only) + The same codes of DRV_DSKIO are used + B = Media status (on success only) + 1 Media has NOT changed since the last time this routine was called + 0 Unknown + -1 Media has changed since the last time this routine was called +``` + +If the media status is "Changed" or "Unknown", the routine must generate a DPB for the disk and copy it to the address passed in HL plus one. See _4.5.3. DRV_GETDPB_ for the DPB format. + +#### 4.5.3. DRV_GETDPB (4166h) + +Gets a DPB (Drive Parameters Block) for the media associated to a given driver unit. + +``` +Input: A = Driver unit, starting at 0 + B = C = Media descriptor + HL = Base address for DPB -1 +Output: - +``` + +The format of the 18 byte DPB is as follows: + +``` ++00: Media descriptor byte (F0h to FFh) ++01: Sector size (2 bytes), must be a power of two ++03: Directory mask, it is calculated as (sector size /32)-1 ++04: Directory shift, it is the number of one bits in the directory mask ++05: Cluster mask, it is calculated as (sectors per cluster)-1 ++06: Cluster shift, it is calculated as (number of one bits in cluster mask)+1 ++07: Sector number of the first FAT ++08: Number of FATs ++0A: Number of directory entries (maximum 254) ++0B: First data sector number (2 bytes) ++0D: Maximum cluster number, it is calculated as + (number of clusters +1) (2 bytes) ++0F: Total number of sectors ++10: First sector number of root directory +``` + +The DPB must be copied to the address passed in HL plus one. + +#### 4.5.4. DRV_CHOICE (4169h) + +Returns a format choice string for a disk. + +``` +Input: - +Output: HL = Address of the choice string in the kernel slot +``` + +This routine is called by the kernel code when a FORMAT command is executed, in order to show the formatting options to the user (in MSX-DOS 2 and Nextor, it is also called by the CHOICE function call). The value returned in HL is the address of a zero terminated string with formatting choice options to be shown to the user; this string must be present in the kernel slot and must be readable with the RDSLT routine or an equivalent method. There are three cases that are supported without any modification needed in the kernel base code: + +1. If the disk supports only one kind of formatting (that is, there is actually no choice), it must return HL = 0. + +2. If the disk does not support formatting (the most common case), it must return HL = 781Fh. This is the address of a null string available in the kernel banks 0 and 3. + +3. If the device is a legacy MSX floppy disk drive that handles single sided and double sided disks, it must return HL = 7820h. This is the address of a "Single sided / Double sided" string available in the kernel banks 0 and 3. + +If any other string is to be returned, then it must be stored at the free 1K space that is available at kernel pages 0 and 3 (see _[4.7.1. The free space at kernel main bank](#471-the-free-space-at-kernel-main-bank)_ for details). + +#### 4.5.5. DRV_FORMAT (416Ch) + +Formats a disk and initializes its boot sector, FAT and root directory. + +``` +Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). + D = Drive unit, starting at 0 + HL = Address of work area in memory + DE = Size of work area + +Output: Cy = 0 on success, 1 on error + A = Error code (on error only): + 0 Write protected + 2 Not ready + 4 Data (CRC) error + 6 Seek error + 8 Record not found + 10 Write fault + 12 Bad parameter + 14 Insufficient memory + 16 Other errors +``` + +This routine performs the actual disk formatting according to the formatting choice passed in register A, which is assumed to have been selected by the user after the choice string returned by DRV_CHOICE has been displayed. + +The "work area" is a RAM space provided by the caller that can be freely used by the formatting routine if necessary. + +#### 4.5.6. DRV_MTOFF (416Fh) + +Stops the motor of all the managed drives. This routine makes sense for floppy disk drives only; for other types of devices it should do nothing. This routine has no input or output parameters. + +### 4.6. Routines for device-based drivers + +This section explains the driver routines that are needed for device-base drivers. Note that the jump table entries for these routines use the same addresses as the routines for drive-based drivers; this makes sense because a driver will only implement one of the two sets of routines. + +Device-based drivers do not use the concept of drive units mapped directly to drive letters; instead, these drivers provide raw access to storage devices, and it is the Nextor kernel itself who manages the drive to device and partition assignment, both automatically (at boot time) and manually (on behalf of the user, via tools that use the new Nextor function calls). + +Device-based drivers can control up to seven storage devices, identified with an index number that ranges from 1 to 7. Each device has in turn from one to seven logical units, identified too with an index number from 1 to 7 (for example, a multimedia card reader with several slots could expose each slot as a separate logical unit). Devices may not physically be divided in logical units (this will be actually the most common case), in this case the driver must expose the device as having one single logical unit with index number 1. + +#### 4.6.1. DEV_RW (4160h) + +Reads or writes absolute sectors from/to a device. + +``` +Input: Cy = 0 to read sectors + 1 to write sectors + A = Device index, 1 to 7 + B = Number of sectors to read or write + C = Logical unit index, 1 to 7 + HL = Source or destination non-page 1 memory address for the transfer + DE = Non-page 1 memory address where the 4 byte sector number is stored +Output: A = Error code: + 0: Ok + .IDEVL: Invalid device or logical unit number + .NRDY: Not ready + .DISK: General unknown disk error + .DATA: CRC error when reading + .RNF: Sector not found + .UFORM: Unformatted disk + .WPROT: Write protected media, or read-only logical unit + .WRERR: Write error + .NCOMP: Incompatible disk + .SEEK: Seek error + B = Number of sectors actually read (in case of error only) +``` + +This routine allows reading and writing sectors from/to a device. Note that what this routine must access is the raw physical device sectors, not partition sectors. The driver does not need to know anything about device partitioning. + +The number of the first sector to read or write is a 32 bit number which is supplied in a memory area whose address is pointed by DE. This address will never be on page 1, therefore the drivers does not need to worry about paging and can access this data directly. The same applies to the sectors data source or destination address. + +The available sector numbers must range from zero to the number of available sectors (as reported by LUN_INFO) minus one. If LUN_INFO reports zero available sectors, then the range of available sectors is undefined unless the driver developer explicitly documents it. + +This routine must work for all block devices. If a non-block device supports reading and/or writing sectors, this routine may optionally work with that device as well. + +The error codes returned are the same used by MSX-DOS 2, as listed under the category "Disk errors" in the _[MSX-DOS 2 Program Interface Specification](DOS2-PIS.TXT)_ document. The .IDEVL error is new in Nextor and has a code of B5h; the complete list of new error codes defined by Nextor is in the _[Nextor 2.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ document. + +#### 4.6.2. DEV_INFO (4163h) + +Returns information about a device. + +``` +Input: A = Device index, 1 to 7 + B = Information to return: + 0: Basic information + 1: Manufacturer name string + 2: Device name string + 3: Serial number string + HL = Pointer to a buffer in non-page 1 RAM +Output: A = Error code: + 0: Ok + 1: Device not available, information not available, + or invalid information index +``` + +This routine is used by the kernel code to check the availability of storage devices and to get general information about them. The "Basic information" block is mandatory (it must be not available only when the device itself is not available), all other information blocks are optional and must return an error if not available. + +The address passed in HL will never be on page 1, therefore the drivers does not need to worry about paging and can generate the data directly at the specified address. + +When basic information is requested, the buffer supplied in HL must be filled with the following information: + +``` ++0 (1): Number of logical units, from 1 to 8. +    1 if the device has no logical units +     (which is functionally equivalent to having only one). ++1 (1): Device features flags. This must be zero in current version. +``` + +All other information blocks have the form of text strings. These must be printable ASCII strings (containing ASCII codes 32 to 126 only), left justified and padded with spaces. + +If a string is provided by the device in binary format, the driver should return it as an hexadecimal, upper-cased string, preceded by the prefix "0x". + +The maximum length for a string is 64 characters. If the string is actually longer, the leftmost 64 characters must be provided. + +In the case of the serial number string, the same general rules for the strings apply, except that it must be provided right-justified, and if it is too long, the rightmost characters must be provided, not the leftmost. + +The driver must never provide the same combination of manufacturer name, device name and serial number for two different devices. Hard-coded serial numbers should never be returned; if the driver is not able to obtain a serial number from the device itself, it should return no serial number at all. + +#### 4.6.3. DEV_STATUS (4166h) + +Obtain the availability and change status for a device or logical unit. + +``` +Input: A = Device index, 1 to 7 + B = Logical unit number, 1 to 7 + 0 to return the status of the device itself +Output: A = Status for the specified logical unit, + or for the whole device if 0 was specified: + 0: The device or logical unit is not available, or the device + or ogical unit number supplied is invalid. + 1: The device or logical unit is available and has not changed + since the last status request. + 2: The device or logical unit is available and has changed + since the last status request. + (for devices, the device has been unplugged and a different + device has been plugged which has been assigned the same device index; + for logical units, the media has been changed). + 3: The device or logical unit is available, but it is not possible + to determine whether it has been changed or not since the last + status request. +``` + +This routine tells the media change status for a device. Nextor will normally call this routine only for the logical units with the "removable" flag set in the information block returned by LUN_INFO; however the routine will be called for fixed logical units as well when running in MSX-DOS 1 mode (for fixed logical units, this routine should always return either 0 or 1 in A). + +In the current version of Nextor this routine will never be called with B=0 (check the status of the device itself). Support for hot-plug device systems such as the USB bus is planned for a future version. + +Nextor uses a boot sector checksum mechanism to manage device changes when drivers return A=3 in response to a call to DEV_STATUS (see _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_, section "Managing media changes", for details). In order to avoid boot sector reads and checksum calculations, drivers should return proper device change information (that is, DEV_STATUS should return A=1 or 2 instead of 3) whenever possible. + +**Important note:** the status returned by this routine is always relative to the previous invocation of the same routine. Calls to DEV_RW must NOT cause the next call to DEV_STATUS to return A=1 if the device has changed. In other words, in the sequence of: media change – call to DEV_RW – call to DEV_STATUS, the last call must return A=2. This behavior is necessary for a proper operation of the Nextor drive mapping engine. + +The value returned by this routine at the first invocation at system boot (after DRV_INIT is invoked) is irrelevant, that is, if a device is available then either A=1 or A=2 may be returned. + +#### 4.6.4. LUN_INFO (4169h) + +Obtain information for a logical unit. + +``` +Input: A = Device index, 1 to 7 + B = Logical unit index, 1 to 7 + HL = Pointer to buffer in non-page 1 RAM +Output: A = 0: Ok, buffer filled with information + 1: Error, device or logical unit not available, or invalid + device index or logical unit number supplied +``` + +This routine must return a certain information about the given logical unit for a device. The address passed in HL will never be on page 1, therefore the drivers does not need to worry about paging and can generate the data directly at the specified address. + +The information to be returned is a 12 byte block with the following structure: + +``` ++0 (1): Medium type: + 0: Block device + 1: CD or DVD reader or recorder + 2-254: Unused (reserved for future use) + 255: Other type ++1 (2): Sector size, 0 if this information does not apply or is not available ++3 (4): Total number of available sectors, 0 if this information does not apply + or is not available ++7 (1): Logical unit features flags: + bit 0: 1 if the medium is removable + bit 1: 1 if the medium is read only + bit 2: 1 if the logical unit is a floppy disk drive + bits 3-7: Unused, must be zero ++8 (2): Number of cylinders ++10 (1): Number of heads ++11 (1): Number of sectors per track +``` + +"Block devices" are all devices that can be read and written via access to logical sectors. This includes floppy disk, hard disks, pendrives, multimedia cards, etc. Block devices must be readable and optionally writable via the DEV_RW routine. + +In the current version Nextor will refuse to work with a device that is reported as a non-block device or having a sector size different from 512 bytes. Support for direct filesystem access is a planned feature for a future version. + +The information about cylinders, heads and sectors per tracks apply only for hard disk; for other device types, or when this information is not available for whatever reason, these fields should be returned with value zero. This information is not used by the Nextor kernel, but can be used by device partitioning tools in order to properly align partitions on the disk (in the current version of Nextor this information is not used by the built-in partitioning tool). + +The "read only" flags should be set only for devices that are only readable by design (for example a CD-ROM). A device that can be dynamically write protected and write enabled should not be reported as a read-only device. + +In the current version of Nextor it is not possible to format devices controlled by Nextor device-based drivers. This is a planned feature for a future version, and it will be available only for devices that have the "floppy disk drive" flag set. + +### 4.7. Other + +This section contains other useful information about the Nextor device driver structure. + +#### 4.7.1. The free space at kernel main bank + +The Nextor kernel has a 1K unused space at the two main banks (bank 0 when running in normal mode, bank 3 when running in MSX-DOS 1 mode) that can be filled with any kind of data or code useful for the driver. The main bank is permanently switched on the Kernel slot in normal circumstances (other banks are switched only for temporary code calls), therefore this area can be accessed via the standard slot accessing mechanisms (such as inter-slot call via CALSLT, inter-slot read via RDSLT, etc) even by software that is not aware of the Nextor bank paging mechanism. This space is visible starting at address 7BD0h. + +There are three cases in which it may be necessary to add custom contents to this area: + +* When a format choice string other than a null string (for devices that can't be formatted) or the "Single side / Double side" string (in case of driving a legacy MSX floppy disk driver) is to be returned by the DRV_CHOICE or DRV_FORMAT routines. These two strings are already provided by the kernel, other strings must be explicitly placed in this available area. + +* When data that is to be read by user software by using RDSLT or an equivalent mechanism is needed (for example, an UNAPI implementation identifier). + +* When a hook other than the timer interrupt hook or the extended BIOS hook is to be patched. In this case, code that performs an inter-bank call to the driver code should be placed in this area, and the hook should be set to do an inter-slot call to this code in the kernel slot. + +The code at this area should use the CALBNK routine if it needs to invoke code in the driver bank, whose number can be read from the K_SIZE address. See _[4.2.6. K_SIZE (40FEh)](#426-k_size-40feh)_ for more details. + +Note that whatever is placed in this area, it must be identical in both banks 0 and 3, so that everything will work correctly in both the normal Nextor mode and the MSX-DOS 1 mode. The MKNEXROM tool will appropriately +patch both banks if a data file for this area is supplied. + +## 5. Change history + +This section contains the change history for the different versions of Nextor. Only the changes that are meaningful from the driver developer point of view are listed. For information on changes at the user level, please look at the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ document. For information on changes related to application development, please look at the _[Nextor 2.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ document. + +This list contains the changes for the 2.1 branch only. For the change history of the 2.0 branch see the _[Nextor 2.0 Driver Development Guide](../../../blob/v2.0/docs/Nextor%202.0%20Driver%20Development%20Guide.md#5-change-history)_ document. + +### 5.1. v2.1 beta 1 + +Added the "User is requesting reduced drive count" flag to the input of [the DRV_INIT routine](#443-drv_init-4136h) and [the DRV_CONFIG routine](#448-drv_config-4151h). diff --git a/docs/Nextor 2.1 Getting Started Guide.md b/docs/Nextor 2.1 Getting Started Guide.md new file mode 100644 index 00000000..ca551c83 --- /dev/null +++ b/docs/Nextor 2.1 Getting Started Guide.md @@ -0,0 +1,345 @@ +# Nextor 2.0 Getting Started Guide + +## Index + +[1. Introduction](#1-introduction) + +[2. Setting up blueMSX](#2-setting-up-bluemsx) + +[2.1. Setting up a real MSX](#21-setting-up-a-real-msx) + +[3. Booting and creating partitions](#3-booting-and-creating-partitions) + +[4. Mapping partitions and changing the boot partition](#4-mapping-partitions-and-changing-the-boot-partition) + +[5. Booting in MSX-DOS 1 mode](#5-booting-in-msx-dos-1-mode) + +[6. Using a second storage device](#6-using-a-second-storage-device) + +[7. Locking drives](#7-locking-drives) + +[8. The reduced/zero allocation information mode](#8-the-reducedzero-allocation-information-mode) + +[9. Using the boot keys](#9-using-the-boot-keys) + +[10. Change history](#10-change-history) + + +## 1. Introduction + +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 walkthrough of the features that Nextor adds to MSX-DOS in the form of a step-by-step guide. In order to make it easier for everyone, this guide assumes that the blueMSX emulator with will be used for the walkthrough together with an emulated Sunrise IDE controller. Users of other emulators will need to adapt the steps of _[2. Setting up blueMSX](#2-setting-up-bluemsx)_ appropriately; on the other hand, users of real MSX hardware should take a look at _[2.1. Setting up a real MSX](#21-setting-up-a-real-msx)_. + +The reader of this document is assumed to have experience with MSX-DOS 2 at least at the user level. Also, It is a good idea to get acquainted with Nextor by reading _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ prior to (or in parallel with) this document. + +Note: in this guide the following Nextor tools will be used: MAPDRV.COM, LOCK.COM and RALLOC.COM. The other tools are simple enough for not needing a step-by-step usage explanation; remember however that all the Nextor tools are explained in the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ and that you can get help for any of the tools by invoking them without parameters or by issuing a TYPE command directly on the command file (for example `TYPE FASTOUT.COM`). + +## 2. Setting up blueMSX + +This section explains the steps needed to setup blueMSX in order to follow this guide. The blueMSX emulator can be downloaded at http://www.bluemsx.com. + +a. Download the following files from [Konamiman's MSX page](https://www.konamiman.com/msx/msx-e.html#nextor): + +* Nextor kernel with Sunrise IDE driver. + +* Nextor tools disk image + +b. Run blueMSX and select the _Tools - Machine Editor_ menu. + +c. Select the machine configuration named "MSX2". + +d. Select the Memory tab and press the _Add..._ button. + +e. In the Slot list select "Slot 1". In the _Type_ list select "Sunrise IDE". + +f. In the _File_ box browse the Nextor kernel file you have downloaded in step a (or simply paste the whole file path). Then press the Ok button to close the window. + +g. Press the _Save as..._ button and save the machine configuration with the name "MSX2 with Sunrise IDE and Nextor". Then press the Close button to close the window. + +h. Select the _File - Disk Drive A - Insert_ menu. Select the Nextor tools disk image file you have downloaded in step a. + +i. Select the _File - Hard Disk - IDE Sunrise Primary - Insert New Disk Image_ menu. In the _Disk Size_ list select "100 MB". Give the disk image any name you want and click the _Open_ button. + +Now you have an emulated MSX2 with a Sunrise IDE controller that has the Nextor kernel in its flash ROM and a 100MB hard disk as the master device. Also, you have the Nextor utils disk in the floppy disk drive. + +### 2.1. Setting up a real MSX + +If you want to follow the steps of this guide by using a real MSX computer with a Sunrise IDE controller and a floppy disk drive instead of an emulator, you will need to do the following: + +* Download the Nextor kernel with Sunrise IDE driver. + +* Copy the NEXTOR.SYS and COMMAND2.COM files and the Nextor tools to a floppy disk. You have two options: + + * Download the Nextor tools disk image file and transfer its contents to a floppy disk. + + * Download the Nextor tools LZH file and uncompress it to a floppy disk, together with the NEXTOR.SYS and COMMAND2.COM files. + +Note: The Nextor kernel, NEXTOR.SYS and the Nextor tools are available at [Konamiman's MSX page](https://www.konamiman.com/msx/msx-e.html#nextor). + +* Copy the MSXDOS.SYS and COMMAND.COM files to the floppy disk, these are necessary for the steps that involve booting in MSX-DOS 1 mode. These files are included in the Nextor tools disk image file, but can be found on other places on Internet too (search for "MSXDOS.SYS" on any search engine). + +* Insert the floppy disk in the drive and attach an IDE device (hard disk or compact flash card) of at least 100MB to the Sunrise IDE controller as the master device, or to the first card slot if you are using a CF reader. The device should be completely blank, that is, it should not contain any partition or filesystem; otherwise you may get different results from these described in the next section until you repartition the device. + +Please note that if you use an existing IDE device, **following the steps of this guide will delete all the data on the device**. + +## 3. Booting and creating partitions + +Once all the hardware (real or emulated) is in place, now we'll see what happens when we try to boot without having defined any partition for the IDE device, then we'll create and prepare some partitions. + +a. Boot your MSX. You will see that you boot in the COMMAND2 prompt in drive B:, as in the following image: + +![](img/gsg/NextorPrompt.png) + + +***What has happened?*** Nextor has assigned one drive to the Sunrise IDE driver (A:) and two drives to the floppy disk drive (B: and C:). Then it has attempted to search a suitable FAT12 or FAT16 partition in the attached hard disk in order to assign it to drive A:, but since the hard disk has no partitions yet, drive A: has been left unassigned. Drive B:, assigned to the floppy disk, is the first valid drive, and so it is used as the boot drive. + +b. Type BASIC and then CALL FDISK to invoke the device partitioning tool. + +c. Press "1" to select the Sunrise IDE driver, then "1" again to select the hard disk, then "1" again to select the first (and only) logical unit. + +d. If you were using an already partitioned device, press "D" to delete the existing partitions. + +e. Press "P" to add a partition. Type "50" to create a 50MB partition. + +f. Repeat step e but this time create a 25MB partition. + +g. Repeat step e but this time create a 16MB partition. + +i. Press "A" to use all the remaining disk space (9214K) for yet another partition. + +j. Press "S" to see the defined partitions. You should see four partitions, as in the following image: + +![](img/gsg/FourPartitionsList.png) + +k. Press ESC to return to the main menu, then press "W" to create the partitions on the disk. Press "y" on the data destroy warning prompt. + +l. Reset your MSX. You will see that the computer boots in the BASIC prompt. + +***What has happened?*** Nextor has assigned drive A: to the IDE controller again. However, since now the attached device has valid partitions, Nextor has assigned the first suitable partition found (the one that is 50MB big) to drive A:, so this is now the boot drive. But since the partition has not the Nextor boot files yet, the system boots in the BASIC prompt. + +m. Copy the Nextor system files from the floppy disk to drive A: by executing the following commands: + +``` +COPY "B:NEXTOR.SYS" TO "A:" +COPY "B:COMMAND2.COM" TO "A:" +``` + +n. Reset your computer and you will see that now it boots in the `COMMAND2.COM` prompt from drive A:. Issue a DIR command and you should see the following (notice the 50M free space): + +![](img/gsg/DirTwoSystemFiles.png) + +**NOTE:** Please be patient with the DIR command, especially if you are not using a MSX Turbo-R computer. Calculating the free space of a 50MB partition will take quite a few time to your MSX. If you are using an emulator, you can probably increase the speed of the emulated machine. + +## 4. Mapping partitions and changing the boot partition + +So far we have seen that Nextor has performed an automatic drive to partition mapping. Now we'll see how to instruct Nextor to select a different partition at boot time, and how perform manual mapping after the system has booted. + +a. Assign partition 2 to drive D: by executing the following command: + + B:MAPDRV D: 2 1 1 + +("2" is the second partition, and "1 1" means "device index 1 controlled by driver in slot 1". Issue a `TYPE B:MAPDRV.COM` command for more details.) + +b. Perform a `DIR D:` command. Check that drive D: has indeed 25MB of free space. + +c. Copy the Nextor system files to drive D: with the following commands: + +``` +COPY NEXTOR.SYS D: +COPY COMMAND2.COM D: +``` + +d. Create an empty file named NEXTOR.DAT in drive D:. You can achieve this by executing a `COPY CON D:NEXTOR.DAT` command, then pressing CTRL+Z, then pressing Enter. + +e. Reset your MSX, and when you are in the COMMAND2 prompt, perform a DIR command and check that this time drive A: is assigned to the second (25MB big) partition: + +![](img/gsg/DirWithNextorDat.png) + +***What has happened?*** When performing the automatic drive to device and partition mapping assignment at boot time, Nextor normally selects the first valid (FAT12 or FAT16) partition available. But if there are partitions with a file named "NEXTOR.DAT" in the root directory, then these partition have preference in the assignment process. The contents of the NEXTOR.DAT file are irrelevant in this version of Nextor. + +## 5. Booting in MSX-DOS 1 mode + +Now we will see what happens with the automatic partition assignment process when we try to boot in MSX-DOS 1 mode. + +a. Map partition 3 to drive D: by executing the following: + + B:MAPDRV D: 3 1 1 + +b. Copy the MSX-DOS 1 system files to drive D: by executing the following: + +``` +COPY B:MSXDOS.SYS D: +COPY B:COMMAND.COM D: +``` + +c. Reset the computer while keeping pressed the "1" key. You will boot in MSX-DOS 1 mode and in the COMMAND.COM prompt. Issue a DIR command and you should see the following (notice the 16M free space): + +![](img/gsg/DirInDos1Mode.png) + +***What has happened?*** When booting in MSX-DOS 1 mode, Nextor assigns one drive to the IDE driver and performs an automatic drive to device and partition assignment, as when booting in normal mode. However, this time the partitions that can't be handled in MSX-DOS 1 mode are skipped during the assignment procedure; MSX-DOS 1 can handle only FAT12 partitions with three or less sector per FAT. The first partition (50MB big) is skipped because it is FAT16. The second partition (25MB big) is skipped because it is FAT12 but has more than three sectors per FAT. Thus the third partition (16MB big) becomes the first one available, and it is then mapped to drive A:. + +Remember that all partitions of 16MB or less created with the Nextor built-in partitioning tool are MSX-DOS 1 compatible. + +d. Reboot the computer in normal mode again. + +e. Map partition 4 to drive D: by executing the following: + + B:MAPDRV D: 4 1 1 + +f. Copy the MSX-DOS 1 system files to drive D: as you did in step b, then create an empty NEXTOR.DAT file in drive D: as you did in the previous section. + +g. Boot the computer while keeping pressed the "1" key. You will boot in MSX-DOS 1 mode and in the COMMAND.COM prompt again. Issue a DIR command and you should see the following (notice the 9M free space): + +![](img/gsg/DirInDos1ModeWithNextorDat.png) + +***What has happened?*** The rule "give priority to partitions holding a file named NEXTOR.DAT at the root directory during the automatic drive to device and partition assignment at boot time" is valid when booting in MSX-DOS 1 mode too, but this time only the MSX-DOS 1 compatible partitions are checked (partitions 3 and 4 in this case, being partition 4 the "winner" partition). + +The remaining steps will leave the environment ready for the next section. + +h. Boot the computer in normal mode. + +i. You should have booted with partition 2 (the one 25M big) mapped to drive A:. If so, simply delete the NEXTOR.DAT file in that drive (`DEL NEXTOR.DAT`). If not, map partition 2 to drive D: (`B:MAPDRV D: 2 1 1`) and then delete the file (`DEL D:NEXTOR.DAT`). + +j. Map partition 4 to drive D: and then delete the NEXTOR.DAT file. + +## 6. Using a second storage device + +Now we will see what happens when we add a second storage device to the IDE controller. + +Step a applies when using the blueMSX emulator. If you are using a different emulator, you should perform the appropriate steps to attach a second 100M emulated hard disk as the slave device to the IDE controller. If you are using a real MSX, you should attach an (at least 100M big) real device configured as slave to the IDE controller, or insert an additional card in the second card slot. + +a. Select the _File - Hard Disk - IDE Sunrise Secondary - Insert New Disk Image_ menu. In the _Disk Size_ list select "100 MB". Give the disk image any name you want and click the _Open_ button. + +b. Reset the computer, go to BASIC and invoke the device partitioning tool with CALL FDISK. + +c. Partition the device as you did in [3. Booting and creating partitions](#3-booting-and-creating-partitions). This time, however, you should select device 2 in the device selection screen; and you should create just two partitions, the first one having a size of 85M and the second one of 15M. + +d. Reset the computer. Once in the COMMAND2 prompt, issue a _DIR_ command and check that drive A: has 50M free. Then issue a _DIR B:_ command and check that drive B: has 85M free (again, please be patient, especially with the second DIR command): + +![](img/gsg/DirAAndDirB.png) + +***What has happened?*** This time, Nextor has assigned two drives (A: and B:) to the Sunrise IDE driver, since two devices have been detected; the floppy disk controller has now drives C: and D: assigned. At boot time, Nextor assigns as many drives as devices are available to each controller (for device-based controllers only; see the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ for details about the controller types). + +Drive A: has been mapped to the first available partition on the first available device, as usual. However, once this has been done, Nextor has searched for more suitable partitions on additional devices to be mapped to drive B:. So drive A: is mapped to the first partition in the master device (50M big) and drive B: is mapped to the first partition in the slave device (85M big). + +e. Create an empty NEXTOR.DAT file in drive B:. Also, copy the NEXTOR.SYS and COMMAND2.COM files to drive B:. + +f. Reset your computer and issue a _DIR_ command, then a _DIR B:_ command. Notice that the mapping is reversed relative to the previous case (A: is mapped to the 85M partition on slave device, B: is mapped to the 50M partition on master device): + +![](img/gsg/DirAAndDirBWithFiles.png) + +***What has happened?*** The rule "give priority to partitions holding a file named NEXTOR.DAT at the root directory during the automatic drive to device and partition assignment at boot time" applies to all partitions on all devices, not only to the first device. Taking in account both the master and the slave devices, the only partition having a NEXTOR.DAT file is the first partition on the slave device, and therefore this one is assigned to drive A:. After this is done, other devices are scanned for a partition to be mapped to drive B:; in this case the only "other device" available is the master device, and thus its first partition is mapped to drive B:. + +g. Map partition 2 of slave device to drive B: (`C:MAPDRV B: 2 2 1`). Copy the MSXDOS.SYS and COMMAND.COM files to drive B:. + +h. Reset the computer while keeping pressed the "1" key. You will boot in MSX-DOS 1 mode and in the `COMMAND.COM` prompt. Issue a `DIR` command, then a `DIR B:` command. Notice that in the first case you get 16M of free space, and in the second case you get 15M: + +![](img/gsg/DirAAndDirBDos1Mode.png) + +***What has happened?*** Drive A: has been mapped to the first available partition on the master device, and drive B: has been mapped to the first available partition on the slave device, as in the previous case. However, this time only the MSX-DOS 1 compatible partitions have been taken in account. These are partitions 3 and 4 in the master device (partition 3, 16M big, is selected) and partition 2 in the slave device (15M big). + +i. Create an empty NEXTOR.DAT file in drive B:. + +j. Reset the computer while keeping pressed the "1" key. You will boot in MSX-DOS 1 mode and in the `COMMAND.COM` prompt. Issue a `DIR` command, then a `DIR B:` command. Notice that the mapping is reversed relative to the previous case (A: is mapped to the 15M partition on slave device, B: is mapped to the 16M partition on master device): + +![](img/gsg/DirAAndDirBDos1ModeWithNextorDat.png) + +***What has happened?*** You should have guessed it already: both devices have been scanned for partitions, only the MSX-DOS 1 partitions have been taken in account, and the partition having a NEXTOR.DAT file has been given priority in the mapping process and thus it has been mapped to drive A:. + +k. Delete the NEXTOR.DAT from drive A:. Reset your computer in normal mode, delete the NEXTOR.DAT from drive A: again, and reset once more. You should be in the COMMAND2 prompt and have the 50M partition mapped to drive A:. + +## 7. Locking drives + +In this section we'll try the drive lock feature. + +a. Execute the following command: `C:LOCK C: ON` + +b. Issue a `DIR C:` command. You will see a directory listing of the Nextor tools floppy disk. + +c. Remove the floppy disk from the drive (if you are using blueMSX, select the `File - Disk Drive A - Eject: nextor.dsk` menu option). + +d. Issue a `DIR C:` command again. You will see the same directory listing again instead of getting a "Not Ready" error, even though the disk has been removed from the drive. + +***What has happened?*** Whenever Nextor is about to access the contents of a drive (and the drive is not mapped to a fixed device on a device-based driver), it first asks the driver if the associated storage media has changed. If the answer is "Yes" or "Not sure", then it takes the appropriate actions: for devices on a device-based driver, it assigns the first available partition on the device to the drive; for other drivers (MSX-DOS legacy drivers and drive-based drivers), it simply clears sector buffers and creates again the disk parameters block for the drive. (The "Not sure" response gets actually a special treatment; see the Nextor user manual for more details) + +When a drive is locked, Nextor will never ask the driver for device change status when accessing that drive, and will instead assume that the device will never change. This improves performance as it saves both CPU processing and device access. + +In this case, we have locked the floppy disk drive, whose change status would otherwise be checked on each disk access (floppy disk drives usually report a change status of "Not sure" always). When issuing the second DIR command, Nextor assumes that the disk has not changed, and since it still has the directory and FAT sectors cached in memory, it can display the disk contents even if the disk has been removed from the drive. + +Nextor will clear then cached sector for a drive at the moment of locking it, therefore if you had reversed the order of steps a and b you would have effectively got a "Not Ready" error. + +e. Insert the Nextor tools floppy disk in its drive again. + +## 8. The reduced/zero allocation information mode + +Now we will set the reduced allocation mode on the FAT16 partition available on each device and see what happens. + +a. Reset your computer. Check that drive A: is mapped to the 50M partition on the master device, and drive B: is mapped to the 85M partition on the slave device. + +b. Issue a `VOL A:50M` command, then a `VOL B:85M` command, in order to help identifying the partitions without having to rely on its free size: + + ![](img/gsg/VolAndDir.png) + +c. Execute the following commands: + +``` +C:RALLOC A: ON +C:RALLOC B: ON +``` + +d. Issue a `DIR` command, then a `DIR B:` command. Notice that now the free space reported is 32M for both partitions: + +![](img/gsg/RallocThenDir.png) + +***What has happened?*** When a drive is in reduced allocation information mode, the Nextor function ALLOC, which returns information about the total and free space on a drive and is used by `COMMAND2.COM` to display the free space, returns 32MB when the real amount is larger than this value. This may be useful when using old software that ask the operating system how much free space is available in the drive, and expect the result (in sectors) to fit in 16 bits. + +e. Execute the following command: + + SET ZALLOC = ON + +f. Issue again the `DIR` and `DIR B:` commands. Notice that this time the free space reported is zero for both partitions, and the DIR commands finish immediately after displaying the last file name. + +***What has happened?*** When an environment item named ZALLOC exists and has the value ON (case insensitive), the reduced allocation information mode becomes the zero allocation information mode, causing the ALLOC function to return zero free space available for the drives that are in this mode. You can use this mode if you have a very large drive and/or are using a very slow device, to prevent the computer from hanging for a few seconds every time a DIR command is issued. + +Note: the zero allocation information mode is available since Nextor 2.0.3. + +## 9. Using the boot keys + +We have seen that if key "1" is kept pressed while the computer is booting, Nextor starts in MSX-DOS 1 mode. Now we'll see other useful keys that can be used to alter the way Nextor boots; see the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ for a full list of the available keys. + +a. Reset your computer while keeping the "3" key pressed. You will see that the computer boots in the BASIC prompt. + +***What*** has happened? When the "3" key is kept pressed at boot time, Nextor ignores any NEXTOR.SYS, MSXDOS.SYS and AUTOEXEC.BAS files present in the boot drive, and boots in the MSX-BASIC prompt. + +b. Issue a `CALL SYSTEM` command. + +c. Copy the DRIVERS tool to drive A: with the following command: `COPY C:DRIVERS.COM A:` + +d. Execute the DRIVERS tool. You will see that the IDE controller had been assigned two drives at boot time, and the same happens with the floppy disk controller: + +![](img/gsg/DriversTwoDrives.png) + +e. Reset your computer while keeping the "CTRL" key pressed. Once in the COMMAND2.COM prompt, execute the DRIVERS tool again. You will see that both the IDE controller and the floppy disk drive have been assigned only one drive each: + +![](img/gsg/DriversOneDrive.png) + +***What has happened?*** When the "CTRL" key is kept pressed at boot time, Nextor will assign one single drive to Nextor drivers, regardless of the number of attached devices (for device-based controllers only; see the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ for details about the controller types). The same behavior is exhibited by the floppy disk controller as usual. + +f. Reset your computer while keeping the "SHIFT" key pressed. Once in the COMMAND2.COM prompt, execute the DRIVERS tool again. You will see that no drives have been assigned to the floppy disk drive: + +![](img/gsg/DriversOneController.png) + +***What has happened?*** When the "SHIFT" key is kept pressed at boot time, all the storage controllers with a MSX-DOS kernel (including the floppy disk drive controller) will disable themselves, but Nextor will not. This is useful to maximize the amount of available memory, especially in MSX-DOS 1 mode, as shown in the next step. (There are boot keys to selectively disable the Nextor kernels as well; see the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ for details) + +g. Reset your computer while keeping the "1" and "3" keys pressed simultaneously. Once in the BASIC prompt, issue a `PRINT FRE(0)` command. You will see that there are about 20K free for BASIC code. + +h. Reset your computer while keeping the "1", "3", "SHIFT" and "CTRL" keys pressed simultaneously. Once in the BASIC prompt, issue a `PRINT FRE(0)` command again. You will see that now the free memory is about 25K. Also, if you execute a `CALL DRVINFO` command, you will see that indeed, there is only one drive assigned: + +![](img/gsg/DrvinfoInBasic.png) + +**Note:** of course, you do not need to keep the "CTRL" key pressed while booting if you have only one device attached to your Nextor controller (unless you want to keep the floppy disk drive active but with only one drive assigned). + +## 10. Change history + +Please look at the file history in the Git repository if you are interested in the change history for this document. For the legacy changes list for the 2.0 branch, please look at the _[Nextor 2.0 Getting Started Guide](../../../blob/v2.0/docs/Nextor%202.0%20Getting%20Started%20Guide.md#10-change-history)_ document. diff --git a/docs/Nextor 2.1 Programmers Reference.md b/docs/Nextor 2.1 Programmers Reference.md new file mode 100644 index 00000000..5bf71e51 --- /dev/null +++ b/docs/Nextor 2.1 Programmers Reference.md @@ -0,0 +1,725 @@ +# Nextor 2.0 Programmers Reference + +## Index + +[1. Introduction](#1-introduction) + +[2. Changes in existing function calls](#2-changes-in-existing-function-calls) + +[2.1. _STROUT (09h)](#21-_strout-09h) + +[2.2. _ALLOC (1Bh)](#22-_alloc-1bh) + +[2.3. _RDABS (2Fh) and _WRABS (30h)](#23-_rdabs-2fh-and-_wrabs-30h) + +[2.4. _DPARM (31h)](#24-_dparm-31h) + +[2.5. _DEFER (64h)](#25-_defer-64h) + +[2.6. _EXPLAIN (66h)](#26-_explain-66h) + +[2.7. _FORMAT (67h)](#27-_format-67h) + +[2.8. _DOSVER (6Fh)](#28-_dosver-6fh) + +[2.8.1 Detecting Nextor in MSX-DOS 1 mode](#281-detecting-nextor-in-msx-dos-1-mode) + +[3. New function calls](#3-new-function-calls) + +[3.1. Get/set fast STROUT mode (_FOUT, 71h)](#31-getset-fast-strout-mode-_fout-71h) + +[3.2. Print a zero-terminated string (_ZSTROUT, 72h)](#32-print-a-zero-terminated-string-_zstrout-72h) + +[3.3. Read absolute sectors from drive (_RDDRV, 73h)](#33-read-absolute-sectors-from-drive-_rddrv-73h) + +[3.4. Write absolute sectors to drive (_WRDRV, 74h)](#34-write-absolute-sectors-to-drive-_wrdrv-74h) + +[3.5. Get/set reduced allocation information mode vector (_RALLOC, 75h)](#35-getset-reduced-allocation-information-mode-vector-_ralloc-75h) + +[3.6. Get drive space information (_DSPACE, 76h)](#36-get-drive-space-information-_dspace-76h) + +[3.7. Lock/unlock a drive, or get lock state for a drive (_LOCK, 77h)](#37-lockunlock-a-drive-or-get-lock-state-for-a-drive-_lock-77h) + +[3.8. Get information about a device driver (_GDRVR, 78h)](#38-get-information-about-a-device-driver-_gdrvr-78h) + +[3.9. Get information about a drive letter (_GDLI, 79h)](#39-get-information-about-a-drive-letter-_gdli-79h) + +[3.10. Get information about a device partition (_GPART, 7Ah)](#310-get-information-about-a-device-partition-_gpart-7ah) + +[3.11. Call a routine in a device driver (_CDRVR, 7Bh)](#311-call-a-routine-in-a-device-driver-_cdrvr-7bh) + +[3.12. Map a drive letter to a driver and device (_MAPDRV, 7Ch)](#312-map-a-drive-letter-to-a-driver-and-device-_mapdrv-7ch) + +[3.13. Enable or disable the Z80 access mode for a driver (_Z80MODE, 7Dh)](#313-enable-or-disable-the-z80-access-mode-for-a-driver-_z80mode-7dh) + +[4. New error codes](#4-new-error-codes) + +[5. Extended mapper support routines](#5-extended-mapper-support-routines) + +[5.1. BLK_ALLOC: Allocate a memory block](#51-blk_alloc-allocate-a-memory-block) + +[5.2. BLK_FREE: Free a memory block](#52-blk_free-free-a-memory-block) + +[6. Other features](#6-other-features) + +[6.1. Correction of the ESC-Y escape sequence bug in STROUT function](#61-correction-of-the-esc-y-escape-sequence-bug-in-strout-function) + +[6.2. Changing the NEXTOR.SYS version number](#62-changing-the-nextorsys-version-number) + +[7. Change history](#7-change-history) + +[7.1. v2.1.0 beta 1](#71-v210-beta-1) + + +## 1. Introduction + +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 reference of the new features that Nextor adds to MSX-DOS 2 from a developer point of view (basically the new function calls provided, but also some other useful information). The development of device drivers for Nextor is not covered in this document; this topic has a separate document devoted to itself, _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_. + +The reader of this document is assumed to have experience developing applications for MSX in general and for MSX-DOS 2 in particular (specifically, the information covered by chapter 3 of _MSX2 Technical Handbook_ and the _[MSX-DOS 2 Program Interface Specification](DOS2-PIS.TXT)_ and _[MSX-DOS 2 Function Codes Specification](DOS2-FCS.TXT)_ documents is assumed to be known). Also, it is a good idea to get acquainted with Nextor by reading _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ prior to this document. + +## 2. Changes in existing function calls + +This section details what Nextor has changed in the function calls already existing in MSX-DOS 2. All the changes are non-breaking except a minor issue with 16 bit sector numbers in function _DPARM. + +Only the changes introduced in Nextor are explained, the complete description of the functions is not provided here. See the _[MSX-DOS 2 Function Codes Specification](DOS2-FCS.TXT)_ document for more details on these function calls. + +### 2.1. _STROUT (09h) + +When the fast STROUT mode is enabled, the maximum printable string length is 511 characters; if the string is longer, only the first 511 characters will be printed. The fast STROUT mode is disabled by default, it must be explicitly enabled by using the new _FOUT function. + +### 2.2. _ALLOC (1Bh) + +When the reduced allocation information mode is enabled for a drive, this function will return a false total and/or free cluster count when necessary so that when multiplied by the sectors per cluster amount, the result will give 32MB or less when called for that drive. The reduced allocation information mode is disabled by default for all drives, it must be explicitly enabled for each desired drive by using the new _RALLOC function. + +Moreover, starting at Nextor 2.0.3 the reduced allocation information mode can be turned into a zero allocation information mode by simply creating an environment item named ZALLOC with value ON (case insensitive). When this item exists, _ALLOC returns zero clusters free for all the drives in reduced allocation information mode. + +### 2.3. _RDABS (2Fh) and _WRABS (30h) + +These functions will work only when the accessed drive contains a FAT12 filesystem. They will return a "Not a DOS disk" error when a drive containing a FAT16 filesystem or an unknown filesystem is accessed. + +Strictly speaking, this is not a change from the behavior in MSX-DOS, since FAT12 was the only filesystem supported by that operating system. However, when a drive containing a FAT16 filesystem is read in MSX-DOS, its boot sector is mistook for a FAT12 boot sector, and the functions succeed. In Nextor FAT16 filesystems are explicitly rejected by these functions; this is done on purpose to prevent programs, such as CHKDSK or IMPROVE, that do low-level processing on drives assuming that they have a FAT12 filesystem, to cause data corruption when accidentally ran on these drives. + +New applications should use instead the new functions _RDDRV and _WRDRV, which accept 32 bit sector numbers and allow access to any drive regardless of the contained filesystem. + +### 2.4. _DPARM (31h) + +This function now returns the total number of logical sectors as a 32 bit value at position +24..27 in the returned parameter block. Moreover, when this number is greater than 65535, the 16 bit sector count returned at position +9,10 will be zero. + +Also, position +28 of the returned parameter block contains the filesystem type: + +``` +0: FAT12 +1: FAT16 +255: Other +``` + +Remember that Nextor can currently handle FAT12 and FAT16 filesystems only. + +### 2.5. _DEFER (64h) + +The parameters passed to the user routine in case of disk error are extended to support 32 bit sector numbers. In MSX-DOS 2, part of these parameters were as follows: + +``` +C:b3 - set if sector number is valid +DE = Sector number (if b3 of C is set) +``` + +In Nextor, these parameters are: + +``` +C:b3 - set if sector number is valid and fits in 16 bits (that is, b4 is set and HL=0) +C:b4 - set if sector number is valid +HL:DE = Sector number (if b4 of C is set) +``` + +### 2.6. _EXPLAIN (66h) + +If an environment variable named ERRLANG exists with value EN (`SET ERRLANG=EN` from the command interpreter prompt), this function will return error messages in English even if the kanji mode is active (`CALL KANJI` from the BASIC interpreter). This feature is available since Nextor 2.0.4. + +### 2.7. _FORMAT (67h) + +In MSX-DOS 2 this function accepts two special choice parameters, FFh and FEh, that do not actually format the disk but generate a MSX-DOS 2 boot sector, including the disk parameters, based on the media ID of the disk. This feature is used by the FIXDISK program to convert old MSX-DOS 1 disks into MSX-DOS 2 disks. + +Nextor adds three new choice parameters: + +* FDh: Assuming that the disk has a FAT12 or FAT16 filesystem with valid disk parameters on the boot sector (otherwise a "Not a DOS disk" will be returned), a standard boot sector will be composed for the disk by (1) setting the manufacturer name as "NEXTOR", and (2) generating an extended block (byte 29h, plus volume ID, plus volume name, plus "FAT12" or "FAT16" mark). The disk parameters will not be modified. If the disk contains an extended block already, only the manufacturer name will be changed (thus maintaining the existing volume ID). This choice is useful for using the dirty disk flag feature on disks already formatted by another system. + +* FCh: It is the same as FDh, but if the disk filesystem is FAT12, a MSX-DOS 2 boot sector (with the "VOL_ID" string) will be composed instead of a standard boot sector. If the disk filesystem is FAT16, this choice works the same way as FDh. This choice is useful if the disk is to be used on MSX-DOS 2 systems. + +* FBh: Will perform a "quick format" on the disk, by simply clearing the FAT and root directory areas. As with the other two new choices, the disk must have a valid FAT12 or FAT16 boot sector, otherwise a "Not a DOS disk" error will be returned. + +When the disk is actually formatted (choice 1..9), a MSX-DOS 2 boot sector will always be generated. + +### 2.8. _DOSVER (6Fh) + +This function call has been expanded in order to allow applications to detect whether they are running MSX-DOS 2 or Nextor (both in Normal or MSX-DOS 1 mode), while at the same time still working for applications that expect the operating system to be MSX-DOS. + +The procedure for detecting Nextor is as follows. The application must invoke the _DOSVER function with the following “magic numbers” as input parameters: + +``` +B = 5Ah +HL = 1234h +DE = ABCDh +IX = 0 +``` + +When the operating system is MSX-DOS 2, then this function call will return IX = 0 (since MSX-DOS does not modify the IX and IY registers unless they return a result, and no result is returned in these registers by this function). When running Nextor and the magic numbers are NOT supplied, the function call will return IX and IY unmodified as well, to maintain compatibility with MSX-DOS 2. + +When the operating is Nextor and the magic numbers are provided, then the following information is returned: + +``` +B = Emulated MSX-DOS kernel major version number (always 2) +C = Emulated MSX-DOS kernel minor version number (always 31h) +D = NEXTOR.SYS major version number in BCD format +E = NEXTOR.SYS minor version number in BCD format +HL = Address of an operating system descriptive string in kernel ROM +IXh = 1 +IXl = Nextor major version number (2-15) +IYh = Nextor secondary version number (0-15) +IYl = Nextor revision number (0-255) +``` + +The procedure for detecting the operating system for Nextor aware applications is then as follows: + +1. Call the DOSVER function with the magic numbers set. +2. If there is an error (A<>0) then the operating system is neither MSX-DOS nor Nextor. +3. If B<2 then the operating system is MSX-DOS 1. +4. If IX is 0 then the operating system is MSX-DOS 2. Look at registers B and C for the version number. +5. If IXh is 1 then the operating system is Nextor. Look at registers IXh, IYh and IYl for the version number. +6. If IXh is neither 0 nor 1 then the operating system is neither MSX-DOS nor Nextor. + +The value returned in HL is a pointer to a zero-terminated printable string that describes the operating system running, for example "Nextor kernel version 2.0". The string resides in the kernel master slot (slot number is available at 0F348h) and can be readed via standard RDSLT calls. + +#### 2.8.1 Detecting Nextor in MSX-DOS 1 mode + +The DOSVER function has been made available in MSX-DOS 1 mode, so you can detect Nextor in this mode. + +The results of the DOSVER function when invoked in MSX-DOS 1 mode are the same returned in normal mode, except that BC=0100h and no meaningful value is returned in HL. However, since the function can be called via de 0F37Dh hook only (see _[3. New function calls](#3-new-function-calls)_), index registers get corrupted, therefore the “check that IX=0” method can't be used to detect Nextor. Instead, DOSVER will return A=1 when ran in MSX-DOS 1 mode. + +Therefore, if your application can work in MSX-DOS 1 mode but you still want to know if you are running in Nextor or in an old MSX-DOS 1 kernel, the detection procedure is as follows: + +1. Set the magic numbers as in the normal mode detection case. +2. Call the DOSVER function via the F37Dh entry point. Do NOT use the 0005h entry point. +3. If A=1, B=1 and IXh=1, then you are running Nextor in MSX-DOS 1 mode. Look at registers IXh, IYh and IYl for the Nextor version number. +4. Otherwise, follow the procedure for the normal mode, as described in the previous section. + +## 3. New function calls + +This section details the new function calls introduced by Nextor. These are invoked the same way as the existing MSX-DOS calls, by setting the function number in register C and calling address 0005h or F37Dh. The specified short name for each function (for example “_FOUT”) is the suggested name for referring the function call in code, and is also the name used for function cross references in this manual. + +Some of the new function calls can be invoked in MSX-DOS 1 mode as well; in the current version, these functions are GDRVR, GPART, CDRVR and GDLI. When invoked in MSX-DOS 1 mode, all the new Nextor function calls have the following restrictions: + +* They must be called by using the F37Dh entry point. The 0005h entry point is not supported, since there is no special version of MSXDOS.SYS for Nextor. + +* When data is exchanged with the invoking application program by using a buffer in RAM, the buffer cannot be in page 1 (addresses 4000h-7FFFh). +Additional restrictions apply for some of the functions. See the functions descriptions for more details. + +### 3.1. Get/set fast STROUT mode (_FOUT, 71h) + +``` +Parameters: C = 71H (_FOUT) + A = 00H => get fast STROUT mode + 01H => set fast STROUT mode + B = 00H => disable (only if A=01H) + FFH => enable (only if A=01H) + +Results: A = Error + B = Current fast STROUT mode +``` + +This function enables or disables the fast STROUT mode. When enabled, the _STROUT and _ZSTROUT functions will work faster, but the maximum printable string length will be 511 characters; if the string is longer, only the first 511 characters will be printed. + +### 3.2. Print a zero-terminated string (_ZSTROUT, 72h) + +``` +Parameters: C = 72H (_ZSTROUT) + DE = Address of string + +Results: A = 0 (never returns an error) +``` + +Prints on the screen the string pointed by DE, the string must be terminated with a zero character. This function is affected by the fast STROUT mode. + +### 3.3. Read absolute sectors from drive (_RDDRV, 73h) + +``` +Parameters: C = 73H (_RDDRV) + A = Drive number (0=A: etc.) + B = Number of sectors to read + HL:DE = Sector number + +Results: A = Error code (0=> no error) +``` + +This function reads sectors directly from a drive. Unlike _RDABS, this function is able to read sectors regardless of the filesystem viewed through the drive (FAT12, FAT16 or an unknown filesystem), and even when there is no filesystem at all. + +The sectors will be read to the current disk transfer address. Any disk error will be reported by the system in the usual way. + +### 3.4. Write absolute sectors to drive (_WRDRV, 74h) + +``` +Parameters: C = 74H (_WRDRV) + A = Drive number (0=A: etc.) + B = Number of sectors to write + HL:DE = Sector number + +Results: A = Error code (0=> no error) +``` + +This function writes sectors directly to a drive. Unlike _WRABS, this function is able to write sectors regardless of the filesystem viewed through the drive (FAT12, FAT16 or an unknown filesystem), and even when there is no filesystem at all. + +The sectors will be written from the current disk transfer address. Any disk error will be reported by the system in the usual way. + +### 3.5. Get/set reduced allocation information mode vector (_RALLOC, 75h) + +``` +Parameters: C = 75H (_RALLOC) + A = 00H => get current vector + 01H => set vector + HL = new vector (only if A=01H) + +Results: A = 0 (never returns an error) + HL = Current vector +``` + +This function obtains or sets the reduced allocation information mode vector. The vector assigns one bit for each drive; bit 0 of L is for A:, bit 1 of L is for B:, etc. This bit is 1 if the reduced allocation mode is currently enabled (when getting vector) or to be enabled (when setting vector) for the drive, 0 when the mode is disabled or to be disabled. + +### 3.6. Get drive space information (_DSPACE, 76h) + +``` +Parameters: C = 76H (_DSPACE) + E = drive number (0 = default, 1 = A:, etc) + A = 00H => get free space + 01H => get total space + +Results: A = error code + HL:DE = space in kilobytes + BC = extra space in bytes +``` + +This function returns the total or free space for a drive. The space information is always returned in Kilobytes, regardless of the type and the cluster size of the filesystem mapped to the drive. + +The "extra free space in bytes" result will be different from zero only when the minimum allocation unit of the drive is not a whole number of kilobytes. In case of FAT drives, it will be non-zero (specifically, it will be 512) only when the drive uses one sector per cluster and the cluster count is odd. For example, for a drive having one sector per cluster and 15 free clusters, this function will return HL=0, DE=7 and BC=512 when called with A=0 for that drive. + +The space information returned by this function is always real, it is not affected by the reduced/zero allocation information mode. + +### 3.7. Lock/unlock a drive, or get lock state for a drive (_LOCK, 77h) + +``` +Parameters: C = 77H (_LOCK) + E = physical drive (0=A:, 1=B:, etc) + A = 00H => get lock status + 01H => set lock status + B = 00H => unlock drive (only if A=01H) + FFH => lock drive (only if A=01H) + +Results: A = Error code + B = Current lock status, same as input +``` + +This function locks or unlocks a drive, or gets the current lock state for a drive. When a drive is locked, Nextor will assume that the media on that drive will never be changed, and therefore will never ask the associated driver for media change status; thus resulting in an overall increase on media access speed. This is useful when using removable devices, such as multimedia cards, as the main storage device. + +In order to be locked, the drive must be mapped to a valid filesystem (that is, the drive must be accessible); otherwise an error will be returned and the drive will not be locked. + +Once a drive is locked, any disk error that is aborted will automatically unlock the drive. + +Locking and unlocking operations cause all the buffers for the drive to be flushed and invalidated. Also, cached disk parameters for the media are deleted so the next access to the media will re-read them. + +It is possible to lock non-removable devices associated to device-based drivers, however it makes no sense to do that, since Nextor will never ask for media change status for this kind of devices. + +Locking feature must be used with care. Changing the device of a locked drive without first unlocking it may result in data corruption, both in the original (locked) media and in the newly inserted media. + +### 3.8. Get information about a device driver (_GDRVR, 78h) + +``` +Parameters: C = 78H (_GDRVR) + A = Driver index, or 0 to specify slot and segment + D = Driver slot number (only if A=0) + E = Driver segment number, FFh for drivers in ROM + (only if A=0) + HL = Pointer to 64 byte data buffer + +Results: A = Error code + HL = Filled with data about driver +``` + +Returns information about a device driver present in the system. This function works in MSX-DOS 1 mode. + +The device driver can be specified by index or by slot and segment number pair. To specify the driver by index, set the index number (starting at 1) in register A; the slot and segment number for the driver is returned in the data buffer together with other driver information. This is useful to discover which drivers are present in the system. + +If you know already the slot and segment numbers of the driver you want to gather information about, set these parameters in registers D and E, and set A=0. The slot and segment numbers are returned anyway in the data buffer, as in the case of specifying a driver index. + +An .IDRVR error will be returned if there is no driver associated to the specified index, or if there is no driver with the specified slot and segment pair. There is no way to know in advance how many drivers are present in the system, so to discover all the drivers this function must be invoked several times, starting with driver index 1 and increasing the index number until a .IDRVR error is obtained. + +The information returned in the data buffer is as follows: + +``` ++0: Driver slot number ++1: Driver segment number, FFh if the driver is embedded within a Nextor + or MSX-DOS kernel ROM (always FFh in current version) ++2: Number of drive letters assigned to this driver at boot time ++3: First drive letter assigned to this driver at boot time (A:=0, etc), + unused if no drives are assigned at boot time ++4: Driver flags: + bit 7: 1 => the driver is a Nextor driver + 0 => the driver is a MSX-DOS driver + (embedded within a MSX-DOS kernel ROM) + bits 6-3: Unused, always zero + bit 2: 1 if the driver implements the DRV_CONFIG routine + bit 1: Unused, always zero + bit 0: 1 => the driver is a device-based driver + 0 => the driver is a drive-based driver ++5: Driver main version number ++6: Driver secondary version number ++7: Driver revision number ++8: Driver name, left justified, padded with spaces (32 bytes) ++40..+63: Reserved (currently always zero) +``` + +In the case of MSX-DOS drivers, the driver flags byte is always zero, and no information about driver version number or driver name is returned. + +Nextor uses the DRV_CONFIG routine starting at version 2.0.5. See the _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_ document for details. + +### 3.9. Get information about a drive letter (_GDLI, 79h) + +``` +Parameters: C = 79H (_GDLI) + A = physical drive (0=A:, 1=B:, etc) + HL = Pointer to 64 byte data buffer + +Results: A = Error code + HL = Filled with data about the drive +``` + +Returns information about a given drive letter. This function works in MSX-DOS 1 mode. + +The information returned in the data buffer is as follows: + +``` ++0: Drive status + 0: Unassigned + 1: Assigned to a storage device attached to a Nextor or MSX-DOS driver + 2: Unused + 3: A file is mounted in the drive + 4: Assigned to the RAM disk (all other fields will be zero) ++1: Driver slot number ++2: Driver segment number, FFh if the driver is embedded within a Nextor + or MSX-DOS kernel ROM (always FFh in current version) ++3: Relative drive number within the driver + (for drive-based drivers only; FFh if device-based driver) ++4: Device index (for device-based drivers only; + 0 for drive-based drivers and MSX-DOS drivers) ++5: Logical unit index (for device-based drivers only; + 0 for drive-based drivers and MSX-DOS drivers) ++5..+8: First device sector number (for devices in device-based drivers only; + always zero for drive-based drivers and MSX-DOS drivers) ++9..+63: Reserved (currently always zero) +``` + +If a file is mounted in the drive, the information returned in the data buffer is insetad as follows: + +``` ++1: Drive where the mounted file is located (0 = A:, etc) ++2: Flags: + bit 0: mount mode, 0 = read and write, 1 = read-only ++3: Always 0 ++4: Filename in printable format (up to 12 characters, plus a terminating zero) +``` + +If a drive larger than the maximum drive number supported by the system is specified, an .IDRV error will be returned. Note that if a drive number is specified which is legal in Nextor, but is currently not assigned to any driver, then no error will be returned, but an empty information block will be returned (the drive status byte should be checked). + +The "first device sector number" is the absolute device sector number that is treated as the first logical sector for the drive; usually it is either the starting sector of a device partition, or the device absolute sector zero, if the device has no partitions. Note that you can't test this value against zero to check whether the drive is assigned to a block device on a device-based driver or not (use the “drive status” field for this purpose). + +### 3.10. Get information about a device partition (_GPART, 7Ah) + +``` +Parameters: C = 7AH (_GPART) + A = Driver slot number + B = Driver segment number, FFh for drivers in ROM + (must be always FFh in current version) + D = Device index + E = Logical unit index + H = Primary partition number (1 to 4) + L = Extended partition number + (0 for an entry in the primary partition table) + +Results: A = Error code + B = Partition type code, + 0 if the specified partition does not exist + HL:DE = Starting device absolute sector number of the partition +``` + +Returns information about a device partition. This function works in MSX-DOS 1 mode. + +This function only works on device-based drivers; if a non-existing driver, a drive-based driver, or a MSX-DOS driver is specified in A and B, then an .IDRVR error will be returned. If the specified device and/or logical unit do not exist in the driver, an .IDEVL error will be returned. + +Storage devices are usually divided in partitions, each one being an independent logical volume residing in a contiguous block of sectors in the media. This function allows finding the starting sector of a given partition in the media, usually in order to map it to a drive letter by using the MAPDRV function, so that the contained filesystem can be accessed by Nextor. + +The partition type code returns information about the filesystem that the partition holds. The code may be one of the following: + +``` +0: None (the partition with the specified number does not exist) +1: FAT12 +4: FAT16, smaller than 32MB (obsolete) +5: Extended (see below) +6: FAT16 +14: FAT16 (LBA) +``` + +There are many more partition type codes defined, but they refer to filesystems that can't be handled by Nextor so they are not listed here. + +A device can have up to four primary partitions, numbered 1 to 4. In order to accommodate more than four partitions, partition number 2 may be of a special type named "Extended". An extended partition is actually a container for more partitions; there is no limit in the number of extra partitions that a partition of type "Extended" can contain. Primary partitions 3 and 4 do not exist when partition 2 is extended. + +In order to enumerate all the partitions existing in a device , the following procedure should be followed, to take in account the possible presence of extended partitions: + + 1. Search partition 1-0 (primary number 1, extended number 0). + +2. Search partition 2-0. If it exists and is of type "Extended", search partitions 2-1, 2-2, 2-3, etc, until a partition code 0 is returned. + +3. If partition 2-0 does not exist or is not of type "Extended", search partitions 3-0 and 3-4. + +Note that it is possible that a device has no partitions at all. In this case, it is still possible that the device contains a valid filesystem, mapped to the absolute device sector zero; this is indeed the case of floppy disks and devices with very small capacity. + +When a partition is mapped to a drive letter, the partition first sector will always be examined in order to determine the actual filesystem hold by the partition. Nextor will never rely in the partition type code to determine the filesystem type. + +Nextor needs to read the device in order to search for partitions. If there is any error when accessing the device (for example, not ready), an error code will be returned. The standard system error handling routine (or the user error handling routine, if one is defined with _DEFER) will NOT be invoked. + +When the specified partition does not exist in the device (for example, when a primary partition number larger than 4 is specified, or when an extended partition number is specified for a non-extended primary partition), then B=0 and A=.IPART will be returned. + +### 3.11. Call a routine in a device driver (_CDRVR, 7Bh) + +``` +Parameters: C = 7BH (_CDRVR) + A = Driver slot number + B = Driver segment number, FFh for drivers in ROM + (must be always FFh in current version) + DE = Routine address + HL = Address of a 8 byte buffer with the input register + values for the routine + +Results: A = Error code + BC, DE, HL = Results from the routine + IX = Value of AF returned by the routine +``` + +Allows direct invocation of a routine in a device driver. This function works in MSX-DOS 1 mode. + +Routines for any driver type (MSX-DOS, device-based and drive-based) can be invoked with this function, however it is intended primarily for device-based drivers, in order to enumerate devices (DEV_INFO and LUN_INFO) and directly access the device absolute sectors (DEV_RW routine), for example to develop device partitioning tools. The available routines for device drivers are enumerated and described in detail in the _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_ document. + +The input value of registers AF, BC, DE and HL for the routine must be provided in an 8 byte buffer pointed by HL. The order of the register values in the buffer is as follows: F, A, C, B, E, D, L, H. The output values of these registers, on the other hand, are returned directly in the registers themselves; except the output value of AF which is returned in IX. + +Some routines accept data from, or write data to, memory buffers supplied by the user. There are two limitations for exchanging data with the driver routines in this way: first, the buffer must be in the primary mapper slot; and second, the buffer may not be partially or totally in page-1. These limitations do not apply for the 8 byte register buffer (remember however that when invoking Nextor function calls via the F37Dh hook, no parameters can be passed in page-1). The register buffer is only used before effectively executing the driver routine, therefore there is no problem if it overlaps with any buffer used by the routine to return data. + +An .IDRVR error will be returned by this function call if a non-existing driver is supplied in A and B. Use the Nextor function _GDRVR to discover the location of the existing drivers. + +### 3.12. Map a drive letter to a driver and device (_MAPDRV, 7Ch) + +``` +Parameters: C = 7CH (_MAPDRV) + A = Physical drive (0=A:, 1=B:, etc) + B = Action to perform + 0: Unmap the drive + 1: Map the drive to its default state + 2: Map the drive by using specific mapping data + 3: Mount a file in the drive + HL = Address of a 8 byte buffer with mapping data (if B=2) + Address of the file name or FIB (if B=3) + D = File mount type (if B=3) + 0: Automatic (read-only if the file has that attribute set, read and write otherwise) + 1: Read-only +Results: A = Error code +``` + +Allows mapping a drive number to a specific combination of device number, logical unit number, and starting absolute device sector number, within a device-based driver. It also allows to revert back the drive mapping to its default state (the state at boot time), and to completely unmap the drive. This function works in MSX-DOS 1 mode with some restrictions (see below). + +If B=0 at input, the drive will be unmapped. This means that the drive will be unavailable from that moment, and any attempt to access it will result in an "Invalid drive" error. If the drive is already unmapped, nothing will happen and no error will be returned. + +If B=1 at input, the drive will be reverted to its default state. If at boot time the drive was unmapped (not assigned to any driver), or was mapped to a drive on a MSX-DOS driver or on a drive-based driver, then the drive will be reverted to the same state. If at boot time the drive was assigned to a device-based driver, then an auto-assign procedure will be performed for this drive, using the same rules as the automatic mapping procedure performed at boot time (the automatic mapping procedure is described in the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ document) except that the NEXTOR.DAT file will not be searched. This may result or not on the drive having the same mapping as it had at boot time, depending on the presence of removable devices in the associated driver and the state of the other drives. + +If the automatic mapping procedure resulting from invoking this function with B=1 fails (because there are no suitable devices or partitions), the drive will be unmapped, regardless of its previous mapping state. An .IDEVL error will be returned in this case. + +If B=2 at input, the drive will be mapped according to the mapping data provided in the buffer pointer by HL. It is possible to map any system drive to any device-based driver by using this method, even drives that were unmapped or were mapped to a different driver at boot time. The contents of the mapping data buffer must be as follows: + +``` ++0: Driver slot number ++1: Driver segment number, + FFh if the driver is embedded within a Nextor kernel ROM + (must be always FFh in current version) ++2: Device number ++3: Logical unit number ++4..+7: Starting sector +``` + +An .IDRVR error will be returned if the specified driver does not exist or is not a device-based driver. An .IDEVL error will be returned if the device with the specified device and logical unit numbers does not exists in the driver. In these cases, the previous drive mapping will not be modified. + +A .RAMDX error will be returned if the drive specified is H: and a RAM disk exists. + +The "starting sector" parameter is the device absolute sector number that will be used as the sector zero for the drive. Usually this will be the starting sector of a device partition, obtained via a call to the _GPART function. Note however that no checking is done for the presence of an actual (and recognized by Nextor) filesystem starting in the specified sector; if no valid filesystem is found, the _MAPDRV function will succeed, but the next access to the drive will return a "Not a DOS disk" error. + +Also, it is possible to map a drive to a removable device which has no media inserted. In this case, the _MAPDRV function will succeed, but the next access to the drive will return a "Disk offline" error. + +It is not possible to map two drives to the same combination of driver, device, logical unit, and start sector; this is to prevent data corruption resulting from dealing with unsynchronized sector buffers. An .IDEVL error will be returned in this case. In order to change the drive letter for a given mapping, the old drive letter must be first unmapped. + +Also, note that it is not possible to explicitly map a drive to a MSX-DOS driver or a drive-based driver. + +Before changing the mapping state of a drive, any open file handles relative to that drive will be closed by this function. This is equivalent to invoking the CLOSE function call for each of these file handles, so disk errors may arise if there are dirty buffers for that drive and there are errors when flushing them to the device. + +When invoked in MSX-DOS 1 mode, the following restrictions apply to this function: + +* The specified drive must have been mapped to a device-base driver at boot time. It is not possible to change the mapping of a drive that was unmapped or mapped to a MSX-DOS driver or a Nextor drive-based driver at boot time. + +* The new mapping information may specify a different partition and/or device, but the driver slot must be the same that was assigned to the drive at boot time. This is not an issue if there is only one Nextor kernel in the system. +These restrictions are imposed by the Nextor architecture. + +If B=3 at input, the file whose name or FIB is passed in HL will be mounted in the drive; file mounting is available since Nextor 2.1.0. A .BFSZ error will be returned if the file is too small or too big. + + +### 3.13. Enable or disable the Z80 access mode for a driver (_Z80MODE, 7Dh) + +``` +Parameters: C = 7DH (_Z80MODE) + A = Driver slot number + B = 00H => get current Z80 access mode + 01H => set Z80 access mode + D = 00H => disable Z80 access mode (only if A=01H) + FFH => enable Z80 access mode (only if A=01H) + +Results: A = Error code + D = Current Z80 access mode for the specified driver, + same as input +``` + +This function works on MSX Turbo-R computers only. On MSX1/2/2+ it will always return an .IDRVR error. + +This function allows enabling or disabling the Z80 access mode for a MSX-DOS driver (a driver embedded within a MSX-DOS kernel ROM). When the Z80 access mode for a driver is enabled, Nextor will switch to the Z80 CPU prior to accessing any drive associated to the driver. When the Z80 access mode for a driver is disabled, no CPU switching is performed, being therefore possible to access the drives on the driver in R800 mode. + +When the computer boots, the Z80 access mode is enabled for all MSX-DOS drivers. This is necessary because some old device drivers do not work when accessed in R800 mode, and it would not be possible to boot from a device on one of these drivers. Once the system boot has finished, this function can be used to disable (and later re-enable if necessary) the Z80 access mode for any MSX-DOS driver. + +Note that the Z80 access mode is enabled or disabled for a whole driver, affecting all the drives associated to the driver. It is not possible to selectively enable or disable the Z80 access mode for individual drives. + +The Z80 access mode applies to MSX-DOS drivers only. Nextor will never change the CPU when accessing drive-based and device-based drivers. + +## 4. New error codes + +New error codes are defined to handle error conditions when managing the new features of Nextor. These errors are returned in MSX-DOS 1 mode as well by the new functions supported in this mode. + +The error codes and descriptions are the following: + +* Invalid device driver (.IDRVR, 0B6h) + +An operation involving a device driver has been requested but the specified driver does not exist, or is not of the valid type (for example, the driver is a MSX-DOS or drive-based driver but a device-based driver is required). + +* Invalid device or LUN (.IDEVL, 0B5h) + +An operation involving a device on a device-based driver has been requested but the specified device does not exist in the driver, or the specified logical unit does not exist in the specified device. + +* Invalid partition number (.IPART, 0B4h) + +Information about a disk partition on a device has been requested, but the specified partition does not exist in the device. + +* Partition is already in use (.PUSED, 0B3h) + +An attempt has made to map a drive to a driver, device and starting sector number; but there is already another drive which is mapped to the same combination of driver, device, logical unit, and starting sector number. + +* File is mounted (.FMNT, 0B2h) + +An attempt to open or alter a mounted file, or to perform any other disallowed operation involving a mounted file, has been made. + +* Bad file size (.BFSZ, 0B1h) + +Attempt to mount a file that is smaller than 512 bytes or larger than 32 MBytes. + + +## 5. Extended mapper support routines + +The original MSX-DOS 2 mapper support routines have been extended with two new functions that allow the allocation of small blocks of memory (from 1 to 16378 bytes) within an allocated or TPA segment. Entries for these functions are available as an extension of the mapper support routines jump table whose address can be obtained by using extended BIOS. The names and locations in the jump table of these new routines are: + +``` ++30h: BLK_ALLOC ++33h: BLK_FREE +``` + +Both routines work on the memory that is switched on page 2 at the moment of calling them. It may be an explicitly allocated segment, a TPA segment, or even non-mapped RAM: they will work on any writable memory that is visible on page 2. However a segment will be assumed to be switched on page 2 for documentation purposes. + +Following is the description of these routines. + +### 5.1. BLK_ALLOC: Allocate a memory block + +``` +Entry: HL = Required size (1 to 16378 bytes) +Returns: On success: + HL = Address of the allocated block (always a page 2 address) + A = 0 and Z set + On error (not enough free space on segment): + HL = 0 + A = .NORAM and Z reset +``` + +This routine tries to allocate a memory block of the specified size on the segment currently switched on page 2, and returns the address of the allocated block if it succeeds, or a "Not enough memory" error if not. The segment must have been previously initialized by calling the BLK_FREE routine with HL=0, otherwise the result is unpredictable. + +### 5.2. BLK_FREE: Free a memory block + +``` +Entry: HL = Address of the allocated block as returned by BLK_ALLOC, + or 0 to initialize the segment +``` + +This routine frees a memory block on the segment currently switched on page 2. The specified address must be a block address previously returned by the BLK_ALLOC routine on the same segment, otherwise the result is unpredictable. The freed space will become available for new allocations. + +All the state information about allocated and free blocks is stored on the segment itself, Nextor does not store any internal information about block memory allocation. This means that when all the allocated blocks on a given segment are no longer needed, it is not needed to explicitly free all blocks one by one; instead, the segment may be overwritten with any other data, the segment itself may be freed, or (in case of TPA segments) application may terminate directly. + +When called with HL=0, this routine initializes the segment currently switched on page 2 for block memory allocation. It is necessary to do this once before performing any block allocation on the segment. Also, this is useful on segments that already have allocated blocks, as a fast way to free all blocks at once. + +## 6. Other features + +This section describes other miscellaneous new features offered by Nextor. + +### 6.1. Correction of the ESC-Y escape sequence bug in STROUT function + +The STROUT function prints a string finished with a "$" character. There is an escape sequence that allows positioning cursor at any location in the screen, the sequence is: ESC (27) "Y" (89) x+32 y+32, where (x,y) is the desired character position. + +The bug appears when this escape sequence is used and either the x or the y coordinate are 4. In this case, the third or fourth byte of the sequence becomes 36, which is the ASCII code of "$"; then MSX-DOS incorrectly assumes that this is the end of string mark and the string is truncated. + +This bug is corrected in Nextor, so the ESC-Y escape sequence can be safely used. + +### 6.2. Changing the NEXTOR.SYS version number + +Some MSX-DOS command line applications are known to check the version number of MSXDOS2.SYS (NEXTOR.SYS in the case of Nextor) and refuse to work if this number is smaller than a certain value, typically 2.20. This is a problem since the current NEXTOR.SYS version number is 2.1. + +As a workaround for this issue, starting at version 2.0 beta 2 the NEXTOR.SYS version number returned by the DOSVER function call is stored in RAM and can be changed easily. There is a command line tool, NSYSVER.COM, that allows to easily do this change (see the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ for more details) but if you want to do the change programmatically, here is the procedure: + +1. When in MSX-DOS mode (page 0 mapped to TPA RAM), read the 16 bit value stored at address 0001h. +2. Add 32h to the obtained value. +3. The resulting value is an address where a 16 bit number is stored. This is the number that the DOSVER function call returns in register DE, that is, the reported NEXTOR.SYS version. + +For example, the code for changing the NEXTOR.SYS version to 2.31 would be as follows: + +``` +ld ix,(0001h) +ld bc,32h +add ix,bc +ld (ix),31h +ld (ix+1),2 +``` + +Of course this change is temporary and it will cease to have effect (that is, the NEXTOR.SYS version number will revert to its real value) when NEXTOR.SYS is reloaded, either because the BASIC prompt is entered and exited via CALL SYSTEM, or because the computer is rebooted. + +All of this applies only if the loaded version of NEXTOR.SYS is 2.0 beta 2 or newer. + +## 7. Change history + +This section contains the change history for the different versions of Nextor. Only the changes that are meaningful from the application developer point of view are listed. For information on changes in general, please look at the _[Nextor 2.1 User Manual](Nextor%202.1%20User%20Manual.md)_ document. For information on changes related to driver development, please look at the _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_ document. + +This list contains the changes for the 2.1 branch only. For the change history of the 2.0 branch see the _[Nextor 2.0 Programmers Reference](../../../blob/v2.0/docs/Nextor%202.0%20Programmers%20Reference.md#7-change-history)_ document. + +### 7.1. v2.1.0 beta 1 + +* [_GDRVR](#38-get-information-about-a-device-driver-_gdrvr-78h) now returns an extra flag that tells if the driver implements the DRV_CONFIG routine. + +* [_MAPDRV](#312-map-a-drive-letter-to-a-driver-and-device-_mapdrv-7ch) now allows to mount files. + +* [_GDLI](#39-get-information-about-a-drive-letter-_gdli-79h) returns a new set of information for drives where a file is mounted. + +* [Error codes](#4-new-error-codes) "File is mounted" (.FMNT) and "Bad file size" (.BFSZ) introduced. diff --git a/docs/Nextor 2.1 User Manual.md b/docs/Nextor 2.1 User Manual.md new file mode 100644 index 00000000..d167472d --- /dev/null +++ b/docs/Nextor 2.1 User Manual.md @@ -0,0 +1,1022 @@ +# Nextor 2.1 User Manual + +## Index + +[1. Introduction](#1-introduction) + +[1.1. Background](#11-background) + +[1.2. Goals](#12-goals) + +[1.3. System requirements](#13-system-requirements) + +[2. Features](#2-features) + +[2.1. FAT16 filesystem support](#21-fat16-filesystem-support) + +[2.2. Standarized and documented driver development system](#22-standarized-and-documented-driver-development-system) + +[2.3. Drive to device/partition mapping management](#23-drive-to-devicepartition-mapping-management) + +[2.4. Drive lock](#24-drive-lock) + +[2.5. Reduced and zero allocation information mode](#25-reduced-and-zero-allocation-information-mode) + +[2.6. Z80 access mode](#26-z80-access-mode) + +[2.7. Fast STROUT mode](#27-fast-strout-mode) + +[2.8. Extended mapper support routines](#28-extended-mapper-support-routines) + +[2.9. Boot keys](#29-boot-keys) + +[2.10. Built-in partitioning tool](#210-built-in-partitioning-tool) + +[2.11. Embedded MSX-DOS 1](#211-embedded-msx-dos-1) + +[2.12. Enhanced Disk BASIC](#212-enhanced-disk-basic) + +[2.13. File mounting and disk emulation mode](#213-file-mounting-and-disk-emulation-mode) + +[3. Using Nextor](#3-using-nextor) + +[3.1. Installing Nextor](#31-installing-nextor) + +[3.1.1. Note for Sunrise IDE/CF users](#311-note-for-sunrise-idecf-users) + +[3.2. Booting Nextor](#32-booting-nextor) + +[3.2.1. Booting in DOS 1 mode](#321-booting-in-dos-1-mode) + +[3.3. Managing media changes](#33-managing-media-changes) + +[3.3.1. Media changes in MSX-DOS 1 mode](#331-media-changes-in-msx-dos-1-mode) + +[3.4. The command line tools](#34-the-command-line-tools) + +[3.4.1. MAPDRV: the drive mapping tool](#341-mapdrv-the-drive-mapping-tool) + +[3.4.2. DRIVERS: the driver information tool](#342-drivers-the-driver-information-tool) + +[3.4.3. DEVINFO: the device information tool](#343-devinfo-the-device-information-tool) + +[3.4.4. DRVINFO: the drive information tool](#344-drvinfo-the-drive-information-tool) + +[3.4.5. LOCK: the drive lock and unlock tool](#345-lock-the-drive-lock-and-unlock-tool) + +[3.4.6. RALLOC: the reduced/zero allocation information mode tool](#346-ralloc-the-reducedzero-allocation-information-mode-tool) + +[3.4.7. Z80MODE: the Z80 access mode tool](#347-z80mode-the-z80-access-mode-tool) + +[3.4.8. FASTOUT: the fast STROUT mode tool](#348-fastout-the-fast-strout-mode-tool) + +[3.4.9. DELALL: the partition quick format tool](#349-delall-the-partition-quick-format-tool) + +[3.4.10. NSYSVER: the NEXTOR.SYS version changer](#3410-nsysver-the-nextorsys-version-changer) + +[3.5. The built-in partitioning tool](#35-the-built-in-partitioning-tool) + +[3.6. Extensions to Disk BASIC](#36-extensions-to-disk-basic) + +[3.6.1. The DSKF command](#361-the-dskf-command) + +[3.6.2. The DSKI$ and DSKO$ commands](#362-the-dski-and-dsko-commands) + +[3.6.3 The CALL NEXTOR command](#363-the-call-nextor-command) + +[3.6.4 The CALL CHDRV command](#364-the-call-chdrv-command) + +[3.6.5 The CALL CURDRV command](#365-the-call-curdrv-command) + +[3.6.6. The CALL DRIVERS command](#366-the-call-drivers-command) + +[3.6.7. The CALL DRVINFO command](#367-the-call-drvinfo-command) + +[3.6.8. The CALL LOCKDRV command](#368-the-call-lockdrv-command) + +[3.6.9. The CALL MAPDRV command](#369-the-call-mapdrv-command) + +[3.6.10. The CALL MAPDRVL command](#3610-the-call-mapdrvl-command) + +[3.6.11. The CALL USR command](#3611-the-call-usr-command) + +[3.7. New BASIC error codes](#37-new-basic-error-codes) + +[3.8. Mounting files](#38-mounting-files) + +[3.9. Disk emulation mode](#39-disk-emulation-mode) + +[3.9.1. Entering and exiting the disk emulation mode](#391-entering-and-exiting-the-disk-emulation-mode) + +[3.9.2. Changing the image file](#392-changing-the-image-file) + +[3.9.3. Rules and restrictions](#393-rules-and-restrictions) + +[3.9.4 How to free some memory](#394-how-to-free-some-memory) + +[3.9.5. Known bugs](#395-known-bugs) + +[4. Other improvements](#4-other-improvements) + +[4.1. load" in F7](#41-load-in-f7) + +[4.2. English error messages in kanji mode](#42-english-error-messages-in-kanji-mode) + +[4.3. Reduced NEXTOR.SYS without Japanese error messages](#43-reduced-nextorsys-without-japanese-error-messages) + +[5. Change history](#5-change-history) + +[5.1. v2.1.0 beta 1](#51-v210-beta-1) + + +## 1. Introduction + +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.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ and _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_. The reader of this document is assumed to have experience with MSX-DOS 2 at least at the user level. + +### 1.1. Background + +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: + +* MSX-DOS handles sector numbers as 16 bit entities, and the only filesystem it supports is FAT12. This limits the size of a single filesystem volume to 32MB. Unofficial patches have been developed to add support for the FAT16 filesystem. + +* The actual device driver (the code that interacts with the massive storage controller hardware) is embedded within the operating system kernel ROM, present in computers with built-in floppy disk drives and in external floppy disk controllers. There is no officially documented way to embed a custom device driver within the kernel ROM; developers of custom storage controller hardware have to reverse-engineer the kernel code in order to embed a custom driver. + +* There is a fixed direct, one-to-one correspondence between the drive letters as seen by the user and the device units exposed by the device driver API. For example, in order to access drive A:, MSX-DOS asks the driver to access its first device; while the second device is queried when accessing drive B:. This is OK for floppy disks, but when using more complex devices that have one or more partitions, it is up to the driver (and usually also to external tools made by the driver developer) to manage the drive to device and partition assignment. + +* Managing non-block devices (such as CD-ROMs) is extremely difficult, as it implies a hard work of reverse-engineering on the kernel code. + + +### 1.2. Goals + +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: + +* Provide native support for the FAT16 filesystem. + +* Provide a standardized, well documented system for developing custom storage device drivers and either embedding them within the OS kernel ROM or loading them dynamically from RAM. + +* Provide a device-based driver system (in contrast with the MSX-DOS drive-based system), so that the driver developer must only worry about enumerating and accessing storage devices and it is the operating system who manages the device- and partition-to-drive assignment. + +* Provide support for non-block devices, and for block devices with filesystems other than FAT12/16. + +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. + +### 1.3. System requirements + +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. + +## 2. Features + +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 4GB 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. + +### 2.2. Standarized and documented driver development system + +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: + +* The _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_ document. + +* A template driver file, DRIVER.ASM, that can be used as the skeleton for developing custom drivers. + +* A command line utility, MKNXEROM, that will do all the work of embedding a device driver within the Nextor kernel ROM. It is provided as a Windows executable (MKNEXROM.EXE) and as a standard C source file (MKNEXROM.C). + +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. + +### 2.3. Drive to device/partition mapping management + +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, see _[3.2. Booting Nextor](#32-booting-nextor)_) and manually (by using a mapping utility that in turn invokes a new function call, see _[3.4.1. MAPDRV: the drive mapping tool](#341-mapdrv-the-drive-mapping-tool)_, and _[3.6.9. The CALL MAPDRV command](#369-the-call-mapdrv-command)_). The driver developer only needs to implement raw access to the device. + +### 2.4. Drive lock + +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. +Drives can be locked by using the supplied tool LOCK.COM or by invoking the CALL LOCKDRV command from within the BASIC prompt. All drives can be locked, even those belonging to MSX-DOS drivers (including floppy disk drives). See _[3.4.5. LOCK: the drive lock and unlock tool](#345-lock-the-drive-lock-and-unlock-tool)_, and _[3.6.8. The CALL LOCKDRV command](#368-the-call-lockdrv-command)_. + +### 2.5. Reduced and zero allocation information mode + +Nextor allows setting 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. See _[3.4.6. RALLOC: the reduced/zero allocation information mode tool](#346-ralloc-the-reducedzero-allocation-information-mode-tool)_. + +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. + +If an environment item named ZALLOC is created with a value –case insensitive- of ON (command `SET ZALLOC=ON` in the command interpreter prompt), the reduced allocation information mode becomes the zero allocation information mode. In this case, ALLOC will return a free space of zero for the drives that have this mode active. This is useful because calculating the free space on a device (at the end of a DIR command, for example) may take a somewhat long time on large devices (about 4 seconds in Z80 mode for a SD card, for example); when the zero allocation information mode is active, this time is reduced to zero. + +The zero allocation information mode is available since Nextor 2.0.3. + +### 2.6. Z80 access mode + +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. See _[3.4.7. Z80MODE: the Z80 access mode tool](#347-z80mode-the-z80-access-mode-tool)_. + +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). + +### 2.7. Fast STROUT 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. + +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. See _[3.4.8. FASTOUT: the fast STROUT mode tool](#348-fastout-the-fast-strout-mode-tool)_. + +### 2.8. Extended mapper support routines + +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. See the _[Nextor 2.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ for details. + +### 2.9. Boot keys + +The boot time configuration of Nextor can be modified by keeping pressed some special keys while the system is booting. These keys and their behavior are: + +* **1**: Force boot in MSX-DOS 1 mode. If the computer is a MSX Turbo-R, switches CPU to Z80 mode. + +* **2**: Force boot in MSX-DOS 1 mode. If the computer is a MSX Turbo-R, switches CPU to R800-ROM mode. Note that in MSX-DOS 1 mode, the active CPU is never changed when accessing disk drives; this may cause some storage devices to not work properly, especially those mapped to MSX-DOS drivers such as floppy disk drives. + +* **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). + +* **4**: (for MSX Turbo-R only) Boot in R800-ROM mode, assign the largest mapper found as the primary mapper (instead of the internal mapper), and free the 64K allocated for the R800-DRAM mode. This is useful for using software that requires a huge amount of mapped RAM and can work only with the primary mapper; note however that there is a big penalty in the system speed. + +* **5**: Assign only one drive to each Nextor kernel with a device-based driver regardless of the number of devices controlled by the driver. This overrides the normal behavior, in which Nextor assigns one drive per device found (see _[3.2. Booting Nextor](#32-booting-nextor)_). This is just the default behavior, though - drivers can override it they implement [the DRV_CONFIG routine](Nextor%202.1%20Driver%20Development%20Guide.md#448-drv_config-4151h)). + +* **CTRL**: The state of this key is passed to MSX-DOS kernels on initialization. Typically this will cause the internal floppy disk drive to disable it second "ghost" drive, allowing to free some extra memory, especially in MSX-DOS 1 mode. + +* **SHIFT**: Prevent MSX-DOS kernels from booting, but allow Nextor kernels to boot normally. This is useful to disable the internal floppy disk drive in order to get some extra TPA memory, especially in MSX-DOS 1 mode. + +* **slot key**: Prevent the Nextor kernel associated to the specified slot key from booting. This is useful when the kernel ROM must be updated so you need to disable it. The associated keys for each slot are: + + * Q for primary slot 1 + * A for primary slot 2 + * QWER for slots 1-0 to 1-3, respectively + * ASDF for slots 2-0 to 2-3, respectively + * ZXCV for slots 3-0 to 3-3, respectively + * In the rare event that you have a Nextor kernel at slot 0, use the keys UIOP for 0-0 to 0-3, respectively. + +Example: if your Nextor kernel is in primary slot 1, press Q to prevent it from booting. If you have it in slot 2-3, press F. + +### 2.10. Built-in partitioning tool + +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 4GB on devices controlled by Nextor device based drivers. See _[3.5. The built-in partitioning tool](#35-the-built-in-partitioning-tool)_. + +### 2.11. Embedded MSX-DOS 1 + +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. See _[3.2.1. Booting in DOS 1 mode](#321-booting-in-dos-1-mode)_. + +### 2.12. Enhanced Disk BASIC + +Disk BASIC has been extended with new commands. Also, some of the existing commands have been improved. See _[3.6. Extensions to Disk BASIC](#36-extensions-to-disk-basic)_. + +### 2.13. File mounting and disk emulation mode + +Since version 2.1 Nextor allows to mount disk image files in two ways: + +* Botting normally and mounting a disk image file in a drive. See [3.8. Mounting files](#38-mounting-files). + +* Booting in disk emulation mode, so the system boots in MSX-DOS 1 mode and uses a set disk image files (one at a time) as the boot device. See [3.9. Disk emulation mode](#39-disk-emulation-mode). + + +## 3. Using Nextor + +This section explains the operational details of Nextor and the associated utilities. + +### 3.1. Installing Nextor + +Nextor consists of the following components: + +* The Nextor kernel ROM. It must contain a device driver, although a "standalone" version is provided which contains a dummy driver exposing no devices. + +* The NEXTOR.SYS file, which is necessary in order to boot in the DOS prompt. This file has the role that MSXDOS2.SYS had in MSX-DOS 2 (in fact, NEXTOR.SYS is just an extended version of MSXDOS2.SYS). + +* The COMMAND2.COM file. There is no special command interpreter for Nextor; instead, the same command interpreter of MSX-DOS 2 is used (any version of COMMAND2.COM from 2.20 will do), and new features are handled by using external commands. + +**Note:** two variants of the NEXTOR.SYS file exist. See _[4.3. Reduced NEXTOR.SYS without Japanese error messages](#43-reduced-nextorsys-without-japanese-error-messages)_. + +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: + +1. Burn a ROM with the appropriate Nextor driver directly in the storage device controller. + +2. Burn a standalone version in a flash ROM cartridge, and use it together with your storage device controller in another slot. + +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. + +#### 3.1.1. Note for Sunrise IDE/CF users + +If you want to burn the Nextor kernel ROM in a Sunrise IDE cartridge or in a Sunrise CF reader cartridge, you can't use the IDEFLOAD.COM program, because it assumes that the file to be burned has a size of 64K but the Nextor kernel is bigger (128K including the driver in current version). Instead, you should use IDEFL128.COM, a modified version of the program that burns 128K files. This program is available at [Konamiman's web site](https://www.konamiman.com/msx/msx-e.html#ide) as well. + +Also, note that the Sunrise IDE driver supplied with Nextor 2.0 is an experimental driver that has some limitations, more precisely: + +* Only LBA mode block devices are supported, there is no support for CHS or ATAPI devices. + +* Devices are reported as fixed by the driver. If you are using a CF card reader and you want to change the card(s), you must switch off your computer; hot swapping of cards is not supported. + +### 3.2. Booting Nextor + +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 perform a query to all the available device-based drivers to find out how many devices are being controlled by these drivers (actually, how many logical units, but devices will usually have one single logical unit), and will assign to each driver as many drives as devices are controlled by the driver. If CTRL is pressed at boot time, only one drive is assigned to each driver instead (see _[2.9. Boot keys](#29-boot-keys)_). + +For example, assume that you have two Nextor kernels with a device-based driver attached. The kernel in slot 1 controls one device, while the kernel in slot 2 controls three devices. Then the initial drive assignment would be as follows: + +``` +A: for driver on slot 1 +B:, C:, D: for driver on slot 2 +E:, F: for the internal disk drive +``` + +If you boot while pressing CTRL, the assignment will be: + +``` +A: for driver on slot 1 +B: for driver on slot 2 +C: for the internal disk drive (which is affected by CTRL as well) +``` + +The internal disk drive would not have any drives attached if you pressed SHIFT while booting (see _[2.9. Boot keys](#29-boot-keys)_). + +After all drives have been assigned to drivers, a device and partition to drive automatic mapping procedure will be run for each of these drives. The procedure is repeated for each driver and is as follows: + +1. Start with the first drive associated to the first Nextor device-based driver found. + +2. Start with the first logical unit on the first device available. + +3. Scan all the existing primary partitions. If one of them has a FAT12 or FAT16 filesystem which has a file named NEXTOR.DAT in the root directory, map it to the drive. (If the drive has no valid partition table, search for one single filesystem at device sector zero) + +4. If step 3 fails, repeat it with the next logical unit available in the device. + +5. If step 3 fails for all the logical units on the device, repeat it with the next device. + +6. If step 3 fails for all the devices, repeat from step 1 but this time do not search a NEXTOR.DAT file (that is, map the first FAT12 or FAT16 partition available). + +7. If step 6 fails (there are no usable partitions available), leave the drive unmapped. + +8. Repeat steps 2-7 for the other drives assigned to the driver (if any), but skipping the logical units already assigned to a drive. + +9. Go to the next device-based driver (if any), and repeat from step 2. + +In short: available devices having a FAT12 or FAT16 partition are assigned to the available drives in device and logical unit number order, but the first partition having a NEXTOR.DAT file in the root directory has 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. + +Starting with Nextor 2.0.5, device-based drivers can tell Nextor how many drives they want at boot time and which devices should be mapped to these drivers, bypassing part of this automatic procedure (partitions are still selected automatically). This feature is optional, and must be implemented by the driver developer. + +After the automatic mapping is finished, the boot procedure will continue with the following steps: + +1. If the "3" key is being pressed, the system displays the BASIC prompt. + +2. Otherwise, if the NEXTOR.SYS and COMMAND2.COM files are present in the boot drive (the first drive that is not unmapped), the DOS prompt is shown after AUTOEXEC.BAT is executed (if present). + +3. Otherwise, if the boot drive has a MSX-DOS 1 or MSX-DOS 2 boot sector, its boot code is executed as in the case of MSX-DOS: first in the BASIC environment with the carry flag reset, then in the DOS environment with the carry flag set. This will usually cause MSXDOS.SYS and COMMAND.COM to be loaded if present. + +4. If the previous step returns, then the BASIC environment is activated, and AUTOEXEC.BAS is executed if present. + +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. + +#### 3.2.1. Booting in DOS 1 mode + +Nextor kernel can boot in MSX-DOS 1 mode. This will happen if anything of the following conditions is met: + +* The computer has no mapped memory, or the largest mapper has less than 128K. + +* The boot drive has a MSX-DOS 1 boot sector (boot sectors not having standard format or MSX-DOS 2 format will be considered MSX-DOS 1 boot sectors). + +* The "1" key or the "2" key is kept pressed while booting. + +The boot procedure for MSX-DOS 1 mode is the same as for the normal (MSX-DOS 2 compatible) mode, with the following differences: + +* During the automatic mapping procedure, only the MSX-DOS 1 compatible partitions will be examined. These are FAT12 partitions with three or less sectors per FAT. + +* After the automatic mapping procedure, the NEXTOR.SYS and COMMAND2.COM search step is omitted. + +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 has 64K of RAM. Otherwise, only Disk BASIC can be used. + +On MSX Turbo-R computers, the CPU mode will be switched to Z80 when booting in MSX-DOS 1 mode, unless the 2 key is pressed during boot (see _[2.9. Boot keys](#29-boot-keys)_). + +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. + +### 3.3. Managing media changes + +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 removable device-based driver, the following procedure is performed: + +* The drive is mapped to the first available valid primary partition found on the device. Valid partitions are FAT12 and FAT16 partitions. If the device has no partition table, the drive is mapped to its absolute sector zero. + +* All the other drives mapped to other partitions of the same device will be left unmapped. + +The device driver may also reply "not sure" when asked for device change status. In that case, the procedure is as follows: + +* When Nextor first reads the boot sector of a drive mapped to a device on a device-based driver, it calculates a 16 bit checksum of the boot sector contents and stores it together with the rest of the disk parameters. + +* When Nextor asks the driver for device change status and the reply is "not sure", it re-reads the boot sector of the drive and calculates the checksum again. If it matches the previously stored checksum, Nextor assumes that the device has not been changed. Otherwise, it assumes that the device has changed and it performs the same mapping procedure as when the driver reports a device change. + +It is recommended to lock drives mapped to removable devices in order to avoid unnecessary media checks (and unnecessary boot sector reads and checksum calculations). + +#### 3.3.1. Media changes in MSX-DOS 1 mode + +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. + +### 3.4. The command line tools + +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 a summary of the parameters accepted by each tool by invoking it without parameters; more detailed help is available as well 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.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ document. + +Please note that none of these tools work in MSX-DOS 1 mode. However there are equivalent BASIC CALL commands that provide equivalent functionality for most of the tools. + +Some of the tools admit a `` parameter. In all of these, number 0 may be specified instead of a slot number, with the meaning of "the primary controller". + +#### 3.4.1. MAPDRV: the drive mapping tool + +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] : |d|u [-[] + [[-]]] +``` + +Partition number 1 refers to the first primary partition on the device. Partitions 2 to 4 refer to extended partitions 2-1 to 2-4 if partition 2 of the device is extended, otherwise they refer to primary partitions 2 to 4. Partitions 5 onwards always refer to the extended partition 2-(P-1). + +If partition number 0 is specified, then the drive is mapped to the absolute sector zero of the device. + +There are three options for specifying the device where the partition is located: + +* Do not supply any parameter after the partition number. In this case, the partition is assumed to be in the same device already mapped to the drive (this works only if the drive is currently mapped to a device-based driver). + +* Supply a device index, but not a slot number. In this case, the partition is assumed to be in the specified device, and the device is assumed to be controlled by the kernel on the same slot of the currently mapped device (this works only if the drive is currently mapped to a device-based driver). + +* Supply a device index and a slot number. In this case, the slot corresponds to the Nextor kernel that contains the driver that handles the device. + +When a device number is supplied, a logical unit number can be supplied too; default value for the logical unit number is 1. + +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 the drive was unmapped at boot time, then it is left unmapped. + +* If at boot time the drive was assigned to a MSX-DOS driver unit, or to a Nextor drive-based unit, then it is mapped to the same unit. + +* If at boot time the drive was assigned to a Nextor device-based driver, then an automatic mapping procedure (equal to the one performed at boot time, except that the NEXTOR.DAT file is not searched) will be performed. This may or may not result in the drive having the same mapping it had at boot time, depending on the mapping state of the other drives. + +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). + +Since Nextor 2.1 the MAPDRV tool can be used to mount a disk image file in a drive as well. The syntax in this case is: + +``` +MAPDRV [/ro] +``` + +The `/ro` parameter will cause the file to be mounted in read-only mode. However, if the file has the read-only attribute set, it will always be mounted in read-only mode, even if no `/ro` parameter is supplied. + +There are some restrictions in place when mounting files to drives. See [3.8. Mounting files](#38-mounting-files) for details. + + +#### 3.4.2. DRIVERS: the driver information tool + +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. + + #### 3.4.3. DEVINFO: the device information tool + +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 [-] +``` + +This tool is useful mainly to get the device and logical unit indexes, in order to supply them as parameters to the MAPDRV tool. + +#### 3.4.4. DRVINFO: the drive information 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". + +#### 3.4.5. LOCK: the drive lock and unlock tool + +The LOCK.COM utility allows locking and unlocking drive letters. The usage syntax for LOCK is: + +``` +LOCK [: [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. + +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. Nextor will never automatically lock a drive. + +#### 3.4.6. RALLOC: the reduced/zero allocation information mode tool + +The RALLOC.COM utility allows activating or deactivating the reduced allocation information mode for a drive. The usage syntax for RALLOC is: + +``` +RALLOC [: 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. + +If an environment item named ZALLOC exists whose value –case insensitive- is ON (command `SET ZALLOC=ON` in the command interpreter), then the reduced allocation information becomes the zero allocation information mode (available since Nextor 2.0.3): the ALLOC function will return a free space of zero for the drives having this mode active. This makes the function to return immediately, which may be useful on very large or very slow devices. + +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. + +#### 3.4.7. Z80MODE: the Z80 access mode tool + +The Z80MODE.COM utility, which works on MSX Turbo-R computers only, allows activating or deactivating the Z80 access mode for a MSX-DOS driver. The usage syntax for Z80MODE is: + +``` +Z80MODE [-]] [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. + + +#### 3.4.8. FASTOUT: the fast STROUT mode tool + +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). + +#### 3.4.9. DELALL: the partition quick format tool + +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 : +``` + +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. + +#### 3.4.10. NSYSVER: the NEXTOR.SYS version changer + +Some MSX-DOS command line applications are known to check the version number of MSXDOS2.SYS (NEXTOR.SYS in the case of Nextor) and refuse to work if this number is smaller than a certain value, typically 2.20. This is a problem since the current NEXTOR.SYS version number is 2.1. + +As a workaround for this issue, starting at version 2.0 beta 2 the NEXTOR.SYS version number returned by the DOSVER function call is stored in RAM and can be changed easily (see the _[Nextor 2.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ document for more details). A command line tool that allows to easily do this change has been created as well, its name is NSYSVER.COM and can be used as follows: + +``` +NSYSVER . +``` + +For example: `NSYSVER 2.20`. Note that this will change only the value of the NEXTOR.SYS version number returned by the DOSVER function call; the VER command will still display the real file version number. + +Note: the version number change performed by this tool is temporary and it will cease to have effect (that is, the NEXTOR.SYS version number will revert to its real value) when NEXTOR.SYS is reloaded, either because the BASIC prompt is entered and exited via CALL SYSTEM, or because the computer is rebooted. + +Note: do not use this tool with NEXTOR.SYS versions older than 2.0 beta 2. + +### 3.5. The built-in partitioning tool + +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. Please note that starting the FDISK tool will delete the current BASIC program from memory. + +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: + +* The tool allows creating up to 256 FAT12 and FAT16 partitions on any block device attached to a Nextor device-based driver. MSX-DOS drivers and Nextor drive-based drivers are not supported. + +* With this tool it is not possible to add new partitions to an already partitioned device. All existing partitions must be removed before defining new partitions. + +* Partitions from 100KB (the minimum supported partition size) up to 32MB will be FAT12, partitions from 33MB to 4GB (the maximum supported partition size) will be FAT16. + +* Partitions of 16MB or less will have three sectors per FAT or less, therefore they can be used in MSX-DOS 1 mode. + +* Partitions up to 32MB will have a MSX-DOS 2 boot sector, partitions of 33MB and more will have a standard boot sector. + +* If four partitions or less are defined, they will be created as primary partitions. If five partitions or more are defined, then the first one will be primary and the others will be extended partitions contained within the second primary partition. Remember that Nextor only scans primary partitions during the automatic drive to device and partition mapping process. + +* To get an optimum cluster size, it is recommended to define the partition sizes as powers of two (that is: 1M, 2M, 4M, 8M, 16M or 32M for FAT12 partitions; 64M, 128M, 256M, 512M, 1G, 2G or 4G for FAT16 partitions). If this is not possible, it is better to select the partition size as slightly smaller than the closest power of two than slightly higher (that is, for example 31M is better than 33M). + +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 (4GB devices are usually shipped with a FAT32 partition, so you will need to partition it with FDISK anyway). + +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. + +### 3.6. Extensions to Disk BASIC + +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. + +Some of the new CALL commands take parameters. These commands can be run without parameters in order to get help on how to use them. + +Unless otherwise stated, the Nextor modifications of existing Disk BASIC are not available in MSX-DOS 1 mode but the new commands are. + +#### 3.6.1. The DSKF command + +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. + +This modification does not apply to MSX-DOS 1 mode, in this mode the free cluster count is still returned as a cluster count. + +The DSKF command will always return the real free space even if the drive has the reduced allocation information mode active. However, if the drive has the zero allocation information mode active, then the value returned will be zero. + +#### 3.6.2. The DSKI$ and DSKO$ commands + +The DSKI$ function and the DSKO$ command, which allow to read and write one disk sector respectively, now accept 32 bit sector numbers, therefore allowing access to any drive sector, not only the first 65536 sectors. + +In order to access sectors with numbers over 32767, the sector number must be specified as a single or double precision constant, expression or variable. If a single precision value is specified and the number is so big that one or more of the least significant digits of the number is lost due to truncation, these commands will fail with an "Overflow" error. This is designed this way to prevent inadvertent access to the wrong sector. For example: + +``` +10 DEFSNG S +20 S=12345678 +30 PRINT S 'Prints "12345700" +40 PRINT DSKI$(0, S) 'Throws "Overflow" +``` + +The previous example will work (provided that the sector exists in the device) if line 10 is changed to DEFDBL S. Always use double precision variables if you are going to access arbitrary sector numbers in your BASIC code. + +An "Overflow" error will be thrown too if the sector number specified does not fit in 32 bits, that is, if it is greater than 4294967295. + +In order to maintain compatibility with the MSX-DOS equivalent command, negative sector numbers are accepted (to which 65536 is added to get the real sector number) but only if the sector number can be evaluated as an integer (16 bit) expression. Therefore the following commands are equivalent and will work if the sector exists in the device: + +``` +PRINT DSKI$(0, 65535) +PRINT DSKI$(0, &HFFFF) +PRINT DSKI$(0, -1) +DEFINT S: S=-1: PRINT DSKI$(0, S) +``` + +However, the following will throw a "Disk I/O error": + +``` +PRINT DSKI$(0, CDBL(-1)) +DEFDBL S: S=-1: PRINT DSKI$(0, S) +``` + +None of this apply to MSX-DOS 1 mode, in this mode only integer (16 bit) sector numbers are accepted. + +#### 3.6.3 The CALL NEXTOR command + +This command will simply display a list of the new CALL commands that Nextor provides for the BASIC environment. + +#### 3.6.4 The CALL CHDRV command + +This command changes the current drive and it exists already in MSX-DOS 2 Disk BASIC. However Nextor expands it in two ways: + +* The command is now available in MSX-DOS 1 mode as well. + +* The drive number can be specified as a number instead of a drive letter (from 1 being A: to 8 being H:). So for example `_CHDRV(3)` is the same as `_CHDRV("C:")`. + +#### 3.6.5 The CALL CURDRV command + +This command will simply display the current drive. + +#### 3.6.6. The CALL DRIVERS command + +This command is equivalent to the DRIVERS.COM tool, which 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". + +#### 3.6.7. The CALL DRVINFO command + +This command is equivalent to the DRVINFO.COM utility, which 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". + +#### 3.6.8. The CALL LOCKDRV command + +This command allows to lock and unlock drives (see _[2.4. Drive lock](#24-drive-lock)_ and _[3.4.5. LOCK: the drive lock and unlock tool](#345-lock-the-drive-lock-and-unlock-tool)_). It is used as follows: + +``` +CALL LOCKDRV() +``` + +Displays the current lock status of the drive. + +``` +CALL LOCKDRV(, 0) +``` + +Unlocks the drive. + +``` +CALL LOCKDRV(, ) +``` + +Locks the drive. + +`` is a string with the drive letter followed by a colon (for example "A:") or a number, being 1 to 8 for drives A: to H:, or 0 for the current drive. + +This command is not available in MSX-DOS 1 mode, in which the concept of "drive lock" does not exist. + +#### 3.6.9. The CALL MAPDRV command + +This command that allows changing the drive to device and partition mapping from the BASIC environment. It is equivalent to the MAPDRV.COM tool. + +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. + +``` +CALL MAPDRV(, , , |0) +``` + +Maps the specified drive to the specified partition of the specified device, which is controlled by the driver on the specified slot. If 0 is specified instead of a slot number, the slot of the primary controller is used. + +``` +CALL MAPDRV(, , ) +``` + +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. + +``` +CALL MAPDRV(, ) +``` + +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. + +``` +CALL MAPDRV(, -1) +``` + +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). + +``` +CALL MAPDRV(, -2) +CALL MAPDRV() +``` + +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 will be performed (the procedure is equal to the one performed at boot time except that the NEXTOR.DAT file will not be searched; see _[3.2. Booting Nextor](#32-booting-nextor)_ for more details); 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: + +* `` is a string with the drive letter followed by a colon (for example "A:") or a number, being 1 to 8 for drives A: to H:, or 0 for the current drive. + +* `` is a number in the range 0-255, interpreted as follows: + * 0: Assumes that the device has no partitions. The drive will be mapped to the absolute sector 0 of the device. + * 1: First primary partition of the device. + * 2, 3 or 4: If device partition 2 is extended, the number is interpreted as the first, second or third extended partition, respectively. Otherwise, the number is interpreted as the second, third or fourth primary partition of the device, respectively. + * 5 or greater: The number is interpreted as the (n-1)th extended partition of the device. + * `` is a device index in the range 1-7. If the device has multiple logical units, use the formula `+16*`. The possible values for the logical unit are 1-7 too (0 is accepted as well and interpreted as 1). + * `` is a slot number in the range 0-3. If the slot is expanded, use the formula `
+4*`. As a special case, If 0 is specified as the slot number and no subslot number is specified, the slot of the primary controller is used. + +In MSX-DOS 1 mode there are some additional restrictions imposed by the Nextor architecture: + +* The specified drive must have been mapped to a device-base driver at boot time. It is not possible to change the mapping of a drive that was unmapped or mapped to a MSX-DOS driver or a Nextor drive-based driver at boot time. + +* The new mapping information may specify a different partition and/or device, but the driver slot must be the same that was assigned to the drive at boot time. This is not an issue if there is only one Nextor kernel in the system. +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. + +Since Nextor 2.1 the CALL MAPDRV command can be used to mount a disk image file in a drive as well. The syntax in this case is: + +``` +CALL MAPDRV(, [,0|1]) +``` + +The `,1` parameter will cause the file to be mounted in read-only mode. However, if the file has the read-only attribute set, it will always be mounted in read-only mode, even if no `,1` parameter is supplied. + +There are some restrictions in place when mounting files to drives. See [3.8. Mounting files](#38-mounting-files) for details. + +#### 3.6.10. The CALL MAPDRVL command + +The CALL MAPDRVL command is identical to the CALL MAPDRV command, except that it will perform a drive lock (see _[2.4. Drive lock](#24-drive-lock)_ and _[3.4.5. LOCK: the drive lock and unlock tool](#345-lock-the-drive-lock-and-unlock-tool)_) 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. + +#### 3.6.11. The CALL USR command + +The CALL USR command allows the execution of assembler code from BASIC code. It is equivalent to the standard MSX-BASIC DEF USR command and the USR function, but with an added feature: it allows to specify the input values of the Z80 registers for the code to execute, and to read the output values after the execution. + +The syntax of the CALL USR command is as follows: + +```` +CALL USR( [,]) +```` + +`` is the address of the assembler code to be executed. Value -1 is treated as a special case: `_USR(-1)` will do nothing but will not throw an error. You can use this feature together with the ON ERROR GOTO command to detect the presence of Nextor from within a BASIC program. + +`` is the address of a 12 byte buffer for the Z80 registers values. If this parameter is specified, the registers will be loaded with the contents of this area before the code is invoked; after the code execution, the reverse process is performed: the buffer is updated with the values hold by the registers. The order of the registers in the buffer is: F, A, C, B, E, D, L, H, IXl, IXh, IYl, IYh. + +Here is a simple BASIC program to test the CALL USR command. Change the registers assignment in lines 40-90 and the address of the code to be invoked in line 100 as appropriate to invoke different code (the MSX BIOS itself is a good source of routines to play around). + +``` +10 ON ERROR GOTO 20: _USR(-1): ON ERROR GOTO 0: GOTO 30 +20 PRINT "Nextor not found!": END +30 DEFINT R: DIM R(12) +40 R(0)=&H2100 ‘AF +50 R(1)=&H3040 ‘BC +60 R(2)=&H5060 ‘DE +70 R(3)=&H7080 ‘HL +80 R(4)=&H90A0 ‘IX +90 R(5)=&HB0C0 ‘IY +100 CALL USR(&H00A2, VARPTR(R(0))) ‘Prints a "!" (passed in A as &H21) +110 PRINT "AF=&H";HEX$(R(0)) +120 PRINT "BC=&H";HEX$(R(1)) +130 PRINT "DE=&H";HEX$(R(2)) +140 PRINT "HL=&H";HEX$(R(3)) +150 PRINT "IX=&H";HEX$(R(4)) +160 PRINT "IY=&H";HEX$(R(5)) +```` + +### 3.7. New BASIC error codes + +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. + +* Invalid device driver (76), thrown by the CALL MAPDRV command in any of these events: + + * The specified slot number does not contain a Nextor device-based driver. + + * No slot number is specified, but the drive is not currently mapped to a Nextor device-based driver. + + * In MSX-DOS 1 mode, the drive was not originally mapped to a Nextor device-based driver, or was mapped to a different driver. + +* Invalid device or LUN (77), thrown by the CALL MAPDRV command in any of these events: + + * The device and/or LUN with the specified index is not available on the specified or implicit driver. + + * The device and/or LUN with the specified index exists on the specified or implicit driver, but it is not a block device. + +* Invalid partition number (78) + +This error will be thrown by the CALL MAPDRV command if the specified partition does not exist on the specified or implicit device. + +* Partition already in use (79) + +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. + +* File is mounted (80) + +An attempt to open or alter a mounted file, or to perform any other disallowed operation involving a mounted file, has been made. + +* Bad file size (81) + +Thrown by the CALL MAPDRV command when attempting to mount a file that is smaller than 512 bytes or larger than 32 MBytes. + + +### 3.8. Mounting files + +Nextor 2.1 introduces the ability to mount disk image files on drive letters. When a disk image file is mounted, you can access its contained files and directories by using regular MSX-DOS/MSX BASIC commands and tools. + +To mount a file, use [the MAPDRV tool](#341-mapdrv-the-drive-mapping-tool) with the `MAPDRV [/ro]` syntax; or in BASIC environment, [the CALL MAPDRV command] (#369-the-call-mapdrv-command) with the `CALL MAPDRV(, [,0|1])`. To unmount the file, change the mapping of the drive to anything else, or simply leave the drive unmapped (`MAPDRV U` or `CALL MAPDRV(, -1)`). + +This feature has some restrictions: + +* To be mountable a disk image file must have a size of at least 512 bytes and at most 32 MBytes. + +* The file is expected to contain a proper FAT filesystem already, it is not possible to apply the FORMAT command on a mounted drive. + +* The file cannot contain partitions, the contained filesystem is expected to start right at the beginning of the file. + +* It is not possible to mount a file on the drive where the file itself is located: + +``` +MAPDRV A: A:TOOLS.DSK --> Error +``` + +* It is not possible to mount the same file in two drives at the same time: + +``` +MAPDRV B: TOOLS.DSK +MAPDRV C: TOOLS.DSK --> Error +``` + +* It is not possible to do a recursive file mount (mounting a file that is itself inside a mounted disk image file): + +``` +MAPDRV B: TOOLS.DSK +MAPDRV C: B:FILE.DSK --> Error +``` + +* It is not possible to alter the mapping state of a drive if it contains one or more files that are currently mounted: + +``` +MAPDRV B: A:TOOLS.DSK +MAPDRV A: U --> Error +``` + +- It is not possible to open or to alter (rename, move, delete, overwrite, change attributes) a mounted file: + +``` +MAPDRV B: TOOLS.DSK +TYPE TOOLS.DSK --> Error +ECHO HELLO > TOOLS.DSK --> Error +REN TOOLS.DSK X.DSK --> Error +MOVE TOOLS.DSK SOMEDIR\ --> Error +DEL TOOLS.DSK --> Error +ATTRIB +R TOOLS.DSK --> Error +``` + +**Note:** Currently `ECHO HELLO > TOOLS.DSK` doesn't actually throw an error due to a bug. + +**Warning:** After mounting a file do not extract or swap the medium where the file is contained. The behavior of Nextor if this is done is undefined and you could lose data. + + +### 3.9. Disk emulation mode + +Since version 2.1 Nextor allows to boot in disk emulation mode. In this mode the usies a disk image file (or a set of swappable files) as the boot device instead of a regular device. This is ideal for playing disks that were released in floppy disk and can't be run from a modern storage device, because they don't have a filesystem or because they need to run in MSX-DOS 1 mode. + + +#### 3.9.1. Entering and exiting the disk emulation mode + +Nextor will boot in disk emulation mode if it finds a file named `NEXT_DSK.DAT` in the root directory of a primary partition in a device controlled by the primary Nextor controller. This file contains information about the disk image files to be used for the emulation. + +The `NEXT_DSK.DAT` file is created by using the supplied `EMUFILE.COM` tool. Most times it's as easy as doing just `EMUFILE file1.dsk file2.dsk file3.dsk` (or `EMUFILE game\*.dsk`, or just `EMUFILE game\`). There are additional options, run the program without parameters to get more information. + +To disable the disk emulation mode (that is, to boot normally even if a `NEXT_DSK.DAT` file exists), keep the 0 (zero) key pressed while the computer boots. You will have to manually delete or rename the `NEXT_DSK.DAT` file to prevent the disk emulation mode to be entered again in the next system boot. + + +#### 3.9.2. Changing the image file + +Up to 32 disk image files can be specified for an emulation session, but only one of them is active at a given time. In order to switch to a different file, you must press the appropriate key while the computer is trying to read the file; this will emulate a disk change. The keys are 1-9 for the first nine image files, then A-W for the rest, in alphabetical order. + +For example, assume that you are playing a two disks game. You boot with disk 1 and at some point the game asks you to insert disk 2 and press space key. Just press 2 (they key assigned to the second image file) and the space key at the same time and you're good to go. + +Alternatively, you can also press the GRAPH key when the computer is trying to read the file. The caps led will lit and the computer will freeze until you release GRAPH and press the appropriate file key. This is useful when having to directly press an alphanumeric key while disk access is performed is a problem (for example, you are in the BASIC prompt and you want to trigger a file change when executing a FILES command: the pressed key would be added to "FILES" causing a Syntax Error). + + +#### 3.9.3. Rules and restrictions + +The following rules and restrictions apply to the disk emulation mode: + +- The primary controller must be a Nextor kernel with a device-based driver. + +- The `NEXT_DSK.DAT` file and all the disk image files must be placed in devices controlled by the primary controller (but they can be in different partitions and even in different devices). + +- The `NEXT_DSK.DAT` file stores information about absolute device sectors, therefore it will be unusable if the disk image files are moved and file renames will have no effect. It is recommended to generate the file immediately before using it. + +- The disk image files must have a size of at least 512 bytes and at most 32 MBytes, must not contain partitions (the contained filesystem is expected to start right at the beginning of the file), and must contain a proper FAT12 filesystem (the FORMAT command will not work in disk emulation mode). + +- The disk image files must not be fragmented, that is, their contents must be placed across consecutive sectors in the device. + +- Disk emulation mode is always started in DOS 1 mode and in Z80 mode. If you want to start a game in R800 mode, do the following: keep pressed GRAPH and 2 while the computer boots, and when the caps led lits, release both keys and press 1. + +- All Nextor controllers but the primary one will be disabled when disk emulation mode is entered. MSX-DOS kernels (such as the internal floppy disk drive) will not, but you can force them to disable themselves by pressing SHIFT while booting; this is useful to free some memory. + +- If you are using a `NEXTOR.DAT` file to alter the device mappings priority, Nextor needs the `NEXT_DSK.DAT` to be found before NEXTOR.DAT in order to start emulation mode. This means that `NEXT_DSK.DAT` must be placed either 1. In the same partition of NEXTOR.DAT (relative position in the root directory is irrelevant); 2. In a primary partition with a smaller number in the same device; or 3. In a device with a smaller device number. + + +#### 3.9.4 How to free some memory + +Some games will not work "out of the box" because they assume that only the floppy disk drive is present in the system, but now there are drives allocated for both Nextor and the floppy drive, and thus the amount of free memory is smaller. You can do the following in order to increase the amount of memory available for games: + +- Press SHIFT while booting to disable the internal floppy disk drive (and any other MSX-DOS kernel, for that matter). + +- Press 5 while booting to force Nextor to allocate only one drive for itself (useful only if you have more than one device connected to your Nextor controller). If your emulation session has five or more disk images, do the following instead: press GRAPH+5 until the caps led lits, then release both keys and press 1. + + +#### 3.9.5. Known bugs + +* The current version of the EMUFILE.COM tool does not verify that the disk image files are not fragmented. + +* If you have more than one device in the primary Nextor controller (for example, for the MegaFlashROM SCC+ SD this means two SD cards, or one or two cards plus the ROM disk), Nextor will allocate one dummy drive letter for each extra device. MSX-DOS devices (if any) will then have drive letters assigned after these. For example, if you have three devices, A: is where the emulated disk image file is mounted, B: and C: are dummy, and D: is the internal floppy disk drive. These dummy drives will NOT have memory allocated for FAT buffers. + + +## 4. Other improvements + +### 4.1. load" in F7 + +Nextor will force the computer to boot with the `load"` string assigned to the F7 key, even on MSX1 and MSX2 computers, which have `cload"` assigned by default. Note however that any code that invokes the INIFNK BIOS routine will cause the key to be assigned to `cload"` again (you can try it yourself: `_USR(&H3E)` ). + +### 4.2. English error messages in kanji mode + +If an environment item named ERRLANG is created with a value –case insensitive- of EN (command `SET ERRLANG=EN` in the command interpreter prompt), error messages in the command interpreter will be displayed in English, instead of Japanese, when the kanji mode is active (`CALL KANJI` in the BASIC interpreter). This feature is available since Nextor 2.0.4. + +### 4.3. Reduced NEXTOR.SYS without Japanese error messages + +Two variants of the NEXTOR.SYS file are offered. The full variant contains Japanese equivalents for part of the error messages (such as the "reading/writing" part or the "Abort, Retry, Ignore" string), while the reduced variant contains only the English versions. The advantage of the reduced variant is that it is smaller and using it saves 256 bytes of TPA space compared to the full version. + +These two variants are offered since NEXTOR.SYS version 2.01 (released together with kernel version 2.0.4). Note that version 2.00 was already reduced, but had a bug that caused garbage to be displayed instead of the proper error messages in kanji mode. + +Note that error messages will be displayed in English regardless of the variant used if the ERRLANG environment item exists with value EN (see _[4.2. English error messages in kanji mode](#42-english-error-messages-in-kanji-mode)_). + + +## 5. Change history + +This section contains the change history for the different versions of Nextor. Changes that affect application or driver development are not listed here; instead, you should look at the _[Nextor 2.1 Programmers Reference](Nextor%202.1%20Programmers%20Reference.md)_ and _[Nextor 2.1 Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md)_ documents for a list of changes of that type. + +This list contains the changes for the 2.1 branch only. For the change history of the 2.0 branch see the _[Nextor 2.0 User Manual](../../../blob/v2.0/docs/Nextor%202.0%20User%20Manual.md#5-change-history)_ document. + + +### 5.1. v2.1.0 beta 1 + +- All the changes and fixes of [Nextor 2.0.5](../../../blob/v2.0/docs/Nextor%202.0%20User%20Manual.md#51-v205-beta-1). + +- Introduced [file mounting and disk emulation mode](#213-file-mounting-and-disk-emulation-mode). + +- Change in boot keys: now the key to request one single drive per driver is the 5 key, and CTRL is simply passed to MSX-DOS kernels as when booting with MSX-DOS (see [2.9. Boot keys](#29-boot-keys)). + +- Fixed [#3 Can't access read-only files with _RDBLK](../../../issues/3) diff --git a/info/Nextor-2.1-alpha-1.txt b/docs/Nextor-2.1-alpha-1.txt similarity index 100% rename from info/Nextor-2.1-alpha-1.txt rename to docs/Nextor-2.1-alpha-1.txt diff --git a/info/Nextor-2.1-alpha-2.txt b/docs/Nextor-2.1-alpha-2.txt similarity index 100% rename from info/Nextor-2.1-alpha-2.txt rename to docs/Nextor-2.1-alpha-2.txt diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..8f27bc5c --- /dev/null +++ b/docs/README.md @@ -0,0 +1,19 @@ +# Nextor documentation + +The following documentation is available for Nextor: + +* [Getting Started Guide](Nextor%202.1%20Getting%20Started%20Guide.md): Step-by-step tutorial to get started with Nextor, wither with an emulator or with real hardware. + +* [User Manual](Nextor%202.1%20User%20Manual.md): Manual for end users, explains how Nextor expands the features of MSX-DOS 2 and contains a reference of the Nextor tools and built-in commands. + +* [Programmers Reference](Nextor%202.1%20Programmers%20Reference.md): For application developers, contains a reference of the new function calls implemented by Nextor and the new and expanded Disk BASIC commands. + +* [Driver Development Guide](Nextor%202.1%20Driver%20Development%20Guide.md): You need this if you want to develop a device driver for Nextor. + +* [Driver skeleton](DRIVER.ASM): Use this as the foundation for developing a device driver for Nextor. + +Also the following documentation for MSX-DOS 2 (relevant also for Nextor) is provided for reference: + +* [MSX-DOS 2 Program Interface Specification](DOS2-PIS.TXT) + +* [MSX-DOS 2 Function Codes Specification](DOS2-FCS.TXT) \ No newline at end of file diff --git a/docs/img/gsg/DirAAndDirB.png b/docs/img/gsg/DirAAndDirB.png new file mode 100644 index 00000000..582128e2 Binary files /dev/null and b/docs/img/gsg/DirAAndDirB.png differ diff --git a/docs/img/gsg/DirAAndDirBDos1Mode.png b/docs/img/gsg/DirAAndDirBDos1Mode.png new file mode 100644 index 00000000..41f4d5b5 Binary files /dev/null and b/docs/img/gsg/DirAAndDirBDos1Mode.png differ diff --git a/docs/img/gsg/DirAAndDirBDos1ModeWithNextorDat.png b/docs/img/gsg/DirAAndDirBDos1ModeWithNextorDat.png new file mode 100644 index 00000000..7696461b Binary files /dev/null and b/docs/img/gsg/DirAAndDirBDos1ModeWithNextorDat.png differ diff --git a/docs/img/gsg/DirAAndDirBWithFiles.png b/docs/img/gsg/DirAAndDirBWithFiles.png new file mode 100644 index 00000000..8d0c2044 Binary files /dev/null and b/docs/img/gsg/DirAAndDirBWithFiles.png differ diff --git a/docs/img/gsg/DirInDos1Mode.png b/docs/img/gsg/DirInDos1Mode.png new file mode 100644 index 00000000..0daf23b8 Binary files /dev/null and b/docs/img/gsg/DirInDos1Mode.png differ diff --git a/docs/img/gsg/DirInDos1ModeWithNextorDat.png b/docs/img/gsg/DirInDos1ModeWithNextorDat.png new file mode 100644 index 00000000..5f55d8a3 Binary files /dev/null and b/docs/img/gsg/DirInDos1ModeWithNextorDat.png differ diff --git a/docs/img/gsg/DirTwoSystemFiles.png b/docs/img/gsg/DirTwoSystemFiles.png new file mode 100644 index 00000000..dca92333 Binary files /dev/null and b/docs/img/gsg/DirTwoSystemFiles.png differ diff --git a/docs/img/gsg/DirWithNextorDat.png b/docs/img/gsg/DirWithNextorDat.png new file mode 100644 index 00000000..14bf31a7 Binary files /dev/null and b/docs/img/gsg/DirWithNextorDat.png differ diff --git a/docs/img/gsg/DriversOneController.png b/docs/img/gsg/DriversOneController.png new file mode 100644 index 00000000..951e5050 Binary files /dev/null and b/docs/img/gsg/DriversOneController.png differ diff --git a/docs/img/gsg/DriversOneDrive.png b/docs/img/gsg/DriversOneDrive.png new file mode 100644 index 00000000..f3ccd230 Binary files /dev/null and b/docs/img/gsg/DriversOneDrive.png differ diff --git a/docs/img/gsg/DriversTwoDrives.png b/docs/img/gsg/DriversTwoDrives.png new file mode 100644 index 00000000..922fe222 Binary files /dev/null and b/docs/img/gsg/DriversTwoDrives.png differ diff --git a/docs/img/gsg/DrvinfoInBasic.png b/docs/img/gsg/DrvinfoInBasic.png new file mode 100644 index 00000000..6a270735 Binary files /dev/null and b/docs/img/gsg/DrvinfoInBasic.png differ diff --git a/docs/img/gsg/FourPartitionsList.png b/docs/img/gsg/FourPartitionsList.png new file mode 100644 index 00000000..090b0cc2 Binary files /dev/null and b/docs/img/gsg/FourPartitionsList.png differ diff --git a/docs/img/gsg/NextorPrompt.png b/docs/img/gsg/NextorPrompt.png new file mode 100644 index 00000000..dd609e24 Binary files /dev/null and b/docs/img/gsg/NextorPrompt.png differ diff --git a/docs/img/gsg/RallocThenDir.png b/docs/img/gsg/RallocThenDir.png new file mode 100644 index 00000000..c3341384 Binary files /dev/null and b/docs/img/gsg/RallocThenDir.png differ diff --git a/docs/img/gsg/VolAndDir.png b/docs/img/gsg/VolAndDir.png new file mode 100644 index 00000000..6899f5dd Binary files /dev/null and b/docs/img/gsg/VolAndDir.png differ diff --git a/info/Nextor2.0DriverDevelopmentGuide.doc b/info/Nextor2.0DriverDevelopmentGuide.doc deleted file mode 100644 index b117a7e7..00000000 Binary files a/info/Nextor2.0DriverDevelopmentGuide.doc and /dev/null differ diff --git a/info/Nextor2.0GettingStartedGuide.doc b/info/Nextor2.0GettingStartedGuide.doc deleted file mode 100644 index 5ee8ff5c..00000000 Binary files a/info/Nextor2.0GettingStartedGuide.doc and /dev/null differ diff --git a/info/Nextor2.0ProgrammersReference.doc b/info/Nextor2.0ProgrammersReference.doc deleted file mode 100644 index c1592cfc..00000000 Binary files a/info/Nextor2.0ProgrammersReference.doc and /dev/null differ diff --git a/info/Nextor2.0UserManual.doc b/info/Nextor2.0UserManual.doc deleted file mode 100644 index 757c9d12..00000000 Binary files a/info/Nextor2.0UserManual.doc and /dev/null differ diff --git a/releases/2.0 final/docs/DRIVER.ASM b/releases/2.0 final/docs/DRIVER.ASM deleted file mode 100644 index 0f4d3ca9..00000000 --- a/releases/2.0 final/docs/DRIVER.ASM +++ /dev/null @@ -1,649 +0,0 @@ - ; Dummy disk driver for Nextor 2.0 - ; By Konamiman, 2/2014 - ; - ; This code can be used as the basis for developing - ; a real disk driver: just set DRV_TYPE appropriately, - ; change the driver name and version at DRV_NAME and VER_*, and - ; implement the required routines depending on the driver type. - ; - ; See the Nextor driver development guide for more details. - - ;org 4100h - - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Miscellaneous constants -; - -;This is a 2 byte buffer to store the address of code to be executed. -;It is used by some of the kernel page 0 routines. - -CODE_ADD: equ 0F84Ch - - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL equ 0B5h -.IPARM equ 08Bh - -endif - - -;----------------------------------------------------------------------------- -; -; Routines and information available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a, -; ld hl, -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel main bank -; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), -; then invokes the routine whose address is at (CODE_ADD). -; It is necessary to use this routine to invoke CALBAS -; (so that kernel bank is correct in case of BASIC error) -; and to invoke DOS functions via F37Dh hook. -; -; Input: Address of code to invoke in (CODE_ADD). -; AF, BC, DE, HL, IX, IY passed to the called routine. -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALLB0 equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; -; Input: A = bank number -; IX = routine address -; AF' = AF for the routine -; HL' = Ix for the routine -; BC, DE, HL, IY = input for the routine -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a, (xor a for current page 1 slot) -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* This address contains one byte that tells how many banks -; form the Nextor kernel (or alternatively, the first bank -; number of the driver). - -K_SIZE equ 40FEh - - -;* This address contains one byte with the current bank number. - -CUR_BANK equ 40FFh - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 781Fh ;Null string (disk can't be formatted) -SING_DBL equ 7820h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "NEXTOR_DRIVER",0 - - -;----------------------------------------------------------------------------- -; -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1 -endif - - -;----------------------------------------------------------------------------- -; -; Reserved byte -; - - db 0 - - -;----------------------------------------------------------------------------- -; -; Driver name -; - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - - -;----------------------------------------------------------------------------- -; -; Jump table for the driver public routines -; - - ; These routines are mandatory for all drivers - ; (but probably you need to implement only DRV_INIT) - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - - ; These routines are mandatory for drive-based drivers - - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - - ; These routines are mandatory for device-based drivers - - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO -endif - - -;===== -;===== END of data that must be at fixed addresses -;===== - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization routine, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7850h, 7853h, 7856h, 7859h and 785Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; C = First sector number to read/write (bits 22-16) if bit 7 = 0 -; Media ID if bit 7 = 1 -; DE = First sector number to read/write (bits 15-0) -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors -; B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical -; units (which is functionally equivalent to having only one). -;+1 (1): Device flags, always zero in Beta 2. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. -; -; The returned status is always relative to the previous invokation of -; DEV_STATUS itself. Please read the Driver Developer Guide for more info. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; End of the driver code - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end diff --git a/releases/2.0 final/docs/Nextor 2.0 Driver Development Guide.pdf b/releases/2.0 final/docs/Nextor 2.0 Driver Development Guide.pdf deleted file mode 100644 index c024714c..00000000 Binary files a/releases/2.0 final/docs/Nextor 2.0 Driver Development Guide.pdf and /dev/null differ diff --git a/releases/2.0 final/docs/Nextor 2.0 Getting Started Guide.pdf b/releases/2.0 final/docs/Nextor 2.0 Getting Started Guide.pdf deleted file mode 100644 index 90f1528a..00000000 Binary files a/releases/2.0 final/docs/Nextor 2.0 Getting Started Guide.pdf and /dev/null differ diff --git a/releases/2.0 final/docs/Nextor 2.0 Programmers Reference.pdf b/releases/2.0 final/docs/Nextor 2.0 Programmers Reference.pdf deleted file mode 100644 index 7ab26cd8..00000000 Binary files a/releases/2.0 final/docs/Nextor 2.0 Programmers Reference.pdf and /dev/null differ diff --git a/releases/2.0 final/docs/Nextor 2.0 User Manual.pdf b/releases/2.0 final/docs/Nextor 2.0 User Manual.pdf deleted file mode 100644 index 7e435fe4..00000000 Binary files a/releases/2.0 final/docs/Nextor 2.0 User Manual.pdf and /dev/null differ diff --git a/releases/2.0 final/fdisk/README.TXT b/releases/2.0 final/fdisk/README.TXT deleted file mode 100644 index 40eac563..00000000 --- a/releases/2.0 final/fdisk/README.TXT +++ /dev/null @@ -1,31 +0,0 @@ -This is the source code of the device partitioner embedded within the Nextor kernel (the one that appears when issuing a CALL FDISK command from the BASIC prompt). You can change it to correct any bug or extend its functionality (subject to code size constraints, see below), or you can use it as the basis for developing a custom tool. - -In order to compile it you need: - -- The SDCC compiler (http://sdcc.sourceforge.net) (See note below!) -- A tool to convert .HEX files to binary files, such as HEX2BIN.EXE for Windows (included). -- A file portions copying tool tool such as DD. Linux has this tool built-in, a Windows port (DD.EXE) exists and is included. - -A script for Windows is included (compile.bat) that will compile the tool and embed it within the Nextor ROM file. You need to copy the Nextor ROM file to the folder where the rest of the files are located, and edit the script to specify the file name (in the line starting with "set nextorfile="). - -Alternatively, you can compile and embed the tool manually. See the beginning of the source files (fdisk.c and fdisk2.c) for details. - -In case that you want to add new code and embed the result within the Nextor kernel, note that the size of the compiled code cannot exceed 16000 bytes for fdisk.c, and 8000 bytes for fdisk2.c, due to ROM page size constraints. You cannot rely on the size of the generated files (fdisk.dat and fdisk2.dat) since these contain data sections that are stripped down in the embedding process. In order to know the size of the generated code, open the .lst files produced by the compilation process (you need to remove the "del *.lst" line in the compilation script) and look at the 4 digit hexadecimal number in the first column in the last line. This value should be no greater than 3E80 for fdisk.lst, or 1F40 for fdisk2.lst. - -More about Nextor here: http://www.konamiman.com#nextor - -------------------------------------------------------- - -NOTE ABOUT SDCC: Quoted from http://www.konamiman.com#sdcc - -SDCC comes with a Z80 version of the standard C library, it is at (SDCC folder)\lib\z80\z80.lib. The versions of the console related functions getchar, putchar and printf that are bundled in this library are not suited for developing MSX software. The logical fix for this would be to replace these functions with MSX compatible versions inside the library itself. - -However there is a problem with the current version of SDCC, at least the Windows version: it is not possible to manage the file z80.lib with the SDCC library manager utility supplied, sdcclib.exe. If attempted, the error message "File was not created with sdcclib" is displayed. - -The workaround I have come up with consists of using the msxchar library that you can download here, plus modifying the original file z80.lib by hand (this is necessary so that the compiler does not complaint about having duplicate function names). That's how this can be done: - -1. Open the z80.lib file in a text editor. You will see garbage (binary data) mixed with text data. -2. Search for all the occurences of the names printf, getchar and putchar within the file, either as whole words or as part of other words. -3. Modify these names while maintaining their lengths. I have simply changed the first character into a 'x', so that they become 'xrintf', 'xetchar' and 'xutchar'. - -This is not a perfect solution but it seems to work. If anyone knows a better way for dealing with this apparently defective z80.lib, please let me know. diff --git a/releases/2.0 final/fdisk/compile.bat b/releases/2.0 final/fdisk/compile.bat deleted file mode 100644 index ebfcd3b6..00000000 --- a/releases/2.0 final/fdisk/compile.bat +++ /dev/null @@ -1,40 +0,0 @@ -@echo off -setlocal -set nextorfile="nextor.rom" -cls - -if not exist %nextorfile% ( - echo %nextorfile% not found! - goto :end -) - -FOR /F "tokens=*" %%A IN ("%nextorfile%") DO set size=%%~zA -if %size% LSS 114688 ( - echo %nextorfile% is too small! At least 112K expected - goto :end -) - -sdasz80 -o fdisk_crt0.rel fdisk_crt0.s -if errorlevel 1 goto :end - -sdcc --code-loc 0x4120 --data-loc 0x8020 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 --no-std-crt0 fdisk_crt0.rel msxchar.lib fdisk.c -if errorlevel 1 goto :end -hex2bin -e dat fdisk.ihx - -sdcc --code-loc 0x4120 --data-loc 0xA000 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 --no-std-crt0 fdisk_crt0.rel msxchar.lib fdisk2.c -if errorlevel 1 goto :end -hex2bin -e dat fdisk2.ihx - -dd if=fdisk.dat of=%nextorfile% bs=1 count=16000 seek=82176 -dd if=fdisk2.dat of=%nextorfile% bs=1 count=8000 seek=98560 - -:end - -del *.sym 2>nul -del *.ihx 2>nul -del *.lst 2>nul -del *.lk 2>nul -del *.noi 2>nul -del *.rel 2>nul -del *.asm 2>nul -del *.map 2>nul diff --git a/releases/2.0 final/fdisk/dd.exe b/releases/2.0 final/fdisk/dd.exe deleted file mode 100644 index 8cf719cf..00000000 Binary files a/releases/2.0 final/fdisk/dd.exe and /dev/null differ diff --git a/releases/2.0 final/fdisk/fdisk.asm b/releases/2.0 final/fdisk/fdisk.asm deleted file mode 100644 index 57480da8..00000000 --- a/releases/2.0 final/fdisk/fdisk.asm +++ /dev/null @@ -1,6542 +0,0 @@ -;-------------------------------------------------------- -; File Created by SDCC : free open source ANSI-C Compiler -; Version 3.3.0 #8604 (May 11 2013) (MINGW32) -; This file was generated Tue Feb 11 14:28:52 2014 -;-------------------------------------------------------- - .module fdisk - .optsdcc -mz80 - -;-------------------------------------------------------- -; Public variables in this module -;-------------------------------------------------------- - .globl _PrintDone - .globl _PrintTargetInfo - .globl _main - .globl _strlen - .globl __ultoa - .globl _sprintf - .globl _printf - .globl _dos1 - .globl _divisor - .globl _dividend - .globl _autoPartitionSizeInK - .globl _canDoDirectFormat - .globl _canCreatePartitions - .globl _unpartitionnedSpaceInSectors - .globl _partitionsExistInDisk - .globl _partitionsCount - .globl _partitions - .globl _screenLinesCount - .globl _is80ColumnsDisplay - .globl _currentScreenConfig - .globl _originalScreenConfig - .globl _OUT_FLAGS - .globl _ASMRUT - .globl _regs - .globl _availableLunsCount - .globl _availableDevicesCount - .globl _installedDriversCount - .globl _selectedLunIndex - .globl _selectedDeviceIndex - .globl _currentDevice - .globl _devices - .globl _selectedLun - .globl _luns - .globl _selectedDriverName - .globl _selectedDriver - .globl _drivers - .globl _buffer - .globl _DoFdisk - .globl _GoDriverSelectionScreen - .globl _ShowDriverSelectionScreen - .globl _ComposeSlotString - .globl _GoDeviceSelectionScreen - .globl _ShowDeviceSelectionScreen - .globl _GetDevicesInformation - .globl _EnsureMaximumStringLength - .globl _GoLunSelectionScreen - .globl _InitializePartitionningVariables - .globl _ShowLunSelectionScreen - .globl _PrintSize - .globl _GetRemainingBy1024String - .globl _GetLunsInformation - .globl _PrintDeviceInfoWithIndex - .globl _GoPartitionningMainMenuScreen - .globl _GetYesOrNo - .globl _GetDiskPartitionsInfo - .globl _ShowPartitions - .globl _PrintOnePartitionInfo - .globl _DeleteAllPartitions - .globl _RecalculateAutoPartitionSize - .globl _AddPartition - .globl _AddAutoPartition - .globl _UndoAddPartition - .globl _TestDeviceAccess - .globl _InitializeScreenForTestDeviceAccess - .globl _PrintDosErrorMessage - .globl _FormatWithoutPartitions - .globl _CreateFatFileSystem - .globl _WritePartitionTable - .globl _PreparePartitionningProcess - .globl _CreatePartition - .globl _ConfirmDataDestroy - .globl _ClearInformationArea - .globl _GetDriversInformation - .globl _TerminateRightPaddedStringWithZero - .globl _WaitKey - .globl _GetKey - .globl _SaveOriginalScreenConfiguration - .globl _ComposeWorkScreenConfiguration - .globl _SetScreenConfiguration - .globl _InitializeWorkingScreen - .globl _PrintRuler - .globl _Locate - .globl _LocateX - .globl _PrintCentered - .globl _PrintStateMessage - .globl _putchar - .globl _print - .globl _CallFunctionInExtraBank - .globl _DriverCall - .globl _DosCall - .globl _SwitchSystemBankThenCall - .globl _AsmCallAlt -;-------------------------------------------------------- -; special function registers -;-------------------------------------------------------- -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _DATA -_buffer:: - .ds 1000 -_drivers:: - .ds 512 -_selectedDriver:: - .ds 2 -_selectedDriverName:: - .ds 50 -_luns:: - .ds 91 -_selectedLun:: - .ds 2 -_devices:: - .ds 455 -_currentDevice:: - .ds 2 -_selectedDeviceIndex:: - .ds 1 -_selectedLunIndex:: - .ds 1 -_installedDriversCount:: - .ds 1 -_availableDevicesCount:: - .ds 1 -_availableLunsCount:: - .ds 1 -_regs:: - .ds 12 -_ASMRUT:: - .ds 4 -_OUT_FLAGS:: - .ds 1 -_originalScreenConfig:: - .ds 3 -_currentScreenConfig:: - .ds 3 -_is80ColumnsDisplay:: - .ds 1 -_screenLinesCount:: - .ds 1 -_partitions:: - .ds 2304 -_partitionsCount:: - .ds 2 -_partitionsExistInDisk:: - .ds 1 -_unpartitionnedSpaceInSectors:: - .ds 4 -_canCreatePartitions:: - .ds 1 -_canDoDirectFormat:: - .ds 1 -_autoPartitionSizeInK:: - .ds 4 -_dividend:: - .ds 4 -_divisor:: - .ds 4 -_dos1:: - .ds 1 -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _INITIALIZED -;-------------------------------------------------------- -; absolute external ram data -;-------------------------------------------------------- - .area _DABS (ABS) -;-------------------------------------------------------- -; global & static initialisations -;-------------------------------------------------------- - .area _HOME - .area _GSINIT - .area _GSFINAL - .area _GSINIT -;-------------------------------------------------------- -; Home -;-------------------------------------------------------- - .area _HOME - .area _HOME -;-------------------------------------------------------- -; code -;-------------------------------------------------------- - .area _CODE -;fdisk.c:154: void main(int bc, int hl) -; --------------------------------- -; Function main -; --------------------------------- -_main_start:: -_main: -;fdisk.c:156: ASMRUT[0] = 0xC3; //Code for JP - ld hl,#_ASMRUT - ld (hl),#0xC3 -;fdisk.c:157: dos1 = (*((byte*)0xF313) == 0); - ld a,(#0xF313) - or a, a - jr NZ,00103$ - ld a,#0x01 - jr 00104$ -00103$: - xor a,a -00104$: - ld (#_dos1 + 0),a -;fdisk.c:194: DoFdisk(); - jp _DoFdisk -_main_end:: -;fdisk.c:199: void DoFdisk() -; --------------------------------- -; Function DoFdisk -; --------------------------------- -_DoFdisk_start:: -_DoFdisk: -;fdisk.c:201: installedDriversCount = 0; - ld hl,#_installedDriversCount + 0 - ld (hl), #0x00 -;fdisk.c:202: selectedDeviceIndex = 0; - ld hl,#_selectedDeviceIndex + 0 - ld (hl), #0x00 -;fdisk.c:203: selectedLunIndex = 0; - ld hl,#_selectedLunIndex + 0 - ld (hl), #0x00 -;fdisk.c:204: availableLunsCount = 0; - ld hl,#_availableLunsCount + 0 - ld (hl), #0x00 -;fdisk.c:206: SaveOriginalScreenConfiguration(); - call _SaveOriginalScreenConfiguration -;fdisk.c:207: ComposeWorkScreenConfiguration(); - call _ComposeWorkScreenConfiguration -;fdisk.c:208: SetScreenConfiguration(¤tScreenConfig); - ld hl,#_currentScreenConfig - push hl - call _SetScreenConfiguration -;fdisk.c:209: InitializeWorkingScreen("Nextor disk partitionning tool"); - ld hl, #__str_0 - ex (sp),hl - call _InitializeWorkingScreen - pop af -;fdisk.c:211: GoDriverSelectionScreen(); - call _GoDriverSelectionScreen -;fdisk.c:213: SetScreenConfiguration(&originalScreenConfig); - ld hl,#_originalScreenConfig - push hl - call _SetScreenConfiguration - pop af - ret -_DoFdisk_end:: -__str_0: - .ascii "Nextor disk partitionning tool" - .db 0x00 -;fdisk.c:217: void GoDriverSelectionScreen() -; --------------------------------- -; Function GoDriverSelectionScreen -; --------------------------------- -_GoDriverSelectionScreen_start:: -_GoDriverSelectionScreen: -;fdisk.c:221: while(true) { -00113$: -;fdisk.c:222: ShowDriverSelectionScreen(); - call _ShowDriverSelectionScreen -;fdisk.c:223: if(installedDriversCount == 0) { - ld a,(#_installedDriversCount + 0) - or a, a -;fdisk.c:224: return; -;fdisk.c:227: while(true) { - ret Z -00110$: -;fdisk.c:228: key = WaitKey(); - call _WaitKey - ld d,l -;fdisk.c:229: if(key == ESC) { - ld a,d - sub a, #0x1B - ret Z - jr 00107$ -;fdisk.c:230: return; - ret -00107$: -;fdisk.c:232: key -= '0'; - ld a,d - add a,#0xD0 -;fdisk.c:233: if(key >= 1 && key <= installedDriversCount) { - ld d,a - sub a, #0x01 - jr C,00110$ - ld a,(#_installedDriversCount) - sub a, d - jr C,00110$ -;fdisk.c:234: GoDeviceSelectionScreen(key); - push de - inc sp - call _GoDeviceSelectionScreen - inc sp -;fdisk.c:235: break; - jr 00113$ - ret -_GoDriverSelectionScreen_end:: -;fdisk.c:243: void ShowDriverSelectionScreen() -; --------------------------------- -; Function ShowDriverSelectionScreen -; --------------------------------- -_ShowDriverSelectionScreen_start:: -_ShowDriverSelectionScreen: - push ix - ld ix,#0 - add ix,sp - ld hl,#-30 - add hl,sp - ld sp,hl -;fdisk.c:253: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:255: if(installedDriversCount == 0) { - ld a,(#_installedDriversCount + 0) - or a, a - jr NZ,00102$ -;fdisk.c:256: GetDriversInformation(); - call _GetDriversInformation -00102$: -;fdisk.c:259: if(installedDriversCount == 0) { - ld a,(#_installedDriversCount + 0) - or a, a - jr NZ,00104$ -;fdisk.c:260: Locate(0, 7); - ld hl,#0x0700 - push hl - call _Locate -;fdisk.c:261: PrintCentered("There are no device-based drivers"); - ld hl, #__str_1 - ex (sp),hl - call _PrintCentered -;fdisk.c:262: CursorDown(); - ld h,#0x1F - ex (sp),hl - inc sp - call _putchar - inc sp -;fdisk.c:263: PrintCentered("available in the system"); - ld hl,#__str_2 - push hl - call _PrintCentered -;fdisk.c:264: PrintStateMessage("Press any key to exit..."); - ld hl, #__str_3 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:265: WaitKey(); - call _WaitKey -;fdisk.c:266: return; - jp 00115$ -00104$: -;fdisk.c:269: currentDriver = &drivers[0]; -;fdisk.c:270: Locate(0,3); - ld hl,#0x0300 - push hl - call _Locate - pop af -;fdisk.c:271: for(i = 0; i < installedDriversCount; i++) { - ld hl,#0x0005 - add hl,sp - ld -2 (ix),l - ld -1 (ix),h - ld a,-2 (ix) - ld -4 (ix),a - ld a,-1 (ix) - ld -3 (ix),a - ld hl,#0x0002 - add hl,sp - ld -6 (ix),l - ld -5 (ix),h - ld -8 (ix),#<(_drivers) - ld -7 (ix),#>(_drivers) - ld -21 (ix),#0x00 -00113$: - ld hl,#_installedDriversCount - ld a,-21 (ix) - sub a, (hl) - jp NC,00111$ -;fdisk.c:272: ComposeSlotString(currentDriver->slot, slot); - ld e,-2 (ix) - ld d,-1 (ix) - ld l,-8 (ix) - ld h,-7 (ix) - ld h,(hl) - push de - push hl - inc sp - call _ComposeSlotString - pop af - inc sp -;fdisk.c:274: revByte = currentDriver->versionRev; - ld l,-8 (ix) - ld h,-7 (ix) - ld de, #0x0007 - add hl, de - ld d,(hl) -;fdisk.c:275: if(revByte == 0) { - ld a,d - or a, a - jr NZ,00106$ -;fdisk.c:276: rev[0] = '\0'; - ld l,-6 (ix) - ld h,-5 (ix) - ld (hl),#0x00 - jr 00107$ -00106$: -;fdisk.c:278: rev[0] = '.'; - ld l,-6 (ix) - ld h,-5 (ix) - ld (hl),#0x2E -;fdisk.c:279: rev[1] = revByte + '0'; - ld l,-6 (ix) - ld h,-5 (ix) - inc hl - ld a,d - add a, #0x30 - ld (hl),a -;fdisk.c:280: rev[2] = '\0'; - ld c,-6 (ix) - ld b,-5 (ix) - inc bc - inc bc - xor a, a - ld (bc),a -00107$: -;fdisk.c:283: driverName = currentDriver->driverName; - ld a,-8 (ix) - add a, #0x08 - ld -30 (ix),a - ld a,-7 (ix) - adc a, #0x00 - ld -29 (ix),a -;fdisk.c:292: slot); - ld a,-4 (ix) - ld -10 (ix),a - ld a,-3 (ix) - ld -9 (ix),a -;fdisk.c:291: rev, - ld a,-6 (ix) - ld -12 (ix),a - ld a,-5 (ix) - ld -11 (ix),a -;fdisk.c:290: currentDriver->versionSec, - ld l,-8 (ix) - ld h,-7 (ix) - ld de, #0x0006 - add hl, de - ld a,(hl) - ld -14 (ix),a - ld -13 (ix),#0x00 -;fdisk.c:289: currentDriver->versionMain, - ld l,-8 (ix) - ld h,-7 (ix) - ld de, #0x0005 - add hl, de - ld a,(hl) - ld -16 (ix),a - ld -15 (ix),#0x00 -;fdisk.c:288: is80ColumnsDisplay ? " " : "\x0D\x0A ", - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr Z,00117$ - ld -18 (ix),#<(__str_5) - ld -17 (ix),#>(__str_5) - jr 00118$ -00117$: - ld -18 (ix),#<(__str_6) - ld -17 (ix),#>(__str_6) -00118$: -;fdisk.c:286: i + 1, - ld a,-21 (ix) - ld -20 (ix),a - ld -19 (ix),#0x00 - inc -20 (ix) - jr NZ,00141$ - inc -19 (ix) -00141$: -;fdisk.c:285: printf("\x1BK%i. %s%sv%i.%i%s on slot %s", - ld l,-10 (ix) - ld h,-9 (ix) - push hl - ld l,-12 (ix) - ld h,-11 (ix) - push hl - ld l,-14 (ix) - ld h,-13 (ix) - push hl - ld l,-16 (ix) - ld h,-15 (ix) - push hl - ld l,-18 (ix) - ld h,-17 (ix) - push hl - ld l,-30 (ix) - ld h,-29 (ix) - push hl - ld l,-20 (ix) - ld h,-19 (ix) - push hl - ld hl,#__str_4 - push hl - call _printf - ld hl,#0x0010 - add hl,sp - ld sp,hl -;fdisk.c:294: NewLine(); - ld hl,#__str_7 - push hl - call _print - pop af -;fdisk.c:295: if(is80ColumnsDisplay || installedDriversCount <= 4) { - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr NZ,00108$ - ld a,#0x04 - ld iy,#_installedDriversCount - sub a, 0 (iy) - jr C,00109$ -00108$: -;fdisk.c:296: NewLine(); - ld hl,#__str_7 - push hl - call _print - pop af -00109$: -;fdisk.c:299: currentDriver++; - ld a,-8 (ix) - add a, #0x40 - ld -8 (ix),a - ld a,-7 (ix) - adc a, #0x00 - ld -7 (ix),a -;fdisk.c:271: for(i = 0; i < installedDriversCount; i++) { - inc -21 (ix) - jp 00113$ -00111$: -;fdisk.c:302: NewLine(); - ld hl,#__str_7 - push hl - call _print -;fdisk.c:303: print("ESC. Exit"); - ld hl, #__str_8 - ex (sp),hl - call _print -;fdisk.c:305: PrintStateMessage("Select the device driver"); - ld hl, #__str_9 - ex (sp),hl - call _PrintStateMessage - pop af -00115$: - ld sp,ix - pop ix - ret -_ShowDriverSelectionScreen_end:: -__str_1: - .ascii "There are no device-based drivers" - .db 0x00 -__str_2: - .ascii "available in the system" - .db 0x00 -__str_3: - .ascii "Press any key to exit..." - .db 0x00 -__str_4: - .db 0x1B - .ascii "K%i. %s%sv%i.%i%s on slot %s" - .db 0x00 -__str_5: - .ascii " " - .db 0x00 -__str_6: - .db 0x0D - .db 0x0A - .ascii " " - .db 0x00 -__str_7: - .db 0x0A - .db 0x0D - .db 0x00 -__str_8: - .ascii "ESC. Exit" - .db 0x00 -__str_9: - .ascii "Select the device driver" - .db 0x00 -;fdisk.c:309: void ComposeSlotString(byte slot, char* destination) -; --------------------------------- -; Function ComposeSlotString -; --------------------------------- -_ComposeSlotString_start:: -_ComposeSlotString: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:312: destination[0] = slot + '0'; - ld c,5 (ix) - ld b,6 (ix) -;fdisk.c:313: destination[1] = '\0'; - ld e, c - ld d, b - inc de -;fdisk.c:311: if((slot & 0x80) == 0) { - bit 7, 4 (ix) - jr NZ,00102$ -;fdisk.c:312: destination[0] = slot + '0'; - ld a,4 (ix) - add a, #0x30 - ld (bc),a -;fdisk.c:313: destination[1] = '\0'; - xor a, a - ld (de),a - jr 00104$ -00102$: -;fdisk.c:315: destination[0] = (slot & 3) + '0'; - ld a,4 (ix) - and a, #0x03 - add a, #0x30 - ld (bc),a -;fdisk.c:316: destination[1] = '-'; - ld a,#0x2D - ld (de),a -;fdisk.c:317: destination[2] = ((slot >> 2) & 3) + '0'; - ld l, c - ld h, b - inc hl - inc hl - ld a,4 (ix) - rrca - rrca - and a,#0x3F - and a, #0x03 - add a, #0x30 - ld (hl),a -;fdisk.c:318: destination[3] = '\0'; - ld l,c - ld h,b - inc hl - inc hl - inc hl - ld (hl),#0x00 -00104$: - pop ix - ret -_ComposeSlotString_end:: -;fdisk.c:323: void GoDeviceSelectionScreen(byte driverIndex) -; --------------------------------- -; Function GoDeviceSelectionScreen -; --------------------------------- -_GoDeviceSelectionScreen_start:: -_GoDeviceSelectionScreen: - push ix - ld ix,#0 - add ix,sp - push af - push af -;fdisk.c:329: selectedDriver = &drivers[driverIndex - 1]; - ld l,4 (ix) - dec l - ld h,#0x00 - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, hl - ld de,#_drivers - add hl,de - ld (_selectedDriver),hl -;fdisk.c:330: ComposeSlotString(selectedDriver->slot, slot); - ld hl,#0x0000 - add hl,sp - ex de,hl - ld c, e - ld b, d - ld hl,(_selectedDriver) - ld h,(hl) - push de - push bc - push hl - inc sp - call _ComposeSlotString - pop af - inc sp - pop de -;fdisk.c:331: strcpy(selectedDriverName, selectedDriver->driverName); - ld hl,(_selectedDriver) - ld bc,#0x0008 - add hl,bc - push de - ld de,#_selectedDriverName - xor a, a -00144$: - cp a, (hl) - ldi - jr NZ, 00144$ - pop de -;fdisk.c:332: if(!is80ColumnsDisplay) { - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr NZ,00102$ -;fdisk.c:333: EnsureMaximumStringLength(selectedDriverName, MAX_LINLEN_MSX1 - 12); - ld hl,#_selectedDriverName - push de - ld bc,#0x001C - push bc - push hl - call _EnsureMaximumStringLength - pop af - pop af - pop de -00102$: -;fdisk.c:337: slot); -;fdisk.c:336: " on slot %s\r\n", -;fdisk.c:335: sprintf(selectedDriverName + strlen(selectedDriverName), - ld hl,#_selectedDriverName - push de - push hl - call _strlen - pop af - pop de - ld bc,#_selectedDriverName - add hl,bc - push de - ld bc,#__str_10 - push bc - push hl - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk.c:339: availableDevicesCount = 0; - ld hl,#_availableDevicesCount + 0 - ld (hl), #0x00 -;fdisk.c:341: while(true) { -00116$: -;fdisk.c:342: ShowDeviceSelectionScreen(); - call _ShowDeviceSelectionScreen -;fdisk.c:343: if(availableDevicesCount == 0) { - ld a,(#_availableDevicesCount + 0) - or a, a -;fdisk.c:344: return; -;fdisk.c:347: while(true) { - jr Z,00118$ -00113$: -;fdisk.c:348: key = WaitKey(); - call _WaitKey - ld c,l -;fdisk.c:349: if(key == ESC) { - ld a,c - sub a, #0x1B - jr Z,00118$ - jr 00110$ -;fdisk.c:350: return; - jr 00118$ -00110$: -;fdisk.c:352: key -= '0'; - ld a,c - add a,#0xD0 -;fdisk.c:353: if(key >= 1 && key <= MAX_DEVICES_PER_DRIVER && devices[key - 1].lunCount != 0) { - ld c,a - sub a, #0x01 - jr C,00113$ - ld a,#0x07 - sub a, c - jr C,00113$ - ld h,c - dec h - ld e,h - ld d,#0x00 - ld l, e - ld h, d - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, de - ld de,#_devices - add hl,de - ld a, (hl) - or a, a - jr Z,00113$ -;fdisk.c:354: GoLunSelectionScreen(key); - ld a,c - push af - inc sp - call _GoLunSelectionScreen - inc sp -;fdisk.c:355: break; - jr 00116$ -00118$: - ld sp,ix - pop ix - ret -_GoDeviceSelectionScreen_end:: -__str_10: - .ascii " on slot %s" - .db 0x0D - .db 0x0A - .db 0x00 -;fdisk.c:363: void ShowDeviceSelectionScreen() -; --------------------------------- -; Function ShowDeviceSelectionScreen -; --------------------------------- -_ShowDeviceSelectionScreen_start:: -_ShowDeviceSelectionScreen: - push ix - ld ix,#0 - add ix,sp - dec sp -;fdisk.c:368: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:369: Locate(0,3); - ld hl,#0x0300 - push hl - call _Locate -;fdisk.c:370: print(selectedDriverName); - ld hl, #_selectedDriverName - ex (sp),hl - call _print -;fdisk.c:371: CursorDown(); - ld h,#0x1F - ex (sp),hl - inc sp - call _putchar - inc sp -;fdisk.c:372: CursorDown(); - ld a,#0x1F - push af - inc sp - call _putchar - inc sp -;fdisk.c:374: if(availableDevicesCount == 0) { - ld a,(#_availableDevicesCount + 0) - or a, a - jr NZ,00102$ -;fdisk.c:375: GetDevicesInformation(); - call _GetDevicesInformation -00102$: -;fdisk.c:378: if(availableDevicesCount == 0) { - ld a,(#_availableDevicesCount + 0) - or a, a - jr NZ,00104$ -;fdisk.c:379: Locate(0, 9); - ld hl,#0x0900 - push hl - call _Locate -;fdisk.c:380: PrintCentered("There are no suitable devices"); - ld hl, #__str_11 - ex (sp),hl - call _PrintCentered -;fdisk.c:381: CursorDown(); - ld h,#0x1F - ex (sp),hl - inc sp - call _putchar - inc sp -;fdisk.c:382: PrintCentered("attached to the driver"); - ld hl,#__str_12 - push hl - call _PrintCentered -;fdisk.c:383: PrintStateMessage("Press any key to go back..."); - ld hl, #__str_13 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:384: WaitKey(); - call _WaitKey -;fdisk.c:385: return; - jr 00112$ -00104$: -;fdisk.c:388: currentDevice = &devices[0]; - ld bc,#_devices -;fdisk.c:389: for(i = 0; i < MAX_DEVICES_PER_DRIVER; i++) { - ld -1 (ix),#0x00 -00110$: -;fdisk.c:390: if(currentDevice->lunCount > 0) { - ld a,(bc) - or a, a - jr Z,00106$ -;fdisk.c:393: currentDevice->deviceName); - ld l, c - ld h, b - inc hl -;fdisk.c:392: i + 1, - ld e,-1 (ix) - ld d,#0x00 - inc de -;fdisk.c:391: printf("\x1BK%i. %s\r\n\r\n", - push bc - push hl - push de - ld hl,#__str_14 - push hl - call _printf - ld hl,#0x0006 - add hl,sp - ld sp,hl - pop bc -00106$: -;fdisk.c:396: currentDevice++; - ld hl,#0x0041 - add hl,bc - ld c,l - ld b,h -;fdisk.c:389: for(i = 0; i < MAX_DEVICES_PER_DRIVER; i++) { - inc -1 (ix) - ld a,-1 (ix) - sub a, #0x07 - jr C,00110$ -;fdisk.c:399: if(availableDevicesCount < 7) { - ld a,(#_availableDevicesCount + 0) - sub a, #0x07 - jr NC,00109$ -;fdisk.c:400: NewLine(); - ld hl,#__str_15 - push hl - call _print - pop af -00109$: -;fdisk.c:402: print("ESC. Go back to driver selection screen"); - ld hl,#__str_16 - push hl - call _print -;fdisk.c:404: PrintStateMessage("Select the device"); - ld hl, #__str_17 - ex (sp),hl - call _PrintStateMessage - pop af -00112$: - inc sp - pop ix - ret -_ShowDeviceSelectionScreen_end:: -__str_11: - .ascii "There are no suitable devices" - .db 0x00 -__str_12: - .ascii "attached to the driver" - .db 0x00 -__str_13: - .ascii "Press any key to go back..." - .db 0x00 -__str_14: - .db 0x1B - .ascii "K%i. %s" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x00 -__str_15: - .db 0x0A - .db 0x0D - .db 0x00 -__str_16: - .ascii "ESC. Go back to driver selection screen" - .db 0x00 -__str_17: - .ascii "Select the device" - .db 0x00 -;fdisk.c:408: void GetDevicesInformation() -; --------------------------------- -; Function GetDevicesInformation -; --------------------------------- -_GetDevicesInformation_start:: -_GetDevicesInformation: - push ix - ld ix,#0 - add ix,sp - ld hl,#-7 - add hl,sp - ld sp,hl -;fdisk.c:412: deviceInfo* currentDevice = &devices[0]; - ld -2 (ix),#<(_devices) - ld -1 (ix),#>(_devices) -;fdisk.c:436: availableDevicesCount = 0; - ld hl,#_availableDevicesCount + 0 - ld (hl), #0x00 -;fdisk.c:438: while(deviceIndex <= MAX_DEVICES_PER_DRIVER) { - ld -5 (ix),#0x01 -00109$: - ld a,#0x07 - sub a, -5 (ix) - jp C,00112$ -;fdisk.c:439: currentDeviceName = currentDevice->deviceName; - ld a,-2 (ix) - add a, #0x01 - ld -7 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -6 (ix),a -;fdisk.c:440: regs.Bytes.A = deviceIndex; - ld hl,#(_regs + 0x0001) - ld a,-5 (ix) - ld (hl),a -;fdisk.c:441: regs.Bytes.B = 0; - ld hl,#(_regs + 0x0003) - ld (hl),#0x00 -;fdisk.c:442: regs.Words.HL = (int)currentDevice; - ld a,-2 (ix) - ld -4 (ix),a - ld a,-1 (ix) - ld -3 (ix),a - ld hl,#(_regs + 0x0006) - ld a,-4 (ix) - ld (hl),a - inc hl - ld a,-3 (ix) - ld (hl),a -;fdisk.c:443: DriverCall(selectedDriver->slot, DEV_INFO); - ld hl,(_selectedDriver) - ld -4 (ix),l - ld -3 (ix),h - ld l,-4 (ix) - ld h,-3 (ix) - ld h,(hl) - ld bc,#0x4163 - push bc - push hl - inc sp - call _DriverCall - pop af - inc sp -;fdisk.c:444: if(regs.Bytes.A == 0) { - ld a,(#(_regs + 0x0001) + 0) - ld -4 (ix), a - or a, a - jp NZ,00107$ -;fdisk.c:445: availableDevicesCount++; - ld hl, #_availableDevicesCount+0 - inc (hl) -;fdisk.c:446: regs.Bytes.A = deviceIndex; - ld hl,#(_regs + 0x0001) - ld a,-5 (ix) - ld (hl),a -;fdisk.c:447: regs.Bytes.B = 2; - ld hl,#(_regs + 0x0003) - ld (hl),#0x02 -;fdisk.c:448: regs.Words.HL = (int)currentDeviceName; - ld a,-7 (ix) - ld -4 (ix),a - ld a,-6 (ix) - ld -3 (ix),a - ld hl,#(_regs + 0x0006) - ld a,-4 (ix) - ld (hl),a - inc hl - ld a,-3 (ix) - ld (hl),a -;fdisk.c:449: DriverCall(selectedDriver->slot, DEV_INFO); - ld hl,(_selectedDriver) - ld -4 (ix),l - ld -3 (ix),h - ld l,-4 (ix) - ld h,-3 (ix) - ld h,(hl) - ld bc,#0x4163 - push bc - push hl - inc sp - call _DriverCall - pop af - inc sp -;fdisk.c:451: if(regs.Bytes.A == 0) { - ld a, (#(_regs + 0x0001) + 0) - or a, a - jr NZ,00102$ -;fdisk.c:452: TerminateRightPaddedStringWithZero(currentDeviceName, MAX_INFO_LENGTH); - ld a,#0x40 - push af - inc sp - ld l,-7 (ix) - ld h,-6 (ix) - push hl - call _TerminateRightPaddedStringWithZero - pop af - inc sp - jr 00103$ -00102$: -;fdisk.c:454: sprintf(currentDeviceName, "(Unnamed device, ID=%i)", deviceIndex); - ld l,-5 (ix) - ld h,#0x00 - ld de,#__str_18 - push hl - push de - ld l,-7 (ix) - ld h,-6 (ix) - push hl - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl -00103$: -;fdisk.c:456: if(!is80ColumnsDisplay) { - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr NZ,00108$ -;fdisk.c:457: EnsureMaximumStringLength(currentDeviceName, MAX_LINLEN_MSX1 - 4); - ld hl,#0x0024 - ld c, l - ld b, h - pop hl - push hl - push bc - push hl - call _EnsureMaximumStringLength - pop af - pop af - jr 00108$ -00107$: -;fdisk.c:460: currentDevice->lunCount = 0; - ld l,-2 (ix) - ld h,-1 (ix) - ld (hl),#0x00 -00108$: -;fdisk.c:463: deviceIndex++; - inc -5 (ix) -;fdisk.c:464: currentDevice++; - ld a,-2 (ix) - add a, #0x41 - ld -2 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -1 (ix),a - jp 00109$ -00112$: - ld sp,ix - pop ix - ret -_GetDevicesInformation_end:: -__str_18: - .ascii "(Unnamed device, ID=%i)" - .db 0x00 -;fdisk.c:470: void EnsureMaximumStringLength(char* string, int maxLength) -; --------------------------------- -; Function EnsureMaximumStringLength -; --------------------------------- -_EnsureMaximumStringLength_start:: -_EnsureMaximumStringLength: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:472: int len = strlen(string); - ld l,4 (ix) - ld h,5 (ix) - push hl - call _strlen - pop af -;fdisk.c:473: if(len > maxLength) { - ld a,6 (ix) - sub a, l - ld a,7 (ix) - sbc a, h - jp PO, 00108$ - xor a, #0x80 -00108$: - jp P,00103$ -;fdisk.c:474: string += maxLength - 3; - ld a,6 (ix) - add a,#0xFD - ld h,a - ld a,7 (ix) - adc a,#0xFF - ld l,a - ld a,4 (ix) - add a, h - ld 4 (ix),a - ld a,5 (ix) - adc a, l - ld 5 (ix),a -;fdisk.c:475: *string++ = '.'; - ld l,4 (ix) - ld h,5 (ix) - ld (hl),#0x2E - inc hl - ld 4 (ix),l - ld 5 (ix),h -;fdisk.c:476: *string++ = '.'; - ld l,4 (ix) - ld h,5 (ix) - ld (hl),#0x2E - inc hl - ld 4 (ix),l - ld 5 (ix),h -;fdisk.c:477: *string++ = '.'; - ld l,4 (ix) - ld h,5 (ix) - ld (hl),#0x2E - inc hl - ld 4 (ix),l - ld 5 (ix),h -;fdisk.c:478: *string = '\0'; - ld l,4 (ix) - ld h,5 (ix) - ld (hl),#0x00 -00103$: - pop ix - ret -_EnsureMaximumStringLength_end:: -;fdisk.c:483: void GoLunSelectionScreen(byte deviceIndex) -; --------------------------------- -; Function GoLunSelectionScreen -; --------------------------------- -_GoLunSelectionScreen_start:: -_GoLunSelectionScreen: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:488: currentDevice = &devices[deviceIndex - 1]; - ld l,4 (ix) - dec l - ld c,l - ld b,#0x00 - ld l, c - ld h, b - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, hl - add hl, bc - ld de,#_devices - add hl,de - ld (_currentDevice),hl -;fdisk.c:489: selectedDeviceIndex = deviceIndex; - ld a,4 (ix) - ld (#_selectedDeviceIndex + 0),a -;fdisk.c:491: availableLunsCount = 0; - ld hl,#_availableLunsCount + 0 - ld (hl), #0x00 -;fdisk.c:493: while(true) { -00114$: -;fdisk.c:494: ShowLunSelectionScreen(); - call _ShowLunSelectionScreen -;fdisk.c:495: if(availableLunsCount == 0) { - ld a,(#_availableLunsCount + 0) - or a, a -;fdisk.c:496: return; -;fdisk.c:499: while(true) { - jr Z,00116$ -00111$: -;fdisk.c:500: key = WaitKey(); - call _WaitKey - ld c,l -;fdisk.c:501: if(key == ESC) { - ld a,c - sub a, #0x1B - jr Z,00116$ - jr 00108$ -;fdisk.c:502: return; - jr 00116$ -00108$: -;fdisk.c:504: key -= '0'; - ld a,c - add a,#0xD0 -;fdisk.c:505: if(key >= 1 && key <= MAX_LUNS_PER_DEVICE && luns[key - 1].suitableForPartitionning) { - ld c,a - sub a, #0x01 - jr C,00111$ - ld a,#0x07 - sub a, c - jr C,00111$ - ld h,c - dec h - ld e,h - ld d,#0x00 - ld l, e - ld h, d - add hl, hl - add hl, de - add hl, hl - add hl, hl - add hl, de - ld de,#_luns - add hl,de - ld de, #0x000C - add hl, de - ld a, (hl) - or a, a - jr Z,00111$ -;fdisk.c:506: InitializePartitionningVariables(key); - ld a,c - push af - inc sp - call _InitializePartitionningVariables - inc sp -;fdisk.c:507: GoPartitionningMainMenuScreen(); - call _GoPartitionningMainMenuScreen -;fdisk.c:508: break; - jr 00114$ -00116$: - pop ix - ret -_GoLunSelectionScreen_end:: -;fdisk.c:516: void InitializePartitionningVariables(byte lunIndex) -; --------------------------------- -; Function InitializePartitionningVariables -; --------------------------------- -_InitializePartitionningVariables_start:: -_InitializePartitionningVariables: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:518: selectedLunIndex = lunIndex - 1; - ld hl,#_selectedLunIndex - ld a,4 (ix) - add a,#0xFF - ld (hl),a -;fdisk.c:519: selectedLun = &luns[selectedLunIndex]; - ld bc,(_selectedLunIndex) - ld b,#0x00 - ld l, c - ld h, b - add hl, hl - add hl, bc - add hl, hl - add hl, hl - add hl, bc - ld de,#_luns - add hl,de - ld (_selectedLun),hl -;fdisk.c:520: partitionsCount = 0; - ld hl,#_partitionsCount + 0 - ld (hl), #0x00 - ld hl,#_partitionsCount + 1 - ld (hl), #0x00 -;fdisk.c:521: partitionsExistInDisk = true; - ld hl,#_partitionsExistInDisk + 0 - ld (hl), #0x01 -;fdisk.c:522: canCreatePartitions = (selectedLun->sectorCount >= (MIN_DEVICE_SIZE_FOR_PARTITIONS_IN_K * 2)); - ld de,(_selectedLun) - ld l, e - ld h, d - inc hl - inc hl - inc hl - inc hl - ld b,(hl) - inc hl - inc hl - ld a,(hl) - dec hl - ld h,(hl) - ld l,a - ld a,b - sub a, #0x08 - ld a,h - sbc a, #0x00 - ld a,l - sbc a, #0x00 - ld a,#0x00 - ccf - rla - ld (#_canCreatePartitions + 0),a -;fdisk.c:523: canDoDirectFormat = (selectedLun->sectorCount <= MAX_DEVICE_SIZE_FOR_DIRECT_FORMAT_IN_K * 2); - ld l, e - ld h, d - inc hl - inc hl - inc hl - ld c,(hl) - inc hl - ld b,(hl) - inc hl - inc hl - ld a,(hl) - dec hl - ld h,(hl) - ld l,a - xor a, a - cp a, c - sbc a, b - ld a,#0x01 - sbc a, h - ld a,#0x00 - sbc a, l - ld a,#0x00 - ccf - rla - ld (#_canDoDirectFormat + 0),a -;fdisk.c:524: unpartitionnedSpaceInSectors = selectedLun->sectorCount; - ex de,hl - inc hl - inc hl - inc hl - ld a,(hl) - ld iy,#_unpartitionnedSpaceInSectors - ld 0 (iy),a - inc hl - ld a,(hl) - ld iy,#_unpartitionnedSpaceInSectors - ld 1 (iy),a - inc hl - ld a,(hl) - ld iy,#_unpartitionnedSpaceInSectors - ld 2 (iy),a - inc hl - ld a,(hl) - ld (#_unpartitionnedSpaceInSectors + 3),a -;fdisk.c:525: RecalculateAutoPartitionSize(true); - ld a,#0x01 - push af - inc sp - call _RecalculateAutoPartitionSize - inc sp - pop ix - ret -_InitializePartitionningVariables_end:: -;fdisk.c:529: void ShowLunSelectionScreen() -; --------------------------------- -; Function ShowLunSelectionScreen -; --------------------------------- -_ShowLunSelectionScreen_start:: -_ShowLunSelectionScreen: - push ix - ld ix,#0 - add ix,sp - ld hl,#-5 - add hl,sp - ld sp,hl -;fdisk.c:534: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:535: Locate(0,3); - ld hl,#0x0300 - push hl - call _Locate -;fdisk.c:536: print(selectedDriverName); - ld hl, #_selectedDriverName - ex (sp),hl - call _print - pop af -;fdisk.c:537: print(currentDevice->deviceName); - ld hl,(_currentDevice) - inc hl - push hl - call _print - pop af -;fdisk.c:538: PrintDeviceInfoWithIndex(); - call _PrintDeviceInfoWithIndex -;fdisk.c:539: NewLine(); - ld hl,#__str_19 - push hl - call _print -;fdisk.c:540: NewLine(); - ld hl, #__str_19 - ex (sp),hl - call _print -;fdisk.c:541: NewLine(); - ld hl, #__str_19 - ex (sp),hl - call _print - pop af -;fdisk.c:543: if(availableLunsCount == 0) { - ld a,(#_availableLunsCount + 0) - or a, a - jr NZ,00102$ -;fdisk.c:544: GetLunsInformation(); - call _GetLunsInformation -00102$: -;fdisk.c:547: if(availableLunsCount == 0) { - ld a,(#_availableLunsCount + 0) - or a, a - jr NZ,00104$ -;fdisk.c:548: Locate(0, 9); - ld hl,#0x0900 - push hl - call _Locate -;fdisk.c:549: PrintCentered("There are no suitable logical units"); - ld hl, #__str_20 - ex (sp),hl - call _PrintCentered -;fdisk.c:550: CursorDown(); - ld h,#0x1F - ex (sp),hl - inc sp - call _putchar - inc sp -;fdisk.c:551: PrintCentered("available in the device"); - ld hl,#__str_21 - push hl - call _PrintCentered -;fdisk.c:552: PrintStateMessage("Press any key to go back..."); - ld hl, #__str_22 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:553: WaitKey(); - call _WaitKey -;fdisk.c:554: return; - jp 00110$ -00104$: -;fdisk.c:557: currentLun = &luns[0]; - ld -2 (ix),#<(_luns) - ld -1 (ix),#>(_luns) -;fdisk.c:558: for(i = 0; i < MAX_LUNS_PER_DEVICE; i++) { - ld -5 (ix),#0x00 -00108$: -;fdisk.c:559: if(currentLun->suitableForPartitionning) { - ld a,-2 (ix) - ld -4 (ix),a - ld a,-1 (ix) - ld -3 (ix),a - ld l,-4 (ix) - ld h,-3 (ix) - ld de, #0x000C - add hl, de - ld a,(hl) - or a, a - jr Z,00106$ -;fdisk.c:560: printf("\x1BK%i. Size: ", i + 1); - ld l,-5 (ix) - ld h,#0x00 - inc hl - ld de,#__str_23 - push hl - push de - call _printf - pop af - pop af -;fdisk.c:561: PrintSize(currentLun->sectorCount / 2); - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - srl b - rr c - rr d - rr e - push bc - push de - call _PrintSize - pop af -;fdisk.c:562: NewLine(); - ld hl, #__str_19 - ex (sp),hl - call _print - pop af -00106$: -;fdisk.c:565: i++; - inc -5 (ix) -;fdisk.c:566: currentLun++; - ld a,-2 (ix) - add a, #0x0D - ld -2 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -1 (ix),a -;fdisk.c:558: for(i = 0; i < MAX_LUNS_PER_DEVICE; i++) { - inc -5 (ix) - ld a,-5 (ix) - sub a, #0x07 - jr C,00108$ -;fdisk.c:569: NewLine(); - ld hl,#__str_19 - push hl - call _print -;fdisk.c:570: NewLine(); - ld hl, #__str_19 - ex (sp),hl - call _print -;fdisk.c:571: print("ESC. Go back to device selection screen"); - ld hl, #__str_24 - ex (sp),hl - call _print -;fdisk.c:573: PrintStateMessage("Select the logical unit"); - ld hl, #__str_25 - ex (sp),hl - call _PrintStateMessage - pop af -00110$: - ld sp,ix - pop ix - ret -_ShowLunSelectionScreen_end:: -__str_19: - .db 0x0A - .db 0x0D - .db 0x00 -__str_20: - .ascii "There are no suitable logical units" - .db 0x00 -__str_21: - .ascii "available in the device" - .db 0x00 -__str_22: - .ascii "Press any key to go back..." - .db 0x00 -__str_23: - .db 0x1B - .ascii "K%i. Size: " - .db 0x00 -__str_24: - .ascii "ESC. Go back to device selection screen" - .db 0x00 -__str_25: - .ascii "Select the logical unit" - .db 0x00 -;fdisk.c:577: void PrintSize(ulong sizeInK) -; --------------------------------- -; Function PrintSize -; --------------------------------- -_PrintSize_start:: -_PrintSize: - push ix - ld ix,#0 - add ix,sp - ld hl,#-11 - add hl,sp - ld sp,hl -;fdisk.c:584: if(sizeInK < (ulong)(10 * 1024)) { - ld a,5 (ix) - sub a, #0x28 - ld a,6 (ix) - sbc a, #0x00 - ld a,7 (ix) - sbc a, #0x00 - jr NC,00102$ -;fdisk.c:585: printf("%iK", sizeInK); - ld l,6 (ix) - ld h,7 (ix) - push hl - ld l,4 (ix) - ld h,5 (ix) - push hl - ld hl,#__str_26 - push hl - call _printf - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk.c:586: return; - jp 00106$ -00102$: -;fdisk.c:589: dividedSize = sizeInK >> 10; - push af - ld l,4 (ix) - ld h,5 (ix) - ld c,6 (ix) - ld d,7 (ix) - pop af - ld b,#0x0A -00114$: - srl d - rr c - rr h - rr l - djnz 00114$ - ld -11 (ix),l - ld -10 (ix),h - ld -9 (ix),c - ld -8 (ix),d -;fdisk.c:590: if(dividedSize < (ulong)(10 * 1024)) { - ld a,-10 (ix) - sub a, #0x28 - ld a,-9 (ix) - sbc a, #0x00 - ld a,-8 (ix) - sbc a, #0x00 - jr NC,00104$ -;fdisk.c:591: printf("%i", dividedSize + GetRemainingBy1024String(sizeInK, buf)); - ld hl,#0x0004 - add hl,sp - ld e,l - ld d,h - push de - push hl - ld l,6 (ix) - ld h,7 (ix) - push hl - ld l,4 (ix) - ld h,5 (ix) - push hl - call _GetRemainingBy1024String - pop af - pop af - pop af - pop de - ld h,#0x00 - ld bc,#0x0000 - ld a,-11 (ix) - add a, l - ld -4 (ix),a - ld a,-10 (ix) - adc a, h - ld -3 (ix),a - ld a,-9 (ix) - adc a, c - ld -2 (ix),a - ld a,-8 (ix) - adc a, b - ld -1 (ix),a - ld bc,#__str_27 - push de - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld l,-4 (ix) - ld h,-3 (ix) - push hl - push bc - call _printf - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk.c:592: printf("%sM", buf); - pop hl - ld de,#__str_28 - push hl - push de - call _printf - pop af - pop af - jp 00106$ -00104$: -;fdisk.c:594: sizeInK >>= 10; - ld 4 (ix),l - ld 5 (ix),h - ld 6 (ix),c - ld 7 (ix),d -;fdisk.c:595: dividedSize = sizeInK >> 10; - push af - ld a,4 (ix) - ld -11 (ix),a - ld a,5 (ix) - ld -10 (ix),a - ld a,6 (ix) - ld -9 (ix),a - ld a,7 (ix) - ld -8 (ix),a - pop af - ld b,#0x0A -00116$: - srl -8 (ix) - rr -9 (ix) - rr -10 (ix) - rr -11 (ix) - djnz 00116$ -;fdisk.c:596: printf("%i", dividedSize + GetRemainingBy1024String(sizeInK, buf)); - ld hl,#0x0004 - add hl,sp - ld -4 (ix),l - ld -3 (ix),h - ld l,-4 (ix) - ld h,-3 (ix) - push hl - ld l,6 (ix) - ld h,7 (ix) - push hl - ld l,4 (ix) - ld h,5 (ix) - push hl - call _GetRemainingBy1024String - pop af - pop af - pop af - ld h,#0x00 - ld de,#0x0000 - ld a,-11 (ix) - add a, l - ld c,a - ld a,-10 (ix) - adc a, h - ld b,a - ld a,-9 (ix) - adc a, e - ld l,a - ld a,-8 (ix) - adc a, d - ld h,a - ld de,#__str_27 - push hl - push bc - push de - call _printf - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk.c:597: printf("%sG", buf); - ld l,-4 (ix) - ld h,-3 (ix) - ld de,#__str_29 - push hl - push de - call _printf - pop af - pop af -00106$: - ld sp,ix - pop ix - ret -_PrintSize_end:: -__str_26: - .ascii "%iK" - .db 0x00 -__str_27: - .ascii "%i" - .db 0x00 -__str_28: - .ascii "%sM" - .db 0x00 -__str_29: - .ascii "%sG" - .db 0x00 -;fdisk.c:602: byte GetRemainingBy1024String(ulong value, char* destination) -; --------------------------------- -; Function GetRemainingBy1024String -; --------------------------------- -_GetRemainingBy1024String_start:: -_GetRemainingBy1024String: - push ix - ld ix,#0 - add ix,sp - push af -;fdisk.c:607: int remaining = value & 0x3FF; - ld h,4 (ix) - ld a,5 (ix) - and a, #0x03 - ld -2 (ix), h - ld -1 (ix), a -;fdisk.c:609: *destination = '\0'; - ld c,8 (ix) - ld b,9 (ix) -;fdisk.c:608: if(remaining >= 950) { - ld a,-2 (ix) - sub a, #0xB6 - ld a,-1 (ix) - rla - ccf - rra - sbc a, #0x83 - jr C,00102$ -;fdisk.c:609: *destination = '\0'; - xor a, a - ld (bc),a -;fdisk.c:610: return 1; - ld l,#0x01 - jr 00108$ -00102$: -;fdisk.c:612: remaining2 = remaining % 100; - push bc - ld hl,#0x0064 - push hl - ld l,-2 (ix) - ld h,-1 (ix) - push hl - call __modsint_rrx_s - pop af - pop af - pop bc - ld e,l -;fdisk.c:613: remainingDigit = (remaining / 100) + '0'; - push bc - push de - ld hl,#0x0064 - push hl - ld l,-2 (ix) - ld h,-1 (ix) - push hl - call __divsint_rrx_s - pop af - pop af - pop de - pop bc - ld a,l - add a, #0x30 - ld d,a -;fdisk.c:614: if(remaining2 >= 50) { - ld a,e - sub a, #0x32 - jr C,00104$ -;fdisk.c:615: remainingDigit++; - inc d -00104$: -;fdisk.c:618: if(remainingDigit == '0') { - ld a,d - sub a, #0x30 - jr NZ,00106$ -;fdisk.c:619: *destination = '\0'; - xor a, a - ld (bc),a - jr 00107$ -00106$: -;fdisk.c:621: destination[0] = '.'; - ld a,#0x2E - ld (bc),a -;fdisk.c:622: destination[1] = remainingDigit; - ld l, c - ld h, b - inc hl - ld (hl),d -;fdisk.c:623: destination[2] = '\0'; - ld l,c - ld h,b - inc hl - inc hl - ld (hl),#0x00 -00107$: -;fdisk.c:626: return 0; - ld l,#0x00 -00108$: - ld sp,ix - pop ix - ret -_GetRemainingBy1024String_end:: -;fdisk.c:630: void GetLunsInformation() -; --------------------------------- -; Function GetLunsInformation -; --------------------------------- -_GetLunsInformation_start:: -_GetLunsInformation: - push ix - ld ix,#0 - add ix,sp - ld hl,#-6 - add hl,sp - ld sp,hl -;fdisk.c:634: lunInfo* currentLun = &luns[0]; - ld -2 (ix),#<(_luns) - ld -1 (ix),#>(_luns) -;fdisk.c:637: while(lunIndex <= MAX_LUNS_PER_DEVICE) { - ld -6 (ix),#0x01 -00106$: - ld a,#0x07 - sub a, -6 (ix) - jp C,00109$ -;fdisk.c:638: regs.Bytes.A = selectedDeviceIndex; - ld hl,#(_regs + 0x0001) - ld a,(#_selectedDeviceIndex + 0) - ld (hl),a -;fdisk.c:639: regs.Bytes.B = lunIndex; - ld hl,#_regs + 3 - ld a,-6 (ix) - ld (hl),a -;fdisk.c:640: regs.Words.HL = (int)currentLun; - ld e,-2 (ix) - ld d,-1 (ix) - ld ((_regs + 0x0006)), de -;fdisk.c:641: DriverCall(selectedDriver->slot, LUN_INFO); - ld hl,(_selectedDriver) - ld h,(hl) - ld bc,#0x4169 - push bc - push hl - inc sp - call _DriverCall - pop af - inc sp -;fdisk.c:647: currentLun->suitableForPartitionning = - ld a,-2 (ix) - add a, #0x0C - ld c,a - ld a,-1 (ix) - adc a, #0x00 - ld b,a -;fdisk.c:648: (regs.Bytes.A == 0) && - ld a, (#_regs + 1) - or a, a - jr NZ,00111$ -;fdisk.c:649: (currentLun->mediumType == BLOCK_DEVICE) && - ld l,-2 (ix) - ld h,-1 (ix) - ld a,(hl) - or a, a - jr NZ,00111$ -;fdisk.c:650: (currentLun->sectorSize == 512) && - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - ld d,(hl) - inc hl - ld h,(hl) - ld a,d - or a, a - jr NZ,00111$ - ld a,h - sub a, #0x02 - jr NZ,00111$ -;fdisk.c:651: (currentLun->sectorCount >= MIN_DEVICE_SIZE_IN_K * 2) && - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - inc hl - ld a,(hl) - dec hl - ld h,(hl) - ld l,a - ld a,e - sub a, #0x14 - ld a,d - sbc a, #0x00 - ld a,h - sbc a, #0x00 - ld a,l - sbc a, #0x00 - ld a,#0x00 - ccf - rla - or a, a - jr Z,00111$ -;fdisk.c:652: ((currentLun->flags & (READ_ONLY_LUN | FLOPPY_DISK_LUN)) == 0); - ld l,-2 (ix) - ld h,-1 (ix) - ld de, #0x0007 - add hl, de - ld a,(hl) - and a,#0x06 - jr Z,00112$ -00111$: - ld a,#0x00 - jr 00113$ -00112$: - ld a,#0x01 -00113$: - ld (bc),a -;fdisk.c:653: if(currentLun->suitableForPartitionning) { - ld l,-2 (ix) - ld h,-1 (ix) - ld de, #0x000C - add hl, de - ld a,(hl) - or a, a - jr Z,00102$ -;fdisk.c:654: availableLunsCount++; - ld hl, #_availableLunsCount+0 - inc (hl) -00102$: -;fdisk.c:657: if(currentLun->sectorsPerTrack == 0 || currentLun->sectorsPerTrack > EXTRA_PARTITION_SECTORS) { - ld c,-2 (ix) - ld b,-1 (ix) - push bc - pop iy - ld a,11 (iy) - ld -3 (ix), a - or a, a - jr Z,00103$ - ld a,#0x01 - sub a, -3 (ix) - jr NC,00104$ -00103$: -;fdisk.c:658: currentLun->sectorsPerTrack = EXTRA_PARTITION_SECTORS; - ld a,-2 (ix) - add a, #0x0B - ld -5 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -4 (ix),a - ld l,-5 (ix) - ld h,-4 (ix) - ld (hl),#0x01 -00104$: -;fdisk.c:661: lunIndex++; - inc -6 (ix) -;fdisk.c:662: currentLun++; - ld a,-2 (ix) - add a, #0x0D - ld -2 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -1 (ix),a - jp 00106$ -00109$: - ld sp,ix - pop ix - ret -_GetLunsInformation_end:: -;fdisk.c:667: void PrintDeviceInfoWithIndex() -; --------------------------------- -; Function PrintDeviceInfoWithIndex -; --------------------------------- -_PrintDeviceInfoWithIndex_start:: -_PrintDeviceInfoWithIndex: -;fdisk.c:669: printf(is80ColumnsDisplay ? " (Id = %i)" : " (%i)", selectedDeviceIndex); - ld hl,#_selectedDeviceIndex + 0 - ld c, (hl) - ld b,#0x00 - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr Z,00103$ - ld hl,#__str_30 - jr 00104$ -00103$: - ld hl,#__str_31 -00104$: - push bc - push hl - call _printf - pop af - pop af - ret -_PrintDeviceInfoWithIndex_end:: -__str_30: - .ascii " (Id = %i)" - .db 0x00 -__str_31: - .ascii " (%i)" - .db 0x00 -;fdisk.c:673: void PrintTargetInfo() -; --------------------------------- -; Function PrintTargetInfo -; --------------------------------- -_PrintTargetInfo_start:: -_PrintTargetInfo: -;fdisk.c:675: Locate(0,3); - ld hl,#0x0300 - push hl - call _Locate -;fdisk.c:676: print(selectedDriverName); - ld hl, #_selectedDriverName - ex (sp),hl - call _print - pop af -;fdisk.c:677: print(currentDevice->deviceName); - ld hl,(_currentDevice) - inc hl - push hl - call _print - pop af -;fdisk.c:678: PrintDeviceInfoWithIndex(); - call _PrintDeviceInfoWithIndex -;fdisk.c:679: NewLine(); - ld hl,#__str_32 - push hl - call _print - pop af -;fdisk.c:680: printf("Logical unit %i, size: ", selectedLunIndex + 1); - ld hl,#_selectedLunIndex + 0 - ld e, (hl) - ld d,#0x00 - inc de - ld hl,#__str_33 - push de - push hl - call _printf - pop af - pop af -;fdisk.c:681: PrintSize(selectedLun->sectorCount / 2); - ld hl,(_selectedLun) - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - srl b - rr c - rr d - rr e - push bc - push de - call _PrintSize - pop af -;fdisk.c:682: NewLine(); - ld hl, #__str_32 - ex (sp),hl - call _print - pop af - ret -_PrintTargetInfo_end:: -__str_32: - .db 0x0A - .db 0x0D - .db 0x00 -__str_33: - .ascii "Logical unit %i, size: " - .db 0x00 -;fdisk.c:686: void GoPartitionningMainMenuScreen() -; --------------------------------- -; Function GoPartitionningMainMenuScreen -; --------------------------------- -_GoPartitionningMainMenuScreen_start:: -_GoPartitionningMainMenuScreen: - push ix - ld ix,#0 - add ix,sp - push af - dec sp -;fdisk.c:691: bool mustRetrievePartitionInfo = true; - ld -3 (ix),#0x01 -;fdisk.c:693: while(true) { -00174$: -;fdisk.c:694: if(mustRetrievePartitionInfo) { - ld a,-3 (ix) - or a, a - jr Z,00108$ -;fdisk.c:695: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:696: PrintTargetInfo(); - call _PrintTargetInfo -;fdisk.c:698: if(canCreatePartitions) { - ld a,(#_canCreatePartitions + 0) - or a, a - jr Z,00106$ -;fdisk.c:699: Locate(0, MESSAGE_ROW); - ld hl,#0x0900 - push hl - call _Locate -;fdisk.c:700: PrintCentered("Searching partitions..."); - ld hl, #__str_34 - ex (sp),hl - call _PrintCentered -;fdisk.c:701: PrintStateMessage("Please wait..."); - ld hl, #__str_35 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:702: error = GetDiskPartitionsInfo(); - call _GetDiskPartitionsInfo - ld h,l -;fdisk.c:703: if(error != 0) { - ld a,h - or a, a - jr Z,00104$ -;fdisk.c:704: PrintDosErrorMessage(error, "Error when searching partitions:"); - ld de,#__str_36 - push de - push hl - inc sp - call _PrintDosErrorMessage -;fdisk.c:705: PrintStateMessage("Manage device anyway? (y/n) "); - inc sp - ld hl,#__str_37 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:706: if(!GetYesOrNo()) { - call _GetYesOrNo - ld a,l - or a, a -;fdisk.c:707: return; - jp Z,00176$ -00104$: -;fdisk.c:710: partitionsExistInDisk = (partitionsCount > 0); - ld hl,#_partitionsExistInDisk - xor a, a - ld iy,#_partitionsCount - cp a, 0 (iy) - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00318$ - xor a, #0x80 -00318$: - rlca - and a,#0x01 - ld (hl),a -00106$: -;fdisk.c:712: mustRetrievePartitionInfo = false; - ld -3 (ix),#0x00 -00108$: -;fdisk.c:715: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:716: PrintTargetInfo(); - call _PrintTargetInfo -;fdisk.c:717: if(!partitionsExistInDisk) { - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr NZ,00110$ -;fdisk.c:718: print("Unpartitionned space available: "); - ld hl,#__str_38 - push hl - call _print - pop af -;fdisk.c:719: PrintSize(unpartitionnedSpaceInSectors / 2); - push af - ld iy,#_unpartitionnedSpaceInSectors - ld l,0 (iy) - ld iy,#_unpartitionnedSpaceInSectors - ld h,1 (iy) - ld iy,#_unpartitionnedSpaceInSectors - ld e,2 (iy) - ld iy,#_unpartitionnedSpaceInSectors - ld d,3 (iy) - pop af - srl d - rr e - rr h - rr l - push de - push hl - call _PrintSize - pop af -;fdisk.c:720: NewLine(); - ld hl, #__str_39 - ex (sp),hl - call _print - pop af -00110$: -;fdisk.c:722: NewLine(); - ld hl,#__str_39 - push hl - call _print - pop af -;fdisk.c:725: "\r\n", is80ColumnsDisplay ? " " : "\r\n"); - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr Z,00178$ - ld de,#__str_41 - jr 00179$ -00178$: - ld de,#__str_42 -00179$: - ld hl,#__str_40 - push de - push hl - call _printf - pop af - pop af -;fdisk.c:727: if(partitionsCount > 0) { - xor a, a - ld iy,#_partitionsCount - cp a, 0 (iy) - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00321$ - xor a, #0x80 -00321$: - jp P,00114$ -;fdisk.c:731: partitionsExistInDisk ? "found" : "defined"); - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr Z,00180$ - ld hl,#__str_44 - jr 00181$ -00180$: - ld hl,#__str_45 -00181$: -;fdisk.c:729: "D. Delete all partitions\r\n", - ld de,#__str_43 - push hl - ld hl,(_partitionsCount) - push hl - push de - call _printf - ld hl,#0x0006 - add hl,sp - ld sp,hl - jr 00115$ -00114$: -;fdisk.c:732: } else if(canCreatePartitions) { - ld a,(#_canCreatePartitions + 0) - or a, a - jr Z,00115$ -;fdisk.c:733: print("(No partitions found or defined)\r\n"); - ld hl,#__str_46 - push hl - call _print - pop af -00115$: -;fdisk.c:736: !partitionsExistInDisk && - ld a,(#_partitionsExistInDisk + 0) - sub a,#0x01 - ld a,#0x00 - rla - ld d,a - or a, a - jr Z,00182$ -;fdisk.c:737: canCreatePartitions && - ld a,(#_canCreatePartitions + 0) - or a, a - jr Z,00182$ -;fdisk.c:738: unpartitionnedSpaceInSectors >= (MIN_REMAINING_SIZE_FOR_NEW_PARTITIONS_IN_K * 2) + (EXTRA_PARTITION_SECTORS) && - ld a,(#_unpartitionnedSpaceInSectors + 0) - sub a, #0xC9 - ld a,(#_unpartitionnedSpaceInSectors + 1) - sbc a, #0x00 - ld a,(#_unpartitionnedSpaceInSectors + 2) - sbc a, #0x00 - ld a,(#_unpartitionnedSpaceInSectors + 3) - sbc a, #0x00 - ld a,#0x00 - ccf - rla - ld d,a - or a, a - jr Z,00182$ -;fdisk.c:739: partitionsCount < MAX_PARTITIONS_TO_HANDLE; - ld a,(#_partitionsCount + 1) - xor a, #0x80 - sub a, #0x81 - jr C,00183$ -00182$: - ld a,#0x00 - jr 00184$ -00183$: - ld a,#0x01 -00184$: -;fdisk.c:740: if(canAddPartitionsNow) { - ld -2 (ix), a - or a, a - jr Z,00117$ -;fdisk.c:741: print("A. Add one "); - ld hl,#__str_47 - push hl - call _print - pop af -;fdisk.c:742: PrintSize(autoPartitionSizeInK); - ld hl,(_autoPartitionSizeInK + 2) - push hl - ld hl,(_autoPartitionSizeInK) - push hl - call _PrintSize - pop af -;fdisk.c:743: print(" partition\r\n"); - ld hl, #__str_48 - ex (sp),hl - call _print -;fdisk.c:744: print("P. Add partition...\r\n"); - ld hl, #__str_49 - ex (sp),hl - call _print - pop af -00117$: -;fdisk.c:746: if(!partitionsExistInDisk && partitionsCount > 0) { - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr NZ,00119$ - xor a, a - ld iy,#_partitionsCount - cp a, 0 (iy) - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00322$ - xor a, #0x80 -00322$: - jp P,00119$ -;fdisk.c:747: print("U. Undo add "); - ld hl,#__str_50 - push hl - call _print - pop af -;fdisk.c:748: PrintSize(partitions[partitionsCount - 1].sizeInK); - ld hl,#_partitionsCount + 0 - ld e, (hl) - ld hl,#_partitionsCount + 1 - ld d, (hl) - dec de - ld l, e - ld h, d - add hl, hl - add hl, hl - add hl, hl - add hl, de - ld de,#_partitions - add hl,de - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - push bc - push de - call _PrintSize - pop af -;fdisk.c:749: print(" partition\r\n"); - ld hl, #__str_48 - ex (sp),hl - call _print - pop af -00119$: -;fdisk.c:751: NewLine(); - ld hl,#__str_39 - push hl - call _print - pop af -;fdisk.c:752: if(canDoDirectFormat) { - ld a,(#_canDoDirectFormat + 0) - or a, a - jr Z,00122$ -;fdisk.c:753: print("F. Format device without partitions\r\n\r\n"); - ld hl,#__str_51 - push hl - call _print - pop af -00122$: -;fdisk.c:755: if(!partitionsExistInDisk && partitionsCount > 0) { - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr NZ,00124$ - xor a, a - ld iy,#_partitionsCount - cp a, 0 (iy) - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00323$ - xor a, #0x80 -00323$: - jp P,00124$ -;fdisk.c:756: print("W. Write partitions to disk\r\n\r\n"); - ld hl,#__str_52 - push hl - call _print - pop af -00124$: -;fdisk.c:758: print("T. Test device access\r\n"); - ld hl,#__str_53 - push hl - call _print -;fdisk.c:760: PrintStateMessage("Select an option or press ESC to return"); - ld hl, #__str_54 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:762: while((key = WaitKey()) == 0); -00126$: - call _WaitKey - ld a,l - ld -1 (ix),a - or a, a - jr Z,00126$ -;fdisk.c:763: if(key == ESC) { - ld a,-1 (ix) - sub a, #0x1B - jr NZ,00136$ -;fdisk.c:764: if(partitionsExistInDisk || partitionsCount == 0) { - ld a,(#_partitionsExistInDisk + 0) - or a, a - jp NZ,00176$ - ld a,(#_partitionsCount + 1) - ld hl,#_partitionsCount + 0 - or a,(hl) -;fdisk.c:765: return; - jp Z,00176$ -;fdisk.c:767: PrintStateMessage("Discard changes and return? (y/n) "); - ld hl,#__str_55 - push hl - call _PrintStateMessage - pop af -;fdisk.c:768: if(GetYesOrNo()) { - call _GetYesOrNo - ld a,l - or a, a - jp Z,00174$ -;fdisk.c:769: return; - jp 00176$ -;fdisk.c:771: continue; -00136$: -;fdisk.c:774: key |= 32; - set 5, -1 (ix) - ld a, -1 (ix) -;fdisk.c:710: partitionsExistInDisk = (partitionsCount > 0); - xor a, a - ld iy,#_partitionsCount - cp a, 0 (iy) - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00326$ - xor a, #0x80 -00326$: - rlca - and a,#0x01 - ld d,a -;fdisk.c:775: if(key == 's' && partitionsCount > 0) { - ld a,-1 (ix) - sub a,#0x73 - jr NZ,00170$ - or a,d - jr Z,00170$ -;fdisk.c:776: ShowPartitions(); - call _ShowPartitions - jp 00174$ -00170$: -;fdisk.c:777: } else if(key == 'd' && partitionsCount > 0) { - ld a,-1 (ix) - sub a,#0x64 - jr NZ,00166$ - or a,d - jr Z,00166$ -;fdisk.c:778: DeleteAllPartitions(); - call _DeleteAllPartitions - jp 00174$ -00166$: -;fdisk.c:779: } else if(key == 'p' && canAddPartitionsNow > 0) { - ld a,-1 (ix) - sub a, #0x70 - jr NZ,00162$ - ld a,-2 (ix) - or a, a - jr Z,00162$ -;fdisk.c:780: AddPartition(); - call _AddPartition - jp 00174$ -00162$: -;fdisk.c:781: } else if(key == 'a' && canAddPartitionsNow > 0) { - ld a,-1 (ix) - sub a, #0x61 - jr NZ,00158$ - ld a,-2 (ix) - or a, a - jr Z,00158$ -;fdisk.c:782: AddAutoPartition(); - call _AddAutoPartition - jp 00174$ -00158$: -;fdisk.c:783: } else if(key == 'u' && !partitionsExistInDisk && partitionsCount > 0) { - ld a,-1 (ix) - sub a, #0x75 - jr NZ,00153$ - ld a,(#_partitionsExistInDisk + 0) - or a,a - jr NZ,00153$ - or a,d - jr Z,00153$ -;fdisk.c:784: UndoAddPartition(); - call _UndoAddPartition - jp 00174$ -00153$: -;fdisk.c:785: }else if(key == 't') { - ld a,-1 (ix) - sub a, #0x74 - jr NZ,00150$ -;fdisk.c:786: TestDeviceAccess(); - call _TestDeviceAccess - jp 00174$ -00150$: -;fdisk.c:787: } else if(key == 'f' && canDoDirectFormat) { - ld a,-1 (ix) - sub a, #0x66 - jr NZ,00146$ - ld a,(#_canDoDirectFormat + 0) - or a, a - jr Z,00146$ -;fdisk.c:788: if(FormatWithoutPartitions()) { - call _FormatWithoutPartitions - ld a,l - or a, a - jp Z,00174$ -;fdisk.c:789: mustRetrievePartitionInfo = true; - ld -3 (ix),#0x01 - jp 00174$ -00146$: -;fdisk.c:791: }else if(key == 'w' && !partitionsExistInDisk && partitionsCount > 0) { - ld a,-1 (ix) - sub a, #0x77 - jp NZ,00174$ - ld a,(#_partitionsExistInDisk + 0) - or a,a - jp NZ,00174$ - or a,d - jp Z,00174$ -;fdisk.c:792: if(WritePartitionTable()) { - call _WritePartitionTable - ld a,l - or a, a - jp Z,00174$ -;fdisk.c:793: mustRetrievePartitionInfo = true; - ld -3 (ix),#0x01 - jp 00174$ -00176$: - ld sp,ix - pop ix - ret -_GoPartitionningMainMenuScreen_end:: -__str_34: - .ascii "Searching partitions..." - .db 0x00 -__str_35: - .ascii "Please wait..." - .db 0x00 -__str_36: - .ascii "Error when searching partitions:" - .db 0x00 -__str_37: - .ascii "Manage device anyway? (y/n) " - .db 0x00 -__str_38: - .ascii "Unpartitionned space available: " - .db 0x00 -__str_39: - .db 0x0A - .db 0x0D - .db 0x00 -__str_40: - .ascii "Changes are not committed%suntil W is pressed." - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x00 -__str_41: - .ascii " " - .db 0x00 -__str_42: - .db 0x0D - .db 0x0A - .db 0x00 -__str_43: - .ascii "S. Show partitions (%i %s)" - .db 0x0D - .db 0x0A - .ascii "D. Delete all partitions" - .db 0x0D - .db 0x0A - .db 0x00 -__str_44: - .ascii "found" - .db 0x00 -__str_45: - .ascii "defined" - .db 0x00 -__str_46: - .ascii "(No partitions found or defined)" - .db 0x0D - .db 0x0A - .db 0x00 -__str_47: - .ascii "A. Add one " - .db 0x00 -__str_48: - .ascii " partition" - .db 0x0D - .db 0x0A - .db 0x00 -__str_49: - .ascii "P. Add partition..." - .db 0x0D - .db 0x0A - .db 0x00 -__str_50: - .ascii "U. Undo add " - .db 0x00 -__str_51: - .ascii "F. Format device without partitions" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x00 -__str_52: - .ascii "W. Write partitions to disk" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x00 -__str_53: - .ascii "T. Test device access" - .db 0x0D - .db 0x0A - .db 0x00 -__str_54: - .ascii "Select an option or press ESC to return" - .db 0x00 -__str_55: - .ascii "Discard changes and return? (y/n) " - .db 0x00 -;fdisk.c:800: bool GetYesOrNo() -; --------------------------------- -; Function GetYesOrNo -; --------------------------------- -_GetYesOrNo_start:: -_GetYesOrNo: -;fdisk.c:804: DisplayCursor(); - ld hl,#__str_56 - push hl - call _print - pop af -;fdisk.c:805: key = WaitKey() | 32; - call _WaitKey - ld a,l - set 5, a - ld h,a -;fdisk.c:806: HideCursor(); - ld de,#__str_57 - push hl - push de - call _print - pop af - pop hl -;fdisk.c:807: return key == 'y'; - ld a,h - sub a, #0x79 - jr NZ,00103$ - ld a,#0x01 - jr 00104$ -00103$: - xor a,a -00104$: - ld l,a - ret -_GetYesOrNo_end:: -__str_56: - .db 0x1B - .ascii "y5" - .db 0x00 -__str_57: - .db 0x1B - .ascii "x5" - .db 0x00 -;fdisk.c:811: byte GetDiskPartitionsInfo() -; --------------------------------- -; Function GetDiskPartitionsInfo -; --------------------------------- -_GetDiskPartitionsInfo_start:: -_GetDiskPartitionsInfo: - push ix - ld ix,#0 - add ix,sp - ld hl,#-6 - add hl,sp - ld sp,hl -;fdisk.c:814: byte extendedIndex = 0; - ld -6 (ix),#0x00 -;fdisk.c:817: partitionInfo* currentPartition = &partitions[0]; - ld -2 (ix),#<(_partitions) - ld -1 (ix),#>(_partitions) -;fdisk.c:830: partitionsCount = 0; - ld hl,#_partitionsCount + 0 - ld (hl), #0x00 - ld hl,#_partitionsCount + 1 - ld (hl), #0x00 -;fdisk.c:832: do { - ld -5 (ix),#0x01 -00111$: -;fdisk.c:833: regs.Bytes.A = selectedDriver->slot; - ld hl,(_selectedDriver) - ld a,(hl) - ld (#(_regs + 0x0001)),a -;fdisk.c:834: regs.Bytes.B = 0xFF; - ld hl,#(_regs + 0x0003) - ld (hl),#0xFF -;fdisk.c:835: regs.Bytes.D = selectedDeviceIndex; - ld hl,#_regs + 5 - ld a,(#_selectedDeviceIndex + 0) - ld (hl),a -;fdisk.c:836: regs.Bytes.E = selectedLunIndex + 1; - ld a,(#_selectedLunIndex + 0) - inc a - ld (#(_regs + 0x0004)),a -;fdisk.c:837: regs.Bytes.H = primaryIndex; - ld hl,#_regs + 7 - ld a,-5 (ix) - ld (hl),a -;fdisk.c:838: regs.Bytes.L = extendedIndex; - ld hl,#_regs + 6 - ld a,-6 (ix) - ld (hl),a -;fdisk.c:839: DosCall(_GPART, REGS_ALL); - ld hl,#0x037A - push hl - call _DosCall - pop af -;fdisk.c:840: error = regs.Bytes.A; - ld hl, #(_regs + 0x0001) + 0 - ld l,(hl) -;fdisk.c:841: if(error == 0) { - ld a,l - or a, a - jp NZ,00108$ -;fdisk.c:842: if(regs.Bytes.B == PARTYPE_EXTENDED) { - ld a, (#(_regs + 0x0003) + 0) - sub a, #0x05 - jr NZ,00102$ -;fdisk.c:843: extendedIndex = 1; - ld -6 (ix),#0x01 - jp 00112$ -00102$: -;fdisk.c:845: currentPartition->primaryIndex = primaryIndex; - ld l,-2 (ix) - ld h,-1 (ix) - ld a,-5 (ix) - ld (hl),a -;fdisk.c:846: currentPartition->extendedIndex = extendedIndex; - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - ld a,-6 (ix) - ld (hl),a -;fdisk.c:847: currentPartition->partitionType = regs.Bytes.B; - ld e,-2 (ix) - ld d,-1 (ix) - inc de - inc de - ld a, (#(_regs + 0x0003) + 0) - ld (de),a -;fdisk.c:848: ((uint*)&(currentPartition->sizeInK))[0] = regs.UWords.IY; - ld a,-2 (ix) - add a, #0x03 - ld -4 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -3 (ix),a - pop bc - pop de - push de - push bc - ld bc, (#_regs + 10) - ld a,c - ld (de),a - inc de - ld a,b - ld (de),a -;fdisk.c:849: ((uint*)&(currentPartition->sizeInK))[1] = regs.UWords.IX; - pop bc - pop de - push de - push bc - inc de - inc de - ld bc, (#_regs + 8) - ld a,c - ld (de),a - inc de - ld a,b - ld (de),a -;fdisk.c:850: currentPartition->sizeInK /= 2; - ld l,-4 (ix) - ld h,-3 (ix) - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - srl b - rr c - rr d - rr e - ld l,-4 (ix) - ld h,-3 (ix) - ld (hl),e - inc hl - ld (hl),d - inc hl - ld (hl),c - inc hl - ld (hl),b -;fdisk.c:851: partitionsCount++; - ld hl, #_partitionsCount+0 - inc (hl) - jr NZ,00135$ - ld hl, #_partitionsCount+1 - inc (hl) -00135$: -;fdisk.c:852: currentPartition++; - ld a,-2 (ix) - add a, #0x09 - ld -2 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -1 (ix),a -;fdisk.c:853: extendedIndex++; - inc -6 (ix) - jr 00112$ -00108$: -;fdisk.c:855: } else if(error == _IPART) { - ld a,l - sub a, #0xB4 - jr NZ,00114$ -;fdisk.c:856: primaryIndex++; - inc -5 (ix) -;fdisk.c:857: extendedIndex = 0; - ld -6 (ix),#0x00 - jr 00112$ -;fdisk.c:859: return error; - jr 00114$ -00112$: -;fdisk.c:861: } while(primaryIndex <= 4 && partitionsCount < MAX_PARTITIONS_TO_HANDLE); - ld a,#0x04 - sub a, -5 (ix) - jr C,00113$ - ld a,(#_partitionsCount + 1) - xor a, #0x80 - sub a, #0x81 - jp C,00111$ -00113$: -;fdisk.c:863: return 0; - ld l,#0x00 -00114$: - ld sp,ix - pop ix - ret -_GetDiskPartitionsInfo_end:: -;fdisk.c:868: void ShowPartitions() -; --------------------------------- -; Function ShowPartitions -; --------------------------------- -_ShowPartitions_start:: -_ShowPartitions: - push ix - ld ix,#0 - add ix,sp - ld hl,#-12 - add hl,sp - ld sp,hl -;fdisk.c:871: int firstShownPartitionIndex = 1; - ld -8 (ix),#0x01 - ld -7 (ix),#0x00 -;fdisk.c:878: Locate(0, screenLinesCount-1); - ld hl,#_screenLinesCount + 0 - ld d, (hl) - dec d - push de - inc sp - xor a, a - push af - inc sp - call _Locate -;fdisk.c:879: DeleteToEndOfLine(); - ld hl, #__str_58 - ex (sp),hl - call _print -;fdisk.c:880: PrintCentered("Press ESC to return"); - ld hl, #__str_59 - ex (sp),hl - call _PrintCentered - pop af -;fdisk.c:882: while(true) { -00121$: -;fdisk.c:883: isFirstPage = (firstShownPartitionIndex == 1); - ld a,-8 (ix) - dec a - jr NZ,00187$ - ld a,-7 (ix) - or a, a - jr NZ,00187$ - ld a,#0x01 - jr 00188$ -00187$: - xor a,a -00188$: - ld -12 (ix),a -;fdisk.c:884: isLastPage = (firstShownPartitionIndex + PARTITIONS_PER_PAGE) > partitionsCount; - ld a,-8 (ix) - add a, #0x0F - ld -2 (ix),a - ld a,-7 (ix) - adc a, #0x00 - ld -1 (ix),a - ld hl,#_partitionsCount - ld a,(hl) - sub a, -2 (ix) - inc hl - ld a,(hl) - sbc a, -1 (ix) - jp PO, 00189$ - xor a, #0x80 -00189$: - rlca - and a,#0x01 -;fdisk.c:885: lastPartitionIndexToShow = isLastPage ? partitionsCount : firstShownPartitionIndex + PARTITIONS_PER_PAGE - 1; - ld -11 (ix), a - or a, a - jr Z,00128$ - ld hl,(_partitionsCount) - ld -10 (ix),l - ld -9 (ix),h - jr 00129$ -00128$: - ld a,-8 (ix) - add a, #0x0E - ld -10 (ix),a - ld a,-7 (ix) - adc a, #0x00 - ld -9 (ix),a -00129$: -;fdisk.c:887: Locate(0, screenLinesCount-1); - ld hl,#_screenLinesCount + 0 - ld d, (hl) - dec d - push de - inc sp - xor a, a - push af - inc sp - call _Locate - pop af -;fdisk.c:888: print(isFirstPage ? " " : "<--"); - ld a,-12 (ix) - or a, a - jr Z,00130$ - ld de,#__str_60 - jr 00131$ -00130$: - ld de,#__str_61 -00131$: - push de - call _print - pop af -;fdisk.c:890: Locate(currentScreenConfig.screenWidth - 4, screenLinesCount-1); - ld hl,#_screenLinesCount + 0 - ld d, (hl) - dec d - ld a, (#_currentScreenConfig + 1) - add a,#0xFC - push de - inc sp - push af - inc sp - call _Locate - pop af -;fdisk.c:891: print(isLastPage ? " " : "-->"); - ld a,-11 (ix) - or a, a - jr Z,00132$ - ld hl,#__str_60 - jr 00133$ -00132$: - ld hl,#__str_62 -00133$: - push hl - call _print - pop af -;fdisk.c:893: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:894: Locate(0, 3); - ld hl,#0x0300 - push hl - call _Locate - pop af -;fdisk.c:895: if(partitionsCount == 1) { - ld a,(#_partitionsCount + 0) - dec a - jr NZ,00102$ - ld a,(#_partitionsCount + 1) - or a, a - jr NZ,00102$ -;fdisk.c:896: PrintCentered(partitionsExistInDisk ? "One partition found on device" : "One new partition defined"); - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr Z,00134$ - ld hl,#__str_63 - jr 00135$ -00134$: - ld hl,#__str_64 -00135$: - push hl - call _PrintCentered - pop af - jr 00103$ -00102$: -;fdisk.c:898: sprintf(buffer, partitionsExistInDisk ? "%i partitions found on device" : "%i new partitions defined", partitionsCount); - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr Z,00136$ - ld bc,#__str_65 - jr 00137$ -00136$: - ld bc,#__str_66 -00137$: - ld de,#_buffer - ld hl,(_partitionsCount) - push hl - push bc - push de - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk.c:899: PrintCentered(buffer); - ld hl,#_buffer - push hl - call _PrintCentered - pop af -00103$: -;fdisk.c:901: NewLine(); - ld hl,#__str_67 - push hl - call _print - pop af -;fdisk.c:902: if(partitionsCount > PARTITIONS_PER_PAGE) { - ld a,#0x0F - ld iy,#_partitionsCount - cp a, 0 (iy) - ld a,#0x00 - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00192$ - xor a, #0x80 -00192$: - jp P,00105$ -;fdisk.c:903: sprintf(buffer, "Displaying partitions %i - %i", - ld hl,#_buffer - pop de - pop bc - push bc - push de - push bc - ld c,-8 (ix) - ld b,-7 (ix) - push bc - ld bc,#__str_68 - push bc - push hl - call _sprintf - ld hl,#0x0008 - add hl,sp - ld sp,hl -;fdisk.c:906: PrintCentered(buffer); - ld hl,#_buffer - push hl - call _PrintCentered -;fdisk.c:907: NewLine(); - ld hl, #__str_67 - ex (sp),hl - call _print - pop af -00105$: -;fdisk.c:909: NewLine(); - ld hl,#__str_67 - push hl - call _print - pop af -;fdisk.c:911: currentPartition = &partitions[firstShownPartitionIndex - 1]; - ld l,-8 (ix) - ld h,-7 (ix) - dec hl - ld c, l - ld b, h - add hl, hl - add hl, hl - add hl, hl - add hl, bc - ld de,#_partitions - add hl,de - ld -4 (ix),l - ld -3 (ix),h -;fdisk.c:913: for(i = firstShownPartitionIndex; i <= lastPartitionIndexToShow; i++) { - ld a,-8 (ix) - ld -6 (ix),a - ld a,-7 (ix) - ld -5 (ix),a -00124$: - ld a,-10 (ix) - sub a, -6 (ix) - ld a,-9 (ix) - sbc a, -5 (ix) - jp PO, 00193$ - xor a, #0x80 -00193$: - jp M,00118$ -;fdisk.c:914: PrintOnePartitionInfo(currentPartition); - ld l,-4 (ix) - ld h,-3 (ix) - push hl - call _PrintOnePartitionInfo - pop af -;fdisk.c:915: currentPartition++; - ld a,-4 (ix) - add a, #0x09 - ld -4 (ix),a - ld a,-3 (ix) - adc a, #0x00 - ld -3 (ix),a -;fdisk.c:913: for(i = firstShownPartitionIndex; i <= lastPartitionIndexToShow; i++) { - inc -6 (ix) - jr NZ,00124$ - inc -5 (ix) - jr 00124$ -;fdisk.c:918: while(true) { -00118$: -;fdisk.c:919: key = WaitKey(); - call _WaitKey -;fdisk.c:920: if(key == ESC) { - ld a,l - sub a, #0x1B - jr Z,00126$ - jr 00115$ -;fdisk.c:921: return; - jr 00126$ -00115$: -;fdisk.c:922: } else if(key == CURSOR_LEFT && !isFirstPage) { - ld a,l - sub a, #0x1D - jr NZ,00111$ - ld a,-12 (ix) - or a, a - jr NZ,00111$ -;fdisk.c:923: firstShownPartitionIndex -= PARTITIONS_PER_PAGE; - ld a,-8 (ix) - add a,#0xF1 - ld -8 (ix),a - ld a,-7 (ix) - adc a,#0xFF - ld -7 (ix),a -;fdisk.c:924: break; - jp 00121$ -00111$: -;fdisk.c:925: } else if(key == CURSOR_RIGHT && !isLastPage) { - ld a,l - sub a, #0x1C - jr NZ,00118$ - ld a,-11 (ix) - or a, a - jr NZ,00118$ -;fdisk.c:926: firstShownPartitionIndex += PARTITIONS_PER_PAGE; - ld a,-2 (ix) - ld -8 (ix),a - ld a,-1 (ix) - ld -7 (ix),a -;fdisk.c:927: break; - jp 00121$ -00126$: - ld sp,ix - pop ix - ret -_ShowPartitions_end:: -__str_58: - .db 0x1B - .ascii "K" - .db 0x00 -__str_59: - .ascii "Press ESC to return" - .db 0x00 -__str_60: - .ascii " " - .db 0x00 -__str_61: - .ascii "<--" - .db 0x00 -__str_62: - .ascii "-->" - .db 0x00 -__str_63: - .ascii "One partition found on device" - .db 0x00 -__str_64: - .ascii "One new partition defined" - .db 0x00 -__str_65: - .ascii "%i partitions found on device" - .db 0x00 -__str_66: - .ascii "%i new partitions defined" - .db 0x00 -__str_67: - .db 0x0A - .db 0x0D - .db 0x00 -__str_68: - .ascii "Displaying partitions %i - %i" - .db 0x00 -;fdisk.c:934: void PrintOnePartitionInfo(partitionInfo* info) -; --------------------------------- -; Function PrintOnePartitionInfo -; --------------------------------- -_PrintOnePartitionInfo_start:: -_PrintOnePartitionInfo: - push ix - ld ix,#0 - add ix,sp - push af - dec sp -;fdisk.c:937: putchar(info->primaryIndex == 1 ? '1' : info->extendedIndex + 1 + '0'); - ld a,4 (ix) - ld -2 (ix),a - ld a,5 (ix) - ld -1 (ix),a - ld l,-2 (ix) - ld h,-1 (ix) - ld e,(hl) -;fdisk.c:936: if(!partitionsExistInDisk && partitionsCount <= 4) { - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr NZ,00104$ - ld a,#0x04 - ld iy,#_partitionsCount - cp a, 0 (iy) - ld a,#0x00 - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00148$ - xor a, #0x80 -00148$: - jp M,00104$ -;fdisk.c:937: putchar(info->primaryIndex == 1 ? '1' : info->extendedIndex + 1 + '0'); - dec e - jr NZ,00122$ - ld a,#0x31 - jr 00123$ -00122$: - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - ld a,(hl) - add a, #0x31 -00123$: - push af - inc sp - call _putchar - inc sp - jr 00105$ -00104$: -;fdisk.c:939: putchar(info->primaryIndex + '0'); - ld a,e - add a, #0x30 - push af - inc sp - call _putchar - inc sp -;fdisk.c:940: if(info->extendedIndex != 0) { - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - ld a,(hl) - or a, a - jr Z,00105$ -;fdisk.c:941: printf("-%i", info->extendedIndex); - ld l,a - ld h,#0x00 - ld de,#__str_69 - push hl - push de - call _printf - pop af - pop af -00105$: -;fdisk.c:944: print(": "); - ld hl,#__str_70 - push hl - call _print - pop af -;fdisk.c:945: if(info->partitionType == PARTYPE_FAT12) { - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - inc hl - ld a,(hl) - ld -3 (ix), a - dec a - jr NZ,00118$ -;fdisk.c:946: print("FAT12"); - ld hl,#__str_71 - push hl - call _print - pop af - jr 00119$ -00118$: -;fdisk.c:947: } else if(info->partitionType == PARTYPE_FAT16) { - ld a,-3 (ix) - sub a, #0x06 - jr NZ,00115$ -;fdisk.c:948: print("FAT16"); - ld hl,#__str_72 - push hl - call _print - pop af - jr 00119$ -00115$: -;fdisk.c:949: } else if(info->partitionType == 0xB || info->partitionType == 0xC) { - ld a,-3 (ix) - sub a, #0x0B - jr Z,00110$ - ld a,-3 (ix) - sub a, #0x0C - jr NZ,00111$ -00110$: -;fdisk.c:950: print("FAT32"); - ld hl,#__str_73 - push hl - call _print - pop af - jr 00119$ -00111$: -;fdisk.c:951: } else if(info->partitionType == 7) { - ld a,-3 (ix) - sub a, #0x07 - jr NZ,00108$ -;fdisk.c:952: print("NTFS"); - ld hl,#__str_74 - push hl - call _print - pop af - jr 00119$ -00108$: -;fdisk.c:954: printf("Type #%x", info->partitionType); - ld l,-3 (ix) - ld h,#0x00 - ld de,#__str_75 - push hl - push de - call _printf - pop af - pop af -00119$: -;fdisk.c:956: print(", "); - ld hl,#__str_76 - push hl - call _print - pop af -;fdisk.c:957: PrintSize(info->sizeInK); - ld l,-2 (ix) - ld h,-1 (ix) - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - push bc - push de - call _PrintSize - pop af -;fdisk.c:958: NewLine(); - ld hl, #__str_77 - ex (sp),hl - call _print - ld sp,ix - pop ix - ret -_PrintOnePartitionInfo_end:: -__str_69: - .ascii "-%i" - .db 0x00 -__str_70: - .ascii ": " - .db 0x00 -__str_71: - .ascii "FAT12" - .db 0x00 -__str_72: - .ascii "FAT16" - .db 0x00 -__str_73: - .ascii "FAT32" - .db 0x00 -__str_74: - .ascii "NTFS" - .db 0x00 -__str_75: - .ascii "Type #%x" - .db 0x00 -__str_76: - .ascii ", " - .db 0x00 -__str_77: - .db 0x0A - .db 0x0D - .db 0x00 -;fdisk.c:962: void DeleteAllPartitions() -; --------------------------------- -; Function DeleteAllPartitions -; --------------------------------- -_DeleteAllPartitions_start:: -_DeleteAllPartitions: -;fdisk.c:964: sprintf(buffer, "Discard all %s partitions? (y/n) ", partitionsExistInDisk ? "existing" : "defined"); - ld a,(#_partitionsExistInDisk + 0) - or a, a - jr Z,00105$ - ld de,#__str_79 - jr 00106$ -00105$: - ld de,#__str_80 -00106$: - ld bc,#__str_78 - ld hl,#_buffer - push de - push bc - push hl - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk.c:965: PrintStateMessage(buffer); - ld hl,#_buffer - push hl - call _PrintStateMessage - pop af -;fdisk.c:966: if(!GetYesOrNo()) { - call _GetYesOrNo - ld a,l - or a, a -;fdisk.c:967: return; - ret Z -;fdisk.c:970: partitionsCount = 0; - ld hl,#_partitionsCount + 0 - ld (hl), #0x00 - ld hl,#_partitionsCount + 1 - ld (hl), #0x00 -;fdisk.c:971: partitionsExistInDisk = false; - ld hl,#_partitionsExistInDisk + 0 - ld (hl), #0x00 -;fdisk.c:972: unpartitionnedSpaceInSectors = selectedLun->sectorCount; - ld hl,(_selectedLun) - inc hl - inc hl - inc hl - ld a,(hl) - ld iy,#_unpartitionnedSpaceInSectors - ld 0 (iy),a - inc hl - ld a,(hl) - ld iy,#_unpartitionnedSpaceInSectors - ld 1 (iy),a - inc hl - ld a,(hl) - ld iy,#_unpartitionnedSpaceInSectors - ld 2 (iy),a - inc hl - ld a,(hl) - ld (#_unpartitionnedSpaceInSectors + 3),a -;fdisk.c:973: RecalculateAutoPartitionSize(true); - ld a,#0x01 - push af - inc sp - call _RecalculateAutoPartitionSize - inc sp - ret -_DeleteAllPartitions_end:: -__str_78: - .ascii "Discard all %s partitions? (y/n) " - .db 0x00 -__str_79: - .ascii "existing" - .db 0x00 -__str_80: - .ascii "defined" - .db 0x00 -;fdisk.c:977: void RecalculateAutoPartitionSize(bool setToAllSpaceAvailable) -; --------------------------------- -; Function RecalculateAutoPartitionSize -; --------------------------------- -_RecalculateAutoPartitionSize_start:: -_RecalculateAutoPartitionSize: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:979: ulong maxAbsolutePartitionSizeInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; - ld a,(#_unpartitionnedSpaceInSectors + 0) - add a,#0xFF - ld d,a - ld a,(#_unpartitionnedSpaceInSectors + 1) - adc a,#0xFF - ld b,a - ld a,(#_unpartitionnedSpaceInSectors + 2) - adc a,#0xFF - ld e,a - ld a,(#_unpartitionnedSpaceInSectors + 3) - adc a,#0xFF - ld c,a - srl c - rr e - rr b - rr d -;fdisk.c:981: if(setToAllSpaceAvailable) { - ld a,4 (ix) - or a, a - jr Z,00102$ -;fdisk.c:982: autoPartitionSizeInK = maxAbsolutePartitionSizeInK; - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), d - ld hl,#_autoPartitionSizeInK + 1 - ld (hl), b - ld hl,#_autoPartitionSizeInK + 2 - ld (hl), e - ld hl,#_autoPartitionSizeInK + 3 - ld (hl), c -00102$: -;fdisk.c:985: if(autoPartitionSizeInK > MAX_FAT16_PARTITION_SIZE_IN_K) { - xor a, a - ld iy,#_autoPartitionSizeInK - cp a, 0 (iy) - ld iy,#_autoPartitionSizeInK - sbc a, 1 (iy) - ld a,#0x40 - ld iy,#_autoPartitionSizeInK - sbc a, 2 (iy) - ld a,#0x00 - ld iy,#_autoPartitionSizeInK - sbc a, 3 (iy) - jr NC,00107$ -;fdisk.c:986: autoPartitionSizeInK = MAX_FAT16_PARTITION_SIZE_IN_K; - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), #0x00 - ld hl,#_autoPartitionSizeInK + 1 - ld (hl), #0x00 - ld hl,#_autoPartitionSizeInK + 2 - ld (hl), #0x40 - ld hl,#_autoPartitionSizeInK + 3 - ld (hl), #0x00 - jr 00108$ -00107$: -;fdisk.c:987: } else if(!setToAllSpaceAvailable && autoPartitionSizeInK > maxAbsolutePartitionSizeInK) { - ld a,4 (ix) - or a, a - jr NZ,00108$ - ld a,d - ld iy,#_autoPartitionSizeInK - sub a, 0 (iy) - ld a,b - ld iy,#_autoPartitionSizeInK - sbc a, 1 (iy) - ld a,e - ld iy,#_autoPartitionSizeInK - sbc a, 2 (iy) - ld a,c - ld iy,#_autoPartitionSizeInK - sbc a, 3 (iy) - jr NC,00108$ -;fdisk.c:988: autoPartitionSizeInK = maxAbsolutePartitionSizeInK; - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), d - ld hl,#_autoPartitionSizeInK + 1 - ld (hl), b - ld hl,#_autoPartitionSizeInK + 2 - ld (hl), e - ld hl,#_autoPartitionSizeInK + 3 - ld (hl), c -00108$: -;fdisk.c:991: if(autoPartitionSizeInK < MIN_PARTITION_SIZE_IN_K) { - ld a,(#_autoPartitionSizeInK + 0) - sub a, #0x64 - ld a,(#_autoPartitionSizeInK + 1) - sbc a, #0x00 - ld a,(#_autoPartitionSizeInK + 2) - sbc a, #0x00 - ld a,(#_autoPartitionSizeInK + 3) - sbc a, #0x00 - jr NC,00112$ -;fdisk.c:992: autoPartitionSizeInK = MIN_PARTITION_SIZE_IN_K; - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), #0x64 - xor a, a - ld (#_autoPartitionSizeInK + 1),a - ld (#_autoPartitionSizeInK + 2),a - ld (#_autoPartitionSizeInK + 3),a - jr 00113$ -00112$: -;fdisk.c:993: } else if(autoPartitionSizeInK > maxAbsolutePartitionSizeInK) { - ld a,d - ld iy,#_autoPartitionSizeInK - sub a, 0 (iy) - ld a,b - ld iy,#_autoPartitionSizeInK - sbc a, 1 (iy) - ld a,e - ld iy,#_autoPartitionSizeInK - sbc a, 2 (iy) - ld a,c - ld iy,#_autoPartitionSizeInK - sbc a, 3 (iy) - jr NC,00113$ -;fdisk.c:994: autoPartitionSizeInK = maxAbsolutePartitionSizeInK; - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), d - ld hl,#_autoPartitionSizeInK + 1 - ld (hl), b - ld hl,#_autoPartitionSizeInK + 2 - ld (hl), e - ld hl,#_autoPartitionSizeInK + 3 - ld (hl), c -00113$: -;fdisk.c:997: if(dos1 && autoPartitionSizeInK > 16*1024) { - ld a,(#_dos1 + 0) - or a, a - jr Z,00117$ - xor a, a - ld iy,#_autoPartitionSizeInK - cp a, 0 (iy) - ld a,#0x40 - ld iy,#_autoPartitionSizeInK - sbc a, 1 (iy) - ld a,#0x00 - ld iy,#_autoPartitionSizeInK - sbc a, 2 (iy) - ld a,#0x00 - ld iy,#_autoPartitionSizeInK - sbc a, 3 (iy) - jr NC,00117$ -;fdisk.c:998: autoPartitionSizeInK = 16*1024; - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), #0x00 - ld hl,#_autoPartitionSizeInK + 1 - ld (hl), #0x40 - ld hl,#_autoPartitionSizeInK + 2 - ld (hl), #0x00 - ld hl,#_autoPartitionSizeInK + 3 - ld (hl), #0x00 -00117$: - pop ix - ret -_RecalculateAutoPartitionSize_end:: -;fdisk.c:1003: void AddPartition() -; --------------------------------- -; Function AddPartition -; --------------------------------- -_AddPartition_start:: -_AddPartition: - push ix - ld ix,#0 - add ix,sp - ld hl,#-28 - add hl,sp - ld sp,hl -;fdisk.c:1010: bool validNumberEntered = false; - ld -18 (ix),#0x00 -;fdisk.c:1014: ulong unpartitionnedSpaceExceptAlignmentInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; - ld a,(#_unpartitionnedSpaceInSectors + 0) - add a,#0xFF - ld e,a - ld a,(#_unpartitionnedSpaceInSectors + 1) - adc a,#0xFF - ld d,a - ld a,(#_unpartitionnedSpaceInSectors + 2) - adc a,#0xFF - ld c,a - ld a,(#_unpartitionnedSpaceInSectors + 3) - adc a,#0xFF - ld b,a - push af - ld -28 (ix),e - ld -27 (ix),d - ld -26 (ix),c - ld -25 (ix),b - pop af - ld a,#0x01 - srl -25 (ix) - rr -26 (ix) - rr -27 (ix) - rr -28 (ix) -;fdisk.c:1016: maxPartitionSizeInM = (uint)((unpartitionnedSpaceInSectors / 2) >> 10); - push af - ld hl,#_unpartitionnedSpaceInSectors + 0 - ld c, (hl) - ld hl,#_unpartitionnedSpaceInSectors + 1 - ld h, (hl) - ld iy,#_unpartitionnedSpaceInSectors - ld l,2 (iy) - ld iy,#_unpartitionnedSpaceInSectors - ld d,3 (iy) - pop af - srl d - rr l - rr h - rr c - ld b,#0x0A -00215$: - srl d - rr l - rr h - rr c - djnz 00215$ - ld -14 (ix),c - ld -13 (ix),h -;fdisk.c:1017: maxPartitionSizeInK = unpartitionnedSpaceExceptAlignmentInK > (ulong)32767 ? (uint)32767 : unpartitionnedSpaceExceptAlignmentInK; - bit 7, -27 (ix) - jr NZ,00217$ - ld a,-26 (ix) - or a, a - jr NZ,00217$ - ld a,-25 (ix) - or a, a - jr Z,00138$ -00217$: - ld hl,#0xFF7F - jr 00139$ -00138$: - ld h,-28 (ix) - ld l,-27 (ix) -00139$: - ld -16 (ix),h - ld -15 (ix),l -;fdisk.c:1019: lessThan1MAvailable = (maxPartitionSizeInM == 0); - ld a,-14 (ix) - or a, -13 (ix) - jr NZ,00218$ - ld a,#0x01 - jr 00219$ -00218$: - xor a,a -00219$: - ld -23 (ix),a -;fdisk.c:1021: if(maxPartitionSizeInM > (ulong)MAX_FAT16_PARTITION_SIZE_IN_M) { - ld h,-14 (ix) - ld l,-13 (ix) - ld de,#0x0000 - xor a, a - cp a, h - ld a,#0x10 - sbc a, l - ld a,#0x00 - sbc a, d - ld a,#0x00 - sbc a, e - jr NC,00102$ -;fdisk.c:1022: maxPartitionSizeInM = MAX_FAT16_PARTITION_SIZE_IN_M; - ld -14 (ix),#0x00 - ld -13 (ix),#0x10 -00102$: -;fdisk.c:1025: PrintStateMessage("Enter size or press ENTER to cancel"); - ld hl,#__str_81 - push hl - call _PrintStateMessage - pop af -;fdisk.c:1027: while(!validNumberEntered) { -00133$: - ld a,-18 (ix) - or a, a - jp NZ,00135$ -;fdisk.c:1028: sizeInKSpecified = true; - ld -24 (ix),#0x01 -;fdisk.c:1029: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:1030: PrintTargetInfo(); - call _PrintTargetInfo -;fdisk.c:1031: NewLine(); - ld hl,#__str_82 - push hl - call _print -;fdisk.c:1032: print("Add new partition\r\n\r\n"); - ld hl, #__str_83 - ex (sp),hl - call _print - pop af -;fdisk.c:1034: if(dos1) { - ld a,(#_dos1 + 0) - or a, a - jr Z,00104$ -;fdisk.c:1036: is80ColumnsDisplay ? " " : "\r\n"); - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr Z,00140$ - ld -2 (ix),#<(__str_85) - ld -1 (ix),#>(__str_85) - jr 00141$ -00140$: - ld -2 (ix),#<(__str_86) - ld -1 (ix),#>(__str_86) -00141$: -;fdisk.c:1035: printf("WARNING: only partitions of 16M or less%scan be used in DOS 1 mode\r\n\r\n", - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld hl,#__str_84 - push hl - call _printf - pop af - pop af -00104$: -;fdisk.c:1039: if(lessThan1MAvailable) { - ld a,-23 (ix) - or a, a - jr Z,00106$ -;fdisk.c:1040: print("Enter"); - ld hl,#__str_87 - push hl - call _print - pop af - jr 00107$ -00106$: -;fdisk.c:1042: printf("Enter partition size in MB (1-%i)\r\nor", - ld hl,#__str_88 - ld c,-14 (ix) - ld b,-13 (ix) - push bc - push hl - call _printf - pop af - pop af -00107$: -;fdisk.c:1046: is80ColumnsDisplay ? " " : "\r\n", - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr Z,00142$ - ld de,#__str_85 - jr 00143$ -00142$: - ld de,#__str_86 -00143$: -;fdisk.c:1045: printf(" partition size in KB followed by%s\"K\" (%i-%i): ", - ld hl,#__str_89 - ld c,-16 (ix) - ld b,-15 (ix) - push bc - ld bc,#0x0064 - push bc - push de - push hl - call _printf - ld hl,#0x0008 - add hl,sp - ld sp,hl -;fdisk.c:1050: buffer[0] = 6; - ld hl,#_buffer - ld (hl),#0x06 -;fdisk.c:1051: regs.Words.DE = (int)buffer; - ld de,#_buffer - ld ((_regs + 0x0004)), de -;fdisk.c:1052: DosCall(_BUFIN, REGS_NONE); - ld hl,#0x000A - push hl - call _DosCall - pop af -;fdisk.c:1053: lineLength = buffer[1]; - ld hl, #_buffer + 1 - ld c,(hl) -;fdisk.c:1054: if(lineLength == 0) { - ld a,c - or a, a -;fdisk.c:1055: return; - jp Z,00136$ -;fdisk.c:1058: pointer = buffer + 2; - ld de,#(_buffer + 0x0002) -;fdisk.c:1059: pointer[lineLength] = '\0'; - ld l,c - ld h,#0x00 - add hl,de - ld (hl),#0x00 -;fdisk.c:1060: enteredSizeInK = 0; - xor a, a - ld -22 (ix),a - ld -21 (ix),a - ld -20 (ix),a - ld -19 (ix),a -;fdisk.c:1061: while(true) { - ld -2 (ix),c - ld -4 (ix),e - ld -3 (ix),d -00124$: -;fdisk.c:1062: ch = (*pointer++) | 32; - ld l,-4 (ix) - ld h,-3 (ix) - ld a,(hl) - inc -4 (ix) - jr NZ,00220$ - inc -3 (ix) -00220$: - set 5, a -;fdisk.c:1063: if(ch == 'k') { - ld -17 (ix), a - sub a, #0x6B - jr NZ,00119$ -;fdisk.c:1064: validNumberEntered = true; - ld -18 (ix),#0x01 -;fdisk.c:1065: break; - jp 00125$ -00119$: -;fdisk.c:1066: } else if(ch == '\0' || ch == 13 || ch == 'm') { - ld a,-17 (ix) - or a, a - jr Z,00113$ - ld a,-17 (ix) - sub a, #0x0D - jr Z,00113$ - ld a,-17 (ix) - sub a, #0x6D - jr NZ,00114$ -00113$: -;fdisk.c:1067: validNumberEntered = true; - ld -18 (ix),#0x01 -;fdisk.c:1068: enteredSizeInK *= 1024; - push af - pop af - ld b,#0x0A -00226$: - sla -22 (ix) - rl -21 (ix) - rl -20 (ix) - rl -19 (ix) - djnz 00226$ -;fdisk.c:1069: sizeInKSpecified = false; - ld -24 (ix),#0x00 -;fdisk.c:1070: break; - jp 00125$ -00114$: -;fdisk.c:1071: } else if(ch < '0' || ch > '9') { - ld a,-17 (ix) - xor a, #0x80 - sub a, #0xB0 - jp C,00125$ - ld a,#0x39 - sub a, -17 (ix) - jp PO, 00228$ - xor a, #0x80 -00228$: - jp M,00125$ -;fdisk.c:1074: enteredSizeInK = (enteredSizeInK * 10) + (ch - '0'); - ld l,-20 (ix) - ld h,-19 (ix) - push hl - ld l,-22 (ix) - ld h,-21 (ix) - push hl - ld hl,#0x0000 - push hl - ld hl,#0x000A - push hl - call __mullong_rrx_s - pop af - pop af - pop af - pop af - ld -5 (ix),d - ld -6 (ix),e - ld -7 (ix),h - ld -8 (ix),l - ld h,-17 (ix) - ld a,-17 (ix) - rla - sbc a, a - ld l,a - ld a,h - add a,#0xD0 - ld h,a - ld a,l - adc a,#0xFF - ld l,a - ld -12 (ix),h - ld -11 (ix),l - ld a,l - rla - sbc a, a - ld -10 (ix),a - ld -9 (ix),a - ld a,-8 (ix) - add a, -12 (ix) - ld -12 (ix),a - ld a,-7 (ix) - adc a, -11 (ix) - ld -11 (ix),a - ld a,-6 (ix) - adc a, -10 (ix) - ld -10 (ix),a - ld a,-5 (ix) - adc a, -9 (ix) - ld -9 (ix),a - ld hl, #6 - add hl, sp - ex de, hl - ld hl, #16 - add hl, sp - ld bc, #4 - ldir -;fdisk.c:1076: lineLength--; - dec -2 (ix) -;fdisk.c:1077: if(lineLength == 0) { - ld a,-2 (ix) - or a, a - jp NZ,00124$ -;fdisk.c:1078: validNumberEntered = true; - ld -18 (ix),#0x01 -;fdisk.c:1079: enteredSizeInK *= 1024; - push af - pop af - ld b,#0x0A -00229$: - sla -22 (ix) - rl -21 (ix) - rl -20 (ix) - rl -19 (ix) - djnz 00229$ -;fdisk.c:1080: sizeInKSpecified = false; - ld -24 (ix),#0x00 -;fdisk.c:1081: break; -00125$: -;fdisk.c:1085: if(validNumberEntered && - ld a,-18 (ix) - or a, a - jr Z,00132$ -;fdisk.c:1086: (sizeInKSpecified && (enteredSizeInK > maxPartitionSizeInK) || (enteredSizeInK < MIN_PARTITION_SIZE_IN_K)) || - ld a,-24 (ix) - or a, a - jr Z,00129$ - ld h,-16 (ix) - ld l,-15 (ix) - ld de,#0x0000 - ld a,h - sub a, -22 (ix) - ld a,l - sbc a, -21 (ix) - ld a,d - sbc a, -20 (ix) - ld a,e - sbc a, -19 (ix) - jr C,00126$ -00129$: - ld a,-22 (ix) - sub a, #0x64 - ld a,-21 (ix) - sbc a, #0x00 - ld a,-20 (ix) - sbc a, #0x00 - ld a,-19 (ix) - sbc a, #0x00 - jr C,00126$ -00132$: -;fdisk.c:1087: (!sizeInKSpecified && (enteredSizeInK > ((ulong)maxPartitionSizeInM * (ulong)1024))) - ld a,-24 (ix) - or a, a - jp NZ,00133$ - ld l,-14 (ix) - ld h,-13 (ix) - ld de,#0x0000 - push af - ld -12 (ix),l - ld -11 (ix),h - ld -10 (ix),e - ld -9 (ix),d - pop af - ld a,#0x0A -00231$: - sla -12 (ix) - rl -11 (ix) - rl -10 (ix) - rl -9 (ix) - dec a - jr NZ,00231$ - ld a,-12 (ix) - sub a, -22 (ix) - ld a,-11 (ix) - sbc a, -21 (ix) - ld a,-10 (ix) - sbc a, -20 (ix) - ld a,-9 (ix) - sbc a, -19 (ix) - jp NC,00133$ -00126$: -;fdisk.c:1089: validNumberEntered = false; - ld -18 (ix),#0x00 - jp 00133$ -00135$: -;fdisk.c:1093: autoPartitionSizeInK = enteredSizeInK > unpartitionnedSpaceExceptAlignmentInK ? unpartitionnedSpaceExceptAlignmentInK : enteredSizeInK; - ld a,-28 (ix) - sub a, -22 (ix) - ld a,-27 (ix) - sbc a, -21 (ix) - ld a,-26 (ix) - sbc a, -20 (ix) - ld a,-25 (ix) - sbc a, -19 (ix) - jr NC,00144$ - ld hl, #16 - add hl, sp - ex de, hl - ld hl, #0 - add hl, sp - ld bc, #4 - ldir - jr 00145$ -00144$: - ld hl, #16 - add hl, sp - ex de, hl - ld hl, #6 - add hl, sp - ld bc, #4 - ldir -00145$: - ld de, #_autoPartitionSizeInK - ld hl, #16 - add hl, sp - ld bc, #4 - ldir -;fdisk.c:1094: AddAutoPartition(); - call _AddAutoPartition -;fdisk.c:1095: unpartitionnedSpaceExceptAlignmentInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; - ld a,(#_unpartitionnedSpaceInSectors + 0) - add a,#0xFF - ld d,a - ld a,(#_unpartitionnedSpaceInSectors + 1) - adc a,#0xFF - ld e,a - ld a,(#_unpartitionnedSpaceInSectors + 2) - adc a,#0xFF - ld b,a - ld iy,#_unpartitionnedSpaceInSectors - ld a,3 (iy) - adc a,#0xFF - ld c,a - push af - ld -28 (ix),d - ld -27 (ix),e - ld -26 (ix),b - ld -25 (ix),c - pop af - srl -25 (ix) - rr -26 (ix) - rr -27 (ix) - rr -28 (ix) -;fdisk.c:1096: autoPartitionSizeInK = enteredSizeInK > unpartitionnedSpaceExceptAlignmentInK ? unpartitionnedSpaceExceptAlignmentInK : enteredSizeInK; - ld a,-28 (ix) - sub a, -22 (ix) - ld a,-27 (ix) - sbc a, -21 (ix) - ld a,-26 (ix) - sbc a, -20 (ix) - ld a,-25 (ix) - sbc a, -19 (ix) - jr NC,00146$ - ld hl, #16 - add hl, sp - ex de, hl - ld hl, #0 - add hl, sp - ld bc, #4 - ldir - jr 00147$ -00146$: - ld hl, #16 - add hl, sp - ex de, hl - ld hl, #6 - add hl, sp - ld bc, #4 - ldir -00147$: - ld de, #_autoPartitionSizeInK - ld hl, #16 - add hl, sp - ld bc, #4 - ldir -;fdisk.c:1097: RecalculateAutoPartitionSize(false); - xor a, a - push af - inc sp - call _RecalculateAutoPartitionSize - inc sp -00136$: - ld sp,ix - pop ix - ret -_AddPartition_end:: -__str_81: - .ascii "Enter size or press ENTER to cancel" - .db 0x00 -__str_82: - .db 0x0A - .db 0x0D - .db 0x00 -__str_83: - .ascii "Add new partition" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x00 -__str_84: - .ascii "WARNING: only partitions of 16M or less%scan be used in DOS " - .ascii "1 mode" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x00 -__str_85: - .ascii " " - .db 0x00 -__str_86: - .db 0x0D - .db 0x0A - .db 0x00 -__str_87: - .ascii "Enter" - .db 0x00 -__str_88: - .ascii "Enter partition size in MB (1-%i)" - .db 0x0D - .db 0x0A - .ascii "or" - .db 0x00 -__str_89: - .ascii " partition size in KB followed by%s" - .db 0x22 - .ascii "K" - .db 0x22 - .ascii " (%i-%i): " - .db 0x00 -;fdisk.c:1101: void AddAutoPartition() -; --------------------------------- -; Function AddAutoPartition -; --------------------------------- -_AddAutoPartition_start:: -_AddAutoPartition: - push ix - ld ix,#0 - add ix,sp - push af -;fdisk.c:1103: partitionInfo* partition = &partitions[partitionsCount]; - ld bc,(_partitionsCount) - ld l, c - ld h, b - add hl, hl - add hl, hl - add hl, hl - add hl, bc - ld de,#_partitions - add hl,de -;fdisk.c:1105: partition->sizeInK = autoPartitionSizeInK; - ld e,l - ld d,h - inc hl - inc hl - inc hl - ld a,(#_autoPartitionSizeInK + 0) - ld (hl),a - inc hl - ld a,(#_autoPartitionSizeInK + 1) - ld (hl),a - inc hl - ld a,(#_autoPartitionSizeInK + 2) - ld (hl),a - inc hl - ld iy,#_autoPartitionSizeInK - ld a,3 (iy) - ld (hl),a -;fdisk.c:1106: partition->partitionType = - ld hl,#0x0002 - add hl,de - ex (sp), hl -;fdisk.c:1107: partition->sizeInK > MAX_FAT12_PARTITION_SIZE_IN_K ? PARTYPE_FAT16 : PARTYPE_FAT12; - ld l, e - ld h, d - inc hl - inc hl - inc hl - ld c,(hl) - inc hl - ld b,(hl) - inc hl - inc hl - ld a,(hl) - dec hl - ld l,(hl) - ld h,a - xor a, a - cp a, c - ld a,#0x80 - sbc a, b - ld a,#0x00 - sbc a, l - ld a,#0x00 - sbc a, h - jr NC,00106$ - ld a,#0x06 - jr 00107$ -00106$: - ld a,#0x01 -00107$: - pop hl - push hl - ld (hl),a -;fdisk.c:1110: partition->extendedIndex = 0; - ld c, e - ld b, d - inc bc -;fdisk.c:1108: if(partitionsCount == 0) { - ld a,(#_partitionsCount + 1) - ld hl,#_partitionsCount + 0 - or a,(hl) - jr NZ,00102$ -;fdisk.c:1109: partition->primaryIndex = 1; - ld a,#0x01 - ld (de),a -;fdisk.c:1110: partition->extendedIndex = 0; - xor a, a - ld (bc),a - jr 00103$ -00102$: -;fdisk.c:1112: partition->primaryIndex = 2; - ld a,#0x02 - ld (de),a -;fdisk.c:1113: partition->extendedIndex = partitionsCount; - ld a,(#_partitionsCount + 0) - ld (bc),a -00103$: -;fdisk.c:1116: unpartitionnedSpaceInSectors -= (autoPartitionSizeInK * 2); - push af - ld hl,#_autoPartitionSizeInK + 0 - ld d, (hl) - ld hl,#_autoPartitionSizeInK + 1 - ld e, (hl) - ld hl,#_autoPartitionSizeInK + 2 - ld b, (hl) - ld hl,#_autoPartitionSizeInK + 3 - ld c, (hl) - pop af - sla d - rl e - rl b - rl c - ld hl,#_unpartitionnedSpaceInSectors - ld a,(hl) - sub a, d - ld (hl),a - inc hl - ld a,(hl) - sbc a, e - ld (hl),a - inc hl - ld a,(hl) - sbc a, b - ld (hl),a - inc hl - ld a,(hl) - sbc a, c - ld (hl),a -;fdisk.c:1117: unpartitionnedSpaceInSectors -= EXTRA_PARTITION_SECTORS; - ld hl,#_unpartitionnedSpaceInSectors - ld a,(hl) - add a,#0xFF - ld (hl),a - inc hl - ld a,(hl) - adc a,#0xFF - ld (hl),a - inc hl - ld a,(hl) - adc a,#0xFF - ld (hl),a - inc hl - ld a,(hl) - adc a,#0xFF - ld (hl),a -;fdisk.c:1118: partitionsCount++; - ld hl, #_partitionsCount+0 - inc (hl) - jr NZ,00116$ - ld hl, #_partitionsCount+1 - inc (hl) -00116$: -;fdisk.c:1119: RecalculateAutoPartitionSize(false); - xor a, a - push af - inc sp - call _RecalculateAutoPartitionSize - ld sp,ix - pop ix - ret -_AddAutoPartition_end:: -;fdisk.c:1123: void UndoAddPartition() -; --------------------------------- -; Function UndoAddPartition -; --------------------------------- -_UndoAddPartition_start:: -_UndoAddPartition: - push ix - ld ix,#0 - add ix,sp - push af -;fdisk.c:1125: partitionInfo* partition = &partitions[partitionsCount - 1]; - ld a,(#_partitionsCount + 0) - add a,#0xFF - ld -2 (ix),a - ld a,(#_partitionsCount + 1) - adc a,#0xFF - ld -1 (ix),a - pop bc - push bc - ld l, c - ld h, b - add hl, hl - add hl, hl - add hl, hl - add hl, bc - ld de,#_partitions - add hl,de -;fdisk.c:1126: autoPartitionSizeInK = partition->sizeInK; - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - ld hl,#_autoPartitionSizeInK + 0 - ld (hl), e - ld hl,#_autoPartitionSizeInK + 1 - ld (hl), d - ld hl,#_autoPartitionSizeInK + 2 - ld (hl), c - ld hl,#_autoPartitionSizeInK + 3 - ld (hl), b -;fdisk.c:1127: unpartitionnedSpaceInSectors += (partition->sizeInK * 2); - sla e - rl d - rl c - rl b - ld hl,#_unpartitionnedSpaceInSectors - ld a,(hl) - add a, e - ld (hl),a - inc hl - ld a,(hl) - adc a, d - ld (hl),a - inc hl - ld a,(hl) - adc a, c - ld (hl),a - inc hl - ld a,(hl) - adc a, b - ld (hl),a -;fdisk.c:1128: unpartitionnedSpaceInSectors += EXTRA_PARTITION_SECTORS; - ld hl, #_unpartitionnedSpaceInSectors+0 - inc (hl) - jr NZ,00105$ - ld hl, #_unpartitionnedSpaceInSectors+1 - inc (hl) - jr NZ,00105$ - ld hl, #_unpartitionnedSpaceInSectors+2 - inc (hl) - jr NZ,00105$ - ld hl, #_unpartitionnedSpaceInSectors+3 - inc (hl) -00105$: -;fdisk.c:1129: partitionsCount--; - pop hl - push hl - ld (_partitionsCount),hl -;fdisk.c:1130: RecalculateAutoPartitionSize(false); - xor a, a - push af - inc sp - call _RecalculateAutoPartitionSize - ld sp,ix - pop ix - ret -_UndoAddPartition_end:: -;fdisk.c:1134: void TestDeviceAccess() -; --------------------------------- -; Function TestDeviceAccess -; --------------------------------- -_TestDeviceAccess_start:: -_TestDeviceAccess: - push ix - ld ix,#0 - add ix,sp - ld hl,#-5 - add hl,sp - ld sp,hl -;fdisk.c:1136: ulong sectorNumber = 0; - xor a, a - ld -4 (ix),a - ld -3 (ix),a - ld -2 (ix),a - ld -1 (ix),a -;fdisk.c:1137: char* message = "Now reading device sector "; -;fdisk.c:1138: byte messageLen = strlen(message); - ld hl,#__str_90 - push hl - call _strlen - pop af - ld -5 (ix),l -;fdisk.c:1140: char* errorMessageHeader = "Error when reading sector "; -;fdisk.c:1142: InitializeScreenForTestDeviceAccess(message); - ld hl,#__str_90 - push hl - call _InitializeScreenForTestDeviceAccess - pop af -;fdisk.c:1144: while(GetKey() == 0) { -00107$: - call _GetKey - ld a,l - or a, a - jp NZ,00110$ -;fdisk.c:1145: _ultoa(sectorNumber, buffer, 10); - ld de,#_buffer - ld a,#0x0A - push af - inc sp - push de - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld l,-4 (ix) - ld h,-3 (ix) - push hl - call __ultoa - ld hl,#0x0007 - add hl,sp - ld sp,hl -;fdisk.c:1146: Locate(messageLen, MESSAGE_ROW); - ld a,#0x09 - push af - inc sp - ld a,-5 (ix) - push af - inc sp - call _Locate -;fdisk.c:1147: print(buffer); - ld hl, #_buffer - ex (sp),hl - call _print -;fdisk.c:1148: print(" ...\x1BK"); - ld hl, #__str_92 - ex (sp),hl - call _print - pop af -;fdisk.c:1150: regs.Flags.C = 0; - ld hl,#_regs - ld a,(hl) - and a,#0xFE - ld (hl),a -;fdisk.c:1151: regs.Bytes.A = selectedDeviceIndex; - ld hl,#_regs + 1 - ld a,(#_selectedDeviceIndex + 0) - ld (hl),a -;fdisk.c:1152: regs.Bytes.B = 1; - ld hl,#_regs + 3 - ld (hl),#0x01 -;fdisk.c:1153: regs.Bytes.C = selectedLunIndex + 1; - ld de,#_regs + 2 - ld a,(#_selectedLunIndex + 0) - inc a - ld (de),a -;fdisk.c:1154: regs.Words.HL = (int)buffer; - ld de,#_buffer - ld ((_regs + 0x0006)), de -;fdisk.c:1155: regs.Words.DE = (int)§orNumber; - ld hl,#0x0001 - add hl,sp - ex de,hl - ld ((_regs + 0x0004)), de -;fdisk.c:1156: DriverCall(selectedDriver->slot, DEV_RW); - ld hl,(_selectedDriver) - ld h,(hl) - ld bc,#0x4160 - push bc - push hl - inc sp - call _DriverCall - pop af - inc sp -;fdisk.c:1158: if((error = regs.Bytes.A) != 0) { - ld a, (#_regs + 1) - ld c,a - or a, a - jr Z,00104$ -;fdisk.c:1159: strcpy(buffer, errorMessageHeader); - ld de,#_buffer - push bc - ld hl,#__str_91 - xor a, a -00127$: - cp a, (hl) - ldi - jr NZ, 00127$ - ld hl,#__str_91 - push hl - call _strlen - pop af - pop bc - ld de,#_buffer - add hl,de - ex de,hl - push bc - ld a,#0x0A - push af - inc sp - push de - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld l,-4 (ix) - ld h,-3 (ix) - push hl - call __ultoa - ld hl,#0x0007 - add hl,sp - ld sp,hl - pop bc -;fdisk.c:1161: strcpy(buffer + strlen(buffer), ":"); - ld hl,#_buffer - push bc - push hl - call _strlen - pop af - pop bc - ld de,#_buffer - add hl,de - ld de,#__str_93 - push bc - ex de, hl - xor a, a -00128$: - cp a, (hl) - ldi - jr NZ, 00128$ - pop bc -;fdisk.c:1162: PrintDosErrorMessage(error, buffer); - ld hl,#_buffer - push hl - ld a,c - push af - inc sp - call _PrintDosErrorMessage -;fdisk.c:1163: PrintStateMessage("Continue reading sectors? (y/n) "); - inc sp - ld hl,#__str_94 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:1164: if(!GetYesOrNo()) { - call _GetYesOrNo - ld a,l - or a, a -;fdisk.c:1165: return; - jr Z,00110$ -;fdisk.c:1167: InitializeScreenForTestDeviceAccess(message); - ld hl,#__str_90 - push hl - call _InitializeScreenForTestDeviceAccess - pop af -00104$: -;fdisk.c:1170: sectorNumber++; - inc -4 (ix) - jr NZ,00129$ - inc -3 (ix) - jr NZ,00129$ - inc -2 (ix) - jr NZ,00129$ - inc -1 (ix) -00129$: -;fdisk.c:1171: if(sectorNumber >= selectedLun->sectorCount) { - ld hl,(_selectedLun) - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld h,(hl) - ld a,-4 (ix) - sub a, e - ld a,-3 (ix) - sbc a, d - ld a,-2 (ix) - sbc a, c - ld a,-1 (ix) - sbc a, h - jp C,00107$ -;fdisk.c:1172: sectorNumber = 0; - xor a, a - ld -4 (ix),a - ld -3 (ix),a - ld -2 (ix),a - ld -1 (ix),a - jp 00107$ -00110$: - ld sp,ix - pop ix - ret -_TestDeviceAccess_end:: -__str_90: - .ascii "Now reading device sector " - .db 0x00 -__str_91: - .ascii "Error when reading sector " - .db 0x00 -__str_92: - .ascii " ..." - .db 0x1B - .ascii "K" - .db 0x00 -__str_93: - .ascii ":" - .db 0x00 -__str_94: - .ascii "Continue reading sectors? (y/n) " - .db 0x00 -;fdisk.c:1178: void InitializeScreenForTestDeviceAccess(char* message) -; --------------------------------- -; Function InitializeScreenForTestDeviceAccess -; --------------------------------- -_InitializeScreenForTestDeviceAccess_start:: -_InitializeScreenForTestDeviceAccess: -;fdisk.c:1180: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:1181: PrintTargetInfo(); - call _PrintTargetInfo -;fdisk.c:1182: Locate(0, MESSAGE_ROW); - ld hl,#0x0900 - push hl - call _Locate - pop af -;fdisk.c:1183: print(message); - pop bc - pop hl - push hl - push bc - push hl - call _print -;fdisk.c:1184: PrintStateMessage("Press any key to stop..."); - ld hl, #__str_95 - ex (sp),hl - call _PrintStateMessage - pop af - ret -_InitializeScreenForTestDeviceAccess_end:: -__str_95: - .ascii "Press any key to stop..." - .db 0x00 -;fdisk.c:1188: void PrintDosErrorMessage(byte code, char* header) -; --------------------------------- -; Function PrintDosErrorMessage -; --------------------------------- -_PrintDosErrorMessage_start:: -_PrintDosErrorMessage: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:1190: Locate(0, MESSAGE_ROW); - ld hl,#0x0900 - push hl - call _Locate - pop af -;fdisk.c:1191: PrintCentered(header); - ld l,5 (ix) - ld h,6 (ix) - push hl - call _PrintCentered -;fdisk.c:1192: NewLine(); - ld hl, #__str_96 - ex (sp),hl - call _print - pop af -;fdisk.c:1194: regs.Bytes.B = code; - ld hl,#_regs + 3 - ld a,4 (ix) - ld (hl),a -;fdisk.c:1195: regs.Words.DE = (int)buffer; - ld de,#_buffer - ld c, e - ld b, d - ld ((_regs + 0x0004)), bc -;fdisk.c:1196: DosCall(_EXPLAIN, REGS_NONE); - push de - ld hl,#0x0066 - push hl - call _DosCall - pop af - pop de -;fdisk.c:1197: if(strlen(buffer) > currentScreenConfig.screenWidth) { - ld l, e - ld h, d - push de - push hl - call _strlen - pop af - ld c,l - ld b,h - pop de - ld a, (#_currentScreenConfig + 1) - ld l,a - ld h,#0x00 - cp a, a - sbc hl, bc - jr NC,00102$ -;fdisk.c:1198: print(buffer); - push de - call _print - pop af - jr 00103$ -00102$: -;fdisk.c:1200: PrintCentered(buffer); - push de - call _PrintCentered - pop af -00103$: -;fdisk.c:1203: PrintStateMessage("Press any key to return..."); - ld hl,#__str_97 - push hl - call _PrintStateMessage - pop af - pop ix - ret -_PrintDosErrorMessage_end:: -__str_96: - .db 0x0A - .db 0x0D - .db 0x00 -__str_97: - .ascii "Press any key to return..." - .db 0x00 -;fdisk.c:1207: void PrintDone() -; --------------------------------- -; Function PrintDone -; --------------------------------- -_PrintDone_start:: -_PrintDone: -;fdisk.c:1209: PrintCentered("Done!"); - ld hl,#__str_98 - push hl - call _PrintCentered -;fdisk.c:1210: print("\x0A\x0D\x0A\x0A\x0A"); - ld hl, #__str_99 - ex (sp),hl - call _print -;fdisk.c:1211: PrintCentered("If this device had drives mapped to,"); - ld hl, #__str_100 - ex (sp),hl - call _PrintCentered -;fdisk.c:1212: NewLine(); - ld hl, #__str_101 - ex (sp),hl - call _print -;fdisk.c:1213: PrintCentered("please reset the computer."); - ld hl, #__str_102 - ex (sp),hl - call _PrintCentered - pop af - ret -_PrintDone_end:: -__str_98: - .ascii "Done!" - .db 0x00 -__str_99: - .db 0x0A - .db 0x0D - .db 0x0A - .db 0x0A - .db 0x0A - .db 0x00 -__str_100: - .ascii "If this device had drives mapped to," - .db 0x00 -__str_101: - .db 0x0A - .db 0x0D - .db 0x00 -__str_102: - .ascii "please reset the computer." - .db 0x00 -;fdisk.c:1216: bool FormatWithoutPartitions() -; --------------------------------- -; Function FormatWithoutPartitions -; --------------------------------- -_FormatWithoutPartitions_start:: -_FormatWithoutPartitions: - push ix - ld ix,#0 - add ix,sp - ld hl,#-15 - add hl,sp - ld sp,hl -;fdisk.c:1221: if(!ConfirmDataDestroy("Format device without partitions")) { - ld hl,#__str_103 - push hl - call _ConfirmDataDestroy - pop af - ld a,l -;fdisk.c:1222: return false; - or a,a - jr NZ,00102$ - ld l,a - jp 00106$ -00102$: -;fdisk.c:1225: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:1226: PrintTargetInfo(); - call _PrintTargetInfo -;fdisk.c:1227: Locate(0, MESSAGE_ROW); - ld hl,#0x0900 - push hl - call _Locate -;fdisk.c:1228: PrintCentered("Formatting the device..."); - ld hl, #__str_104 - ex (sp),hl - call _PrintCentered -;fdisk.c:1229: PrintStateMessage("Please wait..."); - ld hl, #__str_105 - ex (sp),hl - call _PrintStateMessage - pop af -;fdisk.c:1236: error = CreateFatFileSystem(0, selectedLun->sectorCount / 2); - ld hl,(_selectedLun) - inc hl - inc hl - inc hl - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - srl b - rr c - rr d - rr e - push bc - push de - ld hl,#0x0000 - push hl - ld hl,#0x0000 - push hl - call _CreateFatFileSystem - pop af - pop af - pop af - pop af - ld d,l -;fdisk.c:1237: if(error == 0) { - ld a,d - or a, a - jr NZ,00104$ -;fdisk.c:1238: Locate(0, MESSAGE_ROW + 2); - push de - ld hl,#0x0B00 - push hl - call _Locate - pop af - call _PrintDone - pop de -;fdisk.c:1240: PrintStateMessage("Press any key to return..."); - ld hl,#__str_106 - push de - push hl - call _PrintStateMessage - pop af - pop de - jr 00105$ -00104$: -;fdisk.c:1242: PrintDosErrorMessage(error, "Error when formatting device:"); - ld hl,#__str_107 - push de - push hl - push de - inc sp - call _PrintDosErrorMessage - pop af - inc sp - pop de -00105$: -;fdisk.c:1244: WaitKey(); - push de - call _WaitKey - pop de -;fdisk.c:1245: return (error == 0); - ld a,d - or a, a - jr NZ,00116$ - ld a,#0x01 - jr 00117$ -00116$: - xor a,a -00117$: - ld l,a -00106$: - ld sp,ix - pop ix - ret -_FormatWithoutPartitions_end:: -__str_103: - .ascii "Format device without partitions" - .db 0x00 -__str_104: - .ascii "Formatting the device..." - .db 0x00 -__str_105: - .ascii "Please wait..." - .db 0x00 -__str_106: - .ascii "Press any key to return..." - .db 0x00 -__str_107: - .ascii "Error when formatting device:" - .db 0x00 -;fdisk.c:1250: byte CreateFatFileSystem(ulong firstDeviceSector, ulong fileSystemSizeInK) -; --------------------------------- -; Function CreateFatFileSystem -; --------------------------------- -_CreateFatFileSystem_start:: -_CreateFatFileSystem: - push ix - ld ix,#0 - add ix,sp - ld hl,#-6 - add hl,sp - ld sp,hl -;fdisk.c:1252: byte* remoteCallParams = buffer; -;fdisk.c:1254: remoteCallParams[0] = selectedDriver->slot; - ld hl,(_selectedDriver) - ld a,(hl) - ld hl,#_buffer - ld (hl),a -;fdisk.c:1255: remoteCallParams[1] = selectedDeviceIndex; - inc hl - ld a,(#_selectedDeviceIndex + 0) - ld (hl),a -;fdisk.c:1256: remoteCallParams[2] = selectedLunIndex + 1; - ld de,#_buffer + 2 - ld a,(#_selectedLunIndex + 0) - inc a - ld (de),a -;fdisk.c:1257: *((ulong*)&remoteCallParams[3]) = 0; - ld hl,#_buffer + 3 - ld (hl),#0x00 - inc hl - ld (hl),#0x00 - inc hl - ld (hl),#0x00 - inc hl - ld (hl),#0x00 -;fdisk.c:1258: *((ulong*)&remoteCallParams[7]) = selectedLun->sectorCount / 2; - ld -2 (ix),#<((_buffer + 0x0007)) - ld -1 (ix),#>((_buffer + 0x0007)) - ld hl,(_selectedLun) - inc hl - inc hl - inc hl - ld d,(hl) - inc hl - ld b,(hl) - inc hl - ld e,(hl) - inc hl - ld h,(hl) - push af - ld -6 (ix),d - ld -5 (ix),b - ld -4 (ix),e - ld -3 (ix),h - pop af - srl -3 (ix) - rr -4 (ix) - rr -5 (ix) - rr -6 (ix) - ld e,-2 (ix) - ld d,-1 (ix) - ld hl, #0x0000 - add hl, sp - ld bc, #0x0004 - ldir -;fdisk.c:1260: return (byte)CallFunctionInExtraBank(f_CreateFatFileSystem, remoteCallParams); - ld hl,#_buffer - push hl - ld hl,#0x0002 - push hl - call _CallFunctionInExtraBank - ld sp,ix - pop ix - ret -_CreateFatFileSystem_end:: -;fdisk.c:1275: bool WritePartitionTable() -; --------------------------------- -; Function WritePartitionTable -; --------------------------------- -_WritePartitionTable_start:: -_WritePartitionTable: -;fdisk.c:1283: if(partitionsCount <= 4) { - ld a,#0x04 - ld iy,#_partitionsCount - cp a, 0 (iy) - ld a,#0x00 - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00129$ - xor a, #0x80 -00129$: - jp M,00102$ -;fdisk.c:1284: sprintf(buffer, "Create %i primary partitions on device", partitionsCount); - ld de,#__str_108 - ld bc,#_buffer - ld hl,(_partitionsCount) - push hl - push de - push bc - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl - jr 00103$ -00102$: -;fdisk.c:1286: sprintf(buffer, "Create %i partitions on device", partitionsCount); - ld de,#_buffer - ld hl,(_partitionsCount) - push hl - ld hl,#__str_109 - push hl - push de - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl -00103$: -;fdisk.c:1288: if(!ConfirmDataDestroy(buffer)) { - ld hl,#_buffer - push hl - call _ConfirmDataDestroy - pop af - ld a,l -;fdisk.c:1289: return false; - or a,a - jr NZ,00105$ - ld l,a - ret -00105$: -;fdisk.c:1292: ClearInformationArea(); - call _ClearInformationArea -;fdisk.c:1293: PrintTargetInfo(); - call _PrintTargetInfo -;fdisk.c:1294: PrintStateMessage("Please wait..."); - ld hl,#__str_110 - push hl - call _PrintStateMessage -;fdisk.c:1296: Locate(0, MESSAGE_ROW); - ld hl, #0x0900 - ex (sp),hl - call _Locate -;fdisk.c:1297: PrintCentered("Preparing partitionning process..."); - ld hl, #__str_111 - ex (sp),hl - call _PrintCentered - pop af -;fdisk.c:1298: PreparePartitionningProcess(); - call _PreparePartitionningProcess -;fdisk.c:1300: for(i = 0; i < partitionsCount; i++) { - ld bc,#0x0000 -00110$: - ld hl,#_partitionsCount - ld a,c - sub a, (hl) - ld a,b - inc hl - sbc a, (hl) - jp PO, 00130$ - xor a, #0x80 -00130$: - jp P,00108$ -;fdisk.c:1301: Locate(0, MESSAGE_ROW); - push bc - ld hl,#0x0900 - push hl - call _Locate - pop af - pop bc -;fdisk.c:1302: sprintf(buffer, "Creating partition %i of %i ...", i + 1, partitionsCount); - ld e, c - ld d, b - inc de - push bc - push de - ld hl,(_partitionsCount) - push hl - push de - ld hl,#__str_112 - push hl - ld hl,#_buffer - push hl - call _sprintf - ld hl,#0x0008 - add hl,sp - ld sp,hl - pop de - pop bc -;fdisk.c:1303: PrintCentered(buffer); - ld hl,#_buffer - push bc - push de - push hl - call _PrintCentered - pop af - pop de - pop bc -;fdisk.c:1305: error = CreatePartition(i); - push de - push bc - call _CreatePartition - pop af - pop de -;fdisk.c:1306: if(error != 0) { - ld a,l - or a, a - jr Z,00111$ -;fdisk.c:1307: sprintf(buffer, "Error when creating partition %i :", i + 1); - ld bc,#__str_113 - push hl - push de - push bc - ld bc,#_buffer - push bc - call _sprintf - ld hl,#0x0006 - add hl,sp - ld sp,hl - pop hl -;fdisk.c:1308: PrintDosErrorMessage(error, buffer); - ld de,#_buffer - push de - ld a,l - push af - inc sp - call _PrintDosErrorMessage - pop af - inc sp -;fdisk.c:1309: WaitKey(); - call _WaitKey -;fdisk.c:1310: return false; - ld l,#0x00 - ret -00111$: -;fdisk.c:1300: for(i = 0; i < partitionsCount; i++) { - ld c, e - ld b, d - jr 00110$ -00108$: -;fdisk.c:1316: Locate(0, MESSAGE_ROW + 2); - ld hl,#0x0B00 - push hl - call _Locate - pop af -;fdisk.c:1317: PrintDone(); - call _PrintDone -;fdisk.c:1318: PrintStateMessage("Press any key to return..."); - ld hl,#__str_114 - push hl - call _PrintStateMessage - pop af -;fdisk.c:1319: WaitKey(); - call _WaitKey -;fdisk.c:1320: return true; - ld l,#0x01 - ret -_WritePartitionTable_end:: -__str_108: - .ascii "Create %i primary partitions on device" - .db 0x00 -__str_109: - .ascii "Create %i partitions on device" - .db 0x00 -__str_110: - .ascii "Please wait..." - .db 0x00 -__str_111: - .ascii "Preparing partitionning process..." - .db 0x00 -__str_112: - .ascii "Creating partition %i of %i ..." - .db 0x00 -__str_113: - .ascii "Error when creating partition %i :" - .db 0x00 -__str_114: - .ascii "Press any key to return..." - .db 0x00 -;fdisk.c:1324: void PreparePartitionningProcess() -; --------------------------------- -; Function PreparePartitionningProcess -; --------------------------------- -_PreparePartitionningProcess_start:: -_PreparePartitionningProcess: -;fdisk.c:1326: byte* remoteCallParams = buffer; -;fdisk.c:1328: remoteCallParams[0] = selectedDriver->slot; - ld hl,(_selectedDriver) - ld a,(hl) - ld hl,#_buffer - ld (hl),a -;fdisk.c:1329: remoteCallParams[1] = selectedDeviceIndex; - inc hl - ld a,(#_selectedDeviceIndex + 0) - ld (hl),a -;fdisk.c:1330: remoteCallParams[2] = selectedLunIndex + 1; - ld a,(#_selectedLunIndex + 0) - inc a - ld (#(_buffer + 0x0002)),a -;fdisk.c:1331: *((uint*)&remoteCallParams[3]) = partitionsCount; - ld hl,#(_buffer + 0x0003) - ld a,(#_partitionsCount + 0) - ld (hl),a - inc hl - ld a,(#_partitionsCount + 1) - ld (hl),a -;fdisk.c:1332: *((partitionInfo**)&remoteCallParams[5]) = &partitions[0]; - ld de,#(_buffer + 0x0005) - ld a,#<(_partitions) - ld (de),a - inc de - ld a,#>(_partitions) - ld (de),a -;fdisk.c:1333: *((uint*)&remoteCallParams[7]) = luns[selectedLunIndex].sectorsPerTrack; - ld de,#(_buffer + 0x0007) - ld bc,(_selectedLunIndex) - ld b,#0x00 - ld l, c - ld h, b - add hl, hl - add hl, bc - add hl, hl - add hl, hl - add hl, bc - ld bc,#_luns - add hl,bc - ld bc, #0x000B - add hl, bc - ld c,(hl) - ld b,#0x00 - ld a,c - ld (de),a - inc de - ld a,b - ld (de),a -;fdisk.c:1335: CallFunctionInExtraBank(f_PreparePartitionningProcess, remoteCallParams); - ld hl,#_buffer - push hl - ld hl,#0x0003 - push hl - call _CallFunctionInExtraBank - pop af - pop af - ret -_PreparePartitionningProcess_end:: -;fdisk.c:1339: byte CreatePartition(int index) -; --------------------------------- -; Function CreatePartition -; --------------------------------- -_CreatePartition_start:: -_CreatePartition: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:1341: byte* remoteCallParams = buffer; - ld de,#_buffer -;fdisk.c:1343: *((uint*)&remoteCallParams[0]) = index; - ld l, e - ld h, d - ld a,4 (ix) - ld (hl),a - inc hl - ld a,5 (ix) - ld (hl),a -;fdisk.c:1345: return (byte)CallFunctionInExtraBank(f_CreatePartition, remoteCallParams); - push de - ld hl,#0x0004 - push hl - call _CallFunctionInExtraBank - pop af - pop af - pop ix - ret -_CreatePartition_end:: -;fdisk.c:1349: bool ConfirmDataDestroy(char* action) -; --------------------------------- -; Function ConfirmDataDestroy -; --------------------------------- -_ConfirmDataDestroy_start:: -_ConfirmDataDestroy: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:1351: char* spaceOrNewLine = is80ColumnsDisplay ? " " : "\r\n"; - ld a,(#_is80ColumnsDisplay + 0) - or a, a - jr Z,00103$ - ld de,#__str_115 - jr 00104$ -00103$: - ld de,#__str_116 -00104$: -;fdisk.c:1353: PrintStateMessage(""); - ld hl,#__str_117 - push de - push hl - call _PrintStateMessage - pop af - call _ClearInformationArea - call _PrintTargetInfo - ld hl,#0x0900 - push hl - call _Locate - pop af - pop de -;fdisk.c:1363: "Are you sure? (y/n) ", - ld hl,#__str_118 - push de - push de - ld c,4 (ix) - ld b,5 (ix) - push bc - push hl - call _printf - ld hl,#0x0008 - add hl,sp - ld sp,hl -;fdisk.c:1368: return GetYesOrNo(); - pop ix - jp _GetYesOrNo -_ConfirmDataDestroy_end:: -__str_115: - .ascii " " - .db 0x00 -__str_116: - .db 0x0D - .db 0x0A - .db 0x00 -__str_117: - .db 0x00 -__str_118: - .ascii "%s" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .ascii "THIS WILL DESTROY%sALL DATA ON THE DEVICE!!" - .db 0x0D - .db 0x0A - .ascii "This acti" - .ascii "on can't be cancelled%sand can't be undone" - .db 0x0D - .db 0x0A - .db 0x0D - .db 0x0A - .ascii "Are you sure? " - .ascii "(y/n) " - .db 0x00 -;fdisk.c:1372: void ClearInformationArea() -; --------------------------------- -; Function ClearInformationArea -; --------------------------------- -_ClearInformationArea_start:: -_ClearInformationArea: -;fdisk.c:1376: Locate(0, 2); - ld hl,#0x0200 - push hl - call _Locate - pop af -;fdisk.c:1377: for(i = 0; i < screenLinesCount - 4; i++) { - ld de,#0x0000 -00103$: - ld iy,#_screenLinesCount - ld a, 0 (iy) - ld h, #0x00 - add a,#0xFC - ld l,a - ld a,h - adc a,#0xFF - ld h,a - ld a,e - sub a, l - ld a,d - sbc a, h - jp PO, 00114$ - xor a, #0x80 -00114$: - ret P -;fdisk.c:1378: DeleteToEndOfLineAndCursorDown(); - ld hl,#__str_119 - push de - push hl - call _print - pop af - pop de -;fdisk.c:1377: for(i = 0; i < screenLinesCount - 4; i++) { - inc de - jr 00103$ - ret -_ClearInformationArea_end:: -__str_119: - .db 0x1B - .ascii "K" - .db 0x1F - .db 0x00 -;fdisk.c:1383: void GetDriversInformation() -; --------------------------------- -; Function GetDriversInformation -; --------------------------------- -_GetDriversInformation_start:: -_GetDriversInformation: - push ix - ld ix,#0 - add ix,sp - push af -;fdisk.c:1385: byte error = 0; - ld c,#0x00 -;fdisk.c:1387: driverInfo* currentDriver = &drivers[0]; - ld -2 (ix),#<(_drivers) - ld -1 (ix),#>(_drivers) -;fdisk.c:1389: installedDriversCount = 0; - ld hl,#_installedDriversCount + 0 - ld (hl), #0x00 -;fdisk.c:1411: while(error == 0 && driverIndex <= MAX_INSTALLED_DRIVERS) { - ld e,#0x01 -00105$: - ld a,c - or a, a - jr NZ,00108$ - ld a,#0x08 - sub a, e - jr C,00108$ -;fdisk.c:1412: regs.Bytes.A = driverIndex; - ld hl,#_regs + 1 - ld (hl),e -;fdisk.c:1413: regs.Words.HL = (int)currentDriver; - pop bc - push bc - ld ((_regs + 0x0006)), bc -;fdisk.c:1414: DosCall(_GDRVR, REGS_AF); - push de - ld hl,#0x0178 - push hl - call _DosCall - pop af - pop de -;fdisk.c:1415: if((error = regs.Bytes.A) == 0 && (currentDriver->flags & (DRIVER_IS_DOS250 | DRIVER_IS_DEVICE_BASED) == (DRIVER_IS_DOS250 | DRIVER_IS_DEVICE_BASED))) { - ld a, (#_regs + 1) - ld c,a - or a, a - jr NZ,00102$ - pop hl - push hl - inc hl - inc hl - inc hl - inc hl - ld a,(hl) - rrca - jr NC,00102$ -;fdisk.c:1416: installedDriversCount++; - ld hl, #_installedDriversCount+0 - inc (hl) -;fdisk.c:1417: TerminateRightPaddedStringWithZero(currentDriver->driverName, DRIVER_NAME_LENGTH); - ld a,-2 (ix) - add a, #0x08 - ld d,a - ld a,-1 (ix) - adc a, #0x00 - ld b,a - push bc - push de - ld a,#0x20 - push af - inc sp - ld c,d - push bc - call _TerminateRightPaddedStringWithZero - pop af - inc sp - pop de - pop bc -;fdisk.c:1418: currentDriver++; - ld a,-2 (ix) - add a, #0x40 - ld -2 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -1 (ix),a -00102$: -;fdisk.c:1420: driverIndex++; - inc e - jr 00105$ -00108$: - ld sp,ix - pop ix - ret -_GetDriversInformation_end:: -;fdisk.c:1426: void TerminateRightPaddedStringWithZero(char* string, byte length) -; --------------------------------- -; Function TerminateRightPaddedStringWithZero -; --------------------------------- -_TerminateRightPaddedStringWithZero_start:: -_TerminateRightPaddedStringWithZero: -;fdisk.c:1428: char* pointer = string + length - 1; - ld hl,#4 - add hl,sp - ld iy,#2 - add iy,sp - ld a,0 (iy) - add a, (hl) - ld e,a - ld a,1 (iy) - adc a, #0x00 - ld d,a - dec de -;fdisk.c:1429: while(*pointer == ' ' && length > 0) { - ld hl, #4+0 - add hl, sp - ld b, (hl) -00102$: - ld a,(de) - sub a,#0x20 - jr NZ,00104$ - or a,b - jr Z,00104$ -;fdisk.c:1430: pointer--; - dec de -;fdisk.c:1431: length--; - dec b - jr 00102$ -00104$: -;fdisk.c:1433: pointer[1] = '\0'; - inc de - xor a, a - ld (de),a - ret -_TerminateRightPaddedStringWithZero_end:: -;fdisk.c:1437: byte WaitKey() -; --------------------------------- -; Function WaitKey -; --------------------------------- -_WaitKey_start:: -_WaitKey: -;fdisk.c:1441: while((key = GetKey()) == 0); -00101$: - call _GetKey - ld a,l - or a, a - jr Z,00101$ -;fdisk.c:1442: return key; - ret -_WaitKey_end:: -;fdisk.c:1446: byte GetKey() -; --------------------------------- -; Function GetKey -; --------------------------------- -_GetKey_start:: -_GetKey: -;fdisk.c:1448: regs.Bytes.E = 0xFF; - ld hl,#_regs + 4 - ld (hl),#0xFF -;fdisk.c:1449: DosCall(_DIRIO, REGS_AF); - ld hl,#0x0106 - push hl - call _DosCall - pop af -;fdisk.c:1450: return regs.Bytes.A; - ld a, (#_regs + 1) - ld l,a - ret -_GetKey_end:: -;fdisk.c:1454: void SaveOriginalScreenConfiguration() -; --------------------------------- -; Function SaveOriginalScreenConfiguration -; --------------------------------- -_SaveOriginalScreenConfiguration_start:: -_SaveOriginalScreenConfiguration: -;fdisk.c:1456: originalScreenConfig.screenMode = *(byte*)SCRMOD; - ld a,(#0xFCAF) - ld (#_originalScreenConfig),a -;fdisk.c:1457: originalScreenConfig.screenWidth = *(byte*)LINLEN; - ld a,(#0xF3B0) - ld (#(_originalScreenConfig + 0x0001)),a -;fdisk.c:1458: originalScreenConfig.functionKeysVisible = (*(byte*)CNSDFG != 0); - ld a,(#0xF3DE) - or a,a - jr Z,00104$ - ld a,#0x01 -00104$: - ld d,a - ld hl,#(_originalScreenConfig + 0x0002) - ld (hl),d - ret -_SaveOriginalScreenConfiguration_end:: -;fdisk.c:1462: void ComposeWorkScreenConfiguration() -; --------------------------------- -; Function ComposeWorkScreenConfiguration -; --------------------------------- -_ComposeWorkScreenConfiguration_start:: -_ComposeWorkScreenConfiguration: -;fdisk.c:1464: currentScreenConfig.screenMode = 0; - ld hl,#_currentScreenConfig - ld (hl),#0x00 -;fdisk.c:1465: currentScreenConfig.screenWidth = (*(byte*)LINLEN <= MAX_LINLEN_MSX1 ? MAX_LINLEN_MSX1 : MAX_LINLEN_MSX2); - ld hl,#0xF3B0 - ld l,(hl) - ld a,#0x28 - sub a, l - ld a,#0x00 - ccf - rla - or a, a - jr Z,00103$ - ld d,#0x28 - jr 00104$ -00103$: - ld d,#0x50 -00104$: - ld hl,#(_currentScreenConfig + 0x0001) - ld (hl),d -;fdisk.c:1466: currentScreenConfig.functionKeysVisible = false; - ld hl,#_currentScreenConfig + 2 - ld (hl),#0x00 -;fdisk.c:1467: is80ColumnsDisplay = (currentScreenConfig.screenWidth == MAX_LINLEN_MSX2); - ld a,d - sub a, #0x50 - jr NZ,00108$ - ld a,#0x01 - jr 00109$ -00108$: - xor a,a -00109$: - ld (#_is80ColumnsDisplay + 0),a -;fdisk.c:1468: screenLinesCount = *(byte*)CRTCNT; - ld a,(#0xF3B1) - ld (#_screenLinesCount + 0),a - ret -_ComposeWorkScreenConfiguration_end:: -;fdisk.c:1472: void SetScreenConfiguration(ScreenConfiguration* screenConfig) -; --------------------------------- -; Function SetScreenConfiguration -; --------------------------------- -_SetScreenConfiguration_start:: -_SetScreenConfiguration: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:1474: if(screenConfig->screenMode == 0) { - ld c,4 (ix) - ld b,5 (ix) - ld a,(bc) - or a, a - jr NZ,00102$ -;fdisk.c:1475: *((byte*)LINL40) = screenConfig->screenWidth; - ld l, c - ld h, b - inc hl - ld a,(hl) - ld (#0xF3AE),a -;fdisk.c:1476: AsmCall(INITXT, ®s, REGS_NONE, REGS_NONE); - ld de,#_regs - push bc - ld hl,#0x0000 - push hl - ld l, #0x00 - push hl - push de - ld l, #0x6C - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - pop bc - jr 00103$ -00102$: -;fdisk.c:1478: *((byte*)LINL32) = screenConfig->screenWidth; - ld l, c - ld h, b - inc hl - ld a,(hl) - ld (#0xF3AF),a -;fdisk.c:1479: AsmCall(INIT32, ®s, REGS_NONE, REGS_NONE); - ld de,#_regs - push bc - ld hl,#0x0000 - push hl - ld l, #0x00 - push hl - push de - ld l, #0x6F - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - pop bc -00103$: -;fdisk.c:1482: AsmCall(screenConfig->functionKeysVisible ? DSPFNK : ERAFNK, ®s, REGS_NONE, REGS_NONE); - ld de,#_regs - ld l, c - ld h, b - inc hl - inc hl - ld a,(hl) - or a, a - jr Z,00106$ - ld c,#0xCF - jr 00107$ -00106$: - ld c,#0xCC -00107$: - ld b,#0x00 - ld hl,#0x0000 - push hl - ld l, #0x00 - push hl - push de - push bc - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - pop ix - ret -_SetScreenConfiguration_end:: -;fdisk.c:1486: void InitializeWorkingScreen(char* header) -; --------------------------------- -; Function InitializeWorkingScreen -; --------------------------------- -_InitializeWorkingScreen_start:: -_InitializeWorkingScreen: -;fdisk.c:1488: ClearScreen(); - ld a,#0x0C - push af - inc sp - call _putchar - inc sp -;fdisk.c:1489: PrintCentered(header); - pop bc - pop hl - push hl - push bc - push hl - call _PrintCentered -;fdisk.c:1490: CursorDown(); - ld h,#0x1F - ex (sp),hl - inc sp - call _putchar - inc sp -;fdisk.c:1491: PrintRuler(); - call _PrintRuler -;fdisk.c:1492: Locate(0, screenLinesCount - 2); - ld hl,#_screenLinesCount + 0 - ld d, (hl) - dec d - dec d - push de - inc sp - xor a, a - push af - inc sp - call _Locate - pop af -;fdisk.c:1493: PrintRuler(); - jp _PrintRuler -_InitializeWorkingScreen_end:: -;fdisk.c:1497: void PrintRuler() -; --------------------------------- -; Function PrintRuler -; --------------------------------- -_PrintRuler_start:: -_PrintRuler: -;fdisk.c:1501: HomeCursor(); - ld hl,#__str_120 - push hl - call _print - pop af -;fdisk.c:1502: for(i = 0; i < currentScreenConfig.screenWidth; i++) { - ld de,#0x0000 -00103$: - ld a, (#_currentScreenConfig + 1) - ld l,a - ld h,#0x00 - ld a,e - sub a, l - ld a,d - sbc a, h - jp PO, 00114$ - xor a, #0x80 -00114$: - ret P -;fdisk.c:1503: putchar('-'); - push de - ld a,#0x2D - push af - inc sp - call _putchar - inc sp - pop de -;fdisk.c:1502: for(i = 0; i < currentScreenConfig.screenWidth; i++) { - inc de - jr 00103$ - ret -_PrintRuler_end:: -__str_120: - .db 0x0D - .db 0x1B - .ascii "K" - .db 0x00 -;fdisk.c:1508: void Locate(byte x, byte y) -; --------------------------------- -; Function Locate -; --------------------------------- -_Locate_start:: -_Locate: -;fdisk.c:1510: regs.Bytes.H = x + 1; - ld hl, #2+0 - add hl, sp - ld a, (hl) - inc a - ld (#(_regs + 0x0007)),a -;fdisk.c:1511: regs.Bytes.L = y + 1; - ld hl, #3+0 - add hl, sp - ld a, (hl) - inc a - ld (#(_regs + 0x0006)),a -;fdisk.c:1512: AsmCall(POSIT, ®s, REGS_MAIN, REGS_NONE); - ld de,#_regs - ld hl,#0x0000 - push hl - ld l, #0x02 - push hl - push de - ld l, #0xC6 - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - ret -_Locate_end:: -;fdisk.c:1516: void LocateX(byte x) -; --------------------------------- -; Function LocateX -; --------------------------------- -_LocateX_start:: -_LocateX: -;fdisk.c:1518: regs.Bytes.H = x + 1; - ld hl, #2+0 - add hl, sp - ld a, (hl) - inc a - ld (#(_regs + 0x0007)),a -;fdisk.c:1519: regs.Bytes.L = *(byte*)CSRY; - ld a,(#0xF3DC) - ld (#(_regs + 0x0006)),a -;fdisk.c:1520: AsmCall(POSIT, ®s, REGS_MAIN, REGS_NONE); - ld de,#_regs - ld hl,#0x0000 - push hl - ld l, #0x02 - push hl - push de - ld l, #0xC6 - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - ret -_LocateX_end:: -;fdisk.c:1524: void PrintCentered(char* string) -; --------------------------------- -; Function PrintCentered -; --------------------------------- -_PrintCentered_start:: -_PrintCentered: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:1526: byte pos = (currentScreenConfig.screenWidth - strlen(string)) / 2; - ld a, (#_currentScreenConfig + 1) - ld l,a - ld h,#0x00 - push hl - ld c,4 (ix) - ld b,5 (ix) - push bc - call _strlen - pop af - ex de,hl - pop hl - cp a, a - sbc hl, de - srl h - rr l - ld h,l -;fdisk.c:1527: HomeCursor(); - ld de,#__str_121 - push hl - push de - call _print - pop af - inc sp - call _LocateX - inc sp -;fdisk.c:1529: print(string); - ld l,4 (ix) - ld h,5 (ix) - push hl - call _print - pop af - pop ix - ret -_PrintCentered_end:: -__str_121: - .db 0x0D - .db 0x1B - .ascii "K" - .db 0x00 -;fdisk.c:1533: void PrintStateMessage(char* string) -; --------------------------------- -; Function PrintStateMessage -; --------------------------------- -_PrintStateMessage_start:: -_PrintStateMessage: -;fdisk.c:1535: Locate(0, screenLinesCount-1); - ld hl,#_screenLinesCount + 0 - ld d, (hl) - dec d - push de - inc sp - xor a, a - push af - inc sp - call _Locate -;fdisk.c:1536: DeleteToEndOfLine(); - ld hl, #__str_122 - ex (sp),hl - call _print - pop af -;fdisk.c:1537: print(string); - pop bc - pop hl - push hl - push bc - push hl - call _print - pop af - ret -_PrintStateMessage_end:: -__str_122: - .db 0x1B - .ascii "K" - .db 0x00 -;fdisk.c:1541: void putchar(char ch) __naked -; --------------------------------- -; Function putchar -; --------------------------------- -_putchar_start:: -_putchar: -;fdisk.c:1551: __endasm; - push ix - ld ix,#4 - add ix,sp - ld a,(ix) - call 0x00A2 - pop ix - ret -_putchar_end:: -;fdisk.c:1555: void print(char* string) __naked -; --------------------------------- -; Function print -; --------------------------------- -_print_start:: -_print: -;fdisk.c:1573: __endasm; - push ix - ld ix,#4 - add ix,sp - ld l,(ix) - ld h,1(ix) - PRLOOP: - ld a,(hl) - or a - jr z,PREND - call 0x00A2 - inc hl - jr PRLOOP - PREND: - pop ix - ret -_print_end:: -;fdisk.c:1578: int CallFunctionInExtraBank(int functionNumber, void* parametersBuffer) -; --------------------------------- -; Function CallFunctionInExtraBank -; --------------------------------- -_CallFunctionInExtraBank_start:: -_CallFunctionInExtraBank: - push ix - ld ix,#0 - add ix,sp -;fdisk.c:1580: regs.Bytes.A = (*((byte*)0x40ff)) + 1; //Extra functions bank = our bank + 1 - ld a,(#0x40FF) - inc a - ld (#(_regs + 0x0001)),a -;fdisk.c:1581: regs.Words.BC = functionNumber; - ld hl,#_regs + 2 - ld a,4 (ix) - ld (hl),a - inc hl - ld a,5 (ix) - ld (hl),a -;fdisk.c:1582: regs.Words.HL = (int)parametersBuffer; - ld e,6 (ix) - ld d,7 (ix) - ld ((_regs + 0x0006)), de -;fdisk.c:1583: regs.Words.IX = (int)0x4100; //Address of "main" for extra functions program - ld hl,#0x4100 - ld ((_regs + 0x0008)), hl -;fdisk.c:1584: AsmCall(CALBNK, ®s, REGS_ALL, REGS_MAIN); - ld de,#_regs - ld h, #0x00 - push hl - ld hl,#0x0203 - push hl - push de - ld hl,#0x4042 - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl -;fdisk.c:1585: return regs.Words.HL; - ld hl, (#_regs + 6) - pop ix - ret -_CallFunctionInExtraBank_end:: -;asmcall.c:10: void DriverCall(byte slot, uint routineAddress) -; --------------------------------- -; Function DriverCall -; --------------------------------- -_DriverCall_start:: -_DriverCall: - push ix - ld ix,#0 - add ix,sp - ld hl,#-8 - add hl,sp - ld sp,hl -;asmcall.c:15: memcpy(registerData, ®s, 8); - ld hl,#0x0000 - add hl,sp - ld c,l - ld b,h - ld e, c - ld d, b - ld hl,#_regs - push bc - ld bc,#0x0008 - ldir - pop bc -;asmcall.c:17: regs.Bytes.A = slot; - ld hl,#(_regs + 0x0001) - ld a,4 (ix) - ld (hl),a -;asmcall.c:18: regs.Bytes.B = 0xFF; - ld hl,#_regs + 3 - ld (hl),#0xFF -;asmcall.c:19: regs.UWords.DE = routineAddress; - ld hl,#_regs + 4 - ld a,5 (ix) - ld (hl),a - inc hl - ld a,6 (ix) - ld (hl),a -;asmcall.c:20: regs.Words.HL = (int)registerData; - ld ((_regs + 0x0006)), bc -;asmcall.c:22: DosCall(_CDRVR, REGS_ALL); - ld hl,#0x037B - push hl - call _DosCall - pop af -;asmcall.c:24: if(regs.Bytes.A == 0) { - ld a, (#(_regs + 0x0001) + 0) - or a, a - jr NZ,00103$ -;asmcall.c:25: regs.Words.AF = regs.Words.IX; - ld de, (#_regs + 8) - ld (_regs), de -00103$: - ld sp,ix - pop ix - ret -_DriverCall_end:: -;asmcall.c:30: void DosCall(byte function, register_usage outRegistersDetail) -; --------------------------------- -; Function DosCall -; --------------------------------- -_DosCall_start:: -_DosCall: -;asmcall.c:32: regs.Bytes.C = function; - ld hl,#_regs + 2 - ld iy,#2 - add iy,sp - ld a,0 (iy) - ld (hl),a -;asmcall.c:33: SwitchSystemBankThenCall(0xF37D, outRegistersDetail); - ld hl, #3+0 - add hl, sp - ld a, (hl) - push af - inc sp - ld hl,#0xF37D - push hl - call _SwitchSystemBankThenCall - pop af - inc sp - ret -_DosCall_end:: -;asmcall.c:37: void SwitchSystemBankThenCall(int routineAddress, register_usage outRegistersDetail) -; --------------------------------- -; Function SwitchSystemBankThenCall -; --------------------------------- -_SwitchSystemBankThenCall_start:: -_SwitchSystemBankThenCall: -;asmcall.c:39: *((int*)BK4_ADD) = routineAddress; - ld hl,#0xF84C - ld iy,#2 - add iy,sp - ld a,0 (iy) - ld (hl),a - inc hl - ld a,1 (iy) - ld (hl),a -;asmcall.c:40: AsmCall(CALLB0, ®s, REGS_ALL, outRegistersDetail); - ld de,#_regs - ld hl,#0x0000 - push hl - ld hl, #6+0 - add hl, sp - ld b, (hl) - ld c,#0x03 - push bc - push de - ld hl,#0x403F - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - ret -_SwitchSystemBankThenCall_end:: -;asmcall.c:44: void AsmCallAlt(uint address, Z80_registers* regs, register_usage inRegistersDetail, register_usage outRegistersDetail, int alternateAf) __naked -; --------------------------------- -; Function AsmCallAlt -; --------------------------------- -_AsmCallAlt_start:: -_AsmCallAlt: -;asmcall.c:157: __endasm; - push ix - ld ix,#4 - add ix,sp - ld e,6(ix) ;Alternate AF - ld d,7(ix) - ex af,af - push de - pop af - ex af,af - ld l,(ix) ;HL=Routine address - ld h,1(ix) - ld e,2(ix) ;DE=regs address - ld d,3(ix) - ld a,5(ix) - ld (_OUT_FLAGS),a - ld a,4(ix) ;A=in registers detail - ld (_ASMRUT+1),hl - push de - or a - jr z,ASMRUT_DO - push de - pop ix ;IX=&Z80regs - exx - ld l,(ix) - ld h,1(ix) ;AF - dec a - jr z,ASMRUT_DOAF - exx - ld c,2(ix) ;BC, DE, HL - ld b,3(ix) - ld e,4(ix) - ld d,5(ix) - ld l,6(ix) - ld h,7(ix) - dec a - exx - jr z,ASMRUT_DOAF - ld c,8(ix) ;IX - ld b,9(ix) - ld e,10(ix) ;IY - ld d,11(ix) - push de - push bc - pop ix - pop iy - ASMRUT_DOAF: - push hl - pop af - exx - ASMRUT_DO: - call _ASMRUT -;ASMRUT: call 0 - ex (sp),ix ;IX to stack, now IX=&Z80regs - ex af,af ;Alternate AF - ld a,(_OUT_FLAGS) - or a - jr z,CALL_END - exx ;Alternate HLDEBC - ex af,af ;Main AF - push af - pop hl - ld (ix),l - ld 1(ix),h - exx ;Main HLDEBC - ex af,af ;Alternate AF - dec a - jr z,CALL_END - ld 2(ix),c ;BC, DE, HL - ld 3(ix),b - ld 4(ix),e - ld 5(ix),d - ld 6(ix),l - ld 7(ix),h - dec a - jr z,CALL_END - exx ;Alternate HLDEBC - pop hl - ld 8(ix),l ;IX - ld 9(ix),h - push iy - pop hl - ld 10(ix),l ;IY - ld 11(ix),h - exx ;Main HLDEBC - ex af,af - pop ix - ret - CALL_END: - ex af,af - pop hl - pop ix - ret -;OUT_FLAGS: .db #0 -_AsmCallAlt_end:: - .area _CODE - .area _INITIALIZER - .area _CABS (ABS) diff --git a/releases/2.0 final/fdisk/fdisk.c b/releases/2.0 final/fdisk/fdisk.c deleted file mode 100644 index 3e5c0d6c..00000000 --- a/releases/2.0 final/fdisk/fdisk.c +++ /dev/null @@ -1,1589 +0,0 @@ -//FDISK - Disk partitionner for Nextor -//This is the main program. There is also an extra functions file (fdisk2.c) -//that is placed in the bank immediately following. -//To call functions on that bank, use CallFunctionInExtraBank. - -// SDCC compilation command line: -// -// sdcc --code-loc 0x4150 --data-loc 0x8000 -mz80 --disable-warning 196 --disable-warning 84 --no-std-crt0 fdisk_crt0.rel msxchar.lib asm.lib fdisk.c -// hex2bin -e dat fdisk.ihx -// -// Once compiled, embed the first 16000 bytes of fdisk.dat at position 82176 of the appropriate Nextor ROM file: -// dd if=fdisk.dat of=nextor.rom bs=1 count=16000 seek=82176 - -#include -#include -#include -#include -#include "asm.h" -#include "system.h" -#include "dos.h" -#include "types.h" -#include "partit.h" -#include "fdisk.h" -#include "asmcall.h" - -//#define FAKE_DEVICE_INFO -//#define FAKE_DRIVER_INFO -//#define FAKE_PARTITION_COUNT 256 - -/* -If FAKE_DEVICE_SIZE is defined, -simulated device size is provided by user: -_FDISK(sizeInK) -_FDISK(sizeInK, sizeInM) -_FDISK(sizeInK, sizeInM, sizeInG) -All the provided values are added up to get the simulated value. -Maximum value for each parameter is 32767. -*/ - -//#define FAKE_DEVICE_SIZE -//#define TEST_FAT_PARAMETERS - -#define MESSAGE_ROW 9 -#define PARTITIONS_PER_PAGE 15 - -#define CMD_FDISK 1 - -typedef struct { - byte screenMode; - byte screenWidth; - bool functionKeysVisible; -} ScreenConfiguration; - -char buffer[1000]; -driverInfo drivers[MAX_INSTALLED_DRIVERS]; -driverInfo* selectedDriver; -char selectedDriverName[50]; -lunInfo luns[MAX_LUNS_PER_DEVICE]; -lunInfo* selectedLun; -deviceInfo devices[MAX_DEVICES_PER_DRIVER]; -deviceInfo* currentDevice; -byte selectedDeviceIndex; -byte selectedLunIndex; -byte installedDriversCount; -bool availableDevicesCount; -byte availableLunsCount; -Z80_registers regs; -byte ASMRUT[4]; -byte OUT_FLAGS; -ScreenConfiguration originalScreenConfig; -ScreenConfiguration currentScreenConfig; -bool is80ColumnsDisplay; -byte screenLinesCount; -partitionInfo partitions[MAX_PARTITIONS_TO_HANDLE]; -int partitionsCount; -bool partitionsExistInDisk; -ulong unpartitionnedSpaceInSectors; -bool canCreatePartitions; -bool canDoDirectFormat; -ulong autoPartitionSizeInK; -ulong dividend, divisor; -bool dos1; -#ifdef FAKE_DEVICE_SIZE -ulong fakeDeviceSizeInK; -#endif - - -#define HideCursor() print("\x1Bx5") -#define DisplayCursor() print("\x1By5") -#define CursorDown() putchar('\x1F') -#define CursorUp() putchar('\x1E') -#define ClearScreen() putchar('\x0C') -#define HomeCursor() print("\x0D\x1BK") -#define DeleteToEndOfLine() print("\x1BK") -#define DeleteToEndOfLineAndCursorDown() print("\x1BK\x1F"); -#define NewLine() print("\x0A\x0D"); - - -void DoFdisk(); -void GoDriverSelectionScreen(); -void ShowDriverSelectionScreen(); -void ComposeSlotString(byte slot, char* destination); -void GoDeviceSelectionScreen(byte driverIndex); -void ShowDeviceSelectionScreen(); -void GetDevicesInformation(); -void EnsureMaximumStringLength(char* string, int maxLength); -void GoLunSelectionScreen(byte deviceIndex); -void InitializePartitionningVariables(byte lunIndex); -void ShowLunSelectionScreen(); -void PrintSize(ulong sizeInK); -byte GetRemainingBy1024String(ulong value, char* destination); -void GetLunsInformation(); -void PrintDeviceInfoWithIndex(); -void GoPartitionningMainMenuScreen(); -bool GetYesOrNo(); -byte GetDiskPartitionsInfo(); -void ShowPartitions(); -void PrintOnePartitionInfo(partitionInfo* info); -void DeleteAllPartitions(); -void RecalculateAutoPartitionSize(bool setToAllSpaceAvailable); -void AddPartition(); -void AddAutoPartition(); -void UndoAddPartition(); -void TestDeviceAccess(); -void InitializeScreenForTestDeviceAccess(char* message); -void PrintDosErrorMessage(byte code, char* header); -bool FormatWithoutPartitions(); -byte CreateFatFileSystem(ulong firstDeviceSector, ulong fileSystemSizeInK); -#ifdef TEST_FAT_PARAMETERS -void CalculateFatFileSystemParameters(ulong fileSystemSizeInK, dosFilesystemParameters* parameters); -#endif -bool WritePartitionTable(); -void PreparePartitionningProcess(); -byte CreatePartition(int index); -bool ConfirmDataDestroy(char* action); -void ClearInformationArea(); -void GetDriversInformation(); -void TerminateRightPaddedStringWithZero(char* string, byte length); -byte WaitKey(); -byte GetKey(); -void SaveOriginalScreenConfiguration(); -void ComposeWorkScreenConfiguration(); -void SetScreenConfiguration(ScreenConfiguration* screenConfig); -void InitializeWorkingScreen(char* header); -void PrintRuler(); -void Locate(byte x, byte y); -void LocateX(byte x); -void PrintCentered(char* string); -void PrintStateMessage(char* string); -void putchar(char ch); -void print(char* string); -int CallFunctionInExtraBank(int functionNumber, void* parametersBuffer); - -void main(int bc, int hl) -{ - ASMRUT[0] = 0xC3; //Code for JP - dos1 = (*((byte*)0xF313) == 0); - -#ifdef FAKE_DEVICE_SIZE - fakeDeviceSizeInK = 0; - if(*((char*)hl) == '(') { - hl++; - regs.Words.HL = hl; - regs.Words.IX = FRMEVL; - SwitchSystemBankThenCall(CALBAS, REGS_MAIN); - fakeDeviceSizeInK = *(int*)(DAC+2); - hl = regs.Words.HL; - if(*((char*)hl++) == ',') { - regs.Words.HL = hl; - regs.Words.IX = FRMEVL; - SwitchSystemBankThenCall(CALBAS, REGS_MAIN); - fakeDeviceSizeInK += (ulong)(*(int*)(DAC+2)) * (ulong)1024; - hl = regs.Words.HL; - if(*((char*)hl++) == ',') { - regs.Words.HL = hl; - regs.Words.IX = FRMEVL; - SwitchSystemBankThenCall(CALBAS, REGS_MAIN); - fakeDeviceSizeInK += (ulong)(*(int*)(DAC+2)) * (ulong)1024 * (ulong)1024; - hl = regs.Words.HL; - } - } - } -#endif -#ifdef TEST_FAT_PARAMETERS - CalculateFatFileSystemParameters(fakeDeviceSizeInK, (dosFilesystemParameters*)buffer); - printf("Total sectors: "); _ultoa(((dosFilesystemParameters*)buffer)->totalSectors, buffer+80, 10); printf("%s\r\n", buffer+80); - printf("Data sectors: "); _ultoa(((dosFilesystemParameters*)buffer)->dataSectors, buffer+80, 10); printf("%s\r\n", buffer+80); - printf("Cluster count: %u\r\n", ((dosFilesystemParameters*)buffer)->clusterCount); - printf("Sectors per FAT: %u\r\n", ((dosFilesystemParameters*)buffer)->sectorsPerFat); - printf("Sectors per cluster: %u\r\n", ((dosFilesystemParameters*)buffer)->sectorsPerCluster); - printf("Sectors per root dir: %u\r\n", ((dosFilesystemParameters*)buffer)->sectorsPerRootDirectory); - printf(((dosFilesystemParameters*)buffer)->isFat16 ? "FAT16\r\n" : "FAT12\r\n"); -#else - DoFdisk(); -#endif -} - - -void DoFdisk() -{ - installedDriversCount = 0; - selectedDeviceIndex = 0; - selectedLunIndex = 0; - availableLunsCount = 0; - - SaveOriginalScreenConfiguration(); - ComposeWorkScreenConfiguration(); - SetScreenConfiguration(¤tScreenConfig); - InitializeWorkingScreen("Nextor disk partitionning tool"); - - GoDriverSelectionScreen(); - - SetScreenConfiguration(&originalScreenConfig); -} - - -void GoDriverSelectionScreen() -{ - byte key; - - while(true) { - ShowDriverSelectionScreen(); - if(installedDriversCount == 0) { - return; - } - - while(true) { - key = WaitKey(); - if(key == ESC) { - return; - } else { - key -= '0'; - if(key >= 1 && key <= installedDriversCount) { - GoDeviceSelectionScreen(key); - break; - } - } - } - } -} - - -void ShowDriverSelectionScreen() -{ - byte i; - char slot[4]; - char rev[3]; - driverInfo* currentDriver; - byte slotByte; - byte revByte; - char* driverName; - - ClearInformationArea(); - - if(installedDriversCount == 0) { - GetDriversInformation(); - } - - if(installedDriversCount == 0) { - Locate(0, 7); - PrintCentered("There are no device-based drivers"); - CursorDown(); - PrintCentered("available in the system"); - PrintStateMessage("Press any key to exit..."); - WaitKey(); - return; - } - - currentDriver = &drivers[0]; - Locate(0,3); - for(i = 0; i < installedDriversCount; i++) { - ComposeSlotString(currentDriver->slot, slot); - - revByte = currentDriver->versionRev; - if(revByte == 0) { - rev[0] = '\0'; - } else { - rev[0] = '.'; - rev[1] = revByte + '0'; - rev[2] = '\0'; - } - - driverName = currentDriver->driverName; - - printf("\x1BK%i. %s%sv%i.%i%s on slot %s", - i + 1, - driverName, - is80ColumnsDisplay ? " " : "\x0D\x0A ", - currentDriver->versionMain, - currentDriver->versionSec, - rev, - slot); - - NewLine(); - if(is80ColumnsDisplay || installedDriversCount <= 4) { - NewLine(); - } - - currentDriver++; - } - - NewLine(); - print("ESC. Exit"); - - PrintStateMessage("Select the device driver"); -} - - -void ComposeSlotString(byte slot, char* destination) -{ - if((slot & 0x80) == 0) { - destination[0] = slot + '0'; - destination[1] = '\0'; - } else { - destination[0] = (slot & 3) + '0'; - destination[1] = '-'; - destination[2] = ((slot >> 2) & 3) + '0'; - destination[3] = '\0'; - } -} - - -void GoDeviceSelectionScreen(byte driverIndex) -{ - char slot[4]; - int i; - byte key; - - selectedDriver = &drivers[driverIndex - 1]; - ComposeSlotString(selectedDriver->slot, slot); - strcpy(selectedDriverName, selectedDriver->driverName); - if(!is80ColumnsDisplay) { - EnsureMaximumStringLength(selectedDriverName, MAX_LINLEN_MSX1 - 12); - } - sprintf(selectedDriverName + strlen(selectedDriverName), - " on slot %s\r\n", - slot); - - availableDevicesCount = 0; - - while(true) { - ShowDeviceSelectionScreen(); - if(availableDevicesCount == 0) { - return; - } - - while(true) { - key = WaitKey(); - if(key == ESC) { - return; - } else { - key -= '0'; - if(key >= 1 && key <= MAX_DEVICES_PER_DRIVER && devices[key - 1].lunCount != 0) { - GoLunSelectionScreen(key); - break; - } - } - } - } -} - - -void ShowDeviceSelectionScreen() -{ - deviceInfo* currentDevice; - byte i; - - ClearInformationArea(); - Locate(0,3); - print(selectedDriverName); - CursorDown(); - CursorDown(); - - if(availableDevicesCount == 0) { - GetDevicesInformation(); - } - - if(availableDevicesCount == 0) { - Locate(0, 9); - PrintCentered("There are no suitable devices"); - CursorDown(); - PrintCentered("attached to the driver"); - PrintStateMessage("Press any key to go back..."); - WaitKey(); - return; - } - - currentDevice = &devices[0]; - for(i = 0; i < MAX_DEVICES_PER_DRIVER; i++) { - if(currentDevice->lunCount > 0) { - printf("\x1BK%i. %s\r\n\r\n", - i + 1, - currentDevice->deviceName); - } - - currentDevice++; - } - - if(availableDevicesCount < 7) { - NewLine(); - } - print("ESC. Go back to driver selection screen"); - - PrintStateMessage("Select the device"); -} - - -void GetDevicesInformation() -{ - byte error = 0; - byte deviceIndex = 1; - deviceInfo* currentDevice = &devices[0]; - char* currentDeviceName; - -#ifdef FAKE_DEVICE_INFO - availableDevicesCount = 7; - devices[0].lunCount = 1; - strcpy(devices[0].deviceName, "Un dispositivo."); - devices[2].lunCount = 1; - strcpy(devices[2].deviceName, "Otro dispositivo con nombre mas larguillo, de 64 caracteres tal."); - EnsureMaximumStringLength(devices[2].deviceName, MAX_LINLEN_MSX1 - 4); - devices[1].lunCount = 1; - devices[3].lunCount = 2; - devices[4].lunCount = 3; - devices[5].lunCount = 4; - devices[6].lunCount = 5; - - *devices[1].deviceName = '\0'; - *devices[3].deviceName = '\0'; - *devices[4].deviceName = '\0'; - *devices[5].deviceName = '\0'; - *devices[6].deviceName = '\0'; - - return; -#else - availableDevicesCount = 0; - - while(deviceIndex <= MAX_DEVICES_PER_DRIVER) { - currentDeviceName = currentDevice->deviceName; - regs.Bytes.A = deviceIndex; - regs.Bytes.B = 0; - regs.Words.HL = (int)currentDevice; - DriverCall(selectedDriver->slot, DEV_INFO); - if(regs.Bytes.A == 0) { - availableDevicesCount++; - regs.Bytes.A = deviceIndex; - regs.Bytes.B = 2; - regs.Words.HL = (int)currentDeviceName; - DriverCall(selectedDriver->slot, DEV_INFO); - //memcpy(currentDeviceName, "Device name with 40 characters lorem ips", 40); //!!! - if(regs.Bytes.A == 0) { - TerminateRightPaddedStringWithZero(currentDeviceName, MAX_INFO_LENGTH); - } else { - sprintf(currentDeviceName, "(Unnamed device, ID=%i)", deviceIndex); - } - if(!is80ColumnsDisplay) { - EnsureMaximumStringLength(currentDeviceName, MAX_LINLEN_MSX1 - 4); - } - } else { - currentDevice->lunCount = 0; - } - - deviceIndex++; - currentDevice++; - } -#endif -} - - -void EnsureMaximumStringLength(char* string, int maxLength) -{ - int len = strlen(string); - if(len > maxLength) { - string += maxLength - 3; - *string++ = '.'; - *string++ = '.'; - *string++ = '.'; - *string = '\0'; - } -} - - -void GoLunSelectionScreen(byte deviceIndex) -{ - int i; - byte key; - - currentDevice = &devices[deviceIndex - 1]; - selectedDeviceIndex = deviceIndex; - - availableLunsCount = 0; - - while(true) { - ShowLunSelectionScreen(); - if(availableLunsCount == 0) { - return; - } - - while(true) { - key = WaitKey(); - if(key == ESC) { - return; - } else { - key -= '0'; - if(key >= 1 && key <= MAX_LUNS_PER_DEVICE && luns[key - 1].suitableForPartitionning) { - InitializePartitionningVariables(key); - GoPartitionningMainMenuScreen(); - break; - } - } - } - } -} - - -void InitializePartitionningVariables(byte lunIndex) -{ - selectedLunIndex = lunIndex - 1; - selectedLun = &luns[selectedLunIndex]; - partitionsCount = 0; - partitionsExistInDisk = true; - canCreatePartitions = (selectedLun->sectorCount >= (MIN_DEVICE_SIZE_FOR_PARTITIONS_IN_K * 2)); - canDoDirectFormat = (selectedLun->sectorCount <= MAX_DEVICE_SIZE_FOR_DIRECT_FORMAT_IN_K * 2); - unpartitionnedSpaceInSectors = selectedLun->sectorCount; - RecalculateAutoPartitionSize(true); -} - - -void ShowLunSelectionScreen() -{ - byte i; - lunInfo* currentLun; - - ClearInformationArea(); - Locate(0,3); - print(selectedDriverName); - print(currentDevice->deviceName); - PrintDeviceInfoWithIndex(); - NewLine(); - NewLine(); - NewLine(); - - if(availableLunsCount == 0) { - GetLunsInformation(); - } - - if(availableLunsCount == 0) { - Locate(0, 9); - PrintCentered("There are no suitable logical units"); - CursorDown(); - PrintCentered("available in the device"); - PrintStateMessage("Press any key to go back..."); - WaitKey(); - return; - } - - currentLun = &luns[0]; - for(i = 0; i < MAX_LUNS_PER_DEVICE; i++) { - if(currentLun->suitableForPartitionning) { - printf("\x1BK%i. Size: ", i + 1); - PrintSize(currentLun->sectorCount / 2); - NewLine(); - } - - i++; - currentLun++; - } - - NewLine(); - NewLine(); - print("ESC. Go back to device selection screen"); - - PrintStateMessage("Select the logical unit"); -} - - -void PrintSize(ulong sizeInK) -{ - byte remaining; - char buf[3]; - ulong dividedSize; - char* remString; - - if(sizeInK < (ulong)(10 * 1024)) { - printf("%iK", sizeInK); - return; - } - - dividedSize = sizeInK >> 10; - if(dividedSize < (ulong)(10 * 1024)) { - printf("%i", dividedSize + GetRemainingBy1024String(sizeInK, buf)); - printf("%sM", buf); - } else { - sizeInK >>= 10; - dividedSize = sizeInK >> 10; - printf("%i", dividedSize + GetRemainingBy1024String(sizeInK, buf)); - printf("%sG", buf); - } -} - - -byte GetRemainingBy1024String(ulong value, char* destination) -{ - byte remaining2; - char remainingDigit; - - int remaining = value & 0x3FF; - if(remaining >= 950) { - *destination = '\0'; - return 1; - } - remaining2 = remaining % 100; - remainingDigit = (remaining / 100) + '0'; - if(remaining2 >= 50) { - remainingDigit++; - } - - if(remainingDigit == '0') { - *destination = '\0'; - } else { - destination[0] = '.'; - destination[1] = remainingDigit; - destination[2] = '\0'; - } - - return 0; -} - - -void GetLunsInformation() -{ - byte error = 0; - byte lunIndex = 1; - lunInfo* currentLun = &luns[0]; - char* currentDeviceName; - - while(lunIndex <= MAX_LUNS_PER_DEVICE) { - regs.Bytes.A = selectedDeviceIndex; - regs.Bytes.B = lunIndex; - regs.Words.HL = (int)currentLun; - DriverCall(selectedDriver->slot, LUN_INFO); -#ifdef FAKE_DEVICE_SIZE - if(fakeDeviceSizeInK != 0) { - currentLun->sectorCount = fakeDeviceSizeInK * 2; - } -#endif - currentLun->suitableForPartitionning = - (regs.Bytes.A == 0) && - (currentLun->mediumType == BLOCK_DEVICE) && - (currentLun->sectorSize == 512) && - (currentLun->sectorCount >= MIN_DEVICE_SIZE_IN_K * 2) && - ((currentLun->flags & (READ_ONLY_LUN | FLOPPY_DISK_LUN)) == 0); - if(currentLun->suitableForPartitionning) { - availableLunsCount++; - } - - if(currentLun->sectorsPerTrack == 0 || currentLun->sectorsPerTrack > EXTRA_PARTITION_SECTORS) { - currentLun->sectorsPerTrack = EXTRA_PARTITION_SECTORS; - } - - lunIndex++; - currentLun++; - } -} - - -void PrintDeviceInfoWithIndex() -{ - printf(is80ColumnsDisplay ? " (Id = %i)" : " (%i)", selectedDeviceIndex); -} - - -void PrintTargetInfo() -{ - Locate(0,3); - print(selectedDriverName); - print(currentDevice->deviceName); - PrintDeviceInfoWithIndex(); - NewLine(); - printf("Logical unit %i, size: ", selectedLunIndex + 1); - PrintSize(selectedLun->sectorCount / 2); - NewLine(); -} - - -void GoPartitionningMainMenuScreen() -{ - char key; - byte error; - bool canAddPartitionsNow; - bool mustRetrievePartitionInfo = true; - - while(true) { - if(mustRetrievePartitionInfo) { - ClearInformationArea(); - PrintTargetInfo(); - - if(canCreatePartitions) { - Locate(0, MESSAGE_ROW); - PrintCentered("Searching partitions..."); - PrintStateMessage("Please wait..."); - error = GetDiskPartitionsInfo(); - if(error != 0) { - PrintDosErrorMessage(error, "Error when searching partitions:"); - PrintStateMessage("Manage device anyway? (y/n) "); - if(!GetYesOrNo()) { - return; - } - } - partitionsExistInDisk = (partitionsCount > 0); - } - mustRetrievePartitionInfo = false; - } - - ClearInformationArea(); - PrintTargetInfo(); - if(!partitionsExistInDisk) { - print("Unpartitionned space available: "); - PrintSize(unpartitionnedSpaceInSectors / 2); - NewLine(); - } - NewLine(); - - printf("Changes are not committed%suntil W is pressed.\r\n" - "\r\n", is80ColumnsDisplay ? " " : "\r\n"); - - if(partitionsCount > 0) { - printf("S. Show partitions (%i %s)\r\n" - "D. Delete all partitions\r\n", - partitionsCount, - partitionsExistInDisk ? "found" : "defined"); - } else if(canCreatePartitions) { - print("(No partitions found or defined)\r\n"); - } - canAddPartitionsNow = - !partitionsExistInDisk && - canCreatePartitions && - unpartitionnedSpaceInSectors >= (MIN_REMAINING_SIZE_FOR_NEW_PARTITIONS_IN_K * 2) + (EXTRA_PARTITION_SECTORS) && - partitionsCount < MAX_PARTITIONS_TO_HANDLE; - if(canAddPartitionsNow) { - print("A. Add one "); - PrintSize(autoPartitionSizeInK); - print(" partition\r\n"); - print("P. Add partition...\r\n"); - } - if(!partitionsExistInDisk && partitionsCount > 0) { - print("U. Undo add "); - PrintSize(partitions[partitionsCount - 1].sizeInK); - print(" partition\r\n"); - } - NewLine(); - if(canDoDirectFormat) { - print("F. Format device without partitions\r\n\r\n"); - } - if(!partitionsExistInDisk && partitionsCount > 0) { - print("W. Write partitions to disk\r\n\r\n"); - } - print("T. Test device access\r\n"); - - PrintStateMessage("Select an option or press ESC to return"); - - while((key = WaitKey()) == 0); - if(key == ESC) { - if(partitionsExistInDisk || partitionsCount == 0) { - return; - } - PrintStateMessage("Discard changes and return? (y/n) "); - if(GetYesOrNo()) { - return; - } else { - continue; - } - } - key |= 32; - if(key == 's' && partitionsCount > 0) { - ShowPartitions(); - } else if(key == 'd' && partitionsCount > 0) { - DeleteAllPartitions(); - } else if(key == 'p' && canAddPartitionsNow > 0) { - AddPartition(); - } else if(key == 'a' && canAddPartitionsNow > 0) { - AddAutoPartition(); - } else if(key == 'u' && !partitionsExistInDisk && partitionsCount > 0) { - UndoAddPartition(); - }else if(key == 't') { - TestDeviceAccess(); - } else if(key == 'f' && canDoDirectFormat) { - if(FormatWithoutPartitions()) { - mustRetrievePartitionInfo = true; - } - }else if(key == 'w' && !partitionsExistInDisk && partitionsCount > 0) { - if(WritePartitionTable()) { - mustRetrievePartitionInfo = true; - } - } - } -} - - -bool GetYesOrNo() -{ - char key; - - DisplayCursor(); - key = WaitKey() | 32; - HideCursor(); - return key == 'y'; -} - - -byte GetDiskPartitionsInfo() -{ - byte primaryIndex = 1; - byte extendedIndex = 0; - int i; - byte error; - partitionInfo* currentPartition = &partitions[0]; - -#ifdef FAKE_PARTITION_COUNT - partitionsCount = FAKE_PARTITION_COUNT; - for(i = 1; i <= FAKE_PARTITION_COUNT; i++) { - currentPartition->primaryIndex = 1; - currentPartition->extendedIndex = i; - currentPartition->partitionType = i & 0xFF; - currentPartition->sizeInK = (ulong)i * (ulong)1024 * (ulong)1024; - currentPartition++; - } - return 0; -#else - partitionsCount = 0; - - do { - regs.Bytes.A = selectedDriver->slot; - regs.Bytes.B = 0xFF; - regs.Bytes.D = selectedDeviceIndex; - regs.Bytes.E = selectedLunIndex + 1; - regs.Bytes.H = primaryIndex; - regs.Bytes.L = extendedIndex; - DosCall(_GPART, REGS_ALL); - error = regs.Bytes.A; - if(error == 0) { - if(regs.Bytes.B == PARTYPE_EXTENDED) { - extendedIndex = 1; - } else { - currentPartition->primaryIndex = primaryIndex; - currentPartition->extendedIndex = extendedIndex; - currentPartition->partitionType = regs.Bytes.B; - ((uint*)&(currentPartition->sizeInK))[0] = regs.UWords.IY; - ((uint*)&(currentPartition->sizeInK))[1] = regs.UWords.IX; - currentPartition->sizeInK /= 2; - partitionsCount++; - currentPartition++; - extendedIndex++; - } - } else if(error == _IPART) { - primaryIndex++; - extendedIndex = 0; - } else { - return error; - } - } while(primaryIndex <= 4 && partitionsCount < MAX_PARTITIONS_TO_HANDLE); - - return 0; -#endif -} - - -void ShowPartitions() -{ - int i; - int firstShownPartitionIndex = 1; - int lastPartitionIndexToShow; - bool isLastPage; - bool isFirstPage; - byte key; - partitionInfo* currentPartition; - - Locate(0, screenLinesCount-1); - DeleteToEndOfLine(); - PrintCentered("Press ESC to return"); - - while(true) { - isFirstPage = (firstShownPartitionIndex == 1); - isLastPage = (firstShownPartitionIndex + PARTITIONS_PER_PAGE) > partitionsCount; - lastPartitionIndexToShow = isLastPage ? partitionsCount : firstShownPartitionIndex + PARTITIONS_PER_PAGE - 1; - - Locate(0, screenLinesCount-1); - print(isFirstPage ? " " : "<--"); - - Locate(currentScreenConfig.screenWidth - 4, screenLinesCount-1); - print(isLastPage ? " " : "-->"); - - ClearInformationArea(); - Locate(0, 3); - if(partitionsCount == 1) { - PrintCentered(partitionsExistInDisk ? "One partition found on device" : "One new partition defined"); - } else { - sprintf(buffer, partitionsExistInDisk ? "%i partitions found on device" : "%i new partitions defined", partitionsCount); - PrintCentered(buffer); - } - NewLine(); - if(partitionsCount > PARTITIONS_PER_PAGE) { - sprintf(buffer, "Displaying partitions %i - %i", - firstShownPartitionIndex, - lastPartitionIndexToShow); - PrintCentered(buffer); - NewLine(); - } - NewLine(); - - currentPartition = &partitions[firstShownPartitionIndex - 1]; - - for(i = firstShownPartitionIndex; i <= lastPartitionIndexToShow; i++) { - PrintOnePartitionInfo(currentPartition); - currentPartition++; - } - - while(true) { - key = WaitKey(); - if(key == ESC) { - return; - } else if(key == CURSOR_LEFT && !isFirstPage) { - firstShownPartitionIndex -= PARTITIONS_PER_PAGE; - break; - } else if(key == CURSOR_RIGHT && !isLastPage) { - firstShownPartitionIndex += PARTITIONS_PER_PAGE; - break; - } - } - } -} - - -void PrintOnePartitionInfo(partitionInfo* info) -{ - if(!partitionsExistInDisk && partitionsCount <= 4) { - putchar(info->primaryIndex == 1 ? '1' : info->extendedIndex + 1 + '0'); - } else { - putchar(info->primaryIndex + '0'); - if(info->extendedIndex != 0) { - printf("-%i", info->extendedIndex); - } - } - print(": "); - if(info->partitionType == PARTYPE_FAT12) { - print("FAT12"); - } else if(info->partitionType == PARTYPE_FAT16) { - print("FAT16"); - } else if(info->partitionType == 0xB || info->partitionType == 0xC) { - print("FAT32"); - } else if(info->partitionType == 7) { - print("NTFS"); - } else { - printf("Type #%x", info->partitionType); - } - print(", "); - PrintSize(info->sizeInK); - NewLine(); -} - - -void DeleteAllPartitions() -{ - sprintf(buffer, "Discard all %s partitions? (y/n) ", partitionsExistInDisk ? "existing" : "defined"); - PrintStateMessage(buffer); - if(!GetYesOrNo()) { - return; - } - - partitionsCount = 0; - partitionsExistInDisk = false; - unpartitionnedSpaceInSectors = selectedLun->sectorCount; - RecalculateAutoPartitionSize(true); -} - - -void RecalculateAutoPartitionSize(bool setToAllSpaceAvailable) -{ - ulong maxAbsolutePartitionSizeInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; - - if(setToAllSpaceAvailable) { - autoPartitionSizeInK = maxAbsolutePartitionSizeInK; - } - - if(autoPartitionSizeInK > MAX_FAT16_PARTITION_SIZE_IN_K) { - autoPartitionSizeInK = MAX_FAT16_PARTITION_SIZE_IN_K; - } else if(!setToAllSpaceAvailable && autoPartitionSizeInK > maxAbsolutePartitionSizeInK) { - autoPartitionSizeInK = maxAbsolutePartitionSizeInK; - } - - if(autoPartitionSizeInK < MIN_PARTITION_SIZE_IN_K) { - autoPartitionSizeInK = MIN_PARTITION_SIZE_IN_K; - } else if(autoPartitionSizeInK > maxAbsolutePartitionSizeInK) { - autoPartitionSizeInK = maxAbsolutePartitionSizeInK; - } - - if(dos1 && autoPartitionSizeInK > 16*1024) { - autoPartitionSizeInK = 16*1024; - } -} - - -void AddPartition() -{ - uint maxPartitionSizeInM; - uint maxPartitionSizeInK; - byte lineLength; - char* pointer; - char ch; - bool validNumberEntered = false; - ulong enteredSizeInK; - bool lessThan1MAvailable; - bool sizeInKSpecified; - ulong unpartitionnedSpaceExceptAlignmentInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; - - maxPartitionSizeInM = (uint)((unpartitionnedSpaceInSectors / 2) >> 10); - maxPartitionSizeInK = unpartitionnedSpaceExceptAlignmentInK > (ulong)32767 ? (uint)32767 : unpartitionnedSpaceExceptAlignmentInK; - - lessThan1MAvailable = (maxPartitionSizeInM == 0); - - if(maxPartitionSizeInM > (ulong)MAX_FAT16_PARTITION_SIZE_IN_M) { - maxPartitionSizeInM = MAX_FAT16_PARTITION_SIZE_IN_M; - } - - PrintStateMessage("Enter size or press ENTER to cancel"); - - while(!validNumberEntered) { - sizeInKSpecified = true; - ClearInformationArea(); - PrintTargetInfo(); - NewLine(); - print("Add new partition\r\n\r\n"); - - if(dos1) { - printf("WARNING: only partitions of 16M or less%scan be used in DOS 1 mode\r\n\r\n", - is80ColumnsDisplay ? " " : "\r\n"); - } - - if(lessThan1MAvailable) { - print("Enter"); - } else { - printf("Enter partition size in MB (1-%i)\r\nor", - maxPartitionSizeInM); - } - printf(" partition size in KB followed by%s\"K\" (%i-%i): ", - is80ColumnsDisplay ? " " : "\r\n", - MIN_PARTITION_SIZE_IN_K, - maxPartitionSizeInK); - - buffer[0] = 6; - regs.Words.DE = (int)buffer; - DosCall(_BUFIN, REGS_NONE); - lineLength = buffer[1]; - if(lineLength == 0) { - return; - } - - pointer = buffer + 2; - pointer[lineLength] = '\0'; - enteredSizeInK = 0; - while(true) { - ch = (*pointer++) | 32; - if(ch == 'k') { - validNumberEntered = true; - break; - } else if(ch == '\0' || ch == 13 || ch == 'm') { - validNumberEntered = true; - enteredSizeInK *= 1024; - sizeInKSpecified = false; - break; - } else if(ch < '0' || ch > '9') { - break; - } - enteredSizeInK = (enteredSizeInK * 10) + (ch - '0'); - - lineLength--; - if(lineLength == 0) { - validNumberEntered = true; - enteredSizeInK *= 1024; - sizeInKSpecified = false; - break; - } - } - - if(validNumberEntered && - (sizeInKSpecified && (enteredSizeInK > maxPartitionSizeInK) || (enteredSizeInK < MIN_PARTITION_SIZE_IN_K)) || - (!sizeInKSpecified && (enteredSizeInK > ((ulong)maxPartitionSizeInM * (ulong)1024))) - ) { - validNumberEntered = false; - } - } - - autoPartitionSizeInK = enteredSizeInK > unpartitionnedSpaceExceptAlignmentInK ? unpartitionnedSpaceExceptAlignmentInK : enteredSizeInK; - AddAutoPartition(); - unpartitionnedSpaceExceptAlignmentInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; - autoPartitionSizeInK = enteredSizeInK > unpartitionnedSpaceExceptAlignmentInK ? unpartitionnedSpaceExceptAlignmentInK : enteredSizeInK; - RecalculateAutoPartitionSize(false); -} - - -void AddAutoPartition() -{ - partitionInfo* partition = &partitions[partitionsCount]; - - partition->sizeInK = autoPartitionSizeInK; - partition->partitionType = - partition->sizeInK > MAX_FAT12_PARTITION_SIZE_IN_K ? PARTYPE_FAT16 : PARTYPE_FAT12; - if(partitionsCount == 0) { - partition->primaryIndex = 1; - partition->extendedIndex = 0; - } else { - partition->primaryIndex = 2; - partition->extendedIndex = partitionsCount; - } - - unpartitionnedSpaceInSectors -= (autoPartitionSizeInK * 2); - unpartitionnedSpaceInSectors -= EXTRA_PARTITION_SECTORS; - partitionsCount++; - RecalculateAutoPartitionSize(false); -} - - -void UndoAddPartition() -{ - partitionInfo* partition = &partitions[partitionsCount - 1]; - autoPartitionSizeInK = partition->sizeInK; - unpartitionnedSpaceInSectors += (partition->sizeInK * 2); - unpartitionnedSpaceInSectors += EXTRA_PARTITION_SECTORS; - partitionsCount--; - RecalculateAutoPartitionSize(false); -} - - -void TestDeviceAccess() -{ - ulong sectorNumber = 0; - char* message = "Now reading device sector "; - byte messageLen = strlen(message); - byte error; - char* errorMessageHeader = "Error when reading sector "; - - InitializeScreenForTestDeviceAccess(message); - - while(GetKey() == 0) { - _ultoa(sectorNumber, buffer, 10); - Locate(messageLen, MESSAGE_ROW); - print(buffer); - print(" ...\x1BK"); - - regs.Flags.C = 0; - regs.Bytes.A = selectedDeviceIndex; - regs.Bytes.B = 1; - regs.Bytes.C = selectedLunIndex + 1; - regs.Words.HL = (int)buffer; - regs.Words.DE = (int)§orNumber; - DriverCall(selectedDriver->slot, DEV_RW); - - if((error = regs.Bytes.A) != 0) { - strcpy(buffer, errorMessageHeader); - _ultoa(sectorNumber, buffer + strlen(errorMessageHeader), 10); - strcpy(buffer + strlen(buffer), ":"); - PrintDosErrorMessage(error, buffer); - PrintStateMessage("Continue reading sectors? (y/n) "); - if(!GetYesOrNo()) { - return; - } - InitializeScreenForTestDeviceAccess(message); - } - - sectorNumber++; - if(sectorNumber >= selectedLun->sectorCount) { - sectorNumber = 0; - } - } -} - - -void InitializeScreenForTestDeviceAccess(char* message) -{ - ClearInformationArea(); - PrintTargetInfo(); - Locate(0, MESSAGE_ROW); - print(message); - PrintStateMessage("Press any key to stop..."); -} - - -void PrintDosErrorMessage(byte code, char* header) -{ - Locate(0, MESSAGE_ROW); - PrintCentered(header); - NewLine(); - - regs.Bytes.B = code; - regs.Words.DE = (int)buffer; - DosCall(_EXPLAIN, REGS_NONE); - if(strlen(buffer) > currentScreenConfig.screenWidth) { - print(buffer); - } else { - PrintCentered(buffer); - } - - PrintStateMessage("Press any key to return..."); -} - - -void PrintDone() -{ - PrintCentered("Done!"); - print("\x0A\x0D\x0A\x0A\x0A"); - PrintCentered("If this device had drives mapped to,"); - NewLine(); - PrintCentered("please reset the computer."); -} - -bool FormatWithoutPartitions() -{ - dosFilesystemParameters parameters; - byte error; - - if(!ConfirmDataDestroy("Format device without partitions")) { - return false; - } - - ClearInformationArea(); - PrintTargetInfo(); - Locate(0, MESSAGE_ROW); - PrintCentered("Formatting the device..."); - PrintStateMessage("Please wait..."); - -#ifdef TEST_FAT_PARAMETERS - CalculateFatFileSystemParameters(selectedLun->sectorCount / 2, ¶meters); - WaitKey(); - return 0; -#else - error = CreateFatFileSystem(0, selectedLun->sectorCount / 2); - if(error == 0) { - Locate(0, MESSAGE_ROW + 2); - PrintDone(); - PrintStateMessage("Press any key to return..."); - } else { - PrintDosErrorMessage(error, "Error when formatting device:"); - } - WaitKey(); - return (error == 0); -#endif -} - - -byte CreateFatFileSystem(ulong firstDeviceSector, ulong fileSystemSizeInK) -{ - byte* remoteCallParams = buffer; - - remoteCallParams[0] = selectedDriver->slot; - remoteCallParams[1] = selectedDeviceIndex; - remoteCallParams[2] = selectedLunIndex + 1; - *((ulong*)&remoteCallParams[3]) = 0; - *((ulong*)&remoteCallParams[7]) = selectedLun->sectorCount / 2; - - return (byte)CallFunctionInExtraBank(f_CreateFatFileSystem, remoteCallParams); -} - - -#ifdef TEST_FAT_PARAMETERS -void CalculateFatFileSystemParameters(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -{ - byte remoteCallParams[6]; - *((ulong*)&remoteCallParams[0]) = fileSystemSizeInK; - *((int*)&remoteCallParams[4]) = (int)parameters; - CallFunctionInExtraBank(f_CalculateFatFileSystemParameters, remoteCallParams); -} -#endif - - -bool WritePartitionTable() -{ - //http://www.rayknights.org/pc_boot/ext_tbls.htm - - int i; - //masterBootRecord* mbr = (masterBootRecord*)buffer + 80; - byte error; - - if(partitionsCount <= 4) { - sprintf(buffer, "Create %i primary partitions on device", partitionsCount); - } else { - sprintf(buffer, "Create %i partitions on device", partitionsCount); - } - if(!ConfirmDataDestroy(buffer)) { - return false; - } - - ClearInformationArea(); - PrintTargetInfo(); - PrintStateMessage("Please wait..."); - - Locate(0, MESSAGE_ROW); - PrintCentered("Preparing partitionning process..."); - PreparePartitionningProcess(); - - for(i = 0; i < partitionsCount; i++) { - Locate(0, MESSAGE_ROW); - sprintf(buffer, "Creating partition %i of %i ...", i + 1, partitionsCount); - PrintCentered(buffer); - - error = CreatePartition(i); - if(error != 0) { - sprintf(buffer, "Error when creating partition %i :", i + 1); - PrintDosErrorMessage(error, buffer); - WaitKey(); - return false; - } - - - } - - Locate(0, MESSAGE_ROW + 2); - PrintDone(); - PrintStateMessage("Press any key to return..."); - WaitKey(); - return true; -} - - -void PreparePartitionningProcess() -{ - byte* remoteCallParams = buffer; - - remoteCallParams[0] = selectedDriver->slot; - remoteCallParams[1] = selectedDeviceIndex; - remoteCallParams[2] = selectedLunIndex + 1; - *((uint*)&remoteCallParams[3]) = partitionsCount; - *((partitionInfo**)&remoteCallParams[5]) = &partitions[0]; - *((uint*)&remoteCallParams[7]) = luns[selectedLunIndex].sectorsPerTrack; - - CallFunctionInExtraBank(f_PreparePartitionningProcess, remoteCallParams); -} - - -byte CreatePartition(int index) -{ - byte* remoteCallParams = buffer; - - *((uint*)&remoteCallParams[0]) = index; - - return (byte)CallFunctionInExtraBank(f_CreatePartition, remoteCallParams); -} - - -bool ConfirmDataDestroy(char* action) -{ - char* spaceOrNewLine = is80ColumnsDisplay ? " " : "\r\n"; - - PrintStateMessage(""); - ClearInformationArea(); - PrintTargetInfo(); - Locate(0, MESSAGE_ROW); - - printf("%s\r\n" - "\r\n" - "THIS WILL DESTROY%sALL DATA ON THE DEVICE!!\r\n" - "This action can't be cancelled%sand can't be undone\r\n" - "\r\n" - "Are you sure? (y/n) ", - action, - spaceOrNewLine, - spaceOrNewLine); - - return GetYesOrNo(); -} - - -void ClearInformationArea() -{ - int i; - - Locate(0, 2); - for(i = 0; i < screenLinesCount - 4; i++) { - DeleteToEndOfLineAndCursorDown(); - } -} - - -void GetDriversInformation() -{ - byte error = 0; - byte driverIndex = 1; - driverInfo* currentDriver = &drivers[0]; - - installedDriversCount = 0; - -#ifdef FAKE_DRIVER_INFO - strcpy(currentDriver->driverName, "Un drivercillo de nada "); - currentDriver->slot = 1; - currentDriver->flags = 0xFF; - currentDriver->versionMain = 2; - currentDriver->versionSec = 34; - currentDriver->versionRev = 5; - - currentDriver++; - strcpy(currentDriver->driverName, "Otro driver, este de 32 caracter"); - currentDriver->slot = 0x8E; - currentDriver->flags = 0xFF; - currentDriver->versionMain = 2; - currentDriver->versionSec = 34; - currentDriver->versionRev = 0; - - installedDriversCount = 2; - return; -#else - - while(error == 0 && driverIndex <= MAX_INSTALLED_DRIVERS) { - regs.Bytes.A = driverIndex; - regs.Words.HL = (int)currentDriver; - DosCall(_GDRVR, REGS_AF); - if((error = regs.Bytes.A) == 0 && (currentDriver->flags & (DRIVER_IS_DOS250 | DRIVER_IS_DEVICE_BASED) == (DRIVER_IS_DOS250 | DRIVER_IS_DEVICE_BASED))) { - installedDriversCount++; - TerminateRightPaddedStringWithZero(currentDriver->driverName, DRIVER_NAME_LENGTH); - currentDriver++; - } - driverIndex++; - } -#endif -} - - -void TerminateRightPaddedStringWithZero(char* string, byte length) -{ - char* pointer = string + length - 1; - while(*pointer == ' ' && length > 0) { - pointer--; - length--; - } - pointer[1] = '\0'; -} - - -byte WaitKey() -{ - byte key; - - while((key = GetKey()) == 0); - return key; -} - - -byte GetKey() -{ - regs.Bytes.E = 0xFF; - DosCall(_DIRIO, REGS_AF); - return regs.Bytes.A; -} - - -void SaveOriginalScreenConfiguration() -{ - originalScreenConfig.screenMode = *(byte*)SCRMOD; - originalScreenConfig.screenWidth = *(byte*)LINLEN; - originalScreenConfig.functionKeysVisible = (*(byte*)CNSDFG != 0); -} - - -void ComposeWorkScreenConfiguration() -{ - currentScreenConfig.screenMode = 0; - currentScreenConfig.screenWidth = (*(byte*)LINLEN <= MAX_LINLEN_MSX1 ? MAX_LINLEN_MSX1 : MAX_LINLEN_MSX2); - currentScreenConfig.functionKeysVisible = false; - is80ColumnsDisplay = (currentScreenConfig.screenWidth == MAX_LINLEN_MSX2); - screenLinesCount = *(byte*)CRTCNT; -} - - -void SetScreenConfiguration(ScreenConfiguration* screenConfig) -{ - if(screenConfig->screenMode == 0) { - *((byte*)LINL40) = screenConfig->screenWidth; - AsmCall(INITXT, ®s, REGS_NONE, REGS_NONE); - } else { - *((byte*)LINL32) = screenConfig->screenWidth; - AsmCall(INIT32, ®s, REGS_NONE, REGS_NONE); - } - - AsmCall(screenConfig->functionKeysVisible ? DSPFNK : ERAFNK, ®s, REGS_NONE, REGS_NONE); -} - - -void InitializeWorkingScreen(char* header) -{ - ClearScreen(); - PrintCentered(header); - CursorDown(); - PrintRuler(); - Locate(0, screenLinesCount - 2); - PrintRuler(); -} - - -void PrintRuler() -{ - int i; - - HomeCursor(); - for(i = 0; i < currentScreenConfig.screenWidth; i++) { - putchar('-'); - } -} - - -void Locate(byte x, byte y) -{ - regs.Bytes.H = x + 1; - regs.Bytes.L = y + 1; - AsmCall(POSIT, ®s, REGS_MAIN, REGS_NONE); -} - - -void LocateX(byte x) -{ - regs.Bytes.H = x + 1; - regs.Bytes.L = *(byte*)CSRY; - AsmCall(POSIT, ®s, REGS_MAIN, REGS_NONE); -} - - -void PrintCentered(char* string) -{ - byte pos = (currentScreenConfig.screenWidth - strlen(string)) / 2; - HomeCursor(); - LocateX(pos); - print(string); -} - - -void PrintStateMessage(char* string) -{ - Locate(0, screenLinesCount-1); - DeleteToEndOfLine(); - print(string); -} - - -void putchar(char ch) __naked -{ - __asm - push ix - ld ix,#4 - add ix,sp - ld a,(ix) - call CHPUT - pop ix - ret - __endasm; -} - - -void print(char* string) __naked -{ - __asm - push ix - ld ix,#4 - add ix,sp - ld l,(ix) - ld h,1(ix) -PRLOOP: - ld a,(hl) - or a - jr z,PREND - call CHPUT - inc hl - jr PRLOOP -PREND: - pop ix - ret - __endasm; -} - - -// function number is defined in fdisk.h -int CallFunctionInExtraBank(int functionNumber, void* parametersBuffer) -{ - regs.Bytes.A = (*((byte*)0x40ff)) + 1; //Extra functions bank = our bank + 1 - regs.Words.BC = functionNumber; - regs.Words.HL = (int)parametersBuffer; - regs.Words.IX = (int)0x4100; //Address of "main" for extra functions program - AsmCall(CALBNK, ®s, REGS_ALL, REGS_MAIN); - return regs.Words.HL; -} - - -#include "asmcall.c" \ No newline at end of file diff --git a/releases/2.0 final/fdisk/fdisk.dat b/releases/2.0 final/fdisk/fdisk.dat deleted file mode 100644 index eba97041..00000000 Binary files a/releases/2.0 final/fdisk/fdisk.dat and /dev/null differ diff --git a/releases/2.0 final/fdisk/fdisk.ihx b/releases/2.0 final/fdisk/fdisk.ihx deleted file mode 100644 index 52d62a6c..00000000 --- a/releases/2.0 final/fdisk/fdisk.ihx +++ /dev/null @@ -1,453 +0,0 @@ -:2041200021738836C33A13F3B720043E011801AF329591C336412164883600216288360032 -:2041400021638836002166883600CD4B6ACD656A217B88E5CD9B6A216B41E3CD146BF1CD25 -:204160008A41217888E5CD9B6AF1C94E6578746F72206469736B20706172746974696F6E9D -:204180006E696E6720746F6F6C00CDB4413A6488B7C8CD316A557AD61BC81801C97AC6D04C -:2041A00057D60138ED3A64889238E7D533CD71443318D7C9DDE5DD210000DD3921E2FF394F -:2041C000F9CD50693A6488B72003CD87693A6488B7202B210007E5CD6E6B218C43E3CDBD6B -:2041E0006B261FE333CD236C3321AE43E5CDBD6B21C643E3CD016CF1CD316AC38743210030 -:2042000003E5CD6E6BF121050039DD75FEDD74FFDD7EFEDD77FCDD7EFFDD77FD2102003970 -:20422000DD75FADD74FBDD36F808DD36F984DD36EB00216488DD7EEB96D27143DD5EFEDDC0 -:2042400056FFDD6EF8DD66F966D5E533CD2B44F133DD6EF8DD66F911070019567AB7200A76 -:20426000DD6EFADD66FB3600181DDD6EFADD66FB362EDD6EFADD66FB237AC63077DD4EFAB7 -:20428000DD46FB0303AF02DD7EF8C608DD77E2DD7EF9CE00DD77E3DD7EFCDD77F6DD7EFDA0 -:2042A000DD77F7DD7EFADD77F4DD7EFBDD77F5DD6EF8DD66F9110600197EDD77F2DD36F3FE -:2042C00000DD6EF8DD66F9110500197EDD77F0DD36F1003A7E88B7280ADD36EEFDDD36EF41 -:2042E000431808DD36EEFFDD36EF43DD7EEBDD77ECDD36ED00DD34EC2003DD34EDDD6EF631 -:20430000DD66F7E5DD6EF4DD66F5E5DD6EF2DD66F3E5DD6EF0DD66F1E5DD6EEEDD66EFE526 -:20432000DD6EE2DD66E3E5DD6EECDD66EDE521DF43E5CDD07521100039F9210544E5CD340C -:204340006CF13A7E88B7200B3E04FD216488FD96003808210544E5CD346CF1DD7EF8C640B9 -:20436000DD77F8DD7EF9CE00DD77F9DD34EBC33242210544E5CD346C210844E3CD346C21B5 -:204380001244E3CD016CF1DDF9DDE1C9546865726520617265206E6F206465766963652D52 -:2043A0006261736564206472697665727300617661696C61626C6520696E20746865207353 -:2043C000797374656D00507265737320616E79206B657920746F20657869742E2E2E001B4B -:2043E0004B25692E20257325737625692E25692573206F6E20736C6F742025730020000D4A -:204400000A202020000A0D004553432E20457869740053656C656374207468652064657638 -:204420006963652064726976657200DDE5DD210000DD39DD4E05DD4606595013DDCB047E8A -:20444000200ADD7E04C63002AF121822DD7E04E603C630023E2D1269602323DD7E040F0F97 -:20446000E63FE603C6307769602323233600DDE1C9DDE5DD210000DD39F5F5DD6E042D2670 -:20448000002929292929291108841922088621000039EB4B422A088666D5C5E533CD2B44E2 -:2044A000F133D12A088601080009D5110A86AFBEEDA020FBD13A7E88B7200F210A86D50134 -:2044C0001C00C5E5CDD847F1F1D1210A86D5E5CDE076F1D1010A8609D5013245C5E5CD24A5 -:2044E0007621060039F92165883600CD40453A6588B72839CD316A4D79D61B28301802186F -:204500002C79C6D04FD60138EB3E079138E661255C16006B62292929292929191199861906 -:204520007EB728D079F533CD4D483318BEDDF9DDE1C9206F6E20736C6F742025730D0A0037 -:20454000DDE5DD210000DD393BCD5069210003E5CD6E6B210A86E3CD346C261FE333CD23C9 -:204560006C333E1FF533CD236C333A6588B72003CD94463A6588B7202A210009E5CD6E6B03 -:2045800021F945E3CDBD6B261FE333CD236C33211746E5CDBD6B212E46E3CD016CF1CD3101 -:2045A0006A1852019986DD36FF000AB72819696023DD5EFF160013C5E5D5214A46E5CDD0F2 -:2045C0007521060039F9C1214100094D44DD34FFDD7EFFD60738D33A6588D607300821574A -:2045E00046E5CD346CF1215A46E5CD346C218246E3CD016CF133DDE1C954686572652061F5 -:204600007265206E6F207375697461626C65206465766963657300617474616368656420EC -:20462000746F207468652064726976657200507265737320616E79206B657920746F206722 -:204640006F206261636B2E2E2E001B4B25692E2025730D0A0D0A000A0D004553432E204721 -:204660006F206261636B20746F206472697665722073656C656374696F6E20736372656553 -:204680006E0053656C656374207468652064657669636500DDE5DD210000DD3921F9FF3933 -:2046A000F9DD36FE99DD36FF862165883600DD36FB013E07DD96FBDABB47DD7EFEC601DDE0 -:2046C00077F9DD7EFFCE00DD77FA216888DD7EFB77216A883600DD7EFEDD77FCDD7EFFDDED -:2046E00077FD216D88DD7EFC7723DD7EFD772A0886DD75FCDD74FDDD6EFCDD66FD660163CB -:2047000041C5E533CD976CF1333A6888DD77FCB7C29D4721658834216888DD7EFB77216A05 -:20472000883602DD7EF9DD77FCDD7EFADD77FD216D88DD7EFC7723DD7EFD772A0886DD758F -:20474000FCDD74FDDD6EFCDD66FD66016341C5E533CD976CF1333A6888B720123E40F533F3 -:20476000DD6EF9DD66FAE5CD066AF1331819DD6EFB260011C047E5D5DD6EF9DD66FAE5CDD0 -:20478000247621060039F93A7E88B720182124004D44E1E5C5E5CDD847F1F11808DD6EFE7A -:2047A000DD66FF3600DD34FBDD7EFEC641DD77FEDD7EFFCE00DD77FFC3B246DDF9DDE1C930 -:2047C00028556E6E616D6564206465766963652C2049443D25692900DDE5DD210000DD39B6 -:2047E000DD6E04DD6605E5CDE076F1DD7E0695DD7E079CE2F847EE80F24A48DD7E06C6FDFE -:2048000067DD7E07CEFF6FDD7E0484DD7704DD7E058DDD7705DD6E04DD6605362E23DD75A2 -:2048200004DD7405DD6E04DD6605362E23DD7504DD7405DD6E04DD6605362E23DD7504DD03 -:204840007405DD6E04DD66053600DDE1C9DDE5DD210000DD39DD6E042D4D060069602929CB -:20486000292929290911998619226088DD7E043262882166883600CD62493A6688B7283EBB -:20488000CD316A4D79D61B28351802183179C6D04FD60138EB3E079138E661255C16006B8A -:2048A000622919292919113C8619110C00197EB728CE79F533CDC14833CDD34E18B9DDE175 -:2048C000C9DDE5DD210000DD39216388DD7E04C6FF77ED4B63880600696029092929091102 -:2048E0003C8619229786218091360021819136002182913601ED5B97866B6223232323465E -:2049000023237E2B666F78D6087CDE007DDE003E003F173287916B622323234E23462323B7 -:204920007E2B666FAFB9983E019C3E009D3E003F17328891EB2323237EFD218391FD7700EC -:20494000237EFD218391FD7701237EFD218391FD7702237E3286913E01F533CDFF5933DD40 -:20496000E1C9DDE5DD210000DD3921FBFF39F9CD5069210003E5CD6E6B210A86E3CD346C34 -:20498000F12A608823E5CD346CF1CD334E21784AE5CD346C21784AE3CD346C21784AE3CD65 -:2049A000346CF13A6688B72003CD234D3A6688B7202B210009E5CD6E6B217B4AE3CDBD6B8A -:2049C000261FE333CD236C33219F4AE5CDBD6B21B74AE3CD016CF1CD316AC3734ADD36FEE0 -:2049E0003CDD36FF86DD36FB00DD7EFEDD77FCDD7EFFDD77FDDD6EFCDD66FD110C00197E46 -:204A0000B72836DD6EFB26002311D34AE5D5CDD075F1F1DD6EFEDD66FF2323235E23562328 -:204A20004E2346CB38CB19CB1ACB1BC5D5CD204BF121784AE3CD346CF1DD34FBDD7EFEC6FB -:204A40000DDD77FEDD7EFFCE00DD77FFDD34FBDD7EFBD607389321784AE5CD346C21784A5A -:204A6000E3CD346C21E04AE3CD346C21084BE3CD016CF1DDF9DDE1C90A0D0054686572655D -:204A800020617265206E6F207375697461626C65206C6F676963616C20756E697473006199 -:204AA0007661696C61626C6520696E207468652064657669636500507265737320616E7959 -:204AC000206B657920746F20676F206261636B2E2E2E001B4B25692E2053697A653A200002 -:204AE0004553432E20476F206261636B20746F206465766963652073656C656374696F6EAD -:204B00002073637265656E0053656C65637420746865206C6F676963616C20756E69740059 -:204B2000DDE5DD210000DD3921F5FF39F9DD7E05D628DD7E06DE00DD7E07DE00301DDD6EE3 -:204B400006DD6607E5DD6E04DD6605E521944CE5CDD07521060039F9C38F4CF5DD6E04DD94 -:204B60006605DD4E06DD5607F1060ACB3ACB19CB1CCB1D10F6DD75F5DD74F6DD71F7DD727E -:204B8000F8DD7EF6D628DD7EF7DE00DD7EF8DE003067210400395D54D5E5DD6E06DD660772 -:204BA000E5DD6E04DD6605E5CDA34CF1F1F1D12600010000DD7EF585DD77FCDD7EF68CDD2E -:204BC00077FDDD7EF789DD77FEDD7EF888DD77FF01984CD5DD6EFEDD66FFE5DD6EFCDD6652 -:204BE000FDE5C5CDD07521060039F9E1119B4CE5D5CDD075F1F1C38F4CDD7504DD7405DDF5 -:204C00007106DD7207F5DD7E04DD77F5DD7E05DD77F6DD7E06DD77F7DD7E07DD77F8F1062F -:204C20000ADDCBF83EDDCBF71EDDCBF61EDDCBF51E10EE21040039DD75FCDD74FDDD6EFC19 -:204C4000DD66FDE5DD6E06DD6607E5DD6E04DD6605E5CDA34CF1F1F12600110000DD7EF51D -:204C6000854FDD7EF68C47DD7EF78B6FDD7EF88A6711984CE5C5D5CDD07521060039F9DDF0 -:204C80006EFCDD66FD119F4CE5D5CDD075F1F1DDF9DDE1C925694B0025690025734D0025F2 -:204CA000734700DDE5DD210000DD39F5DD6604DD7E05E603DD74FEDD77FFDD4E08DD4609DE -:204CC000DD7EFED6B6DD7EFF173F1FDE833806AF022E011849C5216400E5DD6EFEDD66FF86 -:204CE000E5CDF96DF1F1C15DC5D5216400E5DD6EFEDD66FFE5CD916EF1F1D1C17DC630571E -:204D00007BD6323801147AD6302004AF02180D3E2E02696023726960232336002E00DDF934 -:204D2000DDE1C9DDE5DD210000DD3921FAFF39F9DD36FE3CDD36FF86DD36FA013E07DD961F -:204D4000FADA2E4E2168883A628877216A88DD7EFA77DD5EFEDD56FFED536D882A088666BA -:204D6000016941C5E533CD976CF133DD7EFEC60C4FDD7EFFCE00473A6888B72051DD6EFE33 -:204D8000DD66FF7EB72047DD6EFEDD66FF235623667AB720397CD6022034DD6EFEDD66FFEB -:204DA0002323235E235623237E2B666F7BD6147ADE007CDE007DDE003E003F17B7280FDD1E -:204DC0006EFEDD66FF110700197EE60628043E0018023E0102DD6EFEDD66FF110C00197E86 -:204DE000B7280421668834DD4EFEDD46FFC5FDE1FD7E0BDD77FDB728073E01DD96FD3018EB -:204E0000DD7EFEC60BDD77FBDD7EFFCE00DD77FCDD6EFBDD66FC3601DD34FADD7EFEC60DAE -:204E2000DD77FEDD7EFFCE00DD77FFC33C4DDDF9DDE1C92162884E06003A7E88B728052158 -:204E40004F4E1803215A4EC5E5CDD075F1F1C920284964203D202569290020282569290042 -:204E6000210003E5CD6E6B210A86E3CD346CF12A608823E5CD346CF1CD334E21B84EE5CDF2 -:204E8000346CF12163885E16001321BB4ED5E5CDD075F1F12A97862323235E2356234E23FB -:204EA00046CB38CB19CB1ACB1BC5D5CD204BF121B84EE3CD346CF1C90A0D004C6F67696301 -:204EC000616C20756E69742025692C2073697A653A2000DDE5DD210000DD39F53BDD36FD00 -:204EE00001DD7EFDB72863CD5069CD604E3A8791B72853210009E5CD6E6B21F851E3CDBD06 -:204F00006B211052E3CD016CF1CD3554657CB7281A111F52D5E533CD926333214052E3CD9E -:204F2000016CF1CD08547DB7CAF351218291AFFD218091FDBE00FD218091FD9E01E2424F9D -:204F4000EE8007E60177DD36FD00CD5069CD604E3A8291B7203C215D52E5CD346CF1F5FD08 -:204F6000218391FD6E00FD218391FD6601FD218391FD5E02FD218391FD5603F1CB3ACB1B08 -:204F8000CB1CCB1DD5E5CD204BF1217E52E3CD346CF1217E52E5CD346CF13A7E88B72805D5 -:204FA00011B452180311B652218152D5E5CDD075F1F1AFFD218091FDBE00FD218091FD9EA1 -:204FC00001E2C64FEE80F2EA4F3A8291B7280521F052180321F65211B952E52A8091E5D532 -:204FE000CDD07521060039F9180E3A8791B7280821FE52E5CD346CF13A8291D6013E0017BA -:2050000057B7282B3A8791B728253A8391D6C93A8491DE003A8591DE003A8691DE003E0024 -:205020003F1757B728093A8191EE80D68138043E0018023E01DD77FEB72823212153E5CD5C -:20504000346CF12A8B91E52A8991E5CD204BF1212D53E3CD346C213A53E3CD346CF13A82A6 -:2050600091B7204AAFFD218091FDBE00FD218091FD9E01E27850EE80F2AE50215053E5CD9C -:20508000346CF12180915E218191561B6B6229292919118088192323235E2356234E23469E -:2050A000C5D5CD204BF1212D53E3CD346CF1217E52E5CD346CF13A8891B72808215D53E527 -:2050C000CD346CF13A8291B7201FAFFD218091FDBE00FD218091FD9E01E2DE50EE80F2E972 -:2050E00050218553E5CD346CF121A553E5CD346C21BD53E3CD016CF1CD316A7DDD77FFB78B -:2051000028F6DD7EFFD61B20243A8291B7C2F3513A8191218091B6CAF35121E553E5CD018A -:205120006CF1CD08547DB7CAE14EC3F351DDCBFFEEDD7EFFAFFD218091FDBE00FD218091FE -:20514000FD9E01E24851EE8007E60157DD7EFFD6732009B22806CD5955C3E14EDD7EFFD63C -:20516000642009B22806CD6259C3E14EDD7EFFD670200CDD7EFEB72806CD495BC3E14EDDFE -:205180007EFFD661200CDD7EFEB72806CD4460C3E14EDD7EFFD675200F3A8291B72009B2DB -:2051A0002806CD1161C3E14EDD7EFFD6742006CD9061C3E14EDD7EFFD66620153A8891B741 -:2051C000280FCD8D647DB7CAE14EDD36FD01C3E14EDD7EFFD677C2E14E3A8291B7C2E14E1D -:2051E000B2CAE14ECD2F667DB7CAE14EDD36FD01C3E14EDDF9DDE1C9536561726368696EE8 -:205200006720706172746974696F6E732E2E2E00506C6561736520776169742E2E2E004532 -:2052200072726F72207768656E20736561726368696E6720706172746974696F6E733A005C -:205240004D616E6167652064657669636520616E797761793F2028792F6E292000556E70A3 -:205260006172746974696F6E6E656420737061636520617661696C61626C653A20000A0D2F -:20528000004368616E67657320617265206E6F7420636F6D6D69747465642573756E74694E -:2052A0006C205720697320707265737365642E0D0A0D0A0020000D0A00532E2053686F7724 -:2052C00020706172746974696F6E7320282569202573290D0A442E2044656C65746520612D -:2052E0006C6C20706172746974696F6E730D0A00666F756E6400646566696E656400284EF1 -:205300006F20706172746974696F6E7320666F756E64206F7220646566696E6564290D0A45 -:2053200000412E20416464206F6E65200020706172746974696F6E0D0A00502E204164649B -:2053400020706172746974696F6E2E2E2E0D0A00552E20556E646F206164642000462E207C -:20536000466F726D61742064657669636520776974686F757420706172746974696F6E7393 -:205380000D0A0D0A00572E20577269746520706172746974696F6E7320746F206469736BF4 -:2053A0000D0A0D0A00542E205465737420646576696365206163636573730D0A0053656C20 -:2053C00065637420616E206F7074696F6E206F722070726573732045534320746F207265A6 -:2053E0007475726E0044697363617264206368616E67657320616E642072657475726E3FDF -:205400002028792F6E292000212D54E5CD346CF1CD316A7DCBEF67113154E5D5CD346CF14C -:20542000E17CD67920043E011801AF6FC91B7935001B783500DDE5DD210000DD3921FAFFDC -:2054400039F9DD36FA00DD36FE80DD36FF8821809136002181913600DD36FB012A08867ECC -:20546000326888216A8836FF216C883A6288773A63883C326B88216E88DD7EFB77216D8892 -:20548000DD7EFA77217A03E5CDED6CF12168886E7DB7C231553A6A88D6052007DD36FA016F -:2054A000C34155DD6EFEDD66FFDD7EFB77DD6EFEDD66FF23DD7EFA77DD5EFEDD56FF131330 -:2054C0003A6A8812DD7EFEC603DD77FCDD7EFFCE00DD77FDC1D1D5C5ED4B71887912137830 -:2054E00012C1D1D5C51313ED4B6F887912137812DD6EFCDD66FD5E2356234E2346CB38CBEB -:2055000019CB1ACB1BDD6EFCDD66FD7323722371237021809134200421819134DD7EFEC6E1 -:2055200009DD77FEDD7EFFCE00DD77FFDD34FA18107DD6B4201EDD34FBDD36FA00180218D2 -:20554000133E04DD96FB380A3A8191EE80D681DA5C542E00DDF9DDE1C9DDE5DD210000DD83 -:205560003921F4FF39F9DD36F801DD36F900217F885615D533AFF533CD6E6B217657E3CDDE -:20558000346C217957E3CDBD6BF1DD7EF83D200ADD7EF9B720043E011801AFDD77F4DD7E1E -:2055A000F8C60FDD77FEDD7EF9CE00DD77FF2180917EDD96FE237EDD9EFFE2BF55EE8007B0 -:2055C000E601DD77F5B7280B2A8091DD75F6DD74F71810DD7EF8C60EDD77F6DD7EF9CE002B -:2055E000DD77F7217F885615D533AFF533CD6E6BF1DD7EF4B72805118D571803119157D546 -:20560000CD346CF1217F8856153A7C88C6FCD533F533CD6E6BF1DD7EF5B72805218D571881 -:2056200003219557E5CD346CF1CD5069210003E5CD6E6BF13A80913D201B3A8191B72015F6 -:205640003A8291B72805219957180321B757E5CDBD6BF118273A8291B7280501D15718033F -:2056600001EF571120802A8091E5C5D5CD247621060039F9212080E5CDBD6BF1210958E5C5 -:20568000CD346CF13E0FFD218091FDBE003E00FD218091FD9E01E29B56EE80F2C9562120D9 -:2056A00080D1C1C5D5C5DD4EF8DD46F9C5010C58C5E5CD247621080039F9212080E5CDBD74 -:2056C0006B210958E3CD346CF1210958E5CD346CF1DD6EF8DD66F92B4D4429292909118087 -:2056E0008819DD75FCDD74FDDD7EF8DD77FADD7EF9DD77FBDD7EF6DD96FADD7EF7DD9EFBA3 -:20570000E20557EE80FA2D57DD6EFCDD66FDE5CD2A58F1DD7EFCC609DD77FCDD7EFDCE0017 -:20572000DD77FDDD34FA20CCDD34FB18C7CD316A7DD61B283C180218387DD61D2019DD7E8E -:20574000F4B72013DD7EF8C6F1DD77F8DD7EF9CEFFDD77F9C38A557DD61C20D1DD7EF5B79E -:2057600020CBDD7EFEDD77F8DD7EFFDD77F9C38A55DDF9DDE1C91B4B00507265737320451B -:20578000534320746F2072657475726E00202020003C2D2D002D2D3E004F6E65207061729D -:2057A000746974696F6E20666F756E64206F6E20646576696365004F6E65206E657720706D -:2057C0006172746974696F6E20646566696E656400256920706172746974696F6E732066EF -:2057E0006F756E64206F6E20646576696365002569206E657720706172746974696F6E7301 -:2058000020646566696E6564000A0D00446973706C6179696E6720706172746974696F6E74 -:2058200073202569202D20256900DDE5DD210000DD39F53BDD7E04DD77FEDD7E05DD77FFE2 -:20584000DD6EFEDD66FF5E3A8291B720333E04FD218091FDBE003E00FD218091FD9E01E2F1 -:205860006458EE80FA80581D20043E31180ADD6EFEDD66FF237EC631F533CD236C33182147 -:205880007BC630F533CD236C33DD6EFEDD66FF237EB7280D6F2600113559E5D5CDD075F1D7 -:2058A000F1213959E5CD346CF1DD6EFEDD66FF23237EDD77FD3D200A213C59E5CD346CF101 -:2058C0001849DD7EFDD606200A214259E5CD346CF11838DD7EFDD60B2807DD7EFDD60C20F8 -:2058E0000A214859E5CD346CF11820DD7EFDD607200A214E59E5CD346CF1180FDD6EFD2662 -:2059000000115359E5D5CDD075F1F1215C59E5CD346CF1DD6EFEDD66FF2323235E23562315 -:205920004E2346C5D5CD204BF1215F59E3CD346CDDF9DDE1C92D2569003A20004641543146 -:2059400032004641543136004641543332004E544653005479706520232578002C20000A80 -:205960000D003A8291B7280511EE59180311F75901CC59212080D5C5E5CD247621060039E8 -:20598000F9212080E5CD016CF1CD08547DB7C82180913600218191360021829136002A971C -:2059A000862323237EFD218391FD7700237EFD218391FD7701237EFD218391FD7702237EA2 -:2059C0003286913E01F533CDFF5933C94469736361726420616C6C202573207061727469EB -:2059E00074696F6E733F2028792F6E2920006578697374696E6700646566696E656400DD7D -:205A0000E5DD210000DD393A8391C6FF573A8491CEFF473A8591CEFF5F3A8691CEFF4FCB0C -:205A200039CB1BCB18CB1ADD7E04B7281021899172218A9170218B9173218C9171AFFD21AC -:205A40008991FDBE00FD218991FD9E013E40FD218991FD9E023E00FD218991FD9E033016F0 -:205A60002189913600218A913600218B913640218C9136001838DD7E04B720327AFD218943 -:205A800091FD960078FD218991FD9E017BFD218991FD9E0279FD218991FD9E03301021890D -:205AA0009172218A9170218B9173218C91713A8991D6643A8A91DE003A8B91DE003A8C918C -:205AC000DE0030112189913664AF328A91328B91328C9118327AFD218991FD960078FD2114 -:205AE0008991FD9E017BFD218991FD9E0279FD218991FD9E03301021899172218A91702197 -:205B00008B9173218C91713A9591B72839AFFD218991FDBE003E40FD218991FD9E013E009D -:205B2000FD218991FD9E023E00FD218991FD9E0330142189913600218A913640218B9136A2 -:205B400000218C913600DDE1C9DDE5DD210000DD3921E4FF39F9DD36EE003A8391C6FF5FCB -:205B60003A8491CEFF573A8591CEFF4F3A8691CEFF47F5DD73E4DD72E5DD71E6DD70E7F12B -:205B80003E01DDCBE73EDDCBE61EDDCBE51EDDCBE41EF52183914E21849166FD218391FDB5 -:205BA0006E02FD218391FD5603F1CB3ACB1DCB1CCB19060ACB3ACB1DCB1CCB1910F6DD7128 -:205BC000F2DD74F3DDCBE57E200CDD7EE6B72006DD7EE7B72805217FFF1806DD66E4DD6EE5 -:205BE000E5DD74F0DD75F1DD7EF2DDB6F320043E011801AFDD77E9DD66F2DD6EF31100007D -:205C0000AFBC3E109D3E009A3E009B3008DD36F200DD36F310215E5FE5CD016CF1DD7EEEF3 -:205C2000B7C28D5EDD36E801CD5069CD604E21825FE5CD346C21855FE3CD346CF13A959109 -:205C4000B728283A7E88B7280ADD36FEE2DD36FF5F1808DD36FEE4DD36FF5FDD6EFEDD669E -:205C6000FFE5219B5FE5CDD075F1F1DD7EE9B7280A21E75FE5CD346CF1181021ED5FDD4EB5 -:205C8000F2DD46F3C5E5CDD075F1F13A7E88B7280511E25F180311E45F211360DD4EF0DDED -:205CA00046F1C5016400C5D5E5CDD07521080039F92120803606112080ED536B88210A008B -:205CC000E5CDED6CF12121804E79B7CA595F112280692600193600AFDD77EADD77EBDD77F5 -:205CE000ECDD77EDDD71FEDD73FCDD72FDDD6EFCDD66FD7EDD34FC2003DD34FDCBEFDD7742 -:205D0000EFD66B2007DD36EE01C3FB5DDD7EEFB7280EDD7EEFD60D2807DD7EEFD66D2021AE -:205D2000DD36EE01F5F1060ADDCBEA26DDCBEB16DDCBEC16DDCBED1610EEDD36E800C3FBFE -:205D40005DDD7EEFEE80D6B0DAFB5D3E39DD96EFE2555DEE80FAFB5DDD6EECDD66EDE5DD20 -:205D60006EEADD66EBE5210000E5210A00E5CD056EF1F1F1F1DD72FBDD73FADD74F9DD756E -:205D8000F8DD66EFDD7EEF179F6F7CC6D0677DCEFF6FDD74F4DD75F57D179FDD77F6DD77DB -:205DA000F7DD7EF8DD86F4DD77F4DD7EF9DD8EF5DD77F5DD7EFADD8EF6DD77F6DD7EFBDDCA -:205DC0008EF7DD77F721060039EB21100039010400EDB0DD35FEDD7EFEB7C2ED5CDD36EE70 -:205DE00001F5F1060ADDCBEA26DDCBEB16DDCBEC16DDCBED1610EEDD36E800DD7EEEB728D5 -:205E000037DD7EE8B7281BDD66F0DD6EF11100007CDD96EA7DDD9EEB7ADD9EEC7BDD9EED0E -:205E20003864DD7EEAD664DD7EEBDE00DD7EECDE00DD7EEDDE00384EDD7EE8B7C21D5CDD40 -:205E40006EF2DD66F3110000F5DD75F4DD74F5DD73F6DD72F7F13E0ADDCBF426DDCBF516E0 -:205E6000DDCBF616DDCBF7163D20EDDD7EF4DD96EADD7EF5DD9EEBDD7EF6DD9EECDD7EF703 -:205E8000DD9EEDD21D5CDD36EE00C31D5CDD7EE4DD96EADD7EE5DD9EEBDD7EE6DD9EECDD4B -:205EA0007EE7DD9EED301021100039EB21000039010400EDB0180E21100039EB21060039A9 -:205EC000010400EDB011899121100039010400EDB0CD44603A8391C6FF573A8491CEFF5F93 -:205EE0003A8591CEFF47FD218391FD7E03CEFF4FF5DD72E4DD73E5DD70E6DD71E7F1DDCB14 -:205F0000E73EDDCBE61EDDCBE51EDDCBE41EDD7EE4DD96EADD7EE5DD9EEBDD7EE6DD9EEC71 -:205F2000DD7EE7DD9EED301021100039EB21000039010400EDB0180E21100039EB21060084 -:205F400039010400EDB011899121100039010400EDB0AFF533CDFF5933DDF9DDE1C9456EF0 -:205F60007465722073697A65206F7220707265737320454E54455220746F2063616E6365F2 -:205F80006C000A0D00416464206E657720706172746974696F6E0D0A0D0A005741524E4962 -:205FA0004E473A206F6E6C7920706172746974696F6E73206F662031364D206F72206C6508 -:205FC0007373257363616E206265207573656420696E20444F532031206D6F64650D0A0D22 -:205FE0000A0020000D0A00456E74657200456E74657220706172746974696F6E2073697AF4 -:206000006520696E204D422028312D2569290D0A6F720020706172746974696F6E2073692A -:206020007A6520696E204B4220666F6C6C6F7765642062792573224B22202825692D2569AE -:20604000293A2000DDE5DD210000DD39F5ED4B8091696029292909118088195D5423232310 -:206060003A899177233A8A9177233A8B917723FD218991FD7E037721020019E36B622323F4 -:20608000234E234623237E2B6E67AFB93E80983E009D3E009C30043E0618023E01E1E577E1 -:2060A0004B42033A8191218091B620073E0112AF0218073E02123A809102F521899156218E -:2060C0008A915E218B9146218C914EF1CB22CB13CB10CB112183917E9277237E9B77237EB5 -:2060E0009877237E99772183917EC6FF77237ECEFF77237ECEFF77237ECEFF7721809134DC -:20610000200421819134AFF533CDFF59DDF9DDE1C9DDE5DD210000DD39F53A8091C6FFDDE3 -:2061200077FE3A8191CEFFDD77FFC1C5696029292909118088192323235E2356234E23465F -:2061400021899173218A9172218B9171218C9170CB23CB12CB11CB102183917E8377237EB7 -:206160008A77237E8977237E887721839134201021849134200A21859134200421869134B5 -:20618000E1E5228091AFF533CDFF59DDF9DDE1C9DDE5DD210000DD3921FBFF39F9AFDD7787 -:2061A000FCDD77FDDD77FEDD77FF21FA62E5CDE076F1DD75FB21FA62E5CD5A63F1CD396ADD -:2061C0007DB7C2F5621120803E0AF533D5DD6EFEDD66FFE5DD6EFCDD66FDE5CDFA70210741 -:2061E0000039F93E09F533DD7EFBF533CD6E6B212080E3CD346C213063E3CD346CF121674C -:20620000887EE6FE772168883A628877216A8836011169883A63883C12112080ED536D88CC -:2062200021010039EBED536B882A088666016041C5E533CD976CF1333A68884FB728741177 -:206240002080C5211563AFBEEDA020FB211563E5CDE076F1C111208019EBC53E0AF533D519 -:20626000DD6EFEDD66FFE5DD6EFCDD66FDE5CDFA7021070039F9C1212080C5E5CDE076F171 -:20628000C111208019113763C5EBAFBEEDA020FBC1212080E579F533CD926333213963E366 -:2062A000CD016CF1CD08547DB7284A21FA62E5CD5A63F1DD34FC200DDD34FD2008DD34FE88 -:2062C0002003DD34FF2A97862323235E2356234E2366DD7EFC93DD7EFD9ADD7EFE99DD7EE1 -:2062E000FF9CDABD61AFDD77FCDD77FDDD77FEDD77FFC3BD61DDF9DDE1C94E6F77207265AD -:206300006164696E672064657669636520736563746F7220004572726F72207768656E201E -:2063200072656164696E6720736563746F722000202E2E2E1B4B003A00436F6E74696E7589 -:20634000652072656164696E6720736563746F72733F2028792F6E292000CD5069CD604ED4 -:20636000210009E5CD6E6BF1C1E1E5C5E5CD346C217963E3CD016CF1C95072657373206177 -:206380006E79206B657920746F2073746F702E2E2E00DDE5DD210000DD39210009E5CD6E1A -:2063A0006BF1DD6E05DD6606E5CDBD6B21FB63E3CD346CF1216A88DD7E04771120804B4227 -:2063C000ED436B88D5216600E5CDED6CF1D16B62D5E5CDE076F14D44D13A7C886F2600BFE2 -:2063E000ED423007D5CD346CF11805D5CDBD6BF121FE63E5CD016CF1DDE1C90A0D0050723A -:2064000065737320616E79206B657920746F2072657475726E2E2E2E00213E64E5CDBD6B76 -:20642000214464E3CD346C214A64E3CDBD6B216F64E3CD346C217264E3CDBD6BF1C9446F1C -:206440006E6521000A0D0A0A0A004966207468697320646576696365206861642064726950 -:20646000766573206D617070656420746F2C000A0D00706C656173652072657365742074A0 -:20648000686520636F6D70757465722E00DDE5DD210000DD3921F1FF39F9212B65E5CD8373 -:2064A00068F17DB720046FC32665CD5069CD604E210009E5CD6E6B214C65E3CDBD6B216588 -:2064C00065E3CD016CF12A97862323235E2356234E2346CB38CB19CB1ACB1BC5D52100007B -:2064E000E5210000E5CDAD65F1F1F1F1557AB72019D521000BE5CD6E6BF1CD1964D1217422 -:2065000065D5E5CD016CF1D1180D218F65D5E5D533CD9263F133D1D5CD316AD17AB720044A -:206520003E011801AF6FDDF9DDE1C9466F726D61742064657669636520776974686F75745B -:2065400020706172746974696F6E7300466F726D617474696E672074686520646576696327 -:20656000652E2E2E00506C6561736520776169742E2E2E00507265737320616E79206B650E -:206580007920746F2072657475726E2E2E2E004572726F72207768656E20666F726D6174B0 -:2065A00074696E67206465766963653A00DDE5DD210000DD3921FAFF39F92A08867E2120C6 -:2065C0008077233A6288771122803A63883C122123803600233600233600233600DD36FECA -:2065E00027DD36FF802A9786232323562346235E2366F5DD72FADD70FBDD73FCDD74FDF158 -:20660000DDCBFD3EDDCBFC1EDDCBFB1EDDCBFA1EDD5EFEDD56FF21000039010400EDB021CC -:206620002080E5210200E5CD4F6CDDF9DDE1C93E04FD218091FDBE003E00FD218091FD9EB4 -:2066400001E24666EE80FA5F661132670120802A8091E5D5C5CD247621060039F91814117C -:2066600020802A8091E5215967E5D5CD247621060039F9212080E5CD8368F17DB720026FEB -:20668000C9CD5069CD604E217867E5CD016C210009E3CD6E6B218767E3CDBD6BF1CD086849 -:2066A000010000218091799678239EE2B066EE80F21967C5210009E5CD6E6BF1C15950139F -:2066C000C5D52A8091E5D521AA67E5212080E5CD247621080039F9D1C1212080C5D5E5CD0D -:2066E000BD6BF1D1C1D5C5CD6068F1D17DB7282501CA67E5D5C5012080C5CD2476210600D8 -:2067000039F9E1112080D57DF533CD9263F133CD316A2E00C94B42188A21000BE5CD6E6B10 -:20672000F1CD196421ED67E5CD016CF1CD316A2E01C9437265617465202569207072696D5F -:2067400061727920706172746974696F6E73206F6E2064657669636500437265617465207F -:20676000256920706172746974696F6E73206F6E2064657669636500506C656173652077A0 -:206780006169742E2E2E00507265706172696E6720706172746974696F6E6E696E67207053 -:2067A000726F636573732E2E2E004372656174696E6720706172746974696F6E20256920CB -:2067C0006F66202569202E2E2E004572726F72207768656E206372656174696E6720706152 -:2067E00072746974696F6E202569203A00507265737320616E79206B657920746F207265B0 -:206800007475726E2E2E2E002A08867E21208077233A6288773A63883C3222802123803AC6 -:20682000809177233A8191771125803E8012133E8812112780ED4B63880600696029092974 -:206840002909013C8609010B00094E06007912137812212080E5210300E5CD4F6CF1F1C9C7 -:20686000DDE5DD210000DD391120806B62DD7E047723DD7E0577D5210400E5CD4F6CF1F1AB -:20688000DDE1C9DDE5DD210000DD393A7E88B7280511CB68180311CD6821D068D5E5CD01F1 -:2068A0006CF1CD5069CD604E210009E5CD6E6BF1D121D168D5D5DD4E04DD4605C5E5CDD061 -:2068C0007521080039F9DDE1C3085420000D0A000025730D0A0D0A544849532057494C4C7E -:2068E0002044455354524F592573414C4C2044415441204F4E205448452044455649434515 -:2069000021210D0A5468697320616374696F6E2063616E27742062652063616E63656C6C22 -:2069200065642573616E642063616E277420626520756E646F6E650D0A0D0A417265207967 -:206940006F7520737572653F2028792F6E292000210002E5CD6E6BF1110000FD217F88FDBC -:206960007E002600C6FC6F7CCEFF677B957A9CE27469EE80F0218369D5E5CD346CF1D11346 -:2069800018D9C91B4B1F00DDE5DD210000DD39F50E00DD36FE08DD36FF8421648836001ECF -:2069A0000179B7205C3E0893385721688873C1C5ED436D88D5217801E5CDED6CF1D13A68B5 -:2069C000884FB72039E1E5232323237E0F302F21648834DD7EFEC60857DD7EFFCE0047C59F -:2069E000D53E20F5334AC5CD066AF133D1C1DD7EFEC640DD77FEDD7EFFCE00DD77FF1C18DA -:206A0000A0DDF9DDE1C921040039FD210200FD39FD7E00865FFD7E01CE00571B210400394B -:206A2000461AD6202007B028041B0518F413AF12C9CD396A7DB728F9C9216B8836FF210636 -:206A400001E5CDED6CF13A68886FC93AAFFC3278883AB0F33279883ADEF3B728023E01572E -:206A6000217A8872C9217B88360021B0F36E3E28953E003F17B72804162818021650217C5F -:206A80008872217D8836007AD65020043E011801AF327E883AB1F3327F88C9DDE5DD2100FD -:206AA00000DD39DD4E04DD46050AB720216960237E32AEF3116788C5210000E52E00E5D577 -:206AC0002E6CE5CD3A6D21080039F9C1181F6960237E32AFF3116788C5210000E52E00E554 -:206AE000D52E6FE5CD3A6D21080039F9C1116788696023237EB728040ECF18020ECC060068 -:206B0000210000E52E00E5D5C5CD3A6D21080039F9DDE1C93E0CF533CD236C33C1E1E5C51F -:206B2000E5CDBD6B261FE333CD236C33CD416B217F88561515D533AFF533CD6E6BF1C341F6 -:206B40006B216A6BE5CD346CF11100003A7C886F26007B957A9CE25B6BEE80F0D53E2DF54C -:206B600033CD236C33D11318E3C90D1B4B00210200397E3C326E88210300397E3C326D88BC -:206B8000116788210000E52E02E5D52EC6E5CD3A6D21080039F9C9210200397E3C326E8856 -:206BA0003ADCF3326D88116788210000E52E02E5D52EC6E5CD3A6D21080039F9C9DDE5DDA5 -:206BC000210000DD393A7C886F2600E5DD4E04DD4605C5CDE076F1EBE1BFED52CB3CCB1DDD -:206BE0006511FD6BE5D5CD346CF133CD976B33DD6E04DD6605E5CD346CF1DDE1C90D1B4B96 -:206C000000217F885615D533AFF533CD6E6B21206CE3CD346CF1C1E1E5C5E5CD346CF1C916 -:206C20001B4B00DDE5DD210400DD39DD7E00CDA200DDE1C9DDE5DD210400DD39DD6E00DDC1 -:206C400066017EB72806CDA2002318F6DDE1C9DDE5DD210000DD393AFF403C32688821690C -:206C600088DD7E047723DD7E0577DD5E06DD5607ED536D88210041226F881167882600E586 -:206C8000210302E5D5214240E5CD3A6D21080039F92A6D88DDE1C9DDE5DD210000DD392120 -:206CA000F8FF39F9210000394D445950216788C5010800EDB0C1216888DD7E0477216A88E1 -:206CC00036FF216B88DD7E057723DD7E0677ED436D88217B03E5CDED6CF13A6888B72008D0 -:206CE000ED5B6F88ED536788DDF9DDE1C9216988FD210200FD39FD7E0077210300397EF59F -:206D000033217DF3E5CD0B6DF133C9214CF8FD210200FD39FD7E007723FD7E0177116788D5 -:206D2000210000E521060039460E03C5D5213F40E5CD3A6D21080039F9C9DDE5DD2104001B -:206D4000DD39DD5E06DD560708D5F108DD6E00DD6601DD5E02DD5603DD7E05327788DD7EDE -:206D600004227488D5B72839D5DDE1D9DD6E00DD66013D2829D9DD4E02DD4603DD5E04DD33 -:206D80005605DD6E06DD66073DD92812DD4E08DD4609DD5E0ADD560BD5C5DDE1FDE1E5F1BF -:206DA000D9CD7388DDE3083A7788B7283AD908F5E1DD7500DD7401D9083D282BDD7102DD1F -:206DC0007003DD7304DD7205DD7506DD74073D2816D9E1DD7508DD7409FDE5E1DD750ADD03 -:0C6DE000740BD908DDE1C908E1DDE1C950 -:11410000E5C5D5119991ED539691D1CD2041F1F1C9E3 -:039196000000C90D -:206DEC00210300395E2B6ECDA16EC3CF6EF1E1D1D5E5F5CDA96EC3CF6EC3EF76C38F6FC375 -:206E0C003D70C32A72C361763E05CFC3EC723E05CFC3916E3E05CFC3D96E3E05CFC37C6FDD -:206E2C003E05CFC39A6E3E05CFC3EC6D3E05CFC3566F3E05CFC3E16E3E05CFC37A6E3E057D -:206E4C00CFC3686F3E05CFC33B6F3E05CFC31A6F3E05CFC3726F3E05CFC3476F3E05CFC3CA -:206E6C00296F3E05CFC3F96D3E05CFC3866E210300395E2B6ECDE86EEBC9F1E1D1D5E5F5ED -:206E8C00CDEB6EEBC9F1E1D1D5E5F5C3A96E210300395E2B6E7D079F677B079F577CAA174D -:206EAC007CF517300697956F9F9467CB7A280697935F9F9257CDEB6EF1D04797956F9F9453 -:206ECC006778C917EBD097956F9F9467C9F1E1D1D5E5F5180A210300395E2B6E2600547B71 -:206EEC00E680B220100610ED6A17933001833FED6A10F65FC906097D6C2600CB1DED6AED65 -:206F0C00523001193F1710F5CB10505FEBC9210300395E2B6E2600CDA56EC3CF6E210300B2 -:206F2C0054395E2B6E7D079F67CDA96EC3CF6E210300395E2B6E2600C3A56E210300543952 -:206F4C005E2B6E7D079F67C3A96E21030054395E2B666A06082930011910FAC92103004404 -:206F6C00395E2B4E181621020044395E234E180C210300395E2B6E4D7D179F477B179F5791 -:206F8C00C3F472DDE5DD210000DD3921FBFF39F9DDCB0B7E2819AFDD96085F3E00DD9E09DC -:206FAC00573E00DD9E0A6F3E00DD9E0B67180CDD5E08DD5609DD6E0ADD660BDD7E0707E67C -:206FCC0001DD77FFB72821AFDD9604DD77FB3E00DD9E05DD77FC3E00DD9E06DD77FD3E0080 -:206FEC00DD9E07DD77FE1818DD7E04DD77FBDD7E05DD77FCDD7E06DD77FDDD7E07DD77FEBD -:20700C00E5D5DD6EFDDD66FEE5DD6EFBDD66FCE5CD3D70F1F1F1F1DD7EFFB7280FAF956F99 -:20702C003E009C673E009B5F3E009A57DDF9DDE1C9DDE5DD210000DD39110000DD7E0BCB27 -:20704C0007E6012044F5F1DDCB0826DDCB0916DDCB0A16DDCB0B16DD7E04DD9608DD7E0584 -:20706C00DD9E09DD7E06DD9E0ADD7E07DD9E0B3014F5F1DDCB0B3EDDCB0A1EDDCB091EDD1B -:20708C00CB081E18041C5318B3DD7E04DD9608DD7E05DD9E09DD7E06DD9E0ADD7E07DD9E1C -:2070AC000B3824DD7E04DD9608DD7704DD7E05DD9E09DD7705DD7E06DD9E0ADD7706DD7E53 -:2070CC0007DD9E0BDD7707F5F1DDCB0B3EDDCB0A1EDDCB091EDDCB081E62157CB720AADD27 -:2070EC006E04DD6605DD5E06DD5607DDE1C9DDE5DD210000DD3921DBFF39F9210100394D1D -:20710C0044DD36DB20DD7E0ADD77FCDD36FD00DD36FE00DD36FF00C5DD6EFEDD66FFE5DD17 -:20712C006EFCDD66FDE5DD6E06DD6607E5DD6E04DD6605E5CD0B6EF1F1F1F1C17DC6305723 -:20714C003E399230047AC60757DD35DBDD6EDB26000972C5DD6EFEDD66FFE5DD6EFCDD66D5 -:20716C00FDE5DD6E06DD6607E5DD6E04DD6605E5CD116EF1F1F1F1C1DD7504DD7405DD7358 -:20718C0006DD72077ADDB606DDB605DDB604C21171DD5E08DD5609D5FDE1DD56DB6A260031 -:2071AC00097EFD7700FD23147AD62020F0FD360000DDF9DDE1C9DDE5DD210000DD39DDCB06 -:2071CC00077E2835DD7E0AD60A202EDD6E08DD6609362D23DD7508DD7409AFDD9604DD77DB -:2071EC00043E00DD9E05DD77053E00DD9E06DD77063E00DD9E07DD7707DD7E0AF533DD6E5C -:20720C0008DD6609E5DD6E06DD6607E5DD6E04DD6605E5CDFA7021070039F9DDE1C9DDE553 -:20722C00DD210000DD3921F6FF39F9DD7E0B07E601DD77FFB72821AFDD9608DD77FB3E0088 -:20724C00DD9E09DD77FC3E00DD9E0ADD77FD3E00DD9E0BDD77FE180E21050039EB21120081 -:20726C0039010400EDB0DD7E0707E601DD77FAB72821AFDD9604DD77F63E00DD9E05DD7707 -:20728C00F73E00DD9E06DD77F83E00DD9E07DD77F9180E21000039EB210E0039010400ED0E -:2072AC00B0DD6EFDDD66FEE5DD6EFBDD66FCE5DD6EF8DD66F9E5DD6EF6DD66F7E5CD6176D2 -:2072CC00F1F1F1F1DD7EFADDAEFF280FAF956F3E009C673E009B5F3E009A57DDF9DDE1C910 -:2072EC00F1E1D1D5E5F5444DAF6FB00610200406087929CB111730011910F7C9DDE5DD211A -:20730C000000DD39AFDDB608CA4A73DD4E04DD460578CB7FCA4A73C5DD6E0BDD660CE53E4D -:20732C002DF533213A73E5DD6E09DD660AE9F133C1AF994F3E009847DD7104DD7005DD7E17 -:20734C0004DD9606DD7E05DD9E07DA9373DD6E06DD6607E5DD6E04DD6605E5CDD96E444D41 -:20736C00F1F1DD6E0BDD660CE5DD6E09DD660AE53E00F533DD6E06DD6607E5C5CD0873FD1F -:20738C00210900FD39FDF9DD6E06DD6607E5DD6E04DD6605E5CD866E444DF1F121CA7309F4 -:2073AC004D440A4FDD6E0BDD660CE579F53321C573E5DD6E09DD660AE9F133DDE1C93031D8 -:2073CC00323334353637383941424344454600DDE5DD210000DD39DD4E04DD46050A5FB713 -:2073EC00CAB9757BFE25CAF873C38D7579C601DD770478CE00DD7705DD4E04DD4605C5FDA1 -:20740C00E1FD4E0079FE62CA6C7479FE63CA3D7479FE64CAE27479FE69CAE27479FE73CAAD -:20742C00567579FE75CAA87479FE78CA1C75C3A475DD4E0ADD460B0303DD710ADD700B0B59 -:20744C000B69604E2346DD6E08DD6609E579F533216774E5DD6E06DD6607E9F133C3A4750B -:20746C00DD4E0ADD460B0303DD710ADD700B0B0B69604E23460600DD6E08DD6609E5DD6E7C -:20748C0006DD6607E53E00F533210A00E5C5CD0873FD210900FD39FDF9C3A475DD4E0ADDE7 -:2074AC00460B0303DD710ADD700B0B0B69604E2346DD6E08DD6609E5DD6E06DD6607E53EE1 -:2074CC0000F533210A00E5C5CD0873FD210900FD39FDF9C3A475DD4E0ADD460B0303DD7175 -:2074EC000ADD700B0B0B69604E2346DD6E08DD6609E5DD6E06DD6607E53E01F533210A00F2 -:20750C00E5C5CD0873FD210900FD39FDF9C3A475DD4E0ADD460B0303DD710ADD700B0B0B0F -:20752C0069604E2346DD6E08DD6609E5DD6E06DD6607E53E00F533211000E5C5CD0873FD35 -:20754C00210900FD39FDF9C3A475DD4E0ADD460B0303DD710ADD700B0B0B69604E23460A34 -:20756C0057B7CAA475C5DD6E08DD6609E5D533218675E5DD6E06DD6607E9F133C103C36B22 -:20758C0075DD6E08DD6609E57BF53321A275E5DD6E06DD6607E9F133DD4E04DD460579C6E8 -:2075AC0001DD770478CE00DD7705C3E373DDE1C9DDE5DD210000DD39DD7E04F533CD236C6E -:2075CC0033DDE1C9DDE5DD210000DD39210400394D440303C5210000E521BC75E5DD6E04C9 -:2075EC00DD6605E5CDDB73F1F1F1F1210000DDE1C9DDE5DD210000DD39DD4E05DD4606C5D7 -:20760C00FDE1FD4E00FD4601595013FD7300FD7201DD7E0402DDE1C9DDE5DD210000DD3997 -:20762C00210600394D440303210400395D54C5D521FD75E5DD6E06DD6607E5CDDB73F1F1A9 -:20764C00F1F1DD4E04DD4605C5FDE1FD360000210000DDE1C9DDE5DD210000DD393B1E0038 -:20766C000100001600DD36FF20DD7E07CB07E60167F5F1DDCB0426DDCB0516DDCB0616DD17 -:20768C00CB0716CB23CB10CB11CB12CB442802CBC37BDD960878DD9E0979DD9E0A7ADD9EC8 -:2076AC000B38187BDD96085F78DD9E094779DD9E0A4F7ADD9E0B57DDCB04C6DD35FFDD7E49 -:2076CC00FFB720A5DD6E04DD6605DD5E06DD560733DDE1C9C1E1E5C5AF474FEDB121FFFF09 -:2076EC00ED42C9DDE5DD210000DD3921F2FF39F921000039DD75FEDD74FF23234D44211268 -:20770C000039DD75FCDD74FDDD6EFCDD66FD5E21160039DD75FADD74FBDD6EFADD66FB23F5 -:20772C00237EC5672E005506082930011910FAC1EB7B02037A02DD6EFCDD66FD5EDD6EFA90 -:20774C00DD66FB662E005506082930011910FAEBDD6EFEDD66FF73237221030039EB1A4F3C -:20776C00DD6EFCDD66FD23232346DD6EFADD66FB66D5582E005506082930011910FAD17959 -:20778C0085121A4FDD6EFCDD66FD232346DD6EFADD66FB2366D5582E00550608293001198D -:2077AC0010FAD179851221020039EB6B624E2346DD6EFCDD66FD23237EDD77FEDD6EFADD48 -:2077CC0066FB7ED5C55FDD66FE2E005506082930011910FAC1D1094D446B627123706B62AC -:2077EC004E2346DD6EFCDD66FD237EDD77FEDD6EFADD66FB237ED5C55FDD66FE2E00550665 -:20780C00082930011910FAC1D1094D447912137812DD5EFCDD56FD1313134BDD6EFCDD660E -:20782C00FD235EDD6EFADD66FB232366D52E005506082930011910FAD15D696273DD5EFC09 -:20784C00DD56FD134BDD6EFCDD66FD235EDD6EFADD66FB66D52E005506082930011910FABA -:20786C00D15D446962732370DD5EFADD56FB1313134BDD6EFCDD66FD5EDD6EFADD66FB2347 -:20788C00232366D52E005506082930011910FAD15D696273DD5EFADD56FB134BDD6EFCDDFC -:2078AC0066FD5EDD6EFADD66FB2366D52E005506082930011910FAD15D446962732370DDEC -:2078CC006EFADD66FB3600DD6EFCDD66FD360021000039EBD521060039EB010400EDB0D12B -:2078EC00DD6E04DD6605DD4E06DD4607DD7EF685DD77F6DD7EF78CDD77F7DD7EF889DD7711 -:20790C00F8DD7EF988DD77F9D521060039010400EDB0E1DD6E08DD6609DD5E0ADD560BDD83 -:18792C007EF6856FDD7EF78C67DD7EF88B5FDD7EF98A57DDF9DDE1C9C7 -:00000001FF diff --git a/releases/2.0 final/fdisk/fdisk.lk b/releases/2.0 final/fdisk/fdisk.lk deleted file mode 100644 index 624734a1..00000000 --- a/releases/2.0 final/fdisk/fdisk.lk +++ /dev/null @@ -1,11 +0,0 @@ --mjwx --i fdisk.ihx --b _CODE = 0x4120 --b _DATA = 0x8020 --k C:\Program Files (x86)\SDCC\bin\..\lib\z80 --l msxchar.lib --l z80 -fdisk.rel -fdisk_crt0.rel - --e diff --git a/releases/2.0 final/fdisk/fdisk2.asm b/releases/2.0 final/fdisk/fdisk2.asm deleted file mode 100644 index 5500666f..00000000 --- a/releases/2.0 final/fdisk/fdisk2.asm +++ /dev/null @@ -1,2701 +0,0 @@ -;-------------------------------------------------------- -; File Created by SDCC : free open source ANSI-C Compiler -; Version 3.3.0 #8604 (May 11 2013) (MINGW32) -; This file was generated Tue Feb 11 14:28:56 2014 -;-------------------------------------------------------- - .module fdisk2 - .optsdcc -mz80 - -;-------------------------------------------------------- -; Public variables in this module -;-------------------------------------------------------- - .globl _main - .globl _sectorsPerTrack - .globl _mainExtendedPartitionFirstSector - .globl _mainExtendedPartitionSectorCount - .globl _nextDeviceSector - .globl _partitions - .globl _partitionsCount - .globl _selectedLunIndex - .globl _deviceIndex - .globl _driverSlot - .globl _regs - .globl _OUT_FLAGS - .globl _ASMRUT - .globl _sectorBufferBackup - .globl _sectorBuffer - .globl _remote_CreateFatFileSystem - .globl _CreateFatFileSystem - .globl _CreateFatBootSector - .globl _GetNewSerialNumber - .globl _ClearSectorBuffer - .globl _SectorBootCode - .globl _remote_CalculateFatFileSystemParameters - .globl _CalculateFatFileSystemParameters - .globl _CalculateFatFileSystemParametersFat12 - .globl _CalculateFatFileSystemParametersFat16 - .globl _WriteSectorToDevice - .globl _remote_PreparePartitionningProcess - .globl _remote_CreatePartition - .globl _CreatePartition - .globl _putchar - .globl _Locate - .globl _DriverCall - .globl _DosCall - .globl _SwitchSystemBankThenCall - .globl _AsmCallAlt -;-------------------------------------------------------- -; special function registers -;-------------------------------------------------------- -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _DATA -_sectorBuffer:: - .ds 512 -_sectorBufferBackup:: - .ds 512 -_ASMRUT:: - .ds 4 -_OUT_FLAGS:: - .ds 1 -_regs:: - .ds 12 -_driverSlot:: - .ds 1 -_deviceIndex:: - .ds 1 -_selectedLunIndex:: - .ds 1 -_partitionsCount:: - .ds 2 -_partitions:: - .ds 2 -_nextDeviceSector:: - .ds 4 -_mainExtendedPartitionSectorCount:: - .ds 4 -_mainExtendedPartitionFirstSector:: - .ds 4 -_sectorsPerTrack:: - .ds 2 -;-------------------------------------------------------- -; ram data -;-------------------------------------------------------- - .area _INITIALIZED -;-------------------------------------------------------- -; absolute external ram data -;-------------------------------------------------------- - .area _DABS (ABS) -;-------------------------------------------------------- -; global & static initialisations -;-------------------------------------------------------- - .area _HOME - .area _GSINIT - .area _GSFINAL - .area _GSINIT -;-------------------------------------------------------- -; Home -;-------------------------------------------------------- - .area _HOME - .area _HOME -;-------------------------------------------------------- -; code -;-------------------------------------------------------- - .area _CODE -;fdisk2.c:61: int main(int bc, int hl) -; --------------------------------- -; Function main -; --------------------------------- -_main_start:: -_main: -;fdisk2.c:63: ASMRUT[0] = 0xC3; //Code for JP - ld hl,#_ASMRUT - ld (hl),#0xC3 -;fdisk2.c:64: switch(bc) { - ld iy,#2 - add iy,sp - ld a,0 (iy) - sub a, #0x01 - ld a,1 (iy) - rla - ccf - rra - sbc a, #0x80 - jr C,00105$ - ld a,#0x04 - cp a, 0 (iy) - ld a,#0x00 - sbc a, 1 (iy) - jp PO, 00115$ - xor a, #0x80 -00115$: - jp M,00105$ - ld hl, #2+0 - add hl, sp - ld a, (hl) - add a,#0xFF - ld e,a -;fdisk2.c:66: return remote_CalculateFatFileSystemParameters((byte*)hl); - ld iy,#4 - add iy,sp - ld c,0 (iy) - ld b,1 (iy) -;fdisk2.c:64: switch(bc) { - ld d,#0x00 - ld hl,#00116$ - add hl,de - add hl,de -;fdisk2.c:65: case f_CalculateFatFileSystemParameters: - jp (hl) -00116$: - jr 00101$ - jr 00102$ - jr 00103$ - jr 00104$ -00101$: -;fdisk2.c:66: return remote_CalculateFatFileSystemParameters((byte*)hl); - push bc - call _remote_CalculateFatFileSystemParameters - pop af - ret -;fdisk2.c:68: case f_CreateFatFileSystem: -00102$: -;fdisk2.c:69: return remote_CreateFatFileSystem((byte*)hl); - push bc - call _remote_CreateFatFileSystem - pop af - ret -;fdisk2.c:71: case f_PreparePartitionningProcess: -00103$: -;fdisk2.c:72: return remote_PreparePartitionningProcess((byte*)hl); - push bc - call _remote_PreparePartitionningProcess - pop af - ret -;fdisk2.c:74: case f_CreatePartition: -00104$: -;fdisk2.c:75: return remote_CreatePartition((byte*)hl); - push bc - call _remote_CreatePartition - pop af - ret -;fdisk2.c:77: default: -00105$: -;fdisk2.c:78: return 0; - ld hl,#0x0000 -;fdisk2.c:79: } - ret -_main_end:: -;fdisk2.c:83: int remote_CreateFatFileSystem(byte* callerParameters) -; --------------------------------- -; Function remote_CreateFatFileSystem -; --------------------------------- -_remote_CreateFatFileSystem_start:: -_remote_CreateFatFileSystem: - push ix - ld ix,#0 - add ix,sp - ld hl,#-8 - add hl,sp - ld sp,hl -;fdisk2.c:90: *((ulong*)&callerParameters[7])); - ld a,4 (ix) - add a, #0x07 - ld e,a - ld a,5 (ix) - adc a, #0x00 - ld d,a - ld hl, #0x0004 - add hl, sp - ex de, hl - ld bc, #0x0004 - ldir -;fdisk2.c:89: *((ulong*)&callerParameters[3]), - ld e,4 (ix) - ld d,5 (ix) - inc de - inc de - inc de - ld hl, #0x0000 - add hl, sp - ex de, hl - ld bc, #0x0004 - ldir -;fdisk2.c:88: callerParameters[2], - ld c,4 (ix) - ld b,5 (ix) - push bc - pop iy - ld b,2 (iy) -;fdisk2.c:87: callerParameters[1], - ld e,1 (iy) -;fdisk2.c:86: callerParameters[0], - ld d, 0 (iy) - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld l,-4 (ix) - ld h,-3 (ix) - push hl - ld l,-6 (ix) - ld h,-5 (ix) - push hl - ld l,-8 (ix) - ld h,-7 (ix) - push hl - push bc - inc sp - ld a,e - push af - inc sp - push de - inc sp - call _CreateFatFileSystem - ld iy,#0x000B - add iy,sp - ld sp,iy - ld h,#0x00 - ld sp,ix - pop ix - ret -_remote_CreateFatFileSystem_end:: -;fdisk2.c:94: byte CreateFatFileSystem(byte driverSlot, byte deviceIndex, byte lunIndex, ulong firstDeviceSector, ulong fileSystemSizeInK) -; --------------------------------- -; Function CreateFatFileSystem -; --------------------------------- -_CreateFatFileSystem_start:: -_CreateFatFileSystem: - push ix - ld ix,#0 - add ix,sp - ld hl,#-37 - add hl,sp - ld sp,hl -;fdisk2.c:102: CalculateFatFileSystemParameters(fileSystemSizeInK, ¶meters); - ld hl,#0x0004 - add hl,sp - ld -2 (ix),l - ld -1 (ix),h - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld l,13 (ix) - ld h,14 (ix) - push hl - ld l,11 (ix) - ld h,12 (ix) - push hl - call _CalculateFatFileSystemParameters - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk2.c:106: CreateFatBootSector(¶meters); - ld l,-2 (ix) - ld h,-1 (ix) - push hl - call _CreateFatBootSector - pop af -;fdisk2.c:108: if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, firstDeviceSector)) != 0) { - ld l,9 (ix) - ld h,10 (ix) - push hl - ld l,7 (ix) - ld h,8 (ix) - push hl - ld h,6 (ix) - ld l,5 (ix) - push hl - ld a,4 (ix) - push af - inc sp - call _WriteSectorToDevice - pop af - pop af - pop af - inc sp - ld -3 (ix), l - ld -4 (ix), l - ld a,-3 (ix) - or a, a - jr Z,00102$ -;fdisk2.c:109: return error; - ld l,-4 (ix) - jp 00115$ -00102$: -;fdisk2.c:114: ClearSectorBuffer(); - call _ClearSectorBuffer -;fdisk2.c:115: zeroSectorsToWrite = (parameters.sectorsPerFat * FAT_COPIES) + (parameters.sectorsPerRootDirectory) - 1; - ld a,-2 (ix) - add a, #0x0A - ld -6 (ix),a - ld a,-1 (ix) - adc a, #0x00 - ld -5 (ix),a - ld l,-6 (ix) - ld h,-5 (ix) - ld a,(hl) - ld -8 (ix),a - inc hl - ld a,(hl) - ld -7 (ix),a - sla -8 (ix) - rl -7 (ix) - ld a,-2 (ix) - ld -10 (ix),a - ld a,-1 (ix) - ld -9 (ix),a - ld l,-10 (ix) - ld h,-9 (ix) - ld de, #0x000D - add hl, de - ld a,(hl) - ld -10 (ix), a - ld -10 (ix),a - ld -9 (ix),#0x00 - ld a,-10 (ix) - add a, -8 (ix) - ld -10 (ix),a - ld a,-9 (ix) - adc a, -7 (ix) - ld -9 (ix),a - ld a,-10 (ix) - add a,#0xFF - ld -35 (ix),a - ld a,-9 (ix) - adc a,#0xFF - ld -34 (ix),a -;fdisk2.c:116: sectorNumber = firstDeviceSector + 2; - ld a,7 (ix) - add a, #0x02 - ld -14 (ix),a - ld a,8 (ix) - adc a, #0x00 - ld -13 (ix),a - ld a,9 (ix) - adc a, #0x00 - ld -12 (ix),a - ld a,10 (ix) - adc a, #0x00 - ld -11 (ix),a -;fdisk2.c:117: for(i = 0; i < zeroSectorsToWrite; i++) { - ld hl,#0x0000 - ex (sp), hl -00113$: - ld a,-37 (ix) - sub a, -35 (ix) - ld a,-36 (ix) - sbc a, -34 (ix) - jr NC,00105$ -;fdisk2.c:118: if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, sectorNumber)) != 0) { - ld l,-12 (ix) - ld h,-11 (ix) - push hl - ld l,-14 (ix) - ld h,-13 (ix) - push hl - ld h,6 (ix) - ld l,5 (ix) - push hl - ld a,4 (ix) - push af - inc sp - call _WriteSectorToDevice - pop af - pop af - pop af - inc sp - ld a,l - ld -4 (ix),a - or a, a - jr Z,00104$ -;fdisk2.c:119: return error; - ld l,-4 (ix) - jp 00115$ -00104$: -;fdisk2.c:121: sectorNumber++; - inc -14 (ix) - jr NZ,00140$ - inc -13 (ix) - jr NZ,00140$ - inc -12 (ix) - jr NZ,00140$ - inc -11 (ix) -00140$: -;fdisk2.c:117: for(i = 0; i < zeroSectorsToWrite; i++) { - inc -37 (ix) - jr NZ,00113$ - inc -36 (ix) - jr 00113$ -00105$: -;fdisk2.c:126: sectorBuffer[0] = 0xF0; - ld hl,#_sectorBuffer - ld (hl),#0xF0 -;fdisk2.c:127: sectorBuffer[1] = 0xFF; - ld hl,#(_sectorBuffer + 0x0001) - ld (hl),#0xFF -;fdisk2.c:128: sectorBuffer[2] = 0xFF; - ld hl,#(_sectorBuffer + 0x0002) - ld (hl),#0xFF -;fdisk2.c:129: if(parameters.isFat16) { - ld a,-2 (ix) - ld -14 (ix),a - ld a,-1 (ix) - ld -13 (ix),a - ld l,-14 (ix) - ld h,-13 (ix) - ld de, #0x000E - add hl, de - ld a,(hl) - or a, a - jr Z,00107$ -;fdisk2.c:130: sectorBuffer[3] = 0xFF; - ld hl,#_sectorBuffer + 3 - ld (hl),#0xFF -00107$: -;fdisk2.c:132: if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, firstDeviceSector + 1)) != 0) { - ld a,7 (ix) - add a, #0x01 - ld -14 (ix),a - ld a,8 (ix) - adc a, #0x00 - ld -13 (ix),a - ld a,9 (ix) - adc a, #0x00 - ld -12 (ix),a - ld a,10 (ix) - adc a, #0x00 - ld -11 (ix),a - ld l,-12 (ix) - ld h,-11 (ix) - push hl - ld l,-14 (ix) - ld h,-13 (ix) - push hl - ld h,6 (ix) - ld l,5 (ix) - push hl - ld a,4 (ix) - push af - inc sp - call _WriteSectorToDevice - pop af - pop af - pop af - inc sp - ld a,l - ld -4 (ix),a - or a, a - jr Z,00109$ -;fdisk2.c:133: return error; - ld l,-4 (ix) - jr 00115$ -00109$: -;fdisk2.c:135: if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, firstDeviceSector + 1 + parameters.sectorsPerFat)) != 0) { - ld l,-6 (ix) - ld h,-5 (ix) - ld a,(hl) - ld -10 (ix),a - inc hl - ld a,(hl) - ld -9 (ix),a - ld a,-10 (ix) - ld -18 (ix),a - ld a,-9 (ix) - ld -17 (ix),a - ld -16 (ix),#0x00 - ld -15 (ix),#0x00 - ld a,-14 (ix) - add a, -18 (ix) - ld -18 (ix),a - ld a,-13 (ix) - adc a, -17 (ix) - ld -17 (ix),a - ld a,-12 (ix) - adc a, -16 (ix) - ld -16 (ix),a - ld a,-11 (ix) - adc a, -15 (ix) - ld -15 (ix),a - ld l,-16 (ix) - ld h,-15 (ix) - push hl - ld l,-18 (ix) - ld h,-17 (ix) - push hl - ld h,6 (ix) - ld l,5 (ix) - push hl - ld a,4 (ix) - push af - inc sp - call _WriteSectorToDevice - pop af - pop af - pop af - inc sp - ld a,l - ld -4 (ix),a - or a, a - jr Z,00111$ -;fdisk2.c:136: return error; - ld l,-4 (ix) - jr 00115$ -00111$: -;fdisk2.c:141: return 0; - ld l,#0x00 -00115$: - ld sp,ix - pop ix - ret -_CreateFatFileSystem_end:: -;fdisk2.c:145: void CreateFatBootSector(dosFilesystemParameters* parameters) -; --------------------------------- -; Function CreateFatBootSector -; --------------------------------- -_CreateFatBootSector_start:: -_CreateFatBootSector: - push ix - ld ix,#0 - add ix,sp - push af - dec sp -;fdisk2.c:147: fatBootSector* sector = (fatBootSector*)sectorBuffer; -;fdisk2.c:149: ClearSectorBuffer(); - call _ClearSectorBuffer -;fdisk2.c:151: sector->jumpInstruction[0] = 0xEB; - ld hl,#_sectorBuffer - ld (hl),#0xEB -;fdisk2.c:152: sector->jumpInstruction[1] = 0xFE; - inc hl - ld (hl),#0xFE -;fdisk2.c:153: sector->jumpInstruction[2] = 0x90; - ld hl,#_sectorBuffer + 2 - ld (hl),#0x90 -;fdisk2.c:154: strcpy(sector->oemNameString, "NEXTOR20"); - ld hl,#__str_0 - ld de,#(_sectorBuffer + 0x0003) - xor a, a -00114$: - cp a, (hl) - ldi - jr NZ, 00114$ -;fdisk2.c:155: sector->sectorSize = 512; - ld hl,#0x0200 - ld ((_sectorBuffer + 0x000b)), hl -;fdisk2.c:156: sector->sectorsPerCluster = parameters->sectorsPerCluster; - ld a,4 (ix) - ld -2 (ix),a - ld a,5 (ix) - ld -1 (ix),a - ld l,-2 (ix) - ld h,-1 (ix) - ld de, #0x000C - add hl, de - ld a,(hl) - ld (#(_sectorBuffer + 0x000d)),a -;fdisk2.c:157: sector->reservedSectors = 1; - ld hl,#0x0001 - ld ((_sectorBuffer + 0x000e)), hl -;fdisk2.c:158: sector->numberOfFats = FAT_COPIES; - ld hl,#_sectorBuffer + 16 - ld (hl),#0x02 -;fdisk2.c:159: sector->rootDirectoryEntries = parameters->sectorsPerRootDirectory * DIR_ENTRIES_PER_SECTOR; - ld l,-2 (ix) - ld h,-1 (ix) - ld de, #0x000D - add hl, de - ld l,(hl) - ld h,#0x00 - add hl, hl - add hl, hl - add hl, hl - add hl, hl - ex de,hl - ld ((_sectorBuffer + 0x0011)), de -;fdisk2.c:160: if((parameters->totalSectors & 0xFFFF0000) == 0) { - ld l,-2 (ix) - ld h,-1 (ix) - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld h,(hl) - ld a,c - or a,a - jr NZ,00102$ - or a,h - jr NZ,00102$ -;fdisk2.c:161: sector->smallSectorCount = parameters->totalSectors; - ld ((_sectorBuffer + 0x0013)), de -00102$: -;fdisk2.c:163: sector->mediaId = 0xF0; - ld hl,#_sectorBuffer + 21 - ld (hl),#0xF0 -;fdisk2.c:164: sector->sectorsPerFat = parameters->sectorsPerFat; - ld l,-2 (ix) - ld h,-1 (ix) - ld de, #0x000A - add hl, de - ld e,(hl) - inc hl - ld d,(hl) - ld ((_sectorBuffer + 0x0016)), de -;fdisk2.c:165: strcpy(sector->params.standard.volumeLabelString, "NEXTOR 2.0 "); //it is same for DOS 2.20 format - ld hl,#__str_1 - ld de,#(_sectorBuffer + 0x002b) - xor a, a -00117$: - cp a, (hl) - ldi - jr NZ, 00117$ -;fdisk2.c:166: sector->params.standard.serialNumber = GetNewSerialNumber(); //it is same for DOS 2.20 format - call _GetNewSerialNumber - ld c,l - ld b,h - ld ((_sectorBuffer + 0x0027)), bc - ld ((_sectorBuffer + 0x0027) + 2), de -;fdisk2.c:168: if(parameters->isFat16) { - ld c,-2 (ix) - ld b,-1 (ix) - push bc - pop iy - ld a,14 (iy) -;fdisk2.c:169: sector->params.standard.bigSectorCount = parameters->totalSectors; -;fdisk2.c:171: strcpy(sector->params.standard.fatTypeString, "FAT16 "); -;fdisk2.c:168: if(parameters->isFat16) { - ld -3 (ix), a - or a, a - jr Z,00104$ -;fdisk2.c:169: sector->params.standard.bigSectorCount = parameters->totalSectors; - ld l,-2 (ix) - ld h,-1 (ix) - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld c,(hl) - inc hl - ld b,(hl) - ld ((_sectorBuffer + 0x0020)), de - ld ((_sectorBuffer + 0x0020) + 2), bc -;fdisk2.c:170: sector->params.standard.extendedBlockSignature = 0x29; - ld hl,#(_sectorBuffer + 0x001c) + 10 - ld (hl),#0x29 -;fdisk2.c:171: strcpy(sector->params.standard.fatTypeString, "FAT16 "); - ld hl,#__str_2 - ld de,#(_sectorBuffer + 0x0036) - xor a, a -00118$: - cp a, (hl) - ldi - jr NZ, 00118$ - jr 00106$ -00104$: -;fdisk2.c:173: sector->params.DOS220.z80JumpInstruction[0] = 0x18; - ld hl,#(_sectorBuffer + 0x001e) - ld (hl),#0x18 -;fdisk2.c:174: sector->params.DOS220.z80JumpInstruction[1] = 0x1E; - ld hl,#(_sectorBuffer + 0x001f) - ld (hl),#0x1E -;fdisk2.c:175: strcpy(sector->params.DOS220.volIdString, "VOL_ID"); - ld de,#(_sectorBuffer + 0x0020) - ld hl,#__str_3 - xor a, a -00119$: - cp a, (hl) - ldi - jr NZ, 00119$ -;fdisk2.c:176: strcpy(sector->params.DOS220.fatTypeString, "FAT12 "); - ld de,#(_sectorBuffer + 0x0036) - ld hl,#__str_4 - xor a, a -00120$: - cp a, (hl) - ldi - jr NZ, 00120$ -;fdisk2.c:177: memcpy(&(sector->params.DOS220.z80BootCode), SectorBootCode, (uint)0xC090 - (uint)0xC03E); - ld -2 (ix),#<(_SectorBootCode) - ld -1 (ix),#>(_SectorBootCode) - ld de,#(_sectorBuffer + 0x003e) - ld l,-2 (ix) - ld h,-1 (ix) - ld bc,#0x0052 - ldir -00106$: - ld sp,ix - pop ix - ret -_CreateFatBootSector_end:: -__str_0: - .ascii "NEXTOR20" - .db 0x00 -__str_1: - .ascii "NEXTOR 2.0 " - .db 0x00 -__str_2: - .ascii "FAT16 " - .db 0x00 -__str_3: - .ascii "VOL_ID" - .db 0x00 -__str_4: - .ascii "FAT12 " - .db 0x00 -;fdisk2.c:183: ulong GetNewSerialNumber() __naked -; --------------------------------- -; Function GetNewSerialNumber -; --------------------------------- -_GetNewSerialNumber_start:: -_GetNewSerialNumber: -;fdisk2.c:223: __endasm; - ld a,r - xor b - ld e,a - or #128 - ld b,a - gnsn_1: - nop - djnz gnsn_1 - ld a,r - xor e - ld d,a - or #64 - ld b,a - gnsn_2: - nop - nop - djnz gnsn_2 - ld a,r - xor d - ld l,a - or #32 - ld b,a - gnsn_3: - nop - nop - nop - djnz gnsn_3 - ld a,r - xor l - ld h,a - ret -_GetNewSerialNumber_end:: -;fdisk2.c:227: void ClearSectorBuffer() __naked -; --------------------------------- -; Function ClearSectorBuffer -; --------------------------------- -_ClearSectorBuffer_start:: -_ClearSectorBuffer: -;fdisk2.c:239: __endasm; - ld hl,#_sectorBuffer - ld de,#_sectorBuffer - inc de - ld bc,#512-1 - ld (hl),#0 - ldir - ret -_ClearSectorBuffer_end:: -;fdisk2.c:243: void SectorBootCode() __naked -; --------------------------------- -; Function SectorBootCode -; --------------------------------- -_SectorBootCode_start:: -_SectorBootCode: -;fdisk2.c:283: __endasm; - ret nc - ld (#0xc07b),de - ld de,#0xc078 - ld (hl),e - inc hl - ld (hl),d - ld de,#0xc080 - ld c,#0x0f - call #0xf37d - inc a - jp z,#0x4022 - ld de,#0x100 - ld c,#0x1a - call #0xf37d - ld hl,#1 - ld (#0xc08e),hl - ld hl,#0x3f00 - ld de,#0xc080 - ld c,#0x27 - push de - call #0xf37d - pop de - ld c,#0x10 - call #0xf37d - jp 0x0100 - ld l,b - ret nz - call #0 - jp 0x4022 - nop - .ascii "MSXDOS SYS" - nop - nop - nop - nop -_SectorBootCode_end:: -;fdisk2.c:287: int remote_CalculateFatFileSystemParameters(byte* callerParameters) -; --------------------------------- -; Function remote_CalculateFatFileSystemParameters -; --------------------------------- -_remote_CalculateFatFileSystemParameters_start:: -_remote_CalculateFatFileSystemParameters: - push ix - ld ix,#0 - add ix,sp - push af - push af -;fdisk2.c:289: ulong fileSystemSizeInK = *((ulong*)&callerParameters[0]); - ld c,4 (ix) - ld b,5 (ix) - ld e, c - ld d, b - push bc - ld hl, #0x0002 - add hl, sp - ex de, hl - ld bc, #0x0004 - ldir - pop bc -;fdisk2.c:290: dosFilesystemParameters* parameters = *((dosFilesystemParameters**)&callerParameters[4]); - ld hl,#0x0004 - add hl,bc - ld e,(hl) - inc hl - ld d,(hl) -;fdisk2.c:291: CalculateFatFileSystemParameters(fileSystemSizeInK, parameters); - push de - ld l,-2 (ix) - ld h,-1 (ix) - push hl - ld l,-4 (ix) - ld h,-3 (ix) - push hl - call _CalculateFatFileSystemParameters - ld hl,#0x0006 - add hl,sp - ld sp,hl -;fdisk2.c:292: return 0xB5; - ld hl,#0x00B5 - ld sp,ix - pop ix - ret -_remote_CalculateFatFileSystemParameters_end:: -;fdisk2.c:296: void CalculateFatFileSystemParameters(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -; --------------------------------- -; Function CalculateFatFileSystemParameters -; --------------------------------- -_CalculateFatFileSystemParameters_start:: -_CalculateFatFileSystemParameters: -;fdisk2.c:298: if(fileSystemSizeInK > MAX_FAT12_PARTITION_SIZE_IN_K) { - xor a, a - ld iy,#2 - add iy,sp - cp a, 0 (iy) - ld a,#0x80 - sbc a, 1 (iy) - ld a,#0x00 - sbc a, 2 (iy) - ld a,#0x00 - sbc a, 3 (iy) - jr NC,00102$ -;fdisk2.c:299: CalculateFatFileSystemParametersFat16(fileSystemSizeInK, parameters); - ld hl, #6 - add hl, sp - ld c, (hl) - inc hl - ld b, (hl) - push bc - ld iy,#4 - add iy,sp - ld l,2 (iy) - ld h,3 (iy) - push hl - ld l,0 (iy) - ld h,1 (iy) - push hl - call _CalculateFatFileSystemParametersFat16 - ld hl,#0x0006 - add hl,sp - ld sp,hl - ret -00102$: -;fdisk2.c:301: CalculateFatFileSystemParametersFat12(fileSystemSizeInK, parameters); - ld hl, #6 - add hl, sp - ld c, (hl) - inc hl - ld b, (hl) - push bc - ld iy,#4 - add iy,sp - ld l,2 (iy) - ld h,3 (iy) - push hl - ld l,0 (iy) - ld h,1 (iy) - push hl - call _CalculateFatFileSystemParametersFat12 - ld hl,#0x0006 - add hl,sp - ld sp,hl - ret -_CalculateFatFileSystemParameters_end:: -;fdisk2.c:306: int CalculateFatFileSystemParametersFat12(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -; --------------------------------- -; Function CalculateFatFileSystemParametersFat12 -; --------------------------------- -_CalculateFatFileSystemParametersFat12_start:: -_CalculateFatFileSystemParametersFat12: - push ix - ld ix,#0 - add ix,sp - ld hl,#-21 - add hl,sp - ld sp,hl -;fdisk2.c:317: uint maxClusterCount = MAX_FAT12_CLUSTER_COUNT; - ld -19 (ix),#0xF6 - ld -18 (ix),#0x0F -;fdisk2.c:318: uint maxSectorsPerFat = 12; - ld hl,#0x000C - ex (sp), hl -;fdisk2.c:329: } else if(fileSystemSizeInK <= (16 * (ulong)1024)) { - xor a, a - cp a, 4 (ix) - ld a,#0x40 - sbc a, 5 (ix) - ld a,#0x00 - sbc a, 6 (ix) - ld a,#0x00 - sbc a, 7 (ix) - ld a,#0x00 - rla - ld -1 (ix),a -;fdisk2.c:320: if(fileSystemSizeInK <= (2 * (ulong)1024)) { - xor a, a - cp a, 4 (ix) - ld a,#0x08 - sbc a, 5 (ix) - ld a,#0x00 - sbc a, 6 (ix) - ld a,#0x00 - sbc a, 7 (ix) - jr C,00111$ -;fdisk2.c:321: sectorsPerClusterPower = 0; - ld -17 (ix),#0x00 - ld -16 (ix),#0x00 -;fdisk2.c:322: sectorsPerCluster = 1; - ld -7 (ix),#0x01 - ld -6 (ix),#0x00 - jr 00112$ -00111$: -;fdisk2.c:323: } else if(fileSystemSizeInK <= (4 * (ulong)1024)) { - xor a, a - cp a, 4 (ix) - ld a,#0x10 - sbc a, 5 (ix) - ld a,#0x00 - sbc a, 6 (ix) - ld a,#0x00 - sbc a, 7 (ix) - jr C,00108$ -;fdisk2.c:324: sectorsPerClusterPower = 1; - ld -17 (ix),#0x01 - ld -16 (ix),#0x00 -;fdisk2.c:325: sectorsPerCluster = 2; - ld -7 (ix),#0x02 - ld -6 (ix),#0x00 - jr 00112$ -00108$: -;fdisk2.c:326: } else if(fileSystemSizeInK <= (8 * (ulong)1024)) { - xor a, a - cp a, 4 (ix) - ld a,#0x20 - sbc a, 5 (ix) - ld a,#0x00 - sbc a, 6 (ix) - ld a,#0x00 - sbc a, 7 (ix) - jr C,00105$ -;fdisk2.c:327: sectorsPerClusterPower = 2; - ld -17 (ix),#0x02 - ld -16 (ix),#0x00 -;fdisk2.c:328: sectorsPerCluster = 4; - ld -7 (ix),#0x04 - ld -6 (ix),#0x00 - jr 00112$ -00105$: -;fdisk2.c:329: } else if(fileSystemSizeInK <= (16 * (ulong)1024)) { - ld a,-1 (ix) - or a, a - jr NZ,00102$ -;fdisk2.c:330: sectorsPerClusterPower = 3; - ld -17 (ix),#0x03 - ld -16 (ix),#0x00 -;fdisk2.c:331: sectorsPerCluster = 8; - ld -7 (ix),#0x08 - ld -6 (ix),#0x00 - jr 00112$ -00102$: -;fdisk2.c:333: sectorsPerClusterPower = 4; - ld -17 (ix),#0x04 - ld -16 (ix),#0x00 -;fdisk2.c:334: sectorsPerCluster = 16; - ld -7 (ix),#0x10 - ld -6 (ix),#0x00 -00112$: -;fdisk2.c:337: if(fileSystemSizeInK <= (16 * (ulong)1024)) { - ld a,-1 (ix) - or a, a - jr NZ,00114$ -;fdisk2.c:338: maxClusterCount = 1021; - ld -19 (ix),#0xFD - ld -18 (ix),#0x03 -;fdisk2.c:339: maxSectorsPerFat = 3; - ld hl,#0x0003 - ex (sp), hl -;fdisk2.c:340: sectorsPerCluster *= 4; - ld a,#0x02+1 - jr 00144$ -00143$: - sla -7 (ix) - rl -6 (ix) -00144$: - dec a - jr NZ,00143$ -;fdisk2.c:341: sectorsPerClusterPower += 2; - ld a,-17 (ix) - add a, #0x02 - ld -17 (ix),a - ld a,-16 (ix) - adc a, #0x00 - ld -16 (ix),a -00114$: -;fdisk2.c:344: dataSectorsCount = (fileSystemSizeInK * 2) - (FAT12_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR) - 1; - push af - ld l,4 (ix) - ld h,5 (ix) - ld e,6 (ix) - ld d,7 (ix) - pop af - add hl, hl - rl e - rl d - ld a,l - add a,#0xF8 - ld -15 (ix),a - ld a,h - adc a,#0xFF - ld -14 (ix),a - ld a,e - adc a,#0xFF - ld -13 (ix),a - ld a,d - adc a,#0xFF - ld -12 (ix),a -;fdisk2.c:346: clusterCount = dataSectorsCount >> sectorsPerClusterPower; - ld b,-17 (ix) - push af - ld l,-15 (ix) - ld h,-14 (ix) - ld e,-13 (ix) - ld d,-12 (ix) - pop af - inc b - jr 00148$ -00147$: - srl d - rr e - rr h - rr l -00148$: - djnz 00147$ - ld -11 (ix),l - ld -10 (ix),h -;fdisk2.c:347: sectorsPerFat = ((uint)clusterCount + 2) * 3; - ld l,-11 (ix) - ld h,-10 (ix) - inc hl - inc hl - ld c, l - ld b, h - add hl, hl - add hl, bc - ld -9 (ix),l -;fdisk2.c:350: sectorsPerFat >>= 10; - ld -8 (ix), h - ld a, h - rrca - rrca - and a,#0x3F - ld h,a - ld l,#0x00 -;fdisk2.c:349: if((sectorsPerFat & 0x3FF) == 0) { - ld a,-9 (ix) - or a, a - jr NZ,00116$ - ld a,-8 (ix) - and a, #0x03 - jr NZ,00116$ -;fdisk2.c:350: sectorsPerFat >>= 10; - ld -9 (ix),h - ld -8 (ix),l - jr 00117$ -00116$: -;fdisk2.c:352: sectorsPerFat >>= 10; - ld -9 (ix),h - ld -8 (ix),l -;fdisk2.c:353: sectorsPerFat++; - inc -9 (ix) - jr NZ,00151$ - inc -8 (ix) -00151$: -00117$: -;fdisk2.c:356: clusterCount = (dataSectorsCount - FAT_COPIES * sectorsPerFat) >> sectorsPerClusterPower; - ld l,-9 (ix) - ld h,-8 (ix) - add hl, hl - ld e,#0x00 - ld b,#0x00 - ld a,-15 (ix) - sub a, l - ld l,a - ld a,-14 (ix) - sbc a, h - ld d,a - ld a,-13 (ix) - sbc a, e - ld e,a - ld a,-12 (ix) - sbc a, b - ld h,a - ld b,-17 (ix) - inc b - jr 00153$ -00152$: - srl h - rr e - rr d - rr l -00153$: - djnz 00152$ - ld -11 (ix),l - ld -10 (ix),d -;fdisk2.c:357: dataSectorsCount = (uint)clusterCount * (uint)sectorsPerCluster; - ld l,-7 (ix) - ld h,-6 (ix) - push hl - ld l,-11 (ix) - ld h,-10 (ix) - push hl - call __mulint_rrx_s - pop af - pop af - ld -15 (ix),l - ld -14 (ix),h - ld -13 (ix),#0x00 - ld -12 (ix),#0x00 -;fdisk2.c:359: if(clusterCount > maxClusterCount) { - ld a,-19 (ix) - sub a, -11 (ix) - ld a,-18 (ix) - sbc a, -10 (ix) - jr NC,00119$ -;fdisk2.c:360: difference = clusterCount - maxClusterCount; - ld a,-11 (ix) - sub a, -19 (ix) - ld l,a - ld a,-10 (ix) - sbc a, -18 (ix) - ld h,a -;fdisk2.c:361: clusterCount = maxClusterCount; - ld a,-19 (ix) - ld -11 (ix),a - ld a,-18 (ix) - ld -10 (ix),a -;fdisk2.c:362: sectorsPerFat = maxSectorsPerFat; - ld a,-21 (ix) - ld -9 (ix),a - ld a,-20 (ix) - ld -8 (ix),a -;fdisk2.c:363: dataSectorsCount -= difference * sectorsPerCluster; - ld c,-7 (ix) - ld b,-6 (ix) - push bc - push hl - call __mulint_rrx_s - pop af - pop af - ld de,#0x0000 - ld a,-15 (ix) - sub a, l - ld -15 (ix),a - ld a,-14 (ix) - sbc a, h - ld -14 (ix),a - ld a,-13 (ix) - sbc a, e - ld -13 (ix),a - ld a,-12 (ix) - sbc a, d - ld -12 (ix),a -00119$: -;fdisk2.c:366: parameters->totalSectors = dataSectorsCount + 1 + (sectorsPerFat * FAT_COPIES) + (FAT12_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - ld e,8 (ix) - ld d,9 (ix) - ld l,-9 (ix) - ld h,-8 (ix) - add hl, hl - ld bc,#0x0008 - add hl,bc - ld bc,#0x0000 - ld a,-15 (ix) - add a, l - ld -5 (ix),a - ld a,-14 (ix) - adc a, h - ld -4 (ix),a - ld a,-13 (ix) - adc a, c - ld -3 (ix),a - ld a,-12 (ix) - adc a, b - ld -2 (ix),a - push de - ld hl, #0x0012 - add hl, sp - ld bc, #0x0004 - ldir - pop de -;fdisk2.c:367: parameters->dataSectors = dataSectorsCount; - ld hl,#0x0004 - add hl,de - push de - ex de,hl - ld hl, #0x0008 - add hl, sp - ld bc, #0x0004 - ldir - pop de -;fdisk2.c:368: parameters->clusterCount = clusterCount; - ld hl,#0x0008 - add hl,de - ld a,-11 (ix) - ld (hl),a - inc hl - ld a,-10 (ix) - ld (hl),a -;fdisk2.c:369: parameters->sectorsPerFat = sectorsPerFat; - ld hl,#0x000A - add hl,de - ld a,-9 (ix) - ld (hl),a - inc hl - ld a,-8 (ix) - ld (hl),a -;fdisk2.c:370: parameters->sectorsPerCluster = sectorsPerCluster; - ld hl,#0x000C - add hl,de - ld a,-7 (ix) - ld (hl),a -;fdisk2.c:371: parameters->sectorsPerRootDirectory = (FAT12_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - ld hl,#0x000D - add hl,de - ld (hl),#0x07 -;fdisk2.c:372: parameters->isFat16 = false; - ld hl,#0x000E - add hl,de - ld (hl),#0x00 -;fdisk2.c:374: return 0; - ld hl,#0x0000 - ld sp,ix - pop ix - ret -_CalculateFatFileSystemParametersFat12_end:: -;fdisk2.c:378: int CalculateFatFileSystemParametersFat16(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -; --------------------------------- -; Function CalculateFatFileSystemParametersFat16 -; --------------------------------- -_CalculateFatFileSystemParametersFat16_start:: -_CalculateFatFileSystemParametersFat16: - push ix - ld ix,#0 - add ix,sp - ld hl,#-19 - add hl,sp - ld sp,hl -;fdisk2.c:385: ulong fileSystemSizeInM = fileSystemSizeInK >> 10; - push af - ld a,4 (ix) - ld -19 (ix),a - ld a,5 (ix) - ld -18 (ix),a - ld a,6 (ix) - ld -17 (ix),a - ld a,7 (ix) - ld -16 (ix),a - pop af - ld b,#0x0A -00144$: - srl -16 (ix) - rr -17 (ix) - rr -18 (ix) - rr -19 (ix) - djnz 00144$ -;fdisk2.c:388: if(fileSystemSizeInM <= (ulong)128) { - ld a,#0x80 - cp a, -19 (ix) - ld a,#0x00 - sbc a, -18 (ix) - ld a,#0x00 - sbc a, -17 (ix) - ld a,#0x00 - sbc a, -16 (ix) - jr C,00114$ -;fdisk2.c:389: sectorsPerClusterPower = 2; - ld bc,#0x0002 -;fdisk2.c:390: sectorsPerCluster = 4; - ld -5 (ix),#0x04 - jp 00115$ -00114$: -;fdisk2.c:391: } else if(fileSystemSizeInM <= (ulong)256) { - xor a, a - cp a, -19 (ix) - ld a,#0x01 - sbc a, -18 (ix) - ld a,#0x00 - sbc a, -17 (ix) - ld a,#0x00 - sbc a, -16 (ix) - jr C,00111$ -;fdisk2.c:392: sectorsPerClusterPower = 3; - ld bc,#0x0003 -;fdisk2.c:393: sectorsPerCluster = 8; - ld -5 (ix),#0x08 - jr 00115$ -00111$: -;fdisk2.c:394: } else if(fileSystemSizeInM <= (ulong)512) { - xor a, a - cp a, -19 (ix) - ld a,#0x02 - sbc a, -18 (ix) - ld a,#0x00 - sbc a, -17 (ix) - ld a,#0x00 - sbc a, -16 (ix) - jr C,00108$ -;fdisk2.c:395: sectorsPerClusterPower = 4; - ld bc,#0x0004 -;fdisk2.c:396: sectorsPerCluster = 16; - ld -5 (ix),#0x10 - jr 00115$ -00108$: -;fdisk2.c:397: } else if(fileSystemSizeInM <= (ulong)1024) { - xor a, a - cp a, -19 (ix) - ld a,#0x04 - sbc a, -18 (ix) - ld a,#0x00 - sbc a, -17 (ix) - ld a,#0x00 - sbc a, -16 (ix) - jr C,00105$ -;fdisk2.c:398: sectorsPerClusterPower = 5; - ld bc,#0x0005 -;fdisk2.c:399: sectorsPerCluster = 32; - ld -5 (ix),#0x20 - jr 00115$ -00105$: -;fdisk2.c:400: } else if(fileSystemSizeInM <= (ulong)2048) { - xor a, a - cp a, -19 (ix) - ld a,#0x08 - sbc a, -18 (ix) - ld a,#0x00 - sbc a, -17 (ix) - ld a,#0x00 - sbc a, -16 (ix) - jr C,00102$ -;fdisk2.c:401: sectorsPerClusterPower = 6; - ld bc,#0x0006 -;fdisk2.c:402: sectorsPerCluster = 64; - ld -5 (ix),#0x40 - jr 00115$ -00102$: -;fdisk2.c:404: sectorsPerClusterPower = 7; - ld bc,#0x0007 -;fdisk2.c:405: sectorsPerCluster = 128; - ld -5 (ix),#0x80 -00115$: -;fdisk2.c:408: dataSectorsCount = (fileSystemSizeInK * 2) - (FAT16_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR) - 1; - push af - ld l,4 (ix) - ld h,5 (ix) - ld e,6 (ix) - ld d,7 (ix) - pop af - add hl, hl - rl e - rl d - ld a,l - add a,#0xDF - ld -15 (ix),a - ld a,h - adc a,#0xFF - ld -14 (ix),a - ld a,e - adc a,#0xFF - ld -13 (ix),a - ld a,d - adc a,#0xFF - ld -12 (ix),a -;fdisk2.c:409: clusterCount = dataSectorsCount >> sectorsPerClusterPower; - ld a,c - push af - ld l,-15 (ix) - ld h,-14 (ix) - ld e,-13 (ix) - ld d,-12 (ix) - pop af - inc a - jr 00149$ -00148$: - srl d - rr e - rr h - rr l -00149$: - dec a - jr NZ,00148$ - ld -11 (ix),l - ld -10 (ix),h - ld -9 (ix),e - ld -8 (ix),d -;fdisk2.c:410: sectorsPerFat = clusterCount + 2; - ld a,-11 (ix) - add a, #0x02 - ld h,a - ld a,-10 (ix) - adc a, #0x00 - ld d,a - ld a,-9 (ix) - adc a, #0x00 - ld a,-8 (ix) - adc a, #0x00 - ld -7 (ix),h -;fdisk2.c:413: sectorsPerFat >>= 8; - ld -6 (ix), d - ld h, d - ld l,#0x00 -;fdisk2.c:412: if((sectorsPerFat & 0x3FF) == 0) { - ld a,-7 (ix) - or a, a - jr NZ,00117$ - ld a,-6 (ix) - and a, #0x03 - jr NZ,00117$ -;fdisk2.c:413: sectorsPerFat >>= 8; - ld -7 (ix),h - ld -6 (ix),l - jr 00118$ -00117$: -;fdisk2.c:415: sectorsPerFat >>= 8; - ld -7 (ix),h - ld -6 (ix),l -;fdisk2.c:416: sectorsPerFat++; - inc -7 (ix) - jr NZ,00152$ - inc -6 (ix) -00152$: -00118$: -;fdisk2.c:419: clusterCount = (dataSectorsCount - FAT_COPIES * sectorsPerFat); - ld l,-7 (ix) - ld h,-6 (ix) - add hl, hl - ld de,#0x0000 - ld a,-15 (ix) - sub a, l - ld l,a - ld a,-14 (ix) - sbc a, h - ld h,a - ld a,-13 (ix) - sbc a, d - ld d,a - ld a,-12 (ix) - sbc a, e - ld e,a - ld -11 (ix),l - ld -10 (ix),h - ld -9 (ix),d - ld -8 (ix),e -;fdisk2.c:420: clusterCount >>= sectorsPerClusterPower; - ld a,c - push af - pop af - inc a - jr 00154$ -00153$: - srl -8 (ix) - rr -9 (ix) - rr -10 (ix) - rr -11 (ix) -00154$: - dec a - jr NZ,00153$ -;fdisk2.c:421: dataSectorsCount = clusterCount << sectorsPerClusterPower; - ld a,c - push af - ld l,-11 (ix) - ld h,-10 (ix) - ld d,-9 (ix) - ld e,-8 (ix) - pop af - inc a - jr 00156$ -00155$: - add hl, hl - rl d - rl e -00156$: - dec a - jr NZ,00155$ - ld -15 (ix),l - ld -14 (ix),h - ld -13 (ix),d - ld -12 (ix),e -;fdisk2.c:423: if(clusterCount > MAX_FAT16_CLUSTER_COUNT) { - ld a,#0xF6 - cp a, -11 (ix) - ld a,#0xFF - sbc a, -10 (ix) - ld a,#0x00 - sbc a, -9 (ix) - ld a,#0x00 - sbc a, -8 (ix) - jr NC,00120$ -;fdisk2.c:424: difference = clusterCount - MAX_FAT16_CLUSTER_COUNT; - ld a,-11 (ix) - add a,#0x0A - ld l,a - ld a,-10 (ix) - adc a,#0x00 - ld h,a - ld a,-9 (ix) - adc a,#0xFF - ld e,a - ld a,-8 (ix) - adc a,#0xFF - ld d,a -;fdisk2.c:425: clusterCount = MAX_FAT16_CLUSTER_COUNT; - ld -11 (ix),#0xF6 - ld -10 (ix),#0xFF - ld -9 (ix),#0x00 - ld -8 (ix),#0x00 -;fdisk2.c:426: sectorsPerFat = 256; - ld -7 (ix),#0x00 - ld -6 (ix),#0x01 -;fdisk2.c:427: dataSectorsCount -= difference << sectorsPerClusterPower; - inc c - jr 00158$ -00157$: - add hl, hl - rl e - rl d -00158$: - dec c - jr NZ,00157$ - ld a,-15 (ix) - sub a, l - ld -15 (ix),a - ld a,-14 (ix) - sbc a, h - ld -14 (ix),a - ld a,-13 (ix) - sbc a, e - ld -13 (ix),a - ld a,-12 (ix) - sbc a, d - ld -12 (ix),a -00120$: -;fdisk2.c:430: parameters->totalSectors = dataSectorsCount + 1 + (sectorsPerFat * FAT_COPIES) + (FAT16_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - ld e,8 (ix) - ld d,9 (ix) - ld l,-7 (ix) - ld h,-6 (ix) - add hl, hl - ld bc,#0x0021 - add hl,bc - ld bc,#0x0000 - ld a,-15 (ix) - add a, l - ld -4 (ix),a - ld a,-14 (ix) - adc a, h - ld -3 (ix),a - ld a,-13 (ix) - adc a, c - ld -2 (ix),a - ld a,-12 (ix) - adc a, b - ld -1 (ix),a - push de - ld hl, #0x0011 - add hl, sp - ld bc, #0x0004 - ldir - pop de -;fdisk2.c:431: parameters->dataSectors = dataSectorsCount; - ld hl,#0x0004 - add hl,de - push de - ex de,hl - ld hl, #0x0006 - add hl, sp - ld bc, #0x0004 - ldir - pop de -;fdisk2.c:432: parameters->clusterCount = clusterCount; - ld hl,#0x0008 - add hl,de - ld b,-11 (ix) - ld c,-10 (ix) - ld (hl),b - inc hl - ld (hl),c -;fdisk2.c:433: parameters->sectorsPerFat = sectorsPerFat; - ld hl,#0x000A - add hl,de - ld a,-7 (ix) - ld (hl),a - inc hl - ld a,-6 (ix) - ld (hl),a -;fdisk2.c:434: parameters->sectorsPerCluster = sectorsPerCluster; - ld hl,#0x000C - add hl,de - ld a,-5 (ix) - ld (hl),a -;fdisk2.c:435: parameters->sectorsPerRootDirectory = (FAT16_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - ld hl,#0x000D - add hl,de - ld (hl),#0x20 -;fdisk2.c:436: parameters->isFat16 = true; - ld hl,#0x000E - add hl,de - ld (hl),#0x01 -;fdisk2.c:438: return 0; - ld hl,#0x0000 - ld sp,ix - pop ix - ret -_CalculateFatFileSystemParametersFat16_end:: -;fdisk2.c:442: byte WriteSectorToDevice(byte driverSlot, byte deviceIndex, byte lunIndex, ulong firstDeviceSector) -; --------------------------------- -; Function WriteSectorToDevice -; --------------------------------- -_WriteSectorToDevice_start:: -_WriteSectorToDevice: - push ix - ld ix,#0 - add ix,sp -;fdisk2.c:444: regs.Flags.C = 1; - ld hl,#_regs - ld a,(hl) - or a,#0x01 - ld (hl),a -;fdisk2.c:445: regs.Bytes.A = deviceIndex; - ld hl,#_regs + 1 - ld a,5 (ix) - ld (hl),a -;fdisk2.c:446: regs.Bytes.B = 1; - ld hl,#_regs + 3 - ld (hl),#0x01 -;fdisk2.c:447: regs.Bytes.C = lunIndex; - ld hl,#_regs + 2 - ld a,6 (ix) - ld (hl),a -;fdisk2.c:448: regs.Words.HL = (int)sectorBuffer; - ld de,#_sectorBuffer - ld ((_regs + 0x0006)), de -;fdisk2.c:449: regs.Words.DE = (int)&firstDeviceSector; - ld hl,#0x0007 - add hl,sp - ex de,hl - ld ((_regs + 0x0004)), de -;fdisk2.c:451: DriverCall(driverSlot, DEV_RW); - ld hl,#0x4160 - push hl - ld a,4 (ix) - push af - inc sp - call _DriverCall - pop af - inc sp -;fdisk2.c:452: return regs.Bytes.A; - ld a, (#_regs + 1) - ld l,a - pop ix - ret -_WriteSectorToDevice_end:: -;fdisk2.c:456: int remote_PreparePartitionningProcess(byte* callerParameters) -; --------------------------------- -; Function remote_PreparePartitionningProcess -; --------------------------------- -_remote_PreparePartitionningProcess_start:: -_remote_PreparePartitionningProcess: - push ix - ld ix,#0 - add ix,sp - ld hl,#-6 - add hl,sp - ld sp,hl -;fdisk2.c:462: driverSlot = callerParameters[0]; - ld e,4 (ix) - ld d,5 (ix) - ld a,(de) - ld (#_driverSlot + 0),a -;fdisk2.c:463: deviceIndex = callerParameters[1]; - ld l, e - ld h, d - inc hl - ld a,(hl) - ld (#_deviceIndex + 0),a -;fdisk2.c:464: selectedLunIndex = callerParameters[2]; - ld l, e - ld h, d - inc hl - inc hl - ld a,(hl) - ld (#_selectedLunIndex + 0),a -;fdisk2.c:465: partitionsCount = *((uint*)&callerParameters[3]); - ld l, e - ld h, d - inc hl - inc hl - inc hl - ld a,(hl) - ld iy,#_partitionsCount - ld 0 (iy),a - inc hl - ld a,(hl) - ld (#_partitionsCount + 1),a -;fdisk2.c:466: partitions = *((partitionInfo**)&callerParameters[5]); - ld hl,#0x0005 - add hl,de - ld a,(hl) - ld iy,#_partitions - ld 0 (iy),a - inc hl - ld a,(hl) - ld (#_partitions + 1),a -;fdisk2.c:467: sectorsPerTrack = *((uint*)&callerParameters[7]); - ld hl,#0x0007 - add hl,de - ld a,(hl) - ld iy,#_sectorsPerTrack - ld 0 (iy),a - inc hl - ld a,(hl) - ld (#_sectorsPerTrack + 1),a -;fdisk2.c:469: nextDeviceSector = 0; - xor a, a - ld (#_nextDeviceSector + 0),a - ld (#_nextDeviceSector + 1),a - ld (#_nextDeviceSector + 2),a - ld (#_nextDeviceSector + 3),a -;fdisk2.c:470: mainExtendedPartitionSectorCount = 0; - xor a, a - ld (#_mainExtendedPartitionSectorCount + 0),a - ld (#_mainExtendedPartitionSectorCount + 1),a - ld (#_mainExtendedPartitionSectorCount + 2),a - ld (#_mainExtendedPartitionSectorCount + 3),a -;fdisk2.c:471: mainExtendedPartitionFirstSector = 0; - xor a, a - ld (#_mainExtendedPartitionFirstSector + 0),a - ld (#_mainExtendedPartitionFirstSector + 1),a - ld (#_mainExtendedPartitionFirstSector + 2),a - ld iy,#_mainExtendedPartitionFirstSector - ld 3 (iy),a -;fdisk2.c:473: for(i = 1; i < partitionsCount; i++) { - ld hl,#0x0001 - ex (sp), hl - ld de,#0x0009 -00103$: - ld hl,#_partitionsCount - ld a,-6 (ix) - sub a, (hl) - ld a,-5 (ix) - inc hl - sbc a, (hl) - jp PO, 00114$ - xor a, #0x80 -00114$: - jp P,00101$ -;fdisk2.c:474: mainExtendedPartitionSectorCount += ((&partitions[i])->sizeInK * 2) + 1; //+1 for the MBR - ld iy,(_partitions) - add iy, de - ld l,3 (iy) - ld h,4 (iy) - ld c,5 (iy) - ld b,6 (iy) - add hl, hl - rl c - rl b - ld a,l - add a, #0x01 - ld -4 (ix),a - ld a,h - adc a, #0x00 - ld -3 (ix),a - ld a,c - adc a, #0x00 - ld -2 (ix),a - ld a,b - adc a, #0x00 - ld -1 (ix),a - ld hl,#_mainExtendedPartitionSectorCount - ld a,(hl) - add a, -4 (ix) - ld (hl),a - inc hl - ld a,(hl) - adc a, -3 (ix) - ld (hl),a - inc hl - ld a,(hl) - adc a, -2 (ix) - ld (hl),a - inc hl - ld a,(hl) - adc a, -1 (ix) - ld (hl),a -;fdisk2.c:473: for(i = 1; i < partitionsCount; i++) { - ld hl,#0x0009 - add hl,de - ex de,hl - inc -6 (ix) - jr NZ,00103$ - inc -5 (ix) - jr 00103$ -00101$: -;fdisk2.c:477: return 0; - ld hl,#0x0000 - ld sp,ix - pop ix - ret -_remote_PreparePartitionningProcess_end:: -;fdisk2.c:481: int remote_CreatePartition(byte* callerParameters) -; --------------------------------- -; Function remote_CreatePartition -; --------------------------------- -_remote_CreatePartition_start:: -_remote_CreatePartition: -;fdisk2.c:484: *((int*)&callerParameters[0])); - pop bc - pop hl - push hl - push bc - ld e,(hl) - inc hl - ld d,(hl) - push de - call _CreatePartition - pop af - ret -_remote_CreatePartition_end:: -;fdisk2.c:488: int CreatePartition(int index) -; --------------------------------- -; Function CreatePartition -; --------------------------------- -_CreatePartition_start:: -_CreatePartition: - push ix - ld ix,#0 - add ix,sp - ld hl,#-30 - add hl,sp - ld sp,hl -;fdisk2.c:491: masterBootRecord* mbr = (masterBootRecord*)sectorBuffer; -;fdisk2.c:492: partitionInfo* partition = &partitions[index]; - ld c,4 (ix) - ld b,5 (ix) - ld l, c - ld h, b - add hl, hl - add hl, hl - add hl, hl - add hl, bc - ld e,l - ld d,h - ld iy,(_partitions) - add iy, de - push iy - pop af - ld -18 (ix),a - push iy - dec sp - pop af - inc sp - ld -19 (ix),a -;fdisk2.c:498: bool onlyPrimaryPartitions = (partitionsCount <= 4); - ld a,#0x04 - ld iy,#_partitionsCount - cp a, 0 (iy) - ld a,#0x00 - ld iy,#_partitionsCount - sbc a, 1 (iy) - jp PO, 00146$ - xor a, #0x80 -00146$: - rlca - and a,#0x01 - xor a,#0x01 - ld d,a -;fdisk2.c:502: tableEntry = &(mbr->primaryPartitions[index]); -;fdisk2.c:500: if(onlyPrimaryPartitions) { - ld -30 (ix), d - ld a, d - or a, a - jr Z,00105$ -;fdisk2.c:501: mbrSector = 0; - xor a, a - ld -23 (ix),a - ld -22 (ix),a - ld -21 (ix),a - ld -20 (ix),a -;fdisk2.c:502: tableEntry = &(mbr->primaryPartitions[index]); - ld l,4 (ix) - ld h,5 (ix) - add hl, hl - add hl, hl - add hl, hl - add hl, hl - ld de,#(_sectorBuffer + 0x01be) - add hl,de - ld -29 (ix),l - ld -28 (ix),h -;fdisk2.c:503: if(index == 0) { - ld a,5 (ix) - or a,4 (ix) - jr NZ,00102$ -;fdisk2.c:504: ClearSectorBuffer(); - call _ClearSectorBuffer -;fdisk2.c:505: nextDeviceSector = 1; - ld hl,#_nextDeviceSector + 0 - ld (hl), #0x01 - xor a, a - ld (#_nextDeviceSector + 1),a - ld (#_nextDeviceSector + 2),a - ld (#_nextDeviceSector + 3),a - jr 00103$ -00102$: -;fdisk2.c:507: memcpy(sectorBuffer, sectorBufferBackup, 512); - ld hl,#_sectorBufferBackup - ld de,#_sectorBuffer - ld bc,#0x0200 - ldir -00103$: -;fdisk2.c:509: tableEntry->firstAbsoluteSector = nextDeviceSector; - ld a,-29 (ix) - add a, #0x08 - ld l,a - ld a,-28 (ix) - adc a, #0x00 - ld h,a - ld a,(#_nextDeviceSector + 0) - ld (hl),a - inc hl - ld a,(#_nextDeviceSector + 1) - ld (hl),a - inc hl - ld a,(#_nextDeviceSector + 2) - ld (hl),a - inc hl - ld iy,#_nextDeviceSector - ld a,3 (iy) - ld (hl),a - jr 00106$ -00105$: -;fdisk2.c:511: mbrSector = nextDeviceSector; - ld hl, #7 - add hl, sp - ex de, hl - ld hl, #_nextDeviceSector - ld bc, #4 - ldir -;fdisk2.c:512: tableEntry = &(mbr->primaryPartitions[0]); - ld -29 (ix),#<((_sectorBuffer + 0x01be)) - ld -28 (ix),#>((_sectorBuffer + 0x01be)) -;fdisk2.c:513: ClearSectorBuffer(); - call _ClearSectorBuffer -;fdisk2.c:514: tableEntry->firstAbsoluteSector = 1; - ld a,-29 (ix) - add a, #0x08 - ld l,a - ld a,-28 (ix) - adc a, #0x00 - ld h,a - ld (hl),#0x01 - inc hl - xor a, a - ld (hl), a - inc hl - ld (hl), a - inc hl - ld (hl),#0x00 -00106$: -;fdisk2.c:517: tableEntry->partitionType = partition->partitionType; - ld a,-29 (ix) - add a, #0x04 - ld e,a - ld a,-28 (ix) - adc a, #0x00 - ld d,a - ld l,-19 (ix) - ld h,-18 (ix) - inc hl - inc hl - ld a,(hl) - ld (de),a -;fdisk2.c:518: tableEntry->sectorCount = partition->sizeInK * 2; - ld a,-29 (ix) - add a, #0x0C - ld -2 (ix),a - ld a,-28 (ix) - adc a, #0x00 - ld -1 (ix),a - ld a,-19 (ix) - add a, #0x03 - ld -4 (ix),a - ld a,-18 (ix) - adc a, #0x00 - ld -3 (ix),a - ld e,-4 (ix) - ld d,-3 (ix) - ld hl, #0x0016 - add hl, sp - ex de, hl - ld bc, #0x0004 - ldir - push af - pop af - sla -8 (ix) - rl -7 (ix) - rl -6 (ix) - rl -5 (ix) - ld e,-2 (ix) - ld d,-1 (ix) - ld hl, #0x0016 - add hl, sp - ld bc, #0x0004 - ldir -;fdisk2.c:520: firstFileSystemSector = mbrSector + tableEntry->firstAbsoluteSector; - ld a,-29 (ix) - ld -2 (ix),a - ld a,-28 (ix) - ld -1 (ix),a - ld l,-2 (ix) - ld h,-1 (ix) - ld de, #0x0008 - add hl, de - ld a,(hl) - ld -12 (ix),a - inc hl - ld a,(hl) - ld -11 (ix),a - inc hl - ld a,(hl) - ld -10 (ix),a - inc hl - ld a,(hl) - ld -9 (ix),a - ld a,-23 (ix) - add a, -12 (ix) - ld -27 (ix),a - ld a,-22 (ix) - adc a, -11 (ix) - ld -26 (ix),a - ld a,-21 (ix) - adc a, -10 (ix) - ld -25 (ix),a - ld a,-20 (ix) - adc a, -9 (ix) - ld -24 (ix),a -;fdisk2.c:523: nextDeviceSector = tableEntry->firstAbsoluteSector + tableEntry->sectorCount; - ld a,-12 (ix) - add a, -8 (ix) - ld -12 (ix),a - ld a,-11 (ix) - adc a, -7 (ix) - ld -11 (ix),a - ld a,-10 (ix) - adc a, -6 (ix) - ld -10 (ix),a - ld a,-9 (ix) - adc a, -5 (ix) - ld -9 (ix),a -;fdisk2.c:522: if(onlyPrimaryPartitions){ - ld a,-30 (ix) - or a, a - jr Z,00108$ -;fdisk2.c:523: nextDeviceSector = tableEntry->firstAbsoluteSector + tableEntry->sectorCount; - ld de, #_nextDeviceSector - ld hl, #18 - add hl, sp - ld bc, #4 - ldir - jr 00109$ -00108$: -;fdisk2.c:525: nextDeviceSector += tableEntry->firstAbsoluteSector + tableEntry->sectorCount; - ld hl,#_nextDeviceSector - ld a,(hl) - add a, -12 (ix) - ld (hl),a - inc hl - ld a,(hl) - adc a, -11 (ix) - ld (hl),a - inc hl - ld a,(hl) - adc a, -10 (ix) - ld (hl),a - inc hl - ld a,(hl) - adc a, -9 (ix) - ld (hl),a -00109$: -;fdisk2.c:528: if(!onlyPrimaryPartitions && index != (partitionsCount - 1)) { - ld a,-30 (ix) - or a, a - jp NZ,00114$ - ld hl,#_partitionsCount + 0 - ld e, (hl) - ld iy,#_partitionsCount - ld d,1 (iy) - dec de - ld a,4 (ix) - sub a, e - jr NZ,00149$ - ld a,5 (ix) - sub a, d - jp Z,00114$ -00149$: -;fdisk2.c:529: tableEntry++; - ld a,-29 (ix) - add a, #0x10 - ld -29 (ix),a - ld a,-28 (ix) - adc a, #0x00 - ld -28 (ix),a -;fdisk2.c:530: tableEntry->partitionType = PARTYPE_EXTENDED; - ld a,-29 (ix) - add a, #0x04 - ld l,a - ld a,-28 (ix) - adc a, #0x00 - ld h,a - ld (hl),#0x05 -;fdisk2.c:531: tableEntry->firstAbsoluteSector = nextDeviceSector; - ld a,-29 (ix) - add a, #0x08 - ld -12 (ix),a - ld a,-28 (ix) - adc a, #0x00 - ld -11 (ix),a - ld l,-12 (ix) - ld h,-11 (ix) - ld a,(#_nextDeviceSector + 0) - ld (hl),a - inc hl - ld a,(#_nextDeviceSector + 1) - ld (hl),a - inc hl - ld a,(#_nextDeviceSector + 2) - ld (hl),a - inc hl - ld iy,#_nextDeviceSector - ld a,3 (iy) - ld (hl),a -;fdisk2.c:518: tableEntry->sectorCount = partition->sizeInK * 2; - ld a,-29 (ix) - add a, #0x0C - ld -8 (ix),a - ld a,-28 (ix) - adc a, #0x00 - ld -7 (ix),a -;fdisk2.c:532: if(index == 0) { - ld a,5 (ix) - or a,4 (ix) - jr NZ,00111$ -;fdisk2.c:533: mainExtendedPartitionFirstSector = nextDeviceSector; - ld de, #_mainExtendedPartitionFirstSector - ld hl, #_nextDeviceSector - ld bc, #4 - ldir -;fdisk2.c:534: tableEntry->sectorCount = mainExtendedPartitionSectorCount; - ld l,-8 (ix) - ld h,-7 (ix) - ld a,(#_mainExtendedPartitionSectorCount + 0) - ld (hl),a - inc hl - ld a,(#_mainExtendedPartitionSectorCount + 1) - ld (hl),a - inc hl - ld a,(#_mainExtendedPartitionSectorCount + 2) - ld (hl),a - inc hl - ld iy,#_mainExtendedPartitionSectorCount - ld a,3 (iy) - ld (hl),a - jp 00114$ -00111$: -;fdisk2.c:536: tableEntry->firstAbsoluteSector -= mainExtendedPartitionFirstSector; - ld l,-12 (ix) - ld h,-11 (ix) - ld d,(hl) - inc hl - ld e,(hl) - inc hl - ld b,(hl) - inc hl - ld c,(hl) - ld hl,#_mainExtendedPartitionFirstSector - ld a,d - sub a, (hl) - ld -16 (ix),a - ld a,e - inc hl - sbc a, (hl) - ld -15 (ix),a - ld a,b - inc hl - sbc a, (hl) - ld -14 (ix),a - ld a,c - inc hl - sbc a, (hl) - ld -13 (ix),a - ld e,-12 (ix) - ld d,-11 (ix) - ld hl, #0x000E - add hl, sp - ld bc, #0x0004 - ldir -;fdisk2.c:537: tableEntry->sectorCount = (((partitionInfo*)(partition + 1))->sizeInK * 2); - ld a,-19 (ix) - add a, #0x09 - ld -16 (ix),a - ld a,-18 (ix) - adc a, #0x00 - ld -15 (ix),a - ld l,-16 (ix) - ld h,-15 (ix) - inc hl - inc hl - inc hl - ld a,(hl) - ld -16 (ix),a - inc hl - ld a,(hl) - ld -15 (ix),a - inc hl - ld a,(hl) - ld -14 (ix),a - inc hl - ld a,(hl) - ld -13 (ix),a - push af - pop af - sla -16 (ix) - rl -15 (ix) - rl -14 (ix) - rl -13 (ix) - ld e,-8 (ix) - ld d,-7 (ix) - ld hl, #0x000E - add hl, sp - ld bc, #0x0004 - ldir -00114$: -;fdisk2.c:541: if(index == 0) { - ld a,5 (ix) - or a,4 (ix) - jr NZ,00117$ -;fdisk2.c:542: mbr->jumpInstruction[0] = 0xEB; - ld hl,#_sectorBuffer - ld (hl),#0xEB -;fdisk2.c:543: mbr->jumpInstruction[1] = 0xFE; - inc hl - ld (hl),#0xFE -;fdisk2.c:544: mbr->jumpInstruction[2] = 0x90; - ld hl,#_sectorBuffer + 2 - ld (hl),#0x90 -;fdisk2.c:545: strcpy(mbr->oemNameString, "NEXTOR20"); - ld de,#(_sectorBuffer + 0x0003) - ld hl,#__str_5 - xor a, a -00152$: - cp a, (hl) - ldi - jr NZ, 00152$ -00117$: -;fdisk2.c:548: mbr->mbrSignature = 0xAA55; - ld hl,#0xAA55 - ld ((_sectorBuffer + 0x01fe)), hl -;fdisk2.c:550: memcpy(sectorBufferBackup, sectorBuffer, 512); - ld de,#_sectorBufferBackup - ld hl,#_sectorBuffer - ld bc,#0x0200 - ldir -;fdisk2.c:552: if((error = WriteSectorToDevice(driverSlot, deviceIndex, selectedLunIndex, mbrSector)) != 0) { - ld l,-21 (ix) - ld h,-20 (ix) - push hl - ld l,-23 (ix) - ld h,-22 (ix) - push hl - ld a,(_selectedLunIndex) - push af - inc sp - ld a,(_deviceIndex) - push af - inc sp - ld a,(_driverSlot) - push af - inc sp - call _WriteSectorToDevice - pop af - pop af - pop af - inc sp - ld -17 (ix), l - ld -16 (ix), l - ld a,-17 (ix) - or a, a - jr Z,00119$ -;fdisk2.c:553: return error; - ld l,-16 (ix) - ld h,#0x00 - jr 00120$ -00119$: -;fdisk2.c:556: return CreateFatFileSystem(driverSlot, deviceIndex, selectedLunIndex, firstFileSystemSector, partition->sizeInK); - ld e,-4 (ix) - ld d,-3 (ix) - ld hl, #0x000E - add hl, sp - ex de, hl - ld bc, #0x0004 - ldir - ld l,-14 (ix) - ld h,-13 (ix) - push hl - ld l,-16 (ix) - ld h,-15 (ix) - push hl - ld l,-25 (ix) - ld h,-24 (ix) - push hl - ld l,-27 (ix) - ld h,-26 (ix) - push hl - ld a,(_selectedLunIndex) - push af - inc sp - ld a,(_deviceIndex) - push af - inc sp - ld a,(_driverSlot) - push af - inc sp - call _CreateFatFileSystem - ld iy,#0x000B - add iy,sp - ld sp,iy - ld -16 (ix), l - ld -16 (ix), l - ld -15 (ix),#0x00 - ld l,-16 (ix) - ld h,-15 (ix) -00120$: - ld sp,ix - pop ix - ret -_CreatePartition_end:: -__str_5: - .ascii "NEXTOR20" - .db 0x00 -;fdisk2.c:560: void putchar(char ch) __naked -; --------------------------------- -; Function putchar -; --------------------------------- -_putchar_start:: -_putchar: -;fdisk2.c:570: __endasm; - push ix - ld ix,#4 - add ix,sp - ld a,(ix) - call 0x00A2 - pop ix - ret -_putchar_end:: -;fdisk2.c:574: void Locate(byte x, byte y) -; --------------------------------- -; Function Locate -; --------------------------------- -_Locate_start:: -_Locate: -;fdisk2.c:576: regs.Bytes.H = x + 1; - ld hl, #2+0 - add hl, sp - ld a, (hl) - inc a - ld (#(_regs + 0x0007)),a -;fdisk2.c:577: regs.Bytes.L = y + 1; - ld hl, #3+0 - add hl, sp - ld a, (hl) - inc a - ld (#(_regs + 0x0006)),a -;fdisk2.c:578: AsmCall(POSIT, ®s, REGS_MAIN, REGS_NONE); - ld de,#_regs - ld hl,#0x0000 - push hl - ld l, #0x02 - push hl - push de - ld l, #0xC6 - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - ret -_Locate_end:: -;asmcall.c:10: void DriverCall(byte slot, uint routineAddress) -; --------------------------------- -; Function DriverCall -; --------------------------------- -_DriverCall_start:: -_DriverCall: - push ix - ld ix,#0 - add ix,sp - ld hl,#-8 - add hl,sp - ld sp,hl -;asmcall.c:15: memcpy(registerData, ®s, 8); - ld hl,#0x0000 - add hl,sp - ld c,l - ld b,h - ld e, c - ld d, b - ld hl,#_regs - push bc - ld bc,#0x0008 - ldir - pop bc -;asmcall.c:17: regs.Bytes.A = slot; - ld hl,#(_regs + 0x0001) - ld a,4 (ix) - ld (hl),a -;asmcall.c:18: regs.Bytes.B = 0xFF; - ld hl,#_regs + 3 - ld (hl),#0xFF -;asmcall.c:19: regs.UWords.DE = routineAddress; - ld hl,#_regs + 4 - ld a,5 (ix) - ld (hl),a - inc hl - ld a,6 (ix) - ld (hl),a -;asmcall.c:20: regs.Words.HL = (int)registerData; - ld ((_regs + 0x0006)), bc -;asmcall.c:22: DosCall(_CDRVR, REGS_ALL); - ld hl,#0x037B - push hl - call _DosCall - pop af -;asmcall.c:24: if(regs.Bytes.A == 0) { - ld a, (#(_regs + 0x0001) + 0) - or a, a - jr NZ,00103$ -;asmcall.c:25: regs.Words.AF = regs.Words.IX; - ld de, (#_regs + 8) - ld (_regs), de -00103$: - ld sp,ix - pop ix - ret -_DriverCall_end:: -;asmcall.c:30: void DosCall(byte function, register_usage outRegistersDetail) -; --------------------------------- -; Function DosCall -; --------------------------------- -_DosCall_start:: -_DosCall: -;asmcall.c:32: regs.Bytes.C = function; - ld hl,#_regs + 2 - ld iy,#2 - add iy,sp - ld a,0 (iy) - ld (hl),a -;asmcall.c:33: SwitchSystemBankThenCall(0xF37D, outRegistersDetail); - ld hl, #3+0 - add hl, sp - ld a, (hl) - push af - inc sp - ld hl,#0xF37D - push hl - call _SwitchSystemBankThenCall - pop af - inc sp - ret -_DosCall_end:: -;asmcall.c:37: void SwitchSystemBankThenCall(int routineAddress, register_usage outRegistersDetail) -; --------------------------------- -; Function SwitchSystemBankThenCall -; --------------------------------- -_SwitchSystemBankThenCall_start:: -_SwitchSystemBankThenCall: -;asmcall.c:39: *((int*)BK4_ADD) = routineAddress; - ld hl,#0xF84C - ld iy,#2 - add iy,sp - ld a,0 (iy) - ld (hl),a - inc hl - ld a,1 (iy) - ld (hl),a -;asmcall.c:40: AsmCall(CALLB0, ®s, REGS_ALL, outRegistersDetail); - ld de,#_regs - ld hl,#0x0000 - push hl - ld hl, #6+0 - add hl, sp - ld b, (hl) - ld c,#0x03 - push bc - push de - ld hl,#0x403F - push hl - call _AsmCallAlt - ld hl,#0x0008 - add hl,sp - ld sp,hl - ret -_SwitchSystemBankThenCall_end:: -;asmcall.c:44: void AsmCallAlt(uint address, Z80_registers* regs, register_usage inRegistersDetail, register_usage outRegistersDetail, int alternateAf) __naked -; --------------------------------- -; Function AsmCallAlt -; --------------------------------- -_AsmCallAlt_start:: -_AsmCallAlt: -;asmcall.c:157: __endasm; - push ix - ld ix,#4 - add ix,sp - ld e,6(ix) ;Alternate AF - ld d,7(ix) - ex af,af - push de - pop af - ex af,af - ld l,(ix) ;HL=Routine address - ld h,1(ix) - ld e,2(ix) ;DE=regs address - ld d,3(ix) - ld a,5(ix) - ld (_OUT_FLAGS),a - ld a,4(ix) ;A=in registers detail - ld (_ASMRUT+1),hl - push de - or a - jr z,ASMRUT_DO - push de - pop ix ;IX=&Z80regs - exx - ld l,(ix) - ld h,1(ix) ;AF - dec a - jr z,ASMRUT_DOAF - exx - ld c,2(ix) ;BC, DE, HL - ld b,3(ix) - ld e,4(ix) - ld d,5(ix) - ld l,6(ix) - ld h,7(ix) - dec a - exx - jr z,ASMRUT_DOAF - ld c,8(ix) ;IX - ld b,9(ix) - ld e,10(ix) ;IY - ld d,11(ix) - push de - push bc - pop ix - pop iy - ASMRUT_DOAF: - push hl - pop af - exx - ASMRUT_DO: - call _ASMRUT -;ASMRUT: call 0 - ex (sp),ix ;IX to stack, now IX=&Z80regs - ex af,af ;Alternate AF - ld a,(_OUT_FLAGS) - or a - jr z,CALL_END - exx ;Alternate HLDEBC - ex af,af ;Main AF - push af - pop hl - ld (ix),l - ld 1(ix),h - exx ;Main HLDEBC - ex af,af ;Alternate AF - dec a - jr z,CALL_END - ld 2(ix),c ;BC, DE, HL - ld 3(ix),b - ld 4(ix),e - ld 5(ix),d - ld 6(ix),l - ld 7(ix),h - dec a - jr z,CALL_END - exx ;Alternate HLDEBC - pop hl - ld 8(ix),l ;IX - ld 9(ix),h - push iy - pop hl - ld 10(ix),l ;IY - ld 11(ix),h - exx ;Main HLDEBC - ex af,af - pop ix - ret - CALL_END: - ex af,af - pop hl - pop ix - ret -;OUT_FLAGS: .db #0 -_AsmCallAlt_end:: - .area _CODE - .area _INITIALIZER - .area _CABS (ABS) diff --git a/releases/2.0 final/fdisk/fdisk2.c b/releases/2.0 final/fdisk/fdisk2.c deleted file mode 100644 index 127d790a..00000000 --- a/releases/2.0 final/fdisk/fdisk2.c +++ /dev/null @@ -1,582 +0,0 @@ -//FDISK - Disk partitionner for Nextor -//This is the extra functions file. -//These functions are called from the main program (fidsk.c) -//by using its CallFunctionInExtraBank function. - -// SDCC compilation command line: -// -// sdcc --code-loc 0x4150 --data-loc 0xA000 -mz80 --disable-warning 196 --disable-warning 84 --no-std-crt0 fdisk_crt0.rel msxchar.lib asm.lib fdisk2.c -// hex2bin -e dat fdisk2.ihx -// -// Once compiled, embed the first 8000 bytes of fdisk.dat at position 98560 of the appropriate Nextor ROM file: -// dd if=fdisk2.dat of=nextor.rom bs=1 count=8000 seek=98560 - -#include -#include -#include -#include -#include "asm.h" -#include "system.h" -#include "dos.h" -#include "types.h" -#include "partit.h" -#include "fdisk.h" -#include "asmcall.h" - -byte sectorBuffer[512]; -byte sectorBufferBackup[512]; -byte ASMRUT[4]; -byte OUT_FLAGS; -Z80_registers regs; -byte driverSlot; -byte deviceIndex; -byte selectedLunIndex; -int partitionsCount; -partitionInfo* partitions; -ulong nextDeviceSector; -ulong mainExtendedPartitionSectorCount; -ulong mainExtendedPartitionFirstSector; -uint sectorsPerTrack; - -#define Clear(address, len) memset(address, 0, len) - -int remote_CreateFatFileSystem(byte* callerParameters); -byte CreateFatFileSystem(byte driverSlot, byte deviceIndex, byte lunIndex, ulong firstDeviceSector, ulong fileSystemSizeInK); -void CreateFatBootSector(dosFilesystemParameters* parameters); -ulong GetNewSerialNumber(); -void ClearSectorBuffer(); -void SectorBootCode(); -int remote_CalculateFatFileSystemParameters(byte* callerParameters); -void CalculateFatFileSystemParameters(ulong fileSystemSizeInK, dosFilesystemParameters* parameters); -int CalculateFatFileSystemParametersFat12(ulong fileSystemSizeInK, dosFilesystemParameters* parameters); -int CalculateFatFileSystemParametersFat16(ulong fileSystemSizeInK, dosFilesystemParameters* parameters); -byte WriteSectorToDevice(byte driverSlot, byte deviceIndex, byte lunIndex, ulong firstDeviceSector); -int remote_PreparePartitionningProcess(byte* callerParameters); -int remote_CreatePartition(byte* callerParameters); -int CreatePartition(int index); -void putchar(char ch); -void Locate(byte x, byte y); - -//BC = function number (defined in fdisk.h), HL = address of parameters block -int main(int bc, int hl) -{ - ASMRUT[0] = 0xC3; //Code for JP - switch(bc) { - case f_CalculateFatFileSystemParameters: - return remote_CalculateFatFileSystemParameters((byte*)hl); - break; - case f_CreateFatFileSystem: - return remote_CreateFatFileSystem((byte*)hl); - break; - case f_PreparePartitionningProcess: - return remote_PreparePartitionningProcess((byte*)hl); - break; - case f_CreatePartition: - return remote_CreatePartition((byte*)hl); - break; - default: - return 0; - } -} - - -int remote_CreateFatFileSystem(byte* callerParameters) -{ - return (int)CreateFatFileSystem( - callerParameters[0], - callerParameters[1], - callerParameters[2], - *((ulong*)&callerParameters[3]), - *((ulong*)&callerParameters[7])); -} - - -byte CreateFatFileSystem(byte driverSlot, byte deviceIndex, byte lunIndex, ulong firstDeviceSector, ulong fileSystemSizeInK) -{ - dosFilesystemParameters parameters; - byte error; - ulong sectorNumber; - uint zeroSectorsToWrite; - uint i; - - CalculateFatFileSystemParameters(fileSystemSizeInK, ¶meters); - - //* Boot sector - - CreateFatBootSector(¶meters); - - if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, firstDeviceSector)) != 0) { - return error; - } - - //* FAT (except 1st sector) and root directory sectors - - ClearSectorBuffer(); - zeroSectorsToWrite = (parameters.sectorsPerFat * FAT_COPIES) + (parameters.sectorsPerRootDirectory) - 1; - sectorNumber = firstDeviceSector + 2; - for(i = 0; i < zeroSectorsToWrite; i++) { - if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, sectorNumber)) != 0) { - return error; - } - sectorNumber++; - } - - //* First sector of each FAT - - sectorBuffer[0] = 0xF0; - sectorBuffer[1] = 0xFF; - sectorBuffer[2] = 0xFF; - if(parameters.isFat16) { - sectorBuffer[3] = 0xFF; - } - if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, firstDeviceSector + 1)) != 0) { - return error; - } - if((error = WriteSectorToDevice(driverSlot, deviceIndex, lunIndex, firstDeviceSector + 1 + parameters.sectorsPerFat)) != 0) { - return error; - } - - //* Done - - return 0; -} - - -void CreateFatBootSector(dosFilesystemParameters* parameters) -{ - fatBootSector* sector = (fatBootSector*)sectorBuffer; - - ClearSectorBuffer(); - - sector->jumpInstruction[0] = 0xEB; - sector->jumpInstruction[1] = 0xFE; - sector->jumpInstruction[2] = 0x90; - strcpy(sector->oemNameString, "NEXTOR20"); - sector->sectorSize = 512; - sector->sectorsPerCluster = parameters->sectorsPerCluster; - sector->reservedSectors = 1; - sector->numberOfFats = FAT_COPIES; - sector->rootDirectoryEntries = parameters->sectorsPerRootDirectory * DIR_ENTRIES_PER_SECTOR; - if((parameters->totalSectors & 0xFFFF0000) == 0) { - sector->smallSectorCount = parameters->totalSectors; - } - sector->mediaId = 0xF0; - sector->sectorsPerFat = parameters->sectorsPerFat; - strcpy(sector->params.standard.volumeLabelString, "NEXTOR 2.0 "); //it is same for DOS 2.20 format - sector->params.standard.serialNumber = GetNewSerialNumber(); //it is same for DOS 2.20 format - - if(parameters->isFat16) { - sector->params.standard.bigSectorCount = parameters->totalSectors; - sector->params.standard.extendedBlockSignature = 0x29; - strcpy(sector->params.standard.fatTypeString, "FAT16 "); - } else { - sector->params.DOS220.z80JumpInstruction[0] = 0x18; - sector->params.DOS220.z80JumpInstruction[1] = 0x1E; - strcpy(sector->params.DOS220.volIdString, "VOL_ID"); - strcpy(sector->params.DOS220.fatTypeString, "FAT12 "); - memcpy(&(sector->params.DOS220.z80BootCode), SectorBootCode, (uint)0xC090 - (uint)0xC03E); - } - -} - - -ulong GetNewSerialNumber() __naked -{ - __asm - - ld a,r - xor b - ld e,a - or #128 - ld b,a -gnsn_1: - nop - djnz gnsn_1 - - ld a,r - xor e - ld d,a - or #64 - ld b,a -gnsn_2: - nop - nop - djnz gnsn_2 - - ld a,r - xor d - ld l,a - or #32 - ld b,a -gnsn_3: - nop - nop - nop - djnz gnsn_3 - - ld a,r - xor l - ld h,a - - ret - - __endasm; -} - - -void ClearSectorBuffer() __naked -{ - __asm - - ld hl,#_sectorBuffer - ld de,#_sectorBuffer - inc de - ld bc,#512-1 - ld (hl),#0 - ldir - ret - - __endasm; -} - - -void SectorBootCode() __naked -{ - __asm - - ret nc - ld (#0xc07b),de - ld de,#0xc078 - ld (hl),e - inc hl - ld (hl),d - ld de,#0xc080 - ld c,#0x0f - call #0xf37d - inc a - jp z,#0x4022 - ld de,#0x100 - ld c,#0x1a - call #0xf37d - ld hl,#1 - ld (#0xc08e),hl - ld hl,#0x3f00 - ld de,#0xc080 - ld c,#0x27 - push de - call #0xf37d - pop de - ld c,#0x10 - call #0xf37d - jp 0x0100 - ld l,b - ret nz - call #0 - jp 0x4022 - nop - .ascii "MSXDOS SYS" - nop - nop - nop - nop - - __endasm; -} - -//used only for debugging -int remote_CalculateFatFileSystemParameters(byte* callerParameters) -{ - ulong fileSystemSizeInK = *((ulong*)&callerParameters[0]); - dosFilesystemParameters* parameters = *((dosFilesystemParameters**)&callerParameters[4]); - CalculateFatFileSystemParameters(fileSystemSizeInK, parameters); - return 0xB5; -} - - -void CalculateFatFileSystemParameters(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -{ - if(fileSystemSizeInK > MAX_FAT12_PARTITION_SIZE_IN_K) { - CalculateFatFileSystemParametersFat16(fileSystemSizeInK, parameters); - } else { - CalculateFatFileSystemParametersFat12(fileSystemSizeInK, parameters); - } -} - - -int CalculateFatFileSystemParametersFat12(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -{ - //Note: Partitions <=16M are defined to have at most 3 sectors per FAT, - //so that they can boot DOS 1. This limits the cluster count to 1021. - - uint sectorsPerCluster; - uint sectorsPerFat; - uint clusterCount; - ulong dataSectorsCount; - uint difference; - uint sectorsPerClusterPower; - uint maxClusterCount = MAX_FAT12_CLUSTER_COUNT; - uint maxSectorsPerFat = 12; - - if(fileSystemSizeInK <= (2 * (ulong)1024)) { - sectorsPerClusterPower = 0; - sectorsPerCluster = 1; - } else if(fileSystemSizeInK <= (4 * (ulong)1024)) { - sectorsPerClusterPower = 1; - sectorsPerCluster = 2; - } else if(fileSystemSizeInK <= (8 * (ulong)1024)) { - sectorsPerClusterPower = 2; - sectorsPerCluster = 4; - } else if(fileSystemSizeInK <= (16 * (ulong)1024)) { - sectorsPerClusterPower = 3; - sectorsPerCluster = 8; - } else { - sectorsPerClusterPower = 4; - sectorsPerCluster = 16; - } - - if(fileSystemSizeInK <= (16 * (ulong)1024)) { - maxClusterCount = 1021; - maxSectorsPerFat = 3; - sectorsPerCluster *= 4; - sectorsPerClusterPower += 2; - } - - dataSectorsCount = (fileSystemSizeInK * 2) - (FAT12_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR) - 1; - - clusterCount = dataSectorsCount >> sectorsPerClusterPower; - sectorsPerFat = ((uint)clusterCount + 2) * 3; - - if((sectorsPerFat & 0x3FF) == 0) { - sectorsPerFat >>= 10; - } else { - sectorsPerFat >>= 10; - sectorsPerFat++; - } - - clusterCount = (dataSectorsCount - FAT_COPIES * sectorsPerFat) >> sectorsPerClusterPower; - dataSectorsCount = (uint)clusterCount * (uint)sectorsPerCluster; - - if(clusterCount > maxClusterCount) { - difference = clusterCount - maxClusterCount; - clusterCount = maxClusterCount; - sectorsPerFat = maxSectorsPerFat; - dataSectorsCount -= difference * sectorsPerCluster; - } - - parameters->totalSectors = dataSectorsCount + 1 + (sectorsPerFat * FAT_COPIES) + (FAT12_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - parameters->dataSectors = dataSectorsCount; - parameters->clusterCount = clusterCount; - parameters->sectorsPerFat = sectorsPerFat; - parameters->sectorsPerCluster = sectorsPerCluster; - parameters->sectorsPerRootDirectory = (FAT12_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - parameters->isFat16 = false; - - return 0; -} - - -int CalculateFatFileSystemParametersFat16(ulong fileSystemSizeInK, dosFilesystemParameters* parameters) -{ - byte sectorsPerCluster; - uint sectorsPerFat; - ulong clusterCount; - ulong dataSectorsCount; - uint sectorsPerClusterPower; - ulong fileSystemSizeInM = fileSystemSizeInK >> 10; - ulong difference; - - if(fileSystemSizeInM <= (ulong)128) { - sectorsPerClusterPower = 2; - sectorsPerCluster = 4; - } else if(fileSystemSizeInM <= (ulong)256) { - sectorsPerClusterPower = 3; - sectorsPerCluster = 8; - } else if(fileSystemSizeInM <= (ulong)512) { - sectorsPerClusterPower = 4; - sectorsPerCluster = 16; - } else if(fileSystemSizeInM <= (ulong)1024) { - sectorsPerClusterPower = 5; - sectorsPerCluster = 32; - } else if(fileSystemSizeInM <= (ulong)2048) { - sectorsPerClusterPower = 6; - sectorsPerCluster = 64; - } else { - sectorsPerClusterPower = 7; - sectorsPerCluster = 128; - } - - dataSectorsCount = (fileSystemSizeInK * 2) - (FAT16_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR) - 1; - clusterCount = dataSectorsCount >> sectorsPerClusterPower; - sectorsPerFat = clusterCount + 2; - - if((sectorsPerFat & 0x3FF) == 0) { - sectorsPerFat >>= 8; - } else { - sectorsPerFat >>= 8; - sectorsPerFat++; - } - - clusterCount = (dataSectorsCount - FAT_COPIES * sectorsPerFat); - clusterCount >>= sectorsPerClusterPower; - dataSectorsCount = clusterCount << sectorsPerClusterPower; - - if(clusterCount > MAX_FAT16_CLUSTER_COUNT) { - difference = clusterCount - MAX_FAT16_CLUSTER_COUNT; - clusterCount = MAX_FAT16_CLUSTER_COUNT; - sectorsPerFat = 256; - dataSectorsCount -= difference << sectorsPerClusterPower; - } - - parameters->totalSectors = dataSectorsCount + 1 + (sectorsPerFat * FAT_COPIES) + (FAT16_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - parameters->dataSectors = dataSectorsCount; - parameters->clusterCount = clusterCount; - parameters->sectorsPerFat = sectorsPerFat; - parameters->sectorsPerCluster = sectorsPerCluster; - parameters->sectorsPerRootDirectory = (FAT16_ROOT_DIR_ENTRIES / DIR_ENTRIES_PER_SECTOR); - parameters->isFat16 = true; - - return 0; -} - - -byte WriteSectorToDevice(byte driverSlot, byte deviceIndex, byte lunIndex, ulong firstDeviceSector) -{ - regs.Flags.C = 1; - regs.Bytes.A = deviceIndex; - regs.Bytes.B = 1; - regs.Bytes.C = lunIndex; - regs.Words.HL = (int)sectorBuffer; - regs.Words.DE = (int)&firstDeviceSector; - - DriverCall(driverSlot, DEV_RW); - return regs.Bytes.A; -} - - -int remote_PreparePartitionningProcess(byte* callerParameters) -{ - int i; - int sectorsRemaining; - partitionInfo* partition = &partitions[1]; - - driverSlot = callerParameters[0]; - deviceIndex = callerParameters[1]; - selectedLunIndex = callerParameters[2]; - partitionsCount = *((uint*)&callerParameters[3]); - partitions = *((partitionInfo**)&callerParameters[5]); - sectorsPerTrack = *((uint*)&callerParameters[7]); - - nextDeviceSector = 0; - mainExtendedPartitionSectorCount = 0; - mainExtendedPartitionFirstSector = 0; - - for(i = 1; i < partitionsCount; i++) { - mainExtendedPartitionSectorCount += ((&partitions[i])->sizeInK * 2) + 1; //+1 for the MBR - } - - return 0; -} - - -int remote_CreatePartition(byte* callerParameters) -{ - return (int)CreatePartition( - *((int*)&callerParameters[0])); -} - - -int CreatePartition(int index) -{ - byte error; - masterBootRecord* mbr = (masterBootRecord*)sectorBuffer; - partitionInfo* partition = &partitions[index]; - ulong mbrSector; - uint paddingSectors; - ulong firstFileSystemSector; - ulong extendedPartitionFirstAbsoluteSector; - partitionTableEntry* tableEntry; - bool onlyPrimaryPartitions = (partitionsCount <= 4); - - if(onlyPrimaryPartitions) { - mbrSector = 0; - tableEntry = &(mbr->primaryPartitions[index]); - if(index == 0) { - ClearSectorBuffer(); - nextDeviceSector = 1; - } else { - memcpy(sectorBuffer, sectorBufferBackup, 512); - } - tableEntry->firstAbsoluteSector = nextDeviceSector; - } else { - mbrSector = nextDeviceSector; - tableEntry = &(mbr->primaryPartitions[0]); - ClearSectorBuffer(); - tableEntry->firstAbsoluteSector = 1; - } - - tableEntry->partitionType = partition->partitionType; - tableEntry->sectorCount = partition->sizeInK * 2; - - firstFileSystemSector = mbrSector + tableEntry->firstAbsoluteSector; - - if(onlyPrimaryPartitions){ - nextDeviceSector = tableEntry->firstAbsoluteSector + tableEntry->sectorCount; - } else { - nextDeviceSector += tableEntry->firstAbsoluteSector + tableEntry->sectorCount; - } - - if(!onlyPrimaryPartitions && index != (partitionsCount - 1)) { - tableEntry++; - tableEntry->partitionType = PARTYPE_EXTENDED; - tableEntry->firstAbsoluteSector = nextDeviceSector; - if(index == 0) { - mainExtendedPartitionFirstSector = nextDeviceSector; - tableEntry->sectorCount = mainExtendedPartitionSectorCount; - } else { - tableEntry->firstAbsoluteSector -= mainExtendedPartitionFirstSector; - tableEntry->sectorCount = (((partitionInfo*)(partition + 1))->sizeInK * 2); - } - } - - if(index == 0) { - mbr->jumpInstruction[0] = 0xEB; - mbr->jumpInstruction[1] = 0xFE; - mbr->jumpInstruction[2] = 0x90; - strcpy(mbr->oemNameString, "NEXTOR20"); - } - - mbr->mbrSignature = 0xAA55; - - memcpy(sectorBufferBackup, sectorBuffer, 512); - - if((error = WriteSectorToDevice(driverSlot, deviceIndex, selectedLunIndex, mbrSector)) != 0) { - return error; - } - - return CreateFatFileSystem(driverSlot, deviceIndex, selectedLunIndex, firstFileSystemSector, partition->sizeInK); -} - - -void putchar(char ch) __naked -{ - __asm - push ix - ld ix,#4 - add ix,sp - ld a,(ix) - call CHPUT - pop ix - ret - __endasm; -} - - -void Locate(byte x, byte y) -{ - regs.Bytes.H = x + 1; - regs.Bytes.L = y + 1; - AsmCall(POSIT, ®s, REGS_MAIN, REGS_NONE); -} - - -#include "asmcall.c" \ No newline at end of file diff --git a/releases/2.0 final/fdisk/fdisk2.dat b/releases/2.0 final/fdisk/fdisk2.dat deleted file mode 100644 index 6fb7a55c..00000000 Binary files a/releases/2.0 final/fdisk/fdisk2.dat and /dev/null differ diff --git a/releases/2.0 final/fdisk/fdisk2.ihx b/releases/2.0 final/fdisk/fdisk2.ihx deleted file mode 100644 index fc81a97c..00000000 --- a/releases/2.0 final/fdisk/fdisk2.ihx +++ /dev/null @@ -1,149 +0,0 @@ -:204120002100A436C3FD210200FD39FD7E00D601FD7E01173F1FDE80384E3E04FDBE003E09 -:2041400000FD9E01E24941EE80FA8841210200397EC6FF5FFD210400FD39FD4E00FD460141 -:2041600016002168411919E91806180A180E1812C5CD3446F1C9C5CD8C41F1C9C5CDAE4C49 -:20418000F1C9C5CDAE4DF1C9210000C9DDE5DD210000DD3921F8FF39F9DD7E04C6075FDDAC -:2041A0007E05CE005721040039EB010400EDB0DD5E04DD560513131321000039EB01040072 -:2041C000EDB0DD4E04DD4605C5FDE1FD4602FD5E01FD5600DD6EFEDD66FFE5DD6EFCDD665A -:2041E000FDE5DD6EFADD66FBE5DD6EF8DD66F9E5C5337BF533D533CD0942FD210B00FD39F7 -:20420000FDF92600DDF9DDE1C9DDE5DD210000DD3921DBFF39F921040039DD75FEDD74FF24 -:20422000DD6EFEDD66FFE5DD6E0DDD660EE5DD6E0BDD660CE5CD784621060039F9DD6EFEC9 -:20424000DD66FFE5CD5A44F1DD6E09DD660AE5DD6E07DD6608E5DD6606DD6E05E5DD7E04F6 -:20426000F533CD674CF1F1F133DD75FDDD75FCDD7EFDB72806DD6EFCC35544CDD345DD7ED3 -:20428000FEC60ADD77FADD7EFFCE00DD77FBDD6EFADD66FB7EDD77F8237EDD77F9DDCBF8B0 -:2042A00026DDCBF916DD7EFEDD77F6DD7EFFDD77F7DD6EF6DD66F7110D00197EDD77F6DD82 -:2042C00077F6DD36F700DD7EF6DD86F8DD77F6DD7EF7DD8EF9DD77F7DD7EF6C6FFDD77DD29 -:2042E000DD7EF7CEFFDD77DEDD7E07C602DD77F2DD7E08CE00DD77F3DD7E09CE00DD77F40B -:20430000DD7E0ACE00DD77F5210000E3DD7EDBDD96DDDD7EDCDD9EDE304ADD6EF4DD66F516 -:20432000E5DD6EF2DD66F3E5DD6606DD6E05E5DD7E04F533CD674CF1F1F1337DDD77FCB731 -:204340002806DD6EFCC35544DD34F2200DDD34F32008DD34F42003DD34F5DD34DB20ADDD6C -:2043600034DC18A82100A036F02101A036FF2102A036FFDD7EFEDD77F2DD7EFFDD77F3DD7A -:204380006EF2DD66F3110E00197EB728052103A036FFDD7E07C601DD77F2DD7E08CE00DD77 -:2043A00077F3DD7E09CE00DD77F4DD7E0ACE00DD77F5DD6EF4DD66F5E5DD6EF2DD66F3E5E9 -:2043C000DD6606DD6E05E5DD7E04F533CD674CF1F1F1337DDD77FCB72805DD6EFC1876DDEF -:2043E0006EFADD66FB7EDD77F6237EDD77F7DD7EF6DD77EEDD7EF7DD77EFDD36F000DD3625 -:20440000F100DD7EF2DD86EEDD77EEDD7EF3DD8EEFDD77EFDD7EF4DD8EF0DD77F0DD7EF5A2 -:20442000DD8EF1DD77F1DD6EF0DD66F1E5DD6EEEDD66EFE5DD6606DD6E05E5DD7E04F53332 -:20444000CD674CF1F1F1337DDD77FCB72805DD6EFC18022E00DDF9DDE1C9DDE5DD21000079 -:20446000DD39F53BCDD3452100A036EB2336FE2102A03690217F451103A0AFBEEDA020FBA1 -:20448000210002220BA0DD7E04DD77FEDD7E05DD77FFDD6EFEDD66FF110C00197E320DA0AA -:2044A000210100220EA02110A03602DD6EFEDD66FF110D00196E260029292929EBED5311CB -:2044C000A0DD6EFEDD66FF5E2356234E236679B72007B42004ED5313A02115A036F0DD6E77 -:2044E000FEDD66FF110A00195E2356ED5316A0218845112BA0AFBEEDA020FBCDAD454D444C -:20450000ED4327A0ED5329A0DD4EFEDD46FFC5FDE1FD7E0EDD77FDB72828DD6EFEDD66FF41 -:204520005E2356234E2346ED5320A0ED4322A02126A036292194451136A0AFBEEDA020FB9C -:204540001838211EA03618211FA0361E1120A0219D45AFBEEDA020FB1136A021A445AFBE63 -:20456000EDA020FBDD36FEE2DD36FF45113EA0DD6EFEDD66FF015200EDB0DDF9DDE1C94E34 -:204580004558544F523230004E4558544F5220322E302000464154313620202000564F4CE4 -:2045A0005F494400464154313220202000ED5FA85FF680470010FDED5FAB57F64047000089 -:2045C00010FCED5FAA6FF6204700000010FBED5FAD67C92100A01100A01301FF013600ED30 -:2045E000B0C9D0ED537BC01178C07323721180C00E0FCD7DF33CCA22401100010E1ACD7D0F -:20460000F3210100228EC021003F1180C00E27D5CD7DF3D10E10CD7DF3C3000168C0CD0038 -:2046200000C32240004D5358444F53202053595300000000DDE5DD210000DD39F5F5DD4E4D -:2046400004DD46055950C521020039EB010400EDB0C1210400095E2356D5DD6EFEDD66FFB1 -:20466000E5DD6EFCDD66FDE5CD784621060039F921B500DDF9DDE1C9AFFD210200FD39FDD0 -:20468000BE003E80FD9E013E00FD9E023E00FD9E033025210600394E2346C5FD210400FDFB -:2046A00039FD6E02FD6603E5FD6E00FD6601E5CDA04921060039F9C9210600394E2346C5A1 -:2046C000FD210400FD39FD6E02FD6603E5FD6E00FD6601E5CDDD4621060039F9C9DDE5DD65 -:2046E000210000DD3921EBFF39F9DD36EDF6DD36EE0F210C00E3AFDDBE043E40DD9E053EA6 -:2047000000DD9E063E00DD9E073E0017DD77FFAFDDBE043E08DD9E053E00DD9E063E00DDC2 -:204720009E073812DD36EF00DD36F000DD36F901DD36FA001876AFDDBE043E10DD9E053E83 -:2047400000DD9E063E00DD9E073812DD36EF01DD36F000DD36F902DD36FA00184FAFDDBEFC -:20476000043E20DD9E053E00DD9E063E00DD9E073812DD36EF02DD36F000DD36F904DD3664 -:20478000FA001828DD7EFFB72012DD36EF03DD36F000DD36F908DD36FA001810DD36EF0445 -:2047A000DD36F000DD36F910DD36FA00DD7EFFB7202BDD36EDFDDD36EE03210300E33E0328 -:2047C0001808DDCBF926DDCBFA163D20F5DD7EEFC602DD77EFDD7EF0CE00DD77F0F5DD6EF6 -:2047E00004DD6605DD5E06DD5607F129CB13CB127DC6F8DD77F17CCEFFDD77F27BCEFFDDE9 -:2048000077F37ACEFFDD77F4DD46EFF5DD6EF1DD66F2DD5EF3DD56F4F1041808CB3ACB1BD2 -:20482000CB1CCB1D10F6DD75F5DD74F6DD6EF5DD66F623234D442909DD75F7DD74F87C0F76 -:204840000FE63F672E00DD7EF7B7200FDD7EF8E6032008DD74F7DD75F8180EDD74F7DD75A1 -:20486000F8DD34F72003DD34F8DD6EF7DD66F8291E000600DD7EF1956FDD7EF29C57DD7E57 -:20488000F39B5FDD7EF49867DD46EF041808CB3CCB1BCB1ACB1D10F6DD75F5DD72F6DD6E10 -:2048A000F9DD66FAE5DD6EF5DD66F6E5CD3C53F1F1DD75F1DD74F2DD36F300DD36F400DDD1 -:2048C0007EEDDD96F5DD7EEEDD9EF63052DD7EF5DD96ED6FDD7EF6DD9EEE67DD7EEDDD77ED -:2048E000F5DD7EEEDD77F6DD7EEBDD77F7DD7EECDD77F8DD4EF9DD46FAC5E5CD3C53F1F1E3 -:20490000110000DD7EF195DD77F1DD7EF29CDD77F2DD7EF39BDD77F3DD7EF49ADD77F4DDF3 -:204920005E08DD5609DD6EF7DD66F82901080009010000DD7EF185DD77FBDD7EF28CDD77CF -:20494000FCDD7EF389DD77FDDD7EF488DD77FED521120039010400EDB0D121040019D5EB58 -:2049600021080039010400EDB0D121080019DD7EF57723DD7EF677210A0019DD7EF777233E -:20498000DD7EF877210C0019DD7EF977210D00193607210E00193600210000DDF9DDE1C9BC -:2049A000DDE5DD210000DD3921EDFF39F9F5DD7E04DD77EDDD7E05DD77EEDD7E06DD77EF07 -:2049C000DD7E07DD77F0F1060ADDCBF03EDDCBEF1EDDCBEE1EDDCBED1E10EE3E80DDBEEDFA -:2049E0003E00DD9EEE3E00DD9EEF3E00DD9EF0380A010200DD36FB04C37A4AAFDDBEED3E6C -:204A000001DD9EEE3E00DD9EEF3E00DD9EF03809010300DD36FB081861AFDDBEED3E02DDB3 -:204A20009EEE3E00DD9EEF3E00DD9EF03809010400DD36FB101843AFDDBEED3E04DD9EEEF8 -:204A40003E00DD9EEF3E00DD9EF03809010500DD36FB201825AFDDBEED3E08DD9EEE3E002F -:204A6000DD9EEF3E00DD9EF03809010600DD36FB401807010700DD36FB80F5DD6E04DD6651 -:204A800005DD5E06DD5607F129CB13CB127DC6DFDD77F17CCEFFDD77F27BCEFFDD77F37AC2 -:204AA000CEFFDD77F479F5DD6EF1DD66F2DD5EF3DD56F4F13C1808CB3ACB1BCB1CCB1D3D69 -:204AC00020F5DD75F5DD74F6DD73F7DD72F8DD7EF5C60267DD7EF6CE0057DD7EF7CE00DDB3 -:204AE0007EF8CE00DD74F9DD72FA622E00DD7EF9B7200FDD7EFAE6032008DD74F9DD75FA19 -:204B0000180EDD74F9DD75FADD34F92003DD34FADD6EF9DD66FA29110000DD7EF1956FDDB9 -:204B20007EF29C67DD7EF39A57DD7EF49B5FDD75F5DD74F6DD72F7DD73F879F5F13C18109B -:204B4000DDCBF83EDDCBF71EDDCBF61EDDCBF51E3D20ED79F5DD6EF5DD66F6DD56F7DD5EAD -:204B6000F8F13C180529CB12CB133D20F8DD75F1DD74F2DD72F3DD73F43EF6DDBEF53EFFAD -:204B8000DD9EF63E00DD9EF73E00DD9EF83057DD7EF5C60A6FDD7EF6CE0067DD7EF7CEFF88 -:204BA0005FDD7EF8CEFF57DD36F5F6DD36F6FFDD36F700DD36F800DD36F900DD36FA010CDE -:204BC000180529CB13CB120D20F8DD7EF195DD77F1DD7EF29CDD77F2DD7EF39BDD77F3DD4D -:204BE0007EF49ADD77F4DD5E08DD5609DD6EF9DD66FA2901210009010000DD7EF185DD77E7 -:204C0000FCDD7EF28CDD77FDDD7EF389DD77FEDD7EF488DD77FFD521110039010400EDB039 -:204C2000D121040019D5EB21060039010400EDB0D121080019DD46F5DD4EF6702371210A28 -:204C40000019DD7EF97723DD7EFA77210C0019DD7EFB77210D00193620210E001936012131 -:204C60000000DDF9DDE1C9DDE5DD210000DD392105A47EF601772106A4DD7E05772108A4DC -:204C800036012107A4DD7E06771100A0ED530BA421070039EBED5309A4216041E5DD7E045A -:204CA000F533CDE751F1333A06A46FDDE1C9DDE5DD210000DD3921FAFF39F9DD5E04DD5635 -:204CC000051A3211A46B62237E3212A46B6223237E3213A46B622323237EFD2114A4FD7700 -:204CE00000237E3215A4210500197EFD2116A4FD7700237E3217A4210700197EFD2124A4EC -:204D0000FD7700237E3225A4AF3218A43219A4321AA4321BA4AF321CA4321DA4321EA4325C -:204D20001FA4AF3220A43221A43222A4FD2120A4FD7703210100E31109002114A4DD7EFA76 -:204D400096DD7EFB239EE24B4DEE80F2A64DFD2A16A4FD19FD6E03FD6604FD4E05FD460674 -:204D600029CB11CB107DC601DD77FC7CCE00DD77FD79CE00DD77FE78CE00DD77FF211CA411 -:204D80007EDD86FC77237EDD8EFD77237EDD8EFE77237EDD8EFF7721090019EBDD34FA20E3 -:204DA00099DD34FB1894210000DDF9DDE1C9C1E1E5C55E2356D5CDBB4DF1C9DDE5DD2100DD -:204DC00000DD3921E2FF39F9DD4E04DD46056960292929095D54FD2A16A4FD19FDE5F1DD8D -:204DE00077EEFDE53BF133DD77ED3E04FD2114A4FDBE003E00FD2114A4FD9E01E2014EEE2A -:204E00008007E601EE0157DD72E27AB7286DAFDD77E9DD77EADD77EBDD77ECDD6E04DD66AC -:204E2000052929292911BEA119DD75E3DD74E4DD7E05DDB6042014CDD3452118A43601AF03 -:204E40003219A4321AA4321BA4180B2100A21100A0010002EDB0DD7EE3C6086FDD7EE4CEC3 -:204E600000673A18A477233A19A477233A1AA47723FD2118A4FD7E0377182E21070039EBB7 -:204E80002118A4010400EDB0DD36E3BEDD36E4A1CDD345DD7EE3C6086FDD7EE4CE0067363D -:204EA0000123AF772377233600DD7EE3C6045FDD7EE4CE0057DD6EEDDD66EE23237E12DDCE -:204EC0007EE3C60CDD77FEDD7EE4CE00DD77FFDD7EEDC603DD77FCDD7EEECE00DD77FDDD47 -:204EE0005EFCDD56FD21160039EB010400EDB0F5F1DDCBF826DDCBF916DDCBFA16DDCBFB6D -:204F000016DD5EFEDD56FF21160039010400EDB0DD7EE3DD77FEDD7EE4DD77FFDD6EFEDDB6 -:204F200066FF110800197EDD77F4237EDD77F5237EDD77F6237EDD77F7DD7EE9DD86F4DDDB -:204F400077E5DD7EEADD8EF5DD77E6DD7EEBDD8EF6DD77E7DD7EECDD8EF7DD77E8DD7EF400 -:204F6000DD86F8DD77F4DD7EF5DD8EF9DD77F5DD7EF6DD8EFADD77F6DD7EF7DD8EFBDD7785 -:204F8000F7DD7EE2B7280E1118A421120039010400EDB0181A2118A47EDD86F477237EDD3C -:204FA0008EF577237EDD8EF677237EDD8EF777DD7EE2B7C2E0502114A45EFD2114A4FD56BE -:204FC000011BDD7E04932007DD7E0592CAE050DD7EE3C610DD77E3DD7EE4CE00DD77E4DD43 -:204FE0007EE3C6046FDD7EE4CE00673605DD7EE3C608DD77F4DD7EE4CE00DD77F5DD6EF47F -:20500000DD66F53A18A477233A19A477233A1AA47723FD2118A4FD7E0377DD7EE3C60CDDE9 -:2050200077F8DD7EE4CE00DD77F9DD7E05DDB604202B1120A42118A4010400EDB0DD6EF8CE -:20504000DD66F93A1CA477233A1DA477233A1EA47723FD211CA4FD7E0377C3E050DD6EF450 -:20506000DD66F556235E2346234E2120A47A96DD77F07B239EDD77F178239EDD77F2792372 -:205080009EDD77F3DD5EF4DD56F5210E0039010400EDB0DD7EEDC609DD77F0DD7EEECE0058 -:2050A000DD77F1DD6EF0DD66F12323237EDD77F0237EDD77F1237EDD77F2237EDD77F3F567 -:2050C000F1DDCBF026DDCBF116DDCBF216DDCBF316DD5EF8DD56F9210E0039010400EDB0A8 -:2050E000DD7E05DDB60420192100A036EB2336FE2102A036901103A021A451AFBEEDA020DA -:20510000FB2155AA22FEA11100A22100A0010002EDB0DD6EEBDD66ECE5DD6EE9DD66EAE50F -:205120003A13A4F5333A12A4F5333A11A4F533CD674CF1F1F133DD75EFDD75F0DD7EEFB71D -:205140002807DD6EF026001856DD5EFCDD56FD210E0039EB010400EDB0DD6EF2DD66F3E59D -:20516000DD6EF0DD66F1E5DD6EE7DD66E8E5DD6EE5DD66E6E53A13A4F5333A12A4F5333AF0 -:2051800011A4F533CD0942FD210B00FD39FDF9DD75F0DD75F0DD36F100DD6EF0DD66F1DDF1 -:2051A000F9DDE1C94E4558544F52323000DDE5DD210400DD39DD7E00CDA200DDE1C92102DF -:2051C00000397E3C320CA4210300397E3C320BA41105A4210000E52E02E5D52EC6E5CD8A28 -:2051E0005221080039F9C9DDE5DD210000DD3921F8FF39F9210000394D4459502105A4C5F6 -:20520000010800EDB0C12106A4DD7E04772108A436FF2109A4DD7E057723DD7E0677ED43B4 -:205220000BA4217B03E5CD3D52F13A06A4B72008ED5B0DA4ED5305A4DDF9DDE1C92107A420 -:20524000FD210200FD39FD7E0077210300397EF533217DF3E5CD5B52F133C9214CF8FD21A3 -:205260000200FD39FD7E007723FD7E01771105A4210000E521060039460E03C5D5213F403D -:20528000E5CD8A5221080039F9C9DDE5DD210400DD39DD5E06DD560708D5F108DD6E00DD09 -:2052A0006601DD5E02DD5603DD7E053204A4DD7E042201A4D5B72839D5DDE1D9DD6E00DD33 -:2052C00066013D2829D9DD4E02DD4603DD5E04DD5605DD6E06DD66073DD92812DD4E08DD3B -:2052E0004609DD5E0ADD560BD5C5DDE1FDE1E5F1D9CD00A4DDE3083A04A4B7283AD908F5ED -:20530000E1DD7500DD7401D9083D282BDD7102DD7003DD7304DD7205DD7506DD74073D283A -:1C53200016D9E1DD7508DD7409FDE5E1DD750ADD740BD908DDE1C908E1DDE1C99A -:11410000E5C5D51129A4ED5326A4D1CD2041F1F1C99D -:03A426000000C96A -:1C533C00F1E1D1D5E5F5444DAF6FB00610200406087929CB111730011910F7C9AD -:00000001FF diff --git a/releases/2.0 final/fdisk/fdisk2.lk b/releases/2.0 final/fdisk/fdisk2.lk deleted file mode 100644 index 263c0504..00000000 --- a/releases/2.0 final/fdisk/fdisk2.lk +++ /dev/null @@ -1,11 +0,0 @@ --mjwx --i fdisk2.ihx --b _CODE = 0x4120 --b _DATA = 0xa000 --k C:\Program Files (x86)\SDCC\bin\..\lib\z80 --l msxchar.lib --l z80 -fdisk2.rel -fdisk_crt0.rel - --e diff --git a/releases/2.0 final/fdisk/fdisk_crt0.s b/releases/2.0 final/fdisk/fdisk_crt0.s deleted file mode 100644 index 663c00d5..00000000 --- a/releases/2.0 final/fdisk/fdisk_crt0.s +++ /dev/null @@ -1,56 +0,0 @@ - ;--- crt0.asm for MSX-DOS 2.50 FDISK - ; The C program is expected to have the following main declaration: - ; void main(int bc, int hl) - - .globl _main - - .area _HEADER (ABS) - - .org 0x4100 - - ;--- Initialize globals - -init: ;call gsinit - - ;--- Prepare parameters for main - - push hl - push bc - - ;--- Step 3: Call the "main" function - - push de - ld de,#_HEAP_start - ld (_heap_top),de - pop de - - call _main - - ;--- Terminate program - - pop af - pop af - ret - - ;--- Program code and data (global vars) start here - - ;* Place data after program code, and data init code after data - - .area _CODE - .area _DATA -_heap_top:: - .dw 0 - -gsinit: .area _GSINIT - - .area _GSFINAL - ret - - ;* These doesn't seem to be necessary... (?) - - ;.area _OVERLAY - ;.area _HOME - ;.area _BSS - .area _HEAP - -_HEAP_start:: diff --git a/releases/2.0 final/fdisk/hex2bin.exe b/releases/2.0 final/fdisk/hex2bin.exe deleted file mode 100644 index be16e9a9..00000000 Binary files a/releases/2.0 final/fdisk/hex2bin.exe and /dev/null differ diff --git a/releases/2.0 final/fdisk/nextor.rom b/releases/2.0 final/fdisk/nextor.rom deleted file mode 100644 index 954e7b99..00000000 Binary files a/releases/2.0 final/fdisk/nextor.rom and /dev/null differ diff --git a/releases/2.0 final/fdisk/partit.h b/releases/2.0 final/fdisk/partit.h deleted file mode 100644 index f45e4311..00000000 --- a/releases/2.0 final/fdisk/partit.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef __PARTIT_H -#define __PARTIT_H - -#include "types.h" - -#define MAX_PARTITIONS_TO_HANDLE 256 -#define MIN_DEVICE_SIZE_IN_K 10 -#define MIN_DEVICE_SIZE_FOR_PARTITIONS_IN_K 1024 -#define MIN_REMAINING_SIZE_FOR_NEW_PARTITIONS_IN_K 100 -#define MIN_PARTITION_SIZE_IN_K 100 -#define MAX_DEVICE_SIZE_FOR_DIRECT_FORMAT_IN_K 32768 -#define MAX_FAT16_PARTITION_SIZE_IN_M 4096 -#define MAX_FAT16_PARTITION_SIZE_IN_K ((ulong)MAX_FAT16_PARTITION_SIZE_IN_M * (ulong)1024) -#define MAX_FAT12_PARTITION_SIZE_IN_K 32768 -#define MAX_SECTORS_PER_TRACK 63 -//Each partition has 1 extra sector for MBR -#define EXTRA_PARTITION_SECTORS 1 - -#define PARTYPE_UNUSED 0 -#define PARTYPE_FAT12 1 -#define PARTYPE_FAT16_SMALL 4 -#define PARTYPE_EXTENDED 5 -#define PARTYPE_FAT16 6 - -#define PSTATE_EXISTS 0 -#define PSTATE_ADDED 1 -#define PSTATE_DELETED 2 - -#define MAX_FAT12_CLUSTER_COUNT 4086 -#define MAX_FAT16_CLUSTER_COUNT 65526 -#define FAT12_ROOT_DIR_ENTRIES 112 -#define FAT16_ROOT_DIR_ENTRIES 512 -#define DIR_ENTRIES_PER_SECTOR (512 / 32) -#define MAX_FAT12_SECTORS_PER_FAT 12 -#define MAX_FAT16_SECTORS_PER_FAT 256 -#define FAT_COPIES 2 - -typedef struct { - byte primaryIndex; - byte extendedIndex; - byte partitionType; - ulong sizeInK; - uint alignmentPaddingInSectors; -} partitionInfo; - -typedef struct { - ulong totalSectors; - ulong dataSectors; - uint clusterCount; - uint sectorsPerFat; - byte sectorsPerCluster; - byte sectorsPerRootDirectory; - bool isFat16; -} dosFilesystemParameters; - -typedef struct { - byte jumpInstruction[3]; - char oemNameString[8]; - uint sectorSize; - byte sectorsPerCluster; - uint reservedSectors; - byte numberOfFats; - uint rootDirectoryEntries; - uint smallSectorCount; - byte mediaId; - uint sectorsPerFat; - uint sectorsPerTrack; - uint numberOfHeads; - union { - struct { - ulong hiddenSectors; - ulong bigSectorCount; - byte physicalDriveNum; - byte reserved; - byte extendedBlockSignature; - ulong serialNumber; - char volumeLabelString[11]; - char fatTypeString[8]; - } standard; - struct { - uint hiddenSectors; - byte z80JumpInstruction[2]; - char volIdString[6]; - byte dirtyDiskFlag; - ulong serialNumber; - char volumeLabelString[11]; - char fatTypeString[8]; - byte z80BootCode; - } DOS220; - } params; -} fatBootSector; - -typedef struct { - byte status; - byte chsOfFirstSector[3]; - byte partitionType; - byte chsOfLastSector[3]; - ulong firstAbsoluteSector; - ulong sectorCount; -} partitionTableEntry; - -typedef struct { - byte jumpInstruction[3]; - char oemNameString[8]; - byte emptySpace[435]; - partitionTableEntry primaryPartitions[4]; - uint mbrSignature; -} masterBootRecord; - - -#endif //__PARTIT_H \ No newline at end of file diff --git a/releases/2.0 final/kernels/Nextor-2.0.MegaFlashSDSCC.ROM b/releases/2.0 final/kernels/Nextor-2.0.MegaFlashSDSCC.ROM deleted file mode 100644 index deddb984..00000000 Binary files a/releases/2.0 final/kernels/Nextor-2.0.MegaFlashSDSCC.ROM and /dev/null differ diff --git a/releases/2.0 final/kernels/Nextor-2.0.MegaFlashSDSCC.Recovery.ROM b/releases/2.0 final/kernels/Nextor-2.0.MegaFlashSDSCC.Recovery.ROM deleted file mode 100644 index a0f63d2a..00000000 Binary files a/releases/2.0 final/kernels/Nextor-2.0.MegaFlashSDSCC.Recovery.ROM and /dev/null differ diff --git a/releases/2.0 final/kernels/Nextor-2.0.StandaloneASCII16.ROM b/releases/2.0 final/kernels/Nextor-2.0.StandaloneASCII16.ROM deleted file mode 100644 index 73a71d8f..00000000 Binary files a/releases/2.0 final/kernels/Nextor-2.0.StandaloneASCII16.ROM and /dev/null differ diff --git a/releases/2.0 final/kernels/Nextor-2.0.StandaloneASCII8.ROM b/releases/2.0 final/kernels/Nextor-2.0.StandaloneASCII8.ROM deleted file mode 100644 index a930e415..00000000 Binary files a/releases/2.0 final/kernels/Nextor-2.0.StandaloneASCII8.ROM and /dev/null differ diff --git a/releases/2.0 final/kernels/Nextor-2.0.SunriseIDE.ROM b/releases/2.0 final/kernels/Nextor-2.0.SunriseIDE.ROM deleted file mode 100644 index 41d0b2e9..00000000 Binary files a/releases/2.0 final/kernels/Nextor-2.0.SunriseIDE.ROM and /dev/null differ diff --git a/releases/2.0 final/kernels/Nextor-2.0.base.dat b/releases/2.0 final/kernels/Nextor-2.0.base.dat deleted file mode 100644 index 53bed86b..00000000 Binary files a/releases/2.0 final/kernels/Nextor-2.0.base.dat and /dev/null differ diff --git a/releases/2.0 final/pcutils/mknexrom.c b/releases/2.0 final/pcutils/mknexrom.c deleted file mode 100644 index be893b37..00000000 --- a/releases/2.0 final/pcutils/mknexrom.c +++ /dev/null @@ -1,436 +0,0 @@ -/* MKNEXROM - Make a Nextor kernel ROM - By Konamiman, 5/2011 - - Usage: - mknexrom [/d:] [/m:] [/e:] - - This program creates a Nextor kernel ROM from a base file and a driver file, - as per the recipe specified in the driver development guide. It also allows modifying - an existing kernel ROM file, by changing the mapper code and/or adding extra content - in the free 1K areas present in the DOS 1 and DOS 2 main kernel banks. - - - can be: - - A kernel base file, that is, a file containing the code for the five kernel ROM banks and no driver; or - - A complete ROM file consisting of the kernel bank with the driver bank(s) already appended. - - - is the file containing the driver code. It must be a valid driver according - to the driver development guide. The contents of this file is expected to be as follows: - - 1. 256 dummy bytes. - 2. The driver signature (see the driver development guide) - 3. The driver jump table - 4. The driver code itself - - And optionally, if the driver is more than 16K long, for each additional 16K block: - - 5. 256 dummy bytes. - 6. The additional driver code or data. - 7. Dummy space up to 16K. - - The last block does not need to be 16K long. - - Specifying a driver file is mandarory if a base file without driver is specified in , - and prohibited if a complete ROM file is specified. - - - is the file containing the bank switching code. The following is required for this code: - - - When called, switches ing page 1 the ROM bank passed in A. - - Up to 48 bytes long. - - Runs at address 0x7FD0. - - May corrupt AF, must preserve all other registers. - - If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. - - - is the file containing the extra code or data for the resulting ROM file. This extra data - will be placed at DOS 1 and DOS 2 kernel main banks at address 0x3BD0, this means that this code or data - will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel - slot, at address 0x7BD0. - - The maximum size for the extra file is 1K. - -*/ - -/* v1.01 (4/2011): - BASE_BANK_COUNT changed from 5 to 6 - - v1.02 (4/2011): - BASE_BANK_COUNT changed from 6 to 7 - - v1.03 (4/2011): - BASE_BANK_COUNT no longer used, the value is read from the file (at position 0xFE) instead. - Driver signature searched changed to NEXTOR_DRIVER. - - v1.04 (8/2011): - The address for the mapper code embedded in the initialization code is no longer - calculated from the startup address. Instead, it is now at a fixed position - (MAPPER_INIT_CODE_ADDRESS). - -*/ - - -#include -#include -#include - -#define BANK_SIZE 16384 //Size of each ROM bank -//#define BASE_BANK_COUNT 7 //Number of kernel banks -#define BASE_BANK_COUNT_OFFSET 0xFE //Offset in the base file of number of kernel banks -#define DRIVER_BANK baseBankCount //Index of the first driver bank -#define MAPPER_CODE_SIZE 48 //Size of the bank change code -#define EXTRA_CODE_SIZE 1024 //Size of the extra code for banks 0 and 3 -#define EXTRA_ADDRESS 0x3BD0 //Address of the extra code -#define DRIVER_MIN_SIZE 0x172 //Minimum size of the disk driver -#define PAGE0_SIZE 256 //Size of the common page 0 code -#define DOS2_EXTRA_BANK 0 //Bank for the extra code in DOS 2 mode -#define DOS1_EXTRA_BANK 3 //Bank for the extra code in DOS 2 mode -#define DATABUFFER_SIZE sizeof(dataBuffer) -#define MAPPER_INIT_CODE_ADDRESS 0x07DC - -#define safeClose(file) {if(file!=NULL) {fclose(file); file=NULL;}} - -void DisplayInfo(); -int GetFileSize(FILE* file); -int IsParam(char* arg, char paramLetteR); -void DoExit(int code); - -FILE* baseFile=NULL; -FILE* newFile=NULL; -FILE* driverFile=NULL; -FILE* mapperFile=NULL; -FILE* extraFile=NULL; - -int baseBankCount; - -int main(int argc, char* argv[]) -{ - int hasDriver; - int baseFileSize; - int readCount; - int writeCount; - int signatureLength; - int i; - unsigned short position; - - char* baseFilename=NULL; - char* newFilename=NULL; - char* driverFilename=NULL; - char* mapperFilename=NULL; - char* extraFilename=NULL; - - char* mapperCode[MAPPER_CODE_SIZE]; - char* extraCode[EXTRA_CODE_SIZE]; - char* dataBuffer[1024]; - - char* driverSignature="NEXTOR_DRIVER"; - signatureLength=strlen(driverSignature); - - - //* Get command line parameters - - printf("\r\n"); - if(argc<4) { - DisplayInfo(); - DoExit(0); - } - - baseFilename=argv[1]; - newFilename=argv[2]; - for(i=3; i=(baseBankCount+1) * BANK_SIZE) { - hasDriver=1; - } else { - printf("*** The base file has not the expected length. Expected either %iK (for base file without driver) or >=%iK (for file with driver).\r\n", - (baseBankCount * BANK_SIZE)/1024, - ((baseBankCount+1) * BANK_SIZE)/1024); - DoExit(1); - } - - - //* Check for the presence or absence of driver file, this depends on the base file size - - if(driverFilename!=NULL && hasDriver) { - printf("*** A driver file has been specified, but the base file appears to have a driver already.\r\n"); - DoExit(1); - } else if(driverFilename==NULL && !hasDriver) { - printf("*** No driver file has been specified, but the base file does not have driver.\r\n"); - DoExit(1); - } - - - //* Read the mapper code file, if specified; - // otherwise get the mapper code from the base file itself - - if(mapperFilename==NULL) { - fseek(baseFile, BANK_SIZE-MAPPER_CODE_SIZE, SEEK_SET); - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, baseFile); - if(readCount!=MAPPER_CODE_SIZE) { - printf("*** Can't read the mapper code from the base file\r\n"); - DoExit(1); - } - fseek(baseFile, 0, SEEK_SET); - } else { - mapperFile=fopen(mapperFilename, "rb"); - if(mapperFile==NULL) { - printf("*** Can't open mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(mapperFile)>MAPPER_CODE_SIZE) { - printf("*** The mapper code file has not the expected size (%i bytes)\r\n", MAPPER_CODE_SIZE); - DoExit(1); - } - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, mapperFile); - if(readCount==0) { - printf("*** Can't read the mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - safeClose(mapperFile); - } - - - //* Read the extra code file, if specified - - if(extraFilename!=NULL) { - extraFile=fopen(extraFilename, "rb"); - if(extraFile==NULL) { - printf("*** Can't open extra code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(extraFile)>EXTRA_CODE_SIZE) { - printf("*** The extra code file is too big, maximum allowed size is %i bytes\r\n", EXTRA_CODE_SIZE); - DoExit(1); - } - readCount=fread(extraCode, 1, EXTRA_CODE_SIZE, extraFile); - if(readCount==0) { - printf("*** Can't read the extra code file: %s", extraFilename); - DoExit(1); - } - safeClose(extraFile); - } - - - //* Open the driver file, if necessary, and check its signature - - if(driverFilename!=NULL) { - driverFile=fopen(driverFilename, "rb"); - if(driverFile==NULL) { - printf("*** Can't open driver file: %s\r\n", driverFilename); - DoExit(1); - } - if(GetFileSize(driverFile) [/d:] [/m:] [/e:]\r\n" - ); -} - -int GetFileSize(FILE* file) -{ - int pos; - int end; - - pos=ftell(file); - fseek(file, 0, SEEK_END); - end=ftell(file); - fseek(file,pos,SEEK_SET); - - return end; -} - -int IsParam(char* arg, char paramLetter) -{ - return arg[0]=='/' && ((arg[1] | 0x20) == (paramLetter | 0x20)) && arg[2]==':'; -} - -void DoExit(int code) -{ - safeClose(baseFile); - safeClose(newFile); - safeClose(driverFile); - safeClose(mapperFile); - safeClose(extraFile); - printf("\r\n"); - exit(code); -} \ No newline at end of file diff --git a/releases/2.0 final/pcutils/mknexrom.exe b/releases/2.0 final/pcutils/mknexrom.exe deleted file mode 100644 index baa3a07e..00000000 Binary files a/releases/2.0 final/pcutils/mknexrom.exe and /dev/null differ diff --git a/releases/2.0 final/tools/nextor-dsk.zip b/releases/2.0 final/tools/nextor-dsk.zip deleted file mode 100644 index a4081bcf..00000000 Binary files a/releases/2.0 final/tools/nextor-dsk.zip and /dev/null differ diff --git a/releases/2.0 final/tools/nextor.sys b/releases/2.0 final/tools/nextor.sys deleted file mode 100644 index 4a38f80a..00000000 Binary files a/releases/2.0 final/tools/nextor.sys and /dev/null differ diff --git a/releases/2.0 final/tools/source/CODES.MAC b/releases/2.0 final/tools/source/CODES.MAC deleted file mode 100644 index a3e7f8ee..00000000 --- a/releases/2.0 final/tools/source/CODES.MAC +++ /dev/null @@ -1,305 +0,0 @@ - .z80 - title MSX-DOS 2 Copyright (1988) ASCII Corporation - subttl Public constants declarations - .sall -;----------------------------------------------------------------------------- -; -const macro name,value ;;Macro for declaring public -name equ (value) ;; constants. - public name - endm -; -; -;----------------------------------------------------------------------------- -; -; BDOS function codes -; ===================== -; - const _TERM0, 00h ;Terminate program - const _CONIN, 01h ;Console input - const _CONOUT, 02h ;Console output - const _AUXIN, 03h ;Auxilliary input - const _AUXOUT, 04h ;Auxilliary output - const _LSTOUT, 05h ;List output - const _DIRIO, 06h ;Direct console I/O - const _DIRIN, 07h ;Direct console input, no echo - const _INNOE, 08h ;Console input, no echo - const _STROUT, 09h ;String output - const _BUFIN, 0Ah ;Buffered line input - const _CONST, 0Bh ;Console status -; - const _CPMVER, 0Ch ;Return CP/M version number - const _DSKRST, 0Dh ;Disk reset - const _SELDSK, 0Eh ;Select disk -; - const _FOPEN, 0Fh ;Open file (FCB) - const _FCLOSE, 10h ;Close file (FCB) - const _SFIRST, 11h ;Search for first (FCB) - const _SNEXT, 12h ;Search for next (FCB) - const _FDEL, 13h ;Delete file (FCB) - const _RDSEQ, 14h ;Read sequential (FCB) - const _WRSEQ, 15h ;Write sequential (FCB) - const _FMAKE, 16h ;Create file (FCB) - const _FREN, 17h ;Rename file (FCB) -; - const _LOGIN, 18h ;Get login vector - const _CURDRV, 19h ;Get current drive - const _SETDTA, 1Ah ;Set disk transfer address - const _ALLOC, 1Bh ;Get allocation information -; - const _RDRND, 21h ;Read random (FCB) - const _WRRND, 22h ;Write random (FCB) - const _FSIZE, 23h ;Get file size (FCB) - const _SETRND, 24h ;Set random record (FCB) - const _WRBLK, 26h ;Write random block (FCB) - const _RDBLK, 27h ;Read random block (FCB) - const _WRZER, 28h ;Write random with zero fill (FCB) -; - const _GDATE, 2Ah ;Get date - const _SDATE, 2Bh ;Set date - const _GTIME, 2Ch ;Get time - const _STIME, 2Dh ;Set time - const _VERIFY, 2Eh ;Set/reset verify flag -; - const _RDABS, 2Fh ;Absolute sector read - const _WRABS, 30h ;Absolute sector write - const _DPARM, 31h ;Get disk parameters -; - const _FFIRST, 40h ;Find first entry - const _FNEXT, 41h ;Find next entry - const _FNEW, 42h ;Find new entry -; - const _OPEN, 43h ;Open file handle - const _CREATE, 44h ;Create file and open handle - const _CLOSE, 45h ;Close file handle - const _ENSURE, 46h ;Ensure file handle - const _DUP, 47h ;Duplicate file handle - const _READ, 48h ;Read from file handle - const _WRITE, 49h ;Write to file handle - const _SEEK, 4Ah ;Seek (position file pointer) - const _IOCTL, 4Bh ;I/O control for devices - const _HTEST, 4Ch ;Test file handle -; - const _DELETE, 4Dh ;Delete file or subdirectory - const _RENAME, 4Eh ;Rename file or subdirectory - const _MOVE, 4Fh ;Move file or subdirectory - const _ATTR, 50h ;Change file or subdirectory attributes - const _FTIME, 51h ;Get/set file date and time -; - const _HDELETE, 52h ;Delete file handle - const _HRENAME, 53h ;Rename file handle - const _HMOVE, 54h ;Move file handle - const _HATTR, 55h ;Change file handle attributes - const _HFTIME, 56h ;Get/set file handle date and time -; - const _GETDTA, 57h ;Get disk transfer address - const _GETVFY, 58h ;Get verify flag setting - const _GETCD, 59h ;Get current directory - const _CHDIR, 5Ah ;Change directory - const _PARSE, 5Bh ;Parse pathname - const _PFILE, 5Ch ;Parse filename - const _CHKCHR, 5Dh ;Check character - const _WPATH, 5Eh ;Get whole path string - const _FLUSH, 5Fh ;Flush disk buffers -; - const _FORK, 60h ;Fork a child process - const _JOIN, 61h ;Return to parent process - const _TERM, 62h ;Terminate with error code - const _DEFAB, 63h ;Define abort exit routine - const _DEFER, 64h ;Define critical error handle routine - const _ERROR, 65h ;Get previous error code - const _EXPLAIN, 66h ;Explain error code -; - const _FORMAT, 67h ;Format disk - const _RAMD, 68h ;Create or destroy RAMdisk - const _BUFFER, 69h ;Allocate sector buffers - const _ASSIGN, 6Ah ;Logical drive assignment -; - const _GENV, 6Bh ;Get environment item - const _SENV, 6Ch ;Set environment item - const _FENV, 6Dh ;Find environment item -; - const _DSKCHK, 6Eh ;Get/set disk check status - const _DOSVER, 6Fh ;Get MSX-DOS version number - const _REDIR, 70h ;Get/set redirection flags - - const _FOUT, 71h ;Get/set fast STROUT mode - const _ZSTROUT, 72h ;Zero-terminated string output - - const _RDDRV, 73h ;Absolute drive sector read - const _WRDRV, 74h ;Absolute drive sector write - - const _RALLOC, 75h ;Reduced allocation information mode vector - const _DSPACE, 76h ;Get disk space information - - const _LOCK, 77h ;Lock/unlock drive - - const _GDRVR, 78h ;Get information about disk driver - const _GDLI, 79h ;Get information about drive letter - const _GPART, 7Ah ;Get information about disk partition - const _CDRVR, 7Bh ;Call a routine in a disk driver - const _MAPDRV, 7Ch ;Map a drive letter to a drive or device/LUN/partition - - const _Z80MODE, 7Dh ;Enable or disable the Z80 access mode for a driver -; -; -;----------------------------------------------------------------------------- -; -; Error Codes -; ============= -; -; The following errors are those which a disk error routine may normally -; expect to be passed, although such a routine should be general enough to -; handle any error code. -; - const .NCOMP, 0FFh ;Incompatible disk - const .WRERR, 0FEh ;Write error - const .DISK, 0FDh ;Disk error - const .NRDY, 0FCh ;Not ready - const .VERFY, 0FBh ;Verify error - const .DATA, 0FAh ;Data error - const .RNF, 0F9h ;Sector not found - const .WPROT, 0F8h ;Write protected disk - const .UFORM, 0F7h ;Unformatted disk - const .NDOS, 0F6h ;Not a DOS disk - const .WDISK, 0F5h ;Wrong disk - const .WFILE, 0F4h ;Wrong disk for file - const .SEEK, 0F3h ;Seek error - const .IFAT, 0F2h ;Bad file allocation table - const .NOUPB, 0F1h ; (forces re-validation of disk) - const .IFORM, 0F0h ;Cannot format this drive - ;0EFh \ - ; .. > Reserved for future use - ;0E0h / -; -; -; The following errors are those which may be returned by KBDOS functions. -; - const .INTER, 0DFh ;Internal error -; - const .NORAM, 0DEh ;Not enough memory - ;0DDh - reserved - const .IBDOS, 0DCh ;Invalid BDOS call -; - const .IDRV, 0DBh ;Invalid drive - const .IFNM, 0DAh ;Invalid filename - const .IPATH, 0D9h ;Invalid pathname - const .PLONG, 0D8h ;Pathname too long -; - const .NOFIL, 0D7h ;File not found - const .NODIR, 0D6h ;Directory not found - const .DRFUL, 0D5h ;Root directory full - const .DKFUL, 0D4h ;Disk full - const .DUPF, 0D3h ;Duplicate filename - const .DIRE, 0D2h ;Invalid directory move - const .FILRO, 0D1h ;Read only file - const .DIRNE, 0D0h ;Directory not empty - const .IATTR, 0CFh ;Invalid attributes - const .DOT, 0CEh ;Invalid . or .. operation - const .SYSX, 0CDh ;System file exists - const .DIRX, 0CCh ;Directory exists - const .FILEX, 0CBh ;File exists - const .FOPEN, 0CAh ;File is already in use -; - const .OV64K, 0C9h ;Cannot transfer above 64k - const .FILE, 0C8h ;File allocation error - const .EOF, 0C7h ;End of file - const .ACCV, 0C6h ;File access violation -; - const .IPROC, 0C5h ;Invalid process id - const .NHAND, 0C4h ;No spare file handles - const .IHAND, 0C3h ;Invalid file handle - const .NOPEN, 0C2h ;File handle not open - const .IDEV, 0C1h ;Invalid device operation -; - const .IENV, 0C0h ;Invalid environment string - const .ELONG, 0BFh ;Environment string too long -; - const .IDATE, 0BEh ;Invalid date - const .ITIME, 0BDh ;Invalid time -; - const .RAMDX, 0BCh ;RAM disk already exists - const .NRAMD, 0BBh ;RAM disk does not exist -; - const .HDEAD, 0BAh ;File handle has been deleted - const .EOL, 0B9h ;End of line (internal error) - const .ISBFN, 0B8h ;Invalid sub-function number - const .IFCB, 0B7h ;Invalid FCB - - const .IDRVR, 0B6h ;Invalid device driver - const .IDEVL, 0B5h ;Invalid device or LUN - const .IPART, 0B4h ;Invalid partition number - const .PUSED, 0B3h ;Partition is already in use - ;0B2h \ - ; .. > Reserved for future use - ;0A0h / -; -; -; The following are errors which the KBDOS may pass to the ABORT routine. -; Of cource a user abort routine may see any other error but these are the -; ones which are generated internally and may require special case handling. -; - const .STOP, 09Fh ;Ctrl-STOP pressed - const .CTRLC, 09Eh ;Ctrl-C pressed - const .ABORT, 09Dh ;Disk operation aborted - const .OUTERR,09Ch ;Error on standard output - const .INERR, 09Bh ;Error on standard input - ;09Ah \ - ; .. > Reserved for future use - ;090h / -; -; -; The following errors are those generated by COMMAND2.COM. These will not -; be returned from KBDOS functions, but user application programs may find it -; useful to return some of these errors. -; - const .BADCOM,08Fh ;Wrong version of COMMAND2.COM - const .BADCMD,08Eh ;Unrecognized command - const .BUFUL, 08Dh ;Command too long - const .OKCMD, 08Ch ; (Command executed correctly) -; - const .IPARM, 08Bh ;Invalid parameter - const .INP, 08Ah ;Too many parameters - const .NOPAR, 089h ;Missing parameter - const .IOPT, 088h ;Invalid option - const .BADNO, 087h ;Invalid number -; - const .NOHELP,086h ;File for HELP not found - const .BADVER,085h ;Wrong version of system -; - const .NOCAT, 084h ;Cannot concatenate destination file - const .BADEST,083h ;Cannot create destination file - const .COPY, 082h ;File cannot be copied onto itself - const .OVDEST,081h ;Cannot overwrite previous destination file - const .BATEND,080h ; (Batch file has ended) -; - const .INSDSK,07Fh ;Insert MSX-DOS 2 disk in drive x: - const .PRAK, 07Eh ;Press any key to continue... -; - ;07Dh \ - ; .. > Reserved for future use - ;040h / -; -; -; Error codes below 40h may be used by user programs for any purpose which -; they desire, and will be guarenteed to be different from any errors returned -; by the system. COMMAND2.COM will not print an error message for codes in -; the range 00h...1Fh. -; -; -;----------------------------------------------------------------------------- -; -; Standard File Handles -; ======================= -; - const STDIN, 0 ;Standard input channel - const STDOUT, 1 ;Standard output channel - const STDERR, 2 ;Standard error channel - const STDAUX, 3 ;Auxilliary I/O channel - const STDLST, 4 ;Standard list channel -; -; -;----------------------------------------------------------------------------- -; - end -; diff --git a/releases/2.0 final/tools/source/DELALL.MAC b/releases/2.0 final/tools/source/DELALL.MAC deleted file mode 100644 index 30189e3f..00000000 --- a/releases/2.0 final/tools/source/DELALL.MAC +++ /dev/null @@ -1,93 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 -USAGE_S: - db "DELALL - Deletes all the data in a drive",13,10 - db 13,10 - db "Deletes all files and directories in the specified drive, leaving the media",13,10 - db "completely empty. Deletion is done by cleaning the FAT and root directory",13,10 - db "areas of the media, therefore there is no way to undo the operation.",13,10 - db "Use with care.",13,10 - db 13,10 - db "Usage: DELALL :",13,10 - db 1Ah - db 0 - -START: - call CHK250## - - ;--- Get drive letter - - ld de,BUF - ld a,1 - call EXTPAR## - jr nz,FOUND_PARAMS - - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 -FOUND_PARAMS: - - ld hl,BUF - call CHKLET## - - push af ;Check that the drive actually exists - ld l,a - ld de,BUF - ld c,_DPARM## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - pop af - - ;--- Show a warning message and ask for confirmation - - push af - add a,"A"-1 - ld (DRIVE),a - ld de,WARNING_MSG - ld c,_ZSTROUT## - call 5 - - ld c,_CONIN## - call 5 - or 32 - cp "y" - ld b,.ABORT## - ld c,_TERM## - jp c,5 - - ;--- Do the disk cleaning - - pop bc - ld c,_FORMAT## - ld a,0FBh - ld hl,BUF - ld de,0 - call 5 - - ld b,a - ld c,_TERM## - jp 5 - - -WARNING_MSG: - db 13,10,"WARNING!!",13,10 - db 13,10 - db "ALL data on drive " -DRIVE: - db "X: will be permanently deleted.",13,10 - db "There is no way to undo this operation.",13,10 - db 13,10 - db "Are you sure? (y/n) ",0 - -BUF: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/DEVINFO.MAC b/releases/2.0 final/tools/source/DEVINFO.MAC deleted file mode 100644 index 8b58cc89..00000000 --- a/releases/2.0 final/tools/source/DEVINFO.MAC +++ /dev/null @@ -1,473 +0,0 @@ - .z80 - -DEV_INFO equ 4163h -LUN_INFO equ 4169h - -DEVINFO_STRLEN equ 64 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 -USAGE_S: - db "DEVINFO - displays information about the devices handled by a disk driver",13,10 - db 13,10 - db "Usage: DEVINFO [-][:]|0",13,10 - db 13,10 - db "If 0 is specified, the primary disk controller slot is assumed",13,10 - db 13,10 - db 1Ah - db 0 - -START: - call CHK250## - - ;--- Get slot, subslot, segment - - ld de,BUF - ld a,1 - call EXTPAR## - jr nz,FOUND_PARAMS - - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 -FOUND_PARAMS: - - ld hl,BUF - call GETSLOT## - or a - jr nz,NO_PRIMARY - ld a,(0F348h) -NO_PRIMARY: - ld (SLOT),a - ld a,b - ld (SEGMENT),a - - ;--- Check that the driver exists and is a device-based driver - - ;ld a,(SEGMENT) - ld e,a - ld a,(SLOT) - ld d,a - xor a - ld hl,BUF_INFO - ld c,_GDRVR## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - ld a,(BUF_INFO+4) - and 10000001b - cp 10000001b - ld b,.IDRVR## - ld c,_TERM## - jp nz,5 - - ;--- Loop for all devices - - ld iy,BUF_REG - ld (iy+1),1 - ld hl,BUF_INFO - ld (iy+6),l - ld (iy+7),h - -DEV_LOOP: - - ;* Get and display basic information - - ld (iy+3),0 - call CALL_DEVINFO - push ix - pop af - or a - jp nz,DEV_LOOP_NEXT2 - - ld a,(iy+1) - add a,"0" - ld (DEVINDEX_MSG),a - ld a,(BUF_INFO) - ld (LUNS),a - add a,"0" - ld (LUNS_MSG),a - ld de,DEV_MSG - ld c,_ZSTROUT## - call 5 - - ;* Get and display manufacturer name - -GET_INFO_1: - inc (iy+3) - call CALL_DEVINFO - push ix - pop af - or a - jr nz,GET_INFO_2 - - ld de,MANUF_MSG - ld c,_ZSTROUT## - call 5 - ld hl,BUF_INFO - ld bc,DEVINFO_STRLEN - call PRPAD## - ld de,CRLF - ld c,_ZSTROUT## - call 5 - - ;* Get and display device name - -GET_INFO_2: - inc (iy+3) - call CALL_DEVINFO - push ix - pop af - or a - jr nz,GET_INFO_3 - - ld de,NAME_MSG - ld c,_ZSTROUT## - call 5 - ld hl,BUF_INFO - ld bc,DEVINFO_STRLEN - call PRPAD## - ld de,CRLF - ld c,_ZSTROUT## - call 5 - - ;* Get and display serial number - -GET_INFO_3: - inc (iy+3) - call CALL_DEVINFO - push ix - pop af - or a - jr nz,GET_INFO_4 - - ld hl,BUF_INFO-1 - ld b,DEVINFO_STRLEN -SKIPSP: - inc hl ;This time string is left-padded - ld a,(hl) - cp " " - jr nz,OKSKIPSP - djnz SKIPSP - jr GET_INFO_4 -OKSKIPSP: - - push hl - ld de,SERIAL_MSG - ld c,_ZSTROUT## - call 5 - pop de - - xor a - ld (BUF_INFO+DEVINFO_STRLEN),a - ld c,_ZSTROUT## - call 5 - ld de,CRLF - ld c,_ZSTROUT## - call 5 -GET_INFO_4: - - ;--- Display information about LUNs - - ld a,(iy+1) - ld iy,BUF_REG2 - ld (iy+1),a - ld (iy+3),1 - ld hl,BUF_INFO - ld (iy+6),l - ld (iy+7),h - -LUN_INFO_LOOP: - call CALL_LUNINFO - push ix - pop af - or a - jp nz,LUN_INFO_NEXT2 - - ;* LUN number - - ld a,(iy+3) - add a,"0" - ld (LUNINDEX_MSG),a - ld de,LUN_MSG - ld c,_ZSTROUT## - call 5 - - ;* Device type - - ld a,(BUF_INFO) - ld de,BLOCK_MSG - or a - jr z,OK_LUNTYPE - ld de,CDROM_MSG - dec a - jr z,OK_LUNTYPE - ld de,UNKNOWN_MSG -OK_LUNTYPE: - ld c,_ZSTROUT## - call 5 - - ;* Device capacity, if block device with 512K sectors - - ld a,(BUF_INFO) - or a - jp nz,NO_CAPACITY - ld hl,(BUF_INFO+1) - ld de,512 - or a - sbc hl,de - jr nz,NO_CAPACITY - - ld ix,BUF_INFO+3 - ld e,(ix) - ld d,(ix+1) - ld l,(ix+2) - ld h,(ix+3) - srl h ;HLDE=Capacity in KB - rr l - rr d - rr e - - ld a,h - or l - jr nz,DIVIDE1 - push de - ex de,hl - ld bc,10240 - or a - sbc hl,bc - pop de - ld hl,0 - jr c,DISPLAY - -DIVIDE1: - ld e,d ;Divide by 1024 to obtain MB - ld d,l - ld l,h - srl l - rr d - rr e - srl l - rr d - rr e - ld a,"M" - ld (CAPAUNIT),a - - ld a,l - or a - jr nz,DIVIDE2 - push de - ex de,hl - ld bc,10240 - or a - sbc hl,bc - pop de - ld hl,0 - jr c,DISPLAY - -DIVIDE2: - ld e,d ;Divide by 1024 to obtain GB - ld d,l - srl d - rr e - srl d - rr e - ld a,"G" - ld (CAPAUNIT),a - -DISPLAY: - ex de,hl - ld de,CAPACITY_MSG+2 - call Num2Dec - ld a,(CAPAUNIT) - ld (de),a - inc de - ld a,"B" - ld (de),a - inc de - xor a - ld (de),a - ld de,CAPACITY_MSG - ld c,_ZSTROUT## - call 5 -NO_CAPACITY: - - ;* Device flags - - ld ix,BUF_INFO+7 - bit 0,(ix) - ld de,FIXED_MSG - jr z,DO_REMFIXED - ld de,REMOVABLE_MSG -DO_REMFIXED: - ld c,_ZSTROUT## - call 5 - - bit 1,(ix) - jr z,NO_READONLY - ld de,READONLY_MSG - ld c,_ZSTROUT## - call 5 -NO_READONLY: - - bit 2,(ix) - jr z,NO_FLOPPY - ld de,FLOPPY_MSG - ld c,_ZSTROUT## - call 5 -NO_FLOPPY: - - ;* Go for next LUN - -LUN_INFO_NEXT: - ld de,CRLF - ld c,_ZSTROUT## - call 5 -LUN_INFO_NEXT2: - ld a,(iy+3) - inc a - ld (iy+3),a - cp 8 - jp c,LUN_INFO_LOOP - - ld iy,BUF_REG - - ;--- Go for next device - -DEV_LOOP_NEXT: - ld de,CRLF - ld c,_ZSTROUT## - call 5 -DEV_LOOP_NEXT2: - ld a,(iy+1) - inc a - ld (iy+1),a - cp 8 - jp c,DEV_LOOP - - ld b,0 - ld c,_TERM## - jp 5 - - -CALL_LUNINFO: - ld de,LUN_INFO - ld hl,BUF_REG2 - jr CALL_DRIVER - -CALL_DEVINFO: - ld de,DEV_INFO - ld hl,BUF_REG - -CALL_DRIVER: - ld a,(SEGMENT) - ld b,a - ld a,(SLOT) - ld c,_CDRVR## - call 5 - ret z - ld b,a - ld c,_TERM## - jp 5 - - -Num2Dec: - xor a - ld (de),a - ld bc,-10000 - call Num1 - ld bc,-1000 - call Num1 - ld bc,-100 - call Num1 - ld c,-10 - call Num1 - ld c,-1 - call Num1 - xor a - ld (Num3),a - ld (Num3+1),a - ret - -Num1: ld a,'0'-1 -Num2: inc a - add hl,bc - jr c,Num2 - sbc hl,bc - -Num3: nop - nop - cp "0" - ret z - ld (de),a - inc de - ld a,18h ;jr code - ld (Num3),a - ld a,Num4-Num3-2 - ld (Num3+1),a - ret -Num4: - ld (de),a - inc de - ret - - -DEV_MSG: - db "Device index " -DEVINDEX_MSG: - db "0:",13,10 - db " Number of logical units: " -LUNS_MSG: - db "0" -CRLF: - db 13,10,0 - -NAME_MSG: - db " Device name: ",0 -MANUF_MSG: - db " Device manufacturer: ",0 -SERIAL_MSG: - db " Device serial number: ",0 - -LUN_MSG: - db " LUN " -LUNINDEX_MSG: - db "0: ",0 - -BLOCK_MSG: - db "Block device",0 -CDROM_MSG: - db "CD-ROM",0 -UNKNOWN_MSG: - db "Unknown type",0 -REMOVABLE_MSG: - db ", removable",0 -FIXED_MSG: - db ", fixed",0 -READONLY_MSG: - db ", read-only",0 -FLOPPY_MSG: - db ", floppy disk",0 -CAPAUNIT: - db "K" -CAPACITY_MSG: - db ", 00000KB",0 - -DEVINDEX: - db 1 -SLOT: db -1 -SEGMENT: db 255 -LUNS: db 0 - -BUF: -BUF_REG: -BUF_REG2 equ BUF_REG+8 -BUF_INFO equ BUF_REG2+8 - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/DRIVERS.MAC b/releases/2.0 final/tools/source/DRIVERS.MAC deleted file mode 100644 index c1d295e4..00000000 --- a/releases/2.0 final/tools/source/DRIVERS.MAC +++ /dev/null @@ -1,199 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "DRIVERS - displays information about the disk drivers present in the system",13,10 - db 13,10 - db "Usage: DRIVERS",13,10 - db 1Ah - -START: - call CHK250## - - ld a,1 - ld (INDEX),a - - - ;--- Loop for all available drivers, until GDRVR returns error - -MAIN_LOOP: - ld a,(INDEX) - ld hl,BUF - ld c,_GDRVR## - call 5 - ld b,0 - ld c,_TERM## - jp nz,5 - ld ix,BUF - - - ;* Print driver name and version number - - bit 7,(ix+4) - jr z,IS_LEGACY - - ld hl,BUF+8 - ld bc,32 - call PRPAD## - - ld e," " - ld c,_CONOUT## - call 5 - ld e,"v" - ld c,_CONOUT## - call 5 - - ld a,(ix+5) - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Main version number - - ld e,"." - ld c,_CONOUT## - call 5 - - ld a,(ix+6) - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Secondary version number - - ld a,(ix+7) - or a - jr z,OK_NAME - - ld e,"." - ld c,_CONOUT## - call 5 - - ld a,(ix+7) - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Revision number, only if not zero - - jr OK_NAME - -IS_LEGACY: - ld de,LEGACY_MSG - ld c,_ZSTROUT## - call 5 -OK_NAME: - - - ;* Print slot number - - ld de,ONSLOT_S - ld c,_ZSTROUT## - call 5 - - ld a,(ix) - ld b,(ix+1) - call PRSLOT## - - ld de,CRLF - ld c,_ZSTROUT## - call 5 - - - ;* Print driver type - - bit 7,(ix+4) - jr z,IS_LEGACY_2 - - ld de,DEVBASED_MSG - bit 0,(ix+4) - jr nz,PRINT_TYPE - ld de,DRVBASED_MSG -PRINT_TYPE: - ld c,_ZSTROUT## - call 5 -IS_LEGACY_2: - - - ;* Print number of assigned drives - - ld a,(ix+2) - or a - jr nz,HAS_DRIVES - - ld de,NODRIVES_MSG - ld c,_ZSTROUT## - call 5 - jr OK_PRINT_DRIVES -HAS_DRIVES: - - cp 1 - jr nz,HAS_MANY_DRIVES - ld a,(ix+3) - add a,"A" - ld (ONEDRIVE),a - ld de,ONEDRIVE_MSG - ld c,_ZSTROUT## - call 5 - jr OK_PRINT_DRIVES - -HAS_MANY_DRIVES: - ld b,a - add a,"0" - ld (NUMDRIVES),a - - ld a,(ix+3) - add a,"A" - ld c,a - ld (FIRSTDRIVE),a - - ld a,b - add a,c - dec a - ld (LASTDRIVE),a - - ld de,DRVASSIGN_MSG - ld c,_ZSTROUT## - call 5 -OK_PRINT_DRIVES: - - - ;* Go to the next driver - - ld de,CRLF - ld c,_ZSTROUT## - call 5 - - ld hl,INDEX - inc (hl) - jp MAIN_LOOP - - -DEVBASED_MSG: - db "Type: device-based",13,10,0 -DRVBASED_MSG: - db "Type: drive-based",13,10,0 -LEGACY_MSG: - db "Legacy driver",0 -ONSLOT_S: - db " on slot ",0 -NODRIVES_MSG: - db "No drives assigned at boot time",13,10,0 -ONEDRIVE_MSG: - db "Drives assigned at boot time: 1, " -ONEDRIVE: - db "A:",13,10,0 -DRVASSIGN_MSG: - db "Drives assigned at boot time: " -NUMDRIVES: - db "0, from " -FIRSTDRIVE: - "A: to " -LASTDRIVE: - "Z:" -CRLF: - db 13,10,0 - -INDEX: db 0 -BUF: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/DRVINFO.MAC b/releases/2.0 final/tools/source/DRVINFO.MAC deleted file mode 100644 index 81882563..00000000 --- a/releases/2.0 final/tools/source/DRVINFO.MAC +++ /dev/null @@ -1,213 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "DRVINFO - displays information about the driver and drive/device/LUN",13,10 - db "for all drive letters",13,10 - db 13,10 - db "Usage: DRVINFO",13,10 - db 1Ah - -START: - call CHK250## - - xor a - ld (DRVINDEX),a - - - ;--- Loop for all drive letters - -MAIN_LOOP: - ld a,(DRVINDEX) - ld hl,BUF_LETTER - ld c,_GDLI## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - - ;* Skip if unassigned drive - - ld a,(BUF_LETTER) - or a - jp z,NEXT_DRIVE - - ld a,(DRVINDEX) - add a,"A" - ld (DRIVE_MSG),a - ld de,DRIVEIS_MSG - ld c,_ZSTROUT## - call 5 - - ld a,(BUF_LETTER) - cp 4 - jr nz,NORDISK - ld de,RAMDISK_MSG - ld c,_ZSTROUT## - call 5 - jp NEXT_DRIVE -NORDISK: - - - ;* Get information about the associated driver - - ld ix,BUF_LETTER - ld d,(ix+1) - ld e,(ix+2) - ld ix,BUF_DRIVER - ld h,(ix) - ld l,(ix+1) - or a - sbc hl,de ;Do not get info again - jr z,OK_INFO ;if it is the same driver as previous drive - - xor a - ld hl,BUF_DRIVER - ld c,_GDRVR## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 -OK_INFO: - - ;* Print driver name and version number - - bit 7,(ix+4) - jr z,IS_LEGACY - - ld hl,BUF_DRIVER+8 - ld bc,32 - call PRPAD## - - ld e," " - ld c,_CONOUT## - call 5 - ld e,"v" - ld c,_CONOUT## - call 5 - - ld a,(ix+5) - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Main version number - - ld e,"." - ld c,_CONOUT## - call 5 - - ld a,(ix+6) - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Secondary version number - - ld a,(ix+7) - or a - jr z,OK_NAME - - ld e,"." - ld c,_CONOUT## - call 5 - - ld a,(ix+7) - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Revision number, only if not zero - - jr OK_NAME - -IS_LEGACY: - ld de,LEGACY_MSG - ld c,_ZSTROUT## - call 5 -OK_NAME: - - - ;* Print slot number - - ld de,ONSLOT_S - ld c,_ZSTROUT## - call 5 - - ld a,(ix) - ld b,(ix+1) - call PRSLOT## - - ld de,CRLF - ld c,_ZSTROUT## - call 5 - - - ;* Print relative unit number or device+LUN - - ld ix,BUF_LETTER - ld a,(BUF_DRIVER+4) - and 1 - jr z,SHOW_REL - - ld a,(ix+4) - add a,"0" - ld (DEVICE),a - ld a,(ix+5) - add a,"0" - ld (LUN),a - ld de,DEVLUN_MSG - ld c,_ZSTROUT## - call 5 - jr OK_DEVLUN - -SHOW_REL: - ld a,(ix+3) - add a,"0" - ld (RELUNIT),a - ld de,RELUNIT_MSG - ld c,_ZSTROUT## - call 5 -OK_DEVLUN: - - - ;* Go to the next drive - -NEXT_DRIVE: - ld a,(DRVINDEX) - inc a - ld (DRVINDEX),a - cp 8 - jp c,MAIN_LOOP - - ld bc,_TERM## - jp 5 - -RAMDISK_MSG: - db "RAM disk",13,10,10,0 -DEVLUN_MSG: - db "Device " -DEVICE: - db "0, LUN " -LUN: - db "0",13,10,10,0 -RELUNIT_MSG: - db "Relative unit " -RELUNIT: - db "0",13,10,10,0 -LEGACY_MSG: - db "Legacy driver",0 -DRIVEIS_MSG: - db "Drive " -DRIVE_MSG: - db "A: is assigned to:",13,10,0 -ONSLOT_S: - db " on slot ",0 -CRLF: - db 13,10,0 - -DRVINDEX: db 0 -BUF_DRIVER: ds 64 -BUF_LETTER: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/FASTOUT.MAC b/releases/2.0 final/tools/source/FASTOUT.MAC deleted file mode 100644 index 433387c3..00000000 --- a/releases/2.0 final/tools/source/FASTOUT.MAC +++ /dev/null @@ -1,82 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 -USAGE_S: - db "FASTOUT - Enable or disable the fast STROUT mode",13,10 - db 13,10 - db "When fast STROUT mode is enabled, MSX-DOS functions STROUT and ZSTROUT",13,10 - db "will print strings faster, but string length will be limited to",13,10 - db "511 characters (longer strings will be truncated).",13,10 - db 13,10 - db "Usage: FASTOUT [ON|OFF]",13,10 - db 1Ah - db 0 - -START: - call CHK250## - - ld de,BUF - ld a,1 - call EXTPAR## - jr nz,FOUND_PARAMS - - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 -FOUND_PARAMS: - - ;--- Set value - - ld hl,BUF - call CHKONOFF## - ld b,a - ld a,1 - ld c,_FOUT## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - ;--- Get current value - -DO_GET: - xor a - ld c,_FOUT## - call 5 - ld d,b - ld b,a - ld c,_TERM## - jp nz,5 - ld b,d - - push bc - ld de,INFO_MSG - ld c,_ZSTROUT## - call 5 - pop af - or a - ld de,OFF_S - jr z,DO_INFO - ld de,ON_S -DO_INFO: - ld c,_ZSTROUT## - call 5 - - ld b,a - ld c,_TERM## - jp 5 - -INFO_MSG: - "Fast STROUT mode is currently ",0 -ON_S: db "ON",13,10,0 -OFF_S: db "OFF",13,10,0 - -BUF: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/LOCK.MAC b/releases/2.0 final/tools/source/LOCK.MAC deleted file mode 100644 index f42dc87a..00000000 --- a/releases/2.0 final/tools/source/LOCK.MAC +++ /dev/null @@ -1,224 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "LOCK - Lock or unlock a drive",13,10 - db 13,10 - db "When a drive is marked as locked, Nextor will never check the",13,10 - db "media change status for the drive; instead, the inserted media is assumed",13,10 - db "to never change. This speeds up media access, but be careful since data",13,10 - db "corruption may happen if the media is changed while it is locked.",13,10 - db 13,10 - db "Any disk error which is aborted will automatically unlock the involved drive.",13,10 - db 13,10 - db "Usage: LOCK [: [ON|OFF]]",13,10 - db 1Ah - -START: - call CHK250## - - ld de,BUF - ld a,1 - call EXTPAR## - jr c,DO_GET_ALL - - - ;--- Get drive letter - - ld hl,BUF - call CHKL2## - cp .IPARM## - ld b,a - jp z,DO_TERM - ld (DRIVE),a - - - ;--- Get ON/OFF switch - - ld a,2 - ld de,BUF - call EXTPAR - jr c,DO_GET - - - ;--- Set value - - ld hl,BUF - call CHKONOFF## - ld b,a - ld a,(DRIVE) - dec a - ld e,a - ld a,1 - ld c,_LOCK## - call 5 - ld b,a - jp nz,DO_TERM - - - ;--- Get current value and print it - -DO_GET: - ld a,(DRIVE) - or a - jr z,DO_GET_ALL - - ;* Print value for one drive - - dec a - ld e,a - xor a - ld c,_LOCK## - call 5 - ld d,b - ld b,a - jp nz,DO_TERM - ld a,d - - or a - ld de,OFF_MSG - jr z,ONOFF_OK - ld de,ON_MSG -ONOFF_OK: - push de - ld a,(DRIVE) - add a,"A"-1 - ld (DRIVE_LETTER),a - - ld de,DRVINFO_MSG - ld c,_ZSTROUT## - call 5 - - pop de - ld c,_ZSTROUT## - call 5 - - ld b,a - jp DO_TERM - - - ;* Obtain lock status for all drives - -DO_GET_ALL: - xor a - ld hl,BUF -DO_GET_LOOP: - push af - push hl - ld e,a - xor a - ld c,_LOCK## - call 5 - pop hl - jr z,GET_NOERR - ld b,0 -GET_NOERR: - ld (hl),b - inc hl - pop af - inc a - cp 8 - jr c,DO_GET_LOOP - - ld b,8 - ld hl,BUF - xor a -DO_CHK_LOOP: - or (hl) - inc hl - djnz DO_CHK_LOOP - or a - jr nz,DO_PRINT_LOCK - - - ;* No locked drives: print message and terminate - - ld de,NOLOCK_MSG - ld c,_ZSTROUT## - call 5 - ld b,a - jp DO_TERM - - - ;* There are locked drives: print them and terminate - -DO_PRINT_LOCK: - ld de,LOCKED_MSG - ld c,_ZSTROUT## - call 5 - - ld a,"A" - ld hl,BUF -DO_PRINT_LOOP: - ld (DRIVE_MSG),a - push af - ld a,(hl) - or a - jr z,DO_PRINT_NEXT - - push hl - ld de,DRIVE_MSG - ld c,_ZSTROUT## - call 5 - pop hl - -DO_PRINT_NEXT: - inc hl - pop af - inc a - cp "H"+1 - jr c,DO_PRINT_LOOP - - - ;* Done - - ld de,CRLF - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 - -DO_TERM: - ld a,b - or a - ld c,_TERM## - jp z,5 - - push bc - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - pop bc - ld c,_TERM## - jp 5 - -USAGE_S: - db "Usage: LOCK [: [ON|OFF]]",13,10 - db 13,10 - db "TYPE LOCK.COM for more details.",13,10 - db 0 - -DRVINFO_MSG: - db "Drive " -DRIVE_LETTER: - db "X: is ",0 -ON_MSG: - db "locked." -CRLF: - db 13,10,0 -OFF_MSG: - db "NOT locked.",13,10,0 -NOLOCK_MSG: - db "No drives are locked.",13,10,0 -LOCKED_MSG: - db "The following drives are locked:",13,10,0 -DRIVE_MSG: - db "X: ",0 - -DRIVE: db 0 -BUF: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/MACROS.INC b/releases/2.0 final/tools/source/MACROS.INC deleted file mode 100644 index dd7b0aeb..00000000 --- a/releases/2.0 final/tools/source/MACROS.INC +++ /dev/null @@ -1,96 +0,0 @@ - .xlist - -;Macros for generating IXh/IXl/IYh/IYl instructions. -;These instructions are generated by -;appending a DDh byte to instructions referring to H, to access IXh, -;or to instructions referring to L, to access IXl. -;For IY, FDh is used instead of DDh. - -ld_iyh_a macro - db 0FDh - ld h,a - endm - -ld_iyl_a macro - db 0FDh - ld l,a - endm - -ld_iyh_b macro - db 0FDh - ld h,b - endm - -ld_iyh_c macro - db 0FDh - ld h,c - endm - -ld_a_iyh macro - db 0FDh - ld a,h - endm - -ld_a_iyl macro - db 0FDh - ld a,l - endm - -ld_c_ixh macro - db 0DDh - ld c,h - endm - -ld_ixh_a macro - db 0DDh - ld h,a - endm - -ld_a_ixh macro - db 0DDh - ld a,h - endm - -ld_a_ixl macro - db 0DDh - ld a,l - endm - -ld_a_iyh macro - db 0FDh - ld a,h - endm - -or_ixl macro - db 0DDh - or l - endm - -or_iyl macro - db 0FDh - or l - endm - -cp_ixl macro - db 0DDh - cp l - endm - -cp_ixh macro - db 0DDh - cp h - endm - -cp_iyl macro - db 0FDh - cp l - endm - -cp_iyh macro - db 0FDh - cp h - endm - -; - .list -; diff --git a/releases/2.0 final/tools/source/MAPDRV.MAC b/releases/2.0 final/tools/source/MAPDRV.MAC deleted file mode 100644 index d28e7a83..00000000 --- a/releases/2.0 final/tools/source/MAPDRV.MAC +++ /dev/null @@ -1,374 +0,0 @@ - .z80 - ;include MACROS.INC -ld_a_iyl macro - db 0FDh - ld a,l - endm - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "MAPDRV - map a drive to a driver, device, LUN and partition",13,10 - db 13,10 - db "Usage:",13,10 - db 13,10 - db "MAPDRV [/L] : |d|u [[-] [[-]|0]]",13,10 - db 13,10 - db "Maps the drive to the specified partition of the specified device and LUN",13,10 - db "of the driver in the specified slot (must be a device-based driver).",13,10 - db 13,10 - db "/L locks the drive immediately after doing the mapping.",13,10 - db 13,10 - db " can be any number starting at 1, or 0 to map the drive directly",13,10 - db "to the device (needed for partitionless devices such as floppy disks).",13,10 - db "Partition numbers 2 to 4 refer to extended partitions 2-1 to 2-4 if partition",13,10 - db "2 of the device is extended, otherwise they refer to primary partitions.",13,10 - db 13,10 - db " and must be a number from 1 to 7 each one. If is",13,10 - db "specifided but is omitted, value 1 is assumed for .",13,10 - db 13,10 - db " and must be a number from 0 to 3. If 0 is specified instead,",13,10 - db "the primary disk controller slot is assumed.",13,10 - db 13,10 - db "If device information is provided but slot is omitted, the drive is mapped to",13,10 - db "the specified partition of the specified device in the driver already",13,10 - db "controlling the drive (this works only if the drive is currently mapped",13,10 - db "to a device-based driver).",13,10 - db 13,10 - db "If both device and slot information are omitted, the drive is mapped to the",13,10 - db "specified partition of the device it is already mapped to (this works only if",13,10 - db "the drive is currently mapped to a device-based driver).",13,10 - db 13,10 - db "'d' will revert the drive to its default mapping (the mapping at boot time).",13,10 - db "'u' will leave the drive unmapped. Other parameters are ignored in both cases.",13,10 - db 1Ah - -USAGE_S: - db "MAPDRV - map a drive to a driver, device, LUN and partition",13,10 - db 13,10 - db "MAPDRV [/L] : |d|u [[-] [[-]|0]]",13,10 - db 13,10 - db "TYPE MAPDRV.COM for more details.",13,10 - db 0 - -START: - call CHK250## - - ld de,BUF - ld a,1 - call EXTPAR## - jr nz,FOUND_PARAMS - - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 -FOUND_PARAMS: - - ;--- Get parameters - - ;* Check for /L - - ld iy,2 - - ld a,(BUF) - cp '/' - jr nz,NO_LOCK - inc hl - ld a,(BUF+1) - or 32 - cp 'l' - jr nz,NO_LOCK - - ld a,-1 - ld (DO_LOCK),a - - ld de,buf - ld a,2 - call EXTPAR## - ld b,.NOPAR## - ld c,_TERM## - jp c,5 - - inc iy -NO_LOCK: - - ;* Drive letter - - ld hl,BUF - call CHKLET## - dec a - ld (DRIVE),a - - ;* Partition number - - ld de,BUF - ld_a_iyl - inc iy - call EXTPAR## - ld b,.NOPAR## - ld c,_TERM## - jp c,5 - - ld a,(BUF) ;Check fo special values "d" and "u" - or 20h - cp "d" - ld b,1 - jp z,DO_MAP_DU - cp "u" - ld b,0 - jp z,DO_MAP_DU - - ld hl,BUF ;Get first number - call EXTNUM_TERM - ld (PARTITION),a - - ;* Device, LUN - - ld de,BUF - ld_a_iyl - inc iy - call EXTPAR## - jp c,DO_MAP - - ld a,(BUF) - cp "1" - jp c,IPARM_TERM - cp "8" - jp nc,IPARM_TERM - sub "0" - ld (DEVICE),a - - ld a,(BUF+1) - or a - jr z,OK_DEVLUN - cp "-" - jp nz,IPARM_TERM - - ld a,(BUF+2) - cp "1" - jp c,IPARM_TERM - cp "8" - jp nc,IPARM_TERM - sub "0" - ld (LUN),a -OK_DEVLUN: - - ;* Slot, subslot, segment - - ld de,BUF - ld_a_iyl - inc iy - call EXTPAR## - jp c,DO_MAP - - ld hl,BUF - call GETSLOT## - or a - jr nz,NO_MAIN - ld a,(0F348h) -NO_MAIN: - ld (SLOT),a - ld a,b - ld (SEGMENT),a - - jr DO_MAP - - - ;--- Do the mapping to default value, or unmap the drive - ; Input: B=0 to unmap, B=1 to map to default value - -DO_MAP_DU: - ld a,(DRIVE) - ld c,_MAPDRV## - call 5 - ld b,a - ld c,_TERM## - jp 5 - - - ;--- Do the mapping to partition and device - -DO_MAP: - - ;* If no slot specified, get the current drive mapping - - ld a,(SLOT) - inc a - jr nz,OK_GETCURMAP - - ld a,(DRIVE) - ld hl,BUF_LETTER - ld c,_GDLI## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - ld a,(BUF_LETTER) - cp 1 - ld b,.IDRV## - ld c,_TERM## - jp nz,5 ;Error if not assigned to a block device - - ld a,(DEVICE) - or a - jr nz,OK_DEVICE - ld a,(BUF_LETTER+4) - ld (DEVICE),a - ld a,(BUF_LETTER+5) - ld (LUN),a -OK_DEVICE: - - xor a - inc hl - ld d,(hl) - inc hl - ld e,(hl) - ld hl,BUF_DRIVER - ld c,_GDRVR## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - ld a,(BUF_DRIVER+4) - and 1 - ld b,.IDRVR## - ld c,_TERM## - jp z,5 ;Error if not assigned to a device-based driver - - ld a,(BUF_DRIVER) - ld (SLOT),a - ld a,(BUF_DRIVER+1) - ld (SEGMENT),a -OK_GETCURMAP: - - ;* Convert partition to primary or extended as appropriate - - ld a,(PARTITION) - or a - jp z,OK_ADJUST_PARTITION - cp 1 - jr z,IS_PRIM_PART - cp 5 - jr nc,IS_EXT_PART - - ld hl,0 - ld de,0 - ld ix,DRIVE - ld a,(ix+3) ;Slot - ld b,(ix+4) ;Segment - ld d,(ix+5) ;Device - ld e,(ix+6) ;LUN - ld h,2 ;Primary partition - ld l,0 ;Extended partition - ld c,_GPART## - call 5 - ld h,b - ld b,a - ld c,_TERM## - jp nz,5 - - ld a,h - cp 5 ;Is extended? - jr z,IS_EXT_PART - -IS_PRIM_PART: - ld a,(PARTITION) - ld (PRIMARY),a - xor a - ld (EXTENDED),a - jr OK_ADJUST_PARTITION - -IS_EXT_PART: - ld a,2 - ld (PRIMARY),a - ld a,(PARTITION) - dec a - ld (EXTENDED),a - -OK_ADJUST_PARTITION:: - - ;* Obtain the partition information - - ld hl,0 - ld de,0 - ld a,(PRIMARY) - or a - jr z,OK_PARTINFO - ld ix,DRIVE - ld a,(ix+3) ;Slot - ld b,(ix+4) ;Segment - ld d,(ix+5) ;Device - ld e,(ix+6) ;LUN - ld h,(ix+1) ;Primary partition - ld l,(ix+2) ;Extended partition - ld c,_GPART## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 -OK_PARTINFO: - - - ;* Finally, do the actual mapping and lock if necessary - - ld (SLOT+4),de - ld (SLOT+6),hl - ld a,(DRIVE) - ld b,2 - ld hl,SLOT ;Information is already in the right order for _MAPDRV - ld c,_MAPDRV## - call 5 - ld b,a - or a - jr nz,DO_LOCK_OK - - ld a,(DO_LOCK) - or a - jr z,DO_LOCK_OK - ld a,(DRIVE) - ld e,a - ld a,1 - ld b,0FFh - ld c,_LOCK## - call 5 - ld b,a -DO_LOCK_OK: - - ld c,_TERM## - jp 5 - - -EXTNUM_TERM: - call EXT8## - ret nc -IPARM_TERM: - ld b,.IPARM## - ld c,_TERM## - jp 5 - -NOPARM_TERM: - ld b,.NOPAR## - ld c,_TERM## - jp 5 - -PARTITION: db 0 -DO_LOCK: db 0 -DRIVE: db 0 -PRIMARY: db 0 -EXTENDED: db 0 -SLOT: db -1 -SEGMENT: db 255 -DEVICE: db 0 -LUN: db 1 - -BUF: -BUF_DRIVER: -BUF_LETTER: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/NSYSVER.MAC b/releases/2.0 final/tools/source/NSYSVER.MAC deleted file mode 100644 index 4c610abb..00000000 --- a/releases/2.0 final/tools/source/NSYSVER.MAC +++ /dev/null @@ -1,153 +0,0 @@ -ïŧŋ .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "NSYSVER - Change the NEXTOR.SYS version number",13,10 - db 13,10 - db "Some command line programs will refuse to work if the NEXTOR.SYS version",13,10 - db "is too small. This program allows to change the NEXTOR.SYS version",13,10 - db "reported by the system (the value returned in DE by the DOSVER function call).",13,10 - db "The value displayed by the VER command will not change.",13,10 - db 13,10 - db "Usage: NSYSVER .",13,10 - db 1Ah - -USAGE_S: - db "NSYSVER - Change the NEXTOR.SYS version number",13,10 - db 13,10 - db "Usage: NSYSVER .",13,10 - db 13,10 - db "TYPE NSYSVER.COM for more details.",13,10 - db 0 - -START: - call CHK250## - - ld de,BUF - ld a,1 - call EXTPAR## - jr nz,FOUND_PARAMS - - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - ld de,CURVER_S - ld c,_ZSTROUT## - call 5 - - call GET_VER_ADD - ld a,(ix+1) - call PRINT_DIGIT - ld e,'.' - call PRINT_CHAR - ld a,(ix) - rrca - rrca - rrca - rrca - and 00001111b - call PRINT_DIGIT - ld a,(ix) - and 00001111b - call PRINT_DIGIT - ld e,13 - call PRINT_CHAR - ld e,10 - call PRINT_CHAR - - xor a - ld c,_TERM## - jp 5 -FOUND_PARAMS: - - ld a,(BUF) - call PARSE_DIGIT - jp c,BAD_PARAM - ld d,a - - ld a,(BUF+1) - cp '.' - jp nz,BAD_PARAM - - ld a,(BUF+2) - call PARSE_DIGIT - jp c,BAD_PARAM - rlca - rlca - rlca - rlca - and 11110000b - ld e,a - - ld a,(BUF+3) - call PARSE_DIGIT - jp c,BAD_PARAM - or e - ld e,a - - call GET_VER_ADD - ld (ix),e - ld (ix+1),d - - ld de,OK_S - ld c,_ZSTROUT## - call 5 - - xor a - ld c,_TERM## - jp 5 - - ret - -;Get in IX the address of NEXTOR.SYS version -GET_VER_ADD: - ld ix,(0001h) - ld bc,32h - add ix,bc - ret - -;Print 1 digit number passed in A -PRINT_DIGIT: - add a,'0' - ld e,a - ld c,_CONOUT## - call 5 - ret - -;Print char passed in E -PRINT_CHAR: - ld c,_CONOUT## - jp 5 - -;Parse number passed in ASCII in A, return it in A -;Returns Cy=1 if no valid number - -PARSE_DIGIT: - cp '0' - ret c - cp '9'+1 - ccf - ret c - sub '0' - ret - -BAD_PARAM: - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - - ld b,.IPARM## - ld c,_TERM## - jp 5 - -OK_S: - db "NEXTOR.SYS version changed successfully.",13,10,0 - -CURVER_S: - db 13,10 - db "Current NEXTOR.SYS version: ",0 - -BUF: - end diff --git a/releases/2.0 final/tools/source/RALLOC.MAC b/releases/2.0 final/tools/source/RALLOC.MAC deleted file mode 100644 index 11f7daa8..00000000 --- a/releases/2.0 final/tools/source/RALLOC.MAC +++ /dev/null @@ -1,184 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "RALLOC - Enable or disable the reduced allocation information mode for a drive",13,10 - db 13,10 - db "When the reduced allocation information mode for a drive is enabled,",13,10 - db "MSX-DOS function ALLOC will return the total and/or free space information",13,10 - db "for that drive reduced if necessary, so that the sector count fits in 16 bits",13,10 - db "(that is, the space information returned will be smaller than 32MB).",13,10 - db 13,10 - db "Usage: RALLOC [: ON|OFF]",13,10 - db 1Ah - -START: - call CHK250## - - ld de,BUF - ld a,1 - call EXTPAR## - jr c,DO_GET - - ;--- Set value - - ;* Get drive letter as a bit mask - ; (1=A, 10b=B, 100b=C ...) - - ld hl,BUF - call CHKL2## - cp .IPARM## - ld b,a - jp z,DO_TERM - dec a - ld b,a - ld a,1 - jr z,LET_OK -LET_LOOP: - rlca - djnz LET_LOOP -LET_OK: - push af - - ;* Get ON/OFF switch - - ld a,2 - ld hl,BUF - call EXTPAR - ld b,.NOPAR## - jp c,DO_TERM - - ld hl,BUF - call CHKONOFF## - push af - - ;* Get current RALLOC vector - - xor a - ld c,_RALLOC - call 5 - ld b,a - jp nz,DO_TERM - - pop af ;A=0 for OFF, FFh for ON - pop bc ;B=Drive letter mask - or a - jr z,DO_OFF - - ;* Set ON - - ld a,l ;L=Current mask - or b - jr DO_SET - - ;* Set OFF - -DO_OFF: ld a,b - cpl - and l - - ;* Write new vector - -DO_SET: - ld l,a - ld a,1 - ld c,_RALLOC## - call 5 - ld b,a - jp nz,DO_TERM - - - ;--- Get current vector and print it - -DO_GET: - xor a - ld c,_RALLOC## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - ld a,l - or a - jr nz,DO_PRINT - - ;* No drives in RALLOC mode - - ld de,NORALLOC_MSG - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 -DO_PRINT: - - ;* There are drives in RALLOC mode: print them - - push hl - ld de,RALLOC_MSG - ld c,_ZSTROUT## - call 5 - pop hl - - ld b,8 - ld h,"A" -PRINT_LOOP: - rr l - jr nc,PRINT_NEXT - - push hl - push bc - ld a,h - ld (DRIVE_MSG),a - ld de,DRIVE_MSG - ld c,_ZSTROUT## - call 5 - pop bc - pop hl - -PRINT_NEXT: - inc h - djnz PRINT_LOOP - - ld de,CRLF - ld c,_ZSTROUT## - call 5 - - ld b,a - ld c,_TERM## - jp 5 - -DO_TERM: - ld a,b - or a - ld c,_TERM## - jp z,5 - - push bc - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - pop bc - ld c,_TERM## - jp 5 - -USAGE_S: - db "Usage: RALLOC [: ON|OFF]",13,10 - db 13,10 - db "TYPE RALLOC.COM for more details.",13,10 - db 0 - -NORALLOC_MSG: - db "There are no drives in reduced allocation information mode." -CRLF: db 13,10,0 - -RALLOC_MSG: - db "The following drives are in reduced allocation information mode:",13,10,0 -DRIVE_MSG: - db "A: ",0 - -BUF: - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/SHARED.MAC b/releases/2.0 final/tools/source/SHARED.MAC deleted file mode 100644 index e93cac97..00000000 --- a/releases/2.0 final/tools/source/SHARED.MAC +++ /dev/null @@ -1,669 +0,0 @@ - title MSX-DOS 2.50 - Common file for utility applications - - .Z80 - include MACROS.INC -; include CONST.INC - -;----------------------------------------------------------------------------- -; -; Convert a 8 bit number to an unterminated string -; Input: A = Number -; IX = Destination address -; Output: IX points after the generated string -; Modifies: C - -BYTE2ASC:: cp 10 - jr c,B2A_1D - cp 100 - jr c,B2A_2D - cp 200 - jr c,B2A_1XX - jr B2A_2XX - - ;--- One digit - -B2A_1D: add a,"0" - ld (ix),a - inc ix - ret - - ;--- Two digits - -B2A_2D: ld c,"0" -B2A_2D2: - inc c - sub 10 - cp 10 - jr nc,B2A_2D2 - - ld (ix),c - inc ix - jr B2A_1D - - ;--- Between 100 and 199 - -B2A_1XX: - ld (ix),"1" - sub 100 -B2A_XXX: - inc ix - cp 10 - jr nc,B2A_2D ;If 1XY with X>0 - ld (ix),"0" ;If 10Y - inc ix - jr B2A_1D - - ;--- Between 200 and 255 - -B2A_2XX: - ld (ix),"2" - sub 200 - jr B2A_XXX - - -;----------------------------------------------------------------------------- -; -; Extract a parameter from the command line -; INPUT: A = Parameter index (starting at 1) -; DE = Destination address for parameter -; OUTPUT: A = Total number of parameters -; CY = 1 -> Parameter does not exists -; B undefined, destination buffer unmodified -; CY = 0 -> Parameter copied at address DE, zero terminated -; B = Parameter length (not including terminating zero) -; MODIFIES: - - -EXTPAR:: or a ;Terminate with error if A = 0 - scf - ret z - - ld b,a - ld a,(80h) ;Terminate with error if no parameters available - or a - scf - ret z - ld a,b - - push af - push hl - ld a,(80h) - ld c,a ;Put zero at the end of command line - ld b,0 - ld hl,81h - add hl,bc - ld (hl),0 - pop hl - pop af - - push hl - push de - push ix - ld ix,0 ;IXl: Number of parameters - ld_ixh_a ;IXh: Parameter to be extracted - ld hl,81h - -PASASPC: - ld a,(hl) ;Skip spaces - or a - jr z,ENDPNUM - cp " " - inc hl - jr z,PASASPC - - inc ix -PASAPAR: ld a,(hl) ;Traverse parameter characters - or a - jr z,ENDPNUM - cp " " - inc hl - jr z,PASASPC - jr PASAPAR - -ENDPNUM: - ld_a_ixh ;Error if parameter index - dec a ;is larger that the number of parameters - cp_ixl - jr nc,EXTPERR - - ld hl,81h - ld b,1 ;B = current parameter -PASAP2: ld a,(hl) ;Skip spaces until finding next parameter - cp " " - inc hl - jr z,PASAP2 - - ld_a_ixh ;If it is the desired parameter, extract it. - cp B ;Otherwise... - jr z,PUTINDE0 - - inc B -PASAP3: ld a,(hl) ;...skip it and jump to PASAP2 - cp " " - inc hl - jr nz,PASAP3 - jr PASAP2 - -PUTINDE0: - ld b,0 - dec hl -PUTINDE: - inc b - ld a,(hl) - cp " " - jr z,ENDPUT - or a - jr z,ENDPUT - ld (de),a ;Copy paramater to (DE) - inc de - inc hl - jr PUTINDE - -ENDPUT: xor a - ld (de),a - dec b - - ld_a_ixl - or a - jr FINEXTP -EXTPERR: - scf -FINEXTP: - pop ix - pop de - pop hl - ret - - -;----------------------------------------------------------------------------- -; -; Checks that Nextor 2.0 is running and that NEXTOR.SYS 2.0 is loaded. -; If so, returns normally; otherwise, terminates program. -; Corrupts AF, BC, DE. - -CHK250:: - ld b,05Ah - ld hl,01234h - ld de,0ABCDh - ld c,_DOSVER## - ld ix,0 - call 5 - push de - - ld de,BADKER_MSG - ld a,b - cp 2 - jr c,CHK250_ERR - push ix - pop bc - ld a,b - cp 1 ;NEXTOR_ID - jr nz,CHK250_ERR - ld a,c - cp 2 - jr c,CHK250_ERR - - pop bc - ld de,BADSYS_MSG - ld a,b - cp 2 - ret nc - -CHK250_ERR: - ld c,_STROUT## - call 5 - ld c,_TERM0## - jp 5 - -BADKER_MSG: - db "*** This program requires Nextor 2.0 or later",13,10,"$" -BADSYS_MSG: - db "*** Bad version of NEXTOR.SYS, version 2.0 or later is required",13,10,"$" - - -;----------------------------------------------------------------------------- -; -; Check a string that must be either "on" or "off". -; If it is none of these, terminate program with "Invalid parameter" error. -; Input: HL = Pointer to zero-terminated parameter -; Output: A=0, Z if "off"; A=FFh, NZ if "on" -; Corrupts AF, HL - -CHKONOFF:: - ld a,(hl) - or 32 - cp "o" - jp nz,IPARM - - inc hl - ld a,(hl) - or 32 - cp "f" - jr nz,NO_OFF - inc hl - ld a,(hl) - or 32 - cp "f" - jp nz,IPARM - inc hl - ld a,(hl) - or a - jp nz,IPARM - ret - -NO_OFF: - cp "n" - jp nz,IPARM - inc hl - ld a,(hl) - or a - jp nz,IPARM - dec a - ret - - -;----------------------------------------------------------------------------- -; -; Check a parameter that must be a drive letter. -; If it is not a valid drive letter, terminate program with "Invalid parameter" error. -; Input: HL = Pointer to zero-terminated parameter -; Output: A=Drive letter (1=A:, 2=B:, etc) -; Corrupts AF, HL - -CHKLET:: - ld a,(hl) - or 32 - cp "a" - jp c,IPARM - cp "h"+1 - jp nc,IPARM - push af - inc hl - ld a,(hl) - cp ":" - jp nz,IPARM - inc hl - ld a,(hl) - or a - jp nz,IPARM - - pop af - sub "a"-1 - ret - - -CHKL2:: - ld a,(hl) - or 32 - cp "a" - jr c,CHKLET4 - cp "h"+1 - jr nc,CHKLET4 - push af - inc hl - ld a,(hl) - cp ":" - jr nz,CHKLET3 - inc hl - ld a,(hl) - or a - jr nz,CHKLET3 - - pop af - sub "a"-1 - ret - -CHKLET3: - pop af -CHKLET4: - ld a,.IPARM## - ret - - -;----------------------------------------------------------------------------- -; -; Print a slot+segment number -; The output will be [-][:] -; Input: A = Slot number, B = Segment number -; Modifies: AF, BC, DE, HL - -PRSLOT:: - push bc - push af - and 11b - add a,"0" - ld e,a - ld c,_CONOUT## - call 5 ;Print main slot number - - pop af - bit 7,a - jr z,DO_PRINT_SEGMENT - rrca - rrca - and 11b - add a,"0" - ld e,a - push de - ld e,"-" - ld c,_CONOUT## - call 5 - pop de - ld c,_CONOUT## - call 5 ;Print sub-slot number - -DO_PRINT_SEGMENT: - pop bc - ld a,b - cp 0FFh - ret z - - push ix - ld ix,PRSLOT_BUF+1 - call BY2ASC - ld (ix),0 - pop ix - ld de,PRSLOT_BUF - ld c,_ZSTROUT## - jp 5 - -PRSLOT_BUF: - db ":000",0 - - -;----------------------------------------------------------------------------- -; -; Convert a 8 bit number to an unterminated string -; Input: A = Number -; IX = Destination address -; Output: IX points after the generated string -; Modifies: C - -BY2ASC:: - cp 10 - jr c,B2A1D - cp 100 - jr c,B2A2D - cp 200 - jr c,B2A1XX - jr B2A2XX - - ;* One digit - -B2A1D: add a,"0" - ld (ix),a - inc ix - ret - - ;* Two digits - -B2A2D: ld c,"0" -B2A2D2: - inc c - sub 10 - cp 10 - jr nc,B2A2D2 - - ld (ix),c - inc ix - jr B2A1D - - ;* Between 100 and 199 - -B2A1XX: - ld (ix),"1" - sub 100 -B2AXXX: - inc ix - cp 10 - jr nc,B2A2D ;If 1XY with X>0 - ld (ix),"0" ;If 10Y - inc ix - jr B2A1D - - ;* Between 200 and 255 - -B2A2XX: - ld (ix),"2" - sub 200 - jr B2AXXX - - -;----------------------------------------------------------------------------- -; -; Prints a string which is padded with spaces at right -; (modifies the string by appending a 0 byte over the first padding space) -; Input: HL = String address -; BC = String length - -PRPAD:: - push hl - add hl,bc -PRPAD_LOOP: - dec hl - ld a,(hl) - cp " " - jr nz,PRPAD_FOUND - dec bc - ld a,b - or c - jr nz,PRPAD_LOOP - ret ;Do nothing if the string was just spaces - -PRPAD_FOUND: - inc hl - ld (hl),0 - - pop de - ld c,_ZSTROUT## - jp 5 - - - -;----------------------------------------------------------------------------- -; -; Extracts a 8 bit number from a string -; INPUT: HL = ASCII string address -; OUTPUT: A = number -; E = First non-numeric character -; HL = Address after the number -; Cy=1 if error (not a number, or number too big) -; MODIFIES: BC - -EXT8:: - call EXTNUM - ret c - or a - scf - ret nz - ld a,b - or a - scf - ret nz - ld a,d - or a - scf - ret z - ld a,c - ld c,d - ld b,0 - add hl,bc - or a - ret - - -;----------------------------------------------------------------------------- -; -; Extract a 5 digit number from a string -; INPUT: HL = ASCII string address -; OUTPUT: CY-BC = 17 bit number -; D = Count of digits of the number. -; The number is considered to be extracted -; when a non-numeric character is found, -; or when five digits have been extracted. -; E = First non-numeric character (o 6th digit) -; A = error code: -; 0 => Success -; 1 => The number has more than 5 digits. -; CY-BC contains then the number built from -; the first 5 digits. -; MODIFIES: - - -EXTNUM:: - push hl - push ix - ld ix,ACA - res 0,(ix) - set 1,(ix) - ld bc,0 - ld de,0 -BUSNUM: ld a,(hl) ;Jump to FINEXT if not a digit, or is the 6th digit - ld e,a - cp "0" - jr c,FINEXT - cp "9"+1 - jr nc,FINEXT - ld a,d - cp 5 - jr z,FINEXT - call POR10 - -SUMA: push hl ;BC = BC + A - push bc - pop hl - ld bc,0 - ld a,e - sub "0" - ld c,a - add hl,bc - call c,BIT17 - push hl - pop bc - pop hl - - inc d - inc hl - jr BUSNUM - -BIT17: set 0,(ix) - ret -ACA: db 0 ;b0: num>65535. b1: more than 5 digits - -FINEXT: ld a,e - cp "0" - call c,NODESB - cp "9"+1 - call nc,NODESB - ld a,(ix) - pop ix - pop hl - srl a - ret - -NODESB: res 1,(ix) - ret - -POR10: push de - push hl ;BC = BC * 10 - push bc - push bc - pop hl - pop de - ld b,3 -ROTA: sla l - rl h - djnz ROTA - call c,BIT17 - add hl,de - call c,BIT17 - add hl,de - call c,BIT17 - push hl - pop bc - pop hl - pop de - ret - - -;----------------------------------------------------------------------------- -; -; Extract a slot+segment from a string with the format [-][:] -; If the string is not valid, terminate with "Invalid parameter" error. -; Input: HL = String address -; Output: A = Slot, B = Segment -; Modifies: AF, BC, DE, HL - -GETSLOT:: - ld a,-1 - ld (SUBSLOT),a - ld (SEGMENT),a - - call EXTNUM_TERM ;Get main slot number - cp 4 - jp nc,IPARM - ld (SLOT),a - ld a,e - or a - jr z,OK_SLOTSUBSEG - cp ":" - jr z,OK_SUBSLOT - cp "-" - jp nz,IPARM - - inc hl - call EXTNUM_TERM ;Get subslot number - cp 4 - jp nc,IPARM - ld (SUBSLOT),a - ld a,e - or a - jr z,OK_SLOTSUBSEG - cp ":" - jp nz,IPARM -OK_SUBSLOT: - - inc hl - call EXTNUM_TERM ;Get segment number - ld (SEGMENT),a - ld a,e - or a - jp nz,IPARM -OK_SLOTSUBSEG: - - ;* Convert slot+subslot to slot byte - - ld a,(SUBSLOT) - cp -1 - jr z,OK_MAKESLOT - - rlca - rlca - and 00001100b - ld b,a - ld a,(SLOT) - or b - or 10000000b - ld (SLOT),a -OK_MAKESLOT: - - ld a,(SEGMENT) - ld b,a - ld a,(SLOT) - ret - -SLOT: - db 0 -SUBSLOT: - db 0 -SEGMENT: - db 0 - - -EXTNUM_TERM: - call EXT8 - ret nc -IPARM: - ld b,.IPARM## - ld c,_TERM## - jp 5 - - end diff --git a/releases/2.0 final/tools/source/Z80MODE.MAC b/releases/2.0 final/tools/source/Z80MODE.MAC deleted file mode 100644 index b36a250b..00000000 --- a/releases/2.0 final/tools/source/Z80MODE.MAC +++ /dev/null @@ -1,138 +0,0 @@ - .z80 - - jp START - - ; ------------------------------------------------------------------------------- - db 13 - db "Z80MODE - Enable or disable Z80 access mode for a legacy driver",13,10 - db 13,10 - db "By default, MSX-DOS will enable the Z80 access mode for all legacy drivers",13,10 - db "when running on MSX Turbo-R computers. When this mode is enabled, Z80 CPU is",13,10 - db "switched prior to every access to any drive on the driver. This function",13,10 - db "allows to disable the Z80 access mode for any legacy driver, so drives on",13,10 - db "these drivers can be accessed in R800 mode; and to re-enable it.",13,10 - db 13,10 - db "Z80 mode applies to legacy drivers only. MSX-DOS will never switch to Z80",13,10 - db "CPU when accessing MSX-DOS 2.50 drivers (both device-based and drive-based).",13,10 - db 13,10 - db "Note that this program will work on MSX Turbo-R computers only.",13,10 - db 13,10 - db "Usage: Z80MODE [-]|0 [ON|OFF]",13,10 - db 13,10 - db "If 0 is specified, the primary disk controller slot is assumed",13,10 - db 1Ah - -USAGE_S: - db "Z80MODE - Enable or disable Z80 access mode for a legacy driver",13,10 - db 13,10 - db "Usage: Z80MODE [-]|0 [ON|OFF]",13,10 - db 13,10 - db "TYPE Z80MODE.COM for more details.",13,10 - db 0 - -START: - call CHK250## - - ld de,BUF - ld a,1 - call EXTPAR## - jr nz,FOUND_PARAMS - - ld de,USAGE_S - ld c,_ZSTROUT## - call 5 - ld b,a - ld c,_TERM## - jp 5 -FOUND_PARAMS: - - ;--- Get slot number - - ld hl,BUF - call GETSLOT## - or a - jr nz,NO_PRIMARY - ld a,(0F348h) -NO_PRIMARY: - ld (SLOT),a - ld a,b - inc a - ld b,.IDRVR## - ld c,_TERM## - jp nz,5 - - - ;--- Get ON/OFF switch - - ld a,2 - ld de,BUF2 - call EXTPAR - jr c,DO_GET - - ld hl,BUF2 - call CHKONOFF## - - - ;--- Set value - - ld d,a - ld a,(SLOT) - ld b,1 - ld c,_Z80MODE## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - - ;--- Get current value and print it - -DO_GET: - ld a,(SLOT) - ld b,0 - ld c,_Z80MODE## - call 5 - ld b,a - ld c,_TERM## - jp nz,5 - - push de - ld de,MODE_MSG - ld c,_ZSTROUT## - call 5 - ld de,BUF - ld c,_ZSTROUT## - call 5 - ld de,IS_MSG - ld c,_ZSTROUT## - call 5 - - pop af - ld de,OFF_MSG - or a - jr z,DO_GET2 - ld de,ON_MSG -DO_GET2: - ld c,_ZSTROUT## - call 5 - - ld b,a - ld c,_TERM## - jp 5 - - -MODE_MSG: - db "Z80 access mode for driver in slot ",0 -IS_MSG: - db " is ",0 -ON_MSG: - db "ON",13,10,0 -OFF_MSG: - db "OFF",13,10,0 - -SLOT: - db 0 -BUF: -BUF2 equ BUF+16 - - end \ No newline at end of file diff --git a/releases/2.0 final/tools/source/compile.bat b/releases/2.0 final/tools/source/compile.bat deleted file mode 100644 index e60dd6a8..00000000 --- a/releases/2.0 final/tools/source/compile.bat +++ /dev/null @@ -1,47 +0,0 @@ -@echo off -cls - -if not exist bin md bin - -if .%1==. ( - set files=*.mac - del bin\*.COM 2>nul -) else if exist %1.mac ( - set files=%1.mac - del bin\%1.COM 2>nul -) else ( - echo *** %1.MAC not found! - goto :end -) - -cpm32 M80 =SHARED.MAC -cpm32 M80 =CODES.MAC - -for /r %%f in (%files%) do ( - if not %%~nf==SHARED (if not %%~nf==CODES ( - echo . - echo *** - echo *** %%~nf - echo *** - echo . - cpm32 M80 =%%~nf - cpm32 l80 /P:100,CODES,%%~nf,SHARED,%%~nf/n/x/y/e - if exist %%~nf.hex ( - hex2bin -s 100 %%~nf.hex - ren %%~nf.bin %%~nf.COM - move %%~nf.COM bin\ - ) else ( - echo *** ERROR: %%~nf not compiled - goto :end - ) - )) -) - -:end -del *.bin 2>nul -del *.hex 2>nul -del *.rel 2>nul -del *.sym 2>nul -del *.rel 2>nul - - diff --git a/releases/2.0 final/tools/source/hex2bin.exe b/releases/2.0 final/tools/source/hex2bin.exe deleted file mode 100644 index be16e9a9..00000000 Binary files a/releases/2.0 final/tools/source/hex2bin.exe and /dev/null differ diff --git a/releases/2.0 final/tools/tools.lzh b/releases/2.0 final/tools/tools.lzh deleted file mode 100644 index 95bc485d..00000000 Binary files a/releases/2.0 final/tools/tools.lzh and /dev/null differ diff --git a/releases/2.0 final/tools/tools.zip b/releases/2.0 final/tools/tools.zip deleted file mode 100644 index 3b8be0cf..00000000 Binary files a/releases/2.0 final/tools/tools.zip and /dev/null differ diff --git a/releases/alpha 0/ASCII16.BNK b/releases/alpha 0/ASCII16.BNK deleted file mode 100644 index d2fc4589..00000000 Binary files a/releases/alpha 0/ASCII16.BNK and /dev/null differ diff --git a/releases/alpha 0/ASCII8.BNK b/releases/alpha 0/ASCII8.BNK deleted file mode 100644 index 3a513854..00000000 Binary files a/releases/alpha 0/ASCII8.BNK and /dev/null differ diff --git a/releases/alpha 0/COMMAND2.COM b/releases/alpha 0/COMMAND2.COM deleted file mode 100644 index 46e656fa..00000000 Binary files a/releases/alpha 0/COMMAND2.COM and /dev/null differ diff --git a/releases/alpha 0/DELALL.COM b/releases/alpha 0/DELALL.COM deleted file mode 100644 index b5a1ccdc..00000000 Binary files a/releases/alpha 0/DELALL.COM and /dev/null differ diff --git a/releases/alpha 0/DEVINFO.COM b/releases/alpha 0/DEVINFO.COM deleted file mode 100644 index 19579da7..00000000 Binary files a/releases/alpha 0/DEVINFO.COM and /dev/null differ diff --git a/releases/alpha 0/DOS250.ROM b/releases/alpha 0/DOS250.ROM deleted file mode 100644 index 30aa8284..00000000 Binary files a/releases/alpha 0/DOS250.ROM and /dev/null differ diff --git a/releases/alpha 0/DOS250BA.DAT b/releases/alpha 0/DOS250BA.DAT deleted file mode 100644 index a02b7360..00000000 Binary files a/releases/alpha 0/DOS250BA.DAT and /dev/null differ diff --git a/releases/alpha 0/DRIVER.ASM b/releases/alpha 0/DRIVER.ASM deleted file mode 100644 index 590e78db..00000000 --- a/releases/alpha 0/DRIVER.ASM +++ /dev/null @@ -1,675 +0,0 @@ - ; Dummy disk driver for MSX-DOS 2.50. - ; - ; This code can be used as the basis for developing - ; a real disk driver, just set DRV_TYPE and DRV_HOTPLUG, - ; change the driver name at DRV_NAME, - ; and implement the required routines. - ; - ; See the driver development guide for more details. - - ;org 4100h - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - -;Hot-plug devices support (device-based drivers only): -; 0 for no hot-plug support -; 1 for hot-plug support - -DRV_HOTPLUG equ 0 - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW and DEV_FORMAT -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL: equ 0B5h -.IPARM equ 08Bh - -endif - -;----------------------------------------------------------------------------- -; -; Routines available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a,bank -; ld hl,address -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel bank 0/3, -; then jumps to CALBAS in MSX BIOS. -; This is necessary so that kernel bank is correct in case of BASIC error. - -CALBAS equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; Input: A = bank -; IX = routine address -; AF' = AF for the routine -; BC, DE, HL, IY = input for the routine - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a,slot -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* Call a routine in the driver bank. -; Input: (BK4_ADD) = routine address -; AF, BC, DE, HL, IY = input for the routine -; -; Calls a routine in the driver bank. This routine is the same as CALBNK, -; except that the routine address is passed in address BK4_ADD (#F2ED) -; instead of IX, and the bank number is always 5. This is useful when used -; in combination with CALSLT to call a driver routine from outside -; the driver itself. -; -; Note that register IX can't be used as input parameter, it is -; corrupted before reaching the invoked code. - -CALDRV equ 4048h - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 741Fh ;Null string (disk can't be formatted) -SING_DBL equ 7420h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "MSXDOS_DRIVER",0 - -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based -; bit 1: 1 for hot-plug devices supported (device-based drivers only) - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1+(2*DRV_HOTPLUG) -endif - -;Reserved byte - db 0 - -;Driver name - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - -;Jump table - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO - jp DEV_FORMAT - jp DEV_CMD -endif - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that CALBAS in kernel page 0 -; must be called instead of CALBAS in MSX BIOS. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that CALBAS in kernel page 0 -; must be called instead of CALBAS in MSX BIOS. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7450h, 7453h, 7456h, 7459h and 745Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; DE = First sector number to read/write -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors - B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 8. 1 if the device has no logical -; drives (which is functionally equivalent to having only one). -;+1 (1): Removable device/logical unit flags: -; bit 0: The device supports hot-plug. -; Ignored if hot-plug bit in DRV_FLAGS is zero. -; bit 1: Logical unit 1 is removable. -; ... -; bit 7: Logical unit 7 is removable. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld (hl),0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Physical format a device -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; C = Format choice, 0 to return choice string -;Output: -; When C=0 at input: -; A = 0: Ok, address of choice string returned -; .IFORM: Invalid device or logical unit number, -; or device not formattable -; HL = Address of format choice string (in bank 0 or 3), -; only if A=0 returned. -; Zero, if only one choice is available. -; -; When C<>0 at input: -; A = 0: Ok, device formatted -; Other: error code, same as DEV_RW plus: -; .IPARM: Invalid format choice -; .IFORM: Invalid device or logical unit number, -; or device not formattable -; B = Media ID if the device is a floppy disk, zero otherwise -; (only if A=0 is returned) -; -; Media IDs are: -; F0h: 3.5" Double Sided, 80 tracks per side, 18 sectors per track (1.44MB) -; F8h: 3.5" Single sided, 80 tracks per side, 9 sectors per track (360K) -; F9h: 3.5" Double sided, 80 tracks per side, 9 sectors per track (720K) -; FAh: 5.25" Single sided, 80 tracks per side, 8 sectors per track (320K) -; FBh: 3.5" Double sided, 80 tracks per side, 8 sectors per track (640K) -; FCh: 5.25" Single sided, 40 tracks per side, 9 sectors per track (180K) -; FDh: 5.25" Double sided, 40 tracks per side, 9 sectors per track (360K) -; FEh: 5.25" Single sided, 40 tracks per side, 8 sectors per track (160K) -; FFh: 5.25" Double sided, 40 tracks per side, 8 sectors per track (320K) - -DEV_FORMAT: - ld a,.IFORM - ret - - -;----------------------------------------------------------------------------- -; -; Execute direct command on a device -; -;Input: A = Device number, 1 to 7 -; B = Logical unit number, 1 to 7 (if applicable) -; HL = Address of input buffer -; DE = Address of output buffer, 0 if not necessary -;Output: Output buffer appropriately filled (if applicable) -; A = Error code: -; 0: Ok -; 1: Invalid device number or logical unit number, -; or device not ready -; 2: Invalid or unknown command -; 3: Insufficient output buffer space -; 4-15: Reserved -; 16-255: Device specific error codes -; -; The first two bytes of the input and output buffers must contain the size -; of the buffer, not incuding the size bytes themselves. -; For example, if 16 bytes are needed for a buffer, then 18 bytes must -; be allocated, and the first two bytes of the buffer must be 16, 0. - -DEV_CMD: - ld a,2 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; Padding up to the required driver size - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end \ No newline at end of file diff --git a/releases/alpha 0/DRIVERS.COM b/releases/alpha 0/DRIVERS.COM deleted file mode 100644 index 24549fb3..00000000 Binary files a/releases/alpha 0/DRIVERS.COM and /dev/null differ diff --git a/releases/alpha 0/DRIVERS.TXT b/releases/alpha 0/DRIVERS.TXT deleted file mode 100644 index dadd3921..00000000 --- a/releases/alpha 0/DRIVERS.TXT +++ /dev/null @@ -1,771 +0,0 @@ -MSX-DOS 2.50 alpha 1 Driver Development Guide - - -This document is a guide for developers that want to create a disk driver for a massive storage controller hardware with MSX-DOS 2.50 embedded in the cartridge. - -NOTE: This information is provisional. MSX-DOS 2.50 is still under development. - - - 1. Introduction - -The MSX-DOS kernel code in ROM consists of manily two parts: - -- The kernel itself. It contains the hardware-independent code, such as the code for all the function calls or the FAT filesystem management code. Most of the code in the ROM accounts for this part. - -- The disk driver. This is the code that physically accesses the massive storage devices, mainly to read and write disk sectors, as requested by the kernel when necessary. It consists of a series of routines with standarized input and output parameters. - -In the past (when the MSX computers were sold at the stores), the only way to obtain a MSX-DOS kernel was having it already embedded in the disk controller (always floppy disk controllers at that time) when buying one such controller or when buying a MSX computer with disk drive included; or later, to buy a MSX-DOS 2 standalone cartridge with no massive storage controller associated. The kernel code, and the information about how to develop a disk driver was made available only to floppy disk controller manufacturers; this made sense since normal users were not expected to develop their own massive storage controlling hardware. - -Time passed and the manufacturing of MSX computers and MSX compatible hardware stopped. However a significant number of people kept using their MSX computers, and some of them even developed their own massive storage controller hardware, mostly to provide MSX computers with the ability to use hard disks. These controllers needed to have the MSX-DOS kernel to work, as it happened with the old floppy disk controllers. However since there was no information about how to develop the disk driver part, nor there was information about how to embed this driver in the whole kernel ROM code, developers were forced to resort to reverse engineer the kernel ROM code to guess how to do things, and then to appropriately patch the kernel ROM code. - -This has changed in MSX-DOS 2.50. Now there is explicit support for developing disk drivers for massive storage controller hardware, this support is implemented in two ways: - -a) The routines that the driver must have, their entry point addresses, their input and output parameters, and the way they must behave, are explicitly defined and documented. - -b) The procedure to combine the MSX-DOS kernel code with the driver code, in order to build a ROM file suitable for embedding withing massive storage controllers, is specified with detail. Moreover, there is an utility, MKDOSROM, that does this work. The source code of MKDOSROM is available as well. (The executable for MKDOSROM is available only for Windows at the time alpha 1 is published). - -MSX-DOS 2.50 is provided in two files: - -- DOS250BA.DAT, the kernel base file. This code won't work by itself, it needs to be combined with a disk driver, either manually (how to do this is detailed below) or by using the MKDOSROM utility. - -- DOS250.ROM, a complete kernel file with a dummy driver appended. This file can be burned in a ROM cartridge with no associated massive storage controller, so that the new features of MSX-DOS 2.50 other than the disk driver development support can be used with other MSX-DOS 1 or MSX-DOS 2.20/2.3x controllers. - -Two versions of DOS250.ROM are provided, one for hardware supporting the ASCII8 mapper and other for hardware supporting the ASCII16 mapper. If a different mapping is required, the file can be patched manually or by using the MKDOSROM utility. The DOS250BA.DAT file uses the ASCII16 mapper; if a different mapper is required, the appropriate mapping code must be combined as well when combining the file with the driver code. - - - 2. Architecture of the MSX-DOS kernel - -This section explains the overall organization of the past and present versions of MSX-DOS. Only the information needed in order to develop disk drivers is given. - -MSX-DOS version 1 kernel consisted on a single 16K ROM that was visible on Z80 page 1, and contained the disk driver code following the kernel code itself. See Figure 1. - - -4000h +---------------------+ - | | - | | - | | - | Kernel code | - | | - | | - | | -7405h +---------------------+ - | | - | Disk driver | - | | -7FFFh +---------------------+ - - Figure 1 - MSX-DOS 1 kernel - - -MSX-DOS versions 2.20 and 2.3x consist of 64K of code and data, divided in four 16K banks. Only one bank is visible at the same time, always at Z80 page 1. The first and the last bank contained the disk driver; in the 2.3x kernel, the last bank is the old MSX-DOS 1 kernel code, it is left switched when booting in DOS 1 compatible mode. See Figure 2. - - - Bank 0 Bank 1 Bank 2 Bank 3 -4000h +---------------------+---------------------+---------------------+---------------------+ - | Page 0 code | Page 0 code | Page 0 code | | -40FFh +---------------------+---------------------+---------------------+ | - | 0 (bank ID) | 1 (bank ID) | 2 (bank ID) | | -4100h +---------------------+---------------------+---------------------+ | - | | | | | - | Bank 0 | Bank 1 | Bank 2 | Bank 3 | - | kernel code | kernel code | kernel code | kernel code | - | | | | (MSX-DOS 1 kernel) | - | | | | | -7405h +---------------------+ | |---------------------+ - | | | | | - | Disk driver | | | Disk driver | - | | | | | -7FD0h +---------------------+---------------------+---------------------+---------------------+ - | Bank switching code | Bank switching code | Bank switching code | Bank switching code | -7FFFh +---------------------+---------------------+---------------------+---------------------+ - - Figure 2 - MSX-DOS 2.3x kernel - - -There are three parts that are common to all banks (bank 3 contains the bank switching code only): - -- The page 0 code is 255 bytes long and contains an entry point for the timer interrupt routine, a routine for calling code on another bank, and other useful utility code. - -- The bank ID is just one byte with the bank number, it is needed for doing inter-bank calls. - -- The bank switching code is needed for changing the visible bank. The exact code placed here depends on the ROM mapper type used. - -When booting in DOS 2 mode, bank 0 is permanently switched, and other banks are only temporarily switched when bank 0 code needs to call a routine or access data on one of these banks. When booting in DOS 1 mode, bank 3 is switched at boot time, and it remains switched forever. - - -MSX-DOS 2.50 kernel has the same architecture as version 2.3x, with the following changes: - -- One extra bank is added for additional kernel code (bank number 4), thus making the kernel code 80K in size. - -- One extra bank consisting on the disk driver is appended at the end of the kernel base file (which has banks 0 to 4 only), this bank has number 5. If needed, extra banks can be appended (bank 6 onwards), in case that the disk driver needs more than 16K for code or data. - -- The old disk driver code on banks 0 and 3 is replaced by code that redirects the disk driver calls to the driver bank. - -- The page 0 and bank ID sections are added to the MSX-DOS 1 kernel as well, since it now does calls to the driver bank. - -See Figure 3. - - - Banks 0-4 Bank 5 Banks 6-... (optional) -4000h +---------------------+---------------------+---------------------+---... - | Page 0 code | Page 0 code | Page 0 code | - +---------------------+---------------------+---------------------+---... -40FFh | Bank ID | 5 (bank ID) | Bank ID | -4100h +---------------------+---------------------+---------------------+---... - | | | | - | Bank | | Additional | - | kernel code | Driver code | driver code | - | | | | - | | | | - | | | | -7BD0h +---------------------+ | | - | Available space | | | - | (on banks 0 and 3) | | | -7FD0h +---------------------+---------------------+---------------------+---... - | Bank switching code | Bank switching code | Bank switching code | -7FFFh +---------------------+---------------------+---------------------+---... - - Figure 3 - MSX-DOS 2.50 kernel (kernel base file has banks 0 to 4 only) - - -There is a 1K unused space at banks 0 and 3 (7BD0h to 7FCFh). This space can be used to put any code or data that is required by the driver to be here. In particular, there are three cases in which it is necessary to patch this area: - -- When a format choice string other than a null string (for devices that can't be formatted) or the "Single side / Double side" string (in case of driving a legacy MSX floppy disk driver) is to be returned by the CHOICE or DEV_FORMAT routines. These two strings are already provided by the kernel, other strings must be explicitly placed in this available area. - -- When other data that is to be readed by user software by using RDSLT is needed (for example, an UNAPI implementation identifier). - -- When a hook other than the timer interrupt hook or the extended BIOS hook is to be patched. In this case, code that performs an inter-bank call to the driver code should be placed in this area, and the hook should be set to do an inter-slot call to this code in the kernel slot. - -Note that whatever is placed in this area, it must be identical in both banks 0 and 3, so that everything will work correctly in both DOS 1 and DOS 2 modes. - - - 3. How to create a kernel with embedded driver - -The procedure for creating a ROM file that contains the MSX-DOS 2.50 kernel code and a disk driver consists basically on appending the driver code the the kernel base file, and then patching the resulting file with the appropriate bank switching code. Here are the detailed steps (they assume that the first file position is 0): - -a) Start with the kernel base file (DOS250BA.DAT). - -b) Append the page 0 code at the end of the file. This code can be simply copied from the first 255 bytes of the kernel base file itself. - -c) Append one byte with value 5 at the end of the resulting file (this is the bank ID). - -d) Develop the driver code by appending the routines and following the rules explained in the next section. Append the result (which must be exatcly 16080 bytes long, otherwise padding is required) at the end of the file obtained in c). - -e) Append the bank switching code at the end of the resulting file. If a file suitable for hardware supporting the ASCII16 mapper is desired, then this code can be simply copied from the last 48 bytes of the kernel base file itself. Otherwise, custom mapping code must be provided. - -f) If the driver code does not fit in one single bank, repeat steps b)-e) to append extra banks, increasing the bank ID for each bank as appropriate. - -h) If necessary, patch the resulting file to add a formatting choice string or other data that must be directly visible on the DOS kernel slot. Put the information twice, at positions 3BD0h and FBD0h in the file. - -i) If the mapper type of the target hardware is not ASCII16, patch the bank switching code of the kernel banks (the last 48 bytes of the first five 16K block of the resulting file) with custom bank switching code. - -j) If the mapper type of the target hardware is not ASCII16, read the two byte value at position 2 of the resulting file. Then substract 16378 bytes from the obtained value. In the file position given from the previous operation, put the same custom bank switching code used in steps e) and i). - -The MKDOSROM utility performs all these steps for you. - -The custom mapping code must follow these rules: - -- At most 48 bytes long. -- Must switch in page 1 of the ROM slot the 16K bank whose number is passed in register A. First bank has number zero. -- Can corrupt only register pair AF. -- Must run at any address. - -The next sections explain how to develop the driver code. - - - 4. Drive-based drivers vs device-based drivers - -When developing a driver for embedding with the MSX-DOS 2.50 kernel, you have two choices: develop a drive-based driver or develop a device-based driver. - -- Drive-based drivers mimic the behavior of the old-school drivers embedded within the kernel code of older versions of MSX-DOS in ROM. In these drivers, the driver itself decides how many drive letters are allocated for itself at boot time, as well as how these drives are mapped to physical devices and disk partitions. The user can gain control about drive-to-device and drive-to-partition only through the use of external utilities supplied by the driver developer. - -- Device-based drivers provide direct access to the drived devices, and it is MSX-DOS (on behalf of the user) who decides how to map drives to devices and to disk partitions. Two drive letters are always initially assigned to these drivers at boot time. - -Device-based drivers benefit from the following new features of MSX-DOS: - -- OS handled assignment of drive letters to devices and disk partitions. The driver must simply provide access to the device as a whole, it does not need to know which drive is assigned to which device nor worry about disk partitions. - -- Built-in FDISK utility for creating partitions on block devices. The driver developer does not need to build its own partitioning utility. (Not implemented in alpha 1) - -- The driver may optionally implement support for direct filesystem management, that is, it is the driver itself who manages creating, opening, reading, writing and deleting files and directories for a given device. This is useful for non-block devices (such as CD-ROM readers) and for block devices with no FAT12/16 filesystems (such as FAT32). (Not implemented in alpha 1) - -- Support for hot-plug buses such as USB. MSX-DOS will detect when a device is disconnected or reconnected and react appropriately. (Not implemented in alpha 1) - -Drive-based drivers are appropriate when only driving very simple devices which do not support partitionning (such as floppy disk drives), and for quickly converting an existing driver which is embedded with an older version of the MSX-DOS kernel. But in general, it is advisable to develop a device-based driver instead. - - - 5. Routines available at kernel page 0 - -The kernel page 0 code is needed by the kernel itself for proper operation, however it also provides some useful routines for disk driver code. This section explains these routines. - - - * GSLOT1 (402Dh) - -Obtains the slot currently switched on page 1 (that is, the slot of current driver code). - -Input: - -Output: A = Slot currently switched on page 1 -Corrupts: F - -Note: This routine can't be called directly. It must be called via an inter-bank call to bank 0, in this way: - -XOR A -LD IX,GSLOT1 -CALL CALBNK - - - * RDBANK (403Ch) - -This routine reads a byte from another bank. It must be called via an inter-bank call to the bank to be read, passing the address to be read in HL: - -LD A,bank -LD HL,address (must be a page 1 address) -LD IX,RDBANK -CALL CALBNK - -It returns the readed byte in A and preserves all other registers except F. - - - * CALBAS (403Fh) - -This routine temporarily switches bank 0 (in DOS 2 mode) or bank 3 (in DOS 1 mode), then calls the CALBAS routine in MSX BIOS (0159h), then restores the driver bank and returns. Input and output parameters are the same as the original CALBAS routine in BIOS. - -If the driver implements BASIC extended statements ("CALLs") or BASIC extended devices, it must use this entry instead of the original MSX BIOS routine, in order to make use of the routines that the MSX BASIC interpreter provides for managing the command parameters. This is because in case of using the original routine, if a BASIC error is thrown while parsing parameters the driver bank would remain switched instead of the kernel bank, and the system would crash. - - - * CALBNK (4042h) - -Calls a routine in another bank. This is useful if the driver spawns across two or more banks, and is needed for using the GSLOT1, GWORK and RDBANK routines. - -Input: A = Bank number - IX = Routine address (must be a page 1 address) - AF' = Input parameter for the called routine - (will be passed as AF) - BC, DE, HL, IY = Input parameters for the called routine -Output: AF, BC, DE, HL, IX, IY = Output parameters from the called routine - - - * GWORK (4045h) - -Gets the address of the SLTWRK entry for the passed slot, or for the current slot in page 1. - -Input: A = Slot number - (0, for the current slot in page 1) -Output: A = Current slot switched on page 1 (if 0 at input) - Unchanged (if not 0 at input) - IX = Address of work area in page 3 for the specified slot - (0, if no page 3 space is allocated for the specified slot) -Corrupts: F - -Please see the description of DRV_INIT routine for an explanationa about how to use this routine and the SLTWRK area. - -Note: This routine can't be called directly. It must be called via an inter-bank call to bank 0, in this way: - -LD A,slot -EX AF,AF' -XOR A -LD IX,GWORK -CALL CALBNK - - - * CALDRV (4048h) - -Calls a routine in the driver bank. This routine is the same as CALBNK, except that the routine address is passed in address BK4_ADD (#F84C) instead of IX, and the bank number is always 5. This is useful when used in combination with CALSLT to call a driver routine from outside the driver itself. - -Note that register IX can't be used as input parameter, it is corrupted before reaching the invoked code (actually, CBNKHL simply copies HL' to IX and the jumps to CALBNK). - -Input: (BK4_ADD) = Routine address (must be a page 1 address) - AF, BC, DE, HL, IY = Input parameters for the called routine -Output: AF, BC, DE, HL, IX, IY = Output parameters from the called routine - - - * CHGBNK (7FD0h) - -This is not strictly a page 0 routine, but is provided by kernel and available on all banks as well. It will simply make the specified bank visible on Z80 page 1. Usually, driver code will not need to use this routine, but will use CALBNK instead. - -Input: A = Bank number -Output: - -Corrupts: AF only - - - 6. Routines and data for the driver - -The driver consists of a mandatory jump table at the beginning, followed by the code that implements the required routines. The driver part must be exactly 16080 bytes long, that is, the 16K of Z80 page 1 minus the space for the kernel page 0 code, the bank ID and the bank switching code; it will be visible at addresses 4100h to 7FCFh. If the driver spawns across two banks or more, this applies to each bank. - -Below is the list of the required routines and data, including their entry addresses and their input and output parameters. Unless otherwise stated, these routines work the same way in both DOS 1 and DOS 2 mode, and the driver does not need to worry about the actual mode in which the MSX is working. - - - 6.1. Common routines and data - -The following set of routines and data must be present on all drivers, regardless of its type (drive-based or device-based). - - - * DRV_SIGN (4100h) - -This is the valid driver signature, it is used by the kernel code at boot time to check that the driver bank effectively contains a valid driver. It consists of the verbatim string "MSXDOS_DRIVER", zero-terminated, and uppercased. - - - * DRV_FLAGS (410Eh) - -Provides information about the driver capabilities: - -bit 0: 0 = drive-base driver - 1 = device-based driver -bit 1: 0 = the driver does NOT support device hot-plug - 1 = the driver supports device hot-plug (not supported in alpha 1) -bit 2-7: Reserved, must be zero - -Device hot-plug menas that it is possible to add and remove devices to/from the bus once the system has booted, without having to turn off the computer. An example of bus supporting device hot-plug is the USB bus. - -Note that device hot-plug is available for device-based drivers only. Bit 1 is ignored for drive-base drivers. - - - * 410Fh - -Reserved, must be zero. - - - * DRV_NAME (4110h) - -This is a string containing the driver name. It must consist of 32 printable ASCII characters (ASCII codes 32 to 126). The string must be left justified and padded at the right with spaces. - - - * DRV_TIMI (4130h) - -This is the entry point for the timer interrupt routine of the driver, it will be called 50 or 60 times per second depending on the VDP frequency selected. If the driver does not need to handle the timer interrupt, it should fill this entry with RETs. - -Note that this entry will only called if DRV_INIT returns Cy=1 on its first execution. See the description of DRV_INIT for more details. - - - * DRV_VERSION (4133h) - -This routine returns the driver version. Three version numbers must be returned, one byte each: main version number, secondary version number, and revision number. - -Input: - -Output: - A = Main version number - B = Secondary version number - C = Revision number - - - * DRV_INIT (4136h) - -This is the driver initialization routine. It will be called by the kernel twice: - -1) First execution, for information gathering. - -Input: - A = 0 - B = Number of available drives - HL = Maximum size of allocatable work area in page 3 -Output: - A = Number of required drives (for drive-based drivers only; device-based drivers have always two drives assigned at boot time) - HL = Size of required work area in page 3 - Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise - -2) Second execution, for work area and hardware initialization. - -Input: - A = 1 - B = Number of drives actually allocated for this controller - -Starting at the second execution of this routine, the GWORK routine can be used at any time to obtain the address of the space reserved for the current slot at SLTWRK. The driver should act as follows regarding the page 3 work area: - -- If 8 bytes or less are required, this routine should return HL=0 on its first execution, and the 8 byte space reserved by the system for this slot at SLTWRK should be used as work area: - -XOR A -EX AF,AF' -XOR A -LD IX,GWORK -CALL CALBNK -;Use the 8 byte space pointed by IX as work area - -- If more than 8 bytes are required, this routine should return the required space in HL, and should obtain the pointer to the allocated space from the first two bytes of the space reserved by the system for this slot at SLTWRK: - -XOR A -EX AF,AF' -XOR A -LD IX,GWORK -CALL CALBNK -LD L,(IX) -LD H,(IX+1) -;Use the space pointed by HL as work area - -Plase note also the following: - -- If the first execution requests more page 3 work area than available, the second execution will not be done, no drives will be allocated and DRV_TIMI will not be hooked to the timer interrupt; in other words, MSX-DOS will ignore the involved controller. The size of the work area required should always be within the available limits. - -- For drive-based drivers, if the first execution requests more drives than available, as many drives as possible will be allocated, and the initialization procedure will continue the normal way. This applies to device-based drivers too, except that MSX-DOS will always try to allocate two drives for these drivers. - -- Unlike previous versions of MSX-DOS, the timer interrupt routine will be executed (if requested) even if no drives are requested by the driver code. - - - * DRV_BASSTAT (4139h) - -This is the entry for the BASIC extended statements ("CALLs") handler. It works the same way as the standard handlers (see MSX2 Technical Handbook, chapter 2, for details), except that if the handled statements have parameters, the MSX BIOS routine CALBAS can't be used to invoke the MSX BASIC interpreter helper routines; instead, the CALBAS entry in kernel page 0 must be used. - -If the driver does not handle BASIC extended statements, it must simply set the carry flag and return. - - - * DRV_BASDEV (413Ch) - -This is the entry for the BASIC extended devices handler. It works the same way as the standard handlers (see MSX2 Technical Handbook, chapter 2, for details), but see the note on DRV_BASSTAT about CALBAS. - -If the driver does not handle BASIC extended devices, it must simply set the carry flag and return. - - - * DRV_EXTBIO (413Fh) - -This is the extended BIOS handler. It works the same way as the standard handlers, except that it must return a value in D' (D in the alternative registers set) that tells the kernel what to do after the driver handler has finished: - -D'=0: Return immediately. -D'=1: Execute the kernel and/or the system extended BIOS handler. - -The driver extended BIOS handler is always entered with D'=1. Therefore, if the driver does not handle extended BIOS at all, it can simply fill this entry point with RETs. - - - * DRV_DIRECT0 (4142h) - * DRV_DIRECT1 (4145h) - * DRV_DIRECT2 (4148h) - * DRV_DIRECT3 (414Bh) - * DRV_DIRECT4 (413Eh) - -These are the entries for direct calls to the driver. Calls to any of the five entry points available at addresses 7450h to 745Ch in the kernel ROM (bank 0 or bank 3) will be mapped to a call to the corresponding DRV_DIRECT entry point. This is useful when the driver wants to provide extra functionality for configuration, returning information, or other purposes. When these routines are entered, paging state will be the same as when the bank 0/3 entry was invoked, except of course that the driver bank will be switched on page 1 instead of the kernel bank. All registers except IX and AF' are passed unmodified from the caller. - -If the driver does not implement direct call code, it can simply fill these entry points with RETs. - - - * 4152h to 415Fh - -Reserved for future expansion, must be zero. - - - 6.1. Routines and data for drive-based drivers - -The following set of routines must be present on drive-based drivers. - - - * DRV_DSKIO (4160h) - -Reads or writes disk sectors from a massive storage device. - -Input: A = Drive number, starting at 0 - Cy = 0 for reading sectors, 1 for writing sectors - B = Number of sectors to read/write - DE = First sector number to read/write - HL = source/destination address for the transfer -Output: Cy = 0 on success, 1 on error - A = Error code (on error only): - 0 Write protected - 2 Not ready - 4 Data (CRC) error - 6 Seek error - 8 Record not found - 10 Write fault - 12 Other errors - B = Number of sectors actually read (in case of error only) - -Note that unlike its counterpart in the old-style MSX-DOS 1/2.3x drivers, this routine will never receive a request to transfer data from/to page 1. If the kernel code requires data to be transferred to page 1, it will split the transfer in several 1 sector transfers and use a temporary buffer in page 3; the driver code does not need to worry about this and can do always direct transfers to memory. - - - * DRV_DSKCHG (4163h) - -Returns information about the disk change status for the disk. - -Input: A = Drive number, starting at 0 - B = C = Media descriptor - HL = Base address for DPB -1 -Output: Cy = 0 on success, 1 on error - A = Error code (on error only) - Same codes as DRV_DSKIO - B = Disk status (on success only) - 1 Disk not changed - 0 Unknown - -1 Disk changed - -If the disk status is "Changed" or "Unknown", the routine must generate a DPB for the disk and copy it to the address passed in HL plus one. See DRV_GETDPB for the format of the DPB. - - - * DRV_GETDPB (4166h) - -Gets a DPB (Drive Parameters Block) for the specified disk. - -Input: A = Drive number, starting at 0 - B = C = Media descriptor - HL = Base address for DPB -1 -Output: - - -The format of the 18 byte DPB is as follows: - -+00: Media type (F0..FF) -+01: Sector size (2 bytes), must be a power of two -+03: Directory mask, (sector size /32)-1 -+04: Directory shift, Number of one bits in the directory mask -+05: Cluster mask, (sectors per cluster)-1 -+06: Cluster shift, (number of one bits in cluster mask)+1 -+07: Sector number of first FAT -+08: Number of FATs -+0A: Number of directory entries (maximum 254) -+0B: First data sector number (2 bytes) -+0D: Maximum cluster number (number of clusters +1) (2 bytes) -+0F: Total number of sectors -+10: First sector number of root directory - -The DPB must be copied to the address passed in HL plus one. - - - * DRV_CHOICE (4169h) - -Returns a format choice string for a disk. - -Input: - -Output: HL = Address of the choice string in the kernel slot - -This routine is called by the kernel code when a FORMAT command is executed, in order to show the formatting options to the user (in MSX-DOS 2, it is also called by the CHOICE function call). There are three cases that are supported without any modification needed in the kernel base code: - -- If the disk supports only one kind of formatting (that is, there is actually no choice), it must return HL = 0. - -- If the disk does not support formatting (the most common case), it must return HL = 741Fh. This is the address of a null string available in the kernel banks 0 and 3. - -- If the device is a legacy MSX floppy disk drive that handles single sided and double sided disks, it must return HL = 7420h. This is the address of a "Single sided / Double sided" string available in the kernel banks 0 and 3. - -If any other string is to be returned, then the kernel file must be patched with the required string. There is 1K of available space at address 3BD0h of both bank 0 and bank 3 (this will be seen as 7BD0h, since kernel is accessed at page 1) for this purpose. Both bank 0 and bank 3 must contain exactly the same information at the same address in case that patching is done. - - - * DRV_FORMAT (416Ch) - -Formats a disk and initializes its boot sector, FAT and root directory. - -Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). - D = Drive number, starting at 0 - HL = Address of work area in memory - DE = Size of work area -Output: Cy = 0 on success, 1 on error - A = Error code (on error only): - 0 Write protected - 2 Not ready - 4 Data (CRC) error - 6 Seek error - 8 Record not found - 10 Write fault - 12 Bad parameter - 14 Insufficient memory - 16 Other errors - -The "work area" is a space provided by the caller that can be freely used by the formatting routine if necessary. - - - * DRV_MTOFF (416Fh) - -Stops the motor of all the managed drives. This routine makes sense for floppy disk drives only. - -Input: - -Output: - - - - 6.2. Routines and data for device-based drivers - -The following set of routines must be present on device-based drivers. - - - * DEV_RW (4160h) - -Read or write logical sectors from/to a logical unit. - -Input: Cy=0 to read sectors - 1 to write sectors - A = Device number, 1 to 7 - B = Number of sectors to read or write - C = Logical unit number, 1 to 7 - HL = Source or destination non-page 1 memory address for the transfer - DE = Non-page 1 memory address where the 4 byte sector number is stored -Output: A = Error code: - 0: Ok - .IDEVL: Invalid device or logical unit number - .NRDY: Not ready - .DISK: General unknown disk error - .DATA: CRC error when reading - .RNF: Sector not found - .UFORM: Unformatted disk - .WPROT: Write protected media, or read-only logical unit - .WRERR: Write error - .NCOMP: Incompatible disk - .SEEK: Seek error - B = Number of sectors actually read (in case of error only) - -This routine allows reading and writing physical sectors from/to a device. Note that it refers to absolute device sectors, not partition sectors. The driver does not need to know anywthing about disk partitionning. - -The available sector numbers must range from zero to the number of available sectors (as reported by LUN_INFO) minus one. If LUN_INFO reports zero available sectors, then the range of available sectors is undefined unless the driver developer explicitly documents it. - -This routine must work for all block devices. If a non-block device supports reading and/or writing sectors, this routine may optionally work with that device as well. - -The error codes are the same used by MSX-DOS, in the category "Disk errors". See the MSX-DOS 2 Program Interface Specification for details. - - - * DEV_INFO (4163h) - -Returns information about a device. - -Input: A = Device index, 1 to 7 - B = Information to return: - 0: Basic information - 1: Manufacturer name string - 2: Device name string - 3: Serial number string - HL = Pointer to a buffer in non-page 1 RAM -Output: A = Error code: - 0: Ok - 1: Information not available, or invalid information index - -A device-based driver may handle up to 7 devices, each one havin from 1 to 7 logical units. For example, a multimedia card reader with several slots could expose each slot as a sepparate logical unit. - -When basic information is requested, the buffer supplied in HL is filled with the following information: - -+0 (1): Numer of logical units, from 1 to 8. - 1 if the device has no logical units (which is functionally equivalent to having only one). -+1 (1): Removable device/logical unit flags: - bit 0: The device supports hot-plug - (ignored if hot-plug bit in DRV_FLAGS is zero) - bit 1: Logical unit 1 is removable - ... - bit 7: Logical unit 7 is removable - -The hot plug support bit must be set to one if it is possible to remove the device from the bus without turning off the computer (for example an USB device). (Not supported in alpha 1) - -The strings returned must be printable ASCII string (ASCII codes 32 to 126), left justified and padded with spaces. All the strings are optional, if a given string is not available, an error must be returned. - -If a string is provided by the device in binary format, the driver should return it as an hexadecimal, upper-cased string, preceded by the prefix "0x". - -The maximum length for a string is 64 characters. If the string is actually longer, the leftmost 64 characters must be provided. - -In the case of the serial number string, the same general rules for the strings apply, except that it must be provided right-justified, and if it is too long, the rightmost characters must be provided, not the leftmost. - -The driver must never provide the same combination of manufacturer name, device name and serial number for two different devices. Hardcoded serial numbers should never be returned; if the driver is not able to obtain a serial number from the device itself, it should return no serial number at all. - - - * DEV_STATUS (4166h) - -Obtain the availability and change status for a device or logical unit. - -Input: A = Device index, 1 to 7 - B = Logical unit number, 1 to 7 - 0 to return the status of the device itself -Output: A = Status for the specified logical unit, or for the whole device if 0 was specified: - 0: The device or logical unit is not available, or the device or logical unit number supplied is invalid. - 1: The device or logical unit is available and has not changed since the last status request. - 2: The device or logical unit is available and has changed since the last status request - (for devices, the device has been unplugged and a different device has been plugged which has been assigned the same device index; - for logical units, the media has been changed). - 3: The device or logical unit is available, but it is not possible to determine whether it has been changed or not since the last status request. - -Devices not supporting hot-plugging must always return status value 1. Non removable logical units may return values 0 and 1. - -In case of hot-plug devices, this routine may return 2 if a device is unplugged and then the same device is plugged again. MSX-DOS will detect by itself whether the device is the same or not, by using the manufacturer, device and serial number strings. - - - * LUN_INFO (4169h) - -Obtain information for a logical unit. - -Input: A = Device index, 1 to 7 - B = Logical unit number, 1 to 7 - HL = Pointer to buffer in non-page 1 RAM -Output: A = 0: Ok, buffer filled with information - 1: Error, device or logical unit not available, or invalid device index or logical unit number supplied - -This routine returns information about the given logical unit for a device. Note that all devices have at least one logical unit. - -The information returned is as follows: - -+0 (1): Medium type: - 0: Block device - 1: CD or DVD reader or recorder - 2-254: Unused (reserved for future use) - 255: Other type -+1 (2): Sector size, 0 if this information does not apply or is not available -+3 (4): Total number of available sectors, 0 if this information does not apply or is not available -+7 (1): Flags: - bit 0: 1 if the medium is removable - bit 1: 1 if the medium is read only - bit 2: 1 if the logical unit is a floppy disk drive -+8 (2): Number of cylinders -+10 (1): Number of heads -+11 (1): Number of sectors per track - -"Block devices" are all devices that can be read and written via access to logical sectors. This includes floppy disk, hard disks, pendrives, multimedia cards, etc. Block devices must be readable and optionally writable via the DEV_RW routine. - -Note that MSX-DOS will refuse to work with a device that is reported as a non-block device or having a sector size different from 512 bytes, unless the driver supports direct filesystem access for that device (not supported in alpha 1). - -The information about cylinders, heads and sectors per tracks apply only for hard disks. For other device types, or when this information is not available for whatever reason, these fields should be returned with value zero. This information is used by FDISK in order to properly align partitions on the disk. - -The "read only" flags should be set only for devices that are only readable by design (for example a CD-ROM). A device that can be dinamically write protected and write enabled should not be reported as a read-only device. - -MSX-DOS will allow formatting a device via the MSX-DOS "FORMAT" command or the MSX-BASIC "CALL FORMAT" command only if the floppy disk drive flag is set. - - - * DEV_FORMAT (416Ch) - -(This routine is not used by MSX-DOS in alpha 1) - -Perform physical format on a logical unit. - -Input: A = Device index, 1 to 7 - B = Logical unit number, 1 to 7 - C = Format choice, 0 to return choice string - -Output: - When C=0 at input: - A = 0: Ok, address of choice string returned - .IFORM: Invalid device or logical unit number, or device not formattable - HL = Address of format choice string (in bank 0 or 3), only if A=0 returned. - Zero, if only one choice is available. - - When C<>0 at input: - A = 0: Ok, device formatted - Other: error code, same as DEV_RW plus: - .IPARM: Invalid format choice - .IFORM: Invalid device or logical unit number, or device not formattable - B = Media ID if the device is a floppy disk, zero otherwise - (only if A=0 is returned) - -This routine performs physical format on a device. It is intended mainly for floppy disks but may be used on any other type of device as well. - -When called with C=0, the routine should return either A=.IFORM (if the device is not formattable), A=0 and HL=0 (if the device is formattable but there is only one formatting option), or A=0 and HL pointing to a zero-terminated string with the format options. This string must be embedded in the same address of the kernel banks 0 and 3. - -MSX-DOS provides the built-in string "Single sided / Double sided" at address 7420h. If a different string is needed, then the kernel file must be patched with the appropriate string. See the "Architecture of the MSX-DOS kernel" and "How to create a kernel with embedded driver" sections for details. - -If the media is a floppy disk, the driver must return is type after successful formatting, so that MSX-DOS can appropriately initialize its boot sector, FAT and root directory. The disk type is returned in the form of a media ID byte, with the following possible values: - -F0h: 3.5" Double Sided, 80 tracks per side, 18 sectors per track (1.44MB) -F8h: 3.5" Single sided, 80 tracks per side, 9 sectors per track (360K) -F9h: 3.5" Double sided, 80 tracks per side, 9 sectors per track (720K) -FAh: 5.25" Single sided, 80 tracks per side, 8 sectors per track (320K) -FBh: 3.5" Double sided, 80 tracks per side, 8 sectors per track (640K) -FCh: 5.25" Single sided, 40 tracks per side, 9 sectors per track (180K) -FDh: 5.25" Double sided, 40 tracks per side, 9 sectors per track (360K) -FEh: 5.25" Single sided, 40 tracks per side, 8 sectors per track (160K) -FFh: 5.25" Double sided, 40 tracks per side, 8 sectors per track (320K) - - - * DEV_CMD (416Fh) - -Executes a direct command on a device. - -Input: A = Device number, 1 to 7 - B = Logical unit number, 1 to 7 (if applicable) - HL = Address of the non-page 1 input buffer - DE = Address of non-page 1 output buffer, 0 if not necessary -Output: Output buffer appropriately filled (if applicable) - A = Error code: - 0: Ok - 1: Invalid device number or logical unit number, or device not ready - 2: Invalid or unknown command - 3: Insufficient output buffer space - 4-15: Reserved for future use - 16-255: Device specific error codes - -This routine provides a passthrough mechanism so that the user can execute commands directly on the devices; MSX-DOS does never use this routine. Which commands are available, what does each command, the format and contents of the input and output buffers, and the error codes returned (if errors in the range 16-255 are returned), depend on the specific technology and devices used, and must be documented by the developer of the driver. - -The first two bytes of the input and output buffers must contain the size of the buffer, not incuding the size bytes themselves. For example, if 16 bytes are needed for a buffer, then 18 bytes must be allocated, and the first two bytes of the buffer must be 16, 0. - -If the driver does not support the execution of direct commands in any case, then this routine must simply return A=2 always. diff --git a/releases/alpha 0/DRVINFO.COM b/releases/alpha 0/DRVINFO.COM deleted file mode 100644 index 48397a94..00000000 Binary files a/releases/alpha 0/DRVINFO.COM and /dev/null differ diff --git a/releases/alpha 0/FASTOUT.COM b/releases/alpha 0/FASTOUT.COM deleted file mode 100644 index 35f92333..00000000 Binary files a/releases/alpha 0/FASTOUT.COM and /dev/null differ diff --git a/releases/alpha 0/FUNCTIONS.TXT b/releases/alpha 0/FUNCTIONS.TXT deleted file mode 100644 index c00bf1b7..00000000 --- a/releases/alpha 0/FUNCTIONS.TXT +++ /dev/null @@ -1,408 +0,0 @@ -MSX-DOS 2.50 alpha 1 new function calls and error codes - - -This document describes the changes in function calls and the new function calls introduced in MSX-DOS 2.50 alpha 1, relative to MSX-DOS 2.20 and MSX-DOS 2.31. Also, the new error codes defined are explained. - -NOTE: This information is provisional. MSX-DOS 2.50 is still under development. - - - 1. Changes in existing function calls - -Some of the existing DOS function calls have been modified, mainly to account for the new support for the FAT16 filesystem and 23 bit sector numbers. These changes are non breaking to the extent possible. - - - * STROUT (09h) - -When the fast STROUT mode is enabled, the maximum printable string length is 511 characters; if the string is longer, only the first 511 characters will be printed. The fast STROUT mode is disabled by default, it must be explicitly enabled by using the new FOUT function. - - - * ALLOC (1Bh) - -When the reduced allocation information mode is enabled for a drive, this function will return a false total and/or free cluster count when necessary so that when multiplied by the sectors per cluster amount, the result will give 32MBytes or less when called for that drive. The reduced allocation information mode is disabled by default for all drives, it must be explicitly enabled for each desired drive by using the new RALLOC function. - - - * RDABS (2Fh) and WRABS (30h) - -These functions will work only when the accessed disk contains a FAT12 filesystem. They will throw a "Not a DOS disk" when a disk containing a FAT16 filesystem or an unknown filesystem is accessed. - -Strictly speaking, this is not a change from previous versions, since FAT12 was the only filesystem supported by MSX-DOS 2.31 and previous versions. However, when a disk containing a FAT16 filesystem was read in previous MSX-DOS versions, its boot sector was mistook for a FAT12 boot sector, and the functions succeeded. Now FAT16 disks are explicitly rejected by these functions; this is done on purpose to prevent programs, such as CHKDSK or IMPROVE, that do low-level processing on disks assuming that they have a FAT12 filesystem, to cause data corruption when accidentally ran on these disks. - -New applications should use instead the new functions RDDRV and WRDRV, which accept 32 bit sector numbers and allow acces to any disk regardless of the contained filesystem. - - - * DPARM (31h) - -This function now returns the total number of logical sectors as a 32 bit value at position +24..27 in the returned parameter block. Moreover, when this number is greater than 65535, the 16 bit sector count returned at position +9,10 will be zero. - -Also, position +28 of the returned parameter block contains the filesystem type: - -0: FAT12 -1: FAT16 -2: FAT32 (for direct filesystem access mode) -255: Other (for direct filesystem access mode) - - - * DEFER (64h) - -The parameters passed to the user routine in case of disk error are extended to support 32 bit sector numbers. In MSX-DOS 2.31, part of these parameters were as follows: - - C:b3 - set if sector number is valid - DE = Sector number (if b3 of C is set) - -In MSX-DOS 2.50, these parameters are: - - C:b3 - set if sector number is valid and fits in 16 bits (that is, b4 is set and HL=0) - C:b4 - set if sector number is valid - HL:DE = Sector number (if b4 of C is set) - - - * FORMAT (67h) - -In MSX-DOS 2.31, this function accepts two special choice parameters, FFh and FEh, that do not actually format the disk but generate a MSX-DOS 2.31 boot sector, including the disk parameters, based on the media ID of the disk. This feature is used by the FIXDISK program to convert old MSX-DOS 1 disks into MSX-DOS 2 disks. - -MSX-DOS 2.50 adds three new choice parameters: - - FDh: Assuming that the disk has a FAT12 or FAT16 filesystem with valid disk parameters on the boot sector (otherwise a "Not a DOS disk" will be returned), a standard boot sector will be composed for the disk by (1) setting the manufacturer name as "MSXDOS25", and (2) generating an extended block (byte 29h, plus volume ID, plus volume name, plus "FAT12" or "FAT16" mark). The disk parameters will not be modified. If the disk contains an extended block already, only the manufacturer name will be changed (thus mantaining the existing volume ID). This choice is useful for using the dirty disk flag feature on disks already formatted by another system. - - FCh: It is the same as FDh, but if the disk filesystem is FAT12, a MSX-DOS 2.31 boot sector (with the "VOL_ID" string) will be composed instead of a standard boot sector. If the disk filesystem is FAT16, this choice works the same way as FDh. This choice is useful if the disk is to be used on pre-2.50 MSX-DOS 2 systems. - - FBh: Will do a "quick format" on the disk, by simply clearing the FAT and root directory areas. As with the other two new choices, the disk must have a valid FAT12 or FAT16 boot sector, otherwise a "Not a DOS disk" error will be returned. - -When the disk is actually formatted (choice 1..9), a MSX-DOS 2.31 boot sector will always be generated. - - - * DOSVER (6Fh) - -Now HL returns a pointer to a zero-terminated printable string that describes the kernel version, for example "MSX-DOS 2.50". The string resides in the kernel master slot (slot number is available at 0F348h) and can be readed via standard RDSLT calls. - - - 2. New function calls - -The following functions are new to MSX-DOS 2.50: - - - * Get/set fast STROUT mode - -Parameters: C = 71H (_FOUT) - A = 00H => get fast STROUT mode - 01H => set fast STROUT mode - B = 00H => disable (only if A=01H) - FFH => enable (only if A=01H) -Results: A = Error - B = Current fast STROUT mode - -This function enables or disables the fast STROUT mode. When enabled, STROUT and ZSTROUT functions will work faster, but the maximum printable string length will be 511 characters; if the string is longer, only the first 511 characters will be printed. - - - * Print a zero-terminated string - -Parameters: C = 72H (_ZSTROUT) - DE = Address of string -Results: A = 0 (never returns an error) - -Prints on the screen the string pointed by DE, the string must be terminated with a zero character. This function is affected by the fast STROUT mode. - - - * Read absolute sectors from drive - -Parameters: C = 73H (_RDDRV) - A = Drive number (0=A: etc.) - B = Number of sectors to read - HL:DE = Sector number -Results: A = Error code (0=> no error) - -This function reads sectors directly from the disk. Unlike RDABS, this function is able to read sectors regardless of the filesystem contained in the disk (FAT12, FAT16 or an unknown filesystem), and even when the disk has no filesystem at all. The sectors will be read to the current disk transfer address. Any disk error will be reported by the system in the usual way. - - - * Write absolute sectors to drive - -Parameters: C = 74H (_WRDRV) - A = Drive number (0=A: etc.) - B = Number of sectors to write - HL:DE = Sector number -Results: A = Error code (0=> no error) - -This function writes sectors directly to the disk. Unlike WRABS, this function is able to write sectors regardless of the filesystem contained in the disk (FAT12, FAT16 or an unknown filesystem), and even when the disk has no filesystem at all. The sectors will be written from the current disk transfer address. Any disk error will be reported by the system in the usual way. - - - * Get/set reduced allocation information mode vector - -Parameters: C = 75H (_RALLOC) - A = 00H => get current vector - 01H => set vector - HL = new vector (only if A=01H) -Results: A = 0 (never returns an error) - HL = Current vector - -This function obtains or sets the reduced allocation information mode vector. The vector assigns one bit for each drive; bit 0 of L is for A:, bit 1 of L is for B:, etc. This bit is 1 if the reduced allocation mode is currently enabled (when getting vector) or to be enabled (when setting vector) for the drive, 0 when the mode is disabled or to be disabled. - - - * Get disk space information - -Parameters: C = 76H (_DSPACE) - E = drive number (0 = default, 1 = A:, etc) - A = 00H => get free space - 01H => get total space -Results: A = error code - HL:DE = space in Kilobytes - BC = extra free space in bytes - -This function returns the total or free space for a disk. The space information is always returned in Kilobytes, regardless of the filesystem and the cluster size used by the disk. - -The "extra free space in bytes" result will be different from zero only when the minimum allocation unit of the disk is not a whole number of kilobytes. In case of FAT disks, it will be non zero (specifically, it will be 512) only when the disk uses one sector per cluster and the cluster count is odd. For example, for a disk having one sector per cluster and 15 free clusters, this function will return HL=0, DE=7 and BC=512 when called with A=0 for that disk. - -The space information returned by this function is always real, it is not affected by the reduced allocation information mode. - - - * Mount/unmount a disk, or get mount state for a disk - -Parameters: C = 77H (_MOUNT) - E = physical drive (0=A:, 1=B:, etc) - A = 00H => get mount status - 01H => set mount status - B = 00H => unmount disk (only if A=01H) - FFH => mount disk (only if A=01H) -Results: A = Error code - B = Current mount status, same as input - -This function mounts or unmounts a disk, or gets the current mount state for a disk. When a disk is mounted, MSX-DOS will assume that the disk will never be changed, and therefore will never ask the disk driver for disk change status; thus resulting in an overall increase on disk access speed. This is useful when using removable devices, such as multimedia cards, as the main storage device. - -In order to be mounted, the disk must be in the drive and must be a valid DOS disk; otherwise an error will be thrown and the disk will not be mounted. - -Once a disk is mounted, any disk error that is aborted will automatically unmount the disk. - -Mounting and unmounting operations cause all the buffers for the disk to be flushed and invalidated. Also, cached disk parameters for the disk are deleted so the next access to the disk will re-read them. - -It is possible to mount non-removable devices associated to device-based drivers, however it makes no sense to do that, since MSX-DOS will never ask for disk change status for this kind of devices. - -Mounting feature must be used with care. Changing a mounted disk without first unmounting it may result in disk corruption, both in the original (mounted) disk and in the newly inserted disk. - - - * Get information about a disk driver - -Parameters: C = 78H (_GDRVR) - A = Driver index, or 0 to specify slot and segment - D = Driver slot number (only if A=0) - E = Driver segment number, FFh for drivers in ROM - (only if A=0) - HL = Pointer to 64 byte data buffer -Results: A = Error code - HL = Filled with data about driver - -This function returns information about a disk driver present in the system. - -The disk driver can be specified by index or by slot and segment number pair. To specify the driver by index, set the index number (starting at 1) in register A; the slot and segment number for the driver is returned in the data buffer together with other driver information. This is useful to discover which drivers are present in the system. - -If you know already the slot and segment numbers of the driver you want to gather information about, set these parameters in registers D and E, and set A=0. The slot and segment numbers are returned anyway in the data buffer, as in the case of specifying a driver index. - -An .IDRVR error will be returned if there is no driver associated to the specified index, or if there is no driver with the specified slot and segment pair. There is no way to know in advance how many drivers are present in the system, so to discover all the drivers this function must be invoked several times, starting with driver index 1 and increasing the index number until a .IDRVR error is obtained. - -The information returned in the data buffer is as follows: - -HL+0: Driver slot number -HL+1: Driver segment number, FFh if the driver is embedded within a MSX-DOS kernel ROM (always FFh in alpha 1) -HL+2: Number of drive letters assigned to this driver at boot time -HL+3: First drive letter assigned to this driver at boot time (A:=0, etc), unused if no drives are assigned at boot time -HL+4: Driver flags: - bit 7: 1 => the driver is a MSX-DOS 2.50 driver - 0 => the driver is a legacy driver - (embedded within a MSX-DOS 1/2.20/2.3x kernel ROM) - bits 6-2: Unused, always zero - bit 1: 1 => the driver supports hot-plug devices (not implemented in alpha 1) - 0 => the driver does NOT support hot-plug devices - bit 0: 1 => the driver is a device-based driver - 0 => the driver is a drive-based driver -HL+5: Driver main version number -HL+6: Driver secondary version number -HL+7: Driver revision number -HL+8: Driver name, left justified, padded with spaces (32 bytes) -HL+40..+63: Reserved (currently always zero) - -In the case of legacy drivers, the driver flags byte is always zero, and no information about driver version number or driver name is returned. - - - * Get information about a drive letter - -Parameters: C = 79H (_GDLI) - A = physical drive (0=A:, 1=B:, etc) - HL = Pointer to 64 byte data buffer -Results: A = Error code - HL = Filled with data about the drive - -This function return information about a given drive letter. The information returned in the data buffer is as follows: - -HL+0: Drive status - 0: Unassigned - 1: Assigned to a ROM or RAM driver in block device mode - 2: Assigned to a ROM or RAM driver in direct access mode (not supported in alpha 1) - 3: Assigned to a mounted file (not supported in alpha 1) - 4: Assigned to the MSX-DOS 2 RAM disk (all other fields will be zero then) -HL+1: Driver slot number -HL+2: Driver segment number, FFh if the driver is embedded within a MSX-DOS kernel ROM -HL+3: Relative drive number withing the driver (for drive-based drivers only; FFh if device-based driver) -HL+4: Device index (for device-based drivers only; 0 for drive-based drivers and legacy drivers) -HL+5: Logical unit index (for device-based drivers only; 0 for drive-based drivers and legacy drivers) -HL+5..+8: First device sector number (for block devices in device-based drivers only; always zero for drive-based drivers, legacy drivers, and non-block devices) -HL+9..+22: Filename, zero-terminated (null string if not assigned to a mounted file) -HL+22..+63: Reserved (currently always zero) - -If a drive larger than the maximum drive number supported by the system is specified, an .IDRV error will be returned. Note that if a drive number is specified which is legal in MSX-DOS, but is currently not assigned to any driver, then no error will be returned, but an empty information block will be returned (the drive status byte should be checked). - -The "first device sector number" is the absolute device sector number that is treated as the first logical sector for the drive; usually it is either the starting sector of a disk partition, or the device absolute sector zero, if the device has no partitions. Note that you can't test this value against zero to check whether the drive is assigned to a block device on a device-based driver or not. - -When a file is mounted in the drive, the filename only will be returned in HL+9; no drive or path information for the file will be obtained. - - - * Get information about a disk partition - -Parameters: C = 7AH (_GPART) - A = Driver slot number - B = Driver segment number, FFh for drivers in ROM - D = Device index - E = Logical unit index - H = Primary partition number (1 to 4) - L = Extended partition number (0 for an entry in the primary partition table) -Results: A = Error code - B = Partition type code, 0 if the specified partition does not exist - HLDE = Starting device absolute sector number of the partition - -This function returns information about a disk partition. It only works on device-based drivers; if a non existing driver, a drive-based driver, or a legacy driver is specified in A and B, then an .IDRVR error will be returned. If the specified device and/or logical unit does not exist in the driver, an .IDEVL error will be returned. - -Block devices are usually divided in partitions, each one being an independent logical volume residing in a contiguous block of sectors in the disk. This function allows to find the starting sector of a given partition in the disk, usually in order to map it to a drive letter by using the MAPDRV function, so that the contained filesystem can be accessed by MSX-DOS. - -The partition type code returns information about the filesystem that the partition holds. The code may be one of the following: - -0: None (the partition with the specified number does not exist) -1: FAT12 -4: FAT16, smaller than 32MB (obsolete) -5: Extended (see below) -6: FAT16 - -There are many more partition type codes defined, but they refer to filesystems that can't be handled by MSX-DOS so they are not listed here. - -A disk can have up to four primary partitions, numbered 1 to 4. In order to accommodate more than four partitions, partition number 2 may be of a special type named "Extended". An extended partition is actually a container for more partitions; there is no limit in the number of extra partitions that a partition of type "Extended" can contain. Primary partitions 3 and 4 do not exist when partition 2 is extended. - -In order to enumerate all the partitions existing in a disk, the following procedure should be followed, to take in account the possible presence of extended partitions: - -1. Search partition 1-0 (primary number 1, extended number 0). -2. Search partition 2-0. If it exists and is of type "Extended", search partitions 2-1, 2-2, 2-3, etc, until a partition code 0 is returned. -3. If partition 2-0 does not exits or is not of type "Extended", search partitions 3-0 and 3-4. - -Note that it is possible that a device has no partitions at all. In this case, it is still possible that the disk contains a valid filesystem, mapped to the absolute device sector zero; this is indeed the case of floppy disks and devices with very small capacity. - -When a partition is mapped to a drive letter, the partition first sector will always be examined in order to determine the actual filesystem holded by the partition. MSX-DOS will never rely in the partition type code to determine the filesystem type. - -MSX-DOS needs to read the disk in order to search for partitions. If there is any error when accessing the disk (for example, not ready), an error code will be returned. The standard system error handling routine (or the user error handling routine, if one is defined with _DEFER) will NOT be invoked. - -When the specified partition does not exist in the disk (for example, when a primary partition number larger than 4 is specified, or when an extended partition number is specified for a non-extended primary partition), then B=0 and A=.IPART will be returned. - - - * Call a routine in a disk driver - -Parameters: C = 7BH (_CDRVR) - A = Driver slot number - B = Driver segment number, FFh for drivers in ROM - DE = Routine address - HL = Address of a 8 byte buffer with the input register values for the routine -Results: A = Error code - BC, DE, HL = Results from the routine - IX = Value of AF returned by the routine - -This function allows direct invokation of a routine in a disk driver. Routines for any driver type (legacy, device-based and drive-based) can be invoked with this function, however it is intended primarily for device-based drivers, in order to directly access the device absolute sectors (DEV_RW routine), for example to develop disk partitioning tools. The available routines for disk drivers are enumerated and described in detail in the Driver Development Guide. - -The input value of registers AF, BC, DE and HL for the routine must be provided in a 8 byte buffer pointed by HL. The order of the register values in the buffer is as follows: F, A, C, B, E, D, L, H. The output values of these registers, on the other hand, are returned directly in the registers themselves; except the output value of AF which is returned in IX. - -Some routines accept data from, or write data to, memory buffers supplied by the user. There are two limitations for exchanging data with the driver routines in this way: first, the buffer must be in the primary mapper slot; and second, the buffer may not be partially or totally in page-1. These limitations do not apply for the 8 byte register buffer (remember however that when invoking MSX-DOS function calls via the 0F37Dh hook, no parameters can be passed in page-1). The register buffer is only used before effectively executing the driver routine, therefore there is no problem if it overlaps with any buffer used by the routine to return data. - -An .IDRVR error will be returened by this function call if a non existing driver is supplied in A and B. Use function GDRVR to discover the location of the existing drivers. - - - * Map a drive letter to a driver and device - -Parameters: C = 7CH (_MAPDRV) - A = physical drive (0=A:, 1=B:, etc) - B = Action to perform - 0: Unmap the drive - 1: Map the drive to its default state - 2: Map the drive by using specific mapping data - HL = Address of a 8 byte buffer with mapping data (if B=2) -Results: A = Error code - -This function allows mapping a drive number to a specific combination of device number, logical unit number, and starting absolute device sector number, within a device-based driver. It also allows to revert back the drive mapping to its default state (the state at boot time), and to completely unmap the drive. - -If B=0 at input, the drive will be unmapped. This means that the drive will be unavailable from that moment, and any attempt to access it will result in an "Invalid drive" error. If the drive is already unmapped, nothing will happen and no error will be returned. - -If B=1 at input, the drive will be reverted to its default state. If at boot time the drive was unmapped (not assigned to any driver), or was mapped to a drive on a legacy driver or on a drive-based driver, then the drive will be reverted to the same state. If at boot time the drive was assigned to a device-based driver, then an auto-assign procedure will be performed for this drive, using the same rules as the auto-assign procedure performed at boot time (see "Drive and partition auto-assign procedure for device-based drivers" early in this document). This may result or not on the drive having the same mapping as it had at boot time, depending on the presence of removable devices and hot-plug devices in the associated driver. - -If the auto-assign procedure resulting from invoking this function with B=1 fails (because there are no suitable devices or partitions), the drive will be unmapped, regardless of its previous mapping state. An .IDEVL error will be returned in this case. - -If B=2 at input, the drive will be mapped according to the mapping data provided in the buffer pointer by HL. It is possible to map any system drive to any device-based driver by using this method, even drives that were unmapped or were mapped to a different driver at boot time. The contents of the mapping data buffer must be as follows: - -+0: Driver slot number -+1: Driver segment number, FFh if the driver is embedded within a MSX-DOS kernel ROM (must be always FFh in alpha 1) -+2: Device number -+3: Logical unit number -+4..+7: Starting sector - -An .IDRVR error will be returned if the specified driver does not exists or is not a device-based driver. An .IDEVL error will be returned if the device with the specified device and logical unit numbers does not exists in the driver. In these cases, the previous drive mapping will not be modified. - -A .RAMDX error will be returned if the drive specified is H: and a RAM disk exists. - -It is not possible to assign the same combination of driver, device, logical unit, and starting sector to more than one drive at the same time; this is to prevent data corruption. If the mapping data provided matches the mapping data of other drive, then a "Partition in use" error will be thrown. - -The "starting sector" parameter is the device absolute sector number that will be used as the sector zero for the drive. Usually this will be the starting sector of a disk partition, obtained via a call to the _GPART function. Note however that no checking is done for the presence of an actual (and recognized by MSX-DOS) filesystem starting in the specified sector; if no valid filesystem is found, the _MAPDRV function will succeed, but the next access to the drive will throw a "Not a DOS disk" error. - -Also, it is possible to map a drive to a removable device which has no media inserted. In this case, the _MAPDRV function will succeed, but the next access to the drive will throw a "Disk offline" error. - -It is not possible to map two drives to the same combination of driver, device, logical unit, and start sector; this is to prevent data corruption resulting from dealing with unsynchronized disk buffers. An .IDEVL error will be throw in this case. In order to change the drive letter for a given mapping, the old drive letter must be first unmapped. - -Also, note that it is not possible to explicitly map a drive to a legacy or drive-based driver. - -Before changing the mapping state of a drive, any open file handles relative to that drive will be closed by this function. This is equivalent to invoking the CLOSE function call for each of these file handles, so disk errors may arise if there are dirty buffers for that disk and there are errors when flushing them to the disk. - - - * Enable or disable the Z80 access mode for a legacy driver - -Parameters: C = 7DH (_Z80MODE) - A = Driver slot number - B = 00H => get current Z80 access mode - 01H => set Z80 access mode - D = 00H => disable Z80 access mode (only if A=01H) - FFH => enable Z80 access mode (only if A=01H) -Results: A = Error code - D = Current Z80 access mode for the specified driver, same as input - -This function works on MSX Turbo-R computers only. On MSX1/2/2+ it will always throw an "Invalid disk driver" error. - -This function allows to enable or disable the Z80 access mode for a legacy driver (a driver embedded within a MSX-DOS 1/2.20/2.3x kernel ROM). When the Z80 access mode for a driver is enabled, MSX-DOS will switch to the Z80 CPU prior to accessing any drive associated to the driver. When the Z80 access mode for a driver is disabled, no CPU switching is performed, being therefore possible to access the drives on the driver in R800 mode. - -When the computer boots, the Z80 access mode is enabled for all legacy drivers. This is necessary because some old disk drivers do not work when accessed in R800 mode, and it would not be possible to boot from a disk on one of these drivers. Once the system boot has finished, this function can be used to disable (and later re-enable if necessary) the Z80 access mode for any legacy driver. - -Note that the Z80 access mode is enabled or disabled for a whole driver, affecting all the drives associated to the driver. It is not possible to selectively enable or disable the Z80 access mode for individual drives. - -The Z80 access mode applies to legacy drivers only. MSX-DOS will never change the CPU when accessing drive-based and device-based drivers. - - - 3. New error codes - -New error codes are defined to handle error conditions when managing the new features of MSX-DOS. These errors are the following: - - - Invalid device driver (.IDRVR, 0B6h) - -An operation involving a disk driver has been requested but the specified driver does not exist, or is not of the valid type (for example, the driver is a legacy driver but a device-based driver is required). - - - Invalid device or LUN (.IDEVL, 0B5h) - -An operation involving a device on a device-based driver has been requested but the specified device do not exist in the driver, or the specified logical unit does not exist in the specified device. - - - Invalid partition number (.IPART, 0B4h) - -Information about a disk partition on a device has been requested, but the specified partition does not exist in the device. - - - Partition is already in use (.PUSED, 0B3h) - -An attempt has made to map a drive to a driver, device and starting sector; but there is already another drive which is mapped to the same combination of driver, device, logical unit, and starting sector. diff --git a/releases/alpha 0/MAPDRV.COM b/releases/alpha 0/MAPDRV.COM deleted file mode 100644 index c006b293..00000000 Binary files a/releases/alpha 0/MAPDRV.COM and /dev/null differ diff --git a/releases/alpha 0/MKDOSROM.C b/releases/alpha 0/MKDOSROM.C deleted file mode 100644 index e6d98e32..00000000 --- a/releases/alpha 0/MKDOSROM.C +++ /dev/null @@ -1,411 +0,0 @@ -/* MKDOSROM - Make a MSX-DOS 2.50 kernel ROM - By Konamiman, 7/2009 - - Usage: - mkdosrom [/d:] [/m:] [/e:] - - This program creates a MSXDOS2 kernel ROM from a base file and a driver file, - as per the recipe specified in the driver development guide. It also allows modifying - an existing kernel ROM file, by changing the mapper code and/or adding extra content - in the free 1K areas present in the DOS 1 and DOS 2 main kernel banks. - - - can be: - - A kernel base file, that is, a file containing the code for the five kernel ROM banks and no driver; or - - A complete ROM file consisting of the kernel bank with the driver bank(s) already appended. - - - is the file containing the driver code. It must be a valid driver according - to the driver development guide. The contents of this file is expected to be as follows: - - 1. 256 dummy bytes. - 2. The driver signature (see the driver development guide) - 3. The driver jump table - 4. The driver code itself - - And optionally, if the driver is more than 16K long, for each additional 16K block: - - 5. 256 dummy bytes. - 6. The additional driver code or data. - 7. Dummy space up to 16K. - - The last block does not need to be 16K long. - - Specifying a driver file is mandarory if a base file without driver is specified in , - and prohibited if a complete ROM file is specified. - - - is the file containing the bank switching code. The following is required for this code: - - - When called, switches ing page 1 the ROM bank passed in A. - - Up to 48 bytes long. - - Runs at address 0x7FD0. - - May corrupt AF, must preserve all other registers. - - If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. - - - is the file containing the extra code or data for the resulting ROM file. This extra data - will be placed at DOS 1 and DOS 2 kernel main banks at address 0x3BD0, this means that this code or data - will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel - slot, at address 0x7BD0. - - The maximum size for the extra file is 1K. - -*/ - - -#include -#include -#include - -#define BANK_SIZE 16384 //Size of each ROM bank -#define BASE_BANK_COUNT 5 //Number of kernel banks -#define DRIVER_BANK (BASE_BANK_COUNT) //Index of the first driver bank -#define MAPPER_CODE_SIZE 48 //Size of the bank change code -#define EXTRA_CODE_SIZE 1024 //Size of the extra code for banks 0 and 3 -#define EXTRA_ADDRESS 0x3BD0 //Address of the extra code -#define DRIVER_MIN_SIZE 0x172 //Minimum size of the disk driver -#define PAGE0_SIZE 256 //Size of the common page 0 code -#define DOS2_EXTRA_BANK 0 //Bank for the extra code in DOS 2 mode -#define DOS1_EXTRA_BANK 3 //Bank for the extra code in DOS 2 mode -#define DATABUFFER_SIZE sizeof(dataBuffer) - -#define safeClose(file) {if(file!=NULL) {fclose(file); file=NULL;}} - -void DisplayInfo(); -int GetFileSize(FILE* file); -int IsParam(char* arg, char paramLetteR); -void DoExit(int code); - -FILE* baseFile=NULL; -FILE* newFile=NULL; -FILE* driverFile=NULL; -FILE* mapperFile=NULL; -FILE* extraFile=NULL; - -int main(int argc, char* argv[]) -{ - int hasDriver; - int baseFileSize; - int readCount; - int writeCount; - int signatureLength; - int i; - - char* baseFilename=NULL; - char* newFilename=NULL; - char* driverFilename=NULL; - char* mapperFilename=NULL; - char* extraFilename=NULL; - - char* mapperCode[MAPPER_CODE_SIZE]; - char* extraCode[EXTRA_CODE_SIZE]; - char* dataBuffer[1024]; - - char* driverSignature="MSXDOS_DRIVER"; - signatureLength=strlen(driverSignature); - - - //* Get command line parameters - - printf("\r\n"); - if(argc<4) { - DisplayInfo(); - DoExit(0); - } - - baseFilename=argv[1]; - newFilename=argv[2]; - for(i=3; i=(BASE_BANK_COUNT+1) * BANK_SIZE) { - hasDriver=1; - } else { - printf("*** The base file has not the expected length. Expected either %iK (for base file without driver) or >=%iK (for file with driver).\r\n", - (BASE_BANK_COUNT * BANK_SIZE)/1024, - ((BASE_BANK_COUNT+1) * BANK_SIZE)/1024); - DoExit(1); - } - - - //* Check for the presence or absence of driver file, this depends on the base file size - - if(driverFilename!=NULL && hasDriver) { - printf("*** A driver file has been specified, but the base file appears to have a driver already.\r\n"); - DoExit(1); - } else if(driverFilename==NULL && !hasDriver) { - printf("*** No driver file has been specified, but the base file does not have driver.\r\n"); - DoExit(1); - } - - - //* Read the mapper code file, if specified; - // otherwise get the mapper code from the base file itself - - if(mapperFilename==NULL) { - fseek(baseFile, BANK_SIZE-MAPPER_CODE_SIZE, SEEK_SET); - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, baseFile); - if(readCount!=MAPPER_CODE_SIZE) { - printf("*** Can't read the mapper code from the base file\r\n"); - DoExit(1); - } - fseek(baseFile, 0, SEEK_SET); - } else { - mapperFile=fopen(mapperFilename, "rb"); - if(mapperFile==NULL) { - printf("*** Can't open mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(mapperFile)>MAPPER_CODE_SIZE) { - printf("*** The mapper code file has not the expected size (%i bytes)\r\n", MAPPER_CODE_SIZE); - DoExit(1); - } - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, mapperFile); - if(readCount==0) { - printf("*** Can't read the mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - safeClose(mapperFile); - } - - - //* Read the extra code file, if specified - - if(extraFilename!=NULL) { - extraFile=fopen(extraFilename, "rb"); - if(extraFile==NULL) { - printf("*** Can't open extra code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(extraFile)>EXTRA_CODE_SIZE) { - printf("*** The extra code file is too big, maximum allowed size is %i bytes\r\n", EXTRA_CODE_SIZE); - DoExit(1); - } - readCount=fread(extraCode, 1, EXTRA_CODE_SIZE, extraFile); - if(readCount==0) { - printf("*** Can't read the extra code file: %s", extraFilename); - DoExit(1); - } - safeClose(extraFile); - } - - - //* Open the driver file, if necessary, and check its signature - - if(driverFilename!=NULL) { - driverFile=fopen(driverFilename, "rb"); - if(driverFile==NULL) { - printf("*** Can't open driver file: %s\r\n", driverFilename); - DoExit(1); - } - if(GetFileSize(driverFile) [/d:] [/m:] [/e:]\r\n" - ); -} - -int GetFileSize(FILE* file) -{ - int pos; - int end; - - pos=ftell(file); - fseek(file, 0, SEEK_END); - end=ftell(file); - fseek(file,pos,SEEK_SET); - - return end; -} - -int IsParam(char* arg, char paramLetter) -{ - return arg[0]=='/' && ((arg[1] | 0x20) == (paramLetter | 0x20)) && arg[2]==':'; -} - -void DoExit(int code) -{ - safeClose(baseFile); - safeClose(newFile); - safeClose(driverFile); - safeClose(mapperFile); - safeClose(extraFile); - printf("\r\n"); - exit(code); -} \ No newline at end of file diff --git a/releases/alpha 0/MKDOSROM.EXE b/releases/alpha 0/MKDOSROM.EXE deleted file mode 100644 index 051073b2..00000000 Binary files a/releases/alpha 0/MKDOSROM.EXE and /dev/null differ diff --git a/releases/alpha 0/MOUNT.COM b/releases/alpha 0/MOUNT.COM deleted file mode 100644 index a2cb4f2b..00000000 Binary files a/releases/alpha 0/MOUNT.COM and /dev/null differ diff --git a/releases/alpha 0/MSXDOS2.SYS b/releases/alpha 0/MSXDOS2.SYS deleted file mode 100644 index 1122d566..00000000 Binary files a/releases/alpha 0/MSXDOS2.SYS and /dev/null differ diff --git a/releases/alpha 0/NEW.TXT b/releases/alpha 0/NEW.TXT deleted file mode 100644 index 2ddb42a3..00000000 --- a/releases/alpha 0/NEW.TXT +++ /dev/null @@ -1,191 +0,0 @@ -MSX-DOS 2.50 alpha 1 new features - - -This document describes the changes and new features introduced in MSX-DOS 2.50 alpha 1, relative to MSX-DOS 2.20 and MSX-DOS 2.31. The changes in existing function calls, the new function calls, and the new error codes, are explained in a separate document. - -NOTE: This information is provisional. MSX-DOS 2.50 is still under development. - - - 1. STROUT function: correction of the ESC-Y escape sequence bug - -The STROUT function prints a string finished with a "$" character. There is a escape sequence that allows positioning cursor at any location in the screen, the sequence is: ESC (27) "Y" (89) x+32 y+32, where (x,y) is the desired character position. - -The bug appears when this escape sequence is used and either the x or the y coordinate are 4. In this case, the third or fourth byte of the sequence becomes 36, which is the ASCII code of "$"; then MSX-DOS incorrectly assumes that this is the end of string mark and the string is truncated. - -This bug is corrected in MSX-DOS 2.50, so the ESC-Y escape sequence can be safely used. - - - 2. Fast STROUT mode - -The STROUT function is actually translated into a series of calls to the CONOUT function. This is done this way because the string to be printed can have any arbitrary length, so it can't be copied to any internal buffer before setting up paging for the MSX-DOS environment. This makes the STROUT function to work very slowly. - -In MSX-DOS 2.50, the "Fast STROUT mode" is introduced. When this mode is activated, the string is copied to a 512 byte buffer in page 3 (the sector buffer pointed by SECBUF) and then the string is printed out from code in the MSX-DOS code segment, thus needing one single paging operation and speeding up the printing process. The drwawback of this mode is that the maximum string length is 511 characters; if the string is longer, only the first 511 characters will be printed. - -The fast STROUT mode affects also the behavior of the new function ZSTROUT. - -The fast STROUT mode can be activated or deactivated by using the new FOUT function. - - - 3. Block memory allocation routines - -The mapper support routines have been extended with two new functions that allow the allocation of small blocks of memory (from 1 to 16378 bytes) within an allocated or TPA segment. Entries for these functions are available as an extension of the mapper support routines jump table whose address can be obtained by using extended BIOS. The names and locations in the jump table of these new routines are: - - +30h: BLK_ALLOC - +33h: BLK_FREE - -Both routines work on the memory that is switched on page 2 at the moment of calling them. It may be an explicitly allocated segment, a TPA segment, or even non-mapped RAM: they will work on any writable memory that is visible on page 2. However a segment will be assumed to be switched on page 2 for documentation purposes. - -Following is the description of these routines. - - - BLK_ALLOC: Allocate a memory block - Entry: HL = Required size (1 to 16378 bytes) - Returns: On success: - HL = Address of the allocated block (always a page 2 address) - A = 0 and Z set - On error (not enough free space on segment): - HL = 0 - A = .NORAM and Z reset - -This routine tries to allocate a memory block of the specified size on the segment currently switched on page 2, and returns the address of the allocated block if it succeeds, or a "Not enough memory" error if not. The segment must have been previously initialized by calling the BLK_FREE routine with HL=0, otherwise the result is unpredictable. - - - BLK_FREE: Free a memory block - Entry: HL = Address of the allocated block as returned by BLK_ALLOC, or 0 to initialize the segment - -This routine frees a memory block on the segment currently switched on page 2. The specified address must be a block address previously returned by the BLK_ALLOC routine on the same segment, otherwise the result is unpredictable. The freed space will become available for new allocations. - -All the state information about allocated and free blocks is stored on the segment itself, MSX-DOS does not store any internal information about block memory allocation. This means that when all the allocated blocks on a given segment are no longer needed, it is not needed to explicitly free all blocks one by one; instead, the segment may be overwritten with any other data, the segment itself may be freed, or (in case of TPA segments) application may terminate directly. - -When called with HL=0, this routine initializes the segment currently switched on page 2 for block memory allocation. It is necessary to do this routine once before performing any block allocation on the segment. Also, this is useful on segments that already have allocated blocks, as a fast way to free all blocks at once. - - - 4. Support for the FAT16 filesystem - -MSX-DOS 2.31 could access devices formatted with the FAT12 filesystem only, and worked internally with 16 bit sector numbers. MSX-DOS 2.50 has native support for the FAT16 filesystem, and works internally with 23 bit sector numbers. Some functions have been modified, and some other new functions have been added, in order to account for this new capability. It is possible to boot from a FAT16 drive as well. - -Two new functions are added, RDDRV and WRDRV, that allow absolute sector reading and writing by specifying 32 bit sector numbers. - - - 5. Support for disks with standard boot sector - -MSX-DOS 2.31 recognized two types of disks based on the boot sector. Those having the "VOL_ID" string at position +20h of the boot sector were recognized as MSX-DOS 2 disks, and special features such as a four byte volume ID (used for testing for disk change) and a dirty disk flag (used to inform that the disk has deleted files that can be undeleted) were available for these disks; those not having the "VOL_ID" string were considered disks formatted with MSX-DOS 1 and the mentioned special features were not available. - -MSX-DOS 2.50 still supports DOS 2.31 disks but includes also support for disks with standard boot sectors, that is, disks formatted or partitioned with other systems. Specifically, now four different types of boot sectors are supported: - - - * MSX-DOS 2.31 disks - -These are the disks that have the "VOL_ID" string at position +20h of the boot sector. Volume ID and dirty disk flag are used on theses disks as usual. - - - * Standard disks formatted by MSX-DOS - -These are the disks that have on the boot sector an extended block (byte 28h or 29h at position 26h, and string "FAT12" or "FAT16" at position 36h) and whose manufacturar name (at position 3) is "MSXDOS25". These disks have a four byte volume ID at the same position as MSX-DOS 2.31 disks, which will be used as on these disks. Also, the "reserved" field (at position 25h) will be used as the dirty disk flag. - - - * Standard disks NOT formatted by MSX-DOS - -These are the same as the standard disks formatted by MSX-DOS, except that the manufacturer name is not "MSXDOS25". On these disks, the volume ID will be used, but there will be no dirty disk flag available. - - - * Other disks - -Disks not in the previous three categories will be considered to be MSX-DOS 1 disks. Neither volume ID nor dirty disk flag will be available for these disks. - - - 6. The reduced allocation information mode - -The ALLOC function returns information about the total and free space in a disk as a cluster count. Multiplying this number by the amount of sectors per cluster used by the disk, the total or free space in sectors is obtained. - -Until now, since MSX-DOS supported only the FAT12 filesystem and 16 bit sector numbers, the sector count obtained in this way was always a number that fitted in 16 bits. However this is not true anymore: MSX-DOS 2.50 supports the FAT16 filesystem and 23 bit sector numbers, so the ALLOC function may return a cluster count and a sectors/cluster amount that, when multiplied together, results in a number that needs more than 16 bit to be stored. - -This may pose problems on old applications that assume that the sector count will fit in 16 bits, since these applications will obtain a wrong value. For example, assume an application that calculates the free space on disk before allowing the user to save data. If the disk is FAT16 and has 10002h free sectors, the application will calculate it as 2 free sectors only (the highest bit overflows and it will be almost for sure ignored), thus not allowing the user to save data. - -To solve this, the reduced allocation information mode is introduced. When this mode is active for a given drive, ALLOC will return a false total or free cluster count if necessary, so when multiplying this number by the amount of sectors/cluster the resulting quantity alwys fits 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, ALLOC will return 32MB. - -Example: on a drive with a total size of 100MB and 20MB of free space, when the reduced allocation information mode is active ALLOC will inform 32MB total space and 20MB free space. - -The reduced allocation information mode is initially disabled. It can be enabled on a per drive basis by using the new function RALLOC. There is also a new function, DSPACE, that returns the disk total or free space information as a 32 bit amount of KBytes. - - - 7. Mounting drives - -In MSX-DOS 2.50, drives can now be mounted, in a somewhat similar way as in the Unix/Linux operating system. When a drive is mounted, MSX-DOS will assume that the disk in the drive will never be changed, and therefore will never ask the disk driver for disk change status; this results in an overall increase on disk access speed. This is especially useful when using a removable device, such as a multimedia memory card, as the main storage device for the MSX. - -No disks are mounted by default. Disks can be mounted and unmounted by using the new function MOUNT. Also, a mounted disk will be automatically unmounted when a disk error on that disk is aborted. - - - 8. New, fully documented, disk driver system - -In the past, MSX developers willing to build their own massive storage device controllers (such as hard disk controllers) with the MSX-DOS kernel embedded, had to reverse engineer the kernel code and guess 1) where to put their own hardware access code mixed with the kernel code itself, 2) the routines, and their input and output parameters, that the kernel code expected to be available for performing disk access, and 3) which parts of the kernel code had to be patched in order to make the whole thing to work. - -This changes in MSX-DOS 2.50. Now there is explicit, documented support for building a DOS kernel ROM with an embedded disk driver. Massive storage controller developers willing to deliver their hardware with the MSX-DOS 2.50 kernel embedded just need to develop the code for low-level access to the massive storage harwdare, and combine it with the MSX-DOS 2.50 kernel, as explained with detail in the Driver Development Guide (file DRIVERS.TXT). - - - 8.1. Device-based drivers - -When developing a device driver for MSX-DOS 2.50 the developer has the option to make it a device-based driver. These drivers do not provide routines to directly access the disk drives associated to the driver, as it was the case in older versions of MSX-DOS. Instead, device-based drivers provide routines to directly access the storage devices controlled by the driver. For example, in a multimedia card controller with two slots, the driver will need to serve requests like "check if there is a card in slot 1" or "read sector X from the card in slot 2". - -Choosing to develop a device-based driver for a massive storage controller has one big advantage: MSX-DOS will handle the drive letter to device mapping, as well as the drive letter to disk partition mapoing (there are new function calls and related utility applications that allow the user to control this mapping). Other features available for device-based drivers, to be implemented in future versions, are: built-in disk paritionning tool, and support for direct filesystem access (so devices sucha as CD-ROMs or disks with non-FAT filesystems can be accessed). - -There are more details about device-based driver development in the Driver Development Guide (file DRIVERS.TXT). - - - 8.2. Drive and partition auto-assign procedure for device-based drivers - -In older versions of MSX-DOS (and in MSX-DOS 2.50, when not using device-based drivers), it is the disk driver itself who decides how many drive letters wants to handle, as well as how to map drive letters to devices/disk partitions. In MSX-DOS 2.50, this is no longer the case when using device-based drivers: the user can freely map any drive letter to any device/partition controlled by the driver. - -There is a question that arises with this new system: when using device-based drivers, ŋhow many drive letters does MSX-DOS assign for the driver, and how are devices and partitions mapped to drive letters, at boot time? The answer is: - -- Two drive letters are assigned to each device-based driver at boot time. Note however that once the system has booted, the user can map any drive letter to a device on a device-based driver, not only to the two initially assigned drives (see the new function calls GDRVR, GDLI, GPART and MAPDRV; as well as the new utility routines DRIVERS.COM, DRVINFO.COM and MAPDRV.COM). - -- An auto-assign procedure is performed at boot time for the initial assignment of devices to the two assigned drives. - -The auto-assign procedure scans all the available devices on the driver, and assigns the first suitable device found. The following rules are followed when serching for a suitable device: - -* A device is searched having the smallest device and logical unit number, which is online (if it is removable), has at least one properly formatted FAT12 or FAT16 primary partition, and contains a file named MSXDOS2.DAT in the root directory of the first of these partitions (the contents of the file is irrelevant, it may be even an empty file). Extended partitions are ignored. If the device does not hold a valid partition table, then the whole device space is treated as one single primary partition. - -* If no device is found in the previous step, the first available device is selected (the device having the smallest device and logical unit number), even if it is a removable device with no media inserted. - -* If no device is found in the previous step, the drive will remain unmapped. - -* For the second drive, the same rules are used, except that the device/logical unit already mapped to the first drive is skipped. - - - 9. MSX-DOS 1 - -The MSX-DOS 2.50 kernel includes the MSX-DOS 1 kernel, which is activated when a DOS 1 boot sector is found in the disk assigned to drive A: at boot time, or when the user presses the "1" key at boot time. - -The DOS 1 kernel embedded with MSX-DOS 2.50 is the same one that is embedded with the MSX-DOS 2.3x kernel, except that is has been modified to support the new driver system. When booting in DOS 1 mode, the same drive/partition auto-assign procedure is used for device-based drivers as when booting in DOS 2 mode, except that FAT16 partitions and FAT12 partitions having more than tree sectors per cluster are ignored when searching for a MSXDOS2.DAT file. - -When booting in DOS 1 mode, and if there is at least one device-based driver in the system, then a table is created that contains information about the drive to device/partition mapping. A pointer to this table is stored at address 0F314h (when this pointer is zero, the table does not exist); the table is vreated in a reserved space in page 3. The contents of this table is as follows: - -+0: Number of entries in the table -+1..+8: First table entry -+9..+16: Second table entry -etc... - -Each entry consists of the following: - -+0: Driver slot number -+1: Relative unit number for the driver -+2: Device index -+3: LUN index -+4..+7: First device absolute sector for the drive (that is, first sector number of the assigned partition) - -At this moment there is no way to change the drive to device/partition mapping when booting in DOS 1 mode; the mappings automatically performed at boot time are permanent. This will change in future versions. - - - 10. More meaningful boot error messages - -In previous versions of MSX-DOS 2, when an error that prevented the system from booting occured, a generic "Not enough memory" message appeared. Now a more meaningful error message appears, telling the real cause of the error. - - - 11. Disablable Z80 access mode for legacy drivers - -In previous versions of MSX-DOS 2, and when running in MSX Turbo-R, the Z80 CPU was always switched prior to performing any disk access. This was done because some old floppy disk drives do not work when acessed in R800 mode. - -In MSX-DOS 2.50, the concept of "Z80 access mode" is introduced. Z80 access mode is enabled by default for all legacy drivers (drivers embedded in a MSX-DOS 1/2.20/2.3x kernel ROM), meaning that the Z80 CPU was switched when accessing any drive associated to these drivers. However, this mode can be disabled for any driver, so that drives in these drivers can be accessed in R800 mode. There is a new funcion call, Z80MODE, and a new utility program, Z80MODE.COM, which allow to enable and disable the Z80 access mode for any legacy driver. - -Note that this applies to legacy drivers only. MSX-DOS will never switch the Z80 CPU when accessing device-based or drive-based drivers. diff --git a/releases/alpha 0/RALLOC.COM b/releases/alpha 0/RALLOC.COM deleted file mode 100644 index 37d9e9e3..00000000 Binary files a/releases/alpha 0/RALLOC.COM and /dev/null differ diff --git a/releases/alpha 0/README.TXT b/releases/alpha 0/README.TXT deleted file mode 100644 index 71ba7314..00000000 --- a/releases/alpha 0/README.TXT +++ /dev/null @@ -1,6 +0,0 @@ -MSX-DOS 2.50 alpha 1 README file -By Konamiman, 9/2009 - - -1. What is this? - diff --git a/releases/alpha 0/SUNRIDE.BNK b/releases/alpha 0/SUNRIDE.BNK deleted file mode 100644 index a05d32b3..00000000 --- a/releases/alpha 0/SUNRIDE.BNK +++ /dev/null @@ -1 +0,0 @@ -ÅË?ËË?ËË?ËxÁ2AÉ \ No newline at end of file diff --git a/releases/alpha 1/docs/Nextor 2.0 Alpha1 Driver Development Guide.pdf b/releases/alpha 1/docs/Nextor 2.0 Alpha1 Driver Development Guide.pdf deleted file mode 100644 index a3d80cae..00000000 Binary files a/releases/alpha 1/docs/Nextor 2.0 Alpha1 Driver Development Guide.pdf and /dev/null differ diff --git a/releases/alpha 1/docs/Nextor 2.0 Alpha1 Programmers Reference.pdf b/releases/alpha 1/docs/Nextor 2.0 Alpha1 Programmers Reference.pdf deleted file mode 100644 index 1e166cd8..00000000 Binary files a/releases/alpha 1/docs/Nextor 2.0 Alpha1 Programmers Reference.pdf and /dev/null differ diff --git a/releases/alpha 1/docs/Nextor 2.0 Alpha1 User Manual.pdf b/releases/alpha 1/docs/Nextor 2.0 Alpha1 User Manual.pdf deleted file mode 100644 index 06b4a40e..00000000 Binary files a/releases/alpha 1/docs/Nextor 2.0 Alpha1 User Manual.pdf and /dev/null differ diff --git a/releases/alpha 1/docs/driver.asm b/releases/alpha 1/docs/driver.asm deleted file mode 100644 index 1fbf14dc..00000000 --- a/releases/alpha 1/docs/driver.asm +++ /dev/null @@ -1,644 +0,0 @@ - ; Dummy disk driver for Nextor 2.0 alpha 1 - ; By Konamiman, 7/2011 - ; - ; This code can be used as the basis for developing - ; a real disk driver: just set DRV_TYPE appropriately, - ; change the driver name and version at DRV_NAME and VER_*, and - ; implement the required routines depending on the driver type. - ; - ; See the Nextor driver development guide for more details. - - ;org 4100h - - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Miscellaneous constants -; - -;This is a 2 byte buffer to store the address of code to be executed. -;It is used by some of the kernel page 0 routines. - -CODE_ADD: equ 0F2EDh - - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL equ 0B5h -.IPARM equ 08Bh - -endif - - -;----------------------------------------------------------------------------- -; -; Routines and information available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a, -; ld hl, -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel main bank -; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), -; then invokes the routine whose address is at (CODE_ADD). -; It is necessary to use this routine to invoke CALBAS -; (so that kernel bank is correct in case of BASIC error) -; and to invoke DOS functions via F37Dh hook. -; -; Input: Address of code to invoke in (CODE_ADD). -; AF, BC, DE, HL, IX, IY passed to the called routine. -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALLB0 equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; -; Input: A = bank number -; IX = routine address -; AF' = AF for the routine -; HL' = Ix for the routine -; BC, DE, HL, IY = input for the routine -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a, (xor a for current page 1 slot) -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* This address contains one byte that tells how many banks -; form the Nextor kernel (or alternatively, the first bank -; number of the driver). - -K_SIZE equ 40FEh - - -;* This address contains one byte with the current bank number. - -CUR_BANK equ 40FFh - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 741Fh ;Null string (disk can't be formatted) -SING_DBL equ 7420h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "NEXTOR_DRIVER",0 - - -;----------------------------------------------------------------------------- -; -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1 -endif - - -;----------------------------------------------------------------------------- -; -; Reserved byte -; - - db 0 - - -;----------------------------------------------------------------------------- -; -; Driver name -; - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - - -;----------------------------------------------------------------------------- -; -; Jump table for the driver public routines -; - - ; These routines are mandatory for all drivers - ; (but probably you need to implement only DRV_INIT) - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - - ; These routines are mandatory for drive-based drivers - - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - - ; These routines are mandatory for device-based drivers - - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO -endif - - -;===== -;===== END of data that must be at fixed addresses -;===== - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization routine, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7450h, 7453h, 7456h, 7459h and 745Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; DE = First sector number to read/write -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors - B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical -; units (which is functionally equivalent to having only one). -;+1 (1): Device flags, always zero in Alpha 1. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; End of the driver code - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end diff --git a/releases/alpha 1/kernels/Nextor-2.0-alpha1.StandaloneASCII16.rom b/releases/alpha 1/kernels/Nextor-2.0-alpha1.StandaloneASCII16.rom deleted file mode 100644 index 30e2371b..00000000 Binary files a/releases/alpha 1/kernels/Nextor-2.0-alpha1.StandaloneASCII16.rom and /dev/null differ diff --git a/releases/alpha 1/kernels/Nextor-2.0-alpha1.StandaloneASCII8.rom b/releases/alpha 1/kernels/Nextor-2.0-alpha1.StandaloneASCII8.rom deleted file mode 100644 index 828f37d5..00000000 Binary files a/releases/alpha 1/kernels/Nextor-2.0-alpha1.StandaloneASCII8.rom and /dev/null differ diff --git a/releases/alpha 1/kernels/Nextor-2.0-alpha1.SunriseIDE.rom b/releases/alpha 1/kernels/Nextor-2.0-alpha1.SunriseIDE.rom deleted file mode 100644 index b1f266ac..00000000 Binary files a/releases/alpha 1/kernels/Nextor-2.0-alpha1.SunriseIDE.rom and /dev/null differ diff --git a/releases/alpha 1/kernels/Nextor-2.0-alpha1.base.dat b/releases/alpha 1/kernels/Nextor-2.0-alpha1.base.dat deleted file mode 100644 index c5ea12b2..00000000 Binary files a/releases/alpha 1/kernels/Nextor-2.0-alpha1.base.dat and /dev/null differ diff --git a/releases/alpha 1/pcutils/mknexrom.c b/releases/alpha 1/pcutils/mknexrom.c deleted file mode 100644 index c11aec0a..00000000 --- a/releases/alpha 1/pcutils/mknexrom.c +++ /dev/null @@ -1,432 +0,0 @@ -/* MKNEXROM - Make a Nextor kernel ROM - By Konamiman, 5/2011 - - Usage: - mknexrom [/d:] [/m:] [/e:] - - This program creates a Nextor kernel ROM from a base file and a driver file, - as per the recipe specified in the driver development guide. It also allows modifying - an existing kernel ROM file, by changing the mapper code and/or adding extra content - in the free 1K areas present in the DOS 1 and DOS 2 main kernel banks. - - - can be: - - A kernel base file, that is, a file containing the code for the five kernel ROM banks and no driver; or - - A complete ROM file consisting of the kernel bank with the driver bank(s) already appended. - - - is the file containing the driver code. It must be a valid driver according - to the driver development guide. The contents of this file is expected to be as follows: - - 1. 256 dummy bytes. - 2. The driver signature (see the driver development guide) - 3. The driver jump table - 4. The driver code itself - - And optionally, if the driver is more than 16K long, for each additional 16K block: - - 5. 256 dummy bytes. - 6. The additional driver code or data. - 7. Dummy space up to 16K. - - The last block does not need to be 16K long. - - Specifying a driver file is mandarory if a base file without driver is specified in , - and prohibited if a complete ROM file is specified. - - - is the file containing the bank switching code. The following is required for this code: - - - When called, switches ing page 1 the ROM bank passed in A. - - Up to 48 bytes long. - - Runs at address 0x7FD0. - - May corrupt AF, must preserve all other registers. - - If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. - - - is the file containing the extra code or data for the resulting ROM file. This extra data - will be placed at DOS 1 and DOS 2 kernel main banks at address 0x3BD0, this means that this code or data - will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel - slot, at address 0x7BD0. - - The maximum size for the extra file is 1K. - -*/ - -/* v1.01 (4/2011): - BASE_BANK_COUNT changed from 5 to 6 - - v1.02 (4/2011): - BASE_BANK_COUNT changed from 6 to 7 - - v1.03 (4/2011): - BASE_BANK_COUNT no longer used, the value is read from the file (at position 0xFE) instead. - Driver signature searched changed to NEXTOR_DRIVER. -*/ - - -#include -#include -#include - -#define BANK_SIZE 16384 //Size of each ROM bank -//#define BASE_BANK_COUNT 7 //Number of kernel banks -#define BASE_BANK_COUNT_OFFSET 0xFE //Offset in the base file of number of kernel banks -#define DRIVER_BANK baseBankCount //Index of the first driver bank -#define MAPPER_CODE_SIZE 48 //Size of the bank change code -#define EXTRA_CODE_SIZE 1024 //Size of the extra code for banks 0 and 3 -#define EXTRA_ADDRESS 0x3BD0 //Address of the extra code -#define DRIVER_MIN_SIZE 0x172 //Minimum size of the disk driver -#define PAGE0_SIZE 256 //Size of the common page 0 code -#define DOS2_EXTRA_BANK 0 //Bank for the extra code in DOS 2 mode -#define DOS1_EXTRA_BANK 3 //Bank for the extra code in DOS 2 mode -#define DATABUFFER_SIZE sizeof(dataBuffer) - -#define safeClose(file) {if(file!=NULL) {fclose(file); file=NULL;}} - -void DisplayInfo(); -int GetFileSize(FILE* file); -int IsParam(char* arg, char paramLetteR); -void DoExit(int code); - -FILE* baseFile=NULL; -FILE* newFile=NULL; -FILE* driverFile=NULL; -FILE* mapperFile=NULL; -FILE* extraFile=NULL; - -int baseBankCount; - -int main(int argc, char* argv[]) -{ - int hasDriver; - int baseFileSize; - int readCount; - int writeCount; - int signatureLength; - int i; - unsigned short position; - - char* baseFilename=NULL; - char* newFilename=NULL; - char* driverFilename=NULL; - char* mapperFilename=NULL; - char* extraFilename=NULL; - - char* mapperCode[MAPPER_CODE_SIZE]; - char* extraCode[EXTRA_CODE_SIZE]; - char* dataBuffer[1024]; - - char* driverSignature="NEXTOR_DRIVER"; - signatureLength=strlen(driverSignature); - - - //* Get command line parameters - - printf("\r\n"); - if(argc<4) { - DisplayInfo(); - DoExit(0); - } - - baseFilename=argv[1]; - newFilename=argv[2]; - for(i=3; i=(baseBankCount+1) * BANK_SIZE) { - hasDriver=1; - } else { - printf("*** The base file has not the expected length. Expected either %iK (for base file without driver) or >=%iK (for file with driver).\r\n", - (baseBankCount * BANK_SIZE)/1024, - ((baseBankCount+1) * BANK_SIZE)/1024); - DoExit(1); - } - - - //* Check for the presence or absence of driver file, this depends on the base file size - - if(driverFilename!=NULL && hasDriver) { - printf("*** A driver file has been specified, but the base file appears to have a driver already.\r\n"); - DoExit(1); - } else if(driverFilename==NULL && !hasDriver) { - printf("*** No driver file has been specified, but the base file does not have driver.\r\n"); - DoExit(1); - } - - - //* Read the mapper code file, if specified; - // otherwise get the mapper code from the base file itself - - if(mapperFilename==NULL) { - fseek(baseFile, BANK_SIZE-MAPPER_CODE_SIZE, SEEK_SET); - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, baseFile); - if(readCount!=MAPPER_CODE_SIZE) { - printf("*** Can't read the mapper code from the base file\r\n"); - DoExit(1); - } - fseek(baseFile, 0, SEEK_SET); - } else { - mapperFile=fopen(mapperFilename, "rb"); - if(mapperFile==NULL) { - printf("*** Can't open mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(mapperFile)>MAPPER_CODE_SIZE) { - printf("*** The mapper code file has not the expected size (%i bytes)\r\n", MAPPER_CODE_SIZE); - DoExit(1); - } - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, mapperFile); - if(readCount==0) { - printf("*** Can't read the mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - safeClose(mapperFile); - } - - - //* Read the extra code file, if specified - - if(extraFilename!=NULL) { - extraFile=fopen(extraFilename, "rb"); - if(extraFile==NULL) { - printf("*** Can't open extra code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(extraFile)>EXTRA_CODE_SIZE) { - printf("*** The extra code file is too big, maximum allowed size is %i bytes\r\n", EXTRA_CODE_SIZE); - DoExit(1); - } - readCount=fread(extraCode, 1, EXTRA_CODE_SIZE, extraFile); - if(readCount==0) { - printf("*** Can't read the extra code file: %s", extraFilename); - DoExit(1); - } - safeClose(extraFile); - } - - - //* Open the driver file, if necessary, and check its signature - - if(driverFilename!=NULL) { - driverFile=fopen(driverFilename, "rb"); - if(driverFile==NULL) { - printf("*** Can't open driver file: %s\r\n", driverFilename); - DoExit(1); - } - if(GetFileSize(driverFile) [/d:] [/m:] [/e:]\r\n" - ); -} - -int GetFileSize(FILE* file) -{ - int pos; - int end; - - pos=ftell(file); - fseek(file, 0, SEEK_END); - end=ftell(file); - fseek(file,pos,SEEK_SET); - - return end; -} - -int IsParam(char* arg, char paramLetter) -{ - return arg[0]=='/' && ((arg[1] | 0x20) == (paramLetter | 0x20)) && arg[2]==':'; -} - -void DoExit(int code) -{ - safeClose(baseFile); - safeClose(newFile); - safeClose(driverFile); - safeClose(mapperFile); - safeClose(extraFile); - printf("\r\n"); - exit(code); -} \ No newline at end of file diff --git a/releases/alpha 1/pcutils/mknexrom.exe b/releases/alpha 1/pcutils/mknexrom.exe deleted file mode 100644 index f2089e8e..00000000 Binary files a/releases/alpha 1/pcutils/mknexrom.exe and /dev/null differ diff --git a/releases/alpha 1/tools/nextor-dsk.zip b/releases/alpha 1/tools/nextor-dsk.zip deleted file mode 100644 index 0ba67f8f..00000000 Binary files a/releases/alpha 1/tools/nextor-dsk.zip and /dev/null differ diff --git a/releases/alpha 1/tools/nextor.sys b/releases/alpha 1/tools/nextor.sys deleted file mode 100644 index faf4f9e2..00000000 Binary files a/releases/alpha 1/tools/nextor.sys and /dev/null differ diff --git a/releases/alpha 1/tools/tools.lzh b/releases/alpha 1/tools/tools.lzh deleted file mode 100644 index f2a389b6..00000000 Binary files a/releases/alpha 1/tools/tools.lzh and /dev/null differ diff --git a/releases/alpha2/docs/.svn/all-wcprops b/releases/alpha2/docs/.svn/all-wcprops deleted file mode 100644 index b3c73bdb..00000000 --- a/releases/alpha2/docs/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 59 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/docs -END -driver.asm -K 25 -svn:wc:ra_dav:version-url -V 70 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/docs/driver.asm -END -Nextor 2.0 Alpha1 Driver Development Guide.pdf -K 25 -svn:wc:ra_dav:version-url -V 116 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/docs/Nextor%202.0%20Alpha1%20Driver%20Development%20Guide.pdf -END -Nextor 2.0 Alpha1 User Manual.pdf -K 25 -svn:wc:ra_dav:version-url -V 101 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/docs/Nextor%202.0%20Alpha1%20User%20Manual.pdf -END -Nextor 2.0 Alpha1 Programmers Reference.pdf -K 25 -svn:wc:ra_dav:version-url -V 111 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/docs/Nextor%202.0%20Alpha1%20Programmers%20Reference.pdf -END diff --git a/releases/alpha2/docs/.svn/entries b/releases/alpha2/docs/.svn/entries deleted file mode 100644 index a356a902..00000000 --- a/releases/alpha2/docs/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -82 -http://svn.xp-dev.com/svn/msx2_MSXDOS250/releases/alpha%201%20!/docs -http://svn.xp-dev.com/svn/msx2_MSXDOS250 - - - -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - -66fae3e2-2deb-47f9-a46c-3d3b0164802c - -driver.asm -file - - - - -2011-06-23T07:20:28.971200Z -f4b72ab25e841343bfb43540489dc2d4 -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - - - - - - - - -17406 - -Nextor 2.0 Alpha1 Driver Development Guide.pdf -file - - - - -2011-06-29T14:43:11.870800Z -1971a8e48b4ce9968cdbc938f3ec43a7 -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - - - - - - - - -371250 - -Nextor 2.0 Alpha1 User Manual.pdf -file - - - - -2011-06-28T14:17:50.028800Z -ecf9e0194da78be137471f9825fac43d -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - - - - - - - - -277603 - -Nextor 2.0 Alpha1 Programmers Reference.pdf -file - - - - -2011-06-28T12:48:22.007800Z -1dfe475711f62d32b196282c51b16ad7 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -252815 - diff --git a/releases/alpha2/docs/.svn/prop-base/Nextor 2.0 Alpha1 Programmers Reference.pdf.svn-base b/releases/alpha2/docs/.svn/prop-base/Nextor 2.0 Alpha1 Programmers Reference.pdf.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/docs/.svn/prop-base/Nextor 2.0 Alpha1 Programmers Reference.pdf.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 Driver Development Guide.pdf.svn-base b/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 Driver Development Guide.pdf.svn-base deleted file mode 100644 index a3d80cae..00000000 Binary files a/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 Driver Development Guide.pdf.svn-base and /dev/null differ diff --git a/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 Programmers Reference.pdf.svn-base b/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 Programmers Reference.pdf.svn-base deleted file mode 100644 index 1e166cd8..00000000 Binary files a/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 Programmers Reference.pdf.svn-base and /dev/null differ diff --git a/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 User Manual.pdf.svn-base b/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 User Manual.pdf.svn-base deleted file mode 100644 index 06b4a40e..00000000 Binary files a/releases/alpha2/docs/.svn/text-base/Nextor 2.0 Alpha1 User Manual.pdf.svn-base and /dev/null differ diff --git a/releases/alpha2/docs/.svn/text-base/driver.asm.svn-base b/releases/alpha2/docs/.svn/text-base/driver.asm.svn-base deleted file mode 100644 index 1fbf14dc..00000000 --- a/releases/alpha2/docs/.svn/text-base/driver.asm.svn-base +++ /dev/null @@ -1,644 +0,0 @@ - ; Dummy disk driver for Nextor 2.0 alpha 1 - ; By Konamiman, 7/2011 - ; - ; This code can be used as the basis for developing - ; a real disk driver: just set DRV_TYPE appropriately, - ; change the driver name and version at DRV_NAME and VER_*, and - ; implement the required routines depending on the driver type. - ; - ; See the Nextor driver development guide for more details. - - ;org 4100h - - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Miscellaneous constants -; - -;This is a 2 byte buffer to store the address of code to be executed. -;It is used by some of the kernel page 0 routines. - -CODE_ADD: equ 0F2EDh - - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL equ 0B5h -.IPARM equ 08Bh - -endif - - -;----------------------------------------------------------------------------- -; -; Routines and information available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a, -; ld hl, -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel main bank -; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), -; then invokes the routine whose address is at (CODE_ADD). -; It is necessary to use this routine to invoke CALBAS -; (so that kernel bank is correct in case of BASIC error) -; and to invoke DOS functions via F37Dh hook. -; -; Input: Address of code to invoke in (CODE_ADD). -; AF, BC, DE, HL, IX, IY passed to the called routine. -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALLB0 equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; -; Input: A = bank number -; IX = routine address -; AF' = AF for the routine -; HL' = Ix for the routine -; BC, DE, HL, IY = input for the routine -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a, (xor a for current page 1 slot) -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* This address contains one byte that tells how many banks -; form the Nextor kernel (or alternatively, the first bank -; number of the driver). - -K_SIZE equ 40FEh - - -;* This address contains one byte with the current bank number. - -CUR_BANK equ 40FFh - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 741Fh ;Null string (disk can't be formatted) -SING_DBL equ 7420h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "NEXTOR_DRIVER",0 - - -;----------------------------------------------------------------------------- -; -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1 -endif - - -;----------------------------------------------------------------------------- -; -; Reserved byte -; - - db 0 - - -;----------------------------------------------------------------------------- -; -; Driver name -; - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - - -;----------------------------------------------------------------------------- -; -; Jump table for the driver public routines -; - - ; These routines are mandatory for all drivers - ; (but probably you need to implement only DRV_INIT) - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - - ; These routines are mandatory for drive-based drivers - - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - - ; These routines are mandatory for device-based drivers - - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO -endif - - -;===== -;===== END of data that must be at fixed addresses -;===== - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization routine, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7450h, 7453h, 7456h, 7459h and 745Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; DE = First sector number to read/write -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors - B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical -; units (which is functionally equivalent to having only one). -;+1 (1): Device flags, always zero in Alpha 1. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; End of the driver code - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end diff --git a/releases/alpha2/docs/Nextor 2.0 Alpha2 Driver Development Guide.pdf b/releases/alpha2/docs/Nextor 2.0 Alpha2 Driver Development Guide.pdf deleted file mode 100644 index 24911a84..00000000 Binary files a/releases/alpha2/docs/Nextor 2.0 Alpha2 Driver Development Guide.pdf and /dev/null differ diff --git a/releases/alpha2/docs/Nextor 2.0 Alpha2 Getting Started Guide.pdf b/releases/alpha2/docs/Nextor 2.0 Alpha2 Getting Started Guide.pdf deleted file mode 100644 index 00ca54d7..00000000 Binary files a/releases/alpha2/docs/Nextor 2.0 Alpha2 Getting Started Guide.pdf and /dev/null differ diff --git a/releases/alpha2/docs/Nextor 2.0 Alpha2 Programmers Reference.pdf b/releases/alpha2/docs/Nextor 2.0 Alpha2 Programmers Reference.pdf deleted file mode 100644 index 45bd2903..00000000 Binary files a/releases/alpha2/docs/Nextor 2.0 Alpha2 Programmers Reference.pdf and /dev/null differ diff --git a/releases/alpha2/docs/Nextor 2.0 Alpha2 User Manual.pdf b/releases/alpha2/docs/Nextor 2.0 Alpha2 User Manual.pdf deleted file mode 100644 index fcf2d582..00000000 Binary files a/releases/alpha2/docs/Nextor 2.0 Alpha2 User Manual.pdf and /dev/null differ diff --git a/releases/alpha2/docs/driver.asm b/releases/alpha2/docs/driver.asm deleted file mode 100644 index 0e21cbf5..00000000 --- a/releases/alpha2/docs/driver.asm +++ /dev/null @@ -1,644 +0,0 @@ - ; Dummy disk driver for Nextor 2.0 alpha 2 - ; By Konamiman, 8/2011 - ; - ; This code can be used as the basis for developing - ; a real disk driver: just set DRV_TYPE appropriately, - ; change the driver name and version at DRV_NAME and VER_*, and - ; implement the required routines depending on the driver type. - ; - ; See the Nextor driver development guide for more details. - - ;org 4100h - - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Miscellaneous constants -; - -;This is a 2 byte buffer to store the address of code to be executed. -;It is used by some of the kernel page 0 routines. - -CODE_ADD: equ 0F2EDh - - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL equ 0B5h -.IPARM equ 08Bh - -endif - - -;----------------------------------------------------------------------------- -; -; Routines and information available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a, -; ld hl, -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel main bank -; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), -; then invokes the routine whose address is at (CODE_ADD). -; It is necessary to use this routine to invoke CALBAS -; (so that kernel bank is correct in case of BASIC error) -; and to invoke DOS functions via F37Dh hook. -; -; Input: Address of code to invoke in (CODE_ADD). -; AF, BC, DE, HL, IX, IY passed to the called routine. -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALLB0 equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; -; Input: A = bank number -; IX = routine address -; AF' = AF for the routine -; HL' = Ix for the routine -; BC, DE, HL, IY = input for the routine -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a, (xor a for current page 1 slot) -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* This address contains one byte that tells how many banks -; form the Nextor kernel (or alternatively, the first bank -; number of the driver). - -K_SIZE equ 40FEh - - -;* This address contains one byte with the current bank number. - -CUR_BANK equ 40FFh - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 781Fh ;Null string (disk can't be formatted) -SING_DBL equ 7820h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "NEXTOR_DRIVER",0 - - -;----------------------------------------------------------------------------- -; -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1 -endif - - -;----------------------------------------------------------------------------- -; -; Reserved byte -; - - db 0 - - -;----------------------------------------------------------------------------- -; -; Driver name -; - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - - -;----------------------------------------------------------------------------- -; -; Jump table for the driver public routines -; - - ; These routines are mandatory for all drivers - ; (but probably you need to implement only DRV_INIT) - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - - ; These routines are mandatory for drive-based drivers - - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - - ; These routines are mandatory for device-based drivers - - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO -endif - - -;===== -;===== END of data that must be at fixed addresses -;===== - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization routine, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7450h, 7453h, 7456h, 7459h and 745Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; DE = First sector number to read/write -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors - B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical -; units (which is functionally equivalent to having only one). -;+1 (1): Device flags, always zero in Alpha 1. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; End of the driver code - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end diff --git a/releases/alpha2/kernels/.svn/all-wcprops b/releases/alpha2/kernels/.svn/all-wcprops deleted file mode 100644 index ef52d8e5..00000000 --- a/releases/alpha2/kernels/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/kernels -END -Nextor-2.0-alpha1.base.dat -K 25 -svn:wc:ra_dav:version-url -V 89 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/kernels/Nextor-2.0-alpha1.base.dat -END -Nextor-2.0-alpha1.StandaloneASCII16.rom -K 25 -svn:wc:ra_dav:version-url -V 102 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/kernels/Nextor-2.0-alpha1.StandaloneASCII16.rom -END -Nextor-2.0-alpha1.StandaloneASCII8.rom -K 25 -svn:wc:ra_dav:version-url -V 101 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/kernels/Nextor-2.0-alpha1.StandaloneASCII8.rom -END -Nextor-2.0-alpha1.SunriseIDE.rom -K 25 -svn:wc:ra_dav:version-url -V 95 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/kernels/Nextor-2.0-alpha1.SunriseIDE.rom -END diff --git a/releases/alpha2/kernels/.svn/entries b/releases/alpha2/kernels/.svn/entries deleted file mode 100644 index dfa8a5e4..00000000 --- a/releases/alpha2/kernels/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -82 -http://svn.xp-dev.com/svn/msx2_MSXDOS250/releases/alpha%201%20!/kernels -http://svn.xp-dev.com/svn/msx2_MSXDOS250 - - - -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - -66fae3e2-2deb-47f9-a46c-3d3b0164802c - -Nextor-2.0-alpha1.base.dat -file - - - - -2011-06-27T14:00:07.202000Z -25e68f8180fd74e7d381f9fd3473b39b -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -114688 - -Nextor-2.0-alpha1.StandaloneASCII16.rom -file - - - - -2011-06-23T07:13:15.436200Z -e1e7470ccdf90006bfb2accb46568992 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -131072 - -Nextor-2.0-alpha1.StandaloneASCII8.rom -file - - - - -2011-06-23T07:13:16.212200Z -ea98d7ac06192d4186a3f020a9fa3249 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -131072 - -Nextor-2.0-alpha1.SunriseIDE.rom -file - - - - -2011-06-23T07:13:16.772200Z -0d29695709206847df0319462263fdcf -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -131072 - diff --git a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.StandaloneASCII16.rom.svn-base b/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.StandaloneASCII16.rom.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.StandaloneASCII16.rom.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.StandaloneASCII8.rom.svn-base b/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.StandaloneASCII8.rom.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.StandaloneASCII8.rom.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.SunriseIDE.rom.svn-base b/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.SunriseIDE.rom.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.SunriseIDE.rom.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.base.dat.svn-base b/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.base.dat.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/kernels/.svn/prop-base/Nextor-2.0-alpha1.base.dat.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.StandaloneASCII16.rom.svn-base b/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.StandaloneASCII16.rom.svn-base deleted file mode 100644 index 30e2371b..00000000 Binary files a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.StandaloneASCII16.rom.svn-base and /dev/null differ diff --git a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.StandaloneASCII8.rom.svn-base b/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.StandaloneASCII8.rom.svn-base deleted file mode 100644 index 828f37d5..00000000 Binary files a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.StandaloneASCII8.rom.svn-base and /dev/null differ diff --git a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.SunriseIDE.rom.svn-base b/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.SunriseIDE.rom.svn-base deleted file mode 100644 index b1f266ac..00000000 Binary files a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.SunriseIDE.rom.svn-base and /dev/null differ diff --git a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.base.dat.svn-base b/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.base.dat.svn-base deleted file mode 100644 index c5ea12b2..00000000 Binary files a/releases/alpha2/kernels/.svn/text-base/Nextor-2.0-alpha1.base.dat.svn-base and /dev/null differ diff --git a/releases/alpha2/kernels/Nextor-2.0-alpha2.StandaloneASCII16.ROM b/releases/alpha2/kernels/Nextor-2.0-alpha2.StandaloneASCII16.ROM deleted file mode 100644 index 4a02879f..00000000 Binary files a/releases/alpha2/kernels/Nextor-2.0-alpha2.StandaloneASCII16.ROM and /dev/null differ diff --git a/releases/alpha2/kernels/Nextor-2.0-alpha2.StandaloneASCII8.ROM b/releases/alpha2/kernels/Nextor-2.0-alpha2.StandaloneASCII8.ROM deleted file mode 100644 index edf9086c..00000000 Binary files a/releases/alpha2/kernels/Nextor-2.0-alpha2.StandaloneASCII8.ROM and /dev/null differ diff --git a/releases/alpha2/kernels/Nextor-2.0-alpha2.SunriseIDE.ROM b/releases/alpha2/kernels/Nextor-2.0-alpha2.SunriseIDE.ROM deleted file mode 100644 index 24640290..00000000 Binary files a/releases/alpha2/kernels/Nextor-2.0-alpha2.SunriseIDE.ROM and /dev/null differ diff --git a/releases/alpha2/kernels/Nextor-2.0-alpha2.base.dat b/releases/alpha2/kernels/Nextor-2.0-alpha2.base.dat deleted file mode 100644 index ac62b123..00000000 Binary files a/releases/alpha2/kernels/Nextor-2.0-alpha2.base.dat and /dev/null differ diff --git a/releases/alpha2/mappers/.svn/all-wcprops b/releases/alpha2/mappers/.svn/all-wcprops deleted file mode 100644 index cc6d297a..00000000 --- a/releases/alpha2/mappers/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/mappers -END -Mapper.SunriseIDE.bin -K 25 -svn:wc:ra_dav:version-url -V 84 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/mappers/Mapper.SunriseIDE.bin -END -Mapper.ASCII16.bin -K 25 -svn:wc:ra_dav:version-url -V 81 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/mappers/Mapper.ASCII16.bin -END -Mapper.ASCII8.bin -K 25 -svn:wc:ra_dav:version-url -V 80 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/mappers/Mapper.ASCII8.bin -END diff --git a/releases/alpha2/mappers/.svn/entries b/releases/alpha2/mappers/.svn/entries deleted file mode 100644 index a8eb72aa..00000000 --- a/releases/alpha2/mappers/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -82 -http://svn.xp-dev.com/svn/msx2_MSXDOS250/releases/alpha%201%20!/mappers -http://svn.xp-dev.com/svn/msx2_MSXDOS250 - - - -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - -66fae3e2-2deb-47f9-a46c-3d3b0164802c - -Mapper.SunriseIDE.bin -file - - - - -2011-06-27T14:00:09.815600Z -16c980cbbd92a9098bfe277a8a21c13f -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -48 - -Mapper.ASCII16.bin -file - - - - -2011-06-27T14:00:07.763600Z -ea03bbd1ac63d06f9377d3c6169d8fa3 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -48 - -Mapper.ASCII8.bin -file - - - - -2011-06-27T14:00:08.980400Z -66af596dba9a8e0028b0b2b6ac9004ff -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -48 - diff --git a/releases/alpha2/mappers/.svn/prop-base/Mapper.ASCII16.bin.svn-base b/releases/alpha2/mappers/.svn/prop-base/Mapper.ASCII16.bin.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/mappers/.svn/prop-base/Mapper.ASCII16.bin.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/mappers/.svn/prop-base/Mapper.ASCII8.bin.svn-base b/releases/alpha2/mappers/.svn/prop-base/Mapper.ASCII8.bin.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/mappers/.svn/prop-base/Mapper.ASCII8.bin.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/mappers/.svn/prop-base/Mapper.SunriseIDE.bin.svn-base b/releases/alpha2/mappers/.svn/prop-base/Mapper.SunriseIDE.bin.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/mappers/.svn/prop-base/Mapper.SunriseIDE.bin.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/mappers/.svn/text-base/Mapper.ASCII16.bin.svn-base b/releases/alpha2/mappers/.svn/text-base/Mapper.ASCII16.bin.svn-base deleted file mode 100644 index d9db948d..00000000 Binary files a/releases/alpha2/mappers/.svn/text-base/Mapper.ASCII16.bin.svn-base and /dev/null differ diff --git a/releases/alpha2/mappers/.svn/text-base/Mapper.ASCII8.bin.svn-base b/releases/alpha2/mappers/.svn/text-base/Mapper.ASCII8.bin.svn-base deleted file mode 100644 index ea41b2f9..00000000 Binary files a/releases/alpha2/mappers/.svn/text-base/Mapper.ASCII8.bin.svn-base and /dev/null differ diff --git a/releases/alpha2/mappers/.svn/text-base/Mapper.SunriseIDE.bin.svn-base b/releases/alpha2/mappers/.svn/text-base/Mapper.SunriseIDE.bin.svn-base deleted file mode 100644 index 0792c380..00000000 --- a/releases/alpha2/mappers/.svn/text-base/Mapper.SunriseIDE.bin.svn-base +++ /dev/null @@ -1 +0,0 @@ -ÅË?ËË?ËË?ËxÁ2AÉĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸĸ \ No newline at end of file diff --git a/releases/alpha2/pcutils/.svn/all-wcprops b/releases/alpha2/pcutils/.svn/all-wcprops deleted file mode 100644 index e3746c79..00000000 --- a/releases/alpha2/pcutils/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 62 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/pcutils -END -mknexrom.exe -K 25 -svn:wc:ra_dav:version-url -V 75 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/pcutils/mknexrom.exe -END -mknexrom.c -K 25 -svn:wc:ra_dav:version-url -V 73 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/pcutils/mknexrom.c -END diff --git a/releases/alpha2/pcutils/.svn/entries b/releases/alpha2/pcutils/.svn/entries deleted file mode 100644 index 4e4e329a..00000000 --- a/releases/alpha2/pcutils/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -82 -http://svn.xp-dev.com/svn/msx2_MSXDOS250/releases/alpha%201%20!/pcutils -http://svn.xp-dev.com/svn/msx2_MSXDOS250 - - - -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - -66fae3e2-2deb-47f9-a46c-3d3b0164802c - -mknexrom.exe -file - - - - -2011-06-08T08:29:33.861600Z -4c3fe75b343c2886df410bb6cc09c00e -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -61952 - -mknexrom.c -file - - - - -2011-06-27T14:04:21.399200Z -4281ed82af2e6a9c48ecc6942b53ca3c -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - - - - - - - - -12966 - diff --git a/releases/alpha2/pcutils/.svn/prop-base/mknexrom.exe.svn-base b/releases/alpha2/pcutils/.svn/prop-base/mknexrom.exe.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/pcutils/.svn/prop-base/mknexrom.exe.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/pcutils/.svn/text-base/mknexrom.c.svn-base b/releases/alpha2/pcutils/.svn/text-base/mknexrom.c.svn-base deleted file mode 100644 index c11aec0a..00000000 --- a/releases/alpha2/pcutils/.svn/text-base/mknexrom.c.svn-base +++ /dev/null @@ -1,432 +0,0 @@ -/* MKNEXROM - Make a Nextor kernel ROM - By Konamiman, 5/2011 - - Usage: - mknexrom [/d:] [/m:] [/e:] - - This program creates a Nextor kernel ROM from a base file and a driver file, - as per the recipe specified in the driver development guide. It also allows modifying - an existing kernel ROM file, by changing the mapper code and/or adding extra content - in the free 1K areas present in the DOS 1 and DOS 2 main kernel banks. - - - can be: - - A kernel base file, that is, a file containing the code for the five kernel ROM banks and no driver; or - - A complete ROM file consisting of the kernel bank with the driver bank(s) already appended. - - - is the file containing the driver code. It must be a valid driver according - to the driver development guide. The contents of this file is expected to be as follows: - - 1. 256 dummy bytes. - 2. The driver signature (see the driver development guide) - 3. The driver jump table - 4. The driver code itself - - And optionally, if the driver is more than 16K long, for each additional 16K block: - - 5. 256 dummy bytes. - 6. The additional driver code or data. - 7. Dummy space up to 16K. - - The last block does not need to be 16K long. - - Specifying a driver file is mandarory if a base file without driver is specified in , - and prohibited if a complete ROM file is specified. - - - is the file containing the bank switching code. The following is required for this code: - - - When called, switches ing page 1 the ROM bank passed in A. - - Up to 48 bytes long. - - Runs at address 0x7FD0. - - May corrupt AF, must preserve all other registers. - - If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. - - - is the file containing the extra code or data for the resulting ROM file. This extra data - will be placed at DOS 1 and DOS 2 kernel main banks at address 0x3BD0, this means that this code or data - will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel - slot, at address 0x7BD0. - - The maximum size for the extra file is 1K. - -*/ - -/* v1.01 (4/2011): - BASE_BANK_COUNT changed from 5 to 6 - - v1.02 (4/2011): - BASE_BANK_COUNT changed from 6 to 7 - - v1.03 (4/2011): - BASE_BANK_COUNT no longer used, the value is read from the file (at position 0xFE) instead. - Driver signature searched changed to NEXTOR_DRIVER. -*/ - - -#include -#include -#include - -#define BANK_SIZE 16384 //Size of each ROM bank -//#define BASE_BANK_COUNT 7 //Number of kernel banks -#define BASE_BANK_COUNT_OFFSET 0xFE //Offset in the base file of number of kernel banks -#define DRIVER_BANK baseBankCount //Index of the first driver bank -#define MAPPER_CODE_SIZE 48 //Size of the bank change code -#define EXTRA_CODE_SIZE 1024 //Size of the extra code for banks 0 and 3 -#define EXTRA_ADDRESS 0x3BD0 //Address of the extra code -#define DRIVER_MIN_SIZE 0x172 //Minimum size of the disk driver -#define PAGE0_SIZE 256 //Size of the common page 0 code -#define DOS2_EXTRA_BANK 0 //Bank for the extra code in DOS 2 mode -#define DOS1_EXTRA_BANK 3 //Bank for the extra code in DOS 2 mode -#define DATABUFFER_SIZE sizeof(dataBuffer) - -#define safeClose(file) {if(file!=NULL) {fclose(file); file=NULL;}} - -void DisplayInfo(); -int GetFileSize(FILE* file); -int IsParam(char* arg, char paramLetteR); -void DoExit(int code); - -FILE* baseFile=NULL; -FILE* newFile=NULL; -FILE* driverFile=NULL; -FILE* mapperFile=NULL; -FILE* extraFile=NULL; - -int baseBankCount; - -int main(int argc, char* argv[]) -{ - int hasDriver; - int baseFileSize; - int readCount; - int writeCount; - int signatureLength; - int i; - unsigned short position; - - char* baseFilename=NULL; - char* newFilename=NULL; - char* driverFilename=NULL; - char* mapperFilename=NULL; - char* extraFilename=NULL; - - char* mapperCode[MAPPER_CODE_SIZE]; - char* extraCode[EXTRA_CODE_SIZE]; - char* dataBuffer[1024]; - - char* driverSignature="NEXTOR_DRIVER"; - signatureLength=strlen(driverSignature); - - - //* Get command line parameters - - printf("\r\n"); - if(argc<4) { - DisplayInfo(); - DoExit(0); - } - - baseFilename=argv[1]; - newFilename=argv[2]; - for(i=3; i=(baseBankCount+1) * BANK_SIZE) { - hasDriver=1; - } else { - printf("*** The base file has not the expected length. Expected either %iK (for base file without driver) or >=%iK (for file with driver).\r\n", - (baseBankCount * BANK_SIZE)/1024, - ((baseBankCount+1) * BANK_SIZE)/1024); - DoExit(1); - } - - - //* Check for the presence or absence of driver file, this depends on the base file size - - if(driverFilename!=NULL && hasDriver) { - printf("*** A driver file has been specified, but the base file appears to have a driver already.\r\n"); - DoExit(1); - } else if(driverFilename==NULL && !hasDriver) { - printf("*** No driver file has been specified, but the base file does not have driver.\r\n"); - DoExit(1); - } - - - //* Read the mapper code file, if specified; - // otherwise get the mapper code from the base file itself - - if(mapperFilename==NULL) { - fseek(baseFile, BANK_SIZE-MAPPER_CODE_SIZE, SEEK_SET); - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, baseFile); - if(readCount!=MAPPER_CODE_SIZE) { - printf("*** Can't read the mapper code from the base file\r\n"); - DoExit(1); - } - fseek(baseFile, 0, SEEK_SET); - } else { - mapperFile=fopen(mapperFilename, "rb"); - if(mapperFile==NULL) { - printf("*** Can't open mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(mapperFile)>MAPPER_CODE_SIZE) { - printf("*** The mapper code file has not the expected size (%i bytes)\r\n", MAPPER_CODE_SIZE); - DoExit(1); - } - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, mapperFile); - if(readCount==0) { - printf("*** Can't read the mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - safeClose(mapperFile); - } - - - //* Read the extra code file, if specified - - if(extraFilename!=NULL) { - extraFile=fopen(extraFilename, "rb"); - if(extraFile==NULL) { - printf("*** Can't open extra code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(extraFile)>EXTRA_CODE_SIZE) { - printf("*** The extra code file is too big, maximum allowed size is %i bytes\r\n", EXTRA_CODE_SIZE); - DoExit(1); - } - readCount=fread(extraCode, 1, EXTRA_CODE_SIZE, extraFile); - if(readCount==0) { - printf("*** Can't read the extra code file: %s", extraFilename); - DoExit(1); - } - safeClose(extraFile); - } - - - //* Open the driver file, if necessary, and check its signature - - if(driverFilename!=NULL) { - driverFile=fopen(driverFilename, "rb"); - if(driverFile==NULL) { - printf("*** Can't open driver file: %s\r\n", driverFilename); - DoExit(1); - } - if(GetFileSize(driverFile) [/d:] [/m:] [/e:]\r\n" - ); -} - -int GetFileSize(FILE* file) -{ - int pos; - int end; - - pos=ftell(file); - fseek(file, 0, SEEK_END); - end=ftell(file); - fseek(file,pos,SEEK_SET); - - return end; -} - -int IsParam(char* arg, char paramLetter) -{ - return arg[0]=='/' && ((arg[1] | 0x20) == (paramLetter | 0x20)) && arg[2]==':'; -} - -void DoExit(int code) -{ - safeClose(baseFile); - safeClose(newFile); - safeClose(driverFile); - safeClose(mapperFile); - safeClose(extraFile); - printf("\r\n"); - exit(code); -} \ No newline at end of file diff --git a/releases/alpha2/pcutils/.svn/text-base/mknexrom.exe.svn-base b/releases/alpha2/pcutils/.svn/text-base/mknexrom.exe.svn-base deleted file mode 100644 index f2089e8e..00000000 Binary files a/releases/alpha2/pcutils/.svn/text-base/mknexrom.exe.svn-base and /dev/null differ diff --git a/releases/alpha2/pcutils/mknexrom.c b/releases/alpha2/pcutils/mknexrom.c deleted file mode 100644 index c11aec0a..00000000 --- a/releases/alpha2/pcutils/mknexrom.c +++ /dev/null @@ -1,432 +0,0 @@ -/* MKNEXROM - Make a Nextor kernel ROM - By Konamiman, 5/2011 - - Usage: - mknexrom [/d:] [/m:] [/e:] - - This program creates a Nextor kernel ROM from a base file and a driver file, - as per the recipe specified in the driver development guide. It also allows modifying - an existing kernel ROM file, by changing the mapper code and/or adding extra content - in the free 1K areas present in the DOS 1 and DOS 2 main kernel banks. - - - can be: - - A kernel base file, that is, a file containing the code for the five kernel ROM banks and no driver; or - - A complete ROM file consisting of the kernel bank with the driver bank(s) already appended. - - - is the file containing the driver code. It must be a valid driver according - to the driver development guide. The contents of this file is expected to be as follows: - - 1. 256 dummy bytes. - 2. The driver signature (see the driver development guide) - 3. The driver jump table - 4. The driver code itself - - And optionally, if the driver is more than 16K long, for each additional 16K block: - - 5. 256 dummy bytes. - 6. The additional driver code or data. - 7. Dummy space up to 16K. - - The last block does not need to be 16K long. - - Specifying a driver file is mandarory if a base file without driver is specified in , - and prohibited if a complete ROM file is specified. - - - is the file containing the bank switching code. The following is required for this code: - - - When called, switches ing page 1 the ROM bank passed in A. - - Up to 48 bytes long. - - Runs at address 0x7FD0. - - May corrupt AF, must preserve all other registers. - - If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. - - - is the file containing the extra code or data for the resulting ROM file. This extra data - will be placed at DOS 1 and DOS 2 kernel main banks at address 0x3BD0, this means that this code or data - will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel - slot, at address 0x7BD0. - - The maximum size for the extra file is 1K. - -*/ - -/* v1.01 (4/2011): - BASE_BANK_COUNT changed from 5 to 6 - - v1.02 (4/2011): - BASE_BANK_COUNT changed from 6 to 7 - - v1.03 (4/2011): - BASE_BANK_COUNT no longer used, the value is read from the file (at position 0xFE) instead. - Driver signature searched changed to NEXTOR_DRIVER. -*/ - - -#include -#include -#include - -#define BANK_SIZE 16384 //Size of each ROM bank -//#define BASE_BANK_COUNT 7 //Number of kernel banks -#define BASE_BANK_COUNT_OFFSET 0xFE //Offset in the base file of number of kernel banks -#define DRIVER_BANK baseBankCount //Index of the first driver bank -#define MAPPER_CODE_SIZE 48 //Size of the bank change code -#define EXTRA_CODE_SIZE 1024 //Size of the extra code for banks 0 and 3 -#define EXTRA_ADDRESS 0x3BD0 //Address of the extra code -#define DRIVER_MIN_SIZE 0x172 //Minimum size of the disk driver -#define PAGE0_SIZE 256 //Size of the common page 0 code -#define DOS2_EXTRA_BANK 0 //Bank for the extra code in DOS 2 mode -#define DOS1_EXTRA_BANK 3 //Bank for the extra code in DOS 2 mode -#define DATABUFFER_SIZE sizeof(dataBuffer) - -#define safeClose(file) {if(file!=NULL) {fclose(file); file=NULL;}} - -void DisplayInfo(); -int GetFileSize(FILE* file); -int IsParam(char* arg, char paramLetteR); -void DoExit(int code); - -FILE* baseFile=NULL; -FILE* newFile=NULL; -FILE* driverFile=NULL; -FILE* mapperFile=NULL; -FILE* extraFile=NULL; - -int baseBankCount; - -int main(int argc, char* argv[]) -{ - int hasDriver; - int baseFileSize; - int readCount; - int writeCount; - int signatureLength; - int i; - unsigned short position; - - char* baseFilename=NULL; - char* newFilename=NULL; - char* driverFilename=NULL; - char* mapperFilename=NULL; - char* extraFilename=NULL; - - char* mapperCode[MAPPER_CODE_SIZE]; - char* extraCode[EXTRA_CODE_SIZE]; - char* dataBuffer[1024]; - - char* driverSignature="NEXTOR_DRIVER"; - signatureLength=strlen(driverSignature); - - - //* Get command line parameters - - printf("\r\n"); - if(argc<4) { - DisplayInfo(); - DoExit(0); - } - - baseFilename=argv[1]; - newFilename=argv[2]; - for(i=3; i=(baseBankCount+1) * BANK_SIZE) { - hasDriver=1; - } else { - printf("*** The base file has not the expected length. Expected either %iK (for base file without driver) or >=%iK (for file with driver).\r\n", - (baseBankCount * BANK_SIZE)/1024, - ((baseBankCount+1) * BANK_SIZE)/1024); - DoExit(1); - } - - - //* Check for the presence or absence of driver file, this depends on the base file size - - if(driverFilename!=NULL && hasDriver) { - printf("*** A driver file has been specified, but the base file appears to have a driver already.\r\n"); - DoExit(1); - } else if(driverFilename==NULL && !hasDriver) { - printf("*** No driver file has been specified, but the base file does not have driver.\r\n"); - DoExit(1); - } - - - //* Read the mapper code file, if specified; - // otherwise get the mapper code from the base file itself - - if(mapperFilename==NULL) { - fseek(baseFile, BANK_SIZE-MAPPER_CODE_SIZE, SEEK_SET); - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, baseFile); - if(readCount!=MAPPER_CODE_SIZE) { - printf("*** Can't read the mapper code from the base file\r\n"); - DoExit(1); - } - fseek(baseFile, 0, SEEK_SET); - } else { - mapperFile=fopen(mapperFilename, "rb"); - if(mapperFile==NULL) { - printf("*** Can't open mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(mapperFile)>MAPPER_CODE_SIZE) { - printf("*** The mapper code file has not the expected size (%i bytes)\r\n", MAPPER_CODE_SIZE); - DoExit(1); - } - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, mapperFile); - if(readCount==0) { - printf("*** Can't read the mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - safeClose(mapperFile); - } - - - //* Read the extra code file, if specified - - if(extraFilename!=NULL) { - extraFile=fopen(extraFilename, "rb"); - if(extraFile==NULL) { - printf("*** Can't open extra code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(extraFile)>EXTRA_CODE_SIZE) { - printf("*** The extra code file is too big, maximum allowed size is %i bytes\r\n", EXTRA_CODE_SIZE); - DoExit(1); - } - readCount=fread(extraCode, 1, EXTRA_CODE_SIZE, extraFile); - if(readCount==0) { - printf("*** Can't read the extra code file: %s", extraFilename); - DoExit(1); - } - safeClose(extraFile); - } - - - //* Open the driver file, if necessary, and check its signature - - if(driverFilename!=NULL) { - driverFile=fopen(driverFilename, "rb"); - if(driverFile==NULL) { - printf("*** Can't open driver file: %s\r\n", driverFilename); - DoExit(1); - } - if(GetFileSize(driverFile) [/d:] [/m:] [/e:]\r\n" - ); -} - -int GetFileSize(FILE* file) -{ - int pos; - int end; - - pos=ftell(file); - fseek(file, 0, SEEK_END); - end=ftell(file); - fseek(file,pos,SEEK_SET); - - return end; -} - -int IsParam(char* arg, char paramLetter) -{ - return arg[0]=='/' && ((arg[1] | 0x20) == (paramLetter | 0x20)) && arg[2]==':'; -} - -void DoExit(int code) -{ - safeClose(baseFile); - safeClose(newFile); - safeClose(driverFile); - safeClose(mapperFile); - safeClose(extraFile); - printf("\r\n"); - exit(code); -} \ No newline at end of file diff --git a/releases/alpha2/pcutils/mknexrom.exe b/releases/alpha2/pcutils/mknexrom.exe deleted file mode 100644 index f2089e8e..00000000 Binary files a/releases/alpha2/pcutils/mknexrom.exe and /dev/null differ diff --git a/releases/alpha2/tools/.svn/all-wcprops b/releases/alpha2/tools/.svn/all-wcprops deleted file mode 100644 index eaf4fa66..00000000 --- a/releases/alpha2/tools/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 60 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/tools -END -nextor-dsk.zip -K 25 -svn:wc:ra_dav:version-url -V 75 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/tools/nextor-dsk.zip -END -nextor.sys -K 25 -svn:wc:ra_dav:version-url -V 71 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/tools/nextor.sys -END -tools.lzh -K 25 -svn:wc:ra_dav:version-url -V 70 -/svn/msx2_MSXDOS250/!svn/ver/82/releases/alpha%201%20!/tools/tools.lzh -END diff --git a/releases/alpha2/tools/.svn/entries b/releases/alpha2/tools/.svn/entries deleted file mode 100644 index 9c93cd5e..00000000 --- a/releases/alpha2/tools/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -82 -http://svn.xp-dev.com/svn/msx2_MSXDOS250/releases/alpha%201%20!/tools -http://svn.xp-dev.com/svn/msx2_MSXDOS250 - - - -2011-07-06T16:47:10.817841Z -82 -konamiman - - - - - - - - - - - - - - -66fae3e2-2deb-47f9-a46c-3d3b0164802c - -nextor-dsk.zip -file - - - - -2011-06-27T14:52:40.946800Z -7552dd9710a396e9df2eadb3ebae9c08 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -30738 - -nextor.sys -file - - - - -2011-06-20T10:18:29.470600Z -fd154e505ad6eb78026b82797f5f1501 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -4595 - -tools.lzh -file - - - - -2011-06-27T15:45:22.000000Z -eac05e99429f58e4a5b7e34bb3e7efb4 -2011-07-06T16:47:10.817841Z -82 -konamiman -has-props - - - - - - - - - - - - - - - - - - - - -10426 - diff --git a/releases/alpha2/tools/.svn/prop-base/nextor-dsk.zip.svn-base b/releases/alpha2/tools/.svn/prop-base/nextor-dsk.zip.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/tools/.svn/prop-base/nextor-dsk.zip.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/tools/.svn/prop-base/nextor.sys.svn-base b/releases/alpha2/tools/.svn/prop-base/nextor.sys.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/tools/.svn/prop-base/nextor.sys.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/tools/.svn/prop-base/tools.lzh.svn-base b/releases/alpha2/tools/.svn/prop-base/tools.lzh.svn-base deleted file mode 100644 index 5e9587e6..00000000 --- a/releases/alpha2/tools/.svn/prop-base/tools.lzh.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/releases/alpha2/tools/.svn/text-base/nextor-dsk.zip.svn-base b/releases/alpha2/tools/.svn/text-base/nextor-dsk.zip.svn-base deleted file mode 100644 index 0ba67f8f..00000000 Binary files a/releases/alpha2/tools/.svn/text-base/nextor-dsk.zip.svn-base and /dev/null differ diff --git a/releases/alpha2/tools/.svn/text-base/nextor.sys.svn-base b/releases/alpha2/tools/.svn/text-base/nextor.sys.svn-base deleted file mode 100644 index faf4f9e2..00000000 Binary files a/releases/alpha2/tools/.svn/text-base/nextor.sys.svn-base and /dev/null differ diff --git a/releases/alpha2/tools/.svn/text-base/tools.lzh.svn-base b/releases/alpha2/tools/.svn/text-base/tools.lzh.svn-base deleted file mode 100644 index f2a389b6..00000000 Binary files a/releases/alpha2/tools/.svn/text-base/tools.lzh.svn-base and /dev/null differ diff --git a/releases/alpha2/tools/nextor-dsk.zip b/releases/alpha2/tools/nextor-dsk.zip deleted file mode 100644 index 0ba67f8f..00000000 Binary files a/releases/alpha2/tools/nextor-dsk.zip and /dev/null differ diff --git a/releases/alpha2/tools/nextor.sys b/releases/alpha2/tools/nextor.sys deleted file mode 100644 index faf4f9e2..00000000 Binary files a/releases/alpha2/tools/nextor.sys and /dev/null differ diff --git a/releases/alpha2/tools/tools.lzh b/releases/alpha2/tools/tools.lzh deleted file mode 100644 index f2a389b6..00000000 Binary files a/releases/alpha2/tools/tools.lzh and /dev/null differ diff --git a/releases/beta2/docs/DRIVER.ASM b/releases/beta2/docs/DRIVER.ASM deleted file mode 100644 index 407fa437..00000000 --- a/releases/beta2/docs/DRIVER.ASM +++ /dev/null @@ -1,649 +0,0 @@ - ; Dummy disk driver for Nextor 2.0 beta 2 - ; By Konamiman, 7/2013 - ; - ; This code can be used as the basis for developing - ; a real disk driver: just set DRV_TYPE appropriately, - ; change the driver name and version at DRV_NAME and VER_*, and - ; implement the required routines depending on the driver type. - ; - ; See the Nextor driver development guide for more details. - - ;org 4100h - - -DRV_START: - -;----------------------------------------------------------------------------- -; -; Miscellaneous constants -; - -;This is a 2 byte buffer to store the address of code to be executed. -;It is used by some of the kernel page 0 routines. - -CODE_ADD: equ 0F84Ch - - -;----------------------------------------------------------------------------- -; -; Driver configuration constants -; - -;Driver type: -; 0 for drive-based -; 1 for device-based - -DRV_TYPE equ 0 - - -;Driver version - -VER_MAIN equ 1 -VER_SEC equ 0 -VER_REV equ 0 - - -;----------------------------------------------------------------------------- -; -; Error codes for DEV_RW -; - -if DRV_TYPE eq 1 - -.NCOMP equ 0FFh -.WRERR equ 0FEh -.DISK equ 0FDh -.NRDY equ 0FCh -.DATA equ 0FAh -.RNF equ 0F9h -.WPROT equ 0F8h -.UFORM equ 0F7h -.SEEK equ 0F3h -.IFORM equ 0F0h -.IDEVL equ 0B5h -.IPARM equ 08Bh - -endif - - -;----------------------------------------------------------------------------- -; -; Routines and information available on kernel page 0 -; - -;* Get in A the current slot for page 1. Corrupts F. -; Must be called by using CALBNK to bank 0: -; xor a -; ld ix,GSLOT1 -; call CALBNK - -GSLOT1 equ 402Dh - - -;* This routine reads a byte from another bank. -; Must be called by using CALBNK to the desired bank, -; passing the address to be read in HL: -; ld a, -; ld hl, -; ld ix,RDBANK -; call CALBNK - -RDBANK equ 403Ch - - -;* This routine temporarily switches kernel main bank -; (usually bank 0, but will be 3 when running in MSX-DOS 1 mode), -; then invokes the routine whose address is at (CODE_ADD). -; It is necessary to use this routine to invoke CALBAS -; (so that kernel bank is correct in case of BASIC error) -; and to invoke DOS functions via F37Dh hook. -; -; Input: Address of code to invoke in (CODE_ADD). -; AF, BC, DE, HL, IX, IY passed to the called routine. -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALLB0 equ 403Fh - - -;* Call a routine in another bank. -; Must be used if the driver spawns across more than one bank. -; -; Input: A = bank number -; IX = routine address -; AF' = AF for the routine -; HL' = Ix for the routine -; BC, DE, HL, IY = input for the routine -; Output: AF, BC, DE, HL, IX, IY returned from the called routine. - -CALBNK equ 4042h - - -;* Get in IX the address of the SLTWRK entry for the slot passed in A, -; which will in turn contain a pointer to the allocated page 3 -; work area for that slot (0 if no work area was allocated). -; If A=0, then it uses the slot currently switched in page 1. -; Returns A=current slot for page 1, if A=0 was passed. -; Corrupts F. -; Must be called by using CALBNK to bank 0: -; ld a, (xor a for current page 1 slot) -; ex af,af' -; xor a -; ld ix,GWORK -; call CALBNK - -GWORK equ 4045h - - -;* This address contains one byte that tells how many banks -; form the Nextor kernel (or alternatively, the first bank -; number of the driver). - -K_SIZE equ 40FEh - - -;* This address contains one byte with the current bank number. - -CUR_BANK equ 40FFh - - -;----------------------------------------------------------------------------- -; -; Built-in format choice strings -; - -NULL_MSG equ 781Fh ;Null string (disk can't be formatted) -SING_DBL equ 7820h ;"1-Single side / 2-Double side" - - -;----------------------------------------------------------------------------- -; -; Driver signature -; - db "NEXTOR_DRIVER",0 - - -;----------------------------------------------------------------------------- -; -; Driver flags: -; bit 0: 0 for drive-based, 1 for device-based - -if DRV_TYPE eq 0 - db 0 -endif - -if DRV_TYPE eq 1 - db 1 -endif - - -;----------------------------------------------------------------------------- -; -; Reserved byte -; - - db 0 - - -;----------------------------------------------------------------------------- -; -; Driver name -; - -DRV_NAME: - db "Dummy driver" - ds 32-($-DRV_NAME)," " - - -;----------------------------------------------------------------------------- -; -; Jump table for the driver public routines -; - - ; These routines are mandatory for all drivers - ; (but probably you need to implement only DRV_INIT) - - jp DRV_TIMI - jp DRV_VERSION - jp DRV_INIT - jp DRV_BASSTAT - jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 - - ds 15 - -if DRV_TYPE eq 0 - - ; These routines are mandatory for drive-based drivers - - jp DRV_DSKIO - jp DRV_DSKCHG - jp DRV_GETDPB - jp DRV_CHOICE - jp DRV_DSKFMT - jp DRV_MTOFF -endif - -if DRV_TYPE eq 1 - - ; These routines are mandatory for device-based drivers - - jp DEV_RW - jp DEV_INFO - jp DEV_STATUS - jp LUN_INFO -endif - - -;===== -;===== END of data that must be at fixed addresses -;===== - - -;----------------------------------------------------------------------------- -; -; Timer interrupt routine, it will be called on each timer interrupt -; (at 50 or 60Hz), but only if DRV_INIT returns Cy=1 on its first execution. - -DRV_TIMI: - ret - - -;----------------------------------------------------------------------------- -; -; Driver initialization routine, it is called twice: -; -; 1) First execution, for information gathering. -; Input: -; A = 0 -; B = number of available drives -; HL = maximum size of allocatable work area in page 3 -; Output: -; A = number of required drives (for drive-based driver only) -; HL = size of required work area in page 3 -; Cy = 1 if DRV_TIMI must be hooked to the timer interrupt, 0 otherwise -; -; 2) Second execution, for work area and hardware initialization. -; Input: -; A = 1 -; B = number of allocated drives for this controller -; -; The work area address can be obtained by using GWORK. -; -; If first execution requests more work area than available, -; second execution will not be done and DRV_TIMI will not be hooked -; to the timer interrupt. -; -; If first execution requests more drives than available, -; as many drives as possible will be allocated, and the initialization -; procedure will continue the normal way -; (for drive-based drivers only. Device-based drivers always -; get two allocated drives.) - -DRV_INIT: - xor a - ld hl,0 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain driver version -; -; Input: - -; Output: A = Main version number -; B = Secondary version number -; C = Revision number - -DRV_VERSION: - ld a,VER_MAIN - ld b,VER_SEC - ld c,VER_REV - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded statement ("CALL") handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASSTAT: - scf - ret - - -;----------------------------------------------------------------------------- -; -; BASIC expanded device handler. -; Works the expected way, except that if invoking CALBAS is needed, -; it must be done via the CALLB0 routine in kernel page 0. - -DRV_BASDEV: - scf - ret - - -;----------------------------------------------------------------------------- -; -; Extended BIOS hook. -; Works the expected way, except that it must return -; D'=1 if the old hook must be called, D'=0 otherwise. -; It is entered with D'=1. - -DRV_EXTBIO: - ret - - -;----------------------------------------------------------------------------- -; -; Direct calls entry points. -; Calls to addresses 7850h, 7853h, 7856h, 7859h and 785Ch -; in kernel banks 0 and 3 will be redirected -; to DIRECT0/1/2/3/4 respectively. -; Receives all register data from the caller except IX and AF'. - -DRV_DIRECT0: -DRV_DIRECT1: -DRV_DIRECT2: -DRV_DIRECT3: -DRV_DIRECT4: - ret - - -;===== -;===== BEGIN of DRIVE-BASED specific routines -;===== - -if DRV_TYPE eq 0 - -;----------------------------------------------------------------------------- -; -; Read/write disk sectors -; -;Input: A = Drive number, starting at 0 -; Cy = 0 for reading sectors, 1 for writing sectors -; B = Number of sectors to read/write -; C = First sector number to read/write (bits 22-16) if bit 7 = 0 -; Media ID if bit 7 = 1 -; DE = First sector number to read/write (bits 15-0) -; HL = source/destination address for the transfer -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Other errors -; B = Number of sectors actually read (in case of error only) - -DRV_DSKIO: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get disk change status -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only) -; Same codes as DRV_DSKIO -; B = Disk status (on success only) -; 1 Disk not changed -; 0 Unknown -; -1 Disk changed - -DRV_DSKCHG: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Get DPB for disk -; -;Input: A = Drive number, starting at 0 -; B = C = Media descriptor -; HL = Base address for DPB -1 -;Output: - - -DRV_GETDPB: - ld a,12 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Return format choice string -; -;Input: - -;Output: HL = Address of the choice string in the kernel slot - -DRV_CHOICE: - ld hl,NULL_MSG - ret - - -;----------------------------------------------------------------------------- -; -; Format a disk -; -;Input: A = Formatting choice, from 1 to 9 (see DRV_CHOICE). -; D = Drive number, starting at 0 -; HL = Address of work area in memory -; DE = Size of work area -;Output: Cy = 0 on success, 1 on error -; A = Error code (on error only): -; 0 Write protected -; 2 Not ready -; 4 Data (CRC) error -; 6 Seek error -; 8 Record not found -; 10 Write fault -; 12 Bad parameter -; 14 Insufficient memory -; 16 Other errors - -DRV_DSKFMT: - ld a,16 - scf - ret - - -;----------------------------------------------------------------------------- -; -; Turn off the floppy disk drive motor -; -;Input: - -;Output: - - -DRV_MTOFF: - ret - -endif - - -;===== -;===== END of DRIVE-BASED specific routines -;===== - - -;===== -;===== BEGIN of DEVICE-BASED specific routines -;===== - -if DRV_TYPE eq 1 - -;----------------------------------------------------------------------------- -; -; Read or write logical sectors from/to a logical unit -; -;Input: Cy=0 to read, 1 to write -; A = Device number, 1 to 7 -; B = Number of sectors to read or write -; C = Logical unit number, 1 to 7 -; HL = Source or destination memory address for the transfer -; DE = Address where the 4 byte sector number is stored. -;Output: A = Error code (the same codes of MSX-DOS are used): -; 0: Ok -; .IDEVL: Invalid device or LUN -; .NRDY: Not ready -; .DISK: General unknown disk error -; .DATA: CRC error when reading -; .RNF: Sector not found -; .UFORM: Unformatted disk -; .WPROT: Write protected media, or read-only logical unit -; .WRERR: Write error -; .NCOMP: Incompatible disk. -; .SEEK: Seek error. - B = Number of sectors actually read (in case of error only) - -DEV_RW: - ld a,.NRDY - ld b,0 - ret - - -;----------------------------------------------------------------------------- -; -; Device information gathering -; -;Input: A = Device index, 1 to 7 -; B = Information to return: -; 0: Basic information -; 1: Manufacturer name string -; 2: Device name string -; 3: Serial number string -; HL = Pointer to a buffer in RAM -;Output: A = Error code: -; 0: Ok -; 1: Device not available or invalid device index -; 2: Information not available, or invalid information index -; When basic information is requested, -; buffer filled with the following information: -; -;+0 (1): Numer of logical units, from 1 to 7. 1 if the device has no logical -; units (which is functionally equivalent to having only one). -;+1 (1): Device flags, always zero in Beta 2. -; -; The strings must be printable ASCII string (ASCII codes 32 to 126), -; left justified and padded with spaces. All the strings are optional, -; if not available, an error must be returned. -; If a string is provided by the device in binary format, it must be reported -; as an hexadecimal, upper-cased string, preceded by the prefix "0x". -; The maximum length for a string is 64 characters; -; if the string is actually longer, the leftmost 64 characters -; should be provided. -; -; In the case of the serial number string, the same rules for the strings -; apply, except that it must be provided right-justified, -; and if it is too long, the rightmost characters must be -; provided, not the leftmost. - -DEV_INFO: - ld a,1 - ret - - -;----------------------------------------------------------------------------- -; -; Obtain device status -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; 0 to return the status of the device itself. -;Output: A = Status for the specified logical unit, -; or for the whole device if 0 was specified: -; 0: The device or logical unit is not available, or the -; device or logical unit number supplied is invalid. -; 1: The device or logical unit is available and has not -; changed since the last status request. -; 2: The device or logical unit is available and has changed -; since the last status request -; (for devices, the device has been unplugged and a -; different device has been plugged which has been -; assigned the same device index; for logical units, -; the media has been changed). -; 3: The device or logical unit is available, but it is not -; possible to determine whether it has been changed -; or not since the last status request. -; -; Devices not supporting hot-plugging must always return status value 1. -; Non removable logical units may return values 0 and 1. -; -; The returned status is always relative to the previous invokation of -; DEV_STATUS itself. Please read the Driver Developer Guide for more info. - -DEV_STATUS: - xor a - ret - - -;----------------------------------------------------------------------------- -; -; Obtain logical unit information -; -;Input: A = Device index, 1 to 7 -; B = Logical unit number, 1 to 7 -; HL = Pointer to buffer in RAM. -;Output: A = 0: Ok, buffer filled with information. -; 1: Error, device or logical unit not available, -; or device index or logical unit number invalid. -; On success, buffer filled with the following information: -; -;+0 (1): Medium type: -; 0: Block device -; 1: CD or DVD reader or recorder -; 2-254: Unused. Additional codes may be defined in the future. -; 255: Other -;+1 (2): Sector size, 0 if this information does not apply or is -; not available. -;+3 (4): Total number of available sectors. -; 0 if this information does not apply or is not available. -;+7 (1): Flags: -; bit 0: 1 if the medium is removable. -; bit 1: 1 if the medium is read only. A medium that can dinamically -; be write protected or write enabled is not considered -; to be read-only. -; bit 2: 1 if the LUN is a floppy disk drive. -;+8 (2): Number of cylinders -;+10 (1): Number of heads -;+11 (1): Number of sectors per track -; -; Number of cylinders, heads and sectors apply to hard disks only. -; For other types of device, these fields must be zero. - -LUN_INFO: - ld a,1 - ret - -endif - - -;===== -;===== END of DEVICE-BASED specific routines -;===== - - -;----------------------------------------------------------------------------- -; -; End of the driver code - -DRV_END: - - ;ds 3FD0h-(DRV_END-DRV_START) - - end diff --git a/releases/beta2/docs/Nextor 2.0 Beta 2 Driver Development Guide.pdf b/releases/beta2/docs/Nextor 2.0 Beta 2 Driver Development Guide.pdf deleted file mode 100644 index a61eb4de..00000000 Binary files a/releases/beta2/docs/Nextor 2.0 Beta 2 Driver Development Guide.pdf and /dev/null differ diff --git a/releases/beta2/docs/Nextor 2.0 Beta 2 Getting Started Guide.pdf b/releases/beta2/docs/Nextor 2.0 Beta 2 Getting Started Guide.pdf deleted file mode 100644 index ef0ca43d..00000000 Binary files a/releases/beta2/docs/Nextor 2.0 Beta 2 Getting Started Guide.pdf and /dev/null differ diff --git a/releases/beta2/docs/Nextor 2.0 Beta 2 Programmers Reference.pdf b/releases/beta2/docs/Nextor 2.0 Beta 2 Programmers Reference.pdf deleted file mode 100644 index eb7f5f52..00000000 Binary files a/releases/beta2/docs/Nextor 2.0 Beta 2 Programmers Reference.pdf and /dev/null differ diff --git a/releases/beta2/docs/Nextor 2.0 Beta 2 User Manual.pdf b/releases/beta2/docs/Nextor 2.0 Beta 2 User Manual.pdf deleted file mode 100644 index 437c3aa8..00000000 Binary files a/releases/beta2/docs/Nextor 2.0 Beta 2 User Manual.pdf and /dev/null differ diff --git a/releases/beta2/kernels/Nextor-2.0-beta2.MegaFlashSDSCC.ROM b/releases/beta2/kernels/Nextor-2.0-beta2.MegaFlashSDSCC.ROM deleted file mode 100644 index 67a13ce3..00000000 Binary files a/releases/beta2/kernels/Nextor-2.0-beta2.MegaFlashSDSCC.ROM and /dev/null differ diff --git a/releases/beta2/kernels/Nextor-2.0-beta2.MegaFlashSDSCC.Recovery.ROM b/releases/beta2/kernels/Nextor-2.0-beta2.MegaFlashSDSCC.Recovery.ROM deleted file mode 100644 index 5760a3b7..00000000 Binary files a/releases/beta2/kernels/Nextor-2.0-beta2.MegaFlashSDSCC.Recovery.ROM and /dev/null differ diff --git a/releases/beta2/kernels/Nextor-2.0-beta2.StandaloneASCII16.ROM b/releases/beta2/kernels/Nextor-2.0-beta2.StandaloneASCII16.ROM deleted file mode 100644 index d7d63ed6..00000000 Binary files a/releases/beta2/kernels/Nextor-2.0-beta2.StandaloneASCII16.ROM and /dev/null differ diff --git a/releases/beta2/kernels/Nextor-2.0-beta2.StandaloneASCII8.ROM b/releases/beta2/kernels/Nextor-2.0-beta2.StandaloneASCII8.ROM deleted file mode 100644 index 40cc1bfa..00000000 Binary files a/releases/beta2/kernels/Nextor-2.0-beta2.StandaloneASCII8.ROM and /dev/null differ diff --git a/releases/beta2/kernels/Nextor-2.0-beta2.SunriseIDE.ROM b/releases/beta2/kernels/Nextor-2.0-beta2.SunriseIDE.ROM deleted file mode 100644 index d76c033f..00000000 Binary files a/releases/beta2/kernels/Nextor-2.0-beta2.SunriseIDE.ROM and /dev/null differ diff --git a/releases/beta2/kernels/Nextor-2.0-beta2.base.dat b/releases/beta2/kernels/Nextor-2.0-beta2.base.dat deleted file mode 100644 index 2305725a..00000000 Binary files a/releases/beta2/kernels/Nextor-2.0-beta2.base.dat and /dev/null differ diff --git a/releases/beta2/pcutils/mknexrom.c b/releases/beta2/pcutils/mknexrom.c deleted file mode 100644 index be893b37..00000000 --- a/releases/beta2/pcutils/mknexrom.c +++ /dev/null @@ -1,436 +0,0 @@ -/* MKNEXROM - Make a Nextor kernel ROM - By Konamiman, 5/2011 - - Usage: - mknexrom [/d:] [/m:] [/e:] - - This program creates a Nextor kernel ROM from a base file and a driver file, - as per the recipe specified in the driver development guide. It also allows modifying - an existing kernel ROM file, by changing the mapper code and/or adding extra content - in the free 1K areas present in the DOS 1 and DOS 2 main kernel banks. - - - can be: - - A kernel base file, that is, a file containing the code for the five kernel ROM banks and no driver; or - - A complete ROM file consisting of the kernel bank with the driver bank(s) already appended. - - - is the file containing the driver code. It must be a valid driver according - to the driver development guide. The contents of this file is expected to be as follows: - - 1. 256 dummy bytes. - 2. The driver signature (see the driver development guide) - 3. The driver jump table - 4. The driver code itself - - And optionally, if the driver is more than 16K long, for each additional 16K block: - - 5. 256 dummy bytes. - 6. The additional driver code or data. - 7. Dummy space up to 16K. - - The last block does not need to be 16K long. - - Specifying a driver file is mandarory if a base file without driver is specified in , - and prohibited if a complete ROM file is specified. - - - is the file containing the bank switching code. The following is required for this code: - - - When called, switches ing page 1 the ROM bank passed in A. - - Up to 48 bytes long. - - Runs at address 0x7FD0. - - May corrupt AF, must preserve all other registers. - - If no mapper file is specified, the mapper code from the base file itself is appended to the driver code. - - - is the file containing the extra code or data for the resulting ROM file. This extra data - will be placed at DOS 1 and DOS 2 kernel main banks at address 0x3BD0, this means that this code or data - will be visible to applications via standard inter-slot calls (such as RDSLT or CALSLT) to the kernel - slot, at address 0x7BD0. - - The maximum size for the extra file is 1K. - -*/ - -/* v1.01 (4/2011): - BASE_BANK_COUNT changed from 5 to 6 - - v1.02 (4/2011): - BASE_BANK_COUNT changed from 6 to 7 - - v1.03 (4/2011): - BASE_BANK_COUNT no longer used, the value is read from the file (at position 0xFE) instead. - Driver signature searched changed to NEXTOR_DRIVER. - - v1.04 (8/2011): - The address for the mapper code embedded in the initialization code is no longer - calculated from the startup address. Instead, it is now at a fixed position - (MAPPER_INIT_CODE_ADDRESS). - -*/ - - -#include -#include -#include - -#define BANK_SIZE 16384 //Size of each ROM bank -//#define BASE_BANK_COUNT 7 //Number of kernel banks -#define BASE_BANK_COUNT_OFFSET 0xFE //Offset in the base file of number of kernel banks -#define DRIVER_BANK baseBankCount //Index of the first driver bank -#define MAPPER_CODE_SIZE 48 //Size of the bank change code -#define EXTRA_CODE_SIZE 1024 //Size of the extra code for banks 0 and 3 -#define EXTRA_ADDRESS 0x3BD0 //Address of the extra code -#define DRIVER_MIN_SIZE 0x172 //Minimum size of the disk driver -#define PAGE0_SIZE 256 //Size of the common page 0 code -#define DOS2_EXTRA_BANK 0 //Bank for the extra code in DOS 2 mode -#define DOS1_EXTRA_BANK 3 //Bank for the extra code in DOS 2 mode -#define DATABUFFER_SIZE sizeof(dataBuffer) -#define MAPPER_INIT_CODE_ADDRESS 0x07DC - -#define safeClose(file) {if(file!=NULL) {fclose(file); file=NULL;}} - -void DisplayInfo(); -int GetFileSize(FILE* file); -int IsParam(char* arg, char paramLetteR); -void DoExit(int code); - -FILE* baseFile=NULL; -FILE* newFile=NULL; -FILE* driverFile=NULL; -FILE* mapperFile=NULL; -FILE* extraFile=NULL; - -int baseBankCount; - -int main(int argc, char* argv[]) -{ - int hasDriver; - int baseFileSize; - int readCount; - int writeCount; - int signatureLength; - int i; - unsigned short position; - - char* baseFilename=NULL; - char* newFilename=NULL; - char* driverFilename=NULL; - char* mapperFilename=NULL; - char* extraFilename=NULL; - - char* mapperCode[MAPPER_CODE_SIZE]; - char* extraCode[EXTRA_CODE_SIZE]; - char* dataBuffer[1024]; - - char* driverSignature="NEXTOR_DRIVER"; - signatureLength=strlen(driverSignature); - - - //* Get command line parameters - - printf("\r\n"); - if(argc<4) { - DisplayInfo(); - DoExit(0); - } - - baseFilename=argv[1]; - newFilename=argv[2]; - for(i=3; i=(baseBankCount+1) * BANK_SIZE) { - hasDriver=1; - } else { - printf("*** The base file has not the expected length. Expected either %iK (for base file without driver) or >=%iK (for file with driver).\r\n", - (baseBankCount * BANK_SIZE)/1024, - ((baseBankCount+1) * BANK_SIZE)/1024); - DoExit(1); - } - - - //* Check for the presence or absence of driver file, this depends on the base file size - - if(driverFilename!=NULL && hasDriver) { - printf("*** A driver file has been specified, but the base file appears to have a driver already.\r\n"); - DoExit(1); - } else if(driverFilename==NULL && !hasDriver) { - printf("*** No driver file has been specified, but the base file does not have driver.\r\n"); - DoExit(1); - } - - - //* Read the mapper code file, if specified; - // otherwise get the mapper code from the base file itself - - if(mapperFilename==NULL) { - fseek(baseFile, BANK_SIZE-MAPPER_CODE_SIZE, SEEK_SET); - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, baseFile); - if(readCount!=MAPPER_CODE_SIZE) { - printf("*** Can't read the mapper code from the base file\r\n"); - DoExit(1); - } - fseek(baseFile, 0, SEEK_SET); - } else { - mapperFile=fopen(mapperFilename, "rb"); - if(mapperFile==NULL) { - printf("*** Can't open mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(mapperFile)>MAPPER_CODE_SIZE) { - printf("*** The mapper code file has not the expected size (%i bytes)\r\n", MAPPER_CODE_SIZE); - DoExit(1); - } - readCount=fread(mapperCode, 1, MAPPER_CODE_SIZE, mapperFile); - if(readCount==0) { - printf("*** Can't read the mapper code file: %s\r\n", mapperFilename); - DoExit(1); - } - safeClose(mapperFile); - } - - - //* Read the extra code file, if specified - - if(extraFilename!=NULL) { - extraFile=fopen(extraFilename, "rb"); - if(extraFile==NULL) { - printf("*** Can't open extra code file: %s\r\n", mapperFilename); - DoExit(1); - } - if(GetFileSize(extraFile)>EXTRA_CODE_SIZE) { - printf("*** The extra code file is too big, maximum allowed size is %i bytes\r\n", EXTRA_CODE_SIZE); - DoExit(1); - } - readCount=fread(extraCode, 1, EXTRA_CODE_SIZE, extraFile); - if(readCount==0) { - printf("*** Can't read the extra code file: %s", extraFilename); - DoExit(1); - } - safeClose(extraFile); - } - - - //* Open the driver file, if necessary, and check its signature - - if(driverFilename!=NULL) { - driverFile=fopen(driverFilename, "rb"); - if(driverFile==NULL) { - printf("*** Can't open driver file: %s\r\n", driverFilename); - DoExit(1); - } - if(GetFileSize(driverFile) [/d:] [/m:] [/e:]\r\n" - ); -} - -int GetFileSize(FILE* file) -{ - int pos; - int end; - - pos=ftell(file); - fseek(file, 0, SEEK_END); - end=ftell(file); - fseek(file,pos,SEEK_SET); - - return end; -} - -int IsParam(char* arg, char paramLetter) -{ - return arg[0]=='/' && ((arg[1] | 0x20) == (paramLetter | 0x20)) && arg[2]==':'; -} - -void DoExit(int code) -{ - safeClose(baseFile); - safeClose(newFile); - safeClose(driverFile); - safeClose(mapperFile); - safeClose(extraFile); - printf("\r\n"); - exit(code); -} \ No newline at end of file diff --git a/releases/beta2/pcutils/mknexrom.exe b/releases/beta2/pcutils/mknexrom.exe deleted file mode 100644 index baa3a07e..00000000 Binary files a/releases/beta2/pcutils/mknexrom.exe and /dev/null differ diff --git a/releases/beta2/tools/nextor-dsk.zip b/releases/beta2/tools/nextor-dsk.zip deleted file mode 100644 index f3d2fc50..00000000 Binary files a/releases/beta2/tools/nextor-dsk.zip and /dev/null differ diff --git a/releases/beta2/tools/nextor.dsk b/releases/beta2/tools/nextor.dsk deleted file mode 100644 index 7a8145f8..00000000 Binary files a/releases/beta2/tools/nextor.dsk and /dev/null differ diff --git a/releases/beta2/tools/nextor.sys b/releases/beta2/tools/nextor.sys deleted file mode 100644 index 2f6e4922..00000000 Binary files a/releases/beta2/tools/nextor.sys and /dev/null differ diff --git a/releases/beta2/tools/tools.lzh b/releases/beta2/tools/tools.lzh deleted file mode 100644 index 79207bcf..00000000 Binary files a/releases/beta2/tools/tools.lzh and /dev/null differ diff --git a/releases/beta2/tools/tools.zip b/releases/beta2/tools/tools.zip deleted file mode 100644 index 4c6bfd1c..00000000 Binary files a/releases/beta2/tools/tools.zip and /dev/null differ diff --git a/source/command25/MASTER.tar b/source/command/MASTER.tar similarity index 100% rename from source/command25/MASTER.tar rename to source/command/MASTER.tar diff --git a/source/command25/MEMO/command.ref b/source/command/MEMO/command.ref similarity index 100% rename from source/command25/MEMO/command.ref rename to source/command/MEMO/command.ref diff --git a/source/command25/MEMO/command.xrf b/source/command/MEMO/command.xrf similarity index 100% rename from source/command25/MEMO/command.xrf rename to source/command/MEMO/command.xrf diff --git a/source/command25/MEMO/msxdos.ref b/source/command/MEMO/msxdos.ref similarity index 100% rename from source/command25/MEMO/msxdos.ref rename to source/command/MEMO/msxdos.ref diff --git a/source/command25/Makefile b/source/command/Makefile similarity index 100% rename from source/command25/Makefile rename to source/command/Makefile diff --git a/source/command25/Makefile.def b/source/command/Makefile.def similarity index 100% rename from source/command25/Makefile.def rename to source/command/Makefile.def diff --git a/source/command25/Makefile.sys b/source/command/Makefile.sys similarity index 100% rename from source/command25/Makefile.sys rename to source/command/Makefile.sys diff --git a/source/command25/Makefile.utl b/source/command/Makefile.utl similarity index 100% rename from source/command25/Makefile.utl rename to source/command/Makefile.utl diff --git a/source/command25/chkdsk/chkdsk.com b/source/command/chkdsk/chkdsk.com similarity index 100% rename from source/command25/chkdsk/chkdsk.com rename to source/command/chkdsk/chkdsk.com diff --git a/source/command25/chkdsk/const.inc b/source/command/chkdsk/const.inc similarity index 100% rename from source/command25/chkdsk/const.inc rename to source/command/chkdsk/const.inc diff --git a/source/command25/chkdsk/dir.mac b/source/command/chkdsk/dir.mac similarity index 100% rename from source/command25/chkdsk/dir.mac rename to source/command/chkdsk/dir.mac diff --git a/source/command25/chkdsk/end.mac b/source/command/chkdsk/end.mac similarity index 100% rename from source/command25/chkdsk/end.mac rename to source/command/chkdsk/end.mac diff --git a/source/command25/chkdsk/jtext.mac b/source/command/chkdsk/jtext.mac similarity index 100% rename from source/command25/chkdsk/jtext.mac rename to source/command/chkdsk/jtext.mac diff --git a/source/command25/chkdsk/macros.inc b/source/command/chkdsk/macros.inc similarity index 100% rename from source/command25/chkdsk/macros.inc rename to source/command/chkdsk/macros.inc diff --git a/source/command25/chkdsk/main.mac b/source/command/chkdsk/main.mac similarity index 100% rename from source/command25/chkdsk/main.mac rename to source/command/chkdsk/main.mac diff --git a/source/command25/chkdsk/misc.mac b/source/command/chkdsk/misc.mac similarity index 100% rename from source/command25/chkdsk/misc.mac rename to source/command/chkdsk/misc.mac diff --git a/source/command25/chkdsk/nodebug.mac b/source/command/chkdsk/nodebug.mac similarity index 100% rename from source/command25/chkdsk/nodebug.mac rename to source/command/chkdsk/nodebug.mac diff --git a/source/command25/chkdsk/text.mac b/source/command/chkdsk/text.mac similarity index 100% rename from source/command25/chkdsk/text.mac rename to source/command/chkdsk/text.mac diff --git a/source/command25/chkdsk/var.mac b/source/command/chkdsk/var.mac similarity index 100% rename from source/command25/chkdsk/var.mac rename to source/command/chkdsk/var.mac diff --git a/source/command25/clibmath.mac b/source/command/clibmath.mac similarity index 100% rename from source/command25/clibmath.mac rename to source/command/clibmath.mac diff --git a/source/command25/command/WIP.txt b/source/command/command/WIP.txt similarity index 100% rename from source/command25/command/WIP.txt rename to source/command/command/WIP.txt diff --git a/source/command25/command/cli.mac b/source/command/command/cli.mac similarity index 100% rename from source/command25/command/cli.mac rename to source/command/command/cli.mac diff --git a/source/command25/command/cmd.mac b/source/command/command/cmd.mac similarity index 100% rename from source/command25/command/cmd.mac rename to source/command/command/cmd.mac diff --git a/source/command25/command/command.inc b/source/command/command/command.inc similarity index 100% rename from source/command25/command/command.inc rename to source/command/command/command.inc diff --git a/source/command25/command/command2.com b/source/command/command/command2.com similarity index 100% rename from source/command25/command/command2.com rename to source/command/command/command2.com diff --git a/source/command25/command/copy.mac b/source/command/command/copy.mac similarity index 100% rename from source/command25/command/copy.mac rename to source/command/command/copy.mac diff --git a/source/command25/command/dirs.mac b/source/command/command/dirs.mac similarity index 100% rename from source/command25/command/dirs.mac rename to source/command/command/dirs.mac diff --git a/source/command25/command/files.mac b/source/command/command/files.mac similarity index 100% rename from source/command25/command/files.mac rename to source/command/command/files.mac diff --git a/source/command25/command/io.mac b/source/command/command/io.mac similarity index 100% rename from source/command25/command/io.mac rename to source/command/command/io.mac diff --git a/source/command25/command/jtext.mac b/source/command/command/jtext.mac similarity index 100% rename from source/command25/command/jtext.mac rename to source/command/command/jtext.mac diff --git a/source/command25/command/messages.mac b/source/command/command/messages.mac similarity index 100% rename from source/command25/command/messages.mac rename to source/command/command/messages.mac diff --git a/source/command25/command/misc.mac b/source/command/command/misc.mac similarity index 100% rename from source/command25/command/misc.mac rename to source/command/command/misc.mac diff --git a/source/command25/command/start.mac b/source/command/command/start.mac similarity index 100% rename from source/command25/command/start.mac rename to source/command/command/start.mac diff --git a/source/command25/command/var.mac b/source/command/command/var.mac similarity index 100% rename from source/command25/command/var.mac rename to source/command/command/var.mac diff --git a/source/command25/command/ver.mac b/source/command/command/ver.mac similarity index 100% rename from source/command25/command/ver.mac rename to source/command/command/ver.mac diff --git a/source/command25/diskcopy/dcopy.c b/source/command/diskcopy/dcopy.c similarity index 100% rename from source/command25/diskcopy/dcopy.c rename to source/command/diskcopy/dcopy.c diff --git a/source/command25/diskcopy/diskcopy.com b/source/command/diskcopy/diskcopy.com similarity index 100% rename from source/command25/diskcopy/diskcopy.com rename to source/command/diskcopy/diskcopy.com diff --git a/source/command25/diskcopy/jtext.mac b/source/command/diskcopy/jtext.mac similarity index 100% rename from source/command25/diskcopy/jtext.mac rename to source/command/diskcopy/jtext.mac diff --git a/source/command25/diskcopy/text.mac b/source/command/diskcopy/text.mac similarity index 100% rename from source/command25/diskcopy/text.mac rename to source/command/diskcopy/text.mac diff --git a/source/command25/diskcopy/ttab.mac b/source/command/diskcopy/ttab.mac similarity index 100% rename from source/command25/diskcopy/ttab.mac rename to source/command/diskcopy/ttab.mac diff --git a/source/command25/fixdisk/end.mac b/source/command/fixdisk/end.mac similarity index 100% rename from source/command25/fixdisk/end.mac rename to source/command/fixdisk/end.mac diff --git a/source/command25/fixdisk/fixdisk.com b/source/command/fixdisk/fixdisk.com similarity index 100% rename from source/command25/fixdisk/fixdisk.com rename to source/command/fixdisk/fixdisk.com diff --git a/source/command25/fixdisk/fixdisk.mac b/source/command/fixdisk/fixdisk.mac similarity index 100% rename from source/command25/fixdisk/fixdisk.mac rename to source/command/fixdisk/fixdisk.mac diff --git a/source/command25/fixdisk/jtext.mac b/source/command/fixdisk/jtext.mac similarity index 100% rename from source/command25/fixdisk/jtext.mac rename to source/command/fixdisk/jtext.mac diff --git a/source/command25/fixdisk/text.mac b/source/command/fixdisk/text.mac similarity index 100% rename from source/command25/fixdisk/text.mac rename to source/command/fixdisk/text.mac diff --git a/source/command25/kmode/end.mac b/source/command/kmode/end.mac similarity index 100% rename from source/command25/kmode/end.mac rename to source/command/kmode/end.mac diff --git a/source/command25/kmode/kmode.com b/source/command/kmode/kmode.com similarity index 100% rename from source/command25/kmode/kmode.com rename to source/command/kmode/kmode.com diff --git a/source/command25/kmode/kmode.mac b/source/command/kmode/kmode.mac similarity index 100% rename from source/command25/kmode/kmode.mac rename to source/command/kmode/kmode.mac diff --git a/source/command25/kmode/text.mac b/source/command/kmode/text.mac similarity index 100% rename from source/command25/kmode/text.mac rename to source/command/kmode/text.mac diff --git a/source/command25/loader/endload.mac b/source/command/loader/endload.mac similarity index 100% rename from source/command25/loader/endload.mac rename to source/command/loader/endload.mac diff --git a/source/command25/loader/loader.mac b/source/command/loader/loader.mac similarity index 100% rename from source/command25/loader/loader.mac rename to source/command/loader/loader.mac diff --git a/source/command25/loader/msxdos.sys b/source/command/loader/msxdos.sys similarity index 100% rename from source/command25/loader/msxdos.sys rename to source/command/loader/msxdos.sys diff --git a/releases/2.0 final/tools/source/CPM32.EXE b/source/command/msxdos/CPM32.EXE similarity index 100% rename from releases/2.0 final/tools/source/CPM32.EXE rename to source/command/msxdos/CPM32.EXE diff --git a/releases/2.0 final/tools/source/L80.CPM b/source/command/msxdos/L80.CPM similarity index 100% rename from releases/2.0 final/tools/source/L80.CPM rename to source/command/msxdos/L80.CPM diff --git a/releases/2.0 final/tools/source/LIB80.CPM b/source/command/msxdos/LIB80.CPM similarity index 100% rename from releases/2.0 final/tools/source/LIB80.CPM rename to source/command/msxdos/LIB80.CPM diff --git a/releases/2.0 final/tools/source/M80.CPM b/source/command/msxdos/M80.CPM similarity index 100% rename from releases/2.0 final/tools/source/M80.CPM rename to source/command/msxdos/M80.CPM diff --git a/source/command25/msxdos/MSXDOS2.SYS b/source/command/msxdos/MSXDOS2.SYS similarity index 100% rename from source/command25/msxdos/MSXDOS2.SYS rename to source/command/msxdos/MSXDOS2.SYS diff --git a/source/command25/msxdos/compile.bat b/source/command/msxdos/compile.bat similarity index 100% rename from source/command25/msxdos/compile.bat rename to source/command/msxdos/compile.bat diff --git a/source/command25/msxdos/end.mac b/source/command/msxdos/end.mac similarity index 100% rename from source/command25/msxdos/end.mac rename to source/command/msxdos/end.mac diff --git a/source/command25/msxdos/kmsg.mac b/source/command/msxdos/kmsg.mac similarity index 100% rename from source/command25/msxdos/kmsg.mac rename to source/command/msxdos/kmsg.mac diff --git a/source/command25/msxdos/messages.mac b/source/command/msxdos/messages.mac similarity index 100% rename from source/command25/msxdos/messages.mac rename to source/command/msxdos/messages.mac diff --git a/source/command25/msxdos/nokmsg.mac b/source/command/msxdos/nokmsg.mac similarity index 100% rename from source/command25/msxdos/nokmsg.mac rename to source/command/msxdos/nokmsg.mac diff --git a/source/command25/msxdos/real.mac b/source/command/msxdos/real.mac similarity index 100% rename from source/command25/msxdos/real.mac rename to source/command/msxdos/real.mac diff --git a/source/command25/msxdos/ref.mac b/source/command/msxdos/ref.mac similarity index 100% rename from source/command25/msxdos/ref.mac rename to source/command/msxdos/ref.mac diff --git a/source/command25/msxdos/reloc.mac b/source/command/msxdos/reloc.mac similarity index 100% rename from source/command25/msxdos/reloc.mac rename to source/command/msxdos/reloc.mac diff --git a/source/command25/msxdos/sys.mac b/source/command/msxdos/sys.mac similarity index 100% rename from source/command25/msxdos/sys.mac rename to source/command/msxdos/sys.mac diff --git a/source/command25/msxdos/ver.mac b/source/command/msxdos/ver.mac similarity index 100% rename from source/command25/msxdos/ver.mac rename to source/command/msxdos/ver.mac diff --git a/source/command25/msxdos/yeskmsg.mac b/source/command/msxdos/yeskmsg.mac similarity index 100% rename from source/command25/msxdos/yeskmsg.mac rename to source/command/msxdos/yeskmsg.mac diff --git a/source/command25/msxlib.c b/source/command/msxlib.c similarity index 100% rename from source/command25/msxlib.c rename to source/command/msxlib.c diff --git a/source/command25/undel/const.inc b/source/command/undel/const.inc similarity index 100% rename from source/command25/undel/const.inc rename to source/command/undel/const.inc diff --git a/source/command25/undel/dir.mac b/source/command/undel/dir.mac similarity index 100% rename from source/command25/undel/dir.mac rename to source/command/undel/dir.mac diff --git a/source/command25/undel/end.mac b/source/command/undel/end.mac similarity index 100% rename from source/command25/undel/end.mac rename to source/command/undel/end.mac diff --git a/source/command25/undel/jtext.mac b/source/command/undel/jtext.mac similarity index 100% rename from source/command25/undel/jtext.mac rename to source/command/undel/jtext.mac diff --git a/source/command25/undel/macros.inc b/source/command/undel/macros.inc similarity index 100% rename from source/command25/undel/macros.inc rename to source/command/undel/macros.inc diff --git a/source/command25/undel/main.mac b/source/command/undel/main.mac similarity index 100% rename from source/command25/undel/main.mac rename to source/command/undel/main.mac diff --git a/source/command25/undel/misc.mac b/source/command/undel/misc.mac similarity index 100% rename from source/command25/undel/misc.mac rename to source/command/undel/misc.mac diff --git a/source/command25/undel/nodebug.mac b/source/command/undel/nodebug.mac similarity index 100% rename from source/command25/undel/nodebug.mac rename to source/command/undel/nodebug.mac diff --git a/source/command25/undel/text.mac b/source/command/undel/text.mac similarity index 100% rename from source/command25/undel/text.mac rename to source/command/undel/text.mac diff --git a/source/command25/undel/undel.com b/source/command/undel/undel.com similarity index 100% rename from source/command25/undel/undel.com rename to source/command/undel/undel.com diff --git a/source/command25/undel/var.mac b/source/command/undel/var.mac similarity index 100% rename from source/command25/undel/var.mac rename to source/command/undel/var.mac diff --git a/source/command25/xcopy/jtext.mac b/source/command/xcopy/jtext.mac similarity index 100% rename from source/command25/xcopy/jtext.mac rename to source/command/xcopy/jtext.mac diff --git a/source/command25/xcopy/text.mac b/source/command/xcopy/text.mac similarity index 100% rename from source/command25/xcopy/text.mac rename to source/command/xcopy/text.mac diff --git a/source/command25/xcopy/ttab.mac b/source/command/xcopy/ttab.mac similarity index 100% rename from source/command25/xcopy/ttab.mac rename to source/command/xcopy/ttab.mac diff --git a/source/command25/xcopy/xcopy.c b/source/command/xcopy/xcopy.c similarity index 100% rename from source/command25/xcopy/xcopy.c rename to source/command/xcopy/xcopy.c diff --git a/source/command25/xcopy/xcopy.com b/source/command/xcopy/xcopy.com similarity index 100% rename from source/command25/xcopy/xcopy.com rename to source/command/xcopy/xcopy.com diff --git a/source/command25/xcopy/xcopy.h b/source/command/xcopy/xcopy.h similarity index 100% rename from source/command25/xcopy/xcopy.h rename to source/command/xcopy/xcopy.h diff --git a/source/command25/xcopy/xcopyfns.c b/source/command/xcopy/xcopyfns.c similarity index 100% rename from source/command25/xcopy/xcopyfns.c rename to source/command/xcopy/xcopyfns.c diff --git a/source/command25/xdir/jtext.mac b/source/command/xdir/jtext.mac similarity index 100% rename from source/command25/xdir/jtext.mac rename to source/command/xdir/jtext.mac diff --git a/source/command25/xdir/text.mac b/source/command/xdir/text.mac similarity index 100% rename from source/command25/xdir/text.mac rename to source/command/xdir/text.mac diff --git a/source/command25/xdir/ttab.mac b/source/command/xdir/ttab.mac similarity index 100% rename from source/command25/xdir/ttab.mac rename to source/command/xdir/ttab.mac diff --git a/source/command25/xdir/xdir.c b/source/command/xdir/xdir.c similarity index 100% rename from source/command25/xdir/xdir.c rename to source/command/xdir/xdir.c diff --git a/source/command25/xdir/xdir.com b/source/command/xdir/xdir.com similarity index 100% rename from source/command25/xdir/xdir.com rename to source/command/xdir/xdir.com diff --git a/source/command25/msxdos/CPM32.EXE b/source/kernel/CPM32.EXE similarity index 100% rename from source/command25/msxdos/CPM32.EXE rename to source/kernel/CPM32.EXE diff --git a/source/command25/msxdos/L80.CPM b/source/kernel/L80.CPM similarity index 100% rename from source/command25/msxdos/L80.CPM rename to source/kernel/L80.CPM diff --git a/source/command25/msxdos/LIB80.CPM b/source/kernel/LIB80.CPM similarity index 100% rename from source/command25/msxdos/LIB80.CPM rename to source/kernel/LIB80.CPM diff --git a/source/command25/msxdos/M80.CPM b/source/kernel/M80.CPM similarity index 100% rename from source/command25/msxdos/M80.CPM rename to source/kernel/M80.CPM diff --git a/source/msxdos25/Makefile b/source/kernel/Makefile similarity index 100% rename from source/msxdos25/Makefile rename to source/kernel/Makefile diff --git a/source/msxdos25/SymToEqus.exe b/source/kernel/SymToEqus.exe similarity index 100% rename from source/msxdos25/SymToEqus.exe rename to source/kernel/SymToEqus.exe diff --git a/source/msxdos25/bank.inc b/source/kernel/bank.inc similarity index 100% rename from source/msxdos25/bank.inc rename to source/kernel/bank.inc diff --git a/source/kernel/bank0/.gitignore b/source/kernel/bank0/.gitignore new file mode 100644 index 00000000..06b8a7b0 --- /dev/null +++ b/source/kernel/bank0/.gitignore @@ -0,0 +1,8 @@ +b0lab_b3.inc +b0lab_b3.inc +b0lab_b3.inc +b0labels.inc +bank.inc +condasm.inc +const.inc +macros.inc diff --git a/source/msxdos25/bank0/40ff.mac b/source/kernel/bank0/40ff.mac similarity index 100% rename from source/msxdos25/bank0/40ff.mac rename to source/kernel/bank0/40ff.mac diff --git a/source/msxdos25/CPM32.EXE b/source/kernel/bank0/CPM32.EXE similarity index 100% rename from source/msxdos25/CPM32.EXE rename to source/kernel/bank0/CPM32.EXE diff --git a/source/msxdos25/L80.CPM b/source/kernel/bank0/L80.CPM similarity index 100% rename from source/msxdos25/L80.CPM rename to source/kernel/bank0/L80.CPM diff --git a/source/msxdos25/LIB80.CPM b/source/kernel/bank0/LIB80.CPM similarity index 100% rename from source/msxdos25/LIB80.CPM rename to source/kernel/bank0/LIB80.CPM diff --git a/source/msxdos25/M80.CPM b/source/kernel/bank0/M80.CPM similarity index 100% rename from source/msxdos25/M80.CPM rename to source/kernel/bank0/M80.CPM diff --git a/source/msxdos25/bank0/alloc.mac b/source/kernel/bank0/alloc.mac similarity index 100% rename from source/msxdos25/bank0/alloc.mac rename to source/kernel/bank0/alloc.mac diff --git a/source/msxdos25/bank0/b0.mac b/source/kernel/bank0/b0.mac similarity index 100% rename from source/msxdos25/bank0/b0.mac rename to source/kernel/bank0/b0.mac diff --git a/source/msxdos25/bank0/bdos.mac b/source/kernel/bank0/bdos.mac similarity index 100% rename from source/msxdos25/bank0/bdos.mac rename to source/kernel/bank0/bdos.mac diff --git a/source/msxdos25/bank0/betainfo.mac b/source/kernel/bank0/betainfo.mac similarity index 100% rename from source/msxdos25/bank0/betainfo.mac rename to source/kernel/bank0/betainfo.mac diff --git a/source/msxdos25/bank0/dosboot.mac b/source/kernel/bank0/dosboot.mac similarity index 100% rename from source/msxdos25/bank0/dosboot.mac rename to source/kernel/bank0/dosboot.mac diff --git a/source/msxdos25/bank0/doshead.mac b/source/kernel/bank0/doshead.mac similarity index 100% rename from source/msxdos25/bank0/doshead.mac rename to source/kernel/bank0/doshead.mac diff --git a/source/msxdos25/bank0/dskbasic.mac b/source/kernel/bank0/dskbasic.mac similarity index 100% rename from source/msxdos25/bank0/dskbasic.mac rename to source/kernel/bank0/dskbasic.mac diff --git a/source/msxdos25/bank0/init.mac b/source/kernel/bank0/init.mac similarity index 93% rename from source/msxdos25/bank0/init.mac rename to source/kernel/bank0/init.mac index 114a24e7..fcda19ac 100644 --- a/source/msxdos25/bank0/init.mac +++ b/source/kernel/bank0/init.mac @@ -705,6 +705,7 @@ SLAVE: ;PROCNM+7: 1 to boot in DOS 1 mode ;PROCNM+8: 1 if device-based driver ;PROCNM+9: 1 if in disk emulation mode (set by AUTODRV in partit.mac) + ;PROCNM+10: <>0 if the driver provides configuration ;Calculate how many work area space can be allocated, it will be: ;(SP) - MAX(C200h, BOTTOM+512) @@ -722,7 +723,10 @@ BOTTOM_OK: sbc hl,de ;HL = -DE add hl,sp - call CALLINIT + xor a + call CALL_DV_INIT + push af + pop bc ld e,c res 1,e @@ -731,26 +735,19 @@ BOTTOM_OK: ld (BK4_ADD##),hl ld hl,DV_TYPE## call CALDRV## + + ld h,a and 1 ;Device-based driver? ld (PROCNM+8),a + ld a,h + push af + and 100b + ld (PROCNM+10),a + ld b,a + pop af pop hl jr z,NO_DEVBASED - ;xor a - ;call SNSMAT ;Scan "5" key - ;and 00100000b - ;ld b,2 - ;jr nz,AUTODRIVES - - xor a - call SNSMAT - and 00100000b ;Scan "5" key - ld b,1 - jr z,OKDEVBASED - ;inc b - ;jr OKDEVBASED - -AUTODRIVES: ld b,255 OKDEVBASED: @@ -784,12 +781,9 @@ BIGENOUGH: ld hl,PROCNM+4 ld b,255 set 1,(hl) - ld ix,DV_INIT## ;Initialize environment and hardware - ld a,1 - ex af,af' - ld a,DV_BANK## - call CALBNK## - call COUNTDEVS + ld a,1 + call CALL_DV_INIT ;Initialize environment and hardware + call COUNTDRV ld (PROCNM+5),a NO255DRIVES: @@ -823,13 +817,10 @@ DO_INIT_ENV: ld a,(PROCNM+4) and 2 jr nz,INITENV_DONE - ld ix,DV_INIT## ;Initialize environment and hardware - ld a,(PROCNM+6) ;only if we haven't done that yet + ld a,(PROCNM+6) ;only if we haven't done that yet ld b,a - ld a,1 - ex af,af' - ld a,DV_BANK## - call CALBNK## + ld a,1 + call CALL_DV_INIT ;Initialize environment and hardware INITENV_DONE: ld a,(PROCNM+8) @@ -853,6 +844,11 @@ FINDKER250: jr z,NOSETINT set 6,b NOSETINT: + ld a,(PROCNM+10) + or a + jr z,NOSETCONF + set 5,b +NOSETCONF: ld (hl),b ld a,(PROCNM+6) @@ -1097,7 +1093,7 @@ NO_DPB: ; call GSLOT2 ;Get current page-2 slot ld b,a -nomem:: + ld a,(PROCNM+7) cp 1 jr z,NODOSINIT @@ -2183,34 +2179,15 @@ SNEXT: CALLDOS 12h ;;Search for next (FCB) ALIGN 501Eh FSIZE: CALLDOS 23h ;;Get file size (FCB) ; - ;Invoke LUN_INFO on all possible devices of the driver, - ;and return in A the number of devices found. -cdvs:: -COUNTDEVS: - ld c,0 - ld a,1 -COUNTDEVS1: - ld b,7 -COUNTDEVS2: - push af - push bc - ld hl,COUNTDEVS ;Throw away the returned data - ld ix,LUN_INFO## - ex af,af' - ld a,DV_BANK## - call CALBNK## - pop bc - or a - jr nz,COUNTDEVS3 - inc c -COUNTDEVS3: - pop af - djnz COUNTDEVS2 - inc a - cp 8 - jr c,COUNTDEVS1 - ld a,c ;!!! + ;--- Get in A the number of drives assigned to this driver at boot time. + +COUNTDRV: + ld a,(PROCNM+10) + ld b,a + ld hl,DRVS2## + ld (BK4_ADD##),hl + call ?C4PBK## ret ALIGN 504Eh @@ -2772,15 +2749,12 @@ GTIME: CALLDOS 2Ch ;Get time STIME: CALLDOS 2Dh ;Set time ; -CALLINIT: - ld ix,DV_INIT## ;Call init routine for my driver +SCAN_5_KEY: xor a - ex af,af' - ld a,DV_BANK## - call CALBNK## ;We pass B=available drives, HL=allocatable work area - push af ;Save number of drives and interrupt flag - pop bc - ret + call SNSMAT + and 00100000b + xor 00100000b ;A=00100000b if "5" key pressed, 0 if not + ret ALIGN 55FFh VERIFY: CALLDOS 2Eh ;Set/reset verify flag @@ -3266,6 +3240,22 @@ DO_LDIR: ldir ret + ;Call DRV_INIT in my slot. + ;Input: A, B = Input for the routine. + +CALL_DV_INIT: + push af + push bc + call SCAN_5_KEY + pop bc + ld c,a + pop af + ld ix,DV_INIT## ;Initialize environment and hardware + ex af,af' + ld a,DV_BANK## + call CALBNK## + ret + FOURZEROS: db 0,0,0,0 end diff --git a/source/msxdos25/bank0/ramdrv.mac b/source/kernel/bank0/ramdrv.mac similarity index 100% rename from source/msxdos25/bank0/ramdrv.mac rename to source/kernel/bank0/ramdrv.mac diff --git a/source/kernel/bank1/.gitignore b/source/kernel/bank1/.gitignore new file mode 100644 index 00000000..5f194785 --- /dev/null +++ b/source/kernel/bank1/.gitignore @@ -0,0 +1,5 @@ +b0labels.inc +bank.inc +condasm.inc +const.inc +macros.inc \ No newline at end of file diff --git a/source/msxdos25/bank0/CPM32.EXE b/source/kernel/bank1/CPM32.EXE similarity index 100% rename from source/msxdos25/bank0/CPM32.EXE rename to source/kernel/bank1/CPM32.EXE diff --git a/source/msxdos25/bank0/L80.CPM b/source/kernel/bank1/L80.CPM similarity index 100% rename from source/msxdos25/bank0/L80.CPM rename to source/kernel/bank1/L80.CPM diff --git a/source/msxdos25/bank0/LIB80.CPM b/source/kernel/bank1/LIB80.CPM similarity index 100% rename from source/msxdos25/bank0/LIB80.CPM rename to source/kernel/bank1/LIB80.CPM diff --git a/source/msxdos25/bank0/M80.CPM b/source/kernel/bank1/M80.CPM similarity index 100% rename from source/msxdos25/bank0/M80.CPM rename to source/kernel/bank1/M80.CPM diff --git a/source/msxdos25/bank1/b1.mac b/source/kernel/bank1/b1.mac similarity index 100% rename from source/msxdos25/bank1/b1.mac rename to source/kernel/bank1/b1.mac diff --git a/source/msxdos25/bank1/dosinit.mac b/source/kernel/bank1/dosinit.mac similarity index 100% rename from source/msxdos25/bank1/dosinit.mac rename to source/kernel/bank1/dosinit.mac diff --git a/source/msxdos25/bank1/mapinit.mac b/source/kernel/bank1/mapinit.mac similarity index 95% rename from source/msxdos25/bank1/mapinit.mac rename to source/kernel/bank1/mapinit.mac index 006944c2..253fe858 100644 --- a/source/msxdos25/bank1/mapinit.mac +++ b/source/kernel/bank1/mapinit.mac @@ -768,6 +768,7 @@ EXB_LOOP: ld a,(ix) or a ;Zero if empty entry jr z,EXB_DJNZ + and 10001111b ld c,a ld a,(MASTER_SLOT##) cp c diff --git a/source/msxdos25/bank1/msg.mac b/source/kernel/bank1/msg.mac similarity index 100% rename from source/msxdos25/bank1/msg.mac rename to source/kernel/bank1/msg.mac diff --git a/source/kernel/bank2/.gitignore b/source/kernel/bank2/.gitignore new file mode 100644 index 00000000..18b823ca --- /dev/null +++ b/source/kernel/bank2/.gitignore @@ -0,0 +1,6 @@ +b0labels.inc +b2labels.inc +bank.inc +condasm.inc +const.inc +macros.inc diff --git a/source/msxdos25/bank1/CPM32.EXE b/source/kernel/bank2/CPM32.EXE similarity index 100% rename from source/msxdos25/bank1/CPM32.EXE rename to source/kernel/bank2/CPM32.EXE diff --git a/source/msxdos25/bank1/L80.CPM b/source/kernel/bank2/L80.CPM similarity index 100% rename from source/msxdos25/bank1/L80.CPM rename to source/kernel/bank2/L80.CPM diff --git a/source/msxdos25/bank1/LIB80.CPM b/source/kernel/bank2/LIB80.CPM similarity index 100% rename from source/msxdos25/bank1/LIB80.CPM rename to source/kernel/bank2/LIB80.CPM diff --git a/source/msxdos25/bank1/M80.CPM b/source/kernel/bank2/M80.CPM similarity index 100% rename from source/msxdos25/bank1/M80.CPM rename to source/kernel/bank2/M80.CPM diff --git a/source/msxdos25/bank2/b2.mac b/source/kernel/bank2/b2.mac similarity index 100% rename from source/msxdos25/bank2/b2.mac rename to source/kernel/bank2/b2.mac diff --git a/source/msxdos25/bank2/buf.mac b/source/kernel/bank2/buf.mac similarity index 100% rename from source/msxdos25/bank2/buf.mac rename to source/kernel/bank2/buf.mac diff --git a/source/msxdos25/bank2/char.mac b/source/kernel/bank2/char.mac similarity index 100% rename from source/msxdos25/bank2/char.mac rename to source/kernel/bank2/char.mac diff --git a/source/msxdos25/bank2/del.mac b/source/kernel/bank2/del.mac similarity index 100% rename from source/msxdos25/bank2/del.mac rename to source/kernel/bank2/del.mac diff --git a/source/msxdos25/bank2/dev.mac b/source/kernel/bank2/dev.mac similarity index 100% rename from source/msxdos25/bank2/dev.mac rename to source/kernel/bank2/dev.mac diff --git a/source/msxdos25/bank2/dir.mac b/source/kernel/bank2/dir.mac similarity index 100% rename from source/msxdos25/bank2/dir.mac rename to source/kernel/bank2/dir.mac diff --git a/source/msxdos25/bank2/err.mac b/source/kernel/bank2/err.mac similarity index 100% rename from source/msxdos25/bank2/err.mac rename to source/kernel/bank2/err.mac diff --git a/source/msxdos25/bank2/fat.mac b/source/kernel/bank2/fat.mac similarity index 100% rename from source/msxdos25/bank2/fat.mac rename to source/kernel/bank2/fat.mac diff --git a/source/msxdos25/bank2/files.mac b/source/kernel/bank2/files.mac similarity index 100% rename from source/msxdos25/bank2/files.mac rename to source/kernel/bank2/files.mac diff --git a/source/msxdos25/bank2/find.mac b/source/kernel/bank2/find.mac similarity index 100% rename from source/msxdos25/bank2/find.mac rename to source/kernel/bank2/find.mac diff --git a/source/msxdos25/bank2/handles.mac b/source/kernel/bank2/handles.mac similarity index 100% rename from source/msxdos25/bank2/handles.mac rename to source/kernel/bank2/handles.mac diff --git a/source/msxdos25/bank2/kbios.mac b/source/kernel/bank2/kbios.mac similarity index 100% rename from source/msxdos25/bank2/kbios.mac rename to source/kernel/bank2/kbios.mac diff --git a/source/msxdos25/bank2/kinit.mac b/source/kernel/bank2/kinit.mac similarity index 96% rename from source/msxdos25/bank2/kinit.mac rename to source/kernel/bank2/kinit.mac index f49471a6..9690d0c3 100644 --- a/source/msxdos25/bank2/kinit.mac +++ b/source/kernel/bank2/kinit.mac @@ -790,7 +790,7 @@ kbdos_table: dw ?F_DOSVER##-OFFSET ;Get MSX-DOS version number dw ?F_REDIR## -OFFSET ;Get/set redirection state - dw ?F_FOUT## -OFFSET ;Get/set fast STROUT flag + dw F_FOUT## ;Get/set fast STROUT flag dw ?F_ZSTROUT##-OFFSET ;Zero-terminated string output dw ?F_RDDRV## -OFFSET ;Absolute drive sector read diff --git a/source/msxdos25/bank2/misc.mac b/source/kernel/bank2/misc.mac similarity index 93% rename from source/msxdos25/bank2/misc.mac rename to source/kernel/bank2/misc.mac index 36db257f..218c3bec 100644 --- a/source/msxdos25/bank2/misc.mac +++ b/source/kernel/bank2/misc.mac @@ -1187,38 +1187,6 @@ DOSVER2: dont_set_redir: ld b,c ;Return old value in B xor a ret - -;------------------------------------------------------------------------------ -; - PROC F_FOUT -; -; This function gets or sets the value of fast STROUT flag. -; When this flag is set, STROUT will copy the string to $SECBUF before printing it. -; This speeds up printing process, but limits string length to 512 bytes. -; -; Entry: A = 0 => get current value -; 1 => set new value -; B = value to set (only if A=1) -; 0 = disable -; FFh = enable -; Returns: A = 0 (error code) -; B = current value, 0 or 1. -; - or a ;Skip if just getting value - jr z,fout_get - - ld a,b - and 1 - ld b,a - ld a,(MFLAGS##) - and 0FEh - or b - ld (MFLAGS##),a -; -fout_get: - ld bc,(MFLAGS##-1) ;Get current value into B. - xor a - ret ; ;------------------------------------------------------------------------------ ; diff --git a/source/msxdos25/bank2/path.mac b/source/kernel/bank2/path.mac similarity index 100% rename from source/msxdos25/bank2/path.mac rename to source/kernel/bank2/path.mac diff --git a/source/msxdos25/bank2/rw.mac b/source/kernel/bank2/rw.mac similarity index 100% rename from source/msxdos25/bank2/rw.mac rename to source/kernel/bank2/rw.mac diff --git a/source/msxdos25/bank2/seg.mac b/source/kernel/bank2/seg.mac similarity index 100% rename from source/msxdos25/bank2/seg.mac rename to source/kernel/bank2/seg.mac diff --git a/source/msxdos25/bank2/val.mac b/source/kernel/bank2/val.mac similarity index 92% rename from source/msxdos25/bank2/val.mac rename to source/kernel/bank2/val.mac index a11f2260..65b55968 100644 --- a/source/msxdos25/bank2/val.mac +++ b/source/kernel/bank2/val.mac @@ -16,6 +16,7 @@ PT_FAT12 equ 1 ;Partition type code for FAT12 PT_FAT16_S equ 4 ;Partition type code for FAT16 (< 32M) PT_EXT equ 5 ;Partition type code for extended partition PT_FAT16 equ 6 ;Partition type code for FAT16 +PT_FAT16_L equ 14 ;Partition type code for FAT16 (LBA) MBR_SIG equ 512-2 ;MBR signature offset in MBR (55h, AAh) MAXCLUS_FAT12 equ 4084 MAXCLUS_12BITS equ 4095 @@ -40,11 +41,6 @@ MAXCLUS_12BITS equ 4095 call CALL_UNIT ; give up if any error ret nz ; (shouldn't be!) ; -if 0 - ld a,d - and e ;If returned pointer is - inc a ; 0FFFFh then return an -else ld a,e ;Null pointer is OK. or d ret z @@ -58,11 +54,12 @@ else ex (sp),ix pop hl ;If returned string is or a ; null then return an -endif + ld a,.IFORM## ; error. ret z xor a ret + ; ; ;----------------------------------------------------------------------------- @@ -132,12 +129,10 @@ new_boot_sec: push af ld ix,UPB_BUF## - xor a ;Try to read the boot sector - ld d,a ; from the disk and if there - ld e,a ; was any error then give up - ld (DIO_EX_SECTOR##),a ; immediately. - ld bc,(DATA_SEG##) - ld b,1 + ld d,a ; Try to read the boot sector + ld e,a ; from the disk and if there + ld bc,(DATA_SEG##) ; was any error then give up + ld b,1 ; immediately. call READ_UNIT pop bc @@ -956,6 +951,40 @@ MEDIA_CHECK: ; Corrupts: AF ; ; + ;First check if partition assignment is pending, if so return "changed" + + push ix + push hl + pop ix + bit UF_PAP,(ix+UD_DFLAGS##) + pop ix + jr z,MCHK0 + ld a,1 + or a ;NC, NZ + ret + +MCHK0: + call MCHK2 + + push ix + push af + + push hl + pop ix + bit UF_NCH,(ix+UD_DFLAGS##) + jr z,MCHK1 + + res UF_NCH,(ix+UD_DFLAGS##) + ex (sp),hl ;retrieve pushed AF + set 6,l ;set Z to force "not changed" + ex (sp),hl +MCHK1: + pop af + pop ix + ret + +MCHK2: + call _MCHECK ret z ret nc ;If not "not sure interpret as changed", return @@ -987,7 +1016,6 @@ MCHECK2: xor a ld e,a ld d,a - ld (DIO_EX_SECTOR##),a ld bc,(DATA_SEG##) ld b,1 ld ix,UPB_BUF## @@ -1209,6 +1237,9 @@ cp_volid_loop: ld a,(de) ; to the same controller, device and LUN (this is done by UNMAPALL routine ; in the kernel ROM page 4). Then reset the UF_FOK flag and jump to ; BUILD_UPB in order to search for the first partition of the new media. +; +; A partition assignment pending (UF_PAP) is a special case: we skip the +; entire unmapping procedure since there was no real media change. DO_MEDIA_CHANGE: push ix @@ -1217,6 +1248,8 @@ DO_MEDIA_CHANGE: pop ix bit UF_DBD,(ix+UD_DFLAGS##) jr z,POPIX_BUILD_UPB + bit UF_PAP,(ix+UD_DFLAGS##) + jr nz,RESFOK_BUILD_UPB push af push bc @@ -1248,6 +1281,7 @@ DO_MEDIA_CHANGE: push hl pop ix +RESFOK_BUILD_UPB: res UF_FOK,(ix+UD_DFLAGS##) pop ix @@ -1286,6 +1320,20 @@ POPIX_BUILD_UPB: ; ; build_upb_common: + call bupc + ret nz + push af + push ix + push hl + pop ix + res UF_PAP,(ix+UD_DFLAGS##) + pop ix + pop af + ret + +bupc: + push af + push hl pop ix @@ -1297,39 +1345,17 @@ build_upb_common: ld (ix+UD_FSEC##+3),0 build_upb_okfsec: + pop af push bc push de push af push ix - ;ld a,(MFLAGS##) - ;and 2 - ;jr z,build_upb_srchpar - - ;bit UF_FOK,(ix+UD_DFLAGS##) - ;jr z,build_upb_srchpar - - ;ld a,(ix+UD_FSEC##+2) - ;ld (DIO_EX_SECTOR##),a - ;ld e,(ix+UD_FSEC##) - ;ld d,(ix+UD_FSEC##+1) - ;ld bc,(DATA_SEG##) - ;ld b,1 - ;pop hl - ;push hl - ;ld ix,UPB_BUF## - ;call READ_UNIT - ;pop hl - ;jp nz,build_upb_err - ;jp build_upb_dofind - build_upb_srchpar: ld ix,UPB_BUF## ; try_build_upb: ld de,0 ;Try to read the boot sector ;===== start mod DOS2.50 - xor a - ld (DIO_EX_SECTOR##),a ld bc,(DATA_SEG##) ; from the disk and if there ld b,1 ; was any error then jump to ; moan to the user about it. @@ -1355,71 +1381,53 @@ try_build_upb: ld de,0 ;Try to read the boot sector ex (sp),ix and UFM_DB+UFM_FO cp UFM_DB - jr nz,build_upb_dof2 + jp nz,build_upb_dof2 build_upb_do_findpart: - push ix - pop hl - ld bc,MBR_SIG - add hl,bc - ld a,(hl) - cp 55h - jr nz,build_upb_dof2 - inc hl - ld a,(hl) - cp 0AAh ;If no MBR signature found, - jr nz,build_upb_dof2 ;try searching UPB in the MBR itself - - push ix - pop hl - ld bc,MBR_PSTART+POFF_TYPE - add hl,bc - ld b,4 -build_upb_srchp: - ld a,(hl) - cp PT_FAT12 - jr z,build_upb_pfound - cp PT_FAT16 - jr z,build_upb_pfound - cp PT_FAT16_S - jr nz,build_upb_nopfound -build_upb_pfound: - ld bc,POFF_PSTART-POFF_TYPE - add hl,bc - ex (sp),ix - ld a,(hl) - ld (ix+UD_FSEC##),a - inc hl - ld a,(hl) - ld (ix+UD_FSEC##+1),a - inc hl - ld a,(hl) - ld (ix+UD_FSEC##+2),a - inc hl - ld a,(hl) - ld (ix+UD_FSEC##+3),a - set UF_FOK,(ix+UD_DFLAGS##) - ex (sp),ix - - xor a ;Read boot sector of the partition - ld (DIO_EX_SECTOR##),a - ld bc,(DATA_SEG##) - ld b,1 - ld de,0 - pop hl ;Restore unit desciptor - ld ix,UPB_BUF## - call READ_UNIT - jr nz,build_upb_err - - jr build_upb_dofind - -build_upb_nopfound: - ld de,MBR_PSIZE - add hl,de - djnz build_upb_srchp - - ;If no valid partition found, - ;try searching UPB in the MBR itself + ex (sp),ix + ld b,(ix+UD_DI##) + ld c,(ix+UD_LI##) + ex (sp),ix + + pop hl + push hl + + push ix + push iy + + ld ix,AUTO_ASPART## + ld (BK4_ADD##),ix + ld ix,?CALL4## + ld iy,(MASTER_SLOT##-1) + call CALSLT## + + pop iy + pop ix + + or a + jp nz,build_upb_notfind + + ex (sp),ix + set UF_FOK,(ix+UD_DFLAGS##) + ex (sp),ix + pop hl ;Restore unit desciptor + + ;Read boot sector in UPB_BUF, it will be needed later + + push hl + pop ix + ld de,0 + ld ix,UPB_BUF## + ld bc,(DATA_SEG##) + ld b,1 + push hl + push ix + call READ_UNIT + pop ix + pop hl + + jr nz,build_upb_err + jp found_upb build_upb_dof2: ex (sp),ix @@ -1436,7 +1444,8 @@ build_upb_dofind: ; ;If no valid UPB found, and are invoking from F_RDDRV or F_WRDRV, ;ignore error and continue. - + +build_upb_notfind: bit RF_DOS2,(iy+@RW_FLAGS##) ld a,1 jr nz,found_upb @@ -1455,11 +1464,11 @@ build_upb_err: ld b,a pcall C_DISK_ERR ; to try it again. push hl jp try_build_upb -; +;.ndos found_upb: pop de ;Throw away input AF found_upb2: pop de pop bc - or a + or a ret ;; ld de,1 ;If no UPB in boot sector @@ -2190,19 +2199,19 @@ reduce_set: ; and compiles always the else clause. ; Solve this if MAX_UNITS needs to grow over 8. -if MAX_UNITS## GT 8 - ld hl,(RALL_VECT##) -else +;if MAX_UNITS## GT 8 +; ld hl,(RALL_VECT##) +;else ld a,(RALL_VECT##) -endif +;endif reduce_bit_loop: -if MAX_UNITS## GT 8 - srl h - rr l -else +;if MAX_UNITS## GT 8 +; srl h +; rr l +;else rrca -endif +;endif djnz reduce_bit_loop jr nc,reduce_end ;Here Cy is the red. all. flag for this drive set UF_RALL,(ix+UD_FLAGS##) @@ -2323,15 +2332,34 @@ COMPHLDE: ;------------------------------------------------------------------------------ ; ;===== start add DOS2.50 + +; Input for READ_UNIT and WRITE_UNIT: +; B = Number of sectors +; DE = First sector (3rd byte is always 0) +; HL = Unit descriptor +; IX = Transfer address +; +; READ_UNIT corrupts BC + WRITE_UNIT: + xor a + ld (DIO_EX_SECTOR##),a ld a,WR_CMD jr CALL_UNIT -READ_UNIT: ;B = Number of sectors - ;DE = First sector (plus DIO_EX_SECTOR) - ;HL = Unit descriptor - ;IX = Transfer address +READ_UNIT: + ld a,(DIO_EX_SECTOR##) + push af + xor a + ld (DIO_EX_SECTOR##),a ld a,RD_CMD + call CALL_UNIT + pop bc + ld c,a + ld a,b + ld (DIO_EX_SECTOR##),a + ld a,c + ret ;===== end add DOS2.50 CALL_UNIT: @@ -2357,7 +2385,6 @@ CALL_UNIT: ; (DIO_EX_SECTOR) = sector number bit16-22 (if required) :FAT16 ; Returns: A = Error code (eg .RNF##), flags set appropriately. ; B,DE = Assorted results from unit handler -; Corrupts: AF,BC,DE ; ; cp number_of_cmds ;Reject if command code is diff --git a/source/kernel/bank3/.gitignore b/source/kernel/bank3/.gitignore new file mode 100644 index 00000000..24a9e0df --- /dev/null +++ b/source/kernel/bank3/.gitignore @@ -0,0 +1,5 @@ +b0labels.inc +bank.inc +condasm.inc +const.inc +macros.inc diff --git a/source/msxdos25/bank2/CPM32.EXE b/source/kernel/bank3/CPM32.EXE similarity index 100% rename from source/msxdos25/bank2/CPM32.EXE rename to source/kernel/bank3/CPM32.EXE diff --git a/source/msxdos25/bank2/L80.CPM b/source/kernel/bank3/L80.CPM similarity index 100% rename from source/msxdos25/bank2/L80.CPM rename to source/kernel/bank3/L80.CPM diff --git a/source/msxdos25/bank2/LIB80.CPM b/source/kernel/bank3/LIB80.CPM similarity index 100% rename from source/msxdos25/bank2/LIB80.CPM rename to source/kernel/bank3/LIB80.CPM diff --git a/source/msxdos25/bank2/M80.CPM b/source/kernel/bank3/M80.CPM similarity index 100% rename from source/msxdos25/bank2/M80.CPM rename to source/kernel/bank3/M80.CPM diff --git a/source/msxdos25/bank3/b3.mac b/source/kernel/bank3/b3.mac similarity index 100% rename from source/msxdos25/bank3/b3.mac rename to source/kernel/bank3/b3.mac diff --git a/source/msxdos25/bank3/dos1ker.mac b/source/kernel/bank3/dos1ker.mac similarity index 94% rename from source/msxdos25/bank3/dos1ker.mac rename to source/kernel/bank3/dos1ker.mac index 8db67033..257636ee 100644 --- a/source/msxdos25/bank3/dos1ker.mac +++ b/source/kernel/bank3/dos1ker.mac @@ -100,7 +100,7 @@ XF1E2 equ 0F1E2H ; WBOOT, warm boot DOS system XF1E8 equ 0F1E8H ; start handler in DOS memory XF1F4 equ 0F1F4H ; validate FCB filename YF1F7 equ 0F1F7H ; reserved devicenames -YF20B equ 0F20BH ; īdirentryī for devices +YF20B equ 0F20BH ; 'direntry' for devices YF22B equ 0F22BH ; days in month table YF237 equ 0F237H ; BDOS console output columnpos YF238 equ 0F238H ; console columnpos at start of lineinput @@ -1001,7 +1001,7 @@ A43C3: ld (de),a inc iy djnz A43BB ld a,080H - ld (de),a ; īorginal DR byteī b7 set (ignore fileattribute) + ld (de),a ; 'orginal DR byte' b7 set (ignore fileattribute) call A425A ; check if devicename jr nc,A4408 ; yep, end rename with error ld a,(YF2B8) @@ -4153,7 +4153,7 @@ A5667: ld (de),a ; copy char ld (YF30C),a ; save the FCB EX byte ret -T5677: defb '."/[]:+=;,' +T5677: defb '.",34,"/[]:+=;,' ; Subroutine check if double byte header char ; Inputs ________________________ @@ -4201,7 +4201,6 @@ A56D0: ; Inputs ; Outputs ________________________ -bd:: A56D3: call DO_BDOS ;ei @@ -4651,7 +4650,7 @@ A58A8: call A622D ; hook H.LOPD when H.CLEA is hooked (for register system bot ld a,00DH ld (YCONBF+130),a ; ?? end marker con buffer ld a,7 - ld (YF345),a ; max number of FCBīs is 7 + ld (YF345),a ; max number of FCB's is 7 ld hl,1461 ld (YF33B),hl ; default date when no clockchip is 1-1-1984 ld b,8 @@ -5053,7 +5052,7 @@ A5BA0: ld sp,0C200H ; switch to a temporary stack ld hl,M4173 push hl ; execute RUN command ld hl,BUF+10-1 - push hl ; ībasicpointerī + push hl ; 'basicpointer' ld hl,BUF+64 push hl ld (hl),0E1H @@ -5075,7 +5074,7 @@ A5C16: ld hl,T72AE ld (HIMEM),hl ld a,(YF345) ld c,a - ld b,0 ; number of FCBīs + ld b,0 ; number of FCB's ld de,37 call A4916 ; * 37 call A5EB8 ; allocate memory (adjust HIMEM, halt when error) @@ -5769,7 +5768,7 @@ A607B: pop hl jp A636E ; Unused code -; looks like the previous jump is a patch, may be the īeiī instruction at the end of the patch was forgotten ?? +; looks like the previous jump is a patch, may be the 'ei' instruction at the end of the patch was forgotten ?? ; patch code does not fit here, 1 byte too less nop @@ -7280,7 +7279,7 @@ A6939: ld ix,M739A ; quit loading & start (headloop/executing) ld bc,5 push de ldir - pop hl ; ībasicpointerī + pop hl ; 'basicpointer' ld ix,M4601 jp A731E ; continue in the execution loop @@ -8200,7 +8199,7 @@ A6FBD: cpir pop de ret -T6FCC: defb '."/\[]:+=;,*?' +T6FCC: defb '.',34,'/\[]:+=;,*?' A6FD9: ld a," " cp (hl) diff --git a/source/kernel/bank4/.gitignore b/source/kernel/bank4/.gitignore new file mode 100644 index 00000000..af2adb1b --- /dev/null +++ b/source/kernel/bank4/.gitignore @@ -0,0 +1,7 @@ +b0labels.inc +b2labels.inc +b4rdlabs.inc +bank.inc +condasm.inc +const.inc +macros.inc diff --git a/source/msxdos25/bank4/40ff.mac b/source/kernel/bank4/40ff.mac similarity index 100% rename from source/msxdos25/bank4/40ff.mac rename to source/kernel/bank4/40ff.mac diff --git a/source/msxdos25/bank3/CPM32.EXE b/source/kernel/bank4/CPM32.EXE similarity index 100% rename from source/msxdos25/bank3/CPM32.EXE rename to source/kernel/bank4/CPM32.EXE diff --git a/source/msxdos25/bank3/L80.CPM b/source/kernel/bank4/L80.CPM similarity index 100% rename from source/msxdos25/bank3/L80.CPM rename to source/kernel/bank4/L80.CPM diff --git a/source/msxdos25/bank3/LIB80.CPM b/source/kernel/bank4/LIB80.CPM similarity index 100% rename from source/msxdos25/bank3/LIB80.CPM rename to source/kernel/bank4/LIB80.CPM diff --git a/source/msxdos25/bank3/M80.CPM b/source/kernel/bank4/M80.CPM similarity index 100% rename from source/msxdos25/bank3/M80.CPM rename to source/kernel/bank4/M80.CPM diff --git a/source/msxdos25/bank4/b4.mac b/source/kernel/bank4/b4.mac similarity index 100% rename from source/msxdos25/bank4/b4.mac rename to source/kernel/bank4/b4.mac diff --git a/source/msxdos25/bank4/bkalloc.mac b/source/kernel/bank4/bkalloc.mac similarity index 100% rename from source/msxdos25/bank4/bkalloc.mac rename to source/kernel/bank4/bkalloc.mac diff --git a/source/msxdos25/bank4/cpm.mac b/source/kernel/bank4/cpm.mac similarity index 96% rename from source/msxdos25/bank4/cpm.mac rename to source/kernel/bank4/cpm.mac index 0d5e6e70..0dc261e7 100644 --- a/source/msxdos25/bank4/cpm.mac +++ b/source/kernel/bank4/cpm.mac @@ -395,7 +395,7 @@ DELETE_LOOP_OK: POP BC ;Flag that a file has been ; DELETE_LOOP: CALL M_F_N ;Find next file and stop START_DELETE: JR NZ,DELETE_ERR ; if not found - BIT AT_RO,(IX+FIB_ATR##) ;Don't delete read only files. + BIT AT_RO,(IX+FIB_ATTR##) ;Don't delete read only files. JR NZ,DELETE_LOOP LD A,1 ;Make disc dirty. PCALL DEL_FIB ;Actually do the delete. The @@ -618,7 +618,7 @@ endif ld b,ACM_MOD NOT_MOD2: ld (ix+FAB_ACC##),b ld (ix+FAB_ATTR##),a - and AT_DEV ;restore FAB_MODE + and ATM_DEV ;restore FAB_MODE jr z,NOT_DEV2 ld a,MDM_DEV+MDM_CPM+MDM_ASC NOT_DEV2: ld (ix+FAB_MODE##),a diff --git a/source/msxdos25/bank4/doshead.mac b/source/kernel/bank4/doshead.mac similarity index 100% rename from source/msxdos25/bank4/doshead.mac rename to source/kernel/bank4/doshead.mac diff --git a/source/msxdos25/bank4/env.mac b/source/kernel/bank4/env.mac similarity index 100% rename from source/msxdos25/bank4/env.mac rename to source/kernel/bank4/env.mac diff --git a/source/msxdos25/bank4/jump.mac b/source/kernel/bank4/jump.mac similarity index 89% rename from source/msxdos25/bank4/jump.mac rename to source/kernel/bank4/jump.mac index 014feda7..8fd08daf 100644 --- a/source/msxdos25/bank4/jump.mac +++ b/source/kernel/bank4/jump.mac @@ -78,8 +78,12 @@ jentry macro name jentry FREUSEG jentry F_LOCK + jentry F_FOUT jentry F_RALLOC jentry F_DSPACE + jentry DRVS2 + jentry AUTO_ASPART + finish end \ No newline at end of file diff --git a/source/msxdos25/bank4/misc.mac b/source/kernel/bank4/misc.mac similarity index 82% rename from source/msxdos25/bank4/misc.mac rename to source/kernel/bank4/misc.mac index 8800ca15..96405018 100644 --- a/source/msxdos25/bank4/misc.mac +++ b/source/kernel/bank4/misc.mac @@ -6,6 +6,8 @@ INCLUDE MACROS.INC INCLUDE CONST.INC ;RAMMOD + +CHPUT equ 00A2h ; ;------------------------------------------------------------------------------ ; @@ -103,6 +105,42 @@ mnt_get: ld b,0FFh ret + +;------------------------------------------------------------------------------ +; + PROC F_FOUT +; +; This function gets or sets the value of fast STROUT flag. +; When this flag is set, STROUT will copy the string to $SECBUF before printing it. +; This speeds up printing process, but limits string length to 512 bytes. +; +; Entry: A = 0 => get current value +; 1 => set new value +; B = value to set (only if A=1) +; 0 = disable +; FFh = enable +; Returns: A = 0 (error code) +; B = current value, 0 or 1. +; + ld a,c + or a ;Skip if just getting value + jr z,fout_get + + ld a,b + and 1 + ld b,a + ld a,(MFLAGS##) + and 0FEh + or b + ld (MFLAGS##),a +; +fout_get: + ld bc,(MFLAGS##-1) ;Get current value into B. + xor a + ret +; +; + ;------------------------------------------------------------------------------ ; PROC F_RALLOC diff --git a/source/msxdos25/bank4/partit.mac b/source/kernel/bank4/partit.mac similarity index 82% rename from source/msxdos25/bank4/partit.mac rename to source/kernel/bank4/partit.mac index 0dfa050a..202a7dd9 100644 --- a/source/msxdos25/bank4/partit.mac +++ b/source/kernel/bank4/partit.mac @@ -20,7 +20,7 @@ PT_FAT12 equ 1 ;Partition type code for FAT12 PT_FAT16_S equ 4 ;Partition type code for FAT16 (< 32M) PT_EXT equ 5 ;Partition type code for extended partition PT_FAT16 equ 6 ;Partition type code for FAT16 -MBR_SIG equ 512-2 ;MBR signature offset in MBR (55h, AAh) +PT_FAT16_L equ 14 ;Partition type code for FAT16 (LBA) CALLB0 equ 403Fh CALBAS equ 0159h @@ -137,9 +137,6 @@ CHPUT: call DEV_READ ret nz - call CHECK_MBR_SIG - jp nz,UNEX_PART - ;--- Get pointer to main partition table entry push bc @@ -211,9 +208,6 @@ EXTP_LOOP: call DEV_READ jr nz,TWO_POPS_IY - call CHECK_MBR_SIG - jr nz,TPIY_UNEX_PART - dec l ld a,l or a @@ -296,25 +290,6 @@ UNEX_DEVL: ret -;Check the MBR signature -;Input: MBR in SECBUF -;Output: Z for valid signature, NZ otherwise -;Corrupts: AF, IX - -CHECK_MBR_SIG: - ld ix,($SECBUF##) - push bc - ld bc,MBR_SIG - add ix,bc - pop bc - ld a,(ix) - cp 55h - ret nz - ld a,(ix+1) - cp 0AAh - ret - - ;Perform a 32-bit sector sum ;Input: (IX+POFF_PSTART) and (TMP_SEC##) hold the numbers to sum ;Output: (TMP_SEC##) holds the result @@ -504,18 +479,9 @@ GDRV_OK_ROM: ; table will be copied to an area allocated at page 3. This is necessary ; since DOS 1 does not allocate a data segment like DOS 2 does. ; -; Note that this routine calls AUTO_ASSIGN, which expects an unit descriptor. -; DOS 1 does not work with unit descriptors, so in order for this to work, -; an unit descriptor is faked for each drive prior to each call. -; ; The first byte of the table contains the number of entries. Then, -; there are the entries themselves. Each entry consists of two bytes: -; -; +0: Slot number -; +1: Relative unit number for the driver -; +2: Device index -; +3: LUN index -; +4..+7: First sector +; there are the entries themselves. See the definition of these entries +; in kvar.mac (UD1_*) ; ; Device index will be zero if the drive is unmapped (for example if the ; autoassign procedure does not find any suitable device). Note that this @@ -523,27 +489,22 @@ GDRV_OK_ROM: ; the drive will be considered to belong to a device-based driver). AUTODRV_DOS1: + call DRVS1 + ld hl,(DVB_TABLE##) ld (hl),0 ;start with zero entries in table inc hl - push hl ;HL = Address where to generate drives table - pop ix - ld bc,8*8 - add ix,bc ;IX = Address of buffer for a fake unit descriptor - - push ix - pop iy - ld bc,UD_SZ## - add iy,bc ;IY = Address of buffer for info from F_GDRVR + push hl + pop ix ;--- Loop through all the available drivers, and for these ; of device-based type, perform an auto-assign ld c,1 ;Driver index AUTODRV_LOOP: + ld iy,($SECBUF##) push bc - push hl push ix push iy pop hl @@ -551,7 +512,6 @@ AUTODRV_LOOP: call F_GDRVR pop iy pop ix - pop hl or a jp nz,AUTODRV_END @@ -568,35 +528,67 @@ AUTODRV_LOOP: ld a,(iy+4) and 10000001b cp 10000001b - jr nz,AUTODRV_NEXT ;Skip if no device-based driver + jp nz,AUTODRV_NEXT ;Skip if no device-based driver ;* Perform auto-assign for each drive associated to the driver - ld a,(iy) - ld (ix+UD_SLOT##),a - + ld e,(iy) + ld d,(iy+4) + ld b,(iy+2) ;Number of drives for this driver + push de + pop iy xor a ;Relative drive for the driver - ld b,(iy+2) ;Number of drives for this driver + AUTODRV_DRVLOOP: + ;Here, IX = Beginning of entry in DVB_TABLE + ; IYh = Driver flags (bit 4: provides config) + ; IYl = Slot number + ; B = Remaining drives for this driver + ; A = Relative drive for the driver + ld c,a - ld a,(ix+UD_SLOT##) - ld (hl),a ;Set slot number in table - inc hl + ld_a_iyl + ld (ix+UD1_SLOT##),a ;Set slot number in table entry ld a,c - ld (hl),a ;Set relative drive number in table - inc hl + ld (ix+UD1_REL##),a push af - ld (hl),0 ;assume drive will not be assigned - push hl - ld (ix+UD_PHYS##),a + xor a push bc push iy push ix - pop hl - push hl - ld a,1 + ld_a_iyh ;ld a,(iy+4) + and 00000100b ;Driver provides config? + jr z,AUTODRV_DRVL2 + push ix + push iy + ld b,1 + call ASK_DRIVE_CONFIG + pop iy + pop ix + or a + jr z,AUTODRV_DRVL3 + dec a + jr z,AUTODRV_DRVL2 ;Driver does not provide config for that drive + + pop ix + push ix + ld a,-1 + ld (ix+UD1_FSEC##),a + ld (ix+UD1_FSEC##+1),a + ld (ix+UD1_FSEC##+2),a + ld (ix+UD1_FSEC##+3),a + + inc a + jr AUTODRV_DRVL3 + +AUTODRV_DRVL2: + push ix + pop hl + + ld a,1 ;????? call AUTO_ASSIGN +AUTODRV_DRVL3: cp 2 ;Did we enter disk emulation mode? jr nz,NOEMU1 ;Yes: discard everything else and return @@ -608,67 +600,15 @@ NOEMU1: ld hl,(DVB_TABLE##) inc (hl) ;Increment size of table pop ix + ld de,8 + add ix,de ;Point to next entry in table pop iy pop bc - pop hl - or a - jr z,AUTODRV_DRVOK - ;dec hl - ;dec hl - ;ld (hl),0 ;Do NOT set slot number to 0, unassigned drivers have just device index 0 - ;inc hl - ;inc hl - jr AUTODRV_DRVNEXT -AUTODRV_DRVOK: - - ld a,(ix+UD_DI##) - ld (hl),a ;Set device index in table - inc hl - ld a,(ix+UD_LI##) - ld (hl),a ;Set LUN index in table - inc hl - - bit UF_FOK,(ix+UD_DFLAGS##) - jr z,AUTODRV_NOPAR - - ld a,(ix+UD_FSEC##) - ld (hl),a - inc hl - ld a,(ix+UD_FSEC##+1) - ld (hl),a - inc hl - ld a,(ix+UD_FSEC##+2) - ld (hl),a - inc hl - ld a,(ix+UD_FSEC##+3) - ld (hl),a - inc hl - jr AUTODRV_OKPAR - -AUTODRV_NOPAR: - ld a,0FFh - ld (hl),a ;Set first sector in table - inc hl ;as -1, so the first access - ld (hl),a ;will search for a suitable - inc hl ;partition - ld (hl),a - inc hl - ld (hl),a - inc hl -AUTODRV_OKPAR: + ;Go to next drive on a given driver pop af inc a - djnz AUTODRV_DRVLOOP - jr AUTODRV_NEXT - -AUTODRV_DRVNEXT: ;Go to next drive on a given driver - ld e,6 ;Not 8 (HL points to 3rd byte of table) - ld d,0 - add hl,de - pop af - inc a - djnz AUTODRV_DRVLOOP + djpnz AUTODRV_DRVLOOP AUTODRV_NEXT: ;Go to next driver pop bc @@ -746,11 +686,7 @@ AUTOD_OK250: push bc push hl push ix - ld hl,RDBANK## - ld (BK4_ADD##),hl - ld hl,DV_TYPE## - ld ix,CALDRV## - call CALSLT + call GET_DV_TYPE pop ix bit 0,a jr nz,AUTOD_UDFND2 @@ -761,6 +697,26 @@ AUTOD_OK250: jp SETNUMDRV AUTOD_UDFND2: + ;--- If the driver provides configuration, + ; try to get config from the driver itself + + bit 2,a + jr z,AUTOD_UDFND3 + + ld b,0 + ld c,(ix+UD_REL##) + call ASK_DRIVE_CONFIG + dec a + jr z,AUTOD_UDFND3 ;Driver did not provide config + pop hl + or a + jr z,AUTOD_OK + set UF_PAP,(ix+UD_DFLAGS##) ;Partition will be assigned on first access + set UF_NCH,(ix+UD_DFLAGS##) + jr AUTOD_OK + +AUTOD_UDFND3: + ;--- Call the auto-assign routine push ix @@ -781,6 +737,7 @@ NOEMU2: ;--- Auto-assign failed: destroy the unit descriptor +AUTOD_FAIL: ld e,(hl) inc hl ld d,(hl) @@ -797,8 +754,7 @@ AUTOD_OK: inc hl inc hl pop bc - dec b - jp nz,AUTOD_LOOP + djpnz AUTOD_LOOP jp SETNUMDRV ;----------------------------------------------------------------------------- @@ -841,6 +797,8 @@ SETNUMD_NOUD: ;----------------------------------------------------------------------------- ; +; AUTO_ASSIGN +; ; This routine automatically assigns the appropriate device and partition ; to a drive associated to a device-based DOS 2.50 driver. It does so by ; searching an available block devices, then searching a FAT12 or FAT16 @@ -855,10 +813,20 @@ SETNUMD_NOUD: ; number. If there are more than one devices matching this, the one ; with the smallest device number will be assigned. ; -; Input: HL = Address of unit descriptor, it must have UD_SLOT and UD_PHYS set -; (assumes that it is a DOS 2.50 kernel slot with device based driver) +; There is also a second entry point, AUTO_ASPART. +; The difference is that this one searches for a suitable partition, +; but the device and LUN are fixed (passed as parameters). +; This one is used if the device provides its own configuration. +; +; Input: HL = DOS 2 mode: +; Address of unit descriptor, it must have UD_SLOT and UD_PHYS set +; DOS 1 mode: +; Address of entry in device-based drives table, must have UD_SLOT set +; B = Device index (AUTO_ASPART only) +; C = LUN index (AUTO_ASPART only) ; A = 0: Do NOT try to enter disk emulation mode ; 1: Enter disk emulation mode if possible +; ; Output: A = Error code ; 0: Ok ; 1: No suitable device/partition found @@ -877,8 +845,59 @@ SETNUMD_NOUD: ;NXT7+3 is used to store the stack pointer at input so that we can easily ;discard the stack contents when entering disk emulation mode. + PROC AUTO_ASPART + + scf + jr AUTO_COMMON + AUTO_ASSIGN: - ld (NXT7##+2),a + or a + +AUTO_COMMON: + ld (NXT7##+2),a + + ld de,(NXTEMP##) ;Save lots of page 3 variables. + push de ;This is necessary because AUTO_ASSIGN uses them + ld de,(TMPDEV##) ;as temporary work area, which is OK in DOS 2 mode + push de ;but in in DOS 1 mode these are actually used for anything else. + ld de,(NXT4##) + push de + ld de,(NXT4##+2) + push de + call AUTO_COMMON2 + pop de + ld (NXT4##+2),de + pop de + ld (NXT4##),de + pop de + ld (TMPDEV##),de + pop de + ld (NXTEMP##),de + ret + +AUTO_COMMON2: + jr nc,AUTO_COMMON3 + +;AUTO_ASPART: + push hl + pop ix + ld a,b ;(ix+UD_DI##) + ld (TMPDEV##),a + ld a,c ;(ix+UD_LI##) + ld (TMPLUN##),a + xor a + ld (BUF9##),a + ld (NXTEMP##),a + inc a + ld (NXT3##),a + + jp AA_CHKDUP_OK + +;AUTO_ASSIGN: +AUTO_COMMON3: + xor a + ld (BUF9##),a + ld (NXT3##),a xor a ld (NXT7##+5),a @@ -890,10 +909,6 @@ AUTO_ASSIGN: add hl,sp ld (NXT7##+3),hl - ld (ix+UD_DI##),0 - xor a - ld (BUF9##),a - ld a,1 ;Device index AA_DLOOP: ld (TMPDEV##),a ;push af @@ -907,11 +922,6 @@ AA_LLOOP: ;--- Check if the same slot+device+LUN has been assigned ; to other drive already - ;pop bc ;Retrieve LUN number - ;pop de ;Retrieve device number - ;push de - ;push bc - ;ld e,b ;Now D=Device number, E=LUN number ld a,(TMPDEV##) ld d,a ld a,(TMPLUN##) @@ -921,8 +931,8 @@ AA_LLOOP: or a jr nz,AA_CHKDUP_DOS2 - ;--- DOS 1 version: check fake unit descriptor against - ; table in page 3 + ;--- DOS 1 version: check entry in DVB_TABLE against + ; other entries in the table AA_CHKDUP_DOS1: ld iy,(DVB_TABLE##) @@ -932,17 +942,17 @@ AA_CHKDUP_DOS1: inc iy AA_CHKDUP_LOOP1: - ld a,(iy) + ld a,(iy+UD_SLOT##) cp (ix+UD_SLOT##) jr nz,AA_CHKDUP_NEXT1 - ld a,(iy+2) + ld a,(iy+UD1_DI##) or a ;If device index is 0, it is an unused table entry jr z,AA_CHKDUP_NEXT1 cp d jr nz,AA_CHKDUP_NEXT1 - ld a,(iy+3) ;Check LUN index + ld a,(iy+UD1_LI##) ;Check LUN index cp e jr nz,AA_CHKDUP_NEXT1 @@ -1000,7 +1010,6 @@ AA_CHKDUP_OK: ;--- Obtain device information -aa:: ld a,(ix+UD_SLOT##) ld_iyh_a ld hl,LUN_INFO## @@ -1047,14 +1056,6 @@ aa:: ;* Mark the device as candidate for autoassign, ; unless this was done before - ;ld a,(BUF9##-1) - ;or a - ;jr nz,AA_OK_CANDIDATE - - ;pop bc ;LUN index - ;pop af ;Device index - ;push af - ;push bc ld a,(TMPLUN##) ld b,a ld a,(TMPDEV##) @@ -1069,23 +1070,16 @@ AA_OK_CANDIDATE: ;--- Device parameters OK. ; Now read MBR and look for a suitable partition. - ;ld hl,-1 ;Partition first sector -1 = undefined yet - ;ld (BUF9##+1),hl - ;ld (BUF9##+3),hl - ;* Read device MBR ld hl,0 ld (TMP_SEC##),hl ld (TMP_SEC##+2),hl - ;pop bc ;Retrieve LUN index - ;pop af ;Retrieve device index - ;push af - ;push bc ld a,(TMPLUN##) ld b,a ld a,(TMPDEV##) - call AA_RSEC + call AA_RSEC + or a jp nz,AA_LLOOP_NEXT ;Not ready ;* Check partition table @@ -1093,11 +1087,6 @@ AA_OK_CANDIDATE: xor a ld (NXT4##+2),a - push ix - call CHECK_MBR_SIG - pop ix - jp nz,AA_CHECK_BOOT_MBR ;No MBR signature - ld hl,($SECBUF##) ld bc,MBR_PSTART+POFF_TYPE add hl,bc @@ -1116,6 +1105,8 @@ AA_PLOOP:: jr z,AA_PLOOP_OKTYPE cp PT_FAT16_S jr z,AA_PLOOP_OKTYPE + cp PT_FAT16_L + jr z,AA_PLOOP_OKTYPE AA_PLOOP_NEXT: ld de,MBR_PSIZE @@ -1133,10 +1124,6 @@ AA_PLOOP_OKTYPE: ;* Read first sector of partition - ;pop bc ;Retrieve LUN index - ;pop af ;Retrieve device index - ;push af - ;push bc ld a,(TMPLUN##) ld b,a ld a,(TMPDEV##) @@ -1154,25 +1141,7 @@ AA_PLOOP_OKTYPE: ld (TMP_SEC##+2),de ld (BUF9##+7),de - ;push af - ;push bc - ;ld hl,(BUF9##+1) - ;ld de,(BUF9##+3) - ;ld a,h - ;and l - ;and d - ;and e - ;inc a - ;jr nz,DO_RSEC - - ;ld hl,(TMP_SEC##) ;If this is the first partition being examined, - ;ld (BUF9##+1),hl ;save its number - ;ld hl,(TMP_SEC##+2) - ;ld (BUF9##+3),hl - DO_RSEC: - ;pop bc - ;pop af call AA_RSEC jr nz,AA_PLOOP_NEXT @@ -1203,6 +1172,28 @@ AA_CHECK_BOOT2: jp nc,AA_NEXTPAR ;AA_LLOOP_NEXT AA_SPC_OK: + ;* Check if the partition is already mapped to another drive + + push ix + push iy + ld h,(ix+UD_SLOT##) + ld l,(ix+UD_SEG##) + ld a,(TMPDEV##) + ld d,a + ld a,(TMPLUN##) + ld e,a + exx + ld de,(BUF9##+5) + ld hl,(BUF9##+7) + exx + + call CHECK_MAP_IN_USE + pop iy + pop ix + jp nz,AA_NEXTPAR + + ;* All checks ok, partition is good + ld a,(BUF9##) or a jr nz,AA_OK_CANDIDATE2 @@ -1210,16 +1201,6 @@ AA_SPC_OK: ld a,(NXTEMP##) ld (BUF9##),a ;Valid partition: mark as candidate device - ;!!!!! - ;ld hl,(BUF9##+1) - ;ld de,(BUF9##+3) - ;ld a,h - ;and l - ;and d - ;and e - ;inc a - ;jr nz,DO_RSEC2 - ld hl,(TMP_SEC##) ;If this is the first partition being examined, ld (BUF9##+1),hl ;save its number ld hl,(TMP_SEC##+2) @@ -1270,10 +1251,6 @@ AA_OK_ROOTNUM: ;Outer loop: check all root directory sectors AA_MSXDOS2_SLOOP: - ;pop de ;LUN index - ;pop af ;Device index - ;push af - ;push de ld a,(TMPLUN##) ld d,a ld a,(TMPDEV##) @@ -1379,7 +1356,6 @@ AA_DO_FOUND2: ld (BUF9##+1),hl ld hl,(BUF9##+7) ld (BUF9##+3),hl - set UF_FOK,(ix+UD_DFLAGS##) ;Tell that the partition information is valid jp AA_DO_ASSIGN AA_MSXDOS2_NXTE: @@ -1405,7 +1381,6 @@ AA_NXTE2: pop bc dec b jp nz,AA_MSXDOS2_SLOOP - ;jr AA_LLOOP_NEXT AA_NOMOREENT: ld a,(NXT7##+5) @@ -1438,17 +1413,20 @@ AA_MSXDOS2_ERR: ; so jump to the next device or LUN AA_LLOOP_NEXT: - ;pop af + ld a,(NXT3##) + or a + jr nz,AA_LLOOP_END + ld a,(TMPLUN##) inc a cp 8 jp nz,AA_LLOOP - ;pop af ld a,(TMPDEV##) inc a cp 8 jp nz,AA_DLOOP +AA_LLOOP_END: ;--- No more devices found: ; If a candidate device was identified, use it, @@ -1469,9 +1447,6 @@ AA_LLOOP_NEXT: ld (TMPDEV##),a ld a,b ld (TMPLUN##),a - ;push af - ;push bc - set UF_FOK,(ix+UD_DFLAGS##) ;When the UPB is build, a partition will be searched jp AA_DO_ASSIGN AA_END_NOFOUND: @@ -1482,6 +1457,11 @@ AA_END_NOFOUND: ; Assign it to the drive. AA_DO_ASSIGN: + ld a,(DOS_VER##) + or a + jr z,AA_DO_ASSDOS1 + + set UF_FOK,(ix+UD_DFLAGS##) ;Tell that the partition information is valid ld b,(ix+UD_SLOT##) ld c,(ix+UD_PHYS##) push bc @@ -1500,8 +1480,6 @@ AA_DO_ASSIGN: pop bc ld (ix+UD_SLOT##),b ld (ix+UD_PHYS##),c - ;pop bc ;Retrieve LUN number - ;pop af ;Retrieve device number ld a,(TMPLUN##) ld b,a ld a,(TMPDEV##) @@ -1543,6 +1521,21 @@ AA_DO_ASSIGN: xor a ret +AA_DO_ASSDOS1: + ld a,(TMPDEV##) + ld (ix+UD1_DI##),a + ld a,(TMPLUN##) + ld (ix+UD1_LI##),a + ld hl,(BUF9##+1) + ld (ix+UD1_FSEC##),l + ld (ix+UD1_FSEC##+1),h + ld hl,(BUF9##+3) + ld (ix+UD1_FSEC##+2),l + ld (ix+UD1_FSEC##+3),h + + xor a + ret + MSXDOS2DAT: db "NEXTOR DAT" EMUDAT: @@ -1694,11 +1687,7 @@ CALC_CLUS_OK: ld a,h ;Check if cluster count cp 10h ;0Fh ;is greater than 4080 (0FF0h). - jr nc,upb_not_found - ;jr nz,upb_not_found ;If so, it is FAT16. - ;ld a,l - ;cp 0F1h - ;jr nc,upb_not_found + jr nc,upb_not_found ;If so, it is FAT16. upb_found: xor a @@ -2065,6 +2054,8 @@ CALC_NUMCLUS1: ; 0 => Drive-based driver ; bit 1: 1 => Driver supports hot-plug devices ; 0 => Hot-plug devices not supported +; bit 2: 2 => Driver provides configuration +; 0 => Driver does not provide configuration ; bit 7: 1 => MSX-DOS 2.50 driver ; 0 => Legacy driver (MSX-DOS 1/2.20/2.3x kernel) ; +5 (1): Driver main version number @@ -2191,12 +2182,8 @@ GDRV_IS_KER250: push de push de pop iy - ld hl,RDBANK## - ld (BK4_ADD##),hl - ld hl,DV_TYPE## - ld ix,CALDRV## - call CALSLT## - and 11b + call GET_DV_TYPE + and 111b or 10000000b pop iy pop ix @@ -2262,6 +2249,7 @@ GDRVR_NAME_LOOP: ; +5 (1): LUN index (0 if not a device-based driver) ; +6 (4): First sector number ; (0 if not a device-based driver, or if direct access device) +; (-1 if partition assignment is pending) ; When assigned to a file (+0 = 3): ; +1 (1): Drive where the file is located (0 = A:, etc) ; +2 (2): Flags. Bit 0: mounted in read-only mode. @@ -2373,6 +2361,19 @@ NOMNT: ld (iy+4),a ld a,(ix+UD_LI##) ld (iy+5),a + + bit UF_PAP,(ix+UD_DFLAGS##) + jr z,NOPAP + + ld a,0FFh + ld (ix+UD_FSEC##),a + ld (ix+UD_FSEC##+1),a + ld (ix+UD_FSEC##+2),a + ld (ix+UD_FSEC##+3),a + cpl + ret + +NOPAP: ld a,(ix+UD_FSEC##) ld (iy+6),a ld a,(ix+UD_FSEC##+1) @@ -2427,7 +2428,6 @@ GDLI_DOS1: or a jr nz,GDLI_ISDVB_OK - ld (iy),0 ;If device index is zero, drive is unassigned xor a ret @@ -2507,58 +2507,69 @@ F_CDRVR_GO: ld l,(ix+6) ld h,(ix+7) - ld a,(EXPTBL) - ld b,a - call GSLOT0 - cp b - ld b,(ix+3) - ld ix,CALDRV## - jr nz,CDRV_FROM_DOS + ;--- We need to ensure that the user environment is mapped in + ; so that the driver can see any possible user supplied data. - ;If BASIC slot is set in page 0, restore page 2 user segment only... -CDRV_FROM_BASIC: ld a,(DOS_VER##) or a - ld a,(P2_TPA##) - call nz,PUT_P2## - pop af + jr nz,CDRV_NODOS1 + + ;--- We are in DOS 1 mode: + ; We can just call the driver right away. + ld b,(ix+3) + ld ix,CALDRV## + pop af call CALSLT## push af pop ix - jr CDRV_END + xor a + ret +CDRV_NODOS1: + + ;--- We are in DOS 2 mode: + ; We need to restore TPA segments so that the driver + ; can see any possible user supplied data. + ; We always restore TPA segment in page 2. + ; We restore TPA segment in page 0 only if it was already + ; in place when the function was called; otherwise + ; that TPA segment could be uninitialized. + + ld a,(PS_BDO##) + and 11b + ld b,a ;Main slot number + ld a,(SS_BDO##) + rla + rla + and 1100b + or b + ld b,a ;Main slot + subslot + + ld a,(RAMAD0##) + and 1111b + cp b + jr nz,CDRV_NORAM0 - ;...otherwise, restore both page 0 and 2 -CDRV_FROM_DOS: - ld a,(DOS_VER##) - or a - ld a,(P2_TPA##) - call nz,PUT_P2## - - ld a,(DOS_VER##) - or a ld a,(P0_TPA##) - call nz,PUT_P0## - pop af + call PUT_P0## - push bc - call CALSLT## - pop bc +CDRV_NORAM0: + ld a,(P2_TPA##) + call PUT_P2## + + ld b,(ix+3) + pop af + ld ix,CALDRV## + call $CALSLT## push af pop ix - ld a,(DOS_VER##) - or a ld a,(CODE_SEG##) - call nz,PUT_P0## + call PUT_P0## + ld a,(DATA_SEG##) + call PUT_P2## -CDRV_END: - ld a,(DOS_VER##) - or a - ld a,(DATA_SEG##) ;Put kernel data segment - call nz,PUT_P2## ; back into page-2 - xor a ret @@ -2979,6 +2990,23 @@ MAP_DEF_DRVB: ;* Device-based driver: perform a drive auto-assign MAP_DEF_DEVB: + bit 2,(iy+4) ;The drive provides configuration? + jr z,MAP_DEF_DEVB_NOCFG + + ld b,0 + ld c,(ix+UD_REL##) + push hl + call ASK_DRIVE_CONFIG + pop hl + dec a + jr z,MAP_DEF_DEVB_NOCFG ;Driver did not provide config + or a + ld a,0 + jp z,SETNUMDRV + set UF_PAP,(ix+UD_DFLAGS##) ;Partition will be assigned on first access + jp SETNUMDRV + +MAP_DEF_DEVB_NOCFG: push hl push ix pop hl @@ -3056,71 +3084,26 @@ MAP_SPECIFIC: ;* Check that the specified slot/device/LUN/sector ; is not mapped to any other drive - push hl - - ld hl,UNIT_TAB##+2 - ld b,MAX_UNITS## -MAP_DRV_CHECK: - - pop de - push de - push hl - or a - sbc hl,de - ld a,h - or l - pop hl - jr nz,MAP_DRV_NOTSAME ;Do not compare against the UD being mapped - - inc hl - inc hl - jr MAP_DRV_CHECK_NEXT - -MAP_DRV_NOTSAME: - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld a,d - or e - jr z,MAP_DRV_CHECK_NEXT - - push de - pop ix ;IX = unit descriptor for existing drive - - bit UF_DBD,(ix+UD_DFLAGS##) ;If drive-based or legacy driver, skip - jr z,MAP_DRV_CHECK_NEXT - ld a,(iy) ;Compare slot against mapping data - cp (ix+UD_SLOT##) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+1) ;Compare segment number against mapping data - cp (ix+UD_SEG##) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+2) ;Compare device index against mapping data - cp (ix+UD_DI##) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+3) ;Compare LUN index against mapping data - cp (ix+UD_LI##) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+4) ;Compare starting sector number against mapping data - cp (ix+UD_FSEC##) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+5) - cp (ix+UD_FSEC##+1) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+6) - cp (ix+UD_FSEC##+2) - jr nz,MAP_DRV_CHECK_NEXT - ld a,(iy+7) - cp (ix+UD_FSEC##+3) - jr nz,MAP_DRV_CHECK_NEXT - - pop hl + push hl + push iy + push bc + ld h,(iy) + ld l,(iy+1) + ld d,(iy+2) + ld e,(iy+3) + exx + ld e,(iy+4) + ld d,(iy+5) + ld l,(iy+6) + ld h,(iy+7) + exx + call CHECK_MAP_IN_USE + pop bc + pop iy + pop hl ld a,.PUSED## - jp SETNUMDRV - -MAP_DRV_CHECK_NEXT: - djnz MAP_DRV_CHECK + jp nz,SETNUMDRV + push hl ;* Check that the device and LUN exist ; and are a block-based device @@ -3737,7 +3720,7 @@ MAPDOS1_DPBOK: or a jr nz,MAPDOS1_NOUNMAP - ld (ix+2),0 ;Set device index to 0 + ld (ix+UD1_DI##),0 ;Set device index to 0 jp MAPDOS1_END_OK MAPDOS1_NOUNMAP: @@ -3747,26 +3730,62 @@ MAPDOS1_NOUNMAP: dec a jp nz,MAPDOS1_NODEF +MAPDOS1_DEF: + push hl + push ix + ld a,(ix+UD1_SLOT##) + ld_iyh_a + call GET_DV_TYPE + pop ix + pop hl + and 100b + jr z,MAPDOS1_DEF_NOCFG + + push hl + push ix + ld c,(ix+UD1_REL##) + res 7,c ;Ignore "media changed" flag + ld b,1 + call ASK_DRIVE_CONFIG + pop ix + pop hl + or a + jr z,MAPDOS1_DEF_OK + dec a ;Driver did not provide info? + jr z,MAPDOS1_DEF_NOCFG + + ld a,0FFh + ld (ix+UD1_FSEC##),a + ld (ix+UD1_FSEC##+1),a + ld (ix+UD1_FSEC##+2),a + ld (ix+UD1_FSEC##+3),a + jr MAPDOS1_DEF_OK + +MAPDOS1_DEF_NOCFG: ;No config provided by driver, use AUTO_ASSIGN + ld (ix+UD1_DI##),0 ;At the moment leave the drive unmapped + push hl + push ix + pop hl + push hl + call AUTO_ASSIGN + pop ix + pop hl + jr MAPDOS1_DEF_OK ;Note that on error we just leave the drive unassigned + +if 0 + push ix ;Save pointer to page 3 table entry push hl ld l,(ix) ;Driver slot - ld h,(ix+1) ;Relative unit - ld (ix+2),0 ;At the moment leave the drive unmapped + ld h,(ix+UD1_REL##) ;Relative unit + ld (ix+UD1_DI##),0 ;At the moment leave the drive unmapped pop ix ;Use FAT buffer for the fake unit descriptor ld (ix+UD_SLOT##),l ld (ix+UD_PHYS##),h push ix pop hl - ld de,(NXTEMP##) ;Save lots of page 3 variables. - push de ;This is necessary because AUTO_ASSIGN uses them - ld de,(TMPDEV##) ;as temporary work area, which is OK in DOS 2 mode - push de ;but in in DOS 1 mode these are actually used for anything else. - ld de,(NXT4##) - push de - ld de,(NXT4##+2) - push de push ix push hl xor a @@ -3774,14 +3793,6 @@ MAPDOS1_NOUNMAP: pop hl ld (hl),0FFh ;Mark FAT buffer as invalid again pop ix - pop de - ld (NXT4##+2),de - pop de - ld (NXT4##),de - pop de - ld (TMPDEV##),de - pop de - ld (NXTEMP##),de pop iy ;Retrieve pointer to page 3 table entry or a ld a,0 @@ -3802,6 +3813,11 @@ MAPDOS1_NOUNMAP: push iy pop ix +endif + +MAPDOS1_DEF_OK: + ld (hl),0FFh ;Mark FAT buffer as invalid again + jp MAPDOS1_END_OK MAPDOS1_NODEF: @@ -3917,7 +3933,7 @@ MAPDOS1_CHK_NEXT: ld (ix+7),a MAPDOS1_END_OK: - set 7,(ix+1) ;Set partition changed flag + set 7,(ix+UD1_REL##) ;Set partition changed flag ld hl,0FFFFh ld (0F23Fh),hl ;Make sector buffer invalid ld a,h @@ -5278,6 +5294,21 @@ CDRVIS_S: ; _NEXTOR push hl + + ld hl,DOSV0 +NEXVER_LOOP: + push hl + ld ix,RDBANK## + xor a + call CALBNK## + pop hl + or a + jr z,NEXVER_END + call CHPUT + inc hl + jr NEXVER_LOOP +NEXVER_END: + ld hl,CNEXTOR_S call PRINT pop hl @@ -5285,7 +5316,7 @@ CDRVIS_S: CNEXTOR_S: ; ---------------------------------------- - db "Available Nextor CALL commands:",13,10 + db 13,10,"Available Nextor CALL commands:",13,10 db 13,10 db "_CHDRV (same as MSX-DOS 2,",1 db " but works in DOS 1 mode)",13,10 @@ -5440,7 +5471,6 @@ OK_NAME: ld hl,CRLF call PRINT - ;* Print relative unit number or device+LUN ld ix,BUF_LETTER @@ -5448,6 +5478,14 @@ OK_NAME: and 1 jr z,SHOW_REL + ld a,(ix+4) + or a + jr nz,SHOW_DEVLUN + ld hl,NO_DEV_MSG + call PRINT + jr OK_DEVLUN + +SHOW_DEVLUN: ld hl,DEV_MSG call PRINT ld a,(ix+4) @@ -5508,6 +5546,8 @@ ONDRV_S: db " on drive ",0 RO_S: db " (read only)",0 +NO_DEV_MSG: + db "No device assigned",0 COLON_AND_CRLF: db ":" CRLF: @@ -5833,14 +5873,19 @@ SLOFDR_FOUND: ; Check if a slot number is a Nextor kernel ; Input: E = Slot number ; Output: Cy = 0 if Nextor kernel, 1 if NOT a Nextor kernel +; HL = Pointer to entry in KER250 ; Modifies: AF, HL, B IS_NEXTOR_KER: + ld a,e + or a + scf + ret z ld hl,KER250 ld b,4 IS_NEX_LOOP: ld a,(hl) - and 10111111b + and 10001111b cp e scf ccf @@ -5865,6 +5910,7 @@ GET_DVB_POINTER: ld b,(ix-1) GET_DVB_LOOP: ld a,(ix) ;Driver slot + and 10001111b cp e jr nz,GET_DVB_NEXT @@ -5898,5 +5944,403 @@ GET_DISKID_HL: ld hl,PROCNM+8 ret +;----------------------------------------------------------------------------- +; + PROC DRVS2 + +; Get the number of drives assigned to this driver at boot time in DOS 2 mode. +; Input: B<>0 if the driver provides configuration. +; Output: A = number of drives. + + push bc + call SCAN_5_KEY + pop bc + ld c,a + + ld a,b + or a + jr z,COUNTDEVS + + ;If the driver provices configuration, we first try asking the driver + ;(we pass C=00100000b if "5" key is pressed) + + push bc + ld ix,DV_CONFIG## + ld a,CFG_DRVS + ld b,0 + ex af,af' + ld a,DV_BANK## + call CALBNK## + or a + ld a,b + pop bc + ret z + + ;The driver does not provide configuration, or asking for the number of drives + ;results in an error returned: + ;Invoke LUN_INFO on all possible devices of the driver, + ;and return in A the number of devices found. + ;Input: C=00100000b if "5" key is pressed, C=0 otherwise + +COUNTDEVS: + push bc + call COUNTDEVS0 + pop bc + or a + ret z ;No devices found + + bit 5,c + ret z + ld a,1 ;Only 1 device if "5" key is pressed + ret + +COUNTDEVS0: + ld c,0 + ld a,1 +COUNTDEVS1: + ld b,7 +COUNTDEVS2: + push af + push bc + ld hl,($SECBUF##) ;We don't actually need this data + ld ix,LUN_INFO## + ex af,af' + ld a,DV_BANK## + call CALBNK## + pop bc + or a + jr nz,COUNTDEVS3 + inc c +COUNTDEVS3: + pop af + djnz COUNTDEVS2 + inc a + cp 8 + jr c,COUNTDEVS1 + ld a,c ;!!! + ret + + +;----------------------------------------------------------------------------- +; +; This routine is invoked right before the drive assignment process in DOS 1 mode. +; It scans all the available kernels and for those who are Nextor device-based +; and provide configuration, asks how many drives should be assigned at boot. +; Then it updates the drives count for that kernel in DRVTBL accordingly. + +DRVS1: + ld hl,DRVTBL##+1 + ld b,4 ;B=Entries in DRVTBL + +DRVS1LOOP: + ld e,(hl) + push bc + push hl + + push de + call IS_NEXTOR_KER + pop de + jr c,DRVS1NEXT ;Skip if not a Nextor kernel + + ld_iyh_e + call GET_DV_TYPE + bit 0,a ;Device-based? + jr z,DRVS1NEXT ;No: skip + and 100b + cp 100b ;Provides config? + jr nz,DRVS1NX3 ;No: skip but check "5" key + + call SCAN_5_KEY + ld c,a + ld hl,DV_CONFIG## + ld (BK4_ADD##),hl + ld a,CFG_DRVS + ld b,1 + ld ix,CALDRV## + call CALSLT + or a + jr nz,DRVS1NX3 ;Skip but check "5" key if that config is not available + +DRVS1CHG: + pop hl + dec hl + ld (hl),b + inc hl + jr DRVS1NX2 + +DRVS1NEXT: + pop hl +DRVS1NX2: + pop bc + inc hl + inc hl + djnz DRVS1LOOP + ret + +DRVS1NX3: + call SCAN_5_KEY + and 00100000b + ld b,1 + jr nz,DRVS1CHG + jr DRVS1NEXT + + +;----------------------------------------------------------------------------- +; +; Check if a given candidate partition assignment information is already +; in use in any unit. +; Input: IX = Address of target unit descriptor +; (will be skipped in the check), DOS 2 mode only +; H = Driver slot number +; L = Driver segment number +; D = Device index +; E = LUN index +; (HLDE)' = Partition first absolute sector +; Output: A = 0 & Z: not in use +; A = 1 & NZ: already in use +; Modifies: AF, B, DE, HL, IX, IY + +CHECK_MAP_IN_USE: + ld a,(DOS_VER##) + or a + jp z,CMIU_DOS1 + +CMIU_DOS2: + push de + push hl + + push ix + + ld iy,UNIT_TAB##+2 + ld b,MAX_UNITS## +CMIU_CHECK: + + pop de ;Target unit descriptor pointer + push de + + ld l,(iy) + ld h,(iy+1) + + or a + sbc hl,de + ld a,h + or l + jr nz,CMIU_NOTSAME ;Do not compare against the UD being mapped + + inc iy + inc iy + jr CMIU_CHECK_NEXT + +CMIU_NOTSAME: + ld e,(iy) + inc iy + ld d,(iy) + inc iy + ld a,d + or e + jr z,CMIU_CHECK_NEXT ;Unit descriptor not in use + + push de + pop ix ;IX = unit descriptor being examined + + bit UF_DBD,(ix+UD_DFLAGS##) ;If drive-based or legacy driver, skip + jr z,CMIU_CHECK_NEXT + inc sp + inc sp + pop hl + pop de + push de + push hl + dec sp + dec sp + ld a,h ;Compare slot against mapping data + cp (ix+UD_SLOT##) + jr nz,CMIU_CHECK_NEXT + ld a,l ;Compare segment number against mapping data + cp (ix+UD_SEG##) + jr nz,CMIU_CHECK_NEXT + ld a,d ;Compare device index against mapping data + cp (ix+UD_DI##) + jr nz,CMIU_CHECK_NEXT + ld a,e ;Compare LUN index against mapping data + cp (ix+UD_LI##) + jr nz,CMIU_CHECK_NEXT + exx + ld a,e ;Compare starting sector number against mapping data + cp (ix+UD_FSEC##) + jr nz,CMIU_CHECK_NEXX + ld a,d + cp (ix+UD_FSEC##+1) + jr nz,CMIU_CHECK_NEXX + ld a,l + cp (ix+UD_FSEC##+2) + jr nz,CMIU_CHECK_NEXX + ld a,h + cp (ix+UD_FSEC##+3) + jr nz,CMIU_CHECK_NEXX + + exx + pop ix + ld a,1 + jr CMIU_END + +CMIU_CHECK_NEXX: + exx +CMIU_CHECK_NEXT: + djnz CMIU_CHECK + xor a + pop ix + +CMIU_END: + pop hl + pop de + or a + ret + + ;--- DOS 1 version + +CMIU_DOS1: + ld iy,(DVB_TABLE##) + ld b,(iy) + ld a,b + or a + ret z + inc iy + +CMIU1_LOOP: + ld a,(iy) + cp h + jr nz,CMIU1_NEXT + + ld a,(iy+2) + or a ;If device index is 0, it is an unused table entry + jr z,CMIU1_NEXT + cp d + jr nz,CMIU1_NEXT + + ld a,(iy+3) ;Check LUN index + cp e + jr nz,CMIU1_NEXT + + exx + + ld a,(iy+4) + cp e + jr nz,CMIU1_NEXXT + ld a,(iy+5) + cp d + jr nz,CMIU1_NEXXT + ld a,(iy+6) + cp l + jr nz,CMIU1_NEXXT + ld a,(iy+7) + cp h + jr nz,CMIU1_NEXXT + + exx + ld a,1 + or a + ret + +CMIU1_NEXXT: + exx +CMIU1_NEXT: + ld a,b + ld bc,8 + add iy,bc + ld b,a + djnz CMIU1_LOOP + xor a + ret + + +;---------------- +; +; Invoke DRV_CONFIG in a driver to get the default device for a drive, +; and if the driver provides the info, invokes AUTO_ASPART. +; Assumes that the driver is device-based and implements DRV_CONFIG. +; +; Input: IX = Addess of unit descriptor (in DOS 2 mode) or entry in device-based drives table (in DOS 1 mode) +; Must have UD_SLOT set +; C = Relative unit for the drive +; B = 0 for DOS 2 mode, 1 for DOS 1 mode +; Output: A = 0 ok +; 1 driver did not provide info for that drive +; 2 driver provided info, but can't assign partition to drive +; If A=0 or 2, sets UD_DI, UD_LI and UD_SEG in the unit descriptor +; If A=0, sets UF_FOK in UD_DFLAGS in the unit descriptor +; Modifies: AF, BC, DE, HL, IY + +ASK_DRIVE_CONFIG: + push bc ;BC=DOS mode and relative unit + ld a,(ix+UD_SLOT##) + ld_iyh_a + ld hl,DV_CONFIG## + ld (BK4_ADD##),hl + ld a,CFG_DEVLUN + push ix + ld ix,CALDRV## + call CALSLT + pop ix + pop hl ;H=DOS mode and relative unit + or a + ret nz + + ld a,h + or a + jr nz,ASKDRVCFG_DOS1 + ld (ix+UD_REL##),l + ld (ix+UD_DI##),b + ld (ix+UD_LI##),c + ld (ix+UD_SEG##),0FFh + ld (ix+UD_TIME##),0 + set UF_DBD,(ix+UD_DFLAGS##) + jr ASKDRVCFG_NEXT +ASKDRVCFG_DOS1: + ld (ix+UD1_REL##),l + ld (ix+UD1_DI##),b + ld (ix+UD1_LI##),c +ASKDRVCFG_NEXT: + + push hl ;H=DOS mode + push ix + pop hl + push hl + call AUTO_ASPART + pop ix + pop bc ;B=DOS mode + + dec a + ld a,2 + ret z + ld a,b + dec a + ret z + set UF_FOK,(ix+UD_DFLAGS##) + xor a + ret + +;---------------------------- +; +; Read the DV_TYPE byte from a driver +; Input: IYh = slot number +; Output: A = Value of DV_TYPE +; Modifies: AF, BC, DE, HL, IX, IY + +GET_DV_TYPE: + ld hl,RDBANK## + ld (BK4_ADD##),hl + ld hl,DV_TYPE## + ld ix,CALDRV## + call CALSLT## + ret + +SCAN_5_KEY: + xor a + call SNSMAT + and 00100000b + xor 00100000b ;A=00100000b if "5" key pressed, 0 if not + ret + finish end diff --git a/source/msxdos25/bank4/ramdrv.mac b/source/kernel/bank4/ramdrv.mac similarity index 100% rename from source/msxdos25/bank4/ramdrv.mac rename to source/kernel/bank4/ramdrv.mac diff --git a/source/msxdos25/bank4/ramdrvh.mac b/source/kernel/bank4/ramdrvh.mac similarity index 100% rename from source/msxdos25/bank4/ramdrvh.mac rename to source/kernel/bank4/ramdrvh.mac diff --git a/source/msxdos25/bank4/seg.mac b/source/kernel/bank4/seg.mac similarity index 100% rename from source/msxdos25/bank4/seg.mac rename to source/kernel/bank4/seg.mac diff --git a/source/msxdos25/bank4/time.mac b/source/kernel/bank4/time.mac similarity index 100% rename from source/msxdos25/bank4/time.mac rename to source/kernel/bank4/time.mac diff --git a/source/kernel/bank5/.gitignore b/source/kernel/bank5/.gitignore new file mode 100644 index 00000000..1d84c09b --- /dev/null +++ b/source/kernel/bank5/.gitignore @@ -0,0 +1,5 @@ +bank.inc +condasm.inc +const.inc +macros.inc +printf.cs diff --git a/releases/2.0 final/fdisk/AsmCall.c b/source/kernel/bank5/AsmCall.c similarity index 91% rename from releases/2.0 final/fdisk/AsmCall.c rename to source/kernel/bank5/AsmCall.c index ea3f4091..423c8bc7 100644 --- a/releases/2.0 final/fdisk/AsmCall.c +++ b/source/kernel/bank5/AsmCall.c @@ -30,7 +30,7 @@ void DriverCall(byte slot, uint routineAddress) void DosCall(byte function, register_usage outRegistersDetail) { regs.Bytes.C = function; - SwitchSystemBankThenCall(0xF37D, outRegistersDetail); + SwitchSystemBankThenCall((int)0xF37D, outRegistersDetail); } diff --git a/releases/2.0 final/fdisk/AsmCall.h b/source/kernel/bank5/AsmCall.h similarity index 100% rename from releases/2.0 final/fdisk/AsmCall.h rename to source/kernel/bank5/AsmCall.h diff --git a/source/msxdos25/bank4/CPM32.EXE b/source/kernel/bank5/CPM32.EXE similarity index 100% rename from source/msxdos25/bank4/CPM32.EXE rename to source/kernel/bank5/CPM32.EXE diff --git a/source/msxdos25/bank5/FdiskExample.PNG b/source/kernel/bank5/FdiskExample.PNG similarity index 100% rename from source/msxdos25/bank5/FdiskExample.PNG rename to source/kernel/bank5/FdiskExample.PNG diff --git a/source/msxdos25/bank4/L80.CPM b/source/kernel/bank5/L80.CPM similarity index 100% rename from source/msxdos25/bank4/L80.CPM rename to source/kernel/bank5/L80.CPM diff --git a/source/msxdos25/bank4/LIB80.CPM b/source/kernel/bank5/LIB80.CPM similarity index 100% rename from source/msxdos25/bank4/LIB80.CPM rename to source/kernel/bank5/LIB80.CPM diff --git a/source/msxdos25/bank4/M80.CPM b/source/kernel/bank5/M80.CPM similarity index 100% rename from source/msxdos25/bank4/M80.CPM rename to source/kernel/bank5/M80.CPM diff --git a/releases/2.0 final/fdisk/asm.h b/source/kernel/bank5/asm.h similarity index 100% rename from releases/2.0 final/fdisk/asm.h rename to source/kernel/bank5/asm.h diff --git a/source/msxdos25/bank5/asm.lib b/source/kernel/bank5/asm.lib similarity index 100% rename from source/msxdos25/bank5/asm.lib rename to source/kernel/bank5/asm.lib diff --git a/source/msxdos25/bank5/b5.mac b/source/kernel/bank5/b5.mac similarity index 100% rename from source/msxdos25/bank5/b5.mac rename to source/kernel/bank5/b5.mac diff --git a/source/msxdos25/bank5/compfdsk.bat b/source/kernel/bank5/compfdsk.bat similarity index 54% rename from source/msxdos25/bank5/compfdsk.bat rename to source/kernel/bank5/compfdsk.bat index 1d8fa3a3..ac1917fb 100644 --- a/source/msxdos25/bank5/compfdsk.bat +++ b/source/kernel/bank5/compfdsk.bat @@ -3,11 +3,11 @@ echo Compiling, please be patient... sdasz80 -o fdisk_crt0.rel fdisk_crt0.s if errorlevel 1 goto :error -sdcc --code-loc 0x4120 --data-loc 0x8020 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 --no-std-crt0 fdisk_crt0.rel msxchar.lib fdisk.c +sdcc --code-loc 0x4120 --data-loc 0x8020 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 --max-allocs-per-node 10000 --allow-unsafe-read --opt-code-size --no-std-crt0 fdisk_crt0.rel fdisk.c if errorlevel 1 goto :error hex2bin -e dat fdisk.ihx -sdcc --code-loc 0x4120 --data-loc 0xA000 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 --no-std-crt0 fdisk_crt0.rel msxchar.lib fdisk2.c +sdcc --code-loc 0x4120 --data-loc 0xA000 -mz80 --disable-warning 196 --disable-warning 84 --disable-warning 85 --max-allocs-per-node 10000 --allow-unsafe-read --opt-code-size --no-std-crt0 fdisk_crt0.rel fdisk2.c if errorlevel 1 goto :error hex2bin -e dat fdisk2.ihx diff --git a/source/msxdos25/bank5/compile.bat b/source/kernel/bank5/compile.bat similarity index 100% rename from source/msxdos25/bank5/compile.bat rename to source/kernel/bank5/compile.bat diff --git a/releases/2.0 final/fdisk/dos.h b/source/kernel/bank5/dos.h similarity index 100% rename from releases/2.0 final/fdisk/dos.h rename to source/kernel/bank5/dos.h diff --git a/source/msxdos25/bank5/fdisk.c b/source/kernel/bank5/fdisk.c similarity index 94% rename from source/msxdos25/bank5/fdisk.c rename to source/kernel/bank5/fdisk.c index b1c61b11..4665e66e 100644 --- a/source/msxdos25/bank5/fdisk.c +++ b/source/kernel/bank5/fdisk.c @@ -944,7 +944,7 @@ void PrintOnePartitionInfo(partitionInfo* info) print(": "); if(info->partitionType == PARTYPE_FAT12) { print("FAT12"); - } else if(info->partitionType == PARTYPE_FAT16) { + } else if(info->partitionType == PARTYPE_FAT16 || info->partitionType == PARTYPE_FAT16_SMALL || info->partitionType == PARTYPE_FAT16_LBA) { print("FAT16"); } else if(info->partitionType == 0xB || info->partitionType == 0xC) { print("FAT32"); @@ -1009,6 +1009,7 @@ void AddPartition() char ch; bool validNumberEntered = false; ulong enteredSizeInK; + ulong temp; bool lessThan1MAvailable; bool sizeInKSpecified; ulong unpartitionnedSpaceExceptAlignmentInK = (unpartitionnedSpaceInSectors - EXTRA_PARTITION_SECTORS) / 2; @@ -1065,14 +1066,17 @@ void AddPartition() break; } else if(ch == '\0' || ch == 13 || ch == 'm') { validNumberEntered = true; - enteredSizeInK *= 1024; + enteredSizeInK <<= 10; sizeInKSpecified = false; break; } else if(ch < '0' || ch > '9') { break; } - enteredSizeInK = (enteredSizeInK * 10) + (ch - '0'); - + //This should be: enteredSizeInK = (enteredSizeInK * 10) + (ch - '0'), + //but thew computer crashes. Looks like the compiler is doing something wrong + //when linking the longs handling library. + temp = enteredSizeInK; + enteredSizeInK = (enteredSizeInK << 3) + temp + temp + (ch - '0'); lineLength--; if(lineLength == 0) { validNumberEntered = true; @@ -1084,7 +1088,7 @@ void AddPartition() if(validNumberEntered && (sizeInKSpecified && (enteredSizeInK > maxPartitionSizeInK) || (enteredSizeInK < MIN_PARTITION_SIZE_IN_K)) || - (!sizeInKSpecified && (enteredSizeInK > ((ulong)maxPartitionSizeInM * (ulong)1024))) + (!sizeInKSpecified && (enteredSizeInK > ((ulong)maxPartitionSizeInM * 1024))) ) { validNumberEntered = false; } @@ -1142,7 +1146,8 @@ void TestDeviceAccess() InitializeScreenForTestDeviceAccess(message); while(GetKey() == 0) { - _ultoa(sectorNumber, buffer, 10); + sprintf(buffer, "%u", sectorNumber); + //_ultoa(sectorNumber, buffer, 10); Locate(messageLen, MESSAGE_ROW); print(buffer); print(" ...\x1BK"); @@ -1157,7 +1162,7 @@ void TestDeviceAccess() if((error = regs.Bytes.A) != 0) { strcpy(buffer, errorMessageHeader); - _ultoa(sectorNumber, buffer + strlen(errorMessageHeader), 10); + sprintf(buffer + strlen(errorMessageHeader), "%u", sectorNumber); strcpy(buffer + strlen(buffer), ":"); PrintDosErrorMessage(error, buffer); PrintStateMessage("Continue reading sectors? (y/n) "); @@ -1586,4 +1591,5 @@ int CallFunctionInExtraBank(int functionNumber, void* parametersBuffer) } -#include "asmcall.c" \ No newline at end of file +#include "asmcall.c" +#include "printf.c" diff --git a/releases/2.0 final/fdisk/fdisk.h b/source/kernel/bank5/fdisk.h similarity index 100% rename from releases/2.0 final/fdisk/fdisk.h rename to source/kernel/bank5/fdisk.h diff --git a/source/msxdos25/bank5/fdisk.lnk b/source/kernel/bank5/fdisk.lnk similarity index 100% rename from source/msxdos25/bank5/fdisk.lnk rename to source/kernel/bank5/fdisk.lnk diff --git a/source/msxdos25/bank5/fdisk2.c b/source/kernel/bank5/fdisk2.c similarity index 95% rename from source/msxdos25/bank5/fdisk2.c rename to source/kernel/bank5/fdisk2.c index 45b5bb3e..0905f77e 100644 --- a/source/msxdos25/bank5/fdisk2.c +++ b/source/kernel/bank5/fdisk2.c @@ -164,6 +164,7 @@ void CreateFatBootSector(dosFilesystemParameters* parameters) sector->sectorsPerFat = parameters->sectorsPerFat; strcpy(sector->params.standard.volumeLabelString, "NEXTOR 2.0 "); //it is same for DOS 2.20 format sector->params.standard.serialNumber = GetNewSerialNumber(); //it is same for DOS 2.20 format + sector->mbrSignature = 0xAA55; if(parameters->isFat16) { sector->params.standard.bigSectorCount = parameters->totalSectors; @@ -176,7 +177,6 @@ void CreateFatBootSector(dosFilesystemParameters* parameters) strcpy(sector->params.DOS220.fatTypeString, "FAT12 "); memcpy(&(sector->params.DOS220.z80BootCode), SectorBootCode, (uint)0xC090 - (uint)0xC03E); } - } @@ -496,6 +496,7 @@ int CreatePartition(int index) ulong extendedPartitionFirstAbsoluteSector; partitionTableEntry* tableEntry; bool onlyPrimaryPartitions = (partitionsCount <= 4); + ulong x; if(onlyPrimaryPartitions) { mbrSector = 0; @@ -547,6 +548,9 @@ int CreatePartition(int index) mbr->mbrSignature = 0xAA55; + x = tableEntry->firstAbsoluteSector; //Without this, firstAbsoluteSector is written to disk as 0. WTF??? + tableEntry->firstAbsoluteSector = x; + memcpy(sectorBufferBackup, sectorBuffer, 512); if((error = WriteSectorToDevice(driverSlot, deviceIndex, selectedLunIndex, mbrSector)) != 0) { @@ -579,4 +583,4 @@ void Locate(byte x, byte y) } -#include "asmcall.c" \ No newline at end of file +#include "asmcall.c" diff --git a/source/msxdos25/bank5/fdisk2.lnk b/source/kernel/bank5/fdisk2.lnk similarity index 100% rename from source/msxdos25/bank5/fdisk2.lnk rename to source/kernel/bank5/fdisk2.lnk diff --git a/source/msxdos25/bank5/fdisk_crt0.s b/source/kernel/bank5/fdisk_crt0.s similarity index 92% rename from source/msxdos25/bank5/fdisk_crt0.s rename to source/kernel/bank5/fdisk_crt0.s index 663c00d5..26629330 100644 --- a/source/msxdos25/bank5/fdisk_crt0.s +++ b/source/kernel/bank5/fdisk_crt0.s @@ -36,6 +36,7 @@ init: ;call gsinit ;* Place data after program code, and data init code after data + .area _HOME .area _CODE .area _DATA _heap_top:: diff --git a/source/msxdos25/bank5/mkdosfs.c b/source/kernel/bank5/mkdosfs.c similarity index 100% rename from source/msxdos25/bank5/mkdosfs.c rename to source/kernel/bank5/mkdosfs.c diff --git a/releases/2.0 final/fdisk/msxchar.lib b/source/kernel/bank5/msxchar.lib similarity index 100% rename from releases/2.0 final/fdisk/msxchar.lib rename to source/kernel/bank5/msxchar.lib diff --git a/source/msxdos25/bank5/partit.h b/source/kernel/bank5/partit.h similarity index 92% rename from source/msxdos25/bank5/partit.h rename to source/kernel/bank5/partit.h index 9b940763..ca8019f0 100644 --- a/source/msxdos25/bank5/partit.h +++ b/source/kernel/bank5/partit.h @@ -21,6 +21,7 @@ #define PARTYPE_FAT16_SMALL 4 #define PARTYPE_EXTENDED 5 #define PARTYPE_FAT16 6 +#define PARTYPE_FAT16_LBA 0x0E #define PSTATE_EXISTS 0 #define PSTATE_ADDED 1 @@ -88,6 +89,8 @@ typedef struct { byte z80BootCode; } DOS220; } params; + byte emptySpace[447]; + uint mbrSignature; } fatBootSector; typedef struct { diff --git a/source/kernel/bank5/printf.c b/source/kernel/bank5/printf.c new file mode 100644 index 00000000..d788d184 --- /dev/null +++ b/source/kernel/bank5/printf.c @@ -0,0 +1,185 @@ +/* + Simplified printf and sprintf for SDCC+Z80 + (c) 2018 Konamiman - www.konamiman.com + + This version is about 1.5K smaller than the one contained + in the z80 library supplied with SDCC + + To compile: + sdcc -mz80 -c --disable-warning 85 --disable-warning 196 --max-allocs-per-node 100000 --allow-unsafe-read --opt-code-size printf.c + + Supported format specifiers: + + %d or %i: signed int + %ud or %ui: unsigned int + %x: hexadecimal int + %c: character + %s: string + %%: a % character + + Also if SUPPORT_LONG is defined: + + %l: signed long + %ul: unsigned long + %lx: hexadecimal long +*/ + +//#define SUPPORT_LONG + +#include +#include "system.h" + +#ifdef SUPPORT_LONG +extern void _ultoa(long val, char* buffer, char base); +extern void _ltoa(long val, char* buffer, char base); +#endif +extern void _uitoa(int val, char* buffer, char base); +extern void _itoa(int val, char* buffer, char base); + +static int format_string(const char* buf, const char *fmt, va_list ap); + +int printf(const char *fmt, ...) +{ + va_list arg; + va_start(arg, fmt); + return format_string(0, fmt, arg); +} + +int sprintf(const char* buf, const char* fmt, ...) +{ + va_list arg; + va_start(arg, fmt); + return format_string(buf, fmt, arg); +} + +static void do_char(const char* buf, char c) __naked +{ + __asm + + ld hl,#4 + add hl,sp + ld e,(hl) + + dec hl + ld a,(hl) + dec hl + ld l,(hl) + ld h,a + or l + + ld a,e + jp z,CHPUT + + ld(hl),e + ret + + __endasm; +} + +#define do_char_inc(c) {do_char(bufPnt,c); if(bufPnt) { bufPnt++; } count++;} + +static int format_string(const char* buf, const char *fmt, va_list ap) +{ + char *fmtPnt; + char *bufPnt; + char base; +#ifdef SUPPORT_LONG + char isLong; +#endif + char isUnsigned; + char *strPnt; + long val; + static char buffer[16]; + char theChar; + int count=0; + + fmtPnt = fmt; + bufPnt = buf; + + while((theChar = *fmtPnt)!=0) + { + #ifdef SUPPORT_LONG + isLong = 0; + #endif + isUnsigned = 0; + base = 10; + + fmtPnt++; + + if(theChar != '%') { + do_char_inc(theChar); + continue; + } + + theChar = *fmtPnt; + fmtPnt++; + + if(theChar == 's') + { + strPnt = va_arg(ap, char *); + while((theChar = *strPnt++) != 0) + do_char_inc(theChar); + + continue; + } + + if(theChar == 'c') + { + val = va_arg(ap, int); + do_char_inc((char) val); + + continue; + } + +#ifdef SUPPORT_LONG + if(theChar == 'l') + { + isLong = 1; + theChar = *fmtPnt; + fmtPnt++; + } +#endif + + if(theChar == 'u') { + isUnsigned = 1; + } + else if(theChar == 'x') { + base = 16; + } + else if(theChar != 'd' && theChar != 'i') { + do_char_inc(theChar); + continue; + } + +#ifdef SUPPORT_LONG + if(isLong) + val = va_arg(ap, long); + else + val = va_arg(ap, int); + + if(isUnsigned && isLong) + _ultoa(val, buffer, base); + else if(isUnsigned) + _uitoa(val, buffer, base); + else if(isLong) + _ltoa(val, buffer, base); + else + _itoa(val, buffer, base); +#else + val = va_arg(ap, int); + + if(isUnsigned) + _uitoa(val, buffer, base); + else + _itoa(val, buffer, base); +#endif + + strPnt = buffer; + while((theChar = *strPnt++) != 0) + do_char_inc(theChar); + } + + if(bufPnt) *bufPnt = '\0'; + + return count; +} diff --git a/releases/2.0 final/fdisk/system.h b/source/kernel/bank5/system.h similarity index 100% rename from releases/2.0 final/fdisk/system.h rename to source/kernel/bank5/system.h diff --git a/releases/2.0 final/fdisk/types.h b/source/kernel/bank5/types.h similarity index 100% rename from releases/2.0 final/fdisk/types.h rename to source/kernel/bank5/types.h diff --git a/source/kernel/bank6/.gitignore b/source/kernel/bank6/.gitignore new file mode 100644 index 00000000..4131f0ca --- /dev/null +++ b/source/kernel/bank6/.gitignore @@ -0,0 +1,4 @@ +bank.inc +condasm.inc +const.inc +macros.inc diff --git a/source/msxdos25/bank5/CPM32.EXE b/source/kernel/bank6/CPM32.EXE similarity index 100% rename from source/msxdos25/bank5/CPM32.EXE rename to source/kernel/bank6/CPM32.EXE diff --git a/source/msxdos25/bank5/L80.CPM b/source/kernel/bank6/L80.CPM similarity index 100% rename from source/msxdos25/bank5/L80.CPM rename to source/kernel/bank6/L80.CPM diff --git a/source/msxdos25/bank5/LIB80.CPM b/source/kernel/bank6/LIB80.CPM similarity index 100% rename from source/msxdos25/bank5/LIB80.CPM rename to source/kernel/bank6/LIB80.CPM diff --git a/source/msxdos25/bank5/M80.CPM b/source/kernel/bank6/M80.CPM similarity index 100% rename from source/msxdos25/bank5/M80.CPM rename to source/kernel/bank6/M80.CPM diff --git a/source/msxdos25/bank5/asm.h b/source/kernel/bank6/asm.h similarity index 100% rename from source/msxdos25/bank5/asm.h rename to source/kernel/bank6/asm.h diff --git a/source/msxdos25/bank6/asm.lib b/source/kernel/bank6/asm.lib similarity index 100% rename from source/msxdos25/bank6/asm.lib rename to source/kernel/bank6/asm.lib diff --git a/source/msxdos25/bank6/b6.mac b/source/kernel/bank6/b6.mac similarity index 100% rename from source/msxdos25/bank6/b6.mac rename to source/kernel/bank6/b6.mac diff --git a/source/msxdos25/bank6/dos.h b/source/kernel/bank6/dos.h similarity index 100% rename from source/msxdos25/bank6/dos.h rename to source/kernel/bank6/dos.h diff --git a/source/msxdos25/bank6/fdisk_crt0.s b/source/kernel/bank6/fdisk_crt0.s similarity index 100% rename from source/msxdos25/bank6/fdisk_crt0.s rename to source/kernel/bank6/fdisk_crt0.s diff --git a/source/msxdos25/bank5/msxchar.lib b/source/kernel/bank6/msxchar.lib similarity index 100% rename from source/msxdos25/bank5/msxchar.lib rename to source/kernel/bank6/msxchar.lib diff --git a/source/msxdos25/bank6/partit.h b/source/kernel/bank6/partit.h similarity index 100% rename from source/msxdos25/bank6/partit.h rename to source/kernel/bank6/partit.h diff --git a/source/msxdos25/bank5/system.h b/source/kernel/bank6/system.h similarity index 100% rename from source/msxdos25/bank5/system.h rename to source/kernel/bank6/system.h diff --git a/source/msxdos25/bank6/types.h b/source/kernel/bank6/types.h similarity index 100% rename from source/msxdos25/bank6/types.h rename to source/kernel/bank6/types.h diff --git a/source/msxdos25/chgbnk.mac b/source/kernel/chgbnk.mac similarity index 100% rename from source/msxdos25/chgbnk.mac rename to source/kernel/chgbnk.mac diff --git a/source/msxdos25/codes.mac b/source/kernel/codes.mac similarity index 100% rename from source/msxdos25/codes.mac rename to source/kernel/codes.mac diff --git a/source/msxdos25/compile.bat b/source/kernel/compile.bat similarity index 81% rename from source/msxdos25/compile.bat rename to source/kernel/compile.bat index f7e9ee4f..5da360b2 100644 --- a/source/msxdos25/compile.bat +++ b/source/kernel/compile.bat @@ -177,8 +177,8 @@ dd if=bank5\fdisk.dat of=dos250ba.dat bs=1 count=16000 seek=82176 dd if=bank5\fdisk2.dat of=dos250ba.dat bs=1 count=8000 seek=98560 copy bank4\b4rd.bin dd if=b4rd.bin of=dos250ba.dat bs=1 count=15 seek=65664 -copy dos250ba.dat Nextor-2.1-alpha2.base.dat -copy dos250ba.dat ..\..\bin\kernels\Nextor-2.1-alpha2.base.dat +copy dos250ba.dat Nextor-2.1.0-beta1.base.dat +copy dos250ba.dat ..\..\bin\kernels\Nextor-2.1.0-beta1.base.dat echo . echo ***************** @@ -204,7 +204,7 @@ copy ..\..\codes.rel copy ..\..\kvar.rel copy ..\..\data.rel copy ..\..\chgbnk.rel -copy ..\b6.mac +copy ..\..\bank6\b6.mac copy ..\..\bank0\b0labels.inc for %%A in (B6,DRIVER,CHGBNK) do cpm32 M80 =%%A cpm32 L80 /P:4100,DRIVER,DRIVER/N/X/Y/E @@ -212,8 +212,8 @@ cpm32 L80 /P:7fd0,CHGBNK,CHGBNK/N/X/Y/E hex2bin -s 4000 driver.hex hex2bin -s 7FD0 CHGBNK.hex -..\..\mknexrom ..\..\Nextor-2.1-alpha2.base.dat Nextor-2.1-alpha2.%%~nc.ROM /d:driver.bin /m:chgbnk.bin -copy Nextor-2.1-alpha2.%%~nc.ROM ..\..\..\..\bin\kernels +..\..\..\..\wintools\mknexrom ..\..\Nextor-2.1.0-beta1.base.dat Nextor-2.1.0-beta1.%%~nc.ROM /d:driver.bin /m:chgbnk.bin +copy Nextor-2.1.0-beta1.%%~nc.ROM ..\..\..\..\bin\kernels del b6.mac del *.rom cd .. @@ -222,15 +222,20 @@ cd .. echo . echo *** -echo *** Driver: SD SCC+ +echo *** Driver: MegaFlashROM SD SCC+ echo *** echo . -cd sdscc -..\..\mknexrom ..\..\Nextor-2.1-alpha2.base.dat nextor2.rom /d:driver.bin /m:Mapper.ASCII8.bin -copy nextor2.rom ..\..\..\..\bin\kernels\Nextor-2.1-alpha2.MegaFlashSDSCC.ROM +cd MegaFlashRomSD +..\..\..\..\wintools\mknexrom ..\..\Nextor-2.1.0-beta1.base.dat nextor2.rom /d:driver-1slot.dat /m:Mapper.ASCII8.bin +copy nextor2.rom ..\..\..\..\bin\kernels\Nextor-2.1.0-beta1.MegaFlashSDSCC.1-slot.ROM sjasm makerecoverykernel.asm kernel.dat -copy kernel.dat ..\..\..\..\bin\kernels\Nextor-2.1-alpha2.MegaFlashSDSCC.Recovery.ROM +copy kernel.dat ..\..\..\..\bin\kernels\Nextor-2.1.0-beta1.MegaFlashSDSCC.1-slot.Recovery.ROM +del nextor2.rom +..\..\..\..\wintools\mknexrom ..\..\Nextor-2.1.0-beta1.base.dat nextor2.rom /d:driver-2slots.dat /m:Mapper.ASCII8.bin +copy nextor2.rom ..\..\..\..\bin\kernels\Nextor-2.1.0-beta1.MegaFlashSDSCC.2-slots.ROM +sjasm makerecoverykernel.asm kernel.dat +copy kernel.dat ..\..\..\..\bin\kernels\Nextor-2.1.0-beta1.MegaFlashSDSCC.2-slots.Recovery.ROM cd .. echo . diff --git a/source/msxdos25/condasm.inc b/source/kernel/condasm.inc similarity index 79% rename from source/msxdos25/condasm.inc rename to source/kernel/condasm.inc index a68e8206..f1ef44ee 100644 --- a/source/msxdos25/condasm.inc +++ b/source/kernel/condasm.inc @@ -8,9 +8,9 @@ HYBRID equ -1 ;DOS1/DOS2 hybrid system STURBO equ -1 ;support super turbo mode (for MSXturboR) BUILTIN equ -1 ;built-in system -ALPHA equ 2 ;Level of Alpha release (0: no alpha) +ALPHA equ 0 ;Level of Alpha release (0: no alpha) ALPHAL equ "" ;Letter after the Alpha release number, or empty -BETA equ 0 ;Level of Beta release (0: no beta) +BETA equ 1 ;Level of Beta release (0: no beta) RC equ 0 ;Level of RC (0: no RC) ; ;----------------------------------------------------------------------------- diff --git a/source/msxdos25/const.inc b/source/kernel/const.inc similarity index 93% rename from source/msxdos25/const.inc rename to source/kernel/const.inc index 7b6ffa89..50595b6a 100644 --- a/source/msxdos25/const.inc +++ b/source/kernel/const.inc @@ -241,8 +241,9 @@ UFM_MT equ (1 SHL UF_MNT) UF_DBD equ 0 ;Set => drive assigned to a device-based driver UF_HPL equ 1 ;Set => device supports hot-plug UF_RMV equ 2 ;Set => drive assigned to a removable device -UF_DFS equ 3 ;Set => drive is controlled by direct filesystem access +UF_PAP equ 3 ;Set => drive is pending partition assignment UF_FOK equ 4 ;Set => value at UD_FSEC is valid +UF_NCH equ 5 ;Set => discard next device change status and return "not changed" ; ; ; MASKS FOR "UD_DFLAGS" BITS @@ -250,11 +251,18 @@ UF_FOK equ 4 ;Set => value at UD_FSEC is valid UFM_DB equ (1 SHL UF_DBD) UFM_HP EQU (1 SHL UF_HPL) UFM_RM equ (1 SHL UF_RMV) -UFM_DF equ (1 SHL UF_DFS) +UFM_PP equ (1 SHL UF_PAP) UFM_FO equ (1 SHL UF_FOK) NUMKEYS equ 0FCBBh + +; DRIVER CONFIGURATION KEYS +; ============================= + +CFG_DRVS equ 1 +CFG_DEVLUN equ 2 + ;----------------------------------------------------------------------------- ; .list diff --git a/source/msxdos25/data.mac b/source/kernel/data.mac similarity index 93% rename from source/msxdos25/data.mac rename to source/kernel/data.mac index 873d44d0..0c7a45c5 100644 --- a/source/msxdos25/data.mac +++ b/source/kernel/data.mac @@ -50,7 +50,6 @@ ram_ad defl DATABASE ; ------------------------ ; var PRTBUF,6,F1C9 ;MSX-DOS1 compatible string output routine - var0 NXT4 spare 4 ; ; ------------------------ @@ -106,7 +105,7 @@ ram_ad defl DATABASE spare 5 ;For future expansion ; var1 CUR_DRV ;Current logical drive (1=A:) - var2 DTA_ADR,F23D ;DMAADD used by MSXDOS1.SYS - can not move. + var2 DTA_ADDR,F23D ;DMAADD used by MSXDOS1.SYS - can not move. ; var0 NXT7 spare 7 @@ -243,12 +242,7 @@ ram_ad defl DATABASE ; ; ------------------------ ; - var1 NXTEMP ;For temporary usage by kernel - var0 NXT2 - var1 TMPLUN - var1 TMPDEV - spare 1 - ;spare 4 + spare 4 ; var1 RAWFLG, F30D ;Read-after write flag - must not move var1 COUNTRY,F30E ;Accessed by COMMAND.COM - can't move @@ -268,7 +262,8 @@ ram_ad defl DATABASE var1 NXT_VER ;Nextor version numbr var1 MAIN_BANK var KER250,4 ;MSX-DOS 2.50 kernel slots, - ;bit 6 is set if timer interrupt routine is to be called + ;bit 6 is set if timer interrupt routine is to be called + ;bit 5 is set if the driver provides configuration var _TIME_IRQ,5,F31E ;; spare 11 ;===== end mod DOS2.50 @@ -278,7 +273,13 @@ ram_ad defl DATABASE var2 DISKVECT,F323 ;BDOS_GO disk error vector var2 BREAKVECT,F325 ;BDOS_GO ctrl-stop vector ; - var AUXBODY,10,F327 + var AUXBODY,3,F327 ;Actually 10 + var1 NXTEMP ;For temporary usage by AUTO_ASSIGN + var0 NXT2 ;(values are saved in the stack and later restored) + var1 TMPLUN + var1 TMPDEV + var1 NXT3 + var3 NXT4 ;These variables are declared inside ARG, a 16 byte area used by math-pack. ;There should be no conflict since DOS kernel and math-pack @@ -529,9 +530,13 @@ ram_ad defl 4100h var3 FREUSEG var3 F_LOCK + var3 F_FOUT var3 F_RALLOC var3 F_DSPACE + var3 DRVS2 + var3 AUTO_ASPART + ;----------------------------------------------------------------------------- ; ; Routines on ROM page 0 and on disk drivers @@ -564,7 +569,8 @@ ram_ad defl 4100h var3 DV_D2 var3 DV_D3 var3 DV_D4 - spare 15 + var3 DV_CONFIG + spare 12 ;Routines for drive-based and device-based drivers diff --git a/source/kernel/drivers/.gitignore b/source/kernel/drivers/.gitignore new file mode 100644 index 00000000..24a9e0df --- /dev/null +++ b/source/kernel/drivers/.gitignore @@ -0,0 +1,5 @@ +b0labels.inc +bank.inc +condasm.inc +const.inc +macros.inc diff --git a/source/msxdos25/bank6/CPM32.EXE b/source/kernel/drivers/CPM32.EXE similarity index 100% rename from source/msxdos25/bank6/CPM32.EXE rename to source/kernel/drivers/CPM32.EXE diff --git a/source/msxdos25/drivers/sdscc/Mapper.ASCII8.bin b/source/kernel/drivers/MegaFlashRomSD/Mapper.ASCII8.bin similarity index 100% rename from source/msxdos25/drivers/sdscc/Mapper.ASCII8.bin rename to source/kernel/drivers/MegaFlashRomSD/Mapper.ASCII8.bin diff --git a/source/msxdos25/drivers/sdscc/driver.bin b/source/kernel/drivers/MegaFlashRomSD/driver-1slot.dat similarity index 82% rename from source/msxdos25/drivers/sdscc/driver.bin rename to source/kernel/drivers/MegaFlashRomSD/driver-1slot.dat index f01033eb..cf812a68 100644 Binary files a/source/msxdos25/drivers/sdscc/driver.bin and b/source/kernel/drivers/MegaFlashRomSD/driver-1slot.dat differ diff --git a/source/kernel/drivers/MegaFlashRomSD/driver-2slots.dat b/source/kernel/drivers/MegaFlashRomSD/driver-2slots.dat new file mode 100644 index 00000000..68e00b59 Binary files /dev/null and b/source/kernel/drivers/MegaFlashRomSD/driver-2slots.dat differ diff --git a/source/msxdos25/drivers/sdscc/makerecoverykernel.asm b/source/kernel/drivers/MegaFlashRomSD/makerecoverykernel.asm similarity index 55% rename from source/msxdos25/drivers/sdscc/makerecoverykernel.asm rename to source/kernel/drivers/MegaFlashRomSD/makerecoverykernel.asm index 312d5791..875228fe 100644 --- a/source/msxdos25/drivers/sdscc/makerecoverykernel.asm +++ b/source/kernel/drivers/MegaFlashRomSD/makerecoverykernel.asm @@ -1,10 +1,9 @@ //----------------------------------------------------------------------------- // -// Crea el fichero de recuperacion de la kernel -// Se trata de una cabecera que sirve de identificador e indica el tamaņo de -// la kernel. -// Hay que grabar este fichero en la tarjeta SD tras formatearla. -// Luego se carga desde el menu recovery +// Create the kernel recovery file. +// It's aheader that acts as an identifier and tells the size of the kernel. +// This file has to be saved in the SD card after formatting it, +// then it's loaded from the recovery menu. // // Manuel Pazos 13/01/2013 // @@ -17,4 +16,4 @@ start: incbin "nextor2.rom" ;incbin "nextor.dsk" -end: \ No newline at end of file +end: diff --git a/source/msxdos25/drivers/README.TXT b/source/kernel/drivers/README.TXT similarity index 100% rename from source/msxdos25/drivers/README.TXT rename to source/kernel/drivers/README.TXT diff --git a/source/msxdos25/drivers/CPM32.EXE b/source/kernel/drivers/StandaloneASCII16/CPM32.EXE similarity index 100% rename from source/msxdos25/drivers/CPM32.EXE rename to source/kernel/drivers/StandaloneASCII16/CPM32.EXE diff --git a/source/msxdos25/bank6/L80.CPM b/source/kernel/drivers/StandaloneASCII16/L80.CPM similarity index 100% rename from source/msxdos25/bank6/L80.CPM rename to source/kernel/drivers/StandaloneASCII16/L80.CPM diff --git a/source/msxdos25/bank6/LIB80.CPM b/source/kernel/drivers/StandaloneASCII16/LIB80.CPM similarity index 100% rename from source/msxdos25/bank6/LIB80.CPM rename to source/kernel/drivers/StandaloneASCII16/LIB80.CPM diff --git a/source/msxdos25/bank6/M80.CPM b/source/kernel/drivers/StandaloneASCII16/M80.CPM similarity index 100% rename from source/msxdos25/bank6/M80.CPM rename to source/kernel/drivers/StandaloneASCII16/M80.CPM diff --git a/source/msxdos25/drivers/StandaloneASCII16/b5.mac b/source/kernel/drivers/StandaloneASCII16/b5.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/b5.mac rename to source/kernel/drivers/StandaloneASCII16/b5.mac diff --git a/source/msxdos25/drivers/StandaloneASCII16/chgbnk.mac b/source/kernel/drivers/StandaloneASCII16/chgbnk.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/chgbnk.mac rename to source/kernel/drivers/StandaloneASCII16/chgbnk.mac diff --git a/source/msxdos25/drivers/StandaloneASCII16/driver.mac b/source/kernel/drivers/StandaloneASCII16/driver.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/driver.mac rename to source/kernel/drivers/StandaloneASCII16/driver.mac diff --git a/source/msxdos25/drivers/StandaloneASCII16/CPM32.EXE b/source/kernel/drivers/StandaloneASCII8/CPM32.EXE similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/CPM32.EXE rename to source/kernel/drivers/StandaloneASCII8/CPM32.EXE diff --git a/source/msxdos25/drivers/StandaloneASCII16/L80.CPM b/source/kernel/drivers/StandaloneASCII8/L80.CPM similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/L80.CPM rename to source/kernel/drivers/StandaloneASCII8/L80.CPM diff --git a/source/msxdos25/drivers/StandaloneASCII16/LIB80.CPM b/source/kernel/drivers/StandaloneASCII8/LIB80.CPM similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/LIB80.CPM rename to source/kernel/drivers/StandaloneASCII8/LIB80.CPM diff --git a/source/msxdos25/drivers/StandaloneASCII16/M80.CPM b/source/kernel/drivers/StandaloneASCII8/M80.CPM similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII16/M80.CPM rename to source/kernel/drivers/StandaloneASCII8/M80.CPM diff --git a/source/msxdos25/drivers/StandaloneASCII8/b5.mac b/source/kernel/drivers/StandaloneASCII8/b5.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/b5.mac rename to source/kernel/drivers/StandaloneASCII8/b5.mac diff --git a/source/msxdos25/drivers/StandaloneASCII8/chgbnk.mac b/source/kernel/drivers/StandaloneASCII8/chgbnk.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/chgbnk.mac rename to source/kernel/drivers/StandaloneASCII8/chgbnk.mac diff --git a/source/msxdos25/drivers/StandaloneASCII8/chgbnk.noheader.mac b/source/kernel/drivers/StandaloneASCII8/chgbnk.noheader.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/chgbnk.noheader.mac rename to source/kernel/drivers/StandaloneASCII8/chgbnk.noheader.mac diff --git a/source/msxdos25/drivers/StandaloneASCII8/driver.mac b/source/kernel/drivers/StandaloneASCII8/driver.mac similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/driver.mac rename to source/kernel/drivers/StandaloneASCII8/driver.mac diff --git a/source/msxdos25/drivers/StandaloneASCII8/CPM32.EXE b/source/kernel/drivers/SunriseIDE/CPM32.EXE similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/CPM32.EXE rename to source/kernel/drivers/SunriseIDE/CPM32.EXE diff --git a/source/msxdos25/drivers/SunriseIDE/DRIVER.01.MAC b/source/kernel/drivers/SunriseIDE/DRIVER.01.MAC similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/DRIVER.01.MAC rename to source/kernel/drivers/SunriseIDE/DRIVER.01.MAC diff --git a/source/msxdos25/drivers/SunriseIDE/DRIVER.02.MAC b/source/kernel/drivers/SunriseIDE/DRIVER.02.MAC similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/DRIVER.02.MAC rename to source/kernel/drivers/SunriseIDE/DRIVER.02.MAC diff --git a/source/msxdos25/drivers/SunriseIDE/DRIVER.MAC b/source/kernel/drivers/SunriseIDE/DRIVER.MAC similarity index 92% rename from source/msxdos25/drivers/SunriseIDE/DRIVER.MAC rename to source/kernel/drivers/SunriseIDE/DRIVER.MAC index de758b28..80139bd8 100644 --- a/source/msxdos25/drivers/SunriseIDE/DRIVER.MAC +++ b/source/kernel/drivers/SunriseIDE/DRIVER.MAC @@ -252,8 +252,10 @@ SING_DBL equ 7420h ;"1-Single side / 2-Double side" ; Driver flags: ; bit 0: 0 for drive-based, 1 for device-based ; bit 1: 1 for hot-plug devices supported (device-based drivers only) +; bit 2: 1 if the driver provides configuration +; (implements the DRV_CONFIG routine) - db 1+(2*DRV_HOTPLUG) + db 1+(2*DRV_HOTPLUG)+4 ;Reserved byte db 0 @@ -271,14 +273,15 @@ DRV_NAME: jp DRV_INIT jp DRV_BASSTAT jp DRV_BASDEV - jp DRV_EXTBIO - jp DRV_DIRECT0 - jp DRV_DIRECT1 - jp DRV_DIRECT2 - jp DRV_DIRECT3 - jp DRV_DIRECT4 + jp DRV_EXTBIO + jp DRV_DIRECT0 + jp DRV_DIRECT1 + jp DRV_DIRECT2 + jp DRV_DIRECT3 + jp DRV_DIRECT4 + jp DRV_CONFIG - ds 15 + ds 12 jp DEV_RW jp DEV_INFO @@ -785,6 +788,57 @@ DRV_DIRECT4: ret +;----------------------------------------------------------------------------- +; +; Get driver configuration +; +; Input: +; A = Configuration index +; BC, DE, HL = Depends on the configuration +; +; Output: +; A = 0: Ok +; 1: Configuration not available for the supplied index +; BC, DE, HL = Depends on the configuration +; +; * Get number of drives at boot time (for device-based drivers only): +; Input: +; A = 1 +; B = 0 for DOS 2 mode, 1 for DOS 1 mode +; Output: +; B = number of drives +; +; * Get default configuration for drive +; Input: +; A = 2 +; B = 0 for DOS 2 mode, 1 for DOS 1 mode +; C = Relative drive number at boot time +; Output: +; B = Device index +; C = LUN index + +DRV_CONFIG: + dec a + jr z,DRV_CONFIG_1 + dec a + jr z,DRV_CONFIG_2 + ld a,1 + ret + +DRV_CONFIG_1: + ld a,b + ld b,2 + or a + ret z + xor a + dec b + ret + +DRV_CONFIG_2: + ld a,1 + ret + + ;===== ;===== BEGIN of DEVICE-BASED specific routines ;===== diff --git a/source/msxdos25/drivers/StandaloneASCII8/L80.CPM b/source/kernel/drivers/SunriseIDE/L80.CPM similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/L80.CPM rename to source/kernel/drivers/SunriseIDE/L80.CPM diff --git a/source/msxdos25/drivers/StandaloneASCII8/LIB80.CPM b/source/kernel/drivers/SunriseIDE/LIB80.CPM similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/LIB80.CPM rename to source/kernel/drivers/SunriseIDE/LIB80.CPM diff --git a/source/msxdos25/drivers/StandaloneASCII8/M80.CPM b/source/kernel/drivers/SunriseIDE/M80.CPM similarity index 100% rename from source/msxdos25/drivers/StandaloneASCII8/M80.CPM rename to source/kernel/drivers/SunriseIDE/M80.CPM diff --git a/source/msxdos25/drivers/SunriseIDE/b5.mac b/source/kernel/drivers/SunriseIDE/b5.mac similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/b5.mac rename to source/kernel/drivers/SunriseIDE/b5.mac diff --git a/source/msxdos25/drivers/SunriseIDE/chgbnk.mac b/source/kernel/drivers/SunriseIDE/chgbnk.mac similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/chgbnk.mac rename to source/kernel/drivers/SunriseIDE/chgbnk.mac diff --git a/source/msxdos25/drv.mac b/source/kernel/drv.mac similarity index 85% rename from source/msxdos25/drv.mac rename to source/kernel/drv.mac index d46f9c1a..6b6dee3a 100644 --- a/source/msxdos25/drv.mac +++ b/source/kernel/drv.mac @@ -647,34 +647,6 @@ CHGEN_NOEMU: ld b,1 ;"Unchanged" if partition has not changed ret - if 0 - - ld b,(iy+3) - ld ix,DEV_STATUS## - push hl - push iy - call DO_CALBNK - pop iy - pop hl - or a - jr nz,CHG_ENTRY_2 - ld a,12 - scf - ret - -CHG_ENTRY_2: - ld b,1 ;Not changed - dec a - ret z - ld b,-1 ;Changed - dec a - jr z,DO_MKDPB - ld b,0 ;Unknown - xor a - ret - - endif - ;--- Obtain DPB, input: IY=Entry in DVB_TABLE, HL=Address for DPB DPB_ENTRY:: @@ -841,8 +813,12 @@ IS_DVB_NOEMU: inc iy IS_DVB_LOOP: + push bc ld a,(KSLOT##) - cp (iy) + ld b,(iy) + res 6,b + cp b + pop bc jr nz,DIO_NEXT ld a,(iy+1) @@ -850,10 +826,6 @@ IS_DVB_LOOP: cp c jr nz,DIO_NEXT - ;ld a,c - ;cp (iy+1) - ;jr nz,DIO_NEXT - DIO_OK: pop bc ;Found, return Cy=1 pop af @@ -898,7 +870,7 @@ IS_EMU: ; Return A=0, Z if partition assigned; A<>0, NZ if NO partition assigned. HAS_PARTITION: - ld a,(iy+4) ;No partition assgined + ld a,(iy+4) ;No partition assigned and (iy+5) ;if sector number is -1 and (iy+6) and (iy+7) @@ -915,10 +887,8 @@ RET_NZ: ; ; Assign the first available FAT12 primary partition to ; the device whose entry of DVB_TABLE pointed by IY. -; If no disk error happens but no partitions are found, -; absolute sector 0 is assigned. ; Returns disk error code in A, with Z appropriately set. -; Corrupts, AF, IX. +; Corrupts: AF, IX. MBR_PSTART equ 01BEh ;Start of partition table in MBR MBR_PSIZE equ 16 ;Size of partition table entry @@ -928,80 +898,28 @@ POFF_PSIZE equ 12 ;Offset of partition size in p. table entry PT_FAT12 equ 1 ;Partition type code for FAT12 ASSIGN_PARTITION: - push bc - push de - push hl - push iy - call READ_BOOT - pop iy - or a - jr nz,ASSIGN_P_END - - ld hl,($SECBUF##) - ld bc,510 - add hl,bc - ld a,(hl) - cp 055h - jr nz,ASSIG_P_MBR - inc hl - ld a,(hl) - cp 0AAh - jr z,ASSIGN_P_DO - -ASSIG_P_MBR: - xor a ;No partition table found: - ld (iy+4),a ;assign to MBR - ld (iy+5),a - ld (iy+6),a - ld (iy+7),a - jr ASSIGN_P_END - -ASSIGN_P_DO: - ld ix,($SECBUF##) - ld bc,MBR_PSTART - add ix,bc - ld b,4 -ASSIGN_P_LOOP: - ld a,(ix+POFF_TYPE) - cp PT_FAT12 - jr nz,ASSIGN_P_NEXT - - ld a,(ix+POFF_PSIZE+3) ;Skip partition if size is >16M - or a - jr nz,ASSIGN_P_NEXT - ld a,(ix+POFF_PSIZE+2) - or a - jr nz,ASSIGN_P_NEXT - ld d,(ix+POFF_PSIZE+1) - ld e,(ix+POFF_PSIZE) - dec de - ld a,d - cp 80h - jr nc,ASSIGN_P_NEXT - - ld a,(ix+POFF_PSTART) ;Partition found: assign it - ld (iy+4),a - ld a,(ix+POFF_PSTART+1) - ld (iy+5),a - ld a,(ix+POFF_PSTART+2) - ld (iy+6),a - ld a,(ix+POFF_PSTART+3) - ld (iy+7),a - xor a - jr ASSIGN_P_END + push bc + push de + push hl + push iy + + pop hl + push hl + + ld b,(iy+UD1_DI##) + ld c,(iy+UD1_LI##) + ld a,4 + ld ix,AUTO_ASPART## + call CALBNK## -ASSIGN_P_NEXT: - ld de,MBR_PSIZE - add ix,de - djnz ASSIGN_P_LOOP + pop iy + pop hl + pop de + pop bc - ld a,0FFh ;No suitable partition found: error - or a - -ASSIGN_P_END: - pop hl - pop de - pop bc + or a + ret z + ld a,12 ret diff --git a/source/msxdos25/fat16patch.txt b/source/kernel/fat16patch.txt similarity index 100% rename from source/msxdos25/fat16patch.txt rename to source/kernel/fat16patch.txt diff --git a/source/msxdos25/kitsrc/makebin.bat b/source/kernel/kitsrc/makebin.bat similarity index 100% rename from source/msxdos25/kitsrc/makebin.bat rename to source/kernel/kitsrc/makebin.bat diff --git a/source/msxdos25/kitsrc/oem.mac b/source/kernel/kitsrc/oem.mac similarity index 100% rename from source/msxdos25/kitsrc/oem.mac rename to source/kernel/kitsrc/oem.mac diff --git a/source/msxdos25/kvar.mac b/source/kernel/kvar.mac similarity index 93% rename from source/msxdos25/kvar.mac rename to source/kernel/kvar.mac index 29b57c1d..7d6f10c8 100644 --- a/source/msxdos25/kvar.mac +++ b/source/kernel/kvar.mac @@ -163,12 +163,11 @@ size macro name ; (if zero, all other bits are meaningless) ; bit 1: the device supports hot-plug (ignored) ; bit 2: the drive is removable - ; bit 3: the drive is controlled by direct filesystem access (ignored) + ; bit 3: partition assignment is pending for this drive ; bit 4: value at UD_FSEC is valid ; (so that BUILD_UPB will not auto-assign partition) ; bit 5: value at UD_CHKSUM is valid ; - field 0,UD_REL ;Relative unit number for unit handler (for drive-based drivers) field 1,UD_LI ;LUN index (for device-based drivers) field 1,UD_SEG ;Segment number for RAM based drivers, FFh for ROM based drivers ; @@ -203,6 +202,11 @@ size macro name field 4,UD_FSEC ;First device sector (only for block devices on device-based drivers) field 2,UD_CHKSUM + + field 1,UD_REL ;Relative unit number for unit handler + ;(for device-based drivers this is only used if the driver + ; provides configuration, in order to get the default mapping + ; for the drive) ; ;--- Extra fields used when mounting files ; This extra space should NOT be allocated unless a file is mounted to the drive @@ -217,6 +221,23 @@ size macro name const UD_SZ,UD_MSZ-5 ;Total size of unit descriptor without extra fields + +;***************************************************************************** + +; Entry in the device-based drives table (pointed by DVB_TABLE) in MSX-DOS 1 mode +; WARNING: UD1_SLOT needs to be at the same position as UD_SLOT + + ifield 0 ;Start at offset zero +; + field 1,UD1_SLOT ;Slot address of appropriate disk driver + field 1,UD1_REL ;Relative unit number + ;bit 7 is set if partition has changed + field 1,UD1_DI ;Device index + field 1,UD1_LI ;LUN index + field 4,UD1_FSEC ;First absolute sector number + + size UD1_SZ ;Total size of unit descriptor + ; ;----------------------------------------------------------------------------- ; diff --git a/source/msxdos25/macros.inc b/source/kernel/macros.inc similarity index 90% rename from source/msxdos25/macros.inc rename to source/kernel/macros.inc index 5a04d3eb..313ecc93 100644 --- a/source/msxdos25/macros.inc +++ b/source/kernel/macros.inc @@ -18,6 +18,11 @@ ld_iyh_a macro ld h,a endm +ld_iyh_e macro + db 0FDh + ld h,e + endm + ld_iyl_a macro db 0FDh ld l,a @@ -252,6 +257,12 @@ ST10: PUSH DE endm + +djpnz macro address + dec b + jp nz,address + endm + ;------------------------------------------------------------------------------ ; .list diff --git a/source/msxdos25/megasdrom/BIN2HEX.EXE b/source/kernel/megasdrom/BIN2HEX.EXE similarity index 100% rename from source/msxdos25/megasdrom/BIN2HEX.EXE rename to source/kernel/megasdrom/BIN2HEX.EXE diff --git a/source/msxdos25/drivers/SunriseIDE/CPM32.EXE b/source/kernel/megasdrom/CPM32.EXE similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/CPM32.EXE rename to source/kernel/megasdrom/CPM32.EXE diff --git a/source/msxdos25/drivers/SunriseIDE/L80.CPM b/source/kernel/megasdrom/L80.CPM similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/L80.CPM rename to source/kernel/megasdrom/L80.CPM diff --git a/source/msxdos25/drivers/SunriseIDE/LIB80.CPM b/source/kernel/megasdrom/LIB80.CPM similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/LIB80.CPM rename to source/kernel/megasdrom/LIB80.CPM diff --git a/source/msxdos25/drivers/SunriseIDE/M80.CPM b/source/kernel/megasdrom/M80.CPM similarity index 100% rename from source/msxdos25/drivers/SunriseIDE/M80.CPM rename to source/kernel/megasdrom/M80.CPM diff --git a/source/msxdos25/megasdrom/Makefile b/source/kernel/megasdrom/Makefile similarity index 100% rename from source/msxdos25/megasdrom/Makefile rename to source/kernel/megasdrom/Makefile diff --git a/source/msxdos25/megasdrom/SD3a.ASM b/source/kernel/megasdrom/SD3a.ASM similarity index 100% rename from source/msxdos25/megasdrom/SD3a.ASM rename to source/kernel/megasdrom/SD3a.ASM diff --git a/source/msxdos25/megasdrom/chgbnk1.mac b/source/kernel/megasdrom/chgbnk1.mac similarity index 100% rename from source/msxdos25/megasdrom/chgbnk1.mac rename to source/kernel/megasdrom/chgbnk1.mac diff --git a/source/msxdos25/megasdrom/chgbnk2.mac b/source/kernel/megasdrom/chgbnk2.mac similarity index 100% rename from source/msxdos25/megasdrom/chgbnk2.mac rename to source/kernel/megasdrom/chgbnk2.mac diff --git a/source/msxdos25/megasdrom/dskdrv1.mac b/source/kernel/megasdrom/dskdrv1.mac similarity index 100% rename from source/msxdos25/megasdrom/dskdrv1.mac rename to source/kernel/megasdrom/dskdrv1.mac diff --git a/source/msxdos25/megasdrom/dskdrv2.mac b/source/kernel/megasdrom/dskdrv2.mac similarity index 100% rename from source/msxdos25/megasdrom/dskdrv2.mac rename to source/kernel/megasdrom/dskdrv2.mac diff --git a/source/msxdos25/megasdrom/format1.mac b/source/kernel/megasdrom/format1.mac similarity index 100% rename from source/msxdos25/megasdrom/format1.mac rename to source/kernel/megasdrom/format1.mac diff --git a/source/msxdos25/megasdrom/format2.mac b/source/kernel/megasdrom/format2.mac similarity index 100% rename from source/msxdos25/megasdrom/format2.mac rename to source/kernel/megasdrom/format2.mac diff --git a/source/msxdos25/megasdrom/h2b.exe b/source/kernel/megasdrom/h2b.exe similarity index 100% rename from source/msxdos25/megasdrom/h2b.exe rename to source/kernel/megasdrom/h2b.exe diff --git a/source/msxdos25/megasdrom/spcfunc.mac b/source/kernel/megasdrom/spcfunc.mac similarity index 100% rename from source/msxdos25/megasdrom/spcfunc.mac rename to source/kernel/megasdrom/spcfunc.mac diff --git a/source/msxdos25/mplayerrom/BIN2HEX.EXE b/source/kernel/mplayerrom/BIN2HEX.EXE similarity index 100% rename from source/msxdos25/mplayerrom/BIN2HEX.EXE rename to source/kernel/mplayerrom/BIN2HEX.EXE diff --git a/source/msxdos25/megasdrom/CPM32.EXE b/source/kernel/mplayerrom/CPM32.EXE similarity index 100% rename from source/msxdos25/megasdrom/CPM32.EXE rename to source/kernel/mplayerrom/CPM32.EXE diff --git a/source/msxdos25/mplayerrom/DSKDRV.MAC b/source/kernel/mplayerrom/DSKDRV.MAC similarity index 100% rename from source/msxdos25/mplayerrom/DSKDRV.MAC rename to source/kernel/mplayerrom/DSKDRV.MAC diff --git a/source/msxdos25/mplayerrom/DSKDRVX.MAC b/source/kernel/mplayerrom/DSKDRVX.MAC similarity index 100% rename from source/msxdos25/mplayerrom/DSKDRVX.MAC rename to source/kernel/mplayerrom/DSKDRVX.MAC diff --git a/source/msxdos25/megasdrom/L80.CPM b/source/kernel/mplayerrom/L80.CPM similarity index 100% rename from source/msxdos25/megasdrom/L80.CPM rename to source/kernel/mplayerrom/L80.CPM diff --git a/source/msxdos25/megasdrom/LIB80.CPM b/source/kernel/mplayerrom/LIB80.CPM similarity index 100% rename from source/msxdos25/megasdrom/LIB80.CPM rename to source/kernel/mplayerrom/LIB80.CPM diff --git a/source/msxdos25/megasdrom/M80.CPM b/source/kernel/mplayerrom/M80.CPM similarity index 100% rename from source/msxdos25/megasdrom/M80.CPM rename to source/kernel/mplayerrom/M80.CPM diff --git a/source/msxdos25/mplayerrom/Makefile b/source/kernel/mplayerrom/Makefile similarity index 100% rename from source/msxdos25/mplayerrom/Makefile rename to source/kernel/mplayerrom/Makefile diff --git a/source/msxdos25/mplayerrom/chgbnk1.mac b/source/kernel/mplayerrom/chgbnk1.mac similarity index 100% rename from source/msxdos25/mplayerrom/chgbnk1.mac rename to source/kernel/mplayerrom/chgbnk1.mac diff --git a/source/msxdos25/mplayerrom/chgbnk2.mac b/source/kernel/mplayerrom/chgbnk2.mac similarity index 100% rename from source/msxdos25/mplayerrom/chgbnk2.mac rename to source/kernel/mplayerrom/chgbnk2.mac diff --git a/source/msxdos25/mplayerrom/dskdrv1.mac b/source/kernel/mplayerrom/dskdrv1.mac similarity index 100% rename from source/msxdos25/mplayerrom/dskdrv1.mac rename to source/kernel/mplayerrom/dskdrv1.mac diff --git a/source/msxdos25/mplayerrom/dskdrv2.mac b/source/kernel/mplayerrom/dskdrv2.mac similarity index 100% rename from source/msxdos25/mplayerrom/dskdrv2.mac rename to source/kernel/mplayerrom/dskdrv2.mac diff --git a/source/msxdos25/mplayerrom/format1.mac b/source/kernel/mplayerrom/format1.mac similarity index 100% rename from source/msxdos25/mplayerrom/format1.mac rename to source/kernel/mplayerrom/format1.mac diff --git a/source/msxdos25/mplayerrom/format2.mac b/source/kernel/mplayerrom/format2.mac similarity index 100% rename from source/msxdos25/mplayerrom/format2.mac rename to source/kernel/mplayerrom/format2.mac diff --git a/source/msxdos25/mplayerrom/h2b.exe b/source/kernel/mplayerrom/h2b.exe similarity index 100% rename from source/msxdos25/mplayerrom/h2b.exe rename to source/kernel/mplayerrom/h2b.exe diff --git a/source/msxdos25/ocmsxrom/BIN2HEX.EXE b/source/kernel/ocmsxrom/BIN2HEX.EXE similarity index 100% rename from source/msxdos25/ocmsxrom/BIN2HEX.EXE rename to source/kernel/ocmsxrom/BIN2HEX.EXE diff --git a/source/msxdos25/mplayerrom/CPM32.EXE b/source/kernel/ocmsxrom/CPM32.EXE similarity index 100% rename from source/msxdos25/mplayerrom/CPM32.EXE rename to source/kernel/ocmsxrom/CPM32.EXE diff --git a/source/msxdos25/ocmsxrom/ESE-16J.ASM b/source/kernel/ocmsxrom/ESE-16J.ASM similarity index 100% rename from source/msxdos25/ocmsxrom/ESE-16J.ASM rename to source/kernel/ocmsxrom/ESE-16J.ASM diff --git a/source/msxdos25/mplayerrom/L80.CPM b/source/kernel/ocmsxrom/L80.CPM similarity index 100% rename from source/msxdos25/mplayerrom/L80.CPM rename to source/kernel/ocmsxrom/L80.CPM diff --git a/source/msxdos25/mplayerrom/LIB80.CPM b/source/kernel/ocmsxrom/LIB80.CPM similarity index 100% rename from source/msxdos25/mplayerrom/LIB80.CPM rename to source/kernel/ocmsxrom/LIB80.CPM diff --git a/source/msxdos25/mplayerrom/M80.CPM b/source/kernel/ocmsxrom/M80.CPM similarity index 100% rename from source/msxdos25/mplayerrom/M80.CPM rename to source/kernel/ocmsxrom/M80.CPM diff --git a/source/msxdos25/ocmsxrom/Makefile b/source/kernel/ocmsxrom/Makefile similarity index 100% rename from source/msxdos25/ocmsxrom/Makefile rename to source/kernel/ocmsxrom/Makefile diff --git a/source/msxdos25/ocmsxrom/chgbnk1.mac b/source/kernel/ocmsxrom/chgbnk1.mac similarity index 100% rename from source/msxdos25/ocmsxrom/chgbnk1.mac rename to source/kernel/ocmsxrom/chgbnk1.mac diff --git a/source/msxdos25/ocmsxrom/chgbnk2.mac b/source/kernel/ocmsxrom/chgbnk2.mac similarity index 100% rename from source/msxdos25/ocmsxrom/chgbnk2.mac rename to source/kernel/ocmsxrom/chgbnk2.mac diff --git a/source/msxdos25/ocmsxrom/dskdrv1.mac b/source/kernel/ocmsxrom/dskdrv1.mac similarity index 100% rename from source/msxdos25/ocmsxrom/dskdrv1.mac rename to source/kernel/ocmsxrom/dskdrv1.mac diff --git a/source/msxdos25/ocmsxrom/dskdrv2.mac b/source/kernel/ocmsxrom/dskdrv2.mac similarity index 100% rename from source/msxdos25/ocmsxrom/dskdrv2.mac rename to source/kernel/ocmsxrom/dskdrv2.mac diff --git a/source/msxdos25/ocmsxrom/format1.mac b/source/kernel/ocmsxrom/format1.mac similarity index 100% rename from source/msxdos25/ocmsxrom/format1.mac rename to source/kernel/ocmsxrom/format1.mac diff --git a/source/msxdos25/ocmsxrom/format2.mac b/source/kernel/ocmsxrom/format2.mac similarity index 100% rename from source/msxdos25/ocmsxrom/format2.mac rename to source/kernel/ocmsxrom/format2.mac diff --git a/source/msxdos25/ocmsxrom/h2b.exe b/source/kernel/ocmsxrom/h2b.exe similarity index 100% rename from source/msxdos25/ocmsxrom/h2b.exe rename to source/kernel/ocmsxrom/h2b.exe diff --git a/source/msxdos25/ocmsxrom/spcfunc.mac b/source/kernel/ocmsxrom/spcfunc.mac similarity index 100% rename from source/msxdos25/ocmsxrom/spcfunc.mac rename to source/kernel/ocmsxrom/spcfunc.mac diff --git a/source/msxdos25/panarom/BIN2HEX.EXE b/source/kernel/panarom/BIN2HEX.EXE similarity index 100% rename from source/msxdos25/panarom/BIN2HEX.EXE rename to source/kernel/panarom/BIN2HEX.EXE diff --git a/source/msxdos25/ocmsxrom/CPM32.EXE b/source/kernel/panarom/CPM32.EXE similarity index 100% rename from source/msxdos25/ocmsxrom/CPM32.EXE rename to source/kernel/panarom/CPM32.EXE diff --git a/source/msxdos25/ocmsxrom/L80.CPM b/source/kernel/panarom/L80.CPM similarity index 100% rename from source/msxdos25/ocmsxrom/L80.CPM rename to source/kernel/panarom/L80.CPM diff --git a/source/msxdos25/ocmsxrom/LIB80.CPM b/source/kernel/panarom/LIB80.CPM similarity index 100% rename from source/msxdos25/ocmsxrom/LIB80.CPM rename to source/kernel/panarom/LIB80.CPM diff --git a/source/msxdos25/ocmsxrom/M80.CPM b/source/kernel/panarom/M80.CPM similarity index 100% rename from source/msxdos25/ocmsxrom/M80.CPM rename to source/kernel/panarom/M80.CPM diff --git a/source/msxdos25/panarom/Makefile b/source/kernel/panarom/Makefile similarity index 100% rename from source/msxdos25/panarom/Makefile rename to source/kernel/panarom/Makefile diff --git a/source/msxdos25/panarom/chgbnk.mac b/source/kernel/panarom/chgbnk.mac similarity index 100% rename from source/msxdos25/panarom/chgbnk.mac rename to source/kernel/panarom/chgbnk.mac diff --git a/source/msxdos25/panarom/chgbnk1.mac b/source/kernel/panarom/chgbnk1.mac similarity index 100% rename from source/msxdos25/panarom/chgbnk1.mac rename to source/kernel/panarom/chgbnk1.mac diff --git a/source/msxdos25/panarom/chgbnk2.mac b/source/kernel/panarom/chgbnk2.mac similarity index 100% rename from source/msxdos25/panarom/chgbnk2.mac rename to source/kernel/panarom/chgbnk2.mac diff --git a/source/msxdos25/panarom/dskdrv1.mac b/source/kernel/panarom/dskdrv1.mac similarity index 100% rename from source/msxdos25/panarom/dskdrv1.mac rename to source/kernel/panarom/dskdrv1.mac diff --git a/source/msxdos25/panarom/dskdrv2.mac b/source/kernel/panarom/dskdrv2.mac similarity index 100% rename from source/msxdos25/panarom/dskdrv2.mac rename to source/kernel/panarom/dskdrv2.mac diff --git a/source/msxdos25/panarom/format1.mac b/source/kernel/panarom/format1.mac similarity index 100% rename from source/msxdos25/panarom/format1.mac rename to source/kernel/panarom/format1.mac diff --git a/source/msxdos25/panarom/format2.mac b/source/kernel/panarom/format2.mac similarity index 100% rename from source/msxdos25/panarom/format2.mac rename to source/kernel/panarom/format2.mac diff --git a/source/msxdos25/panarom/h2b.exe b/source/kernel/panarom/h2b.exe similarity index 100% rename from source/msxdos25/panarom/h2b.exe rename to source/kernel/panarom/h2b.exe diff --git a/source/msxdos25/panarom/patch.mac b/source/kernel/panarom/patch.mac similarity index 100% rename from source/msxdos25/panarom/patch.mac rename to source/kernel/panarom/patch.mac diff --git a/source/msxdos25/panarom/romdrv.mac b/source/kernel/panarom/romdrv.mac similarity index 100% rename from source/msxdos25/panarom/romdrv.mac rename to source/kernel/panarom/romdrv.mac diff --git a/source/msxdos25/prodrom/Makefile b/source/kernel/prodrom/Makefile similarity index 100% rename from source/msxdos25/prodrom/Makefile rename to source/kernel/prodrom/Makefile diff --git a/source/msxdos25/prodrom/Makefile.prod b/source/kernel/prodrom/Makefile.prod similarity index 100% rename from source/msxdos25/prodrom/Makefile.prod rename to source/kernel/prodrom/Makefile.prod diff --git a/source/msxdos25/prodrom/chgbkk.mac b/source/kernel/prodrom/chgbkk.mac similarity index 100% rename from source/msxdos25/prodrom/chgbkk.mac rename to source/kernel/prodrom/chgbkk.mac diff --git a/source/msxdos25/prodrom/chgbnk.mac b/source/kernel/prodrom/chgbnk.mac similarity index 100% rename from source/msxdos25/prodrom/chgbnk.mac rename to source/kernel/prodrom/chgbnk.mac diff --git a/source/msxdos25/prodrom/chgbnk.meg b/source/kernel/prodrom/chgbnk.meg similarity index 100% rename from source/msxdos25/prodrom/chgbnk.meg rename to source/kernel/prodrom/chgbnk.meg diff --git a/source/msxdos25/prodrom/chgbnk.org b/source/kernel/prodrom/chgbnk.org similarity index 100% rename from source/msxdos25/prodrom/chgbnk.org rename to source/kernel/prodrom/chgbnk.org diff --git a/source/msxdos25/prodrom/doshedk.mac b/source/kernel/prodrom/doshedk.mac similarity index 100% rename from source/msxdos25/prodrom/doshedk.mac rename to source/kernel/prodrom/doshedk.mac diff --git a/source/msxdos25/prodrom/drv.mac b/source/kernel/prodrom/drv.mac similarity index 100% rename from source/msxdos25/prodrom/drv.mac rename to source/kernel/prodrom/drv.mac diff --git a/source/msxdos25/prodrom/kanji.lib b/source/kernel/prodrom/kanji.lib similarity index 100% rename from source/msxdos25/prodrom/kanji.lib rename to source/kernel/prodrom/kanji.lib diff --git a/source/msxdos25/prodrom/knjdrv.mac b/source/kernel/prodrom/knjdrv.mac similarity index 100% rename from source/msxdos25/prodrom/knjdrv.mac rename to source/kernel/prodrom/knjdrv.mac diff --git a/source/msxdos25/prodrom/knjhead2.mac b/source/kernel/prodrom/knjhead2.mac similarity index 100% rename from source/msxdos25/prodrom/knjhead2.mac rename to source/kernel/prodrom/knjhead2.mac diff --git a/source/msxdos25/rel.mac b/source/kernel/rel.mac similarity index 100% rename from source/msxdos25/rel.mac rename to source/kernel/rel.mac diff --git a/source/msxdos25/reldate b/source/kernel/reldate similarity index 100% rename from source/msxdos25/reldate rename to source/kernel/reldate diff --git a/source/msxdos25/testrom/Makefile b/source/kernel/testrom/Makefile similarity index 100% rename from source/msxdos25/testrom/Makefile rename to source/kernel/testrom/Makefile diff --git a/source/msxdos25/testrom/chgbnk1.mac b/source/kernel/testrom/chgbnk1.mac similarity index 100% rename from source/msxdos25/testrom/chgbnk1.mac rename to source/kernel/testrom/chgbnk1.mac diff --git a/source/msxdos25/testrom/chgbnk2.mac b/source/kernel/testrom/chgbnk2.mac similarity index 100% rename from source/msxdos25/testrom/chgbnk2.mac rename to source/kernel/testrom/chgbnk2.mac diff --git a/source/msxdos25/testrom/drv.mac b/source/kernel/testrom/drv.mac similarity index 100% rename from source/msxdos25/testrom/drv.mac rename to source/kernel/testrom/drv.mac diff --git a/source/msxdos25/panarom/L80.CPM b/source/kernel/tool/L80.CPM similarity index 100% rename from source/msxdos25/panarom/L80.CPM rename to source/kernel/tool/L80.CPM diff --git a/source/msxdos25/panarom/LIB80.CPM b/source/kernel/tool/LIB80.CPM similarity index 100% rename from source/msxdos25/panarom/LIB80.CPM rename to source/kernel/tool/LIB80.CPM diff --git a/source/msxdos25/panarom/M80.CPM b/source/kernel/tool/M80.CPM similarity index 100% rename from source/msxdos25/panarom/M80.CPM rename to source/kernel/tool/M80.CPM diff --git a/source/msxdos25/tool/M80_ORG.COM b/source/kernel/tool/M80_ORG.COM similarity index 100% rename from source/msxdos25/tool/M80_ORG.COM rename to source/kernel/tool/M80_ORG.COM diff --git a/source/msxdos25/tool/M80_PATCHED.COM b/source/kernel/tool/M80_PATCHED.COM similarity index 100% rename from source/msxdos25/tool/M80_PATCHED.COM rename to source/kernel/tool/M80_PATCHED.COM diff --git a/source/msxdos25/Nextor-2.0-beta1.base.dat b/source/msxdos25/Nextor-2.0-beta1.base.dat deleted file mode 100644 index 2305725a..00000000 Binary files a/source/msxdos25/Nextor-2.0-beta1.base.dat and /dev/null differ diff --git a/source/msxdos25/Nextor-2.0.1.base.dat b/source/msxdos25/Nextor-2.0.1.base.dat deleted file mode 100644 index e1ae9cd7..00000000 Binary files a/source/msxdos25/Nextor-2.0.1.base.dat and /dev/null differ diff --git a/source/msxdos25/Nextor-2.0.base.dat b/source/msxdos25/Nextor-2.0.base.dat deleted file mode 100644 index 5def6da9..00000000 Binary files a/source/msxdos25/Nextor-2.0.base.dat and /dev/null differ diff --git a/source/msxdos25/WIP.txt b/source/msxdos25/WIP.txt deleted file mode 100644 index 6ec77367..00000000 --- a/source/msxdos25/WIP.txt +++ /dev/null @@ -1,6 +0,0 @@ -83:1F, 1800 -8E:FE, 1800 - -3EA3: call_unit - -EA94: CALL ENASLT diff --git a/source/msxdos25/bank5/AsmCall.c b/source/msxdos25/bank5/AsmCall.c deleted file mode 100644 index ea3f4091..00000000 --- a/source/msxdos25/bank5/AsmCall.c +++ /dev/null @@ -1,158 +0,0 @@ -#include "asm.h" -#include "asmcall.h" - -//The following is required in the main program: -//byte ASMRUT[4]; -//byte OUT_FLAGS; -//Z80_registers regs; - - -void DriverCall(byte slot, uint routineAddress) -{ - byte registerData[8]; - int i; - - memcpy(registerData, ®s, 8); - - regs.Bytes.A = slot; - regs.Bytes.B = 0xFF; - regs.UWords.DE = routineAddress; - regs.Words.HL = (int)registerData; - - DosCall(_CDRVR, REGS_ALL); - - if(regs.Bytes.A == 0) { - regs.Words.AF = regs.Words.IX; - } -} - - -void DosCall(byte function, register_usage outRegistersDetail) -{ - regs.Bytes.C = function; - SwitchSystemBankThenCall(0xF37D, outRegistersDetail); -} - - -void SwitchSystemBankThenCall(int routineAddress, register_usage outRegistersDetail) -{ - *((int*)BK4_ADD) = routineAddress; - AsmCall(CALLB0, ®s, REGS_ALL, outRegistersDetail); -} - - -void AsmCallAlt(uint address, Z80_registers* regs, register_usage inRegistersDetail, register_usage outRegistersDetail, int alternateAf) __naked -{ - __asm - push ix - ld ix,#4 - add ix,sp - ld e,6(ix) ;Alternate AF - ld d,7(ix) - ex af,af - push de - pop af - ex af,af - ld l,(ix) ;HL=Routine address - ld h,1(ix) - ld e,2(ix) ;DE=regs address - ld d,3(ix) - ld a,5(ix) - ld (_OUT_FLAGS),a - ld a,4(ix) ;A=in registers detail - - ld (_ASMRUT+1),hl - - push de - or a - jr z,ASMRUT_DO - - push de - pop ix ;IX=&Z80regs - - exx - ld l,(ix) - ld h,1(ix) ;AF - dec a - jr z,ASMRUT_DOAF - exx - - ld c,2(ix) ;BC, DE, HL - ld b,3(ix) - ld e,4(ix) - ld d,5(ix) - ld l,6(ix) - ld h,7(ix) - dec a - exx - jr z,ASMRUT_DOAF - - ld c,8(ix) ;IX - ld b,9(ix) - ld e,10(ix) ;IY - ld d,11(ix) - push de - push bc - pop ix - pop iy - -ASMRUT_DOAF: - push hl - pop af - exx - -ASMRUT_DO: - call _ASMRUT - -;ASMRUT: call 0 - - ex (sp),ix ;IX to stack, now IX=&Z80regs - ex af,af ;Alternate AF - - ld a,(_OUT_FLAGS) - or a - jr z,CALL_END - - exx ;Alternate HLDEBC - ex af,af ;Main AF - push af - pop hl - ld (ix),l - ld 1(ix),h - exx ;Main HLDEBC - ex af,af ;Alternate AF - dec a - jr z,CALL_END - - ld 2(ix),c ;BC, DE, HL - ld 3(ix),b - ld 4(ix),e - ld 5(ix),d - ld 6(ix),l - ld 7(ix),h - dec a - jr z,CALL_END - - exx ;Alternate HLDEBC - pop hl - ld 8(ix),l ;IX - ld 9(ix),h - push iy - pop hl - ld 10(ix),l ;IY - ld 11(ix),h - exx ;Main HLDEBC - - ex af,af - pop ix - ret - -CALL_END: - ex af,af - pop hl - pop ix - ret - -;OUT_FLAGS: .db #0 - __endasm; -} diff --git a/source/msxdos25/bank5/AsmCall.h b/source/msxdos25/bank5/AsmCall.h deleted file mode 100644 index 53b3bcc6..00000000 --- a/source/msxdos25/bank5/AsmCall.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __ASMCALL_H -#define __ASMCALL_H - -#define AsmCall(dir, regs, in, out) AsmCallAlt(dir, regs, in, out, 0) - -void DriverCall(byte slot, uint routineAddress); -void DosCall(byte function, register_usage outRegistersDetail); -void SwitchSystemBankThenCall(int routineAddress, register_usage outRegistersDetail); -void AsmCallAlt(uint address, Z80_registers* regs, register_usage inRegistersDetail, register_usage outRegistersDetail, int alternateAf); - -#endif //__ASMCALL_H \ No newline at end of file diff --git a/source/msxdos25/bank5/dos.h b/source/msxdos25/bank5/dos.h deleted file mode 100644 index c6e50405..00000000 --- a/source/msxdos25/bank5/dos.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __DOS_H -#define __DOS_H - -#include "types.h" - -#define MAX_INSTALLED_DRIVERS 8 -#define MAX_DEVICES_PER_DRIVER 7 -#define MAX_LUNS_PER_DEVICE 7 -#define DRIVER_NAME_LENGTH 32 -#define MAX_INFO_LENGTH 64 - - -/* MSX-DOS data structures */ - -#define DRIVER_IS_DOS250 (1 << 7) -#define DRIVER_IS_DEVICE_BASED 1 - -typedef struct { - byte slot; - byte segment; - byte numDrivesAtBootTime; - byte firstDriveLetterAtBootTime; - byte flags; - byte versionMain; - byte versionSec; - byte versionRev; - char driverName[DRIVER_NAME_LENGTH]; - byte reserved[64 - DRIVER_NAME_LENGTH - 8]; -} driverInfo; - - -typedef struct { - byte lunCount; - char deviceName[MAX_INFO_LENGTH]; -} deviceInfo; - - -#define BLOCK_DEVICE 0 -#define READ_ONLY_LUN (1 << 1) -#define FLOPPY_DISK_LUN (1 << 2) - -typedef struct { - byte mediumType; - uint sectorSize; - ulong sectorCount; - byte flags; - uint cylinders; - byte heads; - byte sectorsPerTrack; - bool suitableForPartitionning; -} lunInfo; - - -/* MSX-DOS functions */ - -#define _DIRIO 0x06 -#define _BUFIN 0x0A -#define _EXPLAIN 0x66 -#define _GDRVR 0x78 -#define _GPART 0x7A -#define _CDRVR 0x7B - - -/* MSX-DOS error codes */ - -#define _IPART 0xB4 - - -/* Disk driver routines */ - -#define CALLB0 0x403F -#define CALBNK 0x4042 -#define DEV_RW 0x4160 -#define DEV_INFO 0x4163 -#define LUN_INFO 0x4169 - - -#define BK4_ADD 0xF84C - - -#endif //__DOS_H \ No newline at end of file diff --git a/source/msxdos25/bank5/fdisk.dat b/source/msxdos25/bank5/fdisk.dat deleted file mode 100644 index eba97041..00000000 Binary files a/source/msxdos25/bank5/fdisk.dat and /dev/null differ diff --git a/source/msxdos25/bank5/fdisk.h b/source/msxdos25/bank5/fdisk.h deleted file mode 100644 index 8799305c..00000000 --- a/source/msxdos25/bank5/fdisk.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __FDISK_H -#define __FDISK_H - -#define f_CalculateFatFileSystemParameters 1 -#define f_CreateFatFileSystem 2 -#define f_PreparePartitionningProcess 3 -#define f_CreatePartition 4 - -#endif //__FDISK_H \ No newline at end of file diff --git a/source/msxdos25/bank5/fdisk2.dat b/source/msxdos25/bank5/fdisk2.dat deleted file mode 100644 index 29246259..00000000 Binary files a/source/msxdos25/bank5/fdisk2.dat and /dev/null differ diff --git a/source/msxdos25/bank5/types.h b/source/msxdos25/bank5/types.h deleted file mode 100644 index e9097877..00000000 --- a/source/msxdos25/bank5/types.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __TYPES_H -#define __TYPES_H - -#ifndef uint -typedef unsigned int uint; -#endif - -#ifndef byte -typedef unsigned char byte; -#endif - -#ifndef ulong -typedef unsigned long ulong; -#endif - -#ifndef null -#define null ((void*)0) -#endif - -typedef unsigned char bool; -#define false (0) -#define true (!(false)) - -#endif //__TYPES_H \ No newline at end of file diff --git a/source/msxdos25/bank6/asm.h b/source/msxdos25/bank6/asm.h deleted file mode 100644 index fe57a4c7..00000000 --- a/source/msxdos25/bank6/asm.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __ASM_H -#define __ASM_H - -#include "types.h" - -#ifndef NULL -#define NULL 0 -#endif - - -/* --- Register detail levels --- */ - -// This value tells which registers to pass in/out -// to the routine invoked by AsmCall, DosCall, BiosCall -// and UnapiCall. - -typedef enum { - REGS_NONE = 0, //No registers at all - REGS_AF = 1, //AF only - REGS_MAIN = 2, //AF, BC, DE, HL - REGS_ALL = 3 //AF, BC, DE, HL, IX, IY -} register_usage; - - -/* --- Structure representing the Z80 registers --- - Registers can be accesses as: - Signed or unsigned words (ex: regs.Words.HL, regs.UWords.HL) - Bytes (ex: regs.Bytes.A) - Flags (ex: regs.Flags.Z) - */ - -typedef union { - struct { - byte F; - byte A; - byte C; - byte B; - byte E; - byte D; - byte L; - byte H; - byte IXl; - byte IXh; - byte IYl; - byte IYh; - } Bytes; - struct { - int AF; - int BC; - int DE; - int HL; - int IX; - int IY; - } Words; - struct { - uint AF; - uint BC; - uint DE; - uint HL; - uint IX; - uint IY; - } UWords; - struct { - unsigned C:1; - unsigned N:1; - unsigned PV:1; - unsigned bit3:1; - unsigned H:1; - unsigned bit5:1; - unsigned Z:1; - unsigned S:1; - } Flags; -} Z80_registers; - -#endif diff --git a/source/msxdos25/bank6/msxchar.lib b/source/msxdos25/bank6/msxchar.lib deleted file mode 100644 index cdfb2b0c..00000000 --- a/source/msxdos25/bank6/msxchar.lib +++ /dev/null @@ -1,234 +0,0 @@ - - - - 442 - -putchar 11 -_putchar - - - -getchar 202 -_getchar - - - -printf 378 -__char_emitter_start -_printf_end -__char_emitter_end -__printf -__buf_emitter -__printn -__printf_start -__buf_emitter_start -_sprintf -__printn_start -__printf_end -__buf_emitter_end -__printn_end -_sprintf_start -_printf -__char_emitter -_sprintf_end -_printf_start - - - - - - - -putchar - -XL -H 1 areas 1 global symbols -A _CODE size B flags 0 -S _putchar Def0000 -T 00 00 21 02 00 39 5E 0E 02 CD 05 00 C9 -R 00 00 00 00 - - - - - - -getchar - -XL -H 1 areas 1 global symbols -A _CODE size 6 flags 0 -S _getchar Def0000 -T 00 00 0E 08 CD 05 00 C9 -R 00 00 00 00 - - - - - - -printf - -XL -H 6 areas 15 global symbols -M printf -O -mz80 -S __moduint_rrx_s Ref0000 -S __divuint_rrx_s Ref0000 -S _putchar Ref0000 -A _CODE size 359 flags 0 -S __char_emitter_start Def02B4 -S _printf_end Def02F5 -S __char_emitter_end Def02C8 -S __printf Def00D3 -S __buf_emitter Def02F5 -S __printn Def0000 -S __printf_start Def00D3 -S __buf_emitter_start Def02F5 -S _sprintf Def031C -S __printn_start Def0000 -S __printf_end Def02B4 -S __buf_emitter_end Def031C -S __printn_end Def00C2 -S _sprintf_start Def031C -S _printf Def02C8 -S __char_emitter Def02B4 -S _sprintf_end Def0359 -S _printf_start Def02C8 -A _DATA size 0 flags 0 -A _OVERLAY size 0 flags 0 -A _GSINIT size 0 flags 0 -A _GSFINAL size 0 flags 0 -A _HOME size 0 flags 0 -T 00 00 DD E5 DD 21 00 00 DD 39 AF DD B6 08 CA -R 00 00 00 00 -T 0D 00 42 00 DD 4E 04 DD 46 05 78 CB 7F CA 42 00 -R 00 00 00 00 00 02 00 00 00 0E 00 00 -T 1B 00 C5 DD 6E 0B DD 66 0C E5 3E 2D F5 33 21 -R 00 00 00 00 -T 28 00 32 00 E5 DD 6E 09 DD 66 0A E9 F1 33 C1 AF -R 00 00 00 00 00 02 00 00 -T 36 00 99 4F 3E 00 98 47 DD 71 04 DD 70 05 DD 7E -R 00 00 00 00 -T 44 00 04 DD 96 06 DD 7E 05 DD 9E 07 DA 8B 00 DD -R 00 00 00 00 00 0D 00 00 -T 52 00 6E 06 DD 66 07 E5 DD 6E 04 DD 66 05 E5 CD -R 00 00 00 00 -T 60 00 00 00 44 4D F1 F1 DD 6E 0B DD 66 0C E5 DD -R 00 00 00 00 02 02 01 00 -T 6E 00 6E 09 DD 66 0A E5 3E 00 F5 33 DD 6E 06 DD -R 00 00 00 00 -T 7C 00 66 07 E5 C5 CD 00 00 FD 21 09 00 FD 39 FD -R 00 00 00 00 00 07 00 00 -T 8A 00 F9 DD 6E 06 DD 66 07 E5 DD 6E 04 DD 66 05 -R 00 00 00 00 -T 98 00 E5 CD 00 00 44 4D F1 F1 21 C2 00 09 4D 44 -R 00 00 00 00 02 04 00 00 00 0B 00 00 -T A6 00 0A 4F DD 6E 0B DD 66 0C E5 79 F5 33 21 -R 00 00 00 00 -T B3 00 BD 00 E5 DD 6E 09 DD 66 0A E9 F1 33 DD E1 -R 00 00 00 00 00 02 00 00 -T C1 00 C9 30 31 32 33 34 35 36 37 38 39 41 42 43 -R 00 00 00 00 -T CF 00 44 45 46 00 DD E5 DD 21 00 00 DD 39 DD 4E -R 00 00 00 00 -T DD 00 04 DD 46 05 0A 5F B7 CA B1 02 7B FE 25 CA -R 00 00 00 00 00 0A 00 00 -T EB 00 F0 00 C3 85 02 79 C6 01 DD 77 04 78 CE 00 -R 00 00 00 00 00 02 00 00 00 05 00 00 -T F9 00 DD 77 05 DD 4E 04 DD 46 05 C5 FD E1 FD 4E -R 00 00 00 00 -T 07 01 00 79 FE 62 CA 64 01 79 FE 63 CA 35 01 79 -R 00 00 00 00 00 07 00 00 00 0D 00 00 -T 15 01 FE 64 CA DA 01 79 FE 69 CA DA 01 79 FE 73 -R 00 00 00 00 00 05 00 00 00 0B 00 00 -T 23 01 CA 4E 02 79 FE 75 CA A0 01 79 FE 78 CA -R 00 00 00 00 00 03 00 00 00 09 00 00 -T 30 01 14 02 C3 9C 02 DD 4E 0A DD 46 0B 03 03 DD -R 00 00 00 00 00 02 00 00 00 05 00 00 -T 3E 01 71 0A DD 70 0B 0B 0B 69 60 4E 23 46 DD 6E -R 00 00 00 00 -T 4C 01 08 DD 66 09 E5 79 F5 33 21 5F 01 E5 DD 6E -R 00 00 00 00 00 0B 00 00 -T 5A 01 06 DD 66 07 E9 F1 33 C3 9C 02 DD 4E 0A DD -R 00 00 00 00 00 0A 00 00 -T 68 01 46 0B 03 03 DD 71 0A DD 70 0B 0B 0B 69 60 -R 00 00 00 00 -T 76 01 4E 23 46 06 00 DD 6E 08 DD 66 09 E5 DD 6E -R 00 00 00 00 -T 84 01 06 DD 66 07 E5 3E 00 F5 33 21 0A 00 E5 C5 -R 00 00 00 00 -T 92 01 CD 00 00 FD 21 09 00 FD 39 FD F9 C3 9C 02 -R 00 00 00 00 00 03 00 00 00 0E 00 00 -T A0 01 DD 4E 0A DD 46 0B 03 03 DD 71 0A DD 70 0B -R 00 00 00 00 -T AE 01 0B 0B 69 60 4E 23 46 DD 6E 08 DD 66 09 E5 -R 00 00 00 00 -T BC 01 DD 6E 06 DD 66 07 E5 3E 00 F5 33 21 0A 00 -R 00 00 00 00 -T CA 01 E5 C5 CD 00 00 FD 21 09 00 FD 39 FD F9 C3 -R 00 00 00 00 00 05 00 00 -T D8 01 9C 02 DD 4E 0A DD 46 0B 03 03 DD 71 0A DD -R 00 00 00 00 00 02 00 00 -T E6 01 70 0B 0B 0B 69 60 4E 23 46 DD 6E 08 DD 66 -R 00 00 00 00 -T F4 01 09 E5 DD 6E 06 DD 66 07 E5 3E 01 F5 33 21 -R 00 00 00 00 -T 02 02 0A 00 E5 C5 CD 00 00 FD 21 09 00 FD 39 FD -R 00 00 00 00 00 07 00 00 -T 10 02 F9 C3 9C 02 DD 4E 0A DD 46 0B 03 03 DD 71 -R 00 00 00 00 00 04 00 00 -T 1E 02 0A DD 70 0B 0B 0B 69 60 4E 23 46 DD 6E 08 -R 00 00 00 00 -T 2C 02 DD 66 09 E5 DD 6E 06 DD 66 07 E5 3E 00 F5 -R 00 00 00 00 -T 3A 02 33 21 10 00 E5 C5 CD 00 00 FD 21 09 00 FD -R 00 00 00 00 00 09 00 00 -T 48 02 39 FD F9 C3 9C 02 DD 4E 0A DD 46 0B 03 03 -R 00 00 00 00 00 06 00 00 -T 56 02 DD 71 0A DD 70 0B 0B 0B 69 60 4E 23 46 0A -R 00 00 00 00 -T 64 02 57 B7 CA 9C 02 C5 DD 6E 08 DD 66 09 E5 D5 -R 00 00 00 00 00 05 00 00 -T 72 02 33 21 7E 02 E5 DD 6E 06 DD 66 07 E9 F1 33 -R 00 00 00 00 00 04 00 00 -T 80 02 C1 03 C3 63 02 DD 6E 08 DD 66 09 E5 7B F5 -R 00 00 00 00 00 05 00 00 -T 8E 02 33 21 9A 02 E5 DD 6E 06 DD 66 07 E9 F1 33 -R 00 00 00 00 00 04 00 00 -T 9C 02 DD 4E 04 DD 46 05 79 C6 01 DD 77 04 78 CE -R 00 00 00 00 -T AA 02 00 DD 77 05 C3 DB 00 DD E1 C9 DD E5 DD 21 -R 00 00 00 00 00 07 00 00 -T B8 02 00 00 DD 39 DD 7E 04 F5 33 CD 00 00 33 DD -R 00 00 00 00 02 0C 02 00 -T C6 02 E1 C9 DD E5 DD 21 00 00 DD 39 21 04 00 39 -R 00 00 00 00 -T D4 02 4D 44 03 03 C5 21 00 00 E5 21 B4 02 E5 DD -R 00 00 00 00 00 0C 00 00 -T E2 02 6E 04 DD 66 05 E5 CD D3 00 F1 F1 F1 F1 21 -R 00 00 00 00 00 09 00 00 -T F0 02 00 00 DD E1 C9 DD E5 DD 21 00 00 DD 39 DD -R 00 00 00 00 -T FE 02 4E 05 DD 46 06 C5 FD E1 FD 4E 00 FD 46 01 -R 00 00 00 00 -T 0C 03 59 50 13 FD 73 00 FD 72 01 DD 7E 04 02 DD -R 00 00 00 00 -T 1A 03 E1 C9 DD E5 DD 21 00 00 DD 39 21 06 00 39 -R 00 00 00 00 -T 28 03 4D 44 03 03 21 04 00 39 5D 54 C5 D5 21 -R 00 00 00 00 -T 35 03 F5 02 E5 DD 6E 06 DD 66 07 E5 CD D3 00 F1 -R 00 00 00 00 00 02 00 00 00 0D 00 00 -T 43 03 F1 F1 F1 DD 4E 04 DD 46 05 C5 FD E1 FD 36 -R 00 00 00 00 -T 51 03 00 00 21 00 00 DD E1 C9 -R 00 00 00 00 - - - - - - - - diff --git a/source/msxdos25/bank6/system.h b/source/msxdos25/bank6/system.h deleted file mode 100644 index a0aef783..00000000 --- a/source/msxdos25/bank6/system.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __SYSTEM_H -#define __SYSTEM_H - - -#define MAX_LINLEN_MSX1 40 -#define MAX_LINLEN_MSX2 80 - -#define ESC 27 -#define CURSOR_RIGHT 28 -#define CURSOR_LEFT 29 - - -/* MSX BIOS routines */ - -#define SYNCHR 0x0008 -#define INITXT 0x006C -#define INIT32 0x006F -#define CHPUT 0x00A2 -#define CLS 0x00C3 -#define POSIT 0x00C6 -#define ERAFNK 0x00CC -#define DSPFNK 0x00CF -#define CALBAS 0x0159 - - -/* MSX BASIC ROM routines */ - -#define FRMEVL 0x4C64 - - -/* MSX work area variables */ - -#define LINL40 0xF3AE -#define LINL32 0xF3AF -#define LINLEN 0xF3B0 -#define CRTCNT 0xF3B1 -#define CSRY 0xF3DC -#define CSRX 0xF3DD -#define CNSDFG 0xF3DE -#define VALTYP 0xF663 -#define DAC 0xF7F6 -#define SCRMOD 0xFCAF - - - -#endif //__SYSTEM_H \ No newline at end of file diff --git a/source/msxdos25/drivers/b5.mac b/source/msxdos25/drivers/b5.mac deleted file mode 100644 index 43a87f3d..00000000 --- a/source/msxdos25/drivers/b5.mac +++ /dev/null @@ -1,6 +0,0 @@ - .z80 -BANK equ 6 -; - include BANK.INC -; - end diff --git a/source/msxdos25/drivers/b6.mac b/source/msxdos25/drivers/b6.mac deleted file mode 100644 index 43a87f3d..00000000 --- a/source/msxdos25/drivers/b6.mac +++ /dev/null @@ -1,6 +0,0 @@ - .z80 -BANK equ 6 -; - include BANK.INC -; - end diff --git a/source/msxdos25/drivers/sdscc/DOS250.SDSCC.ROM b/source/msxdos25/drivers/sdscc/DOS250.SDSCC.ROM deleted file mode 100644 index c16fed58..00000000 Binary files a/source/msxdos25/drivers/sdscc/DOS250.SDSCC.ROM and /dev/null differ diff --git a/source/msxdos25/drivers/sdscc/make.bat b/source/msxdos25/drivers/sdscc/make.bat deleted file mode 100644 index 88da45ea..00000000 --- a/source/msxdos25/drivers/sdscc/make.bat +++ /dev/null @@ -1,5 +0,0 @@ -mknexrom ..\..\..\bin\dos250ba.dat nextor2.rom /d:driver.bin /m:Mapper.ASCII8.bin -sjasm makerecoverykernel.asm kernel.dat -copy kernel.dat ..\..\..\bin\DOS250.SDSCC.ROM - - diff --git a/source/msxdos25/mknexrom.exe b/source/msxdos25/mknexrom.exe deleted file mode 100644 index ef011668..00000000 Binary files a/source/msxdos25/mknexrom.exe and /dev/null differ diff --git a/source/msxdos25/panarom/CPM32.EXE b/source/msxdos25/panarom/CPM32.EXE deleted file mode 100644 index 51eb6741..00000000 Binary files a/source/msxdos25/panarom/CPM32.EXE and /dev/null differ diff --git a/source/msxdos25/prodrom/chgbnk.mac.orig b/source/msxdos25/prodrom/chgbnk.mac.orig deleted file mode 100644 index c9ca8792..00000000 --- a/source/msxdos25/prodrom/chgbnk.mac.orig +++ /dev/null @@ -1,51 +0,0 @@ - .z80 - title CHGBNK - OEM Supplied Bank Switching Module -; -;----------------------------------------------------------------------- -; -; This is a manufacturer-supplied bank switching module. This module -; is placed at the tail of every local banks of DOS2-ROM. -; -; This is a sample program. DOS2-ROM has no assumptions on the -; mechanism of bank switching, for example, where the bank register is, -; which bits are assigned to bank switching, etc. The bank register -; does not have to be readable. -; -; Entry: Acc = 0 --- switch to bank #0 -; 1 --- switch to bank #1 -; 2 --- switch to bank #2 -; 3 --- switch to bank #3 -; Exit: None -; -; Only AF can be modified -; -; *** CODE STRTS HERE *** CAUTION!! This must be the first module. -; -BNKREG equ 6000h ;MEGAROM version -BNKID equ 40FFh ;Where Bank id is stored - -CHGBNK:: - ld (BNKREG),a - ret -; -; -------- -; -@DRVINT:: - ex af,af' - ld a,(BNKID) - push af - xor a - call CHGBNK - ex af,af' -; - call DRVINT## -; - ex af,af' - pop af - call CHGBNK - ex af,af' - ret -; - defs (8000h-7FD0h)-($-CHGBNK),0FFh -; - end diff --git a/source/msxdos25/tool/L80.CPM b/source/msxdos25/tool/L80.CPM deleted file mode 100644 index ac1fedc9..00000000 Binary files a/source/msxdos25/tool/L80.CPM and /dev/null differ diff --git a/source/msxdos25/tool/LIB80.CPM b/source/msxdos25/tool/LIB80.CPM deleted file mode 100644 index 81b1d224..00000000 Binary files a/source/msxdos25/tool/LIB80.CPM and /dev/null differ diff --git a/source/msxdos25/tool/M80.CPM b/source/msxdos25/tool/M80.CPM deleted file mode 100644 index 0ae1e23d..00000000 Binary files a/source/msxdos25/tool/M80.CPM and /dev/null differ