From 95e9611e1031487cda8ae03dbe88178c18d413fc Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Thu, 13 Jan 2022 13:10:41 +0100 Subject: [PATCH 1/2] Add a new KIILLDSKIO environment variable. When this variable is set to "ON" (case insensitive) the 512 byte buffer that is normally allocated for the DSKI$ and DSKO$ BASIC commands won't be allocated when starting the BASIC environment, thus these 512 bytes will be gained back for BASIC programs. This implies that the DSKI$ and DSKO$ commands will be disabled (they will throw "syntax error"). --- source/kernel/bank0/dskbasic.mac | 11 +++++++++++ source/kernel/bank0/init.mac | 7 ++++++- source/kernel/bank4/env.mac | 33 +++++++++++++++++++++++++++++++- source/kernel/data.mac | 5 ++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/source/kernel/bank0/dskbasic.mac b/source/kernel/bank0/dskbasic.mac index 38483caf..24c485fb 100644 --- a/source/kernel/bank0/dskbasic.mac +++ b/source/kernel/bank0/dskbasic.mac @@ -1924,6 +1924,15 @@ GET_HANDLE_0: pop hl ret +CHECK_DIRBUF: + push hl + ld hl,($DIRBUF) + ld a,h + or l + pop hl + jp z,JSNERR + ret + if 1 subttl DSKI$/DSKO$ ; @@ -1931,6 +1940,7 @@ if 1 ; DSKO$ , ; $HOOK DSKI$ + call CHECK_DIRBUF call REMHOK ;remove hook return call CHRGET ;skip over current token SYNCHK '(' @@ -1947,6 +1957,7 @@ $HOOK DSKI$ jr DSKO$1 ;perform disk input ; $HOOK DSKO$ + call CHECK_DIRBUF call REMHOK ;remove hook return call GET_PARAM ;get drive and sector call CHRGOT ;end of statement? diff --git a/source/kernel/bank0/init.mac b/source/kernel/bank0/init.mac index 4bff827d..09f56491 100644 --- a/source/kernel/bank0/init.mac +++ b/source/kernel/bank0/init.mac @@ -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,0 + 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 ; diff --git a/source/kernel/bank4/env.mac b/source/kernel/bank4/env.mac index e9bfe45b..48aee33e 100644 --- a/source/kernel/bank4/env.mac +++ b/source/kernel/bank4/env.mac @@ -135,7 +135,7 @@ check_duplicate:call FIND_ENV_ITEM ;Look for a matching item xor a ret ;Return with no error. - ;Check for ZALLOC and ERRLANG + ;Check for ZALLOC, KILLDSKIO and ERRLANG CHECK_SPECIAL: push hl ;Name @@ -162,7 +162,37 @@ ZALLOC_OFF: ZALLOC_END: ld (MFLAGS##),a + jr CHKERRLANG_END + CHKZALLOC_END: + pop de + pop hl + push hl + push de + +CHECK_KILLD: + ld de,KILLD_S + call COMPARE_ENV + jr nz,CHKKILLD_END + + pop hl ;Value + push hl + ld de,ON_S + call COMPARE_ENV + ld a,(MFLAGS##) + jr nz,KILLD_OFF + +KILLD_ON: + or 16 + jr KILLD_END + +KILLD_OFF: + and 255-16 + +KILLD_END: + ld (MFLAGS##),a + jr CHKERRLANG_END +CHKKILLD_END: pop de pop hl push hl @@ -195,6 +225,7 @@ CHKERRLANG_END: ret ZALLOC_S: db "ZALLOC",0 +KILLD_S: db "KILLDSKIO",0 ERRLANG_S: db "ERRLANG",0 ON_S: db "ON",0 EN_S: db "EN",0 diff --git a/source/kernel/data.mac b/source/kernel/data.mac index 65ceb5fb..847be00b 100644 --- a/source/kernel/data.mac +++ b/source/kernel/data.mac @@ -217,7 +217,10 @@ ram_ad defl DATABASE var1 MFLAGS ;Miscellaneous flags const FASTOUT,0 ;bit 0: set for fast STROUT const FIRSTLD,1 ;bit 1: set while booting NEXTOR.SYS for the first time - const ZALLOC,2 ;bit 2: reduced alloc info mode becomes zero info mode + const ZALLOC,2 ;bit 2: reduced alloc info mode becomes zero info mode (SET ZALLOC ON) + const ERRL,3 ;bit 3: always show error messages in English (SET ERRLANG ON) + const KILLD,4 ;bit 4: kill DSKI and DSKO BASIC commands (SET KILLDSKIO ON) + const SYST2,7 ;Bit 7: force boot in MSXDOS2.SYS (temporary, reset after read) spare 1 ;Available for DOS 2 ; var2 BLDCHK From 2d6d35659f995c551407131b3f5426bbc1927a1d Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Tue, 18 Jan 2022 16:32:32 +0100 Subject: [PATCH 2/2] Set DIRBUF and PATHNAM to the value of SECBUF, instead of zero PATHNAME can't be zero as it's used as a pathanme buffer in BASIC. Also set DIRBUF to the same value for compatibility. --- docs/Nextor 2.1 User Manual.md | 12 ++++++++++++ source/kernel/bank0/dskbasic.mac | 15 ++++++--------- source/kernel/bank0/init.mac | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/Nextor 2.1 User Manual.md b/docs/Nextor 2.1 User Manual.md index d19d4518..26c5c010 100644 --- a/docs/Nextor 2.1 User Manual.md +++ b/docs/Nextor 2.1 User Manual.md @@ -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) @@ -339,6 +341,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 @@ -1104,6 +1112,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. diff --git a/source/kernel/bank0/dskbasic.mac b/source/kernel/bank0/dskbasic.mac index 24c485fb..69a33a4f 100644 --- a/source/kernel/bank0/dskbasic.mac +++ b/source/kernel/bank0/dskbasic.mac @@ -1924,13 +1924,10 @@ GET_HANDLE_0: pop hl ret -CHECK_DIRBUF: - push hl - ld hl,($DIRBUF) - ld a,h - or l - pop hl - jp z,JSNERR +CHECK_KILLDSKIO: + ld a,(MFLAGS##) + and 16 ;KILLD + jp nz,JSNERR ret if 1 @@ -1940,7 +1937,7 @@ if 1 ; DSKO$ , ; $HOOK DSKI$ - call CHECK_DIRBUF + call CHECK_KILLDSKIO call REMHOK ;remove hook return call CHRGET ;skip over current token SYNCHK '(' @@ -1957,7 +1954,7 @@ $HOOK DSKI$ jr DSKO$1 ;perform disk input ; $HOOK DSKO$ - call CHECK_DIRBUF + call CHECK_KILLDSKIO call REMHOK ;remove hook return call GET_PARAM ;get drive and sector call CHRGOT ;end of statement? diff --git a/source/kernel/bank0/init.mac b/source/kernel/bank0/init.mac index 09f56491..37e50d30 100644 --- a/source/kernel/bank0/init.mac +++ b/source/kernel/bank0/init.mac @@ -1870,7 +1870,7 @@ SET_DISKBASIC:: ; ld a,(MFLAGS##) and 16 ;KILLD - ld hl,0 + 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