More 808x fixed - fixed (kind of) the 8086 lock ups and the DRAM refresh wait states, also further fixed (and cleaned up) prefetch queue operation, applied a few warning fixes, and fixed the behavior of PUSH SP - anything that uses it to tell 808x apart from 286 is now fixed;

Re-added the higher-clocked 8088's;
Fixed PIT timings for 808x CPU's that don't run off an 14.3 MHz crystal;
Fixed CGA cursor half blink rate setting - fixes insane cursor blinking speed in several cases;
DMA now issues DMA refresh DRAM states on every channel;
Gave the 1982 years to the previously emulated PC and XT's names, and added the 1981 IBM PC and 1986 IBM XT;
Redid the PPI DIP switch redout for the PC/XT keyboard controller;
Fixed a segmentation fault in hdc_ide.c that tended to occur on hard reset after switching machines;
Implemented the port 3B8 color disable on the Hercules, Hercules Plus, and Hercules InColor cards;
Fixed the joystick configuration dialog strings;
Fixed a problem that would have prevented win_sdl.c from compiling with logging enabled.
This commit is contained in:
OBattler
2019-02-11 01:33:15 +01:00
parent a4c11f9536
commit c1f18d9abc
21 changed files with 611 additions and 359 deletions

View File

@@ -24,6 +24,7 @@
#include <string.h>
#include <wchar.h>
#include "86box.h"
#include "floppy/fdd.h"
#include "machine/machine.h"
#include "io.h"
#include "pic.h"
@@ -54,8 +55,7 @@ typedef struct {
int blocked;
int tandy;
uint8_t pa;
uint8_t pb;
uint8_t pa, pb, pd;
uint8_t key_waiting;
uint8_t type;
} xtkbd_t;
@@ -472,14 +472,9 @@ kbd_read(uint16_t port, void *priv)
switch (port) {
case 0x60:
if (!kbd->type && (kbd->pb & 0x80)) {
if (video_is_ega_vga())
ret = 0x4d;
else if (video_is_mda())
ret = 0x7d;
else
ret = 0x6d;
} else if ((kbd->type == 1) && (kbd->pb & 0x80))
if ((kbd->type <= 1) && (kbd->pb & 0x80))
ret = kbd->pd;
else if (((kbd->type == 2) || (kbd->type == 3)) && (kbd->pb & 0x80))
ret = 0xff; /* According to Ruud on the PCem forum, this is supposed to return 0xFF on the XT. */
else
ret = kbd->pa;
@@ -490,39 +485,37 @@ kbd_read(uint16_t port, void *priv)
break;
case 0x62:
if (!kbd->type) {
if (!kbd->type)
ret = 0x00;
else if (kbd->type == 1) {
if (kbd->pb & 0x04)
ret = ((mem_size-64) / 32) & 0x0f;
else
ret = ((mem_size-64) / 32) >> 4;
} else {
if (kbd->pb & 0x08) {
if (video_is_ega_vga())
ret = 0x4;
else if (video_is_mda())
ret = 0x7;
else
ret = 0x6;
} else {
if (kbd->pb & 0x08)
ret = kbd->pd >> 4;
else {
/* LaserXT = Always 512k RAM;
LaserXT/3 = Bit 0: set = 512k, clear = 256k. */
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
if (kbd->type == 3)
if (kbd->type == 5)
ret = (mem_size == 512) ? 0x0d : 0x0c;
else
#endif
ret = 0x0d;
ret = kbd->pd & 0x0f;
}
}
ret |= (ppispeakon ? 0x20 : 0);
if (kbd->type == 2)
if (kbd->type == 4)
ret |= (tandy1k_eeprom_read() ? 0x10 : 0);
break;
default:
pclog("XTkbd: bad read %04X\n", port);
ret = 0xff;
case 0x63:
if ((kbd->type == 2) || (kbd->type == 3))
ret = kbd->pd;
break;
}
return(ret);
@@ -549,6 +542,8 @@ kbd_reset(void *priv)
static void *
kbd_init(const device_t *info)
{
int i, fdd_count = 0;
xtkbd_t *kbd;
kbd = (xtkbd_t *)malloc(sizeof(xtkbd_t));
@@ -560,6 +555,78 @@ kbd_init(const device_t *info)
kbd_reset(kbd);
kbd->type = info->local;
if (kbd->type <= 3) {
for (i = 0; i < FDD_NUM; i++) {
if (fdd_get_flags(i))
fdd_count++;
}
/* DIP switch readout: bit set = OFF, clear = ON. */
/* Switches 7, 8 - floppy drives. */
if (!fdd_count)
kbd->pd = 0x00;
else
kbd->pd = ((fdd_count - 1) << 6) | 0x01;
/* Switches 5, 6 - video. */
if (video_is_mda())
kbd->pd |= 0x30;
else
kbd->pd |= 0x20; /* 0x10 would be 40x25 */
/* Switches 3, 4 - memory size. */
if (kbd->type == 3) {
switch (mem_size) {
case 256:
kbd->pd |= 0x00;
break;
case 512:
kbd->pd |= 0x04;
break;
case 576:
kbd->pd |= 0x08;
break;
case 640:
default:
kbd->pd |= 0x0c;
break;
}
} else if (kbd->type == 2) {
switch (mem_size) {
case 64:
kbd->pd |= 0x00;
break;
case 128:
kbd->pd |= 0x04;
break;
case 192:
kbd->pd |= 0x08;
break;
case 256:
default:
kbd->pd |= 0x0c;
break;
}
} else {
switch (mem_size) {
case 16:
kbd->pd |= 0x00;
break;
case 32:
kbd->pd |= 0x04;
break;
case 48:
kbd->pd |= 0x08;
break;
case 64:
default:
kbd->pd |= 0x0c;
break;
}
}
/* Switch 2 - return bit clear (switch ON) because no 8087 right now. */
/* Switch 1 - always off. */
kbd->pd |= 0x01;
}
timer_add(kbd_poll, &keyboard_delay, TIMER_ALWAYS_ENABLED, kbd);
keyboard_set_table(scancode_xt);
@@ -589,7 +656,7 @@ kbd_close(void *priv)
const device_t keyboard_pc_device = {
"IBM PC Keyboard",
"IBM PC Keyboard (1981)",
0,
0,
kbd_init,
@@ -598,8 +665,8 @@ const device_t keyboard_pc_device = {
NULL, NULL, NULL
};
const device_t keyboard_xt_device = {
"XT Keyboard",
const device_t keyboard_pc82_device = {
"IBM PC Keyboard (1982)",
0,
1,
kbd_init,
@@ -608,10 +675,30 @@ const device_t keyboard_xt_device = {
NULL, NULL, NULL
};
const device_t keyboard_xt_device = {
"XT (1982) Keyboard",
0,
2,
kbd_init,
kbd_close,
kbd_reset,
NULL, NULL, NULL
};
const device_t keyboard_xt86_device = {
"XT (1986) Keyboard",
0,
3,
kbd_init,
kbd_close,
kbd_reset,
NULL, NULL, NULL
};
const device_t keyboard_tandy_device = {
"Tandy 1000 Keyboard",
0,
2,
4,
kbd_init,
kbd_close,
kbd_reset,
@@ -622,7 +709,7 @@ const device_t keyboard_tandy_device = {
const device_t keyboard_xt_lxt3_device = {
"VTech Laser XT3 Keyboard",
0,
3,
/*5*/ 3,
kbd_init,
kbd_close,
kbd_reset,