Finds which slot a GR8NET cartridge is
installed in and publishes the primary slot number as the MSX-DOS 2
environment variable GR8SLOT, so batch files can use it.
Nextor's MAPDRV needs the slot the driver lives in:
mapdrv c: 1 1 2-2
That 2-2 is hardcoded to the cartridge sitting in primary slot 2. Move the
cartridge to slot 1 and every MAPDRV line in AUTOEXEC.BAT breaks. GR8FIND
detects the slot at boot so the batch file no longer has to know it.
A:\>gr8find
GR8NET in slot 2-0, GR8SLOT=2
The line printed shows the full slot ID of the adapter (P or P-S), and the
value stored in GR8SLOT, which is always the primary slot digit 0-3.
In AUTOEXEC.BAT:
gr8find
mapdrv c: 1 1 %GR8SLOT%-2
mapdrv d: 3 1 %GR8SLOT%-2
mapdrv e: 4 1 %GR8SLOT%-2
The -2 stays literal on purpose. Nextor sits in subslot 2 of the GR8NET's
expanded slot in mapper modes 8-14, but in other mapper modes the manual puts
it elsewhere, so GR8FIND reports where the adapter is and leaves the
subslot for the specific service to you.
When no cartridge is found:
A:\>gr8find
GR8NET not found
GR8SLOT is then deleted from the environment rather than left at a stale
value, so a following MAPDRV fails loudly instead of mapping the wrong slot.
- MSX-DOS 2 or Nextor.
GR8SLOTis set through BDOS_SENV(6Ch), which does not exist in MSX-DOS 1. Only MSX-DOS 2 has been tested. - COMMAND2.COM 2.40 or newer to read the variable back. This is the part
that catches people out: COMMAND2.COM 2.31 does not expand
%VAR%, it just strips the percent signs, so%GR8SLOT%-2silently becomesGR8SLOT-2. Check withver. Version 2.44 is known to work.
Setting the variable works on any MSX-DOS 2; only the reading side needs the newer command interpreter.
Two methods, in order.
-
I/O identification ports. Adapters 0-3 are enumerated through ports
5Eh(adapter and register select) and5Fh(register data). Register 0 answers'G'when the adapter is active; register 1 then holds its slot ID inRDSLTformat, with00handFFhmeaning "not initialised". This is the method documented in chapter 12.1 of the GR8NET manual and works regardless of the active mapper mode. -
ROM signature scan. Fallback if the ports do not answer. Walks primary slots 0-3, and subslots 0-3 for slots flagged as expanded in
EXPTBL(FCC1h), looking for the string"GR8NET"at5FB8h(GR8RSG, chapter 12.2 of the manual). Reads go through the BIOSRDSLTroutine at000Ch, which stays available in MSX-DOS page 0 and handles expanded slots without the page-3 /FFFFhhazards of hand-rolled slot switching.
The original port 5Eh value is restored after enumeration, and the
default-adapter bits (5-4) are preserved as the manual requires.
build.sh assembles src into dist
src/gr8find.asm the program
tools/glass-0.6.jar Glass Z80 assembler
dist/GR8FIND.COM build output, copy this to the MSX
Needs Java, for the bundled Glass Z80 assembler:
./build.shProduces a 423 byte dist/GR8FIND.COM. Copy that to the MSX; nothing else
from this repository is needed at runtime.
Verified on real hardware: a Panasonic FS-A1ST with a GR8NET cartridge.
Verified under openMSX on a Panasonic FS-A1GT with MSX-DOS kernel 2.31:
| Case | Result |
|---|---|
| No cartridge present | GR8NET not found, GR8SLOT removed from set |
| Signature ROM in slot 1, not expanded | GR8NET in slot 1, GR8SLOT=1 |
| Signature in slot 3-0, expanded slot | GR8NET in slot 3-0, GR8SLOT=3 |
%GR8SLOT%-2 in a batch file, COMMAND2.COM 2.44 |
expands to 1-2 |
| Same, COMMAND2.COM 2.31 | prints GR8SLOT-2, not expanded |
openMSX does not emulate the adapter, so the emulator cases exercise the signature scan only; they confirm the I/O port path produces no false positives on a machine without a GR8NET. Both paths are live on the FS-A1ST, and the printed line is the same either way, so it does not say which of the two found the cartridge.
- GR8NET manual - chapter 12 covers the programming API, identification ports and GR8RSG
- MSX-DOS 2 Function Specification -
_SENV(6Ch):HL= ASCIIZ name,DE= ASCIIZ value - SET (MSX-DOS 2) - environment variable behaviour
- Nextor 2.0 User Manual -
MAPDRVsyntax