Skip to content

Commit

Permalink
v2.1.1 beta 2 (#102)
Browse files Browse the repository at this point in the history
* Change the mechanism to access mounted files (#93)
* Fix: incorrect setting of UD_ACLU when freeing a FAT chain (#96)
* Add the CALL SYSTEM2 command in BASIC (#97)
* Add a new KILLDSKIO environment variable (#98)
* Update kernel version number to 2.1.1 beta 2 (#101)
  • Loading branch information
Konamiman committed Mar 22, 2022
2 parents 6b5f125 + 4c2903b commit 413810c
Show file tree
Hide file tree
Showing 20 changed files with 328 additions and 533 deletions.
35 changes: 27 additions & 8 deletions docs/Nextor 2.1 Programmers Reference.md
Expand Up @@ -88,9 +88,13 @@

[8. Change history](#8-change-history)

[8.1. v2.1.0 beta 2](#81-v210-beta-2)
[8.1. v2.1.1 beta 2](#81-v211-beta-2)

[8.2. v2.1.0 beta 1](#82-v210-beta-1)
[8.2. v2.1.0 RC 1](#82-v210-rc-1)

[8.3. v2.1.0 beta 2](#83-v210-beta-2)

[8.4. v2.1.0 beta 1](#84-v210-beta-1)


## 1. Introduction
Expand Down Expand Up @@ -440,20 +444,25 @@ The information returned in the data buffer is as follows:
+10..+63: Reserved (currently always zero)
```

If a file is mounted in the drive, the information returned in the data buffer is insetad as follows:
If a file is mounted in the drive, the information returned in the data buffer is instead 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)
+17: Start cluster of the file, 2 bytes (0 if not available)
+19: Start sector of the file, 4 bytes (0 if not available)
```

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).

The "start cluster" and "start sector" fields for mounted files were introduced in Nextor 2.1.1. Currently, they will always contain meaningful information, but in future versions of Nextor this could not be true (because non-FAT filesystems with no concept of "clusters" get supported, or for any other reason) and in these cases the fields will have a value of zero. These fields will also be returned as zero in versions of Nextor older than 2.1.1, therefore application programs using this function call should always verify that the values of these fields are non-zero before using them.


### 3.10. Get information about a device partition (_GPART, 7Ah)

```
Expand Down Expand Up @@ -611,7 +620,7 @@ When invoked in MSX-DOS 1 mode, the following restrictions apply to this functio
* 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.
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, and since Nextor 2.1.1 a file needs to be stored across consecutive sectors in its host filesystem to be mountable. A .BFSZ error will be returned if the file is too small (less than 512 bytes) or too big (more than 32 MBytes). A .ICLUS error will be returned if the file is not stored across consecutive sectors.


### 3.13. Enable or disable the Z80 access mode for a driver (_Z80MODE, 7Dh)
Expand Down Expand Up @@ -754,9 +763,9 @@ An attempt to open or alter a mounted file, or to perform any other disallowed o

Attempt to mount a file that is smaller than 512 bytes or larger than 32 MBytes.

* Invalid cluster number (.ICLUS, 0B0h)
* Invalid cluster number or sequence (.ICLUS, 0B0h)

The cluster number supplied to the [_GETCLUS](#314-get-information-for-a-cluster-on-a-fat-drive-_getclus-7eh) function doesn't exist in the drive.
The cluster number supplied to the [_GETCLUS](#314-get-information-for-a-cluster-on-a-fat-drive-_getclus-7eh) function doesn't exist in the drive, or a file was supplied to [_MAPDRV](#312-map-a-drive-letter-to-a-driver-and-device-_mapdrv-7ch) to be mounted but the file is not stored across consecutive sectors in its host filesystem.


## 5. Extended mapper support routines
Expand Down Expand Up @@ -1001,11 +1010,21 @@ This section contains the change history for the different versions of Nextor. O

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.

### 8.1. v2.1.0 beta 2
### 8.1. v2.1.1 beta 2

* [_GDLI](#39-get-information-about-a-drive-letter-_gdli-79h) returns two new fields, "start cluster" and "start sector", when a file is mounted.

### 8.2. v2.1.0 RC 1

* [_GETCLUS](#314-get-information-for-a-cluster-on-a-fat-drive-_getclus-7eh) function call introduced.
* [UNAPI RAAM helper compatible routines](#5-extended-mapper-support-routines) have been added.
* Extra mapper support routines `ALL_BK` and `FRE_BK` have been removed.

### 8.3. v2.1.0 beta 2

* [_GPART](#310-get-information-about-a-device-partition-_gpart-7ah) now returns the status byte of the partition, and allows to retrieve the device sector number that holds the partition table entry instead of information about the partition.

### 8.2. v2.1.0 beta 1
### 8.4. 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.

Expand Down
31 changes: 30 additions & 1 deletion docs/Nextor 2.1 User Manual.md
Expand Up @@ -42,6 +42,8 @@

[2.13. File mounting and disk emulation mode](#213-file-mounting-and-disk-emulation-mode)

[2.14. The KILLDSKIO environment variable](#214-the-killdskio-environment-variable)

[3. Using Nextor](#3-using-nextor)

[3.1. Installing Nextor](#31-installing-nextor)
Expand Down Expand Up @@ -108,6 +110,8 @@

[3.6.11. The CALL USR command](#3611-the-call-usr-command)

[3.6.12 The CALL SYSTEM2 command](#3611-the-call-system2-command)

[3.7. New BASIC error codes](#37-new-basic-error-codes)

[3.8. Mounting files](#38-mounting-files)
Expand Down Expand Up @@ -339,6 +343,12 @@ Since version 2.1 Nextor allows to mount disk image files in two ways:

* 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).

### 2.14. The KILLDSKIO environment variable

Since version 2.1.1 Nextor provides a mechanism to disable the BASIC commands `DSKI$` and `DSKO$`, which gives 512 extra bytes of free memory for the BASIC environment. This is achieved by creating an environment variable named `KILLDSKIO` with a value of `ON` (case-insensitive).

Note that when `DSKI$` and `DSKO$` are disabled in this way the `DIRBUF` variable (&HF351), which holds the address of the 512 byte buffer where these commands read and write sectors, will have the same value as `SECBUF` (&HF34D), which is a generic sector buffer used internally by Nextor; and the same goes for `PATHNAM` (&HF33B), a buffer used by BASIC to parse pathnames for commands like `FILES`. This shouldn't be a problem in most cases, but for robustness it's recommended to use this feature only when that extra memory is abolutely necessary.


## 3. Using Nextor

Expand All @@ -358,6 +368,8 @@ Nextor consists of the following components:

**Note:** starting with Nextor 2.1.0 beta 2, the kernel will try to load MSXDOS2.SYS if NEXTOR.SYS is not found. However in this case the Nextor command line tools won't work.

**Note:** starting with Nextor 2.1.0 beta 2, [the `CALL SYSTEM2` command](#3611-the-call-system2-command) can be used in BASIC to force a reboot in the DOS environment using MSXDOS2.SYS, even if NEXTOR.SYS exists.

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:
Expand Down Expand Up @@ -921,6 +933,13 @@ Here is a simple BASIC program to test the CALL USR command. Change the register
160 PRINT "IY=&H";HEX$(R(5))
````

#### 3.6.12 The CALL SYSTEM2 command

Nextor 2.1.1 introduced a new `CALL SYSTEM2` command. This command works the same as `CALL SYSTEM`, but will always load MSXDOS2.SYS, even if a file named NEXTOR.SYS exists. This can be useful to get back some TPA space for applications, since MSXDOS2.SYS is smaller than NEXTOR.SYS.

Note however that the new function calls introduced by Nextor won't work if NEXTOR.SYS isn't loaded, this implies that the Nextor-specific command line tools (e.g. `MAPDRV.COM`) won't work if the DOS environment is entered via `CALL SYSTEM2` command.


### 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.
Expand Down Expand Up @@ -955,6 +974,10 @@ An attempt to open or alter a mounted file, or to perform any other disallowed o

Thrown by the CALL MAPDRV command when attempting to mount a file that is smaller than 512 bytes or larger than 32 MBytes.

* Invalid cluster sequence (82)

Thrown by the CALL MAPDRV command when attempting to mount a file that is not stored across consecutive sectors in its host filesystem.


### 3.8. Mounting files

Expand All @@ -964,7 +987,9 @@ To mount a file, use [the MAPDRV tool](#341-mapdrv-the-drive-mapping-tool) with

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 must have a size of at least 512 bytes and at most 32 MBytes.

* The file must be stored across consecutive sectors in its host filesystem (since Nextor 2.1.1).

* The file is expected to contain a proper FAT filesystem already, it is not possible to apply the FORMAT command on a mounted drive.

Expand Down Expand Up @@ -1104,6 +1129,10 @@ This section contains the change history for the different versions of Nextor. C
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.1 beta 2

- Introduced the

### 5.1. v2.1.0 beta 2

- Nextor will now try to load `MSXDOS2.SYS` if `NEXTOR.SYS` is not found in the boot drive.
Expand Down
2 changes: 1 addition & 1 deletion source/kernel/Makefile
Expand Up @@ -4,7 +4,7 @@
# See the "all" main rule for some handy aliases to generate specific ROMs
# (e.g. you can run "make base" or "make ide").

VERSION := 2.1.1-beta1
VERSION := 2.1.1-beta2

export X80_COMMAND_LINE=-t -nb
export M80_COMMAND_LINE=-8
Expand Down
11 changes: 7 additions & 4 deletions source/kernel/bank0/dosboot.mac
Expand Up @@ -294,12 +294,19 @@ NOBOOT:
jr z,msxdos_fail
;
retry_dos:
ld a,(MFLAGS##)
bit 7,a ;SYST2
res 7,a
ld (MFLAGS##),a
jr nz,retry_dos2
retry_dos_go:
ld de,BOOT_NAME ;Try to open the "NEXTOR.SYS"
xor a ;file on the default drive.
ld c,_OPEN##
call BOOT_BDOS
jr z,msxdos_bootok

retry_dos2:
ld de,OLD_BOOT_NAME ;Fallback to try "MSXDOS.SYS"
xor a
ld c,_OPEN##
Expand All @@ -316,8 +323,6 @@ msxdos_bootok:
push af
ld c,_CLOSE##
call BOOT_BDOS ;Close the file handle
ld hl,MFLAGS##
res 1,(hl)
pop af
jr nz,msxdos_fail ;Jump if the read was no good
;
Expand All @@ -333,8 +338,6 @@ endif
jp 100h ;Start up MSXDOS.SYS
;
msxdos_fail:
ld hl,MFLAGS##
res 1,(hl)
ret
;
;
Expand Down
23 changes: 21 additions & 2 deletions source/kernel/bank0/dskbasic.mac
Expand Up @@ -397,6 +397,8 @@ ABORT:
; Table of expanded statements
;
COMMAND:
defb 'SYSTEM2',0
defw SYSTEM2
defb 'SYSTEM',0
defw SYSTEM
defb 'FORMAT',0
Expand Down Expand Up @@ -437,6 +439,12 @@ COMMAND:
;
; _SYSTEM[("<command_string>")]
;
SYSTEM2:
push hl
ld hl,MFLAGS##
set 7,(hl) ;SYST2
pop hl

SYSTEM:
ld de,CMDTMP ; assume end of statement
jr z,SYSTEM_NO_ARG ; good assumption
Expand Down Expand Up @@ -1924,13 +1932,20 @@ GET_HANDLE_0:
pop hl
ret

CHECK_KILLDSKIO:
ld a,(MFLAGS##)
and 16 ;KILLD
jp nz,JSNERR
ret

if 1
subttl DSKI$/DSKO$
;
; DSKI$(<drive_number>,<sector_number>)
; DSKO$ <drive_number>,<sector_number>
;
$HOOK DSKI$
call CHECK_KILLDSKIO
call REMHOK ;remove hook return
call CHRGET ;skip over current token
SYNCHK '('
Expand All @@ -1947,6 +1962,7 @@ $HOOK DSKI$
jr DSKO$1 ;perform disk input
;
$HOOK DSKO$
call CHECK_KILLDSKIO
call REMHOK ;remove hook return
call GET_PARAM ;get drive and sector
call CHRGOT ;end of statement?
Expand Down Expand Up @@ -3547,7 +3563,7 @@ DBABORT_ROUTINE:
;
; Analyze errors returned from BDOS call
;
.FRSTER equ 0B1h ;0BAh ; lowest MSXDOS2 error code supported
.FRSTER equ 0B0h ;0BAh ; lowest MSXDOS2 error code supported
;
DERNUM macro ERRNAM
ifidn <ERRNAM>,<*>
Expand All @@ -3562,6 +3578,7 @@ QQQQ defl .FRSTER
;
DERR_TAB:

DERNUM ERRICL ; Invalid cluster sequence
DERNUM ERRBFS ; Bad file size
DERNUM ERRFIM ; File is mounted

Expand Down Expand Up @@ -3720,6 +3737,7 @@ QQQQ defl DERFST

DERMAK ERRFIM ; File is mounted
DERMAK ERRBFS ; Bad file size
DERMAK ERRICL ; Invalid cluster sequence
;
DERLST equ QQQQ-1 ;
;
Expand Down Expand Up @@ -4118,8 +4136,9 @@ DERMSG: defb 0

defb 'File is mounted', 0
defb 'Bad file size', 0
defb 'Invalid cluster sequence',0

; '----+----1----+----2----'
; '----+----1----+----2----'
;
MAXMSGLEN equ 24+2 ;2 extra spaces are for terminators

Expand Down
7 changes: 6 additions & 1 deletion source/kernel/bank0/init.mac
Expand Up @@ -1868,8 +1868,13 @@ SET_DISKBASIC::
ld hl,DBABORT##
ld (BREAKVECT##),hl
;
ld bc,($MAXSEC##) ;Allocate sector buffer for DSKI$, DSKO$
ld a,(MFLAGS##)
and 16 ;KILLD
ld hl,($SECBUF##)
jr nz,SET_DIRBUF ;Allocate sector buffer for DSKI$, DSKO$
ld bc,($MAXSEC##) ;unless KILLDSKIO env item is set
call RESERVE_BASIC
SET_DIRBUF:
ld ($DIRBUF##),hl
if 0
;
Expand Down
8 changes: 0 additions & 8 deletions source/kernel/bank1/mapinit.mac
Expand Up @@ -223,14 +223,6 @@ zero_p2_loop: ld (hl),0 ; data segment up to the
ld (RAM_PTR##),hl ; to point to an end of chain
; marker at the bottom of all
; the fixed variables.
ld hl,0
ld (MHANDLES##),hl
ld (MHANDLES##+2),hl
ld (MHANDLES##+4),hl
ld (MHANDLES##+6),hl
ld a,h
ld (RW_LEVEL##),a
ld (BF_LEVEL##),a
;
;
; ***** SETUP MAP_TBL AND SEGMENT LISTS IN PAGE-2 *****
Expand Down
4 changes: 2 additions & 2 deletions source/kernel/bank1/msg.mac
Expand Up @@ -239,7 +239,7 @@ ERR_MSG_TABLE:
err .PUSED, <"Partition is already in use">
err .FMNT, <"File is mounted">
err .BFSZ, <"Bad file size">
err .ICLUS, <"Invalid cluster number">
err .ICLUS, <"Invalid cluster number or sequence">
;
;
; The following are errors which the KBDOS may pass to the ABORT routine.
Expand Down Expand Up @@ -439,7 +439,7 @@ ERR_KMSG_TABLE:
err .PUSED, <"�p�[�e�B�V�������g�p���ł�"> ;<"Partition is already in use">
err .FMNT, <"�t�@�C�����}�E���g����Ă��܂�"> ;<"File is mounted">
err .BFSZ, <"�����ȃt�@�C���T�C�Y"> ;<"Bad file size">
err .ICLUS, <"�����ȃN���X�^�[�ԍ�"> ;<"Invalid cluster number">
err .ICLUS, <"�����ȃN���X�^�[�ԍ��܂��̓V�[�P���X"> ;<"Invalid cluster number or sequence">
;
;
; The following are errors which the KBDOS may pass to the ABORT routine.
Expand Down

0 comments on commit 413810c

Please sign in to comment.