Skip to content

Commit 413810c

Browse files
authored
v2.1.1 beta 2 (#102)
* 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)
2 parents 6b5f125 + 4c2903b commit 413810c

File tree

20 files changed

+328
-533
lines changed

20 files changed

+328
-533
lines changed

docs/Nextor 2.1 Programmers Reference.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@
8888

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

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

93-
[8.2. v2.1.0 beta 1](#82-v210-beta-1)
93+
[8.2. v2.1.0 RC 1](#82-v210-rc-1)
94+
95+
[8.3. v2.1.0 beta 2](#83-v210-beta-2)
96+
97+
[8.4. v2.1.0 beta 1](#84-v210-beta-1)
9498

9599

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

443-
If a file is mounted in the drive, the information returned in the data buffer is insetad as follows:
447+
If a file is mounted in the drive, the information returned in the data buffer is instead as follows:
444448

445449
```
446450
+1: Drive where the mounted file is located (0 = A:, etc)
447451
+2: Flags:
448452
bit 0: mount mode, 0 = read and write, 1 = read-only
449453
+3: Always 0
450454
+4: Filename in printable format (up to 12 characters, plus a terminating zero)
455+
+17: Start cluster of the file, 2 bytes (0 if not available)
456+
+19: Start sector of the file, 4 bytes (0 if not available)
451457
```
452458

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

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

463+
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.
464+
465+
457466
### 3.10. Get information about a device partition (_GPART, 7Ah)
458467

459468
```
@@ -611,7 +620,7 @@ When invoked in MSX-DOS 1 mode, the following restrictions apply to this functio
611620
* 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.
612621
These restrictions are imposed by the Nextor architecture.
613622

614-
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.
623+
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.
615624

616625

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

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

757-
* Invalid cluster number (.ICLUS, 0B0h)
766+
* Invalid cluster number or sequence (.ICLUS, 0B0h)
758767

759-
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.
768+
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.
760769

761770

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

10021011
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.
10031012

1004-
### 8.1. v2.1.0 beta 2
1013+
### 8.1. v2.1.1 beta 2
1014+
1015+
* [_GDLI](#39-get-information-about-a-drive-letter-_gdli-79h) returns two new fields, "start cluster" and "start sector", when a file is mounted.
1016+
1017+
### 8.2. v2.1.0 RC 1
1018+
1019+
* [_GETCLUS](#314-get-information-for-a-cluster-on-a-fat-drive-_getclus-7eh) function call introduced.
1020+
* [UNAPI RAAM helper compatible routines](#5-extended-mapper-support-routines) have been added.
1021+
* Extra mapper support routines `ALL_BK` and `FRE_BK` have been removed.
1022+
1023+
### 8.3. v2.1.0 beta 2
10051024

10061025
* [_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.
10071026

1008-
### 8.2. v2.1.0 beta 1
1027+
### 8.4. v2.1.0 beta 1
10091028

10101029
* [_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.
10111030

docs/Nextor 2.1 User Manual.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

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

45+
[2.14. The KILLDSKIO environment variable](#214-the-killdskio-environment-variable)
46+
4547
[3. Using Nextor](#3-using-nextor)
4648

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

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

113+
[3.6.12 The CALL SYSTEM2 command](#3611-the-call-system2-command)
114+
111115
[3.7. New BASIC error codes](#37-new-basic-error-codes)
112116

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

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

346+
### 2.14. The KILLDSKIO environment variable
347+
348+
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).
349+
350+
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.
351+
342352

343353
## 3. Using Nextor
344354

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

359369
**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.
360370

371+
**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.
372+
361373
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).
362374

363375
Therefore, in order to "install" Nextor, you have two options:
@@ -921,6 +933,13 @@ Here is a simple BASIC program to test the CALL USR command. Change the register
921933
160 PRINT "IY=&H";HEX$(R(5))
922934
````
923935
936+
#### 3.6.12 The CALL SYSTEM2 command
937+
938+
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.
939+
940+
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.
941+
942+
924943
### 3.7. New BASIC error codes
925944
926945
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.
@@ -955,6 +974,10 @@ An attempt to open or alter a mounted file, or to perform any other disallowed o
955974
956975
Thrown by the CALL MAPDRV command when attempting to mount a file that is smaller than 512 bytes or larger than 32 MBytes.
957976
977+
* Invalid cluster sequence (82)
978+
979+
Thrown by the CALL MAPDRV command when attempting to mount a file that is not stored across consecutive sectors in its host filesystem.
980+
958981
959982
### 3.8. Mounting files
960983
@@ -964,7 +987,9 @@ To mount a file, use [the MAPDRV tool](#341-mapdrv-the-drive-mapping-tool) with
964987
965988
This feature has some restrictions:
966989
967-
* To be mountable a disk image file must have a size of at least 512 bytes and at most 32 MBytes.
990+
* The file must have a size of at least 512 bytes and at most 32 MBytes.
991+
992+
* The file must be stored across consecutive sectors in its host filesystem (since Nextor 2.1.1).
968993
969994
* The file is expected to contain a proper FAT filesystem already, it is not possible to apply the FORMAT command on a mounted drive.
970995
@@ -1104,6 +1129,10 @@ This section contains the change history for the different versions of Nextor. C
11041129
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.
11051130
11061131
1132+
### 5.1. v2.1.1 beta 2
1133+
1134+
- Introduced the
1135+
11071136
### 5.1. v2.1.0 beta 2
11081137
11091138
- Nextor will now try to load `MSXDOS2.SYS` if `NEXTOR.SYS` is not found in the boot drive.

source/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# See the "all" main rule for some handy aliases to generate specific ROMs
55
# (e.g. you can run "make base" or "make ide").
66

7-
VERSION := 2.1.1-beta1
7+
VERSION := 2.1.1-beta2
88

99
export X80_COMMAND_LINE=-t -nb
1010
export M80_COMMAND_LINE=-8

source/kernel/bank0/dosboot.mac

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,19 @@ NOBOOT:
294294
jr z,msxdos_fail
295295
;
296296
retry_dos:
297+
ld a,(MFLAGS##)
298+
bit 7,a ;SYST2
299+
res 7,a
300+
ld (MFLAGS##),a
301+
jr nz,retry_dos2
302+
retry_dos_go:
297303
ld de,BOOT_NAME ;Try to open the "NEXTOR.SYS"
298304
xor a ;file on the default drive.
299305
ld c,_OPEN##
300306
call BOOT_BDOS
301307
jr z,msxdos_bootok
302308

309+
retry_dos2:
303310
ld de,OLD_BOOT_NAME ;Fallback to try "MSXDOS.SYS"
304311
xor a
305312
ld c,_OPEN##
@@ -316,8 +323,6 @@ msxdos_bootok:
316323
push af
317324
ld c,_CLOSE##
318325
call BOOT_BDOS ;Close the file handle
319-
ld hl,MFLAGS##
320-
res 1,(hl)
321326
pop af
322327
jr nz,msxdos_fail ;Jump if the read was no good
323328
;
@@ -333,8 +338,6 @@ endif
333338
jp 100h ;Start up MSXDOS.SYS
334339
;
335340
msxdos_fail:
336-
ld hl,MFLAGS##
337-
res 1,(hl)
338341
ret
339342
;
340343
;

source/kernel/bank0/dskbasic.mac

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ ABORT:
397397
; Table of expanded statements
398398
;
399399
COMMAND:
400+
defb 'SYSTEM2',0
401+
defw SYSTEM2
400402
defb 'SYSTEM',0
401403
defw SYSTEM
402404
defb 'FORMAT',0
@@ -437,6 +439,12 @@ COMMAND:
437439
;
438440
; _SYSTEM[("<command_string>")]
439441
;
442+
SYSTEM2:
443+
push hl
444+
ld hl,MFLAGS##
445+
set 7,(hl) ;SYST2
446+
pop hl
447+
440448
SYSTEM:
441449
ld de,CMDTMP ; assume end of statement
442450
jr z,SYSTEM_NO_ARG ; good assumption
@@ -1924,13 +1932,20 @@ GET_HANDLE_0:
19241932
pop hl
19251933
ret
19261934

1935+
CHECK_KILLDSKIO:
1936+
ld a,(MFLAGS##)
1937+
and 16 ;KILLD
1938+
jp nz,JSNERR
1939+
ret
1940+
19271941
if 1
19281942
subttl DSKI$/DSKO$
19291943
;
19301944
; DSKI$(<drive_number>,<sector_number>)
19311945
; DSKO$ <drive_number>,<sector_number>
19321946
;
19331947
$HOOK DSKI$
1948+
call CHECK_KILLDSKIO
19341949
call REMHOK ;remove hook return
19351950
call CHRGET ;skip over current token
19361951
SYNCHK '('
@@ -1947,6 +1962,7 @@ $HOOK DSKI$
19471962
jr DSKO$1 ;perform disk input
19481963
;
19491964
$HOOK DSKO$
1965+
call CHECK_KILLDSKIO
19501966
call REMHOK ;remove hook return
19511967
call GET_PARAM ;get drive and sector
19521968
call CHRGOT ;end of statement?
@@ -3547,7 +3563,7 @@ DBABORT_ROUTINE:
35473563
;
35483564
; Analyze errors returned from BDOS call
35493565
;
3550-
.FRSTER equ 0B1h ;0BAh ; lowest MSXDOS2 error code supported
3566+
.FRSTER equ 0B0h ;0BAh ; lowest MSXDOS2 error code supported
35513567
;
35523568
DERNUM macro ERRNAM
35533569
ifidn <ERRNAM>,<*>
@@ -3562,6 +3578,7 @@ QQQQ defl .FRSTER
35623578
;
35633579
DERR_TAB:
35643580

3581+
DERNUM ERRICL ; Invalid cluster sequence
35653582
DERNUM ERRBFS ; Bad file size
35663583
DERNUM ERRFIM ; File is mounted
35673584

@@ -3720,6 +3737,7 @@ QQQQ defl DERFST
37203737

37213738
DERMAK ERRFIM ; File is mounted
37223739
DERMAK ERRBFS ; Bad file size
3740+
DERMAK ERRICL ; Invalid cluster sequence
37233741
;
37243742
DERLST equ QQQQ-1 ;
37253743
;
@@ -4118,8 +4136,9 @@ DERMSG: defb 0
41184136

41194137
defb 'File is mounted', 0
41204138
defb 'Bad file size', 0
4139+
defb 'Invalid cluster sequence',0
41214140

4122-
; '----+----1----+----2----'
4141+
; '----+----1----+----2----'
41234142
;
41244143
MAXMSGLEN equ 24+2 ;2 extra spaces are for terminators
41254144

source/kernel/bank0/init.mac

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,8 +1868,13 @@ SET_DISKBASIC::
18681868
ld hl,DBABORT##
18691869
ld (BREAKVECT##),hl
18701870
;
1871-
ld bc,($MAXSEC##) ;Allocate sector buffer for DSKI$, DSKO$
1871+
ld a,(MFLAGS##)
1872+
and 16 ;KILLD
1873+
ld hl,($SECBUF##)
1874+
jr nz,SET_DIRBUF ;Allocate sector buffer for DSKI$, DSKO$
1875+
ld bc,($MAXSEC##) ;unless KILLDSKIO env item is set
18721876
call RESERVE_BASIC
1877+
SET_DIRBUF:
18731878
ld ($DIRBUF##),hl
18741879
if 0
18751880
;

source/kernel/bank1/mapinit.mac

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,6 @@ zero_p2_loop: ld (hl),0 ; data segment up to the
223223
ld (RAM_PTR##),hl ; to point to an end of chain
224224
; marker at the bottom of all
225225
; the fixed variables.
226-
ld hl,0
227-
ld (MHANDLES##),hl
228-
ld (MHANDLES##+2),hl
229-
ld (MHANDLES##+4),hl
230-
ld (MHANDLES##+6),hl
231-
ld a,h
232-
ld (RW_LEVEL##),a
233-
ld (BF_LEVEL##),a
234226
;
235227
;
236228
; ***** SETUP MAP_TBL AND SEGMENT LISTS IN PAGE-2 *****

source/kernel/bank1/msg.mac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ ERR_MSG_TABLE:
239239
err .PUSED, <"Partition is already in use">
240240
err .FMNT, <"File is mounted">
241241
err .BFSZ, <"Bad file size">
242-
err .ICLUS, <"Invalid cluster number">
242+
err .ICLUS, <"Invalid cluster number or sequence">
243243
;
244244
;
245245
; The following are errors which the KBDOS may pass to the ABORT routine.
@@ -439,7 +439,7 @@ ERR_KMSG_TABLE:
439439
err .PUSED, <"�p�[�e�B�V�������g�p���ł�"> ;<"Partition is already in use">
440440
err .FMNT, <"�t�@�C�����}�E���g����Ă��܂�"> ;<"File is mounted">
441441
err .BFSZ, <"�����ȃt�@�C���T�C�Y"> ;<"Bad file size">
442-
err .ICLUS, <"�����ȃN���X�^�[�ԍ�"> ;<"Invalid cluster number">
442+
err .ICLUS, <"�����ȃN���X�^�[�ԍ��܂��̓V�[�P���X"> ;<"Invalid cluster number or sequence">
443443
;
444444
;
445445
; The following are errors which the KBDOS may pass to the ABORT routine.

0 commit comments

Comments
 (0)