Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new KILLDSKIO environment variable #98

Merged
merged 3 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/Nextor 2.1 User Manual.md
Original file line number Diff line number Diff line change
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 @@ -341,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 Down Expand Up @@ -1121,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
8 changes: 8 additions & 0 deletions source/kernel/bank0/dskbasic.mac
Original file line number Diff line number Diff line change
Expand Up @@ -1932,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 @@ -1955,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
7 changes: 6 additions & 1 deletion source/kernel/bank0/init.mac
Original file line number Diff line number Diff line change
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
33 changes: 32 additions & 1 deletion source/kernel/bank4/env.mac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion source/kernel/data.mac
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ 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
;
Expand Down