PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).

This commit is contained in:
OBattler
2020-10-14 23:15:01 +02:00
parent 01362b3dc6
commit 795a6017d2
80 changed files with 2811 additions and 2163 deletions

View File

@@ -622,8 +622,10 @@ static void
fdc_rate(fdc_t *fdc, int drive)
{
fdc_update_rate(fdc, drive);
fdc_log("FDD %c: Setting rate: %i, %i, %i (%i, %i)\n", 0x41 + drive, fdc->drvrate[drive], fdc->rate, fdc_get_densel(fdc, drive), fdc->rwc[drive], fdc->densel_force);
// fdc_log("FDD %c: Setting rate: %i, %i, %i (%i, %i)\n", 0x41 + drive, fdc->drvrate[drive], fdc->rate, fdc_get_densel(fdc, drive), fdc->rwc[drive], fdc->densel_force);
fdc_log("FDD %c: [%i] Setting rate: %i, %i, %i (%i, %i, %i)\n", 0x41 + drive, fdc->enh_mode, fdc->drvrate[drive], fdc->rate, fdc_get_densel(fdc, drive), fdc->rwc[drive], fdc->densel_force, fdc->densel_polarity);
fdd_set_densel(fdc_get_densel(fdc, drive));
fdc_log("FDD %c: [%i] Densel: %i\n", 0x41 + drive, fdc->enh_mode, fdc_get_densel(fdc, drive));
}
@@ -657,6 +659,17 @@ fdc_bad_command(fdc_t *fdc)
static void
fdc_io_command_phase1(fdc_t *fdc, int out)
{
#if 0
int i;
pclog_toggle_suppr();
pclog("%02X ", fdc->processed_cmd);
for (i = 0; i < fdc->pnum; i++)
pclog("%02X ", fdc->params[i]);
pclog("\n");
pclog_toggle_suppr();
#endif
fdc_reset_fifo_buf(fdc);
fdc_rate(fdc, fdc->drive);
fdc->head = fdc->params[2];
@@ -831,6 +844,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc->command = val;
fdc->stat |= 0x10;
fdc_log("Starting FDC command %02X\n",fdc->command);
fdc->error = 0;
if (((fdc->command & 0x1f) == 0x02) || ((fdc->command & 0x1f) == 0x05) ||
((fdc->command & 0x1f) == 0x06) || ((fdc->command & 0x1f) == 0x0a) ||
@@ -1417,7 +1431,8 @@ fdc_read(uint16_t addr, void *priv)
default:
ret = 0xFF;
}
fdc_log("Read FDC %04X %02X\n", addr, ret);
// fdc_log("Read FDC %04X %02X\n", addr, ret);
fdc_log("[%04X:%08X] Read FDC %04X %02X [%i:%02X]\n", CS, cpu_state.pc, addr, ret, drive, fdc->dor & (0x10 << drive));
return ret;
}
@@ -1431,6 +1446,13 @@ fdc_poll_common_finish(fdc_t *fdc, int compare, int st5)
fdc->st0 = fdc->res[4] = (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->rw_drive;
fdc->res[5] = st5;
fdc->res[6] = 0;
if (fdc->error) {
fdc->error = 0;
fdc->st0 |= 0x40;
fdc->res[4] |= 0x40;
fdc->res[5] |= fdc->st5;
fdc->res[6] |= fdc->st6;
}
if (fdc->wrong_am) {
fdc->res[6] |= 0x40;
fdc->wrong_am = 0;
@@ -1770,6 +1792,7 @@ fdc_callback(void *priv)
void
fdc_error(fdc_t *fdc, int st5, int st6)
{
#if 1
timer_disable(&fdc->timer);
fdc_int(fdc, 1);
@@ -1806,6 +1829,48 @@ fdc_error(fdc_t *fdc, int st5, int st6)
}
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 0);
fdc->paramstogo = 7;
#else
switch(fdc->interrupt) {
case 0x02:
case 0x05:
case 0x06:
case 0x09:
case 0x0C:
case 0x11:
case 0x16:
case 0x19:
case 0x1D:
fdc->error = 1;
fdc->st5 = st5;
fdc->st6 = st6;
fdc->tc = 1;
fdc->stat = 0x10;
fdc_callback(fdc);
break;
default:
timer_disable(&fdc->timer);
fdc_int(fdc, 1);
if (!(fdc->flags & FDC_FLAG_PS1))
fdc->fintr = 0;
fdc->stat = 0xD0;
fdc->st0 = fdc->res[4] = 0x40 | (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->rw_drive;
if (fdc->head && !fdd_is_double_sided(real_drive(fdc, fdc->drive)))
fdc->st0 |= 0x08;
fdc->res[5] = st5;
fdc->res[6] = st6;
fdc_log("FDC Error: %02X %02X %02X\n", fdc->res[4], fdc->res[5], fdc->res[6]);
fdc->res[7]=0;
fdc->res[8]=0;
fdc->res[9]=0;
fdc->res[10]=0;
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 0);
fdc->paramstogo = 7;
break;
}
#endif
}

View File

@@ -1609,7 +1609,9 @@ d86f_read_sector_data(int drive, int side)
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
dev->error_condition = 0;
dev->state = STATE_IDLE;
if (dev->state == STATE_11_SCAN_DATA)
if (dev->state == STATE_02_READ_DATA)
fdc_track_finishread(d86f_fdc, dev->error_condition);
else if (dev->state == STATE_11_SCAN_DATA)
fdc_sector_finishcompare(d86f_fdc, (dev->satisfying_bytes == ((128 << ((uint32_t) dev->last_sector.id.n)) - 1)) ? 1 : 0);
else
fdc_sector_finishread(d86f_fdc);
@@ -2149,20 +2151,23 @@ d86f_turbo_read(int drive, int side)
dev->data_find.sync_marks = dev->data_find.bits_obtained = dev->data_find.bytes_obtained = 0;
if ((flags & SECTOR_CRC_ERROR) && (dev->state != STATE_02_READ_DATA)) {
#ifdef ENABLE_D86F_LOG
d86f_log("86F: Data CRC error in turbo mode\n");
d86f_log("86F: Data CRC error in turbo mode (%02X)\n", dev->state);
#endif
dev->error_condition = 0;
dev->state = STATE_IDLE;
fdc_finishread(d86f_fdc);
fdc_datacrcerror(d86f_fdc);
} else if ((dev->calc_crc.word != dev->track_crc.word) && (dev->state == STATE_02_READ_DATA)) {
} else if ((flags & SECTOR_CRC_ERROR) && (dev->state == STATE_02_READ_DATA)) {
#ifdef ENABLE_D86F_LOG
d86f_log("86F: Data CRC error in turbo mode at READ TRACK command\n");
#endif
dev->error_condition |= 2; /* Mark that there was a data error. */
dev->state = STATE_IDLE;
fdc_track_finishread(d86f_fdc, dev->error_condition);
} else {
/* CRC is valid. */
#ifdef ENABLE_D86F_LOG
d86f_log("86F: Data CRC OK error in turbo mode\n");
d86f_log("86F: Data CRC OK in turbo mode\n");
#endif
dev->error_condition = 0;
dev->state = STATE_IDLE;

View File

@@ -108,6 +108,7 @@ typedef struct {
static json_t *images[FDD_NUM];
#define ENABLE_JSON_LOG 1
#ifdef ENABLE_JSON_LOG
int json_do_log = ENABLE_JSON_LOG;
@@ -247,9 +248,9 @@ load_image(json_t *dev)
switch(state) {
case 0: /* read level header */
dev->dmf = 1;
if (c != '[') {
if ((c != '[') && (c != '{') && (c != '\r') && (c != '\n')) {
state = unexpect(c, state, level);
} else {
} else if (c == '[') {
if (++level == 3)
state++;
}

View File

@@ -1121,6 +1121,7 @@ td0_seek(int drive, int track)
id[1] = dev->sects[track][side][actual_sector].head;
id[2] = real_sector;
id[3] = dev->sects[track][side][actual_sector].size;
pclog("track %i, side %i, %i,%i,%i,%i %i\n", track, side, id[0], id[1], id[2], id[3], dev->sects[track][side][actual_sector].flags);
fm = dev->sects[track][side][actual_sector].fm;
if (((dev->sects[track][side][actual_sector].flags & 0x42) || (id[3] > (dev->max_sector_size - fm))) && !fdd_get_turbo(drive))
ssize = 3;