Documentation ¶
Overview ¶
Package mdturbo provides the MicroDrive/Turbo partition map format, along with serializer and deserializer functions.
The format is AFAIK undocumented, but the CiderPress source at https://github.com/fadden/ciderpress/blob/master/diskimg/MicroDrive.cpp contains a partial description.
Package mdturbo provides the MicroDrive/Turbo partition map format, along with serializer and deserializer functions.
The format is AFAIK undocumented, but the CiderPress source at https://github.com/fadden/ciderpress/blob/master/diskimg/MicroDrive.cpp contains a partial description.
Package mdturbo provides the MicroDrive/Turbo partition map format, along with serializer and deserializer functions.
The format is AFAIK undocumented, but the CiderPress source at https://github.com/fadden/ciderpress/blob/master/diskimg/MicroDrive.cpp contains a partial description.
Package mdturbo provides the MicroDrive/Turbo partition map format, along with serializer and deserializer functions.
The format is AFAIK undocumented, but the CiderPress source at https://github.com/fadden/ciderpress/blob/master/diskimg/MicroDrive.cpp contains a partial description.
Package mdturbo provides the MicroDrive/Turbo partition map format, along with serializer and deserializer functions.
The format is AFAIK undocumented, but the CiderPress source at https://github.com/fadden/ciderpress/blob/master/diskimg/MicroDrive.cpp contains a partial description.
Index ¶
Constants ¶
const MaxPartitions = 8
MaxPartitions is the maximum number of partitions in an image
const PartChunkSize = 64
PartChunkSize is the number of bytes in either of the two partition blocks inside the table. Each of these chunks represents up to 8 partitions, with all of the start sector numbers (8 x 4 bytes apiece = 32) followed by all of the lengths (32 bits apiece each again), for 64 bytes total.
const PartitionBlkLen = 512
PartitionBlkLen is the number of bytes for a partition block
const SectorSize = 512
SectorSize is the number of bytes per sector
Variables ¶
This section is empty.
Functions ¶
func GoPrint ¶
GoPrint returns strings with a nice Go-style data structure representing the partition table
func PrettyPrint ¶
PrettyPrint formats a nice string representation of an MDTurbo struct. Returns a multi-line string.
This is a very manual structure and would be improved by automation, but getting good output is harder here than with serialize/deserialize.
func Serialize ¶
func Serialize(partmap MDTurbo) ([PartitionBlkLen]uint8, error)
Serialize converts from a disk sector into an MDTurbo struct. Returns a 512-byte array, or an error if one occurs while parsing. It does not insist upon validity of the structure it encodes, so that we can successfully round-trip arbitrary sectors.
Types ¶
type MDTurbo ¶
type MDTurbo struct { Magic uint16 `offset:"0x00"` // Drive type identifier Cylinders uint16 `offset:"0x02"` // # of cylinders Unknown1 [2]uint8 `offset:"0x04"` // Unknown region 1 Heads uint16 `offset:"0x06"` // heads per cyl Sectors uint16 `offset:"0x08"` // sectors per track Unknown2 [2]uint8 `offset:"0x0A"` // Unknown region 2 PartCount1 uint8 `offset:"0x0C"` // # of partitions in first chunk PartCount2 uint8 `offset:"0x0D"` // # of partitions in second chunk Unknown3 [10]uint8 `offset:"0x0E"` // Unknown region 3 RomVersion uint16 `offset:"0x18"` // IIgs Rom version (01 or 03) BootPart uint16 `offset:"0x1A"` // Boot partition. Unknown4 [4]uint8 `offset:"0x1C"` // Unknown region 4 // The partitions are actually represented as Start Sector // numbers followed by lengths - see PartChunkSize comment // above. Partitions1 [MaxPartitions]Partition `offset:"0x20"` Unknown5 [32]uint8 `offset:"0x60"` // Unknown region 5 // Same as Partitions1 but starting at 0x80 and 0xA0 Partitions2 [MaxPartitions]Partition `offset:"0x80"` // Probably padding, per CiderPress Unknown6 [320]uint8 `offset:"0xC0"` }
MDTurbo is the data structure with what we know about a MicroDrive/Turbo partition map. The struct tag serialize is used to encode the offset of a field; length is calculated from the data type.
Because the Partitions data structure doesn't map exactly, we do keep the offset but the prcessing is a very very special case.
func Deserialize ¶
Deserialize converts from a disk sector into an MDTurbo struct. Returns a partition table data structure, or an error if the structure cannot be parsed. It does *NOT* check for overall structure validity; use MDTurbo.Validate() for that.
func (*MDTurbo) AddPartition ¶
AddPartition adds a new partition to a disk image, returns the new Partition number and an error if it can't.
func (MDTurbo) GetPartition ¶
GetPartition returns the Partition data structure and an error
func (MDTurbo) Serialize ¶
func (pt MDTurbo) Serialize() ([PartitionBlkLen]uint8, error)
Serialize is the struct-attached Serialize function, for convenience
type Partition ¶
type Partition struct { Start uint32 // Offset in bytes of partition in sectors // RawLength may not reflect the "actual" partition length, but // we need it for correct round-tripping of arbitrary partition // tables. RawLength uint32 `json:"Length"` // Length of partition in sectors }
Partition is data for a single partition in a partition map