From 39b9cb0207c273d60a057785eee124735b05428c Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Tue, 6 Mar 2018 17:41:45 +0000 Subject: [PATCH] jvc_dsk: Added notes (nw) --- src/lib/formats/jvc_dsk.cpp | 95 ++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp index d2e7e503d3b..3056a311169 100644 --- a/src/lib/formats/jvc_dsk.cpp +++ b/src/lib/formats/jvc_dsk.cpp @@ -6,10 +6,101 @@ Disk image format - Named after its creator, Jeff Vavasour + Used by Jeff Vavasour's CoCo Emulators + + Documentation taken from Tim Linder's web site: + http://tlindner.macmess.org/?page_id=86 + + A. Header length + The header length is determined by the file length modulo 256: + headerSize = fileLength % 256; + This means that the header is variable length and the minimum size + is zero bytes, and the maximum size of 255 bytes. + + B. Header + Here is a description of the header bytes: + Byte Offset Description Default + ----------- ----------- ------- + 0 Sectors per track 18 + 1 Side count 1 + 2 Sector size code 1 + 3 First sector ID 1 + 4 Sector attribute flag 0 + + If the sector attribute flag is zero then the track count is determined + by the formula: + + (fileLength - headerSize) / (sectorsPerTrack * (128 << + sectorSizeCode)) / sideCount + + If the sector attribute flag is non zero then the track count is + determined by the more complex formula: + + (fileLength - headerSize) / (sectorsPerTrack * ((128 << + sectorSizeCode) + 1) ) / sideCount + + If the length of the header is to short to contain the geometry desired, + then the default values are assumed. If the header length is zero the all + of the geometry is assumed. When creating disk images it is desirable to + make the header length as short as possible. The header should only be + used to deviate from the default values. + + The sector data begins immediately after the header. If the header length + is zero then the sector data is at the beginning file. + + C. Sectors per track + This is the number of sectors per track (ones based). A value of 18 + means there are 18 sectors per track + + D. Side Count + This is the number of sides in the disk image. Values of 1 or 2 are + acceptable. If there are two sides then the tracks are interleaved. + The first track in the image file is track zero side 1, the second + track in the image file is track zero side 2. + + E. Sector size + The is the same value that is stored in the wd179x ID field to + determine sector size: + + 0x00 128 bytes + 0x01 256 bytes + 0x02 512 bytes + 0x03 1024 bytes + + Other values are undefined. Every sector in the disk image must be the + same size. + + F. First sector ID + This determines the first sector ID for each track. Each successive + sector adds one to the previous ID. If the first sector ID is 1, then + the second sector has an ID of 2, and the third has an ID of 3. + + G. Sector Attribute Flag + If this byte is non zero, then each sector contains an additional + byte prepended to the sector data. If the attribute flag is zero then + there are no extra bytes in front of the sector data. + + H. Sector attribute byte + This byte is put at the beginning of every sector if the header flag + is turned on. The information this byte contains is the same as the + status register (of the wd179x) would contain when a 'Read Sector' + command was issued. The bit fields are defined as: + + Bit position: + --------------- + 7 6 5 4 3 2 1 0 + | | | | | | | | + | | | | | | | +--- Not used. Set to zero. + | | | | | | +----- Not used. Set to zero. + | | | | | +------- Not used. Set to zero. + | | | | +--------- Set on CRC error. + | | | +----------- Set if sector not found. + | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. + | +--------------- Not Used. Set to zero. + +----------------- Not Used. Set to zero. TODO: - - Support writing unusal formats? + - Support writing unusual formats? ***************************************************************************/