disk

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DISK_2MG_NIB_LENGTH = DISK_NIBBLE_LENGTH + 0x040
View Source
const DISK_2MG_NON_NIB_LENGTH = DISK_PLAIN_LENGTH + 0x040
View Source
const DISK_NIBBLE_LENGTH = TRACK_NIBBLE_LENGTH * TRACK_COUNT
View Source
const DISK_PLAIN_LENGTH = STD_DISK_BYTES
View Source
const HALF_TRACK_COUNT = TRACK_COUNT * 2
View Source
const PASCAL_BLOCK_SIZE = 512
View Source
const PASCAL_DIRECTORY_ENTRY_LENGTH = 26
View Source
const PASCAL_MAX_VOLUME_NAME = 7
View Source
const PASCAL_OVERSIZE_DIR = 32
View Source
const PASCAL_VOLUME_BLOCK = 2
View Source
const PREAMBLE_2MG_SIZE = 0x40
View Source
const PRODOS_400KB_BLOCKS = 800
View Source
const PRODOS_400KB_DISK_BYTES = STD_BYTES_PER_SECTOR * 2 * PRODOS_400KB_BLOCKS
View Source
const PRODOS_800KB_BLOCKS = 1600
View Source
const PRODOS_800KB_BLOCKS_PER_TRACK = 20
View Source
const PRODOS_800KB_DISK_BYTES = STD_BYTES_PER_SECTOR * 2 * PRODOS_800KB_BLOCKS
View Source
const PRODOS_BLOCKS_PER_DISK = 280
View Source
const PRODOS_BLOCKS_PER_TRACK = 8
View Source
const PRODOS_ENTRY_SIZE = 39
View Source
const PRODOS_SECTORS_PER_BLOCK = 2
View Source
const RDOS_CATALOG_LENGTH = 0xB
View Source
const RDOS_CATALOG_TRACK = 0x01
View Source
const RDOS_ENTRY_LENGTH = 0x20
View Source
const RDOS_NAME_LENGTH = 0x18
View Source
const SECTOR_COUNT = STD_SECTORS_PER_TRACK
View Source
const STD_BYTES_PER_SECTOR = 256
View Source
const STD_SECTORS_PER_TRACK = 16
View Source
const STD_SECTORS_PER_TRACK_OLD = 13
View Source
const STD_TRACKS_PER_DISK = 35
View Source
const TRACK_COUNT = STD_TRACKS_PER_DISK
View Source
const TRACK_NIBBLE_LENGTH = 0x1A00

Variables

View Source
var ASPartials = map[string]bool{
	"COLOR":  true,
	"HCOLOR": true,
	"SPEED":  true,
	"SCALE":  true,
	"-":      true,
}
View Source
var AppleDOSTypeMap = map[FileType][2]string{
	0x00: [2]string{"TXT", "ASCII Text"},
	0x01: [2]string{"INT", "Integer Basic Program"},
	0x02: [2]string{"BAS", "Applesoft Basic Program"},
	0x04: [2]string{"BIN", "Binary File"},
	0x08: [2]string{"S", "S File Type"},
	0x10: [2]string{"REL", "Relocatable Object Code"},
	0x20: [2]string{"A", "A File Type"},
	0x40: [2]string{"B", "B File Type"},
}
View Source
var ApplesoftReverse map[string]int
View Source
var ApplesoftTokens = map[int]string{}/* 107 elements not displayed */
View Source
var DIVERSE_SECTOR_ORDER = []int{
	0x00, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
	0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x0f,
}
View Source
var DOS_32_SECTOR_ORDER = []int{
	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
	0x08, 0x09, 0x0A, 0x0B, 0x0C,
}
View Source
var DOS_33_SECTOR_ORDER = []int{
	0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
	0x0B, 0x03, 0x0A, 0x02, 0x09, 0x01, 0x08, 0x0F,
}
View Source
var IntegerReverse map[string]int
View Source
var IntegerTokens = map[int]string{}/* 127 elements not displayed */
View Source
var LINEAR_SECTOR_ORDER = []int{
	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
}
View Source
var MAGIC_2MG = []byte{byte('2'), byte('I'), byte('M'), byte('G')}
View Source
var NIBBLE_53 = []byte{
	0xab, 0xad, 0xae, 0xaf, 0xb5, 0xb6, 0xb7, 0xba,
	0xbb, 0xbd, 0xbe, 0xbf, 0xd6, 0xd7, 0xda, 0xdb,
	0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xed, 0xee, 0xef,
	0xf5, 0xf6, 0xf7, 0xfa, 0xfb, 0xfd, 0xfe, 0xff,
}
View Source
var NIBBLE_62 = []byte{
	0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,
	0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,
	0xb4, 0xb5, 0xb6, 0xb7, 0xb9, 0xba, 0xbb, 0xbc,
	0xbd, 0xbe, 0xbf, 0xcb, 0xcd, 0xce, 0xcf, 0xd3,
	0xd6, 0xd7, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
	0xdf, 0xe5, 0xe6, 0xe7, 0xe9, 0xea, 0xeb, 0xec,
	0xed, 0xee, 0xef, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
	0xf7, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff}
View Source
var PRODOS_SECTOR_ORDER = []int{
	0x00, 0x08, 0x01, 0x09, 0x02, 0x0a, 0x03, 0x0b,
	0x04, 0x0c, 0x05, 0x0d, 0x06, 0x0e, 0x07, 0x0f,
}
View Source
var PascalTypeMap = map[PascalFileType][2]string{
	0x00: [2]string{"UNK", "ASCII Text"},
	0x01: [2]string{"BAD", "Bad Block"},
	0x02: [2]string{"PCD", "Pascal Code"},
	0x03: [2]string{"PTX", "Pascal Text"},
	0x04: [2]string{"PIF", "Pascal Info"},
	0x05: [2]string{"PDA", "Pascal Data"},
	0x06: [2]string{"GRF", "Pascal Graphics"},
	0x07: [2]string{"FOT", "HiRes Graphics"},
	0x08: [2]string{"SEC", "Secure Directory"},
}
View Source
var ProDOSTypeMap = map[ProDOSFileType][2]string{}/* 122 elements not displayed */
View Source
var RDOSTypeMap = map[RDOSFileType][2]string{
	FileType_RDOS_Unknown:   [2]string{"UNK", "Unknown"},
	FileType_RDOS_AppleSoft: [2]string{"BAS", "Applesoft Basic Program"},
	FileType_RDOS_Binary:    [2]string{"BIN", "Binary File"},
	FileType_RDOS_Text:      [2]string{"TXT", "ASCII Text"},
}
View Source
var RDOS_SIGNATURE = []byte{
	byte('R' + 0x80),
	byte('D' + 0x80),
	byte('O' + 0x80),
	byte('S' + 0x80),
	byte(' ' + 0x80),
}
View Source
var RDOS_SIGNATURE_32 = []byte{
	byte('R' + 0x80),
	byte('D' + 0x80),
	byte('O' + 0x80),
	byte('S' + 0x80),
	byte(' ' + 0x80),
	byte('2' + 0x80),
}
View Source
var RDOS_SIGNATURE_33 = []byte{
	byte('R' + 0x80),
	byte('D' + 0x80),
	byte('O' + 0x80),
	byte('S' + 0x80),
	byte(' ' + 0x80),
	byte('3' + 0x80),
}

Functions

func ApplesoftDetoks

func ApplesoftDetoks(data []byte) []byte

func ApplesoftTokenize

func ApplesoftTokenize(lines []string) []byte

func AsciiToPoke

func AsciiToPoke(b byte) byte

func Between

func Between(v, lo, hi uint) bool

func Checksum

func Checksum(b []byte) string

func Dump

func Dump(bytes []byte)

func IntegerDetoks

func IntegerDetoks(data []byte) []byte

func IntegerTokenize

func IntegerTokenize(lines []string) []byte

func PokeToAscii

func PokeToAscii(v uint, usealt bool) int

func Read16

func Read16(srcptr, length *int, buffer []byte) int

func Read8

func Read8(srcptr, length *int, buffer []byte) byte

func SectorMapperDOS33

func SectorMapperDOS33(wanted int) int

SectoreMapperDOS33 handles the interleaving for dos sectors

func SectorMapperDOS33Alt

func SectorMapperDOS33Alt(wanted int) int

func SectorMapperDOS33bad

func SectorMapperDOS33bad(wanted int) int

func SectorMapperDiversiDOS added in v0.6.0

func SectorMapperDiversiDOS(wanted int) int

SectoreMapperProDOS handles the interleaving for dos sectors

func SectorMapperLinear added in v0.6.0

func SectorMapperLinear(wanted int) int

SectoreMapperDOS33 handles the interleaving for dos sectors

func SectorMapperProDOS

func SectorMapperProDOS(wanted int) int

SectoreMapperProDOS handles the interleaving for dos sectors

func StripText

func StripText(b []byte) []byte

Types

type CatalogEntry

type CatalogEntry interface {
	Size() int // file size in bytes
	Name() string
	NameUnadorned() string
	Date() time.Time
	Type() CatalogEntryType
}

type CatalogEntryType

type CatalogEntryType int
const (
	CETUnknown CatalogEntryType = iota
	CETBinary
	CETBasicApplesoft
	CETBasicInteger
	CETPascal
	CETText
	CETData
	CETGraphics
)

type DSKContainer

type DSKContainer []byte

type DSKWrapper

type DSKWrapper struct {
	Data          DSKContainer
	Layout        SectorOrder
	CurrentTrack  int
	CurrentSector int
	SectorPointer int
	Format        DiskFormat
	RDOSFormat    RDOSFormat
	Filename      string
	//Nibbles       []byte
	Nibbles            Nibbler
	CurrentSectorOrder []int
	CatalogSectorOrder []int // usually nil but for badly behaved OS: looking at YOU, DiversiDOS... :(
	WriteProtected     bool
	NibblesChanged     bool
	DOSVolumeID        int
}

func NewDSKWrapper

func NewDSKWrapper(nibbler Nibbler, filename string) (*DSKWrapper, error)

func NewDSKWrapperBin

func NewDSKWrapperBin(nibbler Nibbler, data []byte, filename string) (*DSKWrapper, error)

func (*DSKWrapper) AppleDOSDeleteFile

func (dsk *DSKWrapper) AppleDOSDeleteFile(name string) error

func (*DSKWrapper) AppleDOSGetCatalog

func (d *DSKWrapper) AppleDOSGetCatalog(pattern string) (*VTOC, []FileDescriptor, error)

func (*DSKWrapper) AppleDOSGetFileSectors

func (d *DSKWrapper) AppleDOSGetFileSectors(fd FileDescriptor, maxblocks int) ([][2]int, error)

func (*DSKWrapper) AppleDOSGetFreeSectors

func (dsk *DSKWrapper) AppleDOSGetFreeSectors(size int) ([][2]int, [][2]int, error)

AppleDOSGetFreeSectors tries to find free sectors for certain size file... Remember, we need space for the T/S list as well...

func (*DSKWrapper) AppleDOSGetTSListSectors

func (d *DSKWrapper) AppleDOSGetTSListSectors(fd FileDescriptor, maxblocks int) ([][2]int, error)

func (*DSKWrapper) AppleDOSGetVTOC

func (d *DSKWrapper) AppleDOSGetVTOC() (*VTOC, error)

func (*DSKWrapper) AppleDOSNamedCatalogEntry

func (d *DSKWrapper) AppleDOSNamedCatalogEntry(name string) (*FileDescriptor, error)

func (*DSKWrapper) AppleDOSNextFreeCatalogEntry

func (d *DSKWrapper) AppleDOSNextFreeCatalogEntry(name string) (*FileDescriptor, error)

func (*DSKWrapper) AppleDOSReadFile

func (d *DSKWrapper) AppleDOSReadFile(fd FileDescriptor) (int, int, []byte, error)

func (*DSKWrapper) AppleDOSReadFileRaw

func (d *DSKWrapper) AppleDOSReadFileRaw(fd FileDescriptor) (int, int, []byte, error)

func (*DSKWrapper) AppleDOSReadFileSectors

func (d *DSKWrapper) AppleDOSReadFileSectors(fd FileDescriptor, maxblocks int) ([]byte, error)

func (*DSKWrapper) AppleDOSRemoveFile

func (d *DSKWrapper) AppleDOSRemoveFile(fd *FileDescriptor) error

func (*DSKWrapper) AppleDOSRenameFile

func (dsk *DSKWrapper) AppleDOSRenameFile(name, newname string) error

func (*DSKWrapper) AppleDOSSetLocked

func (dsk *DSKWrapper) AppleDOSSetLocked(name string, lock bool) error

func (*DSKWrapper) AppleDOSUsedBitmap

func (dsk *DSKWrapper) AppleDOSUsedBitmap() ([]bool, error)

func (*DSKWrapper) AppleDOSWriteFile

func (dsk *DSKWrapper) AppleDOSWriteFile(name string, kind FileType, data []byte, loadAddr int) error

func (*DSKWrapper) ChecksumDisk

func (d *DSKWrapper) ChecksumDisk() string

func (*DSKWrapper) ChecksumSector

func (d *DSKWrapper) ChecksumSector(t, s int) string

func (*DSKWrapper) GetNibbles

func (dsk *DSKWrapper) GetNibbles() []byte

func (*DSKWrapper) HuntVTOC

func (d *DSKWrapper) HuntVTOC(t, s int) (int, int)

func (*DSKWrapper) Identify

func (dsk *DSKWrapper) Identify()

func (*DSKWrapper) Is2MG

func (dsk *DSKWrapper) Is2MG() (bool, DiskFormat, SectorOrder, *DSKWrapper)

func (*DSKWrapper) IsAppleDOS

func (dsk *DSKWrapper) IsAppleDOS() (bool, DiskFormat, SectorOrder)

func (*DSKWrapper) IsChanged

func (d *DSKWrapper) IsChanged() bool

func (*DSKWrapper) IsPascal

func (dsk *DSKWrapper) IsPascal() (bool, string)

func (*DSKWrapper) IsProDOS

func (dsk *DSKWrapper) IsProDOS() (bool, DiskFormat, SectorOrder)

func (*DSKWrapper) IsRDOS

func (dsk *DSKWrapper) IsRDOS() (bool, RDOSFormat)

func (*DSKWrapper) NibbleOffsetToTS

func (d *DSKWrapper) NibbleOffsetToTS(offset int) (int, int)

func (*DSKWrapper) Nibblize

func (d *DSKWrapper) Nibblize() []byte

func (*DSKWrapper) PRODOS800ChecksumBlock

func (d *DSKWrapper) PRODOS800ChecksumBlock(b int) string

func (*DSKWrapper) PRODOS800GetBlock

func (d *DSKWrapper) PRODOS800GetBlock(block int) ([]byte, error)

func (*DSKWrapper) PRODOS800GetBlockSectors

func (d *DSKWrapper) PRODOS800GetBlockSectors(block int) (int, int, int)

func (*DSKWrapper) PRODOS800GetVDH

func (d *DSKWrapper) PRODOS800GetVDH(b int) (*VDH, error)

func (*DSKWrapper) PRODOS800GetVolumeBitmap

func (dsk *DSKWrapper) PRODOS800GetVolumeBitmap() (ProDOSVolumeBitmap, error)

func (*DSKWrapper) PRODOSChecksumBlock

func (d *DSKWrapper) PRODOSChecksumBlock(b int) string

func (*DSKWrapper) PRODOSCreateDirectory

func (dsk *DSKWrapper) PRODOSCreateDirectory(path string, name string) error

PRODOSCreateDirectory tries to create a subdirectory...

func (*DSKWrapper) PRODOSDeleteDirectory

func (dsk *DSKWrapper) PRODOSDeleteDirectory(path string, name string) error

func (*DSKWrapper) PRODOSDeleteFile

func (dsk *DSKWrapper) PRODOSDeleteFile(path string, name string) error

func (*DSKWrapper) PRODOSFindDirBlocks

func (dsk *DSKWrapper) PRODOSFindDirBlocks(start int, path string) (*VDH, []int, [][]byte, error)

PRODOSFindDirBlocks locates the blocks for a given directory (if it exists!)

func (*DSKWrapper) PRODOSGetBlock

func (d *DSKWrapper) PRODOSGetBlock(block int) ([]byte, error)

func (*DSKWrapper) PRODOSGetBlockSectors

func (d *DSKWrapper) PRODOSGetBlockSectors(block int) (int, int, int)

func (*DSKWrapper) PRODOSGetCatalog

func (d *DSKWrapper) PRODOSGetCatalog(startblock int, pattern string) (*VDH, []ProDOSFileDescriptor, error)

func (*DSKWrapper) PRODOSGetCatalogPathed

func (d *DSKWrapper) PRODOSGetCatalogPathed(start int, path string, pattern string) (*VDH, []ProDOSFileDescriptor, error)

func (*DSKWrapper) PRODOSGetDirBlocks

func (dsk *DSKWrapper) PRODOSGetDirBlocks(start int) (*VDH, []int, [][]byte, error)

PRODOSGetDirBlocks returns a list of blocks for the current directory level

func (*DSKWrapper) PRODOSGetFirstFreeEntry

func (dsk *DSKWrapper) PRODOSGetFirstFreeEntry(path string, name string, grow bool) (*ProDOSFileDescriptor, error)

PRODOSGetFirstFreeEntry for a given path, will find the first free file descriptor it will expand the directory if needed to create a free block

func (*DSKWrapper) PRODOSGetFreeBlocks

func (dsk *DSKWrapper) PRODOSGetFreeBlocks(count int, totalBlocks int) ([]int, error)

func (*DSKWrapper) PRODOSGetNamedEntry

func (dsk *DSKWrapper) PRODOSGetNamedEntry(path string, name string) (*ProDOSFileDescriptor, error)

PRODOSGetNamedEntry for a given path, will find the file descriptor with name

func (*DSKWrapper) PRODOSGetVDH

func (d *DSKWrapper) PRODOSGetVDH(b int) (*VDH, error)

func (*DSKWrapper) PRODOSGetVolumeBitmap

func (dsk *DSKWrapper) PRODOSGetVolumeBitmap() (ProDOSVolumeBitmap, error)

func (*DSKWrapper) PRODOSInitDirectoryBlock

func (dsk *DSKWrapper) PRODOSInitDirectoryBlock(targetBlock int, parentBlock int, entriesPerBlock int, entrySize int, entryNum int, name string) error

func (*DSKWrapper) PRODOSMarkBlocks

func (dsk *DSKWrapper) PRODOSMarkBlocks(list []int, free bool) error

func (*DSKWrapper) PRODOSReadFile

func (d *DSKWrapper) PRODOSReadFile(fd ProDOSFileDescriptor) (int, int, []byte, error)

func (*DSKWrapper) PRODOSReadFileRaw

func (d *DSKWrapper) PRODOSReadFileRaw(fd ProDOSFileDescriptor) (int, int, []byte, error)

func (*DSKWrapper) PRODOSReadFileSectors

func (d *DSKWrapper) PRODOSReadFileSectors(fd ProDOSFileDescriptor, maxblocks int) ([]byte, error)

func (*DSKWrapper) PRODOSRenameFile

func (dsk *DSKWrapper) PRODOSRenameFile(path, name, newname string) error

func (*DSKWrapper) PRODOSSetLocked

func (dsk *DSKWrapper) PRODOSSetLocked(path, name string, lock bool) error

func (*DSKWrapper) PRODOSSetVDH added in v0.5.5

func (d *DSKWrapper) PRODOSSetVDH(b int, vdh *VDH) error

func (*DSKWrapper) PRODOSWrite

func (dsk *DSKWrapper) PRODOSWrite(b int, data []byte) error

func (*DSKWrapper) PRODOSWriteFile

func (dsk *DSKWrapper) PRODOSWriteFile(path string, name string, kind ProDOSFileType, data []byte, auxtype int) error

func (*DSKWrapper) PRODOSWriteSaplingBlocks

func (dsk *DSKWrapper) PRODOSWriteSaplingBlocks(indexBlock int, dataBlocks []int, data []byte) error

func (*DSKWrapper) PascalGetCatalog

func (dsk *DSKWrapper) PascalGetCatalog(pattern string) ([]*PascalFileEntry, error)

func (*DSKWrapper) PascalReadFile

func (dsk *DSKWrapper) PascalReadFile(file *PascalFileEntry) ([]byte, error)

func (*DSKWrapper) PascalUsedBitmap

func (dsk *DSKWrapper) PascalUsedBitmap() ([]bool, error)

func (*DSKWrapper) RDOSGetCatalog

func (dsk *DSKWrapper) RDOSGetCatalog(pattern string) ([]*RDOSFileDescriptor, error)

func (*DSKWrapper) RDOSReadFile

func (dsk *DSKWrapper) RDOSReadFile(file *RDOSFileDescriptor) ([]byte, error)

func (*DSKWrapper) RDOSUsedBitmap

func (dsk *DSKWrapper) RDOSUsedBitmap() ([]bool, error)

func (*DSKWrapper) Read

func (d *DSKWrapper) Read() []byte

Read is a simple function to return the current pointed to sector

func (*DSKWrapper) Seek

func (d *DSKWrapper) Seek(t, s int) error

Seek is a convienience function to go straight to a particular track & sector

func (*DSKWrapper) SetData

func (d *DSKWrapper) SetData(data []byte)

func (*DSKWrapper) SetNibbles

func (dsk *DSKWrapper) SetNibbles(data []byte)

func (*DSKWrapper) SetSector

func (d *DSKWrapper) SetSector(s int) error

SetSector changes the sector we are looking at

func (*DSKWrapper) SetSectorPointer

func (d *DSKWrapper) SetSectorPointer()

SetSectorPointer calculates the pointer to the current sector, taking into account the sector interleaving of the DSK image.

func (*DSKWrapper) SetTrack

func (d *DSKWrapper) SetTrack(t int) error

func (*DSKWrapper) UpdateTrack

func (d *DSKWrapper) UpdateTrack(track int)

func (*DSKWrapper) Write

func (d *DSKWrapper) Write(data []byte)

type DiskFormat

type DiskFormat struct {
	ID DiskFormatID
	// contains filtered or unexported fields
}

func GetDiskFormat

func GetDiskFormat(id DiskFormatID) DiskFormat

func GetPDDiskFormat

func GetPDDiskFormat(id DiskFormatID, blocks int) DiskFormat

func (DiskFormat) BPD

func (df DiskFormat) BPD() int

func (DiskFormat) IsOneOf added in v0.6.0

func (df DiskFormat) IsOneOf(args ...DiskFormatID) bool

func (DiskFormat) SPT

func (df DiskFormat) SPT() int

func (DiskFormat) String

func (f DiskFormat) String() string

func (DiskFormat) TPD

func (df DiskFormat) TPD() int

func (DiskFormat) USPT

func (df DiskFormat) USPT() int

type DiskFormatID

type DiskFormatID int
const (
	DF_NONE DiskFormatID = iota
	DF_DOS_SECTORS_13
	DF_DOS_SECTORS_16
	DF_PRODOS
	DF_PRODOS_800KB
	DF_PASCAL
	DF_RDOS_3
	DF_RDOS_32
	DF_RDOS_33
	DF_PRODOS_400KB
	DF_PRODOS_CUSTOM
)

type DiskImage

type DiskImage interface {
	IsValid() (bool, DiskFormat, SectorOrder)
	GetCatalog(path string, pattern string) ([]CatalogEntry, error)
	ReadFile(fd CatalogEntry) (int, []byte, error)
	StoreFile(fd CatalogEntry) error
	GetUsedBitmap() ([]bool, error)
	Nibblize() ([]byte, error)
}

type FileDescriptor

type FileDescriptor struct {
	Data []byte
	// contains filtered or unexported fields
}

func (*FileDescriptor) GetTrackSectorListStart

func (fd *FileDescriptor) GetTrackSectorListStart() (int, int)

func (*FileDescriptor) IsLocked

func (fd *FileDescriptor) IsLocked() bool

func (*FileDescriptor) IsUnused

func (fd *FileDescriptor) IsUnused() bool

func (*FileDescriptor) Name

func (fd *FileDescriptor) Name() string

func (*FileDescriptor) NameBytes

func (fd *FileDescriptor) NameBytes() []byte

func (*FileDescriptor) NameOK

func (fd *FileDescriptor) NameOK() bool

func (*FileDescriptor) NameUnadorned

func (fd *FileDescriptor) NameUnadorned() string

func (*FileDescriptor) Publish

func (fd *FileDescriptor) Publish(dsk *DSKWrapper) error

func (*FileDescriptor) SetData

func (fd *FileDescriptor) SetData(data []byte, t, s, o int)

func (*FileDescriptor) SetLocked

func (fd *FileDescriptor) SetLocked(b bool)

func (*FileDescriptor) SetName

func (fd *FileDescriptor) SetName(s string)

func (*FileDescriptor) SetTotalSectors

func (fd *FileDescriptor) SetTotalSectors(v int)

func (*FileDescriptor) SetTrackSectorListStart

func (fd *FileDescriptor) SetTrackSectorListStart(t, s int)

func (*FileDescriptor) SetType

func (fd *FileDescriptor) SetType(t FileType)

func (*FileDescriptor) TotalSectors

func (fd *FileDescriptor) TotalSectors() int

func (*FileDescriptor) Type

func (fd *FileDescriptor) Type() FileType

type FileType

type FileType byte
const (
	FileTypeTXT FileType = 0x00
	FileTypeINT FileType = 0x01
	FileTypeAPP FileType = 0x02
	FileTypeBIN FileType = 0x04
	FileTypeS   FileType = 0x08
	FileTypeREL FileType = 0x10
	FileTypeA   FileType = 0x20
	FileTypeB   FileType = 0x40
)

func AppleDOSFileTypeFromExt

func AppleDOSFileTypeFromExt(ext string) FileType

func (FileType) Ext

func (ft FileType) Ext() string

func (FileType) String

func (ft FileType) String() string

type Header2MG

type Header2MG struct {
	Data [64]byte
}

func (*Header2MG) GetCreatorID

func (h *Header2MG) GetCreatorID() string

func (*Header2MG) GetDOSFlags

func (h *Header2MG) GetDOSFlags() int

func (*Header2MG) GetDiskDataLength

func (h *Header2MG) GetDiskDataLength() int

func (*Header2MG) GetDiskDataStart

func (h *Header2MG) GetDiskDataStart() int

func (*Header2MG) GetHeaderSize

func (h *Header2MG) GetHeaderSize() int

func (*Header2MG) GetID

func (h *Header2MG) GetID() string

func (*Header2MG) GetImageFormat

func (h *Header2MG) GetImageFormat() int

func (*Header2MG) GetProDOSBlocks

func (h *Header2MG) GetProDOSBlocks() int

func (*Header2MG) GetVersion

func (h *Header2MG) GetVersion() int

func (*Header2MG) SetData

func (h *Header2MG) SetData(data []byte)

type Nibbler

type Nibbler interface {
	SetNibble(offset int, value byte)
	GetNibble(offset int) byte
}

type PascalFileEntry

type PascalFileEntry struct {
	// contains filtered or unexported fields
}

func (*PascalFileEntry) GetBytesRemaining

func (pvh *PascalFileEntry) GetBytesRemaining() int

func (*PascalFileEntry) GetFileSize

func (pvh *PascalFileEntry) GetFileSize() int

func (*PascalFileEntry) GetName

func (pvh *PascalFileEntry) GetName() string

func (*PascalFileEntry) GetNameLength

func (pvh *PascalFileEntry) GetNameLength() int

func (*PascalFileEntry) GetNextBlock

func (pvh *PascalFileEntry) GetNextBlock() int

func (*PascalFileEntry) GetStartBlock

func (pvh *PascalFileEntry) GetStartBlock() int

func (*PascalFileEntry) GetType

func (pvh *PascalFileEntry) GetType() PascalFileType

func (*PascalFileEntry) IsLocked

func (pvh *PascalFileEntry) IsLocked() bool

func (*PascalFileEntry) SetData

func (pfe *PascalFileEntry) SetData(data []byte)

type PascalFileType

type PascalFileType int
const (
	FileType_PAS_NONE PascalFileType = 0
	FileType_PAS_BADD PascalFileType = 1
	FileType_PAS_CODE PascalFileType = 2
	FileType_PAS_TEXT PascalFileType = 3
	FileType_PAS_INFO PascalFileType = 4
	FileType_PAS_DATA PascalFileType = 5
	FileType_PAS_GRAF PascalFileType = 6
	FileType_PAS_FOTO PascalFileType = 7
	FileType_PAS_SECD PascalFileType = 8
)

func PascalFileTypeFromExt

func PascalFileTypeFromExt(ext string) PascalFileType

func (PascalFileType) Ext

func (ft PascalFileType) Ext() string

func (PascalFileType) String

func (ft PascalFileType) String() string

type PascalVolumeHeader

type PascalVolumeHeader struct {
	// contains filtered or unexported fields
}

func (*PascalVolumeHeader) GetName

func (pvh *PascalVolumeHeader) GetName() string

func (*PascalVolumeHeader) GetNameLength

func (pvh *PascalVolumeHeader) GetNameLength() int

func (*PascalVolumeHeader) GetNextBlock

func (pvh *PascalVolumeHeader) GetNextBlock() int

func (*PascalVolumeHeader) GetNumFiles

func (pvh *PascalVolumeHeader) GetNumFiles() int

func (*PascalVolumeHeader) GetStartBlock

func (pvh *PascalVolumeHeader) GetStartBlock() int

func (*PascalVolumeHeader) GetTotalBlocks

func (pvh *PascalVolumeHeader) GetTotalBlocks() int

func (*PascalVolumeHeader) GetType

func (pvh *PascalVolumeHeader) GetType() int

func (*PascalVolumeHeader) SetData

func (pvh *PascalVolumeHeader) SetData(data []byte)

type ProDOSAccessMode

type ProDOSAccessMode byte
const (
	AccessType_Destroy  ProDOSAccessMode = 0x80
	AccessType_Rename   ProDOSAccessMode = 0x40
	AccessType_Changed  ProDOSAccessMode = 0x20
	AccessType_Writable ProDOSAccessMode = 0x02
	AccessType_Readable ProDOSAccessMode = 0x01
	//
	AccessType_Default ProDOSAccessMode = AccessType_Readable | AccessType_Writable | AccessType_Rename | AccessType_Destroy
)

type ProDOSFileDescriptor

type ProDOSFileDescriptor struct {
	Data []byte
	// contains filtered or unexported fields
}

-- Prodos file descriptor

func (*ProDOSFileDescriptor) AccessMode

func (fd *ProDOSFileDescriptor) AccessMode() ProDOSAccessMode

func (*ProDOSFileDescriptor) AuxType

func (fd *ProDOSFileDescriptor) AuxType() int

func (*ProDOSFileDescriptor) CreateTime

func (fd *ProDOSFileDescriptor) CreateTime() time.Time

func (*ProDOSFileDescriptor) GetMinVersion

func (fd *ProDOSFileDescriptor) GetMinVersion() int

func (*ProDOSFileDescriptor) GetNameLength

func (fd *ProDOSFileDescriptor) GetNameLength() int

func (*ProDOSFileDescriptor) GetStorageType

func (fd *ProDOSFileDescriptor) GetStorageType() ProDOSStorageType

func (*ProDOSFileDescriptor) GetVersion

func (fd *ProDOSFileDescriptor) GetVersion() int

func (*ProDOSFileDescriptor) HeaderPointer

func (fd *ProDOSFileDescriptor) HeaderPointer() int

func (*ProDOSFileDescriptor) IndexBlock

func (fd *ProDOSFileDescriptor) IndexBlock() int

func (*ProDOSFileDescriptor) IsLocked

func (fd *ProDOSFileDescriptor) IsLocked() bool

func (*ProDOSFileDescriptor) ModTime

func (fd *ProDOSFileDescriptor) ModTime() time.Time

func (*ProDOSFileDescriptor) Name

func (fd *ProDOSFileDescriptor) Name() string

func (*ProDOSFileDescriptor) NameUnadorned

func (fd *ProDOSFileDescriptor) NameUnadorned() string

func (*ProDOSFileDescriptor) Publish

func (fd *ProDOSFileDescriptor) Publish(dsk *DSKWrapper) error

func (*ProDOSFileDescriptor) SetAccessMode

func (fd *ProDOSFileDescriptor) SetAccessMode(t ProDOSAccessMode)

func (*ProDOSFileDescriptor) SetAuxType

func (fd *ProDOSFileDescriptor) SetAuxType(b int)

func (*ProDOSFileDescriptor) SetCreateTime

func (fd *ProDOSFileDescriptor) SetCreateTime(t time.Time)

func (*ProDOSFileDescriptor) SetData

func (fd *ProDOSFileDescriptor) SetData(data []byte, blockid int, blockoffset int)

func (*ProDOSFileDescriptor) SetHeaderPointer

func (fd *ProDOSFileDescriptor) SetHeaderPointer(v int)

func (*ProDOSFileDescriptor) SetIndexBlock

func (fd *ProDOSFileDescriptor) SetIndexBlock(b int)

func (*ProDOSFileDescriptor) SetLocked

func (fd *ProDOSFileDescriptor) SetLocked(b bool)

func (*ProDOSFileDescriptor) SetMinVersion

func (fd *ProDOSFileDescriptor) SetMinVersion(b int)

func (*ProDOSFileDescriptor) SetModTime

func (fd *ProDOSFileDescriptor) SetModTime(t time.Time)

func (*ProDOSFileDescriptor) SetName

func (fd *ProDOSFileDescriptor) SetName(name string)

func (*ProDOSFileDescriptor) SetSize

func (fd *ProDOSFileDescriptor) SetSize(v int)

func (*ProDOSFileDescriptor) SetStorageType

func (fd *ProDOSFileDescriptor) SetStorageType(t ProDOSStorageType)

func (*ProDOSFileDescriptor) SetTotalBlocks

func (fd *ProDOSFileDescriptor) SetTotalBlocks(b int)

func (*ProDOSFileDescriptor) SetType

func (fd *ProDOSFileDescriptor) SetType(t ProDOSFileType)

func (*ProDOSFileDescriptor) SetVersion

func (fd *ProDOSFileDescriptor) SetVersion(b int)

func (*ProDOSFileDescriptor) Size

func (fd *ProDOSFileDescriptor) Size() int

func (*ProDOSFileDescriptor) TotalBlocks

func (fd *ProDOSFileDescriptor) TotalBlocks() int

func (*ProDOSFileDescriptor) TotalSectors

func (fd *ProDOSFileDescriptor) TotalSectors() int

func (*ProDOSFileDescriptor) Type

type ProDOSFileType

type ProDOSFileType byte
const (
	FileType_PD_None      ProDOSFileType = 0x00
	FileType_PD_TXT       ProDOSFileType = 0x04
	FileType_PD_Directory ProDOSFileType = 0x0f
	FileType_PD_BIN       ProDOSFileType = 0x06
	FileType_PD_INT       ProDOSFileType = 0xfa
	FileType_PD_INT_Var   ProDOSFileType = 0xfb
	FileType_PD_APP       ProDOSFileType = 0xfc
	FileType_PD_APP_Var   ProDOSFileType = 0xfd
	FileType_PD_Reloc     ProDOSFileType = 0xfe
	FileType_PD_SYS       ProDOSFileType = 0xff
)

func ProDOSFileTypeFromExt

func ProDOSFileTypeFromExt(ext string) ProDOSFileType

func (ProDOSFileType) Ext

func (ft ProDOSFileType) Ext() string

func (ProDOSFileType) String

func (t ProDOSFileType) String() string

func (ProDOSFileType) Valid

func (t ProDOSFileType) Valid() bool

type ProDOSStorageType

type ProDOSStorageType byte
const (
	StorageType_Inactive      ProDOSStorageType = 0x0
	StorageType_Seedling      ProDOSStorageType = 0x1
	StorageType_Sapling       ProDOSStorageType = 0x2
	StorageType_Tree          ProDOSStorageType = 0x3
	StorageType_SubDir_File   ProDOSStorageType = 0xd
	StorageType_SubDir_Header ProDOSStorageType = 0xe
	StorageType_Volume_Header ProDOSStorageType = 0xf
)

type ProDOSVolumeBitmap

type ProDOSVolumeBitmap struct {
	Data []byte
	// contains filtered or unexported fields
}

func (ProDOSVolumeBitmap) IsBlockFree

func (vb ProDOSVolumeBitmap) IsBlockFree(b int) bool

func (ProDOSVolumeBitmap) SetBlockFree

func (vb ProDOSVolumeBitmap) SetBlockFree(b int, free bool)

type RDOSFileDescriptor

type RDOSFileDescriptor struct {
	// contains filtered or unexported fields
}

func (*RDOSFileDescriptor) IsDeleted

func (fd *RDOSFileDescriptor) IsDeleted() bool

func (*RDOSFileDescriptor) IsLocked

func (fd *RDOSFileDescriptor) IsLocked() bool

func (*RDOSFileDescriptor) IsUnused

func (fd *RDOSFileDescriptor) IsUnused() bool

func (RDOSFileDescriptor) Length

func (fd RDOSFileDescriptor) Length() int

func (RDOSFileDescriptor) LoadAddress

func (fd RDOSFileDescriptor) LoadAddress() int

func (*RDOSFileDescriptor) Name

func (fd *RDOSFileDescriptor) Name() string

func (*RDOSFileDescriptor) NameUnadorned

func (fd *RDOSFileDescriptor) NameUnadorned() string

func (RDOSFileDescriptor) NumSectors

func (fd RDOSFileDescriptor) NumSectors() int

func (*RDOSFileDescriptor) SetData

func (fd *RDOSFileDescriptor) SetData(in []byte)

func (RDOSFileDescriptor) StartSector

func (fd RDOSFileDescriptor) StartSector() int

func (*RDOSFileDescriptor) Type

func (fd *RDOSFileDescriptor) Type() RDOSFileType

type RDOSFileType

type RDOSFileType int
const (
	FileType_RDOS_Unknown RDOSFileType = iota
	FileType_RDOS_AppleSoft
	FileType_RDOS_Binary
	FileType_RDOS_Text
)

func RDOSFileTypeFromExt

func RDOSFileTypeFromExt(ext string) RDOSFileType

func (RDOSFileType) Ext

func (ft RDOSFileType) Ext() string

func (RDOSFileType) String

func (ft RDOSFileType) String() string

type RDOSFormat

type RDOSFormat int
const (
	RDOS_Unknown RDOSFormat = iota
	RDOS_3
	RDOS_32
	RDOS_33
)

func (RDOSFormat) Spec

func (f RDOSFormat) Spec() *RDOSFormatSpec

func (RDOSFormat) String

func (f RDOSFormat) String() string

type RDOSFormatSpec

type RDOSFormatSpec struct {
	SectorStride  int
	SectorMax     int
	CatalogTrack  int
	CatalogSector int
	Ordering      SectorOrder
}

type SectorOrder

type SectorOrder int
const (
	SectorOrderDOS33 SectorOrder = iota
	SectorOrderDOS32
	SectorOrderDOS33Alt
	SectorOrderProDOS
	SectorOrderProDOSLinear
	SectorOrderDiversiDOS
)

func (SectorOrder) String

func (so SectorOrder) String() string

type VDH

type VDH struct {
	Data []byte
	// contains filtered or unexported fields
}

func (*VDH) CreateTime

func (fd *VDH) CreateTime() time.Time

func (*VDH) GetAccess

func (fd *VDH) GetAccess() ProDOSAccessMode

func (*VDH) GetBitmapPointer

func (fd *VDH) GetBitmapPointer() int

func (*VDH) GetDirName

func (fd *VDH) GetDirName() string

func (*VDH) GetDirParentEntry

func (fd *VDH) GetDirParentEntry() int

func (*VDH) GetDirParentEntryLength

func (fd *VDH) GetDirParentEntryLength() int

func (*VDH) GetDirParentPointer

func (fd *VDH) GetDirParentPointer() int

func (*VDH) GetEntriesPerBlock

func (fd *VDH) GetEntriesPerBlock() int

func (*VDH) GetEntryLength

func (fd *VDH) GetEntryLength() int

func (*VDH) GetFileCount

func (fd *VDH) GetFileCount() int

func (*VDH) GetMinVersion

func (fd *VDH) GetMinVersion() int

func (*VDH) GetNameLength

func (fd *VDH) GetNameLength() int

func (*VDH) GetStorageType

func (fd *VDH) GetStorageType() ProDOSStorageType

func (*VDH) GetTotalBlocks

func (fd *VDH) GetTotalBlocks() int

func (*VDH) GetVersion

func (fd *VDH) GetVersion() int

func (*VDH) GetVolumeName

func (fd *VDH) GetVolumeName() string

func (*VDH) Publish

func (fd *VDH) Publish(dsk *DSKWrapper) error

func (*VDH) SetAccess

func (fd *VDH) SetAccess(m ProDOSAccessMode)

func (*VDH) SetCreateTime

func (fd *VDH) SetCreateTime(t time.Time)

func (*VDH) SetData

func (fd *VDH) SetData(data []byte, blockid, blockoffset int)

func (*VDH) SetDirParentEntry

func (fd *VDH) SetDirParentEntry(b int)

func (*VDH) SetDirParentEntryLength

func (fd *VDH) SetDirParentEntryLength(b int)

func (*VDH) SetDirParentPointer

func (fd *VDH) SetDirParentPointer(b int)

func (*VDH) SetEntriesPerBlock

func (fd *VDH) SetEntriesPerBlock(b int)

func (*VDH) SetEntryLength

func (fd *VDH) SetEntryLength(b int)

func (*VDH) SetFileCount

func (fd *VDH) SetFileCount(c int)

func (*VDH) SetMinVersion

func (fd *VDH) SetMinVersion(b int)

func (*VDH) SetName

func (fd *VDH) SetName(name string)

func (*VDH) SetNameLength added in v0.5.5

func (fd *VDH) SetNameLength(l int)

func (*VDH) SetStorageType

func (fd *VDH) SetStorageType(t ProDOSStorageType)

func (*VDH) SetTotalBlocks

func (fd *VDH) SetTotalBlocks(b int)

func (*VDH) SetVersion

func (fd *VDH) SetVersion(b int)

func (*VDH) SetVolumeName added in v0.5.5

func (fd *VDH) SetVolumeName(s string)

type VTOC

type VTOC struct {
	Data [256]byte
	// contains filtered or unexported fields
}

func (*VTOC) BytesPerSector

func (fd *VTOC) BytesPerSector() int

func (*VTOC) DumpMap

func (fd *VTOC) DumpMap()

func (*VTOC) GetCatalogStart

func (fd *VTOC) GetCatalogStart() (int, int)

func (*VTOC) GetDOSVersion

func (fd *VTOC) GetDOSVersion() byte

func (*VTOC) GetMaxTSPairsPerSector

func (fd *VTOC) GetMaxTSPairsPerSector() int

func (*VTOC) GetSectors

func (fd *VTOC) GetSectors() int

func (*VTOC) GetTrackOrder

func (fd *VTOC) GetTrackOrder() int

func (*VTOC) GetTracks

func (fd *VTOC) GetTracks() int

func (*VTOC) GetVolumeID

func (fd *VTOC) GetVolumeID() byte

func (*VTOC) IsTSFree

func (fd *VTOC) IsTSFree(t, s int) bool

func (*VTOC) Publish

func (fd *VTOC) Publish(dsk *DSKWrapper) error

func (*VTOC) SetData

func (fd *VTOC) SetData(data []byte, t, s int)

func (*VTOC) SetTSFree

func (fd *VTOC) SetTSFree(t, s int, b bool)

SetTSFree marks a T/S free or not

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL