The bug can be demonstrated in MEMU. Start MEMU with the following command line:
Then type the following into the MEMU window:
Code: Select all
./memu -vid-win -vid-win-big -rom5 "roms/sdx-type07.rom" -sdx-mfloppy "disks/andy_sys.mfloppy"
The result is a BDOS error: Note that the "andy_sys.mfloppy" disk image was chosen because it already contains a lot of files and hence triggers the bug.
Code: Select all
10 REM TEST USER SAVE "TEST.BAS"
For use with MEMU I wanted a ROM image which did not have the bug, but was otherwise as near identical to the original ROM as possible.
Andy has source code for the SDX ROM on his site at http://www.nyangau.org/sdxrom/sdxrom.htm.
If you build a ROM from this source, with DRVB03 and DRVC03 set, then the result is byte for byte identical to the original Memotech "sdx-type03.rom".
However if you build a ROM with DRVB07 and DRVC07 set, then the result differs from the original Memotech "sdx-type07.rom". I have identified the following differences:
- At 0x2169: The B drive checksum vector address is set to 0xE968 instead of 0xE954.
- At 0x216F: The C drive checksum vector address is set to 0xE9B0 instead of 0xE978.
- At 0x2171: The C drive allocation vector address is set to 0xE988 instead of 0xE964.
- At 0x2398: The type 07 drive extent mask is set to 0x01 instead of 0x00.
- At 0x27CC: The delay counter is set to 0x0320 (=800) instead of 0x1220 (=4640).
- At 0x3858: A byte value of 0x03 instead of 0x12 in the drive format string.
To produce a bug-free ROM (at least of this bug) it is necessary to enable just a type 07 B drive and no C drive. However, if you do this using Andy's source code the result is a large number of bytes different to the original ROM. This is because the code to initialise the C drive is omitted, resulting in the code above moving downwards. This changes the entry points to these routines, potentially breaking any code that calls the ROM.
I have therefore modified Andy's source code to add a DRVC00 configuration option. This disables drive C, but includes dummy initialisation code to preserve the original ROM entry point locations.
The attached zip file contains:
- My modified version of Andy's source.
- Andy's makefile to build the ROM using MEMU, M80 & L80.
- Alternately, "build.sh" to build the ROM using my Z80Asm.
- A built ROM image "sdx-type07a.rom".