SDX Type 07 ROM

About the BASIC system (not including PROGRAMMING)
Post Reply
Bill B
Posts: 259
Joined: 26 Jan 2014 16:31

SDX Type 07 ROM

Post by Bill B »

I suppose that most users with a 3.5 inch SDX are aware of the bug in the SDX ROM, which overlaps the allocation vectors and the directory checksum vectors for the drives. This can cause failures when attempting to save files.

The bug can be demonstrated in MEMU. Start MEMU with the following command line:

Code: Select all

./memu -vid-win -vid-win-big -rom5 "roms/sdx-type07.rom" -sdx-mfloppy "disks/andy_sys.mfloppy"
Then type the following into the MEMU window:

Code: Select all

10 REM TEST
USER SAVE "TEST.BAS"
The result is a BDOS error:
New SDX ROM image, source & build files
New SDX ROM image, source & build files
BDOS_Err.png (7.47 KiB) Viewed 520 times
Note that the "andy_sys.mfloppy" disk image was chosen because it already contains a lot of files and hence triggers the bug.

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.
The first change means that the vectors for drive B no longer overlap. However the next two changes mean that the vectors for drive C overlap the following directory buffer. Assembling Andy's code with these two options set quite rightly results in a warning message for this overlap.

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".
Attachments
sdxrom.zip
(44.62 KiB) Downloaded 35 times
User avatar
1024MAK
Posts: 627
Joined: 24 Dec 2012 03:01
Location: Looking forward to summer, in Somerset, UK

Re: SDX Type 07 ROM

Post by 1024MAK »

👍 8-)

Mark
User avatar
thewiz
Posts: 129
Joined: 12 Aug 2012 16:08

Re: SDX Type 07 ROM

Post by thewiz »

👌👍
THIS is what Memotech is doing now.
Post Reply