Class DSK
In: lib/DSK.rb
Parent: Object
DSKTrackSector DSK dot/f_5.png

For manipulating DSK files, as created by ADT (adt.berlios.de) and ADTPRo (adtpro.sourceforge.net) used by many Apple 2 emulators.

Methods

Constants

FILE_SYSTEMS = [:prodos,:dos33,:nadol,:cpm,:pascal,:modified_dos,:unknown,:none]
SECTOR_ORDERS = [:physical,:dos]
DSK_IMAGE_EXTENSIONS = [".dsk",".po",".do",".hdv",".nib"]
INTERLEAVES = { :physical=> [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F], :dos=>[0x00,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x0F], }
DSK_FILE_LENGTH = 143360
NIB_FILE_LENGTH = 232960

Attributes

file_bytes  [RW] 
sector_order  [RW] 
source_filename  [RW] 
track_count  [RW] 

Public Class methods

create a new DSK initialised with specified filesystem

does this filename have a suitable extension?

create a new DSK structure (in memory, not on disk)

read in an existing DSK file (must exist)

Public Instance methods

add_file takes a *File object (of a type compatible with the underlying file system) and adds it to the in-memory image of this DSK this should be overridden in each *Disk type that has write support enabled

for a generic DSK,return an instance of subclass representing the the best match file system

return a formatted hex dump of a single 256 byte sector

return a formatted hex dump of a single 256 byte sector

return a formatted hex dump of all sectors on all tracks

does this DSK have a standard Apple DOS 3.3 VTOC?

make_file creates a *File object (of a type compatible with the underlying file system) from filename, contents and options required for the underlying file system. The file is NOT added to the in-memory image of this DSK (call add_file to do that)

write out DSK to file

write supplied code to track 0 (from sector 0 to whatever is required) code should run from $0801 and can be up to 4KB (16 sectors) in length

[Validate]