diff --git a/src/808x.c b/src/808x.c index 20f6e3b93..dd7228ed6 100644 --- a/src/808x.c +++ b/src/808x.c @@ -662,6 +662,7 @@ void resetx86() codegen_reset(); x86_was_reset = 1; port_92_clear_reset(); + BuslogicSoftReset(); } void softresetx86() @@ -685,6 +686,7 @@ void softresetx86() x86seg_reset(); x86_was_reset = 1; port_92_clear_reset(); + BuslogicSoftReset(); } static void setznp8(uint8_t val) diff --git a/src/Makefile.mingw b/src/Makefile.mingw index fdafe9849..9ac7152bc 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -33,8 +33,8 @@ LIBS = -mwindows -lwinmm -lopenal.dll -lopenal -lddraw -ldinput8 -ldxguid -ld3d9 86Box.exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) $(CC) $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) -o "86Box.exe" $(LIBS) sleep 10 - strip "86Box.exe" - sleep 10 +strip "86Box.exe" +sleep 10 all : 86Box.exe diff --git a/src/buslogic.c b/src/buslogic.c index 9248c636d..b45ea65e3 100644 --- a/src/buslogic.c +++ b/src/buslogic.c @@ -29,6 +29,8 @@ #include "buslogic.h" +#define BUSLOGIC_RESET_DURATION_NS UINT64_C(50000000) + typedef struct __attribute__((packed)) { uint8_t hi; @@ -531,7 +533,9 @@ typedef struct __attribute__((packed)) Buslogic_t int scsi_model = 1; +int BuslogicResetCallback = 0; int BuslogicCallback = 0; + int BuslogicInOperation = 0; /** Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */ @@ -621,9 +625,12 @@ static void BuslogicLocalRam(Buslogic_t *Buslogic) /** @todo calculate checksum? */ } +static Buslogic_t *BuslogicResetDevice; + static void BuslogicReset(Buslogic_t *Buslogic) { BuslogicCallback = 0; + BuslogicResetCallback = 0; Buslogic->Status = STAT_IDLE | STAT_INIT; Buslogic->Geometry = 0x80; Buslogic->Command = 0xFF; @@ -644,6 +651,14 @@ static void BuslogicReset(Buslogic_t *Buslogic) BuslogicLocalRam(Buslogic); } +void BuslogicSoftReset() +{ + if (BuslogicResetDevice != NULL) + { + BuslogicReset(BuslogicResetDevice); + } +} + static void BuslogicResetControl(Buslogic_t *Buslogic, uint8_t Reset) { BuslogicReset(Buslogic); @@ -652,6 +667,7 @@ static void BuslogicResetControl(Buslogic_t *Buslogic, uint8_t Reset) Buslogic->Status |= STAT_STST; Buslogic->Status &= ~STAT_IDLE; } + BuslogicResetCallback = BUSLOGIC_RESET_DURATION_NS * TIMER_USEC; } static void BuslogicCommandComplete(Buslogic_t *Buslogic) @@ -1056,12 +1072,19 @@ uint8_t BuslogicRead(uint16_t Port, void *p) { case 0: Temp = Buslogic->Status; +#if 0 if (Buslogic->Status & STAT_STST) { Buslogic->Status &= ~STAT_STST; Buslogic->Status |= STAT_IDLE; - Temp = Buslogic->Status; + + if (BuslogicResetCallback <= 0) + { + Temp = Buslogic->Status; + BuslogicResetCallback; + } } +#endif break; case 1: @@ -1246,6 +1269,9 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p) break; case 0x8C: + Buslogic->CmdParamLeft = scsi_model ? 1 : 0; + break; + case 0x95: //Valid only for PCI Buslogic->CmdParamLeft = BuslogicIsPCI() ? 1 : 0; break; @@ -1336,7 +1362,7 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p) case 0x0A: memset(Buslogic->DataBuf, 0, 8); - for (i = 0; i < 6; i++) + for (i = 0; i < 7; i++) { for (j = 0; j < 8; j++) { @@ -1646,14 +1672,12 @@ void BuslogicWrite(uint16_t Port, uint8_t Val, void *p) break; case 0x8C: - if (BuslogicIsPCI()) + // if (BuslogicIsPCI()) + if (scsi_model) { int i = 0; Buslogic->DataReplyLeft = Buslogic->CmdBuf[0]; - for (i = 0; i < Buslogic->DataReplyLeft; i++) - { - Buslogic->DataBuf[0] = 0; - } + memset(Buslogic->DataBuf, 0, Buslogic->DataReplyLeft); } else { @@ -2156,6 +2180,16 @@ static int BuslogicProcessMailbox(Buslogic_t *Buslogic) return ret; } +void BuslogicResetPoll(void *p) +{ + Buslogic_t *Buslogic = (Buslogic_t *)p; + + Buslogic->Status &= ~STAT_STST; + Buslogic->Status |= STAT_IDLE; + + BuslogicResetCallback = 0; +} + void BuslogicCommandCallback(void *p) { Buslogic_t *Buslogic = (Buslogic_t *)p; @@ -2169,7 +2203,7 @@ void BuslogicCommandCallback(void *p) if (BuslogicInOperation == 0) { - BuslogicLog("BusLogic Callback: Start outgoing mailbox\n"); + // BuslogicLog("BusLogic Callback: Start outgoing mailbox\n"); if (Buslogic->MailboxCount) { ret = BuslogicProcessMailbox(Buslogic); @@ -2395,6 +2429,8 @@ void *BuslogicInit() Buslogic_t *Buslogic = malloc(sizeof(Buslogic_t)); memset(Buslogic, 0, sizeof(Buslogic_t)); + BuslogicResetDevice = Buslogic; + scsi_model = device_get_config_int("model"); Buslogic->Base = device_get_config_int("addr"); Buslogic->PCIBase = 0; @@ -2406,10 +2442,11 @@ void *BuslogicInit() { if (BuslogicIsPCI()) { + io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); } else { - io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, BuslogicReadL, BuslogicWrite, BuslogicWriteW, BuslogicWriteL, Buslogic); + io_sethandler(Buslogic->Base, 0x0004, BuslogicRead, BuslogicReadW, NULL, BuslogicWrite, BuslogicWriteW, NULL, Buslogic); } } @@ -2424,6 +2461,7 @@ void *BuslogicInit() } } + timer_add(BuslogicResetPoll, &BuslogicResetCallback, &BuslogicResetCallback, Buslogic); timer_add(BuslogicCommandCallback, &BuslogicCallback, &BuslogicCallback, Buslogic); if (BuslogicIsPCI()) @@ -2455,6 +2493,7 @@ void BuslogicClose(void *p) { Buslogic_t *Buslogic = (Buslogic_t *)p; free(Buslogic); + BuslogicResetDevice = NULL; } static device_config_t BuslogicConfig[] = diff --git a/src/cdrom.c b/src/cdrom.c index 93fc0b85c..fdfd6cd65 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -2585,6 +2585,10 @@ void cdrom_command(uint8_t id, uint8_t *cdb) break; case GPCMD_INQUIRY: + max_len = cdb[3]; + max_len <<= 8; + max_len |= cdb[4]; + if (cdb[1] & 1) { preamble_len = 4; @@ -2658,7 +2662,7 @@ atapi_out: cdbufferb[size_idx] = idx - preamble_len; len=idx; - cdrom_data_command_finish(id, len, len, cdb[4], 0); + cdrom_data_command_finish(id, len, len, max_len, 0); break; case GPCMD_PREVENT_REMOVAL: diff --git a/src/disc.c b/src/disc.c index ed3d7d1d2..e5d202775 100644 --- a/src/disc.c +++ b/src/disc.c @@ -83,6 +83,7 @@ loaders[]= {"CQM", img_load, img_close, -1}, {"DSK", img_load, img_close, -1}, {"FDI", fdi_load, fdi_close, -1}, + {"FDF", img_load, img_close, -1}, {"FLP", img_load, img_close, -1}, {"HDM", img_load, img_close, -1}, {"IMA", img_load, img_close, -1}, diff --git a/src/disc_img.c b/src/disc_img.c index f7b88e882..5bbe87526 100644 --- a/src/disc_img.c +++ b/src/disc_img.c @@ -29,8 +29,9 @@ static struct uint16_t sector_pos[2][256]; uint8_t current_sector_pos_side; uint16_t current_sector_pos; - uint8_t *cqm_data; + uint8_t *disk_data; uint8_t is_cqm; + uint8_t disk_at_once; uint8_t interleave; uint8_t skew; } img[FDD_NUM]; @@ -225,10 +226,15 @@ int first_byte_is_valid(uint8_t first_byte) } } +double bit_rate_300; + +char ext[4]; + +uint8_t first_byte, second_byte, third_byte, fourth_byte; + void img_load(int drive, char *fn) { int size; - double bit_rate_300; uint16_t bpb_bps; uint16_t bpb_total; uint8_t bpb_mid; /* Media type ID. */ @@ -237,14 +243,17 @@ void img_load(int drive, char *fn) uint32_t bpt; uint8_t max_spt; /* Used for XDF detection. */ int temp_rate; - char ext[4]; - int fdi, cqm; + uint8_t fdi, cqm, fdf; int i; - uint8_t first_byte, second_byte; uint16_t comment_len = 0; int16_t block_len = 0; uint32_t cur_pos = 0; uint8_t rep_byte = 0; + uint8_t run = 0; + uint8_t real_run = 0; + uint8_t *bpos; + uint16_t track_bytes = 0; + uint8_t *literal; ext[0] = fn[strlen(fn) - 3] | 0x60; ext[1] = fn[strlen(fn) - 2] | 0x60; @@ -291,22 +300,218 @@ void img_load(int drive, char *fn) fseek(img[drive].f, 0x18, SEEK_SET); bpb_sides = fgetc(img[drive].f); + fseek(img[drive].f, img[drive].base, SEEK_SET); + first_byte = fgetc(img[drive].f); + fdi = 1; cqm = 0; + img[drive].disk_at_once = 0; + fdf = 0; } else { - /* Read the first type bytes. */ + /* Read the first four bytes. */ fseek(img[drive].f, 0x00, SEEK_SET); first_byte = fgetc(img[drive].f); fseek(img[drive].f, 0x01, SEEK_SET); second_byte = fgetc(img[drive].f); + fseek(img[drive].f, 0x02, SEEK_SET); + third_byte = fgetc(img[drive].f); + fseek(img[drive].f, 0x03, SEEK_SET); + fourth_byte = fgetc(img[drive].f); + + if ((first_byte == 0x1A) && (second_byte == 'F') && (third_byte == 'D') && (fourth_byte == 'F')) + { + /* This is a FDF image. */ + pclog("img_load(): File is a FDF image...\n"); + fwriteprot[drive] = writeprot[drive] = 1; + fclose(img[drive].f); + img[drive].f = fopen(fn, "rb"); + + fdf = 1; + + cqm = 0; + img[drive].disk_at_once = 1; + + fseek(img[drive].f, 0x50, SEEK_SET); + fread(&img[drive].tracks, 1, 4, img[drive].f); + + /* Decode the entire file - pass 1, no write to buffer, determine length. */ + fseek(img[drive].f, 0x80, SEEK_SET); + size = 0; + track_bytes = 0; + bpos = img[drive].disk_data; + while(!feof(img[drive].f)) + { + if (!track_bytes) + { + /* Skip first 3 bytes - their meaning is unknown to us but could be a checksum. */ + first_byte = fgetc(img[drive].f); + fread(&track_bytes, 1, 2, img[drive].f); + pclog("Block header: %02X %04X ", first_byte, track_bytes); + /* Read the length of encoded data block. */ + fread(&track_bytes, 1, 2, img[drive].f); + pclog("%04X\n", track_bytes); + } + + if (feof(img[drive].f)) + { + break; + } + + if (first_byte == 0xFF) + { + break; + } + + if (first_byte) + { + run = fgetc(img[drive].f); + + /* I *HAVE* to read something because fseek tries to be smart and never hits EOF, causing an infinite loop. */ + track_bytes--; + + if (run & 0x80) + { + /* Repeat. */ + track_bytes--; + rep_byte = fgetc(img[drive].f); + } + else + { + /* Literal. */ + track_bytes -= (run & 0x7f); + literal = (uint8_t *) malloc(run & 0x7f); + fread(literal, 1, (run & 0x7f), img[drive].f); + free(literal); + } + size += (run & 0x7f); + if (!track_bytes) + { + size--; + } + } + else + { + /* Literal block. */ + size += (track_bytes - 1); + literal = (uint8_t *) malloc(track_bytes); + fread(literal, 1, track_bytes, img[drive].f); + free(literal); + track_bytes = 0; + } + + if (feof(img[drive].f)) + { + break; + } + } + + /* Allocate the buffer. */ + img[drive].disk_data = (uint8_t *) malloc(size); + + /* Decode the entire file - pass 2, write to buffer. */ + fseek(img[drive].f, 0x80, SEEK_SET); + track_bytes = 0; + bpos = img[drive].disk_data; + while(!feof(img[drive].f)) + { + if (!track_bytes) + { + /* Skip first 3 bytes - their meaning is unknown to us but could be a checksum. */ + first_byte = fgetc(img[drive].f); + fread(&track_bytes, 1, 2, img[drive].f); + pclog("Block header: %02X %04X ", first_byte, track_bytes); + /* Read the length of encoded data block. */ + fread(&track_bytes, 1, 2, img[drive].f); + pclog("%04X\n", track_bytes); + } + + if (feof(img[drive].f)) + { + break; + } + + if (first_byte == 0xFF) + { + break; + } + + if (first_byte) + { + run = fgetc(img[drive].f); + real_run = (run & 0x7f); + + /* I *HAVE* to read something because fseek tries to be smart and never hits EOF, causing an infinite loop. */ + track_bytes--; + + if (run & 0x80) + { + /* Repeat. */ + track_bytes--; + if (!track_bytes) + { + real_run--; + } + rep_byte = fgetc(img[drive].f); + if (real_run) + { + memset(bpos, rep_byte, real_run); + } + } + else + { + /* Literal. */ + track_bytes -= real_run; + literal = (uint8_t *) malloc(real_run); + fread(literal, 1, real_run, img[drive].f); + if (!track_bytes) + { + real_run--; + } + if (run & 0x7f) + { + memcpy(bpos, literal, real_run); + } + free(literal); + } + bpos += real_run; + } + else + { + /* Literal block. */ + literal = (uint8_t *) malloc(track_bytes); + fread(literal, 1, track_bytes, img[drive].f); + memcpy(bpos, literal, track_bytes - 1); + free(literal); + bpos += (track_bytes - 1); + track_bytes = 0; + } + + if (feof(img[drive].f)) + { + break; + } + } + + first_byte = *img[drive].disk_data; + + bpb_bps = *(uint16_t *) (img[drive].disk_data + 0x0B); + bpb_total = *(uint16_t *) (img[drive].disk_data + 0x13); + bpb_mid = *(img[drive].disk_data + 0x15); + bpb_sectors = *(img[drive].disk_data + 0x18); + bpb_sides = *(img[drive].disk_data + 0x1A); + + /* Jump ahead to determine the image's geometry and finish the loading. */ + goto jump_if_fdf; + } if (((first_byte == 'C') && (second_byte == 'Q')) || ((first_byte == 'c') && (second_byte == 'q'))) { pclog("img_load(): File is a CopyQM image...\n"); - fwriteprot[drive] = writeprot[drive] = 1; + fclose(img[drive].f); + img[drive].f = fopen(fn, "rb"); fseek(img[drive].f, 0x03, SEEK_SET); fread(&bpb_bps, 1, 2, img[drive].f); @@ -326,8 +531,8 @@ void img_load(int drive, char *fn) fseek(img[drive].f, 0x76, SEEK_SET); img[drive].skew = fgetc(img[drive].f); - img[drive].cqm_data = (uint8_t *) malloc(((uint32_t) bpb_total) * ((uint32_t) bpb_bps)); - memset(img[drive].cqm_data, 0xf6, ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)); + img[drive].disk_data = (uint8_t *) malloc(((uint32_t) bpb_total) * ((uint32_t) bpb_bps)); + memset(img[drive].disk_data, 0xf6, ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)); fseek(img[drive].f, 0x6F, SEEK_SET); fread(&comment_len, 1, 2, img[drive].f); @@ -352,12 +557,12 @@ void img_load(int drive, char *fn) if ((cur_pos + block_len) > ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)) { block_len = ((uint32_t) bpb_total) * ((uint32_t) bpb_bps) - cur_pos; - memset(img[drive].cqm_data + cur_pos, rep_byte, block_len); + memset(img[drive].disk_data + cur_pos, rep_byte, block_len); break; } else { - memset(img[drive].cqm_data + cur_pos, rep_byte, block_len); + memset(img[drive].disk_data + cur_pos, rep_byte, block_len); cur_pos += block_len; } } @@ -366,12 +571,12 @@ void img_load(int drive, char *fn) if ((cur_pos + block_len) > ((uint32_t) bpb_total) * ((uint32_t) bpb_bps)) { block_len = ((uint32_t) bpb_total) * ((uint32_t) bpb_bps) - cur_pos; - fread(img[drive].cqm_data + cur_pos, 1, block_len, img[drive].f); + fread(img[drive].disk_data + cur_pos, 1, block_len, img[drive].f); break; } else { - fread(img[drive].cqm_data + cur_pos, 1, block_len, img[drive].f); + fread(img[drive].disk_data + cur_pos, 1, block_len, img[drive].f); cur_pos += block_len; } } @@ -380,9 +585,13 @@ void img_load(int drive, char *fn) printf("Finished reading CopyQM image data\n"); cqm = 1; + img[drive].disk_at_once = 1; + fdf = 0; + first_byte = *img[drive].disk_data; } else { + img[drive].disk_at_once = 0; /* Read the BPB */ pclog("img_load(): File is a raw image...\n"); fseek(img[drive].f, 0x0B, SEEK_SET); @@ -399,11 +608,12 @@ void img_load(int drive, char *fn) cqm = 0; } - img[drive].base = 0; - fdi = 0; - fseek(img[drive].f, -1, SEEK_END); size = ftell(img[drive].f) + 1; + +jump_if_fdf: + img[drive].base = 0; + fdi = 0; } img[drive].sides = 2; @@ -432,7 +642,7 @@ void img_load(int drive, char *fn) else if (size <= (1120*1024)) { img[drive].sectors = 14; img[drive].tracks = 80; } /*Double density*/ else if (size <= 1228800) { img[drive].sectors = 15; img[drive].tracks = 80; } /*High density 1.2MB*/ else if (size <= 1261568) { img[drive].sectors = 8; img[drive].tracks = 77; img[drive].sector_size = 3; } /*High density 1.25MB Japanese format*/ - else if (size <= (0x1A4000-1)) { img[drive].sectors = 18; img[drive].tracks = 80; } /*High density (not supported by Tandy 1000)*/ + else if (size <= 1474560) { img[drive].sectors = 18; img[drive].tracks = 80; } /*High density (not supported by Tandy 1000)*/ else if (size <= 1556480) { img[drive].sectors = 19; img[drive].tracks = 80; } /*High density (not supported by Tandy 1000)*/ else if (size <= 1638400) { img[drive].sectors = 10; img[drive].tracks = 80; img[drive].sector_size = 3; } /*High density (not supported by Tandy 1000)*/ else if (size <= 1720320) { img[drive].sectors = 21; img[drive].tracks = 80; } /*DMF format - used by Windows 95 */ @@ -467,7 +677,7 @@ void img_load(int drive, char *fn) } else { - if (!cqm) + if (!cqm && !fdf) { /* Number of tracks = number of total sectors divided by sides times sectors per track. */ img[drive].tracks = ((uint32_t) bpb_total) / (((uint32_t) bpb_sides) * ((uint32_t) bpb_sectors)); @@ -552,9 +762,10 @@ void img_close(int drive) d86f_unregister(drive); if (img[drive].f) fclose(img[drive].f); - if (img[drive].cqm_data) - free(img[drive].cqm_data); + if (img[drive].disk_data) + free(img[drive].disk_data); img[drive].f = NULL; + img[drive].disk_data = NULL; } #define xdf_img_sector xdf_img_layout[current_xdft][!is_t0][sector] @@ -602,18 +813,18 @@ void img_seek(int drive, int track) is_t0 = (track == 0) ? 1 : 0; - if (!img[drive].is_cqm) + if (!img[drive].disk_at_once) { fseek(img[drive].f, img[drive].base + (track * img[drive].sectors * ssize * img[drive].sides), SEEK_SET); } for (side = 0; side < img[drive].sides; side++) { - if (img[drive].is_cqm) + if (img[drive].disk_at_once) { cur_pos = (track * img[drive].sectors * ssize * img[drive].sides) + (side * img[drive].sectors * ssize); // pclog("Current position: %i... ", cur_pos); - memcpy(img[drive].track_data[side], img[drive].cqm_data + cur_pos, img[drive].sectors * ssize); + memcpy(img[drive].track_data[side], img[drive].disk_data + cur_pos, img[drive].sectors * ssize); // pclog("done!\n"); } else @@ -753,7 +964,7 @@ void img_writeback(int drive) if (!img[drive].f) return; - if (img[drive].is_cqm) + if (img[drive].disk_at_once) return; fseek(img[drive].f, img[drive].base + (img[drive].track * img[drive].sectors * ssize * img[drive].sides), SEEK_SET); diff --git a/src/dma.c b/src/dma.c index a6d43550f..391121c18 100644 --- a/src/dma.c +++ b/src/dma.c @@ -297,7 +297,7 @@ void dma_page_write(uint16_t addr, uint8_t val, void *priv) dma16.page[0] = val; break; default: - pclog("DMA write to extra page register: %02X\n", addr & 0xf); + // pclog("DMA write to extra page register: %02X\n", addr & 0xf); break; } } diff --git a/src/fdc.c b/src/fdc.c index f23ce3252..42ea7ff49 100644 --- a/src/fdc.c +++ b/src/fdc.c @@ -156,6 +156,18 @@ sector_id_t fdc_get_read_track_sector() return fdc.read_track_sector; } +int fdc_ps1_525() +{ + if ((romset == ROM_IBMPS1_2011) && fdd_is_525(real_drive(fdc.dor & 3))) + { + return 0x40; + } + else + { + return 0; + } +} + int fdc_get_compare_condition() { switch (discint) diff --git a/src/keyboard_at.c b/src/keyboard_at.c index 24cabb4f9..9d9857945 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -642,17 +642,17 @@ bad_command: break; case 0xc0: /*Read input port*/ - keyboard_at_adddata((keyboard_at.input_port & 0xfc) | 0x84); + keyboard_at_adddata((keyboard_at.input_port & 0xfc) | 0x84 | fdc_ps1_525()); break; case 0xc1: /*Copy bits 0 to 3 of input port to status bits 4 to 7*/ keyboard_at.status &= 0xf; - keyboard_at.status |= ((keyboard_at.input_port & 0xf) << 4); + keyboard_at.status |= ((((keyboard_at.input_port & 0xfc) | 0x84 | fdc_ps1_525()) & 0xf) << 4); break; case 0xc2: /*Copy bits 4 to 7 of input port to status bits 4 to 7*/ keyboard_at.status &= 0xf; - keyboard_at.status |= (keyboard_at.input_port & 0xf0); + keyboard_at.status |= (((keyboard_at.input_port & 0xfc) | 0x84 | fdc_ps1_525()) & 0xf0); break; case 0xc9: /*AMI - block P22 and P23 ??? */ @@ -689,7 +689,23 @@ bad_command: case 0xd4: /*Write to mouse*/ keyboard_at.want60 = 1; break; - + + case 0xdd: /* Disable A20 Address Line */ + keyboard_at.output_port &= ~0x02; + mem_a20_key = 0; + mem_a20_recalc(); + // pclog("Rammask change to %08X %02X\n", rammask, val & 0x02); + flushmmucache(); + break; + + case 0xdf: /* Enable A20 Address Line */ + keyboard_at.output_port |= 0x02; + mem_a20_key = 2; + mem_a20_recalc(); + // pclog("Rammask change to %08X %02X\n", rammask, val & 0x02); + flushmmucache(); + break; + case 0xe0: /*Read test inputs*/ keyboard_at_adddata(0x00); break; diff --git a/src/model.c b/src/model.c index c5a7a79aa..191aec7fd 100644 --- a/src/model.c +++ b/src/model.c @@ -155,7 +155,7 @@ MODEL models[] = {"IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", { "", cpus_ps1_m2011, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2011_init, NULL}, {"IBM PS/2 Model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", { "", cpus_ps2_m30_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 16, 1, ps2_m30_286_init, NULL}, {"IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2121_init, NULL}, - {"IBM PS/1 m.2121 + ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2121_init, NULL}, + {"IBM PS/1 m.2121 + ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2121_init, NULL}, {"Compaq Deskpro 386", ROM_DESKPRO_386, "dekspro386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, deskpro386_init, NULL}, {"DTK 386SX clone", ROM_DTK386, "dtk386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_neat_init, NULL}, {"Amstrad MegaPC", ROM_MEGAPC, "megapc", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, at_wd76c10_init, NULL}, @@ -379,7 +379,6 @@ void ps1_common_init() device_add(&ps1_audio_device); /*PS/1 audio uses ports 200h and 202-207h, so only initialise gameport on 201h*/ if (joystick_type != 7) device_add(&gameport_201_device); - fdc_set_ps1(); } void ps1_m2011_init() @@ -392,6 +391,7 @@ void ps1_m2121_init() { ps1_common_init(); ps1mb_m2121_init(); + fdc_set_ps1(); } void ps2_m30_286_init() diff --git a/src/vid_paradise.c b/src/vid_paradise.c index 218f6683d..e6ce2ee06 100644 --- a/src/vid_paradise.c +++ b/src/vid_paradise.c @@ -366,7 +366,7 @@ static int paradise_wd90c11_standalone_available() return rom_present("roms/megapc/41651-bios lo.u18") && rom_present("roms/megapc/211253-bios hi.u19"); } -static void *cpqvga_init() +/* static void *cpqvga_init() { paradise_t *paradise = paradise_pvga1a_init(); @@ -379,7 +379,7 @@ static void *cpqvga_init() static int cpqvga_standalone_available() { return rom_present("roms/1988-05-18.rom"); -} +} */ void paradise_close(void *p) { @@ -455,7 +455,7 @@ device_t paradise_wd90c11_device = paradise_force_redraw, paradise_add_status_info }; -device_t cpqvga_device = +/* device_t cpqvga_device = { "Compaq/Paradise VGA", 0, @@ -465,4 +465,4 @@ device_t cpqvga_device = paradise_speed_changed, paradise_force_redraw, paradise_add_status_info -}; +}; */ diff --git a/src/vid_paradise.h b/src/vid_paradise.h index 63503670c..e28bb4fae 100644 --- a/src/vid_paradise.h +++ b/src/vid_paradise.h @@ -5,4 +5,4 @@ extern device_t paradise_pvga1a_pc2086_device; extern device_t paradise_pvga1a_pc3086_device; extern device_t paradise_wd90c11_megapc_device; extern device_t paradise_wd90c11_device; -extern device_t cpqvga_device; +// extern device_t cpqvga_device; diff --git a/src/vid_ps1_svga.c b/src/vid_ps1_svga.c index 700582938..4c0ce9963 100644 --- a/src/vid_ps1_svga.c +++ b/src/vid_ps1_svga.c @@ -1,6 +1,3 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ /*Emulation of the SVGA chip in the IBM PS/1 Model 2121, or at least the 20 MHz version. @@ -48,8 +45,6 @@ void ps1_m2121_svga_out(uint16_t addr, uint8_t val, void *p) svga->crtcreg = val & 0x1f; return; case 0x3D5: - if (svga->crtcreg <= 0x18) - val &= mask_crtc[svga->crtcreg]; if ((svga->crtcreg < 7) && (svga->crtc[0x11] & 0x80)) return; if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) diff --git a/src/vid_svga.c b/src/vid_svga.c index 0ee6b0c7b..2e2b34da7 100644 --- a/src/vid_svga.c +++ b/src/vid_svga.c @@ -64,7 +64,7 @@ void svga_out(uint16_t addr, uint8_t val, void *p) svga_t *svga = (svga_t *)p; int c; uint8_t o; -// printf("OUT SVGA %03X %02X %04X:%04X\n",addr,val,CS,pc); + // printf("OUT SVGA %03X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); switch (addr) { case 0x32CB: @@ -102,7 +102,7 @@ void svga_out(uint16_t addr, uint8_t val, void *p) return; case 0x3C0: - // case 0x3C1: + case 0x3C1: if (!svga->attrff) { svga->attraddr = val & 31; @@ -170,8 +170,8 @@ void svga_out(uint16_t addr, uint8_t val, void *p) if (svga->seqaddr > 0xf) return; o = svga->seqregs[svga->seqaddr & 0xf]; /* Sanitize value for the first 5 sequencer registers. */ - if ((svga->seqaddr & 0xf) <= 4) - val &= mask_seq[svga->seqaddr & 0xf]; + /* if ((svga->seqaddr & 0xf) <= 4) + val &= mask_seq[svga->seqaddr & 0xf]; */ svga->seqregs[svga->seqaddr & 0xf] = val; if (o != val && (svga->seqaddr & 0xf) == 1) svga_recalctimings(svga); @@ -236,7 +236,16 @@ void svga_out(uint16_t addr, uint8_t val, void *p) if (svga->ramdac_type == RAMDAC_8BIT) svga->pallook[svga->dac_write] = makecol32(svga->vgapal[svga->dac_write].r, svga->vgapal[svga->dac_write].g, svga->vgapal[svga->dac_write].b); else - svga->pallook[svga->dac_write] = makecol32(video_6to8[svga->vgapal[svga->dac_write].r], video_6to8[svga->vgapal[svga->dac_write].g], video_6to8[svga->vgapal[svga->dac_write].b]); + { + if ((romset == ROM_IBMPS1_2011) || (romset == ROM_IBMPS1_2121) || (romset == ROM_IBMPS2_M30_286)) + { + svga->pallook[svga->dac_write] = makecol32((svga->vgapal[svga->dac_write].r & 0x3f) * 4, (svga->vgapal[svga->dac_write].g & 0x3f) * 4, (svga->vgapal[svga->dac_write].b & 0x3f) * 4); + } + else + { + svga->pallook[svga->dac_write] = makecol32(video_6to8[svga->vgapal[svga->dac_write].r], video_6to8[svga->vgapal[svga->dac_write].g], video_6to8[svga->vgapal[svga->dac_write].b]); + } + } svga->dac_pos = 0; svga->dac_write = (svga->dac_write + 1) & 255; break; @@ -247,8 +256,8 @@ void svga_out(uint16_t addr, uint8_t val, void *p) break; case 0x3CF: /* Sanitize the first 9 GDC registers. */ - if ((svga->gdcaddr & 15) <= 8) - val &= mask_gdc[svga->gdcaddr & 15]; + /* if ((svga->gdcaddr & 15) <= 8) + val &= mask_gdc[svga->gdcaddr & 15]; */ o = svga->gdcreg[svga->gdcaddr & 15]; switch (svga->gdcaddr & 15) { @@ -340,7 +349,7 @@ uint8_t svga_in(uint16_t addr, void *p) { svga_t *svga = (svga_t *)p; uint8_t temp; -// if (addr!=0x3da) pclog("Read port %04X\n",addr); + // if (addr!=0x3da) pclog("Read port %04X\n",addr); switch (addr) { case 0x22CA: diff --git a/src/video.c b/src/video.c index 7af00d173..9ac3a3040 100644 --- a/src/video.c +++ b/src/video.c @@ -77,7 +77,7 @@ static VIDEO_CARD video_cards[] = {"Chips & Technologies SuperEGA", "superega", &sega_device, GFX_SUPER_EGA}, {"Compaq ATI VGA Wonder XL (ATI-28800-5)", "compaq_ati28800", &compaq_ati28800_device, GFX_VGAWONDERXL}, {"Compaq EGA", "compaq_ega", &cpqega_device, GFX_COMPAQ_EGA}, - {"Compaq/Paradise VGA", "compaq_vga", &cpqvga_device, GFX_COMPAQ_VGA}, + /* {"Compaq/Paradise VGA", "compaq_vga", &cpqvga_device, GFX_COMPAQ_VGA}, */ {"Hercules", "hercules", &hercules_device, GFX_HERCULES}, {"Hercules Plus", "hercules_plus", &herculesplus_device, GFX_HERCULESPLUS}, {"Hercules InColor", "incolor", &incolor_device, GFX_INCOLOR}, diff --git a/src/win.c b/src/win.c index d4f670530..4b5f87f32 100644 --- a/src/win.c +++ b/src/win.c @@ -1084,7 +1084,7 @@ void cdrom_close(uint8_t id) } } -char *floppy_image_extensions = "All floppy images (*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF)\0*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.TD0\0Basic sector-based images (*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF)\0*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"; +char *floppy_image_extensions = "All floppy images (*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF)\0*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.86F;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMD;*.IMG;*.TD0;*.VFD;*.XDF\0Advanced sector-based images (*.IMD;*.TD0)\0*.IMD;*.TD0\0Basic sector-based images (*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF)\0*.001;*.002;*.003;*.004;*.005;*.006;*.007;*.008;*.009;*.010;*.12;*.144;*.360;*.720;*.BIN;*.CQ;*.CQM;*.DSK;*.FDI;*.FDF;*.FLP;*.HDM;*.IMA;*.IMG;*.VFD;*.XDF\0Flux images (*.FDI)\0*.FDI\0Surface-based images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"; int ide_ter_set_irq(HMENU hmenu, int irq, int id) { diff --git a/src/x86_ops_fpu.h b/src/x86_ops_fpu.h index 10102a4aa..a1976f268 100644 --- a/src/x86_ops_fpu.h +++ b/src/x86_ops_fpu.h @@ -3,7 +3,6 @@ */ static int opESCAPE_d8_a16(uint32_t fetchdat) { - pclog("D8 %02X\n", fetchdat & 0xff); return x86_opcodes_d8_a16[(fetchdat >> 3) & 0x1f](fetchdat); } static int opESCAPE_d8_a32(uint32_t fetchdat) @@ -13,7 +12,6 @@ static int opESCAPE_d8_a32(uint32_t fetchdat) static int opESCAPE_d9_a16(uint32_t fetchdat) { - pclog("D9 %02X\n", fetchdat & 0xff); return x86_opcodes_d9_a16[fetchdat & 0xff](fetchdat); } static int opESCAPE_d9_a32(uint32_t fetchdat) @@ -23,7 +21,6 @@ static int opESCAPE_d9_a32(uint32_t fetchdat) static int opESCAPE_da_a16(uint32_t fetchdat) { - pclog("DA %02X\n", fetchdat & 0xff); return x86_opcodes_da_a16[fetchdat & 0xff](fetchdat); } static int opESCAPE_da_a32(uint32_t fetchdat) @@ -33,7 +30,6 @@ static int opESCAPE_da_a32(uint32_t fetchdat) static int opESCAPE_db_a16(uint32_t fetchdat) { - pclog("DB %02X\n", fetchdat & 0xff); return x86_opcodes_db_a16[fetchdat & 0xff](fetchdat); } static int opESCAPE_db_a32(uint32_t fetchdat) @@ -43,7 +39,6 @@ static int opESCAPE_db_a32(uint32_t fetchdat) static int opESCAPE_dc_a16(uint32_t fetchdat) { - pclog("DC %02X\n", fetchdat & 0xff); return x86_opcodes_dc_a16[(fetchdat >> 3) & 0x1f](fetchdat); } static int opESCAPE_dc_a32(uint32_t fetchdat) @@ -53,7 +48,6 @@ static int opESCAPE_dc_a32(uint32_t fetchdat) static int opESCAPE_dd_a16(uint32_t fetchdat) { - pclog("DD %02X\n", fetchdat & 0xff); return x86_opcodes_dd_a16[fetchdat & 0xff](fetchdat); } static int opESCAPE_dd_a32(uint32_t fetchdat) @@ -63,7 +57,6 @@ static int opESCAPE_dd_a32(uint32_t fetchdat) static int opESCAPE_de_a16(uint32_t fetchdat) { - pclog("DE %02X\n", fetchdat & 0xff); return x86_opcodes_de_a16[fetchdat & 0xff](fetchdat); } static int opESCAPE_de_a32(uint32_t fetchdat) @@ -73,7 +66,6 @@ static int opESCAPE_de_a32(uint32_t fetchdat) static int opESCAPE_df_a16(uint32_t fetchdat) { - pclog("DF %02X\n", fetchdat & 0xff); return x86_opcodes_df_a16[fetchdat & 0xff](fetchdat); } static int opESCAPE_df_a32(uint32_t fetchdat)