t_stat clk_attach (UNIT *uptr, CONST char *cptr) { t_stat r; uptr->flags = uptr->flags | (UNIT_ATTABLE | UNIT_BUFABLE); memset (uptr->filebuf, 0, (size_t)uptr->capac); r = attach_unit (uptr, cptr); if (r != SCPE_OK) uptr->flags = uptr->flags & ~(UNIT_ATTABLE | UNIT_BUFABLE); else { TOY *toy = (TOY *)uptr->filebuf; uptr->hwmark = (uint32) uptr->capac; if ((toy->toy_endian_plus2 < 2) || (toy->toy_endian_plus2 > 3)) memset (uptr->filebuf, 0, (size_t)uptr->capac); else { if (toy->toy_endian_plus2 != sim_end + 2) { /* wrong endian? */ toy->toy_gmtbase = sim_byteswap32 (toy->toy_gmtbase); toy->toy_gmtbasemsec = sim_byteswap32 (toy->toy_gmtbasemsec); } } toy->toy_endian_plus2 = sim_end + 2; todr_resync (); } return r; }
t_stat lpt_attach (UNIT *uptr, char *cptr) { cctptr = 0; /* clear cct ptr */ lines = 0; /* no cc action */ ind[IN_LPT] = 0; return attach_unit (uptr, cptr); }
t_stat ptp_attach (UNIT *uptr, CONST char *cptr) { if (sim_switches & SWMASK ('A')) uptr->flags = uptr->flags | UNIT_ASCII; else uptr->flags = uptr->flags & ~UNIT_ASCII; return attach_unit (uptr, cptr); }
t_stat rp_attach (UNIT *uptr, char *cptr) { t_stat reason; reason = attach_unit (uptr, cptr); rp_updsta (0, 0); return reason; }
t_stat dp_attach (UNIT *uptr, char *cptr) { t_stat r; r = attach_unit (uptr, cptr); if (r != SCPE_OK) return r; return dp_showformat (stdout, uptr, 0, NULL); }
t_stat ptr_attach (UNIT *uptr, CONST char *cptr) { ptr_leader = PTR_LEADER; /* set up leader */ if (sim_switches & SWMASK ('A')) uptr->flags = uptr->flags | UNIT_ASCII; else uptr->flags = uptr->flags & ~UNIT_ASCII; return attach_unit (uptr, cptr); }
t_stat dqc_attach (UNIT *uptr, char *cptr) { t_stat r; r = attach_unit (uptr, cptr); /* attach unit */ if (r == SCPE_OK) dqc_load_unload (uptr, 0, NULL, NULL);/* if OK, load heads */ return r; }
t_stat ptp_attach (UNIT *uptr, char *cptr) { t_stat reason; reason = attach_unit (uptr, cptr); if ((ptp_unit.flags & UNIT_ATT) == 0) ptp_csr = ptp_csr | CSR_ERR; else ptp_csr = ptp_csr & ~CSR_ERR; return reason; }
t_stat rp_attach (UNIT *uptr, CONST char *cptr) { t_stat reason; uptr->capac = RP_QSIZE (uptr->flags); reason = attach_unit (uptr, cptr); rp_updsta (0, 0); return reason; }
t_stat pt_attach (UNIT *uptr, char *cptr) { t_stat st; st = attach_unit (uptr, cptr); if ((uptr == &pt_unit[PTR]) && (st == SCPE_OK)) ptr_nzc = 0; return st; }
static t_stat sagelp_attach (UNIT *uptr, CONST char *cptr) { t_stat rc; rc = attach_unit(uptr, cptr); if ((sagelp_unit.flags & UNIT_ATT) == 0) u39.portb |= U39B_PAPER; /* no paper */ return rc; }
t_stat cdr_attach (UNIT *uptr, char *cptr) { t_stat r; ind[IN_LST] = ind[IN_READ] = 0; /* clear last card */ cdr_unit.flags |= UNIT_ATTABLE; /* must be attachable */ r = attach_unit (uptr, cptr); /* do attach */ if ((r != SCPE_OK) && ((cdr_unit.flags & UNIT_CONS) != 0)) /* failed, default? */ cdr_unit.flags &= ~UNIT_ATTABLE; /* clear attachable */ return r; }
t_stat lpt_attach(UNIT * uptr, char *cptr) { t_stat reason; lpt_csr = lpt_csr & ~CSR_ERR; reason = attach_unit(uptr, cptr); if ((lpt_unit.flags & UNIT_ATT) == 0) lpt_csr = lpt_csr | CSR_ERR; return reason; }
t_stat dp_attach(UNIT *uptr, CONST char *cptr) { struct dpio_unit *iou = (struct dpio_unit *)uptr->up7; const char *drivetype = ((uptr->flags & UNIT_854) != 0) ? "854" : "853"; t_addr capac = ((uptr->flags & UNIT_854) != 0) ? DP854_SIZE : DP853_SIZE; t_stat r; uptr->capac = capac; r = attach_unit(uptr, cptr); if (r != SCPE_OK) return r; /* * If this is a newly created file, set the drive size appropriately. */ if (sim_fsize_ex(uptr->fileref) == 0) sim_set_fsize(uptr->fileref, capac); if (sim_fsize_ex(uptr->fileref) != capac) { if (ExecutionStarted) { detach_unit(uptr); return sim_messagef(SCPE_OPENERR, "Unable to autosize drive after execution started\n"); } /* * This is not the correct size according the drive type but this is the * first attach. Force the drive to match the size of the disk. */ switch (sim_fsize_ex(uptr->fileref)) { case DP854_SIZE: uptr->capac = DP854_SIZE; uptr->flags |= UNIT_854; break; case DP853_SIZE: uptr->capac = DP853_SIZE; uptr->flags &= ~UNIT_854; break; default: detach_unit(uptr); return sim_messagef(SCPE_OPENERR, "Unsupported disk size\n"); } } /* * Set unit to cylinder 0, head 0, sector 0 and indicate on-cylinder. */ iou->cylinder = 0; iou->head = 0; iou->sector = 0; iou->oncyl = TRUE; return SCPE_OK; }
t_stat ry_attach (UNIT *uptr, char *cptr) { uint32 sz; if ((uptr->flags & UNIT_AUTO) && (sz = sim_fsize_name (cptr))) { if (sz > RX_SIZE) uptr->flags = uptr->flags | UNIT_DEN; else uptr->flags = uptr->flags & ~UNIT_DEN; } uptr->capac = (uptr->flags & UNIT_DEN)? RY_SIZE: RX_SIZE; return attach_unit (uptr, cptr); }
/* Attach routine */ t_stat mfdc_attach(UNIT *uptr, char *cptr) { t_stat r; unsigned int i = 0; r = attach_unit(uptr, cptr); /* attach unit */ if ( r != SCPE_OK) /* error? */ return r; /* Determine length of this disk */ if(sim_fsize(uptr->fileref) != 0) { uptr->capac = sim_fsize(uptr->fileref); } else { uptr->capac = MFDC_CAPACITY; } i = find_unit_index(uptr); /* Default for new file is DSK */ uptr->u3 = IMAGE_TYPE_DSK; if(uptr->capac > 0) { r = assignDiskType(uptr); if (r != SCPE_OK) { mfdc_detach(uptr); return r; } } if (uptr->flags & UNIT_MFDC_VERBOSE) printf("MDSK%d, attached to '%s', type=%s, len=%d\n", i, cptr, uptr->u3 == IMAGE_TYPE_IMD ? "IMD" : uptr->u3 == IMAGE_TYPE_CPT ? "CPT" : "DSK", uptr->capac); if(uptr->u3 == IMAGE_TYPE_IMD) { if(uptr->capac < 318000) { printf("Cannot create IMD files with SIMH.\nCopy an existing file and format it with CP/M.\n"); mfdc_detach(uptr); return SCPE_OPENERR; } if (uptr->flags & UNIT_MFDC_VERBOSE) printf("--------------------------------------------------------\n"); mfdc_info->drive[i].imd = diskOpen((uptr->fileref), (uptr->flags & UNIT_MFDC_VERBOSE)); if (uptr->flags & UNIT_MFDC_VERBOSE) printf("\n"); } else { mfdc_info->drive[i].imd = NULL; } return SCPE_OK; }
t_stat clk_attach (UNIT *uptr, char *cptr) { t_stat r; uptr->flags = uptr->flags | (UNIT_ATTABLE | UNIT_BUFABLE); memset (uptr->filebuf, 0, (size_t)uptr->capac); r = attach_unit (uptr, cptr); if (r != SCPE_OK) uptr->flags = uptr->flags & ~(UNIT_ATTABLE | UNIT_BUFABLE); else uptr->hwmark = (uint32) uptr->capac; return r; }
/* Attach routine */ static t_stat mdsad_attach(UNIT *uptr, CONST char *cptr) { char header[4]; t_stat r; unsigned int i = 0; r = attach_unit(uptr, cptr); /* attach unit */ if(r != SCPE_OK) /* error? */ return r; /* Determine length of this disk */ if(sim_fsize(uptr->fileref) != 0) { uptr->capac = sim_fsize(uptr->fileref); } else { uptr->capac = MDSAD_CAPACITY; } for(i = 0; i < MDSAD_MAX_DRIVES; i++) { mdsad_info->drive[i].uptr = &mdsad_dev.units[i]; } for(i = 0; i < MDSAD_MAX_DRIVES; i++) { if(mdsad_dev.units[i].fileref == uptr->fileref) { break; } mdsad_info->orders.st = 0; /* ensure valid state */ } /* Default for new file is DSK */ uptr->u3 = IMAGE_TYPE_DSK; if(uptr->capac > 0) { char *rtn = fgets(header, 4, uptr->fileref); if((rtn != NULL) && (strncmp(header, "CPT", 3) == 0)) { sim_printf("CPT images not yet supported\n"); uptr->u3 = IMAGE_TYPE_CPT; mdsad_detach(uptr); return SCPE_OPENERR; } else { uptr->u3 = IMAGE_TYPE_DSK; } } if (uptr->flags & UNIT_MDSAD_VERBOSE) sim_printf("MDSAD%d, attached to '%s', type=%s, len=%d\n", i, cptr, uptr->u3 == IMAGE_TYPE_CPT ? "CPT" : "DSK", uptr->capac); return SCPE_OK; }
t_stat pt_attach (UNIT *uptr, char *cptr) { t_stat r; if (!(uptr->flags & UNIT_ATTABLE)) return SCPE_NOFNC; if (r = attach_unit (uptr, cptr)) return r; if (sim_switches & SWMASK ('A')) /* -a? ASCII */ uptr->flags |= UNIT_ASC; else if (sim_switches & SWMASK ('U')) /* -u? Unix ASCII */ uptr->flags |= (UNIT_ASC|UNIT_UASC); else if (sim_switches & SWMASK ('B')) /* -b? binary */ uptr->flags &= ~(UNIT_ASC|UNIT_UASC); uptr->STA = 0; return r; }
t_stat cd_attach (UNIT *uptr, CONST char *cptr) { t_stat r; r = attach_unit (uptr, cptr); if (r != SCPE_OK) /* attach */ return r; if (sim_switches & SWMASK ('T')) /* text? */ uptr->flags = uptr->flags & ~UNIT_CBN; else if (sim_switches & SWMASK ('C')) /* column binary? */ uptr->flags = uptr->flags | UNIT_CBN; else if (match_ext (cptr, "TXT")) /* .txt? */ uptr->flags = uptr->flags & ~UNIT_CBN; else if (match_ext (cptr, "CBN")) /* .cbn? */ uptr->flags = uptr->flags | UNIT_CBN; return SCPE_OK; }
t_stat EPROM_attach (UNIT *uptr, CONST char *cptr) { uint16 j; int c; FILE *fp; t_stat r; sim_debug (DEBUG_flow, &EPROM_dev, "EPROM_attach: cptr=%s\n", cptr); if ((r = attach_unit (uptr, cptr)) != SCPE_OK) { sim_debug (DEBUG_flow, &EPROM_dev, "EPROM_attach: Error\n"); return r; } sim_debug (DEBUG_read, &EPROM_dev, "\tAllocate buffer\n"); if (EPROM_unit.filebuf == NULL) { /* no buffer allocated */ EPROM_unit.filebuf = malloc(EPROM_unit.capac); /* allocate EPROM buffer */ if (EPROM_unit.filebuf == NULL) { sim_debug (DEBUG_flow, &EPROM_dev, "EPROM_attach: Malloc error\n"); return SCPE_MEM; } } sim_debug (DEBUG_read, &EPROM_dev, "\tOpen file %s\n", EPROM_unit.filename); fp = fopen(EPROM_unit.filename, "rb"); /* open EPROM file */ if (fp == NULL) { sim_printf("EPROM: Unable to open ROM file %s\n", EPROM_unit.filename); sim_printf("\tNo ROM image loaded!!!\n"); return SCPE_OK; } sim_debug (DEBUG_read, &EPROM_dev, "\tRead file\n"); j = 0; /* load EPROM file */ c = fgetc(fp); while (c != EOF) { *((uint8 *)EPROM_unit.filebuf + j++) = c & 0xFF; c = fgetc(fp); if (j > EPROM_unit.capac) { sim_printf("\tImage is too large - Load truncated!!!\n"); break; } } sim_printf("\tImage size=%05X unit_capac=%05X\n", j, EPROM_unit.capac); sim_debug (DEBUG_read, &EPROM_dev, "\tClose file\n"); fclose(fp); sim_printf("EPROM: %d bytes of ROM image %s loaded\n", j, EPROM_unit.filename); sim_debug (DEBUG_flow, &EPROM_dev, "EPROM_attach: Done\n"); return SCPE_OK; }
t_stat i2716_attach (UNIT *uptr, char *cptr) { int32 j, c; t_stat r; FILE *fp; if (i2716_dev.dctrl & DEBUG_flow) printf("i2716_attach: cptr=%s\n", cptr); if ((r = attach_unit (uptr, cptr)) != SCPE_OK) { if (i2716_dev.dctrl & DEBUG_flow) printf("i2716_attach: Error\n"); return r; } if (i2716_dev.dctrl & DEBUG_read) printf("\tOpen file\n"); fp = fopen(uptr->filename, "rb"); /* open EPROM file */ if (fp == NULL) { printf("i2716%d: Unable to open ROM file %s\n", uptr - i2716_dev.units, uptr->filename); printf("\tNo ROM image loaded!!!\n"); return SCPE_OK; } if (i2716_dev.dctrl & DEBUG_read) printf("\tRead file\n"); j = 0; /* load EPROM file */ c = fgetc(fp); while (c != EOF) { *(uint8 *)(uptr->filebuf + j++) = c & 0xFF; c = fgetc(fp); if (j > 2048) { printf("\tImage is too large - Load truncated!!!\n"); break; } } if (i2716_dev.dctrl & DEBUG_read) printf("\tClose file\n"); fclose(fp); // printf("i2716%d: %d bytes of ROM image %s loaded\n",uptr - i2716_dev.units, j, uptr->filename); if (i2716_dev.dctrl & DEBUG_flow) printf("i2716_attach: Done\n"); return SCPE_OK; }
t_stat dp_attach (UNIT *uptr, char *cptr) { uint32 i, p; t_stat r; uptr->capac = drv_tab[GET_DTYPE (uptr->flags)].size; r = attach_unit (uptr, cptr); /* attach unit */ if (r != SCPE_OK) /* error? */ return r; uptr->CYL = 0; if ((uptr->flags & UNIT_AUTO) == 0) /* autosize? */ return SCPE_OK; if ((p = ftell (uptr->fileref)) == 0) return SCPE_OK; for (i = 0; drv_tab[i].surf != 0; i++) { if (p <= drv_tab[i].size) { uptr->flags = (uptr->flags & ~UNIT_DTYPE) | (i << UNIT_V_DTYPE); uptr->capac = drv_tab[i].size; return SCPE_OK; } } return SCPE_OK; }
t_stat ptr_attach (UNIT *uptr, char *cptr) { ptr_trlcnt = 0; return attach_unit (uptr, cptr); }
/* Attach routine */ static t_stat disk3_attach(UNIT *uptr, char *cptr) { t_stat r = SCPE_OK; DISK3_DRIVE_INFO *pDrive; int i = 0; i = find_unit_index(uptr); if (i == -1) { return (SCPE_IERR); } pDrive = &disk3_info->drive[i]; pDrive->ready = 1; pDrive->track = 5; pDrive->ntracks = C20MB_NTRACKS; pDrive->nheads = C20MB_NHEADS; pDrive->nsectors = C20MB_NSECTORS; pDrive->sectsize = C20MB_SECTSIZE; r = attach_unit(uptr, cptr); /* attach unit */ if ( r != SCPE_OK) /* error? */ return r; /* Determine length of this disk */ if(sim_fsize(uptr->fileref) != 0) { uptr->capac = sim_fsize(uptr->fileref); } else { uptr->capac = (pDrive->ntracks * pDrive->nsectors * pDrive->nheads * pDrive->sectsize); } pDrive->uptr = uptr; /* Default for new file is DSK */ uptr->u3 = IMAGE_TYPE_DSK; if(uptr->capac > 0) { r = assignDiskType(uptr); if (r != SCPE_OK) { disk3_detach(uptr); return r; } } if (uptr->flags & UNIT_DISK3_VERBOSE) printf("DISK3%d, attached to '%s', type=%s, len=%d\n", i, cptr, uptr->u3 == IMAGE_TYPE_IMD ? "IMD" : uptr->u3 == IMAGE_TYPE_CPT ? "CPT" : "DSK", uptr->capac); if(uptr->u3 == IMAGE_TYPE_IMD) { if(uptr->capac < 318000) { printf("Cannot create IMD files with SIMH.\nCopy an existing file and format it with CP/M.\n"); disk3_detach(uptr); return SCPE_OPENERR; } if (uptr->flags & UNIT_DISK3_VERBOSE) printf("--------------------------------------------------------\n"); disk3_info->drive[i].imd = diskOpenEx((uptr->fileref), (uptr->flags & UNIT_DISK3_VERBOSE), &disk3_dev, VERBOSE_MSG, VERBOSE_MSG); if (uptr->flags & UNIT_DISK3_VERBOSE) printf("\n"); } else { disk3_info->drive[i].imd = NULL; } return SCPE_OK; }
t_stat cdr_attach (UNIT *uptr, char *cptr) { ind[IN_LST] = ind[IN_READ] = 0; /* clear last card */ return attach_unit (uptr, cptr); }
/* Attach routine */ static t_stat hdc1001_attach(UNIT *uptr, char *cptr) { t_stat r = SCPE_OK; HDC1001_DRIVE_INFO *pDrive; char header[4]; unsigned int i = 0; i = find_unit_index(uptr); if (i == -1) { return (SCPE_IERR); } pDrive = &hdc1001_info->drive[i]; pDrive->ready = 1; pDrive->track = 5; pDrive->ntracks = 243; pDrive->nheads = 8; pDrive->nsectors = 11; pDrive->sectsize = 1024; r = attach_unit(uptr, cptr); /* attach unit */ if ( r != SCPE_OK) /* error? */ return r; /* Determine length of this disk */ if(sim_fsize(uptr->fileref) != 0) { uptr->capac = sim_fsize(uptr->fileref); } else { uptr->capac = (pDrive->ntracks * pDrive->nsectors * pDrive->nheads * pDrive->sectsize); } pDrive->uptr = uptr; /* Default for new file is DSK */ uptr->u3 = IMAGE_TYPE_DSK; if(uptr->capac > 0) { fgets(header, 4, uptr->fileref); if(!strcmp(header, "IMD")) { uptr->u3 = IMAGE_TYPE_IMD; } else if(!strcmp(header, "CPT")) { printf("CPT images not yet supported\n"); uptr->u3 = IMAGE_TYPE_CPT; hdc1001_detach(uptr); return SCPE_OPENERR; } else { uptr->u3 = IMAGE_TYPE_DSK; } } if (uptr->flags & UNIT_HDC1001_VERBOSE) printf("HDC1001%d, attached to '%s', type=%s, len=%d\n", i, cptr, uptr->u3 == IMAGE_TYPE_IMD ? "IMD" : uptr->u3 == IMAGE_TYPE_CPT ? "CPT" : "DSK", uptr->capac); if(uptr->u3 == IMAGE_TYPE_IMD) { if(uptr->capac < 318000) { printf("Cannot create IMD files with SIMH.\nCopy an existing file and format it with CP/M.\n"); hdc1001_detach(uptr); return SCPE_OPENERR; } if (uptr->flags & UNIT_HDC1001_VERBOSE) printf("--------------------------------------------------------\n"); hdc1001_info->drive[i].imd = diskOpen((uptr->fileref), (uptr->flags & UNIT_HDC1001_VERBOSE)); if (uptr->flags & UNIT_HDC1001_VERBOSE) printf("\n"); } else { hdc1001_info->drive[i].imd = NULL; } return SCPE_OK; }
/* Attach routine */ t_stat i8272_attach(UNIT *uptr, char *cptr) { char header[4]; t_stat r; int32 i = 0; r = attach_unit(uptr, cptr); /* attach unit */ if ( r != SCPE_OK) /* error? */ return r; /* Determine length of this disk */ uptr->capac = sim_fsize(uptr->fileref); i = find_unit_index(uptr); if (i == -1) { return (SCPE_IERR); } DBG_PRINT(("Attach I8272%d\n", i)); i8272_info->drive[i].uptr = uptr; /* Default to drive not ready */ i8272_info->drive[i].ready = 0; if(uptr->capac > 0) { char *rtn = fgets(header, 4, uptr->fileref); if((rtn != NULL) && strncmp(header, "IMD", 3)) { printf("I8272: Only IMD disk images are supported\n"); i8272_info->drive[i].uptr = NULL; return SCPE_OPENERR; } } else { /* create a disk image file in IMD format. */ if (diskCreate(uptr->fileref, "$Id: i8272.c 1999 2008-07-22 04:25:28Z hharte $") != SCPE_OK) { printf("I8272: Failed to create IMD disk.\n"); i8272_info->drive[i].uptr = NULL; return SCPE_OPENERR; } uptr->capac = sim_fsize(uptr->fileref); } uptr->u3 = IMAGE_TYPE_IMD; if (uptr->flags & UNIT_I8272_VERBOSE) { printf("I8272%d: attached to '%s', type=%s, len=%d\n", i, cptr, uptr->u3 == IMAGE_TYPE_IMD ? "IMD" : uptr->u3 == IMAGE_TYPE_CPT ? "CPT" : "DSK", uptr->capac); } if(uptr->u3 == IMAGE_TYPE_IMD) { if (uptr->flags & UNIT_I8272_VERBOSE) printf("--------------------------------------------------------\n"); i8272_info->drive[i].imd = diskOpen(uptr->fileref, uptr->flags & UNIT_I8272_VERBOSE); if (uptr->flags & UNIT_I8272_VERBOSE) printf("\n"); if (i8272_info->drive[i].imd == NULL) { printf("I8272: IMD disk corrupt.\n"); i8272_info->drive[i].uptr = NULL; return SCPE_OPENERR; } i8272_info->drive[i].ready = 1; } else { i8272_info->drive[i].imd = NULL; } return SCPE_OK; }
t_stat lpt_attach (UNIT *uptr, CONST char *cptr) { lpt_reset (&lpt_dev); return attach_unit (uptr, cptr); }
/* Attach routine */ static t_stat vfdhd_attach(UNIT *uptr, char *cptr) { char header[4]; t_stat r; unsigned int i = 0; r = attach_unit(uptr, cptr); /* attach unit */ if ( r != SCPE_OK) /* error? */ return r; /* Determine length of this disk */ uptr->capac = sim_fsize(uptr->fileref); for(i = 0; i < VFDHD_MAX_DRIVES; i++) { vfdhd_info->drive[i].uptr = &vfdhd_dev.units[i]; } for(i = 0; i < VFDHD_MAX_DRIVES; i++) { if(vfdhd_dev.units[i].fileref == uptr->fileref) { break; } } if(uptr->capac > 0) { fgets(header, 4, uptr->fileref); if(!strcmp(header, "IMD")) { uptr->u3 = IMAGE_TYPE_IMD; } else if(!strcmp(header, "CPT")) { printf("CPT images not yet supported\n"); uptr->u3 = IMAGE_TYPE_CPT; vfdhd_detach(uptr); return SCPE_OPENERR; } else { uptr->u3 = IMAGE_TYPE_DSK; } } else { /* creating file, must be DSK format. */ uptr->u3 = IMAGE_TYPE_DSK; } if (uptr->flags & UNIT_VFDHD_VERBOSE) printf("VFDHD%d: attached to '%s', type=%s, len=%d\n", i, cptr, uptr->u3 == IMAGE_TYPE_IMD ? "IMD" : uptr->u3 == IMAGE_TYPE_CPT ? "CPT" : "DSK", uptr->capac); if(uptr->u3 == IMAGE_TYPE_IMD) { if(uptr->capac < 318000) { printf("Cannot create IMD files with SIMH.\nCopy an existing file and format it with CP/M.\n"); vfdhd_detach(uptr); return SCPE_OPENERR; } if (uptr->flags & UNIT_VFDHD_VERBOSE) printf("--------------------------------------------------------\n"); vfdhd_info->drive[i].imd = diskOpen((uptr->fileref), (uptr->flags & UNIT_VFDHD_VERBOSE)); if (uptr->flags & UNIT_VFDHD_VERBOSE) printf("\n"); } else { vfdhd_info->drive[i].imd = NULL; } if(i>0) { /* Floppy Disk, Unit 1-3 */ vfdhd_info->drive[i].ntracks = 77; /* number of tracks */ vfdhd_info->drive[i].nheads = 2; /* number of heads */ vfdhd_info->drive[i].nspt = 16; /* number of sectors per track */ vfdhd_info->drive[i].npre_len = 40; /* preamble length */ vfdhd_info->drive[i].sectsize = VFDHD_SECTOR_LEN; /* sector size, not including pre/postamble */ } else { /* Hard Disk, Unit 0 */ if(hdSize == 10) { vfdhd_info->drive[i].ntracks = 153; /* number of tracks */ vfdhd_info->drive[i].nheads = 6; /* number of heads */ vfdhd_info->hdsk_type = 1; printf("10MB\n"); } else if (hdSize == 5) { vfdhd_info->drive[i].ntracks = 153; /* number of tracks */ vfdhd_info->drive[i].nheads = 4; /* number of heads */ vfdhd_info->hdsk_type = 0; printf("5MB\n"); } else { vfdhd_info->drive[i].ntracks = 512; /* number of tracks */ vfdhd_info->drive[i].nheads = 8; /* number of heads */ vfdhd_info->hdsk_type = 1; printf("32MB\n"); } vfdhd_info->drive[i].nheads = 4; /* number of heads */ vfdhd_info->drive[i].nspt = 32; /* number of sectors per track */ vfdhd_info->drive[i].npre_len = 30; /* preamble length */ vfdhd_info->drive[i].sectsize = VFDHD_SECTOR_LEN; /* sector size, not including pre/postamble */ vfdhd_info->drive[i].ready = 1; vfdhd_info->drive[i].seek_complete = 1; vfdhd_info->drive[i].sync_lost = 1; /* Active LOW */ } vfdhd_info->motor_on = 1; return SCPE_OK; }