+3DOS

From Sinclair Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Spectrum +3 Disk Operating System

+3DOS is the disk operating system of the Sinclair ZX Spectrum +2A, +3, +2B, and +3B. It is a CP/M compatible filesystem and is integrated into the +3 BASIC. The DOS routines are located in ROM2 (the +3DOS ROM) and the code for the Sinclair BASIC integration is located in ROM1 (the Syntax ROM). The +3DOS extensions to the BASIC are only present when running the +3 BASIC ROM. There is no provision for using +3DOS from ROM3 (the 48K BASIC ROM). In fact when 48 BASIC is selected from the main menu the ROM paging is locked and it is impossible to access the +3DOS ROM again until the spectrum has been rebooted.

Spectrum +2A/B

Despite the lack of disk interface hardware the Black +2 models contain the same Operating System ROMs as the +3. Therefore the +3DOS routines are all present. The ROMs detect the absence of the disk interface hardware and set the title of the boot menu to "128 +2A" as opposed to "128 +3". The RAMDisk (Drive M:) is available on the Black +2 machines but obviously the floppy drives (A: and B:) are not present. Attempting to access drive A: or B: will generate a "Drive not found" error. The default drive for load/save operations on the +2A/B is the tape (drive T:) however the CAT command (list drive catalogue) defaults to the RAMDisk (M:)

eXtended Disk Parameter Block

Each logical drive in +3DOS has an extended disk parameter block. This is a CP/M disk parameter block (DPB) with additional information to support different formats. When a disk is logged on the XDPB is initialised and set with the relevant settings for the disk format in use.

The Plus 3 manual describes the XDPB layout:

Bytes 0...1	SPT records per track
Byte 2		BSH log2(block size / 128)
Byte 3		BLM block size / 128 - 1
Byte 4		EXM extent mask
Bytes 5...6	DSM last block number
Bytes 7...8	DRM last directory entry number
Byte 9		AL0 directory bit map
Byte 10		AL1 directory bit map
Bytes 11...12	CKS size of checksum vector (bit 15 = permanent)
Bytes 13...14	OFF number of reserved tracks
Byte 15		PSH log2(sector size / 128)
Byte 16		PHM sector size / 128 - 1
Byte 17		Bits 0...1 Sidedness
			0 = Single sided
			1 = Double sided (alternating sides)
			2 = Double sided (successive sides)
		Bits 2...6 Reserved (set to 0)
		Bit 7 Double track
Byte 18		Number of tracks per side
Byte 19		Number of sectors per track
Byte 20		First sector number
Bytes 21...22	Sector size
Byte 23		Gap length (read/write)
Byte 24		Gap length (format)
Byte 25		Bit 7 Multi-track operation
			1 = multi-track
			0 = single track
		Bit 6 Modulation mode
			1 = MFM mode
			0 = FM mode
		Bit 5 Skip deleted data address mark
			1 = skip deleted data address mark
			0 = don't skip deleted address mark
		Bits 0...4 = 0
Byte 26		Freeze flag
			00h (0) = auto-detect disk format
			FFh (255) = don't auto-detect disk format

Byte 25 is normally set to 60h (96). Multi-track operation is not
recommended.

Setting the freeze flag (byte 26) prevents +3DOS from trying to
determine the format of a disk. This should be used when patching an
XDPB for a non-standard format.

It also gives examples of the XDPB for three different formats.

The AMSTRAD PCW range single track format (type 0) (As used by the +3):

36		SPT, records per track
3		BSH, block shift
7		BLM, block mask
0		EXM, extent mask
174		DSM, number of blocks - 1
63		DRM, number of directory entries - 1
C0h (192)	AL0, 2 directory blocks
00h (0)		AL1
16		CKS, size of checksum vector
1		OFF, reserved tracks
2		PSH, physical sector shift
3		PHM, physical sector mask

0		Single sided
40		Tracks per side
9		Sectors per track
1		First sector number
512		Sector size
42		Gap length (read/write)
82		Gap length (format)
60h (96)	MFM mode, skip deleted data address mark
0		Do auto select format

The AMSTRAD CPC range SYSTEM format (type 1)

36		SPT, records per track
3		BSH, block shift
7		BLM, block mask
0		EXM, extent mask
170		DSM, number of blocks - 1
63		DRM, number of directory entries - 1
C0h (192)	AL0, 2 directory blocks
00h (0)		AL1
16		CKS, size of checksum vector
2		OFF, reserved tracks
2		PSH, physical sector shift
3		PHM, physical sector mask

0		Single sided
40		Tracks per side
9		Sectors per track
41h (65)	First sector number
512		Sector size
42		Gap length (read/write)
82		Gap length (format)
60h (96)	MFM mode, skip deleted data address mark
0		Do auto select format

Finally the AMSTRAD CPC range DATA ONLY format (type 2)

36		SPT, records per track
3		BSH, block shift
7		BLM, block mask
0		EXM, extent mask
179		DSM, number of blocks - 1
63		DRM, number of directory entries - 1
C0h (192)	AL0, 2 directory blocks
00h (0)		AL1
16		CKS, size of checksum vector
0		OFF, reserved tracks
2		PSH, physical sector shift
3		PHM, physical sector mask

0		Single sided
40		Tracks per side
9		Sectors per track
C1h (193)	First sector number
512		Sector size
42		Gap length (read/write)
82		Gap length (format)
60h (96)	MFM mode, skip deleted data address mark
0		Do auto select format

The +3e ROMs

Garry Lancaster's +3e ROMs patch the XDPB to support the +3DOS filesystem on IDEDOS hard disk partitions.