Skip to content

Commit

Permalink
New DiskII Driver. Woz here we come
Browse files Browse the repository at this point in the history
Complete replacement from the previous version, see readme for
details...
Short story is that theres support for WOZ 1/2 read/write disks, as now
emulate the low level LSS state machine.

Signed-off-by: Michel Pollet <[email protected]>
  • Loading branch information
buserror committed Feb 12, 2024
1 parent 59beeb2 commit 66937f3
Show file tree
Hide file tree
Showing 12 changed files with 1,042 additions and 1,017 deletions.
661 changes: 387 additions & 274 deletions src/drivers/mii_disk2.c

Large diffs are not rendered by default.

472 changes: 0 additions & 472 deletions src/format/dsk.c

This file was deleted.

36 changes: 0 additions & 36 deletions src/format/empty.c

This file was deleted.

31 changes: 27 additions & 4 deletions src/format/mii_dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,21 @@ mii_dd_file_load(
{
if (!flags)
flags = O_RDONLY;
if (flags & O_WRONLY)
flags |= O_RDWR;
int err;
int fd = open(pathname, flags);
if (fd < 0) {
perror(pathname);
printf("%s: %s: Retrying Read only\n", __func__, pathname);
if (flags & (O_RDWR | O_WRONLY)) {
flags &= ~(O_RDWR | O_WRONLY);
flags |= O_RDONLY;
fd = open(pathname, flags, 0666);
}
}
if (fd < 0) {
printf("%s: %s: Failed to open: %s\n",
__func__, pathname, strerror(errno));
return NULL;
}
struct stat st;
Expand Down Expand Up @@ -174,10 +185,22 @@ mii_dd_file_load(
res->dd = NULL;
res->next = dd->file;
dd->file = res;
res->read_only = (flags & O_RDWR) == 0;
char *suffix = strrchr(pathname, '.');
if (suffix && !strcasecmp(suffix, ".2mg")) {
res->format = MII_DD_FILE_2MG;
res->map += 64;
if (suffix) {
if (!strcasecmp(suffix, ".dsk")) {
res->format = MII_DD_FILE_DSK;
} else if (!strcasecmp(suffix, ".po") || !strcasecmp(suffix, ".hdv")) {
res->format = MII_DD_FILE_PO;
} else if (!strcasecmp(suffix, ".nib")) {
res->format = MII_DD_FILE_NIB;
} else if (!strcasecmp(suffix, ".woz")) {
res->format = MII_DD_FILE_WOZ;
} else if (!strcasecmp(suffix, ".2mg")) {
res->format = MII_DD_FILE_2MG;
res->map += 64;
}
printf("%s: suffix %s, format %d\n", __func__, suffix, res->format);
}
return res;
bail:
Expand Down
5 changes: 5 additions & 0 deletions src/format/mii_dd.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ enum {
// MII_DD_FILE_OVERLAY = 1,
MII_DD_FILE_RAM,
MII_DD_FILE_ROM,
MII_DD_FILE_PO,
MII_DD_FILE_2MG = 5,
MII_DD_FILE_DSK,
MII_DD_FILE_NIB,
MII_DD_FILE_WOZ
};

// a disk image file (or chunck of ram, if ramdisk is used)
typedef struct mii_dd_file_t {
struct mii_dd_file_t *next;
char * pathname;
uint8_t format;
uint8_t read_only;
uint8_t * start; // start of the file
uint8_t * map; // start of the blocks

Expand Down
95 changes: 0 additions & 95 deletions src/format/mii_disk_format.c

This file was deleted.

35 changes: 0 additions & 35 deletions src/format/mii_disk_format.h

This file was deleted.

Loading

0 comments on commit 66937f3

Please sign in to comment.