AltairZ80: More fixes from source code scan (Coverity Scan)
This commit is contained in:
parent
70a8921a7a
commit
bd575651ca
12 changed files with 208 additions and 137 deletions
|
@ -122,7 +122,7 @@ DEVICE net_dev = {
|
|||
static t_stat set_net(UNIT *uptr, int32 value, CONST char *cptr, void *desc) {
|
||||
char temp[CBUFSIZE];
|
||||
if ((net_unit.flags & UNIT_ATT) && ((net_unit.flags & UNIT_SERVER) != (uint32)value)) {
|
||||
strncpy(temp, net_unit.filename, CBUFSIZE); /* save name for later attach */
|
||||
strncpy(temp, net_unit.filename, CBUFSIZE - 1); /* save name for later attach */
|
||||
net_detach(&net_unit);
|
||||
net_unit.flags ^= UNIT_SERVER; /* now switch from client to server and vice versa */
|
||||
net_attach(uptr, temp);
|
||||
|
|
|
@ -1357,6 +1357,7 @@ static void setClockZSDOS(void) {
|
|||
newTime.tm_hour = fromBCD(GetBYTEWrapper(setClockZSDOSAdr + 3));
|
||||
newTime.tm_min = fromBCD(GetBYTEWrapper(setClockZSDOSAdr + 4));
|
||||
newTime.tm_sec = fromBCD(GetBYTEWrapper(setClockZSDOSAdr + 5));
|
||||
newTime.tm_isdst = 0;
|
||||
ClockZSDOSDelta = mktime(&newTime) - time(NULL);
|
||||
}
|
||||
|
||||
|
@ -1371,6 +1372,7 @@ static time_t mkCPM3Origin(void) {
|
|||
date.tm_hour = 0;
|
||||
date.tm_min = 0;
|
||||
date.tm_sec = 0;
|
||||
date.tm_isdst = 0;
|
||||
return mktime(&date);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ const char* m68ki_cpu_names[9] =
|
|||
"M68000",
|
||||
"M68010",
|
||||
"Invalid CPU",
|
||||
"M68EC020"
|
||||
"M68EC020",
|
||||
"Invalid CPU",
|
||||
"Invalid CPU",
|
||||
"Invalid CPU",
|
||||
|
|
|
@ -455,34 +455,38 @@ static uint8 DISK2_Write(const uint32 Addr, uint8 cData)
|
|||
" READ_DATA: cyl=%d, track=%d\n", PCX, disk2_info->cyl, pDrive->track);
|
||||
pDrive->track = disk2_info->cyl; /* update track */
|
||||
}
|
||||
sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * pDrive->nsectors * (pDrive->sectsize + 3)), SEEK_SET);
|
||||
for(i=0;i<pDrive->nsectors;i++) {
|
||||
/* Read sector */
|
||||
rtn = sim_fread(sdata.raw, 1, (pDrive->sectsize + 3), (pDrive->uptr)->fileref);
|
||||
if (rtn != (size_t)(pDrive->sectsize + 3)) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA: sim_fread error.\n", PCX);
|
||||
}
|
||||
if(sdata.u.header[2] == disk2_info->sector) {
|
||||
if(sdata.u.header[0] != disk2_info->cyl) { /*pDrive->track) { */
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA Incorrect header: track" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
if(sdata.u.header[1] != disk2_info->head) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA Incorrect header: head" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
if(sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * pDrive->nsectors * (pDrive->sectsize + 3)), SEEK_SET) == 0) {
|
||||
for(i=0;i<pDrive->nsectors;i++) {
|
||||
/* Read sector */
|
||||
rtn = sim_fread(sdata.raw, 1, (pDrive->sectsize + 3), (pDrive->uptr)->fileref);
|
||||
if (rtn != (size_t)(pDrive->sectsize + 3)) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA: sim_fread error.\n", PCX);
|
||||
}
|
||||
if(sdata.u.header[2] == disk2_info->sector) {
|
||||
if(sdata.u.header[0] != disk2_info->cyl) { /*pDrive->track) { */
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA Incorrect header: track" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
if(sdata.u.header[1] != disk2_info->head) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA Incorrect header: head" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
|
||||
selchan_dma(sdata.u.data, pDrive->sectsize);
|
||||
break;
|
||||
}
|
||||
if(i == pDrive->nsectors) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" Sector not found" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
selchan_dma(sdata.u.data, pDrive->sectsize);
|
||||
break;
|
||||
}
|
||||
if(i == pDrive->nsectors) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" Sector not found" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" READ_DATA: sim_fseek error.\n", PCX);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -498,41 +502,49 @@ static uint8 DISK2_Write(const uint32 Addr, uint8 cData)
|
|||
pDrive->track = disk2_info->cyl; /* update track */
|
||||
}
|
||||
|
||||
sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * pDrive->nsectors * (pDrive->sectsize + 3)), SEEK_SET);
|
||||
for(i=0;i<pDrive->nsectors;i++) {
|
||||
/* Read sector */
|
||||
file_offset = ftell((pDrive->uptr)->fileref);
|
||||
rtn = sim_fread(sdata.raw, 1, 3, (pDrive->uptr)->fileref);
|
||||
if (rtn != 3) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA: sim_fread error.\n", PCX);
|
||||
}
|
||||
if(sdata.u.header[2] == disk2_info->sector) {
|
||||
if(sdata.u.header[0] != disk2_info->cyl) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA Incorrect header: track" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
if(sdata.u.header[1] != disk2_info->head) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA Incorrect header: head" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
if(sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * pDrive->nsectors * (pDrive->sectsize + 3)), SEEK_SET) == 0) {
|
||||
for(i=0;i<pDrive->nsectors;i++) {
|
||||
/* Read sector */
|
||||
file_offset = ftell((pDrive->uptr)->fileref);
|
||||
rtn = sim_fread(sdata.raw, 1, 3, (pDrive->uptr)->fileref);
|
||||
if (rtn != 3) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA: sim_fread error.\n", PCX);
|
||||
}
|
||||
if(sdata.u.header[2] == disk2_info->sector) {
|
||||
if(sdata.u.header[0] != disk2_info->cyl) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA Incorrect header: track" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
if(sdata.u.header[1] != disk2_info->head) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA Incorrect header: head" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
|
||||
selchan_dma(sdata.u.data, pDrive->sectsize);
|
||||
sim_fseek((pDrive->uptr)->fileref, file_offset+3, SEEK_SET);
|
||||
sim_fwrite(sdata.u.data, 1, (pDrive->sectsize), (pDrive->uptr)->fileref);
|
||||
break;
|
||||
}
|
||||
rtn = sim_fread(sdata.raw, 1, pDrive->sectsize, (pDrive->uptr)->fileref);
|
||||
if (rtn != (size_t)(pDrive->sectsize)) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA: sim_fread error.\n", PCX);
|
||||
}
|
||||
if(i == pDrive->nsectors) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT " Sector not found" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
selchan_dma(sdata.u.data, pDrive->sectsize);
|
||||
if(sim_fseek((pDrive->uptr)->fileref, file_offset+3, SEEK_SET) == 0) {
|
||||
sim_fwrite(sdata.u.data, 1, (pDrive->sectsize), (pDrive->uptr)->fileref);
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA: sim_fseek error.\n", PCX);
|
||||
}
|
||||
break;
|
||||
}
|
||||
rtn = sim_fread(sdata.raw, 1, pDrive->sectsize, (pDrive->uptr)->fileref);
|
||||
if (rtn != (size_t)(pDrive->sectsize)) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA: sim_fread error.\n", PCX);
|
||||
}
|
||||
if(i == pDrive->nsectors) {
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT " Sector not found" NLP, PCX);
|
||||
disk2_info->timeout = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_DATA: sim_fseek error.\n", PCX);
|
||||
}
|
||||
break;
|
||||
case DISK2_CMD_WRITE_HEADER:
|
||||
|
@ -544,8 +556,12 @@ static uint8 DISK2_Write(const uint32 Addr, uint8 cData)
|
|||
|
||||
i = disk2_info->hdr_sector;
|
||||
selchan_dma(sdata.raw, 3);
|
||||
sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * (pDrive->sectsize + 3) * pDrive->nsectors) + (i * (pDrive->sectsize + 3)), SEEK_SET);
|
||||
sim_fwrite(sdata.raw, 1, 3, (pDrive->uptr)->fileref);
|
||||
if(sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * (pDrive->sectsize + 3) * pDrive->nsectors) + (i * (pDrive->sectsize + 3)), SEEK_SET) == 0) {
|
||||
sim_fwrite(sdata.raw, 1, 3, (pDrive->uptr)->fileref);
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" WRITE_HEADER Command: sim_fseek error.\n", PCX);
|
||||
}
|
||||
|
||||
disk2_info->hdr_sector++;
|
||||
if(disk2_info->hdr_sector >= pDrive->nsectors) {
|
||||
|
@ -557,14 +573,18 @@ static uint8 DISK2_Write(const uint32 Addr, uint8 cData)
|
|||
track_offset = pDrive->track * pDrive->nheads * pDrive->nsectors * (pDrive->sectsize + 3);
|
||||
sim_debug(CMD_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" READ_HEADER Command\n", PCX);
|
||||
sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * pDrive->nsectors * (pDrive->sectsize + 3)), SEEK_SET);
|
||||
rtn = sim_fread(sdata.raw, 1, 3, (pDrive->uptr)->fileref);
|
||||
if (rtn != 3) {
|
||||
if(sim_fseek((pDrive->uptr)->fileref, track_offset + (disk2_info->head_sel * pDrive->nsectors * (pDrive->sectsize + 3)), SEEK_SET) == 0) {
|
||||
rtn = sim_fread(sdata.raw, 1, 3, (pDrive->uptr)->fileref);
|
||||
if (rtn != 3) {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" READ_HEADER: sim_fread error.\n", PCX);
|
||||
}
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &disk2_dev, "DISK2: " ADDRESS_FORMAT
|
||||
" READ_HEADER: sim_fread error.\n", PCX);
|
||||
" READ_HEADER: sim_fseek error.\n", PCX);
|
||||
}
|
||||
selchan_dma(sdata.raw, 3);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
sim_printf("DISK2: " ADDRESS_FORMAT " Unknown CMD=%d" NLP, PCX, disk2_info->ctl_op);
|
||||
|
|
|
@ -546,36 +546,39 @@ static uint8 DISK3_Write(const uint32 Addr, uint8 cData)
|
|||
|
||||
dataBuffer = (uint8 *)malloc(xfr_len);
|
||||
|
||||
sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET);
|
||||
if(sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET) == 0) {
|
||||
|
||||
if(disk3_info->iopb[DISK3_IOPB_ARG1] == 1) { /* Read */
|
||||
rtn = sim_fread(dataBuffer, 1, xfr_len, (pDrive->uptr)->fileref);
|
||||
if(disk3_info->iopb[DISK3_IOPB_ARG1] == 1) { /* Read */
|
||||
rtn = sim_fread(dataBuffer, 1, xfr_len, (pDrive->uptr)->fileref);
|
||||
|
||||
sim_debug(RD_DATA_MSG, &disk3_dev, "DISK3[%d]: " ADDRESS_FORMAT
|
||||
" READ @0x%05x T:%04d/S:%04d/#:%d %s\n",
|
||||
disk3_info->sel_drive,
|
||||
PCX,
|
||||
disk3_info->dma_addr,
|
||||
pDrive->cur_track,
|
||||
pDrive->cur_sect,
|
||||
pDrive->xfr_nsects,
|
||||
rtn == (size_t)xfr_len ? "OK" : "NOK" );
|
||||
sim_debug(RD_DATA_MSG, &disk3_dev, "DISK3[%d]: " ADDRESS_FORMAT
|
||||
" READ @0x%05x T:%04d/S:%04d/#:%d %s\n",
|
||||
disk3_info->sel_drive,
|
||||
PCX,
|
||||
disk3_info->dma_addr,
|
||||
pDrive->cur_track,
|
||||
pDrive->cur_sect,
|
||||
pDrive->xfr_nsects,
|
||||
rtn == (size_t)xfr_len ? "OK" : "NOK" );
|
||||
|
||||
|
||||
/* Perform DMA Transfer */
|
||||
for(xfr_count = 0;xfr_count < xfr_len; xfr_count++) {
|
||||
PutByteDMA(disk3_info->dma_addr + xfr_count, dataBuffer[xfr_count]);
|
||||
/* Perform DMA Transfer */
|
||||
for(xfr_count = 0;xfr_count < xfr_len; xfr_count++) {
|
||||
PutByteDMA(disk3_info->dma_addr + xfr_count, dataBuffer[xfr_count]);
|
||||
}
|
||||
} else { /* Write */
|
||||
sim_debug(WR_DATA_MSG, &disk3_dev, "DISK3[%d]: " ADDRESS_FORMAT
|
||||
" WRITE @0x%05x T:%04d/S:%04d/#:%d\n", disk3_info->sel_drive, PCX, disk3_info->dma_addr, pDrive->cur_track, pDrive->cur_sect, pDrive->xfr_nsects );
|
||||
|
||||
/* Perform DMA Transfer */
|
||||
for(xfr_count = 0;xfr_count < xfr_len; xfr_count++) {
|
||||
dataBuffer[xfr_count] = GetByteDMA(disk3_info->dma_addr + xfr_count);
|
||||
}
|
||||
|
||||
sim_fwrite(dataBuffer, 1, xfr_len, (pDrive->uptr)->fileref);
|
||||
}
|
||||
} else { /* Write */
|
||||
sim_debug(WR_DATA_MSG, &disk3_dev, "DISK3[%d]: " ADDRESS_FORMAT
|
||||
" WRITE @0x%05x T:%04d/S:%04d/#:%d\n", disk3_info->sel_drive, PCX, disk3_info->dma_addr, pDrive->cur_track, pDrive->cur_sect, pDrive->xfr_nsects );
|
||||
|
||||
/* Perform DMA Transfer */
|
||||
for(xfr_count = 0;xfr_count < xfr_len; xfr_count++) {
|
||||
dataBuffer[xfr_count] = GetByteDMA(disk3_info->dma_addr + xfr_count);
|
||||
}
|
||||
|
||||
sim_fwrite(dataBuffer, 1, xfr_len, (pDrive->uptr)->fileref);
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &disk3_dev, "DISK3[%d]: " ADDRESS_FORMAT " READWRITE: sim_fseek error.\n", disk3_info->sel_drive, PCX);
|
||||
}
|
||||
|
||||
free(dataBuffer);
|
||||
|
@ -623,8 +626,11 @@ static uint8 DISK3_Write(const uint32 Addr, uint8 cData)
|
|||
fmtBuffer = (uint8 *)malloc(data_len);
|
||||
memset(fmtBuffer, disk3_info->iopb[DISK3_IOPB_ARG2], data_len);
|
||||
|
||||
sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET);
|
||||
sim_fwrite(fmtBuffer, 1, data_len, (pDrive->uptr)->fileref);
|
||||
if(sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET) == 0) {
|
||||
sim_fwrite(fmtBuffer, 1, data_len, (pDrive->uptr)->fileref);
|
||||
} else {
|
||||
sim_debug(WR_DATA_MSG, &disk3_dev, "DISK3[%d]: " ADDRESS_FORMAT " FORMAT: sim_fseek error.\n", disk3_info->sel_drive, PCX);
|
||||
}
|
||||
|
||||
free(fmtBuffer);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ static int DoDiskOperation(desc_t *dsc, uint8 val)
|
|||
}
|
||||
current_disk_flags = (fif_dev.units + current_disk) -> flags;
|
||||
if ((current_disk_flags & UNIT_ATT) == 0) { /* nothing attached? */
|
||||
if ( (current_disk_flags & UNIT_DSK_VERBOSE) && (warnAttached[current_disk] < warnLevelDSK) ) {
|
||||
if ((current_disk_flags & UNIT_DSK_VERBOSE) && (warnAttached[current_disk] < warnLevelDSK)) {
|
||||
warnAttached[current_disk]++;
|
||||
/*02*/sim_printf("FIF%i: " ADDRESS_FORMAT " Attempt to select unattached FIF%d - ignored." NLP, current_disk, PCX, current_disk);
|
||||
}
|
||||
|
@ -245,20 +245,26 @@ static int DoDiskOperation(desc_t *dsc, uint8 val)
|
|||
/*Sleep(250); */
|
||||
memset(blanksec, 0, SEC_SZ);
|
||||
addr = dsc->track * SPT;
|
||||
sim_fseek(cpx, addr * SEC_SZ, SEEK_SET);
|
||||
|
||||
/* write a track worth of sectors */
|
||||
for (kt=0; kt < SPT; kt++) {
|
||||
sim_fwrite(blanksec, 1, sizeof(blanksec), cpx);
|
||||
if (sim_fseek(cpx, addr * SEC_SZ, SEEK_SET) == 0) {
|
||||
/* write a track worth of sectors */
|
||||
for (kt=0; kt < SPT; kt++) {
|
||||
sim_fwrite(blanksec, 1, sizeof(blanksec), cpx);
|
||||
}
|
||||
} else {
|
||||
if ((current_disk_flags & UNIT_DSK_VERBOSE) &&
|
||||
(warnAttached[current_disk] < warnLevelDSK)) {
|
||||
warnAttached[current_disk]++;
|
||||
sim_printf("FIF%i: " ADDRESS_FORMAT " sim_fseek error." NLP, current_disk, PCX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case READ_SEC:
|
||||
addr = (dsc->track * SPT) + dsc->sector - 1;
|
||||
sim_fseek(cpx, addr * SEC_SZ, SEEK_SET);
|
||||
if (sim_fseek(cpx, addr * SEC_SZ, SEEK_SET) == 0) {
|
||||
rtn = sim_fread(blanksec, 1, SEC_SZ, cpx);
|
||||
if ( (rtn != SEC_SZ) && (current_disk_flags & UNIT_DSK_VERBOSE) &&
|
||||
(warnAttached[current_disk] < warnLevelDSK) ) {
|
||||
if ((rtn != SEC_SZ) && (current_disk_flags & UNIT_DSK_VERBOSE) &&
|
||||
(warnAttached[current_disk] < warnLevelDSK)) {
|
||||
warnAttached[current_disk]++;
|
||||
sim_printf("FIF%i: " ADDRESS_FORMAT " sim_fread error." NLP, current_disk, PCX);
|
||||
}
|
||||
|
@ -266,16 +272,30 @@ static int DoDiskOperation(desc_t *dsc, uint8 val)
|
|||
for (kt = 0; kt < SEC_SZ; kt++) {
|
||||
PutBYTEWrapper(addr++, blanksec[kt]);
|
||||
}
|
||||
} else {
|
||||
if ((current_disk_flags & UNIT_DSK_VERBOSE) &&
|
||||
(warnAttached[current_disk] < warnLevelDSK)) {
|
||||
warnAttached[current_disk]++;
|
||||
sim_printf("FIF%i: " ADDRESS_FORMAT " sim_fseek error." NLP, current_disk, PCX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WRITE_SEC:
|
||||
addr = (dsc->track * SPT) + dsc->sector - 1;
|
||||
sim_fseek(cpx, addr * SEC_SZ, SEEK_SET);
|
||||
if (sim_fseek(cpx, addr * SEC_SZ, SEEK_SET) == 0) {
|
||||
addr = dsc->addr_l + (dsc->addr_h << 8); /* no assumption on endianness */
|
||||
for (kt = 0; kt < SEC_SZ; kt++) {
|
||||
blanksec[kt] = GetBYTEWrapper(addr++);
|
||||
}
|
||||
sim_fwrite(blanksec, 1, SEC_SZ, cpx);
|
||||
} else {
|
||||
if ((current_disk_flags & UNIT_DSK_VERBOSE) &&
|
||||
(warnAttached[current_disk] < warnLevelDSK)) {
|
||||
warnAttached[current_disk]++;
|
||||
sim_printf("FIF%i: " ADDRESS_FORMAT " sim_fseek error." NLP, current_disk, PCX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -361,7 +361,7 @@ static uint8 HDC1001_Write(const uint32 Addr, uint8 cData)
|
|||
|
||||
switch(Addr & 0x07) {
|
||||
case TF_SDH:
|
||||
hdc1001_info->sel_drive = (cData >> 3) & 0x03;
|
||||
hdc1001_info->sel_drive = (cData >> 3) & 0x03; /* intentional fallthrough */
|
||||
case TF_DATA:
|
||||
case TF_ERROR:
|
||||
case TF_SECNT:
|
||||
|
|
|
@ -411,8 +411,11 @@ static uint8 MDSA_Read(const uint32 Addr)
|
|||
if(pDrive->uptr->fileref == NULL) {
|
||||
printf(".fileref is NULL!" NLP);
|
||||
} else {
|
||||
sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET);
|
||||
sim_fwrite(sdata.u.data, 1, MDSA_SECTOR_LEN, (pDrive->uptr)->fileref);
|
||||
if (sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET) == 0) {
|
||||
sim_fwrite(sdata.u.data, 1, MDSA_SECTOR_LEN, (pDrive->uptr)->fileref);
|
||||
} else {
|
||||
printf("%s: sim_fseek error" NLP, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IMAGE_TYPE_CPT:
|
||||
|
@ -455,12 +458,16 @@ static uint8 MDSA_Read(const uint32 Addr)
|
|||
printf(".fileref is NULL!" NLP);
|
||||
}
|
||||
else {
|
||||
sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET);
|
||||
rtn = sim_fread(&sdata.u.data[0], 1, MDSA_SECTOR_LEN,
|
||||
(pDrive->uptr)->fileref);
|
||||
if (rtn != MDSA_SECTOR_LEN) {
|
||||
if (sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET) == 0) {
|
||||
rtn = sim_fread(&sdata.u.data[0], 1, MDSA_SECTOR_LEN,
|
||||
(pDrive->uptr)->fileref);
|
||||
if (rtn != MDSA_SECTOR_LEN) {
|
||||
sim_debug(ERROR_MSG, &mdsa_dev, "MDSA: " ADDRESS_FORMAT
|
||||
" READ: sim_fread error.\n", PCX);
|
||||
}
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &mdsa_dev, "MDSA: " ADDRESS_FORMAT
|
||||
" READ: sim_fread error.\n", PCX);
|
||||
" READ: sim_fseek error.\n", PCX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -499,9 +499,12 @@ static uint8 MDSAD_Read(const uint32 Addr)
|
|||
if(pDrive->uptr->fileref == NULL) {
|
||||
sim_printf(".fileref is NULL!" NLP);
|
||||
} else {
|
||||
sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET);
|
||||
sim_fwrite(sdata.u.data, 1, MDSAD_SECTOR_LEN,
|
||||
(pDrive->uptr)->fileref);
|
||||
if (sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET) == 0) {
|
||||
sim_fwrite(sdata.u.data, 1, MDSAD_SECTOR_LEN,
|
||||
(pDrive->uptr)->fileref);
|
||||
} else {
|
||||
sim_printf("%s: sim_fseek error" NLP, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IMAGE_TYPE_CPT:
|
||||
|
@ -733,13 +736,17 @@ static uint8 MDSAD_Read(const uint32 Addr)
|
|||
if(pDrive->uptr->fileref == NULL) {
|
||||
sim_printf(".fileref is NULL!" NLP);
|
||||
} else {
|
||||
sim_fseek((pDrive->uptr)->fileref,
|
||||
sec_offset, SEEK_SET);
|
||||
rtn = sim_fread(&sdata.u.data[0], 1, MDSAD_SECTOR_LEN,
|
||||
(pDrive->uptr)->fileref);
|
||||
if (rtn != MDSAD_SECTOR_LEN) {
|
||||
if (sim_fseek((pDrive->uptr)->fileref,
|
||||
sec_offset, SEEK_SET) == 0) {
|
||||
rtn = sim_fread(&sdata.u.data[0], 1, MDSAD_SECTOR_LEN,
|
||||
(pDrive->uptr)->fileref);
|
||||
if (rtn != MDSAD_SECTOR_LEN) {
|
||||
sim_debug(ERROR_MSG, &mdsad_dev, "MDSAD: " ADDRESS_FORMAT
|
||||
" READ: sim_fread error.\n", PCX);
|
||||
}
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &mdsad_dev, "MDSAD: " ADDRESS_FORMAT
|
||||
" READ: sim_fread error.\n", PCX);
|
||||
" READ: sim_fseek error.\n", PCX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -304,7 +304,7 @@ static uint8 SS1_Read(const uint32 Addr)
|
|||
|
||||
switch(Addr & 0x0F) {
|
||||
case SS1_S8259_L:
|
||||
sel_pic = SLAVE_PIC;
|
||||
sel_pic = SLAVE_PIC; /* intentional fallthrough */
|
||||
case SS1_M8259_L:
|
||||
if((ss1_pic[sel_pic].OCW3 & 0x03) == 0x03) {
|
||||
cData = ss1_pic[sel_pic].ISR;
|
||||
|
@ -319,7 +319,7 @@ static uint8 SS1_Read(const uint32 Addr)
|
|||
}
|
||||
break;
|
||||
case SS1_S8259_H:
|
||||
sel_pic = SLAVE_PIC;
|
||||
sel_pic = SLAVE_PIC; /* intentional fallthrough */
|
||||
case SS1_M8259_H:
|
||||
cData = ss1_pic[sel_pic].IMR;
|
||||
sim_debug(PIC_MSG, &ss1_dev, "SS1: " ADDRESS_FORMAT
|
||||
|
@ -437,7 +437,7 @@ static uint8 SS1_Write(const uint32 Addr, uint8 cData)
|
|||
|
||||
switch(Addr & 0x0F) {
|
||||
case SS1_S8259_L:
|
||||
sel_pic = SLAVE_PIC;
|
||||
sel_pic = SLAVE_PIC; /* intentional falltrough */
|
||||
case SS1_M8259_L:
|
||||
if(cData & 0x10) {
|
||||
sim_debug(PIC_MSG, &ss1_dev, "SS1: " ADDRESS_FORMAT
|
||||
|
@ -457,7 +457,7 @@ static uint8 SS1_Write(const uint32 Addr, uint8 cData)
|
|||
}
|
||||
break;
|
||||
case SS1_S8259_H:
|
||||
sel_pic = SLAVE_PIC;
|
||||
sel_pic = SLAVE_PIC; /* intentional fallthrough */
|
||||
case SS1_M8259_H:
|
||||
if(ss1_pic[sel_pic].config_cnt == 0) {
|
||||
sim_debug(PIC_MSG, &ss1_dev, "SS1: " ADDRESS_FORMAT " WR: %s PIC IMR=0x%02x.\n", PCX, (sel_pic ? "Slave " : "Master"), cData);
|
||||
|
|
|
@ -233,7 +233,7 @@ static t_stat vfdhd_attach(UNIT *uptr, CONST char *cptr)
|
|||
unsigned int i = 0;
|
||||
|
||||
r = attach_unit(uptr, cptr); /* attach unit */
|
||||
if ( r != SCPE_OK) /* error? */
|
||||
if(r != SCPE_OK) /* error? */
|
||||
return r;
|
||||
|
||||
/* Determine length of this disk */
|
||||
|
@ -248,6 +248,9 @@ static t_stat vfdhd_attach(UNIT *uptr, CONST char *cptr)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(i == VFDHD_MAX_DRIVES) {
|
||||
return (SCPE_IERR);
|
||||
}
|
||||
|
||||
if(uptr->capac > 0) {
|
||||
r = assignDiskType(uptr);
|
||||
|
@ -331,6 +334,9 @@ static t_stat vfdhd_detach(UNIT *uptr)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(i == VFDHD_MAX_DRIVES) {
|
||||
return (SCPE_IERR);
|
||||
}
|
||||
|
||||
DBG_PRINT(("Detach VFDHD%d\n", i));
|
||||
r = diskClose(&vfdhd_info->drive[i].imd);
|
||||
|
@ -582,8 +588,7 @@ static void VFDHD_Command(void)
|
|||
case IMAGE_TYPE_DSK:
|
||||
if(pDrive->uptr->fileref == NULL) {
|
||||
sim_printf(".fileref is NULL!" NLP);
|
||||
} else {
|
||||
sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET);
|
||||
} else if(sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET) == 0) {
|
||||
rtn = sim_fread(&sdata.u.sync, 1, 274, /*VFDHD_SECTOR_LEN,*/ (pDrive->uptr)->fileref);
|
||||
if (rtn != 274) {
|
||||
sim_debug(ERROR_MSG, &vfdhd_dev, "VFDHD: " ADDRESS_FORMAT " READ: sim_fread error.\n", PCX);
|
||||
|
@ -596,7 +601,8 @@ static void VFDHD_Command(void)
|
|||
}
|
||||
|
||||
DBG_PRINT(("VFDHD: " ADDRESS_FORMAT " READ: Sync found at offset %d" NLP, PCX, vfdhd_info->datacount));
|
||||
|
||||
} else {
|
||||
sim_debug(ERROR_MSG, &vfdhd_dev, "VFDHD: " ADDRESS_FORMAT " READ: sim_fseek error.\n", PCX);
|
||||
}
|
||||
break;
|
||||
case IMAGE_TYPE_CPT:
|
||||
|
@ -641,17 +647,20 @@ static void VFDHD_Command(void)
|
|||
sim_printf(".fileref is NULL!" NLP);
|
||||
} else {
|
||||
DBG_PRINT(("VFDHD: " ADDRESS_FORMAT " WR drive=%d, track=%d, head=%d, sector=%d" NLP,
|
||||
PCX,
|
||||
vfdhd_info->sel_drive,
|
||||
pDrive->track,
|
||||
vfdhd_info->head,
|
||||
vfdhd_info->sector));
|
||||
sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET);
|
||||
PCX,
|
||||
vfdhd_info->sel_drive,
|
||||
pDrive->track,
|
||||
vfdhd_info->head,
|
||||
vfdhd_info->sector));
|
||||
if(sim_fseek((pDrive->uptr)->fileref, sec_offset, SEEK_SET) == 0) {
|
||||
#ifdef USE_VGI
|
||||
sim_fwrite(&sdata.u.sync, 1, VFDHD_SECTOR_LEN, (pDrive->uptr)->fileref);
|
||||
sim_fwrite(&sdata.u.sync, 1, VFDHD_SECTOR_LEN, (pDrive->uptr)->fileref);
|
||||
#else
|
||||
sim_fwrite(sdata.u.data, 1, 256, (pDrive->uptr)->fileref);
|
||||
sim_fwrite(sdata.u.data, 1, 256, (pDrive->uptr)->fileref);
|
||||
#endif /* USE_VGI */
|
||||
} else {
|
||||
sim_printf("%s: sim_fseek error" NLP, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IMAGE_TYPE_CPT:
|
||||
|
|
|
@ -1112,7 +1112,7 @@ uint8 WD179X_Write(const uint32 Addr, uint8 cData)
|
|||
" FORMAT T:%d/H:%d/N:%d=%d/L=%d[%d] Fill=0x%02x\n", PCX,
|
||||
pDrive->track, wd179x_info->fdc_head,
|
||||
wd179x_info->fdc_fmt_sector_count,
|
||||
wd179x_info->fdc_sectormap[wd179x_info->fdc_fmt_sector_count],
|
||||
wd179x_info->fdc_sectormap[wd179x_info->fdc_fmt_sector_count - 1],
|
||||
wd179x_info->fdc_dataindex, wd179x_info->fdc_sec_len, sdata.raw[0]);
|
||||
|
||||
wd179x_info->fdc_gap[1] = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue