+3e

From Sinclair Wiki
Jump to navigation Jump to search

The ZX Spectrum +3e is a replacement ROM for the ZX Spectrum +3 which fixes several bugs, improves the BASIC, and introduces support for hard drives and compact flash cards. It was created by Garry Lancaster, and its homepage is [1].

Extended eXtended Disk Parameter Block

The +3e has an "extended XDPB" based on the +3DOS XDPB. The data is ordered as follows

0x0000  SPT SPT BSH BLM EXM DSM DSM DRM DRM AL0 AL1 CKS CKS OFF OFF PSH
0x0010  PHM fl1 tps spt fsn ssz ssz glr glf fl2 fzf fl3 drl fdu lac lac
0x0020  lac nfo nfd nfd lud lud cka cka aba aba lda lda sra sra swa swa 

key:
SPT: Records Per Track
BSH: Block Shift: 128 * 2^BSH
BLM: Block Mask: 128 * (BLM + 1)
EXM: Extent Mask
DSM: Number of blocks - 1
DRM: Number of directory entries - 1
AL0: AL0 directory bitmap
AL1: AL1 directory bitmap
CKS: Size of checksum vector
OFF: Reserved tracks
PSH: Physical sector shift
PHM: Sector size
fl1: Flags relating to sidedness
tps: Number of tracks per side
spt: Number of sectors per track
fst: First physical sector number
ssz: Sector size
glr: Gap length (read/write)
glf: Gap length (format)
fl2: Flags relating to multitrack/modulation/skip
fzf: Freeze flag
fl3: Flags relating to drives
drl: Drive letter (ascii)
fdu: FD unit number for drive B:
lac: Last access (FRAMES)
nfo: Number of files open on drive
nfd: Number of free director entries
lud: Last used directory entry number
cka: Address of checksum vector
aba: Address of allocation bitmap
lda: Address of routine to login a disk
sra: Address of routine to read a sector
swa: Address of routine to write a sector

When the +3e creates a +3DOS hard disk partition it stores the first 28 bytes of the eXDPB in the type specific data section of the partition table entry. The values for the parameters are set as follows:

SPT: always 0x0200
BSH: dependent upon the size of the partition
BLM: dependent upon the size of the partition
EXM: dependent upon the size of the partition
DRM: always 0x01FF
AL0: dependent upon the size of the partition
AL1: always 0x00
CKS: always 0x8000
OFF: always 0x0000
PSH: always 0x02
PHM: always 0x03
fl1: always 0x00
tps: dependent upon the size of the partition
spt: always 0x80
fst: always 0x00
ssz: always 0x0200
glr: always 0x00
glf: always 0x00
fl2: always 0x00
fzf: always 0x00

The following table shows relationship between disk parameters and partition size:

Partition size Block size BSH BLM EXM AL0
1-4 MB 2 kB 0x04 0x0F 0x00 0xFF
5-8 MB 4 kB 0x05 0x1F 0x01 0xF0
9-16 MB 8 kB 0x06 0x3F 0x03 0xC0

The number of tracks per size (tps) is equal to the partition size in megabytes multiplied by sixteen, e.g. 0x30 for a 3 megabyte partition. The exception to this is the case of a 16 megabyte partition which sets the tps parameter to 0xFF; the maximum value it can store. This means that the filesystem is actually slightly less than 16 megabytes (64kB less to be precise).

BASIC extensions

Mass storage