WOZ 2.0 Disk Image Format

This commit is contained in:
Tamas Rudnai 2024-05-07 20:05:39 -07:00
parent 67cc9d2359
commit 41cfb1efde
4 changed files with 24 additions and 19 deletions

View File

@ -343,7 +343,7 @@ static size_t write_sync(uint8_t *buffer, size_t position) {
@param dest The at-least-343 byte buffer to which the encoded sector is written.
@param src The 256-byte source data.
*/
static void encode_6_and_2(uint8_t *dest, const uint8_t *src) {
void encode_6_and_2(uint8_t *dest, const uint8_t *src) {
const uint8_t six_and_two_mapping[] = {
0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,
0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,

View File

@ -25,5 +25,6 @@
#define dsk2woz_h
int dsk2woz( const char * filename );
extern void encode_6_and_2(uint8_t *dest, const uint8_t *src);
#endif /* dsk2woz_h */

View File

@ -32,7 +32,8 @@
#define WOZ1_FILE_SIZE 233216
#define DISKII_MAXTRACKS 80
#define WOZ1_MAXTRACKS 80
#define WOZ2_MAXTRACKS 160
#define DISKII_PHASES 4
#define WOZ1_MAGIC 0x315A4F57
@ -54,7 +55,13 @@
#pragma pack(1)
typedef struct woz_header_s {
uint32_t magic;
union {
struct {
char woz_name [3]; // should be "WOZ"
char woz_version; // currently "1" (0x31) or "2" (0x32)
};
uint32_t magic;
};
union {
struct {
uint8_t no7;
@ -73,8 +80,9 @@ typedef struct woz_chunk_header_s {
// chunk data only
typedef struct woz_info_s {
uint8_t version; // Version number of the INFO chunk.
// WOZ1 version is 1
// WOZ2 version is 2
// WOZ1 => 1
// WOZ2 => 2
// WOZ 2.1 => 3
uint8_t disk_type; // 1 = 5.25, 2 = 3.5
uint8_t is_write_protected; // 1 = Floppy is write protected
uint8_t sync; // 1 = Cross track sync
@ -109,7 +117,7 @@ typedef struct woz_info_s {
// chunk data only
typedef struct woz_tmap_s {
uint8_t phase [DISKII_MAXTRACKS * DISKII_PHASES];
uint8_t phase [WOZ1_MAXTRACKS * DISKII_PHASES];
} woz_tmap_t;
#define WOZ1_TRACK_BYTE_COUNT 6646
@ -117,7 +125,7 @@ typedef struct woz_tmap_s {
// chunk data only
typedef struct woz1_track_s {
typedef struct woz1_trk_s {
uint8_t data [WOZ1_TRACK_BYTE_COUNT];
uint16_t bytes_used;
uint16_t bit_count;
@ -125,7 +133,7 @@ typedef struct woz1_track_s {
uint8_t splice_nibble;
uint8_t splice_bit_count;
uint16_t reserved;
} woz1_track_t;
} woz1_trk_t;
typedef struct woz2_trk_s {
@ -138,18 +146,9 @@ typedef struct woz2_trk_s {
#define WOZ_MAX_TRK 160
typedef struct woz2_track_s {
uint8_t trks [WOZ_MAX_TRK];
uint16_t bytes_used;
uint16_t bit_count;
uint16_t splice_point;
uint8_t splice_nibble;
uint8_t splice_bit_count;
uint16_t reserved;
} woz2_track_t;
// chunk data only
typedef woz1_track_t woz1_trks_t[DISKII_MAXTRACKS];
typedef woz1_trk_t woz1_trks_t[WOZ1_MAXTRACKS];
typedef woz2_trk_t woz2_trks_t[WOZ2_MAXTRACKS];
#pragma pack(pop)

5
woz_debug.rtf Normal file
View File

@ -0,0 +1,5 @@
{\rtf1\ansi\ansicpg1252\cocoartf949
{\fonttbl}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
}