mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 10:28:19 -07:00
Merge branch 'master' into pc98x1
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <86box/vid_cga.h>
|
||||
#include <86box/vid_cga_comp.h>
|
||||
#include <86box/plat_unused.h>
|
||||
#include <86box/chipset.h>
|
||||
|
||||
#define RAM_DIAG_L_BASE_MEM_640KB 0x00
|
||||
#define RAM_DIAG_L_BASE_MEM_INV 0x10
|
||||
@@ -749,18 +750,28 @@ compaq_386_init(UNUSED(const device_t *info))
|
||||
static void
|
||||
compaq_genoa_outw(uint16_t port, uint16_t val, void *priv)
|
||||
{
|
||||
if (port == 0x0c02) {
|
||||
if (port == 0x0c02) {
|
||||
if (val)
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
else
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||
|
||||
flushmmucache_nopc();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
compaq_genoa_reset(void *priv)
|
||||
{
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
}
|
||||
|
||||
static void *
|
||||
compaq_genoa_init(UNUSED(const device_t *info))
|
||||
{
|
||||
io_sethandler(0x0c02, 3, NULL, NULL, NULL, NULL, compaq_genoa_outw, NULL, ram);
|
||||
io_sethandler(0x0c02, 2, NULL, NULL, NULL, NULL, compaq_genoa_outw, NULL, NULL);
|
||||
|
||||
device_add(&compaq_386_device);
|
||||
|
||||
return ram;
|
||||
}
|
||||
@@ -782,11 +793,11 @@ const device_t compaq_386_device = {
|
||||
const device_t compaq_genoa_device = {
|
||||
.name = "Compaq Genoa Memory Control",
|
||||
.internal_name = "compaq_genoa",
|
||||
.flags = 0,
|
||||
.flags = DEVICE_SOFTRESET,
|
||||
.local = 0,
|
||||
.init = compaq_genoa_init,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
.reset = compaq_genoa_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
|
||||
@@ -106,11 +106,11 @@ opti391_shadow_recalc(opti391_t *dev)
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
base = 0xd0000 + (i << 14);
|
||||
if (base >= 0xe0000) {
|
||||
sh_master = (dev->regs[0x02] & 0x40);
|
||||
sh_wp = (dev->regs[0x02] & 0x10);
|
||||
} else {
|
||||
sh_master = (dev->regs[0x02] & 0x20);
|
||||
sh_wp = (dev->regs[0x02] & 0x08);
|
||||
} else {
|
||||
sh_master = (dev->regs[0x02] & 0x40);
|
||||
sh_wp = (dev->regs[0x02] & 0x10);
|
||||
}
|
||||
sh_enable = dev->regs[0x03] & (1 << i);
|
||||
|
||||
@@ -253,7 +253,7 @@ opti391_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
case 0x06:
|
||||
pclog("Write %02X: %02X\n", dev->index - dev->reg_base, val);
|
||||
opti391_log("Write %02X: %02X\n", dev->index - dev->reg_base, val);
|
||||
dev->regs[dev->index - dev->reg_base] = val;
|
||||
opti391_shadow_recalc(dev);
|
||||
break;
|
||||
|
||||
@@ -1720,7 +1720,7 @@ save_general(void)
|
||||
char temp[512];
|
||||
char buffer[512] = { 0 };
|
||||
|
||||
const char *va_name = NULL;
|
||||
const char *va_name;
|
||||
|
||||
ini_section_set_int(cat, "vid_resize", vid_resize);
|
||||
if (vid_resize == 0)
|
||||
|
||||
6389
src/cpu/cpu_table.c
6389
src/cpu/cpu_table.c
File diff suppressed because it is too large
Load Diff
@@ -240,7 +240,6 @@ reset_common(int hard)
|
||||
|
||||
if (!hard && reset_on_hlt) {
|
||||
hlt_reset_pending++;
|
||||
pclog("hlt_reset_pending = %i\n", hlt_reset_pending);
|
||||
if (hlt_reset_pending == 2)
|
||||
hlt_reset_pending = 0;
|
||||
else
|
||||
@@ -352,7 +351,8 @@ reset_common(int hard)
|
||||
/* If we have an AT or PS/2 keyboard controller, make sure the A20 state
|
||||
is correct. */
|
||||
device_reset_all(DEVICE_KBC);
|
||||
}
|
||||
} else
|
||||
device_reset_all(DEVICE_SOFTRESET);
|
||||
|
||||
if (!is286)
|
||||
reset_808x(hard);
|
||||
|
||||
14
src/device.c
14
src/device.c
@@ -97,14 +97,12 @@ device_set_context(device_context_t *c, const device_t *dev, int inst)
|
||||
if (inst) {
|
||||
sprintf(c->name, "%s #%i", dev->name, inst);
|
||||
|
||||
/* If this is the first instance and a numbered section is not present, but a non-numbered
|
||||
section of the same name is, rename the non-numbered section to numbered. */
|
||||
if (inst == 1) {
|
||||
const void *sec = config_find_section(c->name);
|
||||
void * single_sec = config_find_section((char *) dev->name);
|
||||
if ((sec == NULL) && (single_sec != NULL))
|
||||
config_rename_section(single_sec, c->name);
|
||||
}
|
||||
/* If a numbered section is not present, but a non-numbered of the same name
|
||||
is, rename the non-numbered section to numbered. */
|
||||
const void *sec = config_find_section(c->name);
|
||||
void * single_sec = config_find_section((char *) dev->name);
|
||||
if ((sec == NULL) && (single_sec != NULL))
|
||||
config_rename_section(single_sec, c->name);
|
||||
} else
|
||||
sprintf(c->name, "%s", dev->name);
|
||||
}
|
||||
|
||||
@@ -1189,6 +1189,20 @@ write60_ami(void *priv, uint8_t val)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
kbc_at_set_ps2(void *priv, const uint8_t ps2)
|
||||
{
|
||||
atkbc_t *dev = (atkbc_t *) priv;
|
||||
|
||||
dev->ami_flags = (dev->ami_flags & 0xfe) | (!!ps2);
|
||||
dev->misc_flags &= ~FLAG_PS2;
|
||||
if (ps2) {
|
||||
dev->misc_flags |= FLAG_PS2;
|
||||
kbc_at_do_poll = kbc_at_poll_ps2;
|
||||
} else
|
||||
kbc_at_do_poll = kbc_at_poll_at;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
write64_ami(void *priv, uint8_t val)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
|
||||
enum mtouch_modes {
|
||||
MODE_TABLET = 1,
|
||||
MODE_RAW = 2
|
||||
MODE_RAW = 2,
|
||||
MODE_HEX = 3
|
||||
};
|
||||
|
||||
typedef struct mouse_microtouch_t {
|
||||
@@ -50,7 +51,7 @@ typedef struct mouse_microtouch_t {
|
||||
char cmd[512];
|
||||
int cmd_pos;
|
||||
int mode;
|
||||
uint8_t cal_cntr, pen_mode;
|
||||
uint8_t cal_cntr, pen_mode, prev_b;
|
||||
bool soh;
|
||||
bool in_reset;
|
||||
serial_t *serial;
|
||||
@@ -93,80 +94,85 @@ microtouch_process_commands(mouse_microtouch_t *mtouch)
|
||||
for (i = 0; i < strlen(mtouch->cmd); i++) {
|
||||
mtouch->cmd[i] = toupper(mtouch->cmd[i]);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'Z') {
|
||||
if (mtouch->cmd[0] == 'Z') { /* Null */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'O') {
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'O') { /* Finger Only */
|
||||
mtouch->pen_mode = 1;
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'U' && mtouch->cmd[1] == 'T') {
|
||||
if (mtouch->cmd[0] == 'U' && mtouch->cmd[1] == 'T') { /* Unit Type */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "TP****00\r", sizeof("TP****00\r") - 1);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'O' && mtouch->cmd[1] == 'I') {
|
||||
if (mtouch->cmd[0] == 'O' && mtouch->cmd[1] == 'I') { /* Output Identity */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "P50200\r", sizeof("P50200\r") - 1);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'T') {
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'T') { /* Format Tablet */
|
||||
mtouch->mode = MODE_TABLET;
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'R') {
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'H') { /* Format Hexadecimal */
|
||||
mtouch->mode = MODE_HEX;
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *)"0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'R') { /* Format Raw */
|
||||
mtouch->mode = MODE_RAW;
|
||||
mtouch->cal_cntr = 0;
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'M' && mtouch->cmd[1] == 'S') {
|
||||
if (mtouch->cmd[0] == 'M' && mtouch->cmd[1] == 'S') { /* Mode Stream */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'R') {
|
||||
if (mtouch->cmd[0] == 'R') { /* Reset */
|
||||
mtouch->in_reset = true;
|
||||
mtouch->mode = MODE_TABLET;
|
||||
mtouch->cal_cntr = 0;
|
||||
mtouch->pen_mode = 3;
|
||||
timer_on_auto(&mtouch->reset_timer, 500. * 1000.);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'A' && (mtouch->cmd[1] == 'D' || mtouch->cmd[1] == 'E')) {
|
||||
if (mtouch->cmd[0] == 'A' && (mtouch->cmd[1] == 'D' || mtouch->cmd[1] == 'E')) { /* Autobaud Enable/Disable */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'N' && mtouch->cmd[1] == 'M') {
|
||||
if (mtouch->cmd[0] == 'N' && mtouch->cmd[1] == 'M') { /* ?? */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "1\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'Q') {
|
||||
if (mtouch->cmd[0] == 'F' && mtouch->cmd[1] == 'Q') { /* ?? */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "1\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'G' && mtouch->cmd[1] == 'F') {
|
||||
if (mtouch->cmd[0] == 'G' && mtouch->cmd[1] == 'F') { /* ?? */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "1\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'P') {
|
||||
if (mtouch->cmd[1] == 'F') mtouch->pen_mode = 3;
|
||||
else if (mtouch->cmd[1] == 'O') mtouch->pen_mode = 2;
|
||||
if (mtouch->cmd[1] == 'F') mtouch->pen_mode = 3; /* Pen or Finger */
|
||||
else if (mtouch->cmd[1] == 'O') mtouch->pen_mode = 2; /* Pen Only */
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'C' && (mtouch->cmd[1] == 'N' || mtouch->cmd[1] == 'X')) {
|
||||
if (mtouch->cmd[0] == 'C' && (mtouch->cmd[1] == 'N' || mtouch->cmd[1] == 'X')) { // Calibrate New/Extended
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
mtouch->cal_cntr = 2;
|
||||
}
|
||||
if (mtouch->cmd[0] == 'G' && mtouch->cmd[1] == 'P' && mtouch->cmd[2] == '1') {
|
||||
if (mtouch->cmd[0] == 'G' && mtouch->cmd[1] == 'P' && mtouch->cmd[2] == '1') { // Get Parameter Block 1
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "A\r", 2);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0000000000000000000000000\r", sizeof("0000000000000000000000000\r") - 1);
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "0\r", 2);
|
||||
}
|
||||
if (mtouch->cmd[0] == 'S' && mtouch->cmd[1] == 'P' && mtouch->cmd[2] == '1') {
|
||||
if (mtouch->cmd[0] == 'S' && mtouch->cmd[1] == 'P' && mtouch->cmd[2] == '1') { // Set Parameter Block 1
|
||||
fifo8_push(&mtouch->resp, 1);
|
||||
fifo8_push_all(&mtouch->resp, (uint8_t *) "A\r", 2);
|
||||
}
|
||||
@@ -219,46 +225,52 @@ static int
|
||||
mtouch_poll(void *priv)
|
||||
{
|
||||
mouse_microtouch_t *dev = (mouse_microtouch_t *) priv;
|
||||
|
||||
if (fifo8_num_free(&dev->resp) <= 10 || dev->mode == MODE_RAW) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int abs_x_int = 0, abs_y_int = 0;
|
||||
double abs_x;
|
||||
double abs_y;
|
||||
int b = mouse_get_buttons_ex();
|
||||
|
||||
if (dev->mode != MODE_RAW && fifo8_num_free(&dev->resp) >= 10) {
|
||||
unsigned int abs_x_int = 0, abs_y_int = 0;
|
||||
double abs_x;
|
||||
double abs_y;
|
||||
int b = mouse_get_buttons_ex();
|
||||
mouse_get_abs_coords(&abs_x, &abs_y);
|
||||
dev->b |= !!(b & 3);
|
||||
|
||||
mouse_get_abs_coords(&abs_x, &abs_y);
|
||||
dev->b |= !!(b & 3); /* any button pressed */
|
||||
|
||||
if (abs_x >= 1.0)
|
||||
abs_x = 1.0;
|
||||
if (abs_y >= 1.0)
|
||||
abs_y = 1.0;
|
||||
if (abs_x <= 0.0)
|
||||
abs_x = 0.0;
|
||||
if (abs_y <= 0.0)
|
||||
abs_y = 0.0;
|
||||
if (enable_overscan) {
|
||||
int index = mouse_tablet_in_proximity - 1;
|
||||
if (mouse_tablet_in_proximity == -1)
|
||||
mouse_tablet_in_proximity = 0;
|
||||
|
||||
abs_x *= monitors[index].mon_unscaled_size_x - 1;
|
||||
abs_y *= monitors[index].mon_efscrnsz_y - 1;
|
||||
|
||||
if (abs_x <= (monitors[index].mon_overscan_x / 2.)) {
|
||||
abs_x = (monitors[index].mon_overscan_x / 2.);
|
||||
}
|
||||
if (abs_y <= (monitors[index].mon_overscan_y / 2.)) {
|
||||
abs_y = (monitors[index].mon_overscan_y / 2.);
|
||||
}
|
||||
abs_x -= (monitors[index].mon_overscan_x / 2.);
|
||||
abs_y -= (monitors[index].mon_overscan_y / 2.);
|
||||
abs_x = abs_x / (double) monitors[index].mon_xsize;
|
||||
abs_y = abs_y / (double) monitors[index].mon_ysize;
|
||||
if (abs_x >= 1.0)
|
||||
abs_x = 1.0;
|
||||
if (abs_y >= 1.0)
|
||||
abs_y = 1.0;
|
||||
if (abs_x <= 0.0)
|
||||
abs_x = 0.0;
|
||||
if (abs_y <= 0.0)
|
||||
abs_y = 0.0;
|
||||
if (enable_overscan) {
|
||||
int index = mouse_tablet_in_proximity - 1;
|
||||
if (mouse_tablet_in_proximity == -1)
|
||||
mouse_tablet_in_proximity = 0;
|
||||
}
|
||||
|
||||
abs_x *= monitors[index].mon_unscaled_size_x - 1;
|
||||
abs_y *= monitors[index].mon_efscrnsz_y - 1;
|
||||
|
||||
if (abs_x <= (monitors[index].mon_overscan_x / 2.)) {
|
||||
abs_x = (monitors[index].mon_overscan_x / 2.);
|
||||
}
|
||||
if (abs_y <= (monitors[index].mon_overscan_y / 2.)) {
|
||||
abs_y = (monitors[index].mon_overscan_y / 2.);
|
||||
}
|
||||
abs_x -= (monitors[index].mon_overscan_x / 2.);
|
||||
abs_y -= (monitors[index].mon_overscan_y / 2.);
|
||||
abs_x = abs_x / (double) monitors[index].mon_xsize;
|
||||
abs_y = abs_y / (double) monitors[index].mon_ysize;
|
||||
if (abs_x >= 1.0)
|
||||
abs_x = 1.0;
|
||||
if (abs_y >= 1.0)
|
||||
abs_y = 1.0;
|
||||
}
|
||||
if (dev->mode == MODE_TABLET) {
|
||||
if (dev->cal_cntr && (!(dev->b & 1) && !!(b & 3))) {
|
||||
dev->b |= 1;
|
||||
} else if (dev->cal_cntr && ((dev->b & 1) && !(b & 3))) {
|
||||
@@ -268,7 +280,7 @@ mtouch_poll(void *priv)
|
||||
if (dev->cal_cntr) {
|
||||
return 0;
|
||||
}
|
||||
if (!!(b & 3)) {
|
||||
if (!!(b & 3)) { /* Hover */
|
||||
dev->abs_x = abs_x;
|
||||
dev->abs_y = abs_y;
|
||||
dev->b |= 1;
|
||||
@@ -281,7 +293,7 @@ mtouch_poll(void *priv)
|
||||
fifo8_push(&dev->resp, (abs_x_int >> 7) & 0b1111111);
|
||||
fifo8_push(&dev->resp, abs_y_int & 0b1111111);
|
||||
fifo8_push(&dev->resp, (abs_y_int >> 7) & 0b1111111);
|
||||
} else if ((dev->b & 1) && !(b & 3)) {
|
||||
} else if ((dev->b & 1) && !(b & 3)) { /* Touch */
|
||||
dev->b &= ~1;
|
||||
abs_x_int = dev->abs_x * 16383;
|
||||
abs_y_int = 16383 - dev->abs_y * 16383;
|
||||
@@ -297,6 +309,28 @@ mtouch_poll(void *priv)
|
||||
fifo8_push(&dev->resp, (abs_y_int >> 7) & 0b1111111);
|
||||
}
|
||||
}
|
||||
|
||||
else if (dev->mode == MODE_HEX) {
|
||||
abs_x_int = abs_x * 1023;
|
||||
abs_y_int = 1023 - (abs_y * 1023);
|
||||
char buffer[20];
|
||||
|
||||
if (dev->cal_cntr && !b && dev->prev_b) {
|
||||
microtouch_calibrate_timer(dev);
|
||||
}
|
||||
else if (b & 1) {
|
||||
if (dev->prev_b == 0) { /* Touchdown */
|
||||
snprintf(buffer, sizeof(buffer), "\x19%03X,%03X\r", abs_x_int, abs_y_int);
|
||||
} else { /* Touch Continuation */
|
||||
snprintf(buffer, sizeof(buffer), "\x1c%03X,%03X\r", abs_x_int, abs_y_int);
|
||||
}
|
||||
fifo8_push_all(&dev->resp, (uint8_t *)buffer, strlen(buffer));
|
||||
} else if (dev->prev_b == 1) { /* Liftoff */
|
||||
snprintf(buffer, sizeof(buffer), "\x18%03X,%03X\r", abs_x_int, abs_y_int);
|
||||
fifo8_push_all(&dev->resp, (uint8_t *)buffer, strlen(buffer));
|
||||
}
|
||||
dev->prev_b = b & 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,13 +41,71 @@ typedef struct monster_fdc_t {
|
||||
rom_t bios_rom;
|
||||
fdc_t *fdc_pri;
|
||||
fdc_t *fdc_sec;
|
||||
char *nvr_path;
|
||||
} monster_fdc_t;
|
||||
|
||||
static void
|
||||
rom_write(uint32_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
const rom_t *rom = (rom_t *) priv;
|
||||
|
||||
#ifdef ROM_TRACE
|
||||
if (rom->mapping.base == ROM_TRACE)
|
||||
rom_log("ROM: read byte from BIOS at %06lX\n", addr);
|
||||
#endif
|
||||
|
||||
if (addr < rom->mapping.base)
|
||||
return;
|
||||
if (addr >= (rom->mapping.base + rom->sz))
|
||||
return;
|
||||
rom->rom[(addr - rom->mapping.base) & rom->mask] = val;
|
||||
}
|
||||
|
||||
static void
|
||||
rom_writew(uint32_t addr, uint16_t val, void *priv)
|
||||
{
|
||||
rom_t *rom = (rom_t *) priv;
|
||||
|
||||
#ifdef ROM_TRACE
|
||||
if (rom->mapping.base == ROM_TRACE)
|
||||
rom_log("ROM: read word from BIOS at %06lX\n", addr);
|
||||
#endif
|
||||
|
||||
if (addr < (rom->mapping.base - 1))
|
||||
return;
|
||||
if (addr >= (rom->mapping.base + rom->sz))
|
||||
return;
|
||||
*(uint16_t *) &rom->rom[(addr - rom->mapping.base) & rom->mask] = val;
|
||||
}
|
||||
|
||||
static void
|
||||
rom_writel(uint32_t addr, uint32_t val, void *priv)
|
||||
{
|
||||
rom_t *rom = (rom_t *) priv;
|
||||
|
||||
#ifdef ROM_TRACE
|
||||
if (rom->mapping.base == ROM_TRACE)
|
||||
rom_log("ROM: read long from BIOS at %06lX\n", addr);
|
||||
#endif
|
||||
|
||||
if (addr < (rom->mapping.base - 3))
|
||||
return;
|
||||
if (addr >= (rom->mapping.base + rom->sz))
|
||||
return;
|
||||
*(uint32_t *) &rom->rom[(addr - rom->mapping.base) & rom->mask] = val;
|
||||
}
|
||||
|
||||
static void
|
||||
monster_fdc_close(void *priv)
|
||||
{
|
||||
monster_fdc_t *dev = (monster_fdc_t *) priv;
|
||||
|
||||
FILE *f = fopen(dev->nvr_path, "wb");
|
||||
if (f != NULL) {
|
||||
fwrite(dev->bios_rom.rom, 1, 0x2000, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
@@ -79,9 +137,18 @@ monster_fdc_init(UNUSED(const device_t *info))
|
||||
fdc_set_dma_ch(dev->fdc_sec, sec_dma);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
uint8_t rom_writes_enabled = device_get_config_int("rom_writes_enabled");
|
||||
#endif
|
||||
if (rom_writes_enabled) {
|
||||
mem_mapping_set_write_handler(&dev->bios_rom.mapping, rom_write, rom_writew, rom_writel);
|
||||
dev->nvr_path = "monster_fdc_0.nvr";
|
||||
dev->nvr_path[12] = device_get_instance() + 0x30;
|
||||
FILE *f = fopen(dev->nvr_path, "rb");
|
||||
if (f != NULL) {
|
||||
fread(dev->bios_rom.rom, 1, 0x2000, f);
|
||||
fclose(f);
|
||||
}
|
||||
} else
|
||||
dev->nvr_path = NULL;
|
||||
|
||||
return dev;
|
||||
}
|
||||
@@ -197,6 +264,7 @@ static const device_config_t monster_fdc_config[] = {
|
||||
{ .description = "" }
|
||||
}
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.name = "rom_writes_enabled",
|
||||
.description = "Enable BIOS extension ROM Writes",
|
||||
@@ -204,7 +272,6 @@ static const device_config_t monster_fdc_config[] = {
|
||||
.default_string = "",
|
||||
.default_int = 0
|
||||
},
|
||||
#endif
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -101,6 +101,7 @@ enum {
|
||||
DEVICE_COM = 0x100000, /* requires a serial port */
|
||||
DEVICE_LPT = 0x200000, /* requires a parallel port */
|
||||
DEVICE_KBC = 0x400000, /* is a keyboard controller */
|
||||
DEVICE_SOFTRESET = 0x800000, /* requires to be reset on soft reset */
|
||||
|
||||
DEVICE_ONBOARD = 0x40000000, /* is on-board */
|
||||
DEVICE_PIT = 0x80000000, /* device is a PIT */
|
||||
|
||||
@@ -278,6 +278,7 @@ extern int keyboard_isfsexit(void);
|
||||
extern int keyboard_isfsexit_up(void);
|
||||
extern int keyboard_ismsexit(void);
|
||||
extern void keyboard_set_is_amstrad(int ams);
|
||||
extern void kbc_at_set_ps2(void *priv, uint8_t ps2);
|
||||
|
||||
extern void kbc_at_set_fast_reset(uint8_t new_fast_reset);
|
||||
extern void kbc_at_handler(int set, void *priv);
|
||||
|
||||
@@ -943,6 +943,7 @@ extern int machine_xt_v20xt_init(const machine_t *);
|
||||
|
||||
extern int machine_xt_iskra3104_init(const machine_t *);
|
||||
extern int machine_xt_pravetz16_imko4_init(const machine_t *);
|
||||
extern int machine_xt_pravetz16s_cpu12p_init(const machine_t *);
|
||||
extern int machine_xt_micoms_xl7turbo_init(const machine_t *);
|
||||
|
||||
/* m_xt_compaq.c */
|
||||
|
||||
@@ -391,6 +391,11 @@ extern void mem_mapping_set_handler(mem_mapping_t *,
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *priv));
|
||||
|
||||
extern void mem_mapping_set_write_handler(mem_mapping_t *,
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *priv));
|
||||
|
||||
extern void mem_mapping_set_p(mem_mapping_t *, void *priv);
|
||||
|
||||
extern void mem_mapping_set_addr(mem_mapping_t *,
|
||||
|
||||
@@ -153,7 +153,7 @@ extern uint32_t plat_get_ticks(void);
|
||||
extern void plat_delay_ms(uint32_t count);
|
||||
extern void plat_pause(int p);
|
||||
extern void plat_mouse_capture(int on);
|
||||
extern int plat_vidapi(char *name);
|
||||
extern int plat_vidapi(const char *name);
|
||||
extern char *plat_vidapi_name(int api);
|
||||
extern void plat_resize(int x, int y, int monitor_index);
|
||||
extern void plat_resize_request(int x, int y, int monitor_index);
|
||||
|
||||
@@ -88,6 +88,7 @@ extern const device_t um8669f_device;
|
||||
extern const device_t um8669f_ide_device;
|
||||
extern const device_t um8669f_ide_sec_device;
|
||||
extern const device_t via_vt82c686_sio_device;
|
||||
extern const device_t vl82c113_device;
|
||||
extern const device_t w83787f_88h_device;
|
||||
extern const device_t w83787f_device;
|
||||
extern const device_t w83787f_ide_device;
|
||||
|
||||
@@ -141,6 +141,7 @@ typedef struct sb_dsp_t {
|
||||
int wb_full;
|
||||
|
||||
pc_timer_t irq_timer;
|
||||
pc_timer_t irq16_timer;
|
||||
|
||||
int busy_count;
|
||||
|
||||
|
||||
@@ -644,7 +644,12 @@ machine_at_cmdsl386sx25_init(const machine_t *model)
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
device_add(&gd5402_onboard_device);
|
||||
|
||||
machine_at_scamp_common_init(model, 1);
|
||||
machine_at_common_ide_init(model);
|
||||
|
||||
device_add(&ali5105_device); /* The FDC is part of the ALi M5105. */
|
||||
device_add(&vl82c113_device); /* The keyboard controller is part of the VL82c113. */
|
||||
|
||||
device_add(&vlsi_scamp_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -725,6 +730,7 @@ machine_at_acer100t_init(const machine_t *model)
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
device_add(&oti077_acer100t_device);
|
||||
|
||||
device_add(&ali5105_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ machine_at_vect486vl_init(const machine_t *model) // has HDC problems
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
device_add(&gd5428_onboard_device);
|
||||
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
device_add(&vl82c113_device);
|
||||
device_add(&fdc37c651_ide_device);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -364,6 +364,24 @@ machine_xt_pravetz16_imko4_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_xt_pravetz16s_cpu12p_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/pravetz16s/PR16S.BIN",
|
||||
0x000fe000, 8192, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
device_add(&keyboard_xt_device);
|
||||
|
||||
machine_xt_common_init(model, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_xt_micoms_xl7turbo_init(const machine_t *model)
|
||||
{
|
||||
|
||||
@@ -1342,6 +1342,45 @@ const machine_t machines[] = {
|
||||
.snd_device = NULL,
|
||||
.net_device = NULL
|
||||
},
|
||||
{
|
||||
.name = "[8088] Pravetz 16S / CPU12 Plus",
|
||||
.internal_name = "pravetz16s",
|
||||
.type = MACHINE_TYPE_8088,
|
||||
.chipset = MACHINE_CHIPSET_DISCRETE,
|
||||
.init = machine_xt_pravetz16s_cpu12p_init,
|
||||
.p1_handler = NULL,
|
||||
.gpio_handler = NULL,
|
||||
.available_flag = MACHINE_AVAILABLE,
|
||||
.gpio_acpi_handler = NULL,
|
||||
.cpu = {
|
||||
.package = CPU_PKG_8088,
|
||||
.block = CPU_BLOCK_NONE,
|
||||
.min_bus = 4772728,
|
||||
.max_bus = 12000000,
|
||||
.min_voltage = 0,
|
||||
.max_voltage = 0,
|
||||
.min_multi = 0,
|
||||
.max_multi = 0
|
||||
},
|
||||
.bus_flags = MACHINE_PC,
|
||||
.flags = MACHINE_FLAGS_NONE,
|
||||
.ram = {
|
||||
.min = 512,
|
||||
.max = 1024,
|
||||
.step = 128
|
||||
},
|
||||
.nvrmask = 0,
|
||||
.kbc_device = &keyboard_xt_device,
|
||||
.kbc_p1 = 0xff,
|
||||
.gpio = 0xffffffff,
|
||||
.gpio_acpi = 0xffffffff,
|
||||
.device = NULL,
|
||||
.fdc_device = NULL,
|
||||
.sio_device = NULL,
|
||||
.vid_device = NULL,
|
||||
.snd_device = NULL,
|
||||
.net_device = NULL
|
||||
},
|
||||
{
|
||||
.name = "[8088] Sanyo SX-16",
|
||||
.internal_name = "sansx16",
|
||||
@@ -5658,7 +5697,7 @@ const machine_t machines[] = {
|
||||
.flags = MACHINE_APM,
|
||||
.ram = {
|
||||
.min = 1024,
|
||||
.max = 65536,
|
||||
.max = 16384,
|
||||
.step = 1024
|
||||
},
|
||||
.nvrmask = 127,
|
||||
|
||||
@@ -2556,6 +2556,19 @@ mem_mapping_set_handler(mem_mapping_t *map,
|
||||
mem_mapping_recalc(map->base, map->size);
|
||||
}
|
||||
|
||||
void
|
||||
mem_mapping_set_write_handler(mem_mapping_t *map,
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *priv))
|
||||
{
|
||||
map->write_b = write_b;
|
||||
map->write_w = write_w;
|
||||
map->write_l = write_l;
|
||||
|
||||
mem_mapping_recalc(map->base, map->size);
|
||||
}
|
||||
|
||||
void
|
||||
mem_mapping_set_addr(mem_mapping_t *map, uint32_t base, uint32_t size)
|
||||
{
|
||||
|
||||
@@ -41,8 +41,12 @@ endif()
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Qt${QT_MAJOR} COMPONENTS Core Widgets Network OpenGL REQUIRED)
|
||||
find_package(Qt${QT_MAJOR} COMPONENTS Core Widgets Network OpenGL Gui REQUIRED)
|
||||
find_package(Qt${QT_MAJOR}LinguistTools REQUIRED NO_CMAKE_FIND_ROOT_PATH)
|
||||
if(NOT USE_QT6)
|
||||
# For <qpa/qplatformwindow.h> in src/qt/qt_mainwindow.cpp
|
||||
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
endif ()
|
||||
|
||||
# TODO: Is this the correct way to do this, and is it required on any
|
||||
# other platforms or with Qt 5?
|
||||
|
||||
BIN
src/qt/icons/cdrom_folder.ico
Normal file
BIN
src/qt/icons/cdrom_folder.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_host.ico
Normal file
BIN
src/qt/icons/cdrom_host.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_image.ico
Normal file
BIN
src/qt/icons/cdrom_image.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_mute.ico
Normal file
BIN
src/qt/icons/cdrom_mute.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/cdrom_unmute.ico
Normal file
BIN
src/qt/icons/cdrom_unmute.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -38,7 +38,7 @@ qt_nvr_save(void)
|
||||
char icon_set[256] = ""; /* name of the iconset to be used */
|
||||
|
||||
int
|
||||
plat_vidapi(char *api)
|
||||
plat_vidapi(const char *api)
|
||||
{
|
||||
if (!strcasecmp(api, "default") || !strcasecmp(api, "system")) {
|
||||
return 0;
|
||||
|
||||
@@ -144,10 +144,10 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
MachineStatus::iterateCDROM([this, parentMenu](int i) {
|
||||
auto *menu = parentMenu->addMenu("");
|
||||
cdromMutePos = menu->children().count();
|
||||
menu->addAction(QApplication::style()->standardIcon(QStyle::SP_MediaVolumeMuted), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
|
||||
menu->addSeparator();
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom.ico"), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
|
||||
menu->addAction(QApplication::style()->standardIcon(QStyle::SP_DirIcon), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_image.ico"), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false);
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_folder.ico"), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false);
|
||||
menu->addSeparator();
|
||||
for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
|
||||
cdromImageHistoryPos[slot] = menu->children().count();
|
||||
@@ -160,7 +160,7 @@ MediaMenu::refresh(QMenu *parentMenu)
|
||||
for (const auto &letter : driveLetters) {
|
||||
auto drive = QString("%1:\\").arg(letter);
|
||||
if (GetDriveType(drive.toUtf8().constData()) == DRIVE_CDROM)
|
||||
menu->addAction(QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon), tr("Host CD/DVD Drive (%1:)").arg(letter), [this, i, letter] { cdromMount(i, 2, QString(R"(\\.\%1:)").arg(letter)); })->setCheckable(false);
|
||||
menu->addAction(ProgSettings::loadIcon("/cdrom_host.ico"), tr("Host CD/DVD Drive (%1:)").arg(letter), [this, i, letter] { cdromMount(i, 2, QString(R"(\\.\%1:)").arg(letter)); })->setCheckable(false);
|
||||
}
|
||||
menu->addSeparator();
|
||||
#endif // Q_OS_WINDOWS
|
||||
@@ -587,7 +587,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
children = menu->children();
|
||||
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[cdromImageHistoryPos[slot]]);
|
||||
if (fn.left(8) == "ioctl://") {
|
||||
menu_icon = QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon);
|
||||
menu_icon = ProgSettings::loadIcon("/cdrom_host.ico");
|
||||
#ifdef Q_OS_WINDOWS
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(fn.right(2)).toUtf8().constData();
|
||||
#else
|
||||
@@ -595,7 +595,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
#endif
|
||||
} else {
|
||||
fi.setFile(fn);
|
||||
menu_icon = fi.isDir() ? QApplication::style()->standardIcon(QStyle::SP_DirIcon) : ProgSettings::loadIcon("/cdrom.ico");
|
||||
menu_icon = fi.isDir() ? ProgSettings::loadIcon("/cdrom_folder.ico") : ProgSettings::loadIcon("/cdrom_image.ico");
|
||||
menu_item_name = fn.isEmpty() ? tr("previous image").toUtf8().constData() : fn.toUtf8().constData();
|
||||
}
|
||||
imageHistoryUpdatePos->setIcon(menu_icon);
|
||||
@@ -642,7 +642,7 @@ MediaMenu::cdromUpdateMenu(int i)
|
||||
auto childs = menu->children();
|
||||
|
||||
auto *muteMenu = dynamic_cast<QAction *>(childs[cdromMutePos]);
|
||||
muteMenu->setIcon(QApplication::style()->standardIcon((cdrom[i].sound_on == 0) ? QStyle::SP_MediaVolume : QStyle::SP_MediaVolumeMuted));
|
||||
muteMenu->setIcon(ProgSettings::loadIcon((cdrom[i].sound_on == 0) ? "/cdrom_unmute.ico" : "/cdrom_mute.ico"));
|
||||
muteMenu->setText((cdrom[i].sound_on == 0) ? tr("&Unmute") : tr("&Mute"));
|
||||
|
||||
auto *imageMenu = dynamic_cast<QAction *>(childs[cdromImagePos]);
|
||||
@@ -655,13 +655,13 @@ MediaMenu::cdromUpdateMenu(int i)
|
||||
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(name.right(name.length() - 8));
|
||||
#endif
|
||||
name2 = menu_item_name;
|
||||
menu_icon = QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon);
|
||||
menu_icon = ProgSettings::loadIcon("/cdrom_host.ico");
|
||||
} else {
|
||||
QFileInfo fi(cdrom[i].image_path);
|
||||
|
||||
menu_item_name = name.isEmpty() ? QString().toUtf8().constData() : name.toUtf8().constData();
|
||||
name2 = name;
|
||||
menu_icon = fi.isDir() ? QApplication::style()->standardIcon(QStyle::SP_DirIcon) : ProgSettings::loadIcon("/cdrom.ico");
|
||||
menu_icon = fi.isDir() ? ProgSettings::loadIcon("/cdrom_folder.ico") : ProgSettings::loadIcon("/cdrom_image.ico");
|
||||
}
|
||||
imageMenu->setIcon(menu_icon);
|
||||
imageMenu->setText(QString::asprintf(tr("Eject %s").toUtf8().constData(), menu_item_name.toUtf8().constData()));
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
<file>qt/icons/cdrom_disabled.ico</file>
|
||||
<file>qt/icons/cdrom_empty.ico</file>
|
||||
<file>qt/icons/cdrom_empty_active.ico</file>
|
||||
<file>qt/icons/cdrom_mute.ico</file>
|
||||
<file>qt/icons/cdrom_unmute.ico</file>
|
||||
<file>qt/icons/cdrom_image.ico</file>
|
||||
<file>qt/icons/cdrom_folder.ico</file>
|
||||
<file>qt/icons/cdrom_host.ico</file>
|
||||
<file>qt/icons/display.ico</file>
|
||||
<file>qt/icons/floppy_35.ico</file>
|
||||
<file>qt/icons/floppy_35_active.ico</file>
|
||||
|
||||
@@ -1043,7 +1043,8 @@ aha_init(const device_t *info)
|
||||
case AHA_154xC:
|
||||
strcpy(dev->name, "AHA-154xC");
|
||||
dev->bios_path = "roms/scsi/adaptec/aha1542c102.bin";
|
||||
dev->nvr_path = "aha1542c.nvr";
|
||||
dev->nvr_path = "aha1542c_0.nvr";
|
||||
dev->nvr_path[9] = device_get_instance() + 0x30;
|
||||
dev->fw_rev = "D001";
|
||||
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||
@@ -1059,7 +1060,8 @@ aha_init(const device_t *info)
|
||||
case AHA_154xCF:
|
||||
strcpy(dev->name, "AHA-154xCF");
|
||||
dev->bios_path = "roms/scsi/adaptec/aha1542cf211.bin";
|
||||
dev->nvr_path = "aha1542cf.nvr";
|
||||
dev->nvr_path = "aha1542cf_0.nvr";
|
||||
dev->nvr_path[10] = device_get_instance() + 0x30;
|
||||
dev->fw_rev = "E001";
|
||||
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||
@@ -1080,7 +1082,8 @@ aha_init(const device_t *info)
|
||||
bios_rev = (char *) device_get_config_bios("bios_rev");
|
||||
dev->bios_path = (char *) device_get_bios_file(info, bios_rev, 0);
|
||||
dev->mcode_path = (char *) device_get_bios_file(info, bios_rev, 1);
|
||||
dev->nvr_path = "aha1542cp.nvr";
|
||||
dev->nvr_path = "aha1542cp_0.nvr";
|
||||
dev->nvr_path[10] = device_get_instance() + 0x30;
|
||||
dev->fw_rev = aha1542cp_rev;
|
||||
dev->rom_shram = 0x3F80; /* shadow RAM address base */
|
||||
dev->rom_shramsz = 128; /* size of shadow RAM */
|
||||
|
||||
@@ -2571,37 +2571,39 @@ ncr53c8xx_init(const device_t *info)
|
||||
|
||||
switch (dev->chip) {
|
||||
case CHIP_810:
|
||||
dev->nvr_path = "ncr53c810.nvr";
|
||||
dev->nvr_path = "ncr53c810_0.nvr";
|
||||
dev->wide = 0;
|
||||
break;
|
||||
case CHIP_815:
|
||||
dev->chip_rev = 0x04;
|
||||
dev->nvr_path = "ncr53c815.nvr";
|
||||
dev->nvr_path = "ncr53c815_0.nvr";
|
||||
dev->wide = 0;
|
||||
break;
|
||||
case CHIP_820:
|
||||
dev->nvr_path = "ncr53c820.nvr";
|
||||
dev->nvr_path = "ncr53c820_0.nvr";
|
||||
dev->wide = 1;
|
||||
break;
|
||||
case CHIP_825:
|
||||
dev->chip_rev = 0x26;
|
||||
dev->nvr_path = "ncr53c825a.nvr";
|
||||
dev->nvr_path = "ncr53c825_0.nvr";
|
||||
dev->wide = 1;
|
||||
break;
|
||||
case CHIP_860:
|
||||
scsi_bus_set_speed(dev->bus, 20000000.0);
|
||||
dev->chip_rev = 0x04;
|
||||
dev->nvr_path = "ncr53c860.nvr";
|
||||
dev->nvr_path = "ncr53c860_0.nvr";
|
||||
dev->wide = 1;
|
||||
break;
|
||||
case CHIP_875:
|
||||
scsi_bus_set_speed(dev->bus, 40000000.0);
|
||||
dev->chip_rev = 0x04;
|
||||
dev->nvr_path = "ncr53c875.nvr";
|
||||
dev->nvr_path = "ncr53c875_0.nvr";
|
||||
dev->wide = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
dev->nvr_path[10] = device_get_instance() + 0x30;
|
||||
|
||||
ncr53c8xx_pci_bar[0].addr_regs[0] = 1;
|
||||
ncr53c8xx_pci_bar[1].addr_regs[0] = 0;
|
||||
ncr53c8xx_pci_regs[0x04] = 3;
|
||||
|
||||
@@ -1856,7 +1856,8 @@ dc390_init(UNUSED(const device_t *info))
|
||||
if (dev->has_bios)
|
||||
esp_bios_disable(dev);
|
||||
|
||||
dev->nvr_path = "dc390.nvr";
|
||||
dev->nvr_path = "dc390_0.nvr";
|
||||
dev->nvr_path[6] = device_get_instance() + 0x30;
|
||||
|
||||
/* Load the serial EEPROM. */
|
||||
dc390_load_eeprom(dev);
|
||||
|
||||
@@ -20,7 +20,7 @@ add_library(sio OBJECT sio_acc3221.c sio_ali5123.c sio_f82c710.c sio_82091aa.c
|
||||
sio_prime3b.c sio_prime3c.c
|
||||
sio_w83787f.c sio_w83877f.c sio_w83977f.c
|
||||
sio_um8663f.c sio_um8669f.c
|
||||
sio_vt82c686.c)
|
||||
sio_vl82c113.c sio_vt82c686.c)
|
||||
|
||||
if(SIO_DETECT)
|
||||
target_sources(sio PRIVATE sio_detect.c)
|
||||
|
||||
163
src/sio/sio_vl82c113.c
Normal file
163
src/sio/sio_vl82c113.c
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Implementation of the VLSI VL82c113 Combination I/O Chip.
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2024 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/sio.h>
|
||||
|
||||
typedef struct vl82c113_t {
|
||||
uint8_t index;
|
||||
uint8_t nvr_enabled;
|
||||
uint8_t regs[3];
|
||||
uint8_t pad;
|
||||
uint16_t nvr_base;
|
||||
int cur_reg;
|
||||
nvr_t *nvr;
|
||||
void *kbc;
|
||||
} vl82c113_t;
|
||||
|
||||
static void
|
||||
vl82c113_nvr_handler(vl82c113_t *dev)
|
||||
{
|
||||
const uint8_t nvr_enabled = (dev->regs[0x00]) & 0x01;
|
||||
const uint16_t nvr_base = ((dev->regs[0x01] << 8) | dev->regs[0x00]) & 0xfffe;
|
||||
|
||||
if ((nvr_enabled != dev->nvr_enabled) || (nvr_base != dev->nvr_base)) {
|
||||
if (dev->nvr_enabled && (dev->nvr_base != 0x0000))
|
||||
nvr_at_handler(0, dev->nvr_base, dev->nvr);
|
||||
|
||||
dev->nvr_enabled = nvr_enabled;
|
||||
dev->nvr_base = nvr_base;
|
||||
|
||||
if (dev->nvr_enabled && (dev->nvr_base != 0x0000))
|
||||
nvr_at_handler(1, dev->nvr_base, dev->nvr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vl82c113_out(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
vl82c113_t *dev = (vl82c113_t *) priv;
|
||||
|
||||
if (port == 0xec)
|
||||
dev->index = val;
|
||||
else if ((dev->index >= 0x1b) && (dev->index <= 0x1d)) {
|
||||
const uint8_t index = dev->index - 0x1b;
|
||||
const uint8_t valxor = dev->regs[index] ^ val;
|
||||
|
||||
dev->regs[index] = val;
|
||||
|
||||
switch (index) {
|
||||
default:
|
||||
break;
|
||||
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
if (valxor)
|
||||
vl82c113_nvr_handler(dev);
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
if (valxor & 0x02)
|
||||
kbc_at_set_ps2(dev->kbc, !(val & 0x02));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
vl82c113_in(uint16_t port, void *priv)
|
||||
{
|
||||
const vl82c113_t *dev = (vl82c113_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
if (port == 0xed) {
|
||||
if ((dev->index >= 0x1b) && (dev->index <= 0x1d))
|
||||
ret = dev->regs[dev->index - 0x1b];
|
||||
else if (dev->index == 0x1f)
|
||||
/* REVID */
|
||||
ret = 0xc0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
vl82c113_reset(void *priv)
|
||||
{
|
||||
vl82c113_t *dev = (vl82c113_t *) priv;
|
||||
|
||||
memset(dev->regs, 0x00, sizeof(dev->regs));
|
||||
|
||||
dev->regs[0x00] = 0x71;
|
||||
dev->regs[0x01] = 0x00;
|
||||
|
||||
dev->regs[0x02] = 0xc3;
|
||||
|
||||
kbc_at_set_ps2(dev->kbc, 0);
|
||||
|
||||
vl82c113_nvr_handler(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
vl82c113_close(void *priv)
|
||||
{
|
||||
vl82c113_t *dev = (vl82c113_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
static void *
|
||||
vl82c113_init(const device_t *info)
|
||||
{
|
||||
vl82c113_t *dev = (vl82c113_t *) calloc(1, sizeof(vl82c113_t));
|
||||
|
||||
dev->nvr = device_add(&at_nvr_device);
|
||||
|
||||
dev->nvr_enabled = 1;
|
||||
dev->nvr_base = 0x0070;
|
||||
|
||||
/* Commands are standard. */
|
||||
dev->kbc = device_add(&keyboard_at_device);
|
||||
|
||||
vl82c113_reset(dev);
|
||||
|
||||
io_sethandler(0x00ec, 0x0002, vl82c113_in, NULL, NULL, vl82c113_out, NULL, NULL, dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
const device_t vl82c113_device = {
|
||||
.name = "VLSI VL82c113 Combination I/O",
|
||||
.internal_name = "vl82c113",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = vl82c113_init,
|
||||
.close = vl82c113_close,
|
||||
.reset = vl82c113_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
@@ -425,7 +425,7 @@ const device_t ym3812_ymfm_device = {
|
||||
.init = ymfm_drv_init,
|
||||
.close = ymfm_drv_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
@@ -439,7 +439,7 @@ const device_t ymf262_ymfm_device = {
|
||||
.init = ymfm_drv_init,
|
||||
.close = ymfm_drv_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
@@ -453,7 +453,7 @@ const device_t ymf289b_ymfm_device = {
|
||||
.init = ymfm_drv_init,
|
||||
.close = ymfm_drv_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
@@ -467,7 +467,7 @@ const device_t ymf278b_ymfm_device = {
|
||||
.init = ymfm_drv_init,
|
||||
.close = ymfm_drv_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
|
||||
@@ -1722,19 +1722,18 @@ sb_exec_command(sb_dsp_t *dsp)
|
||||
sb_add_data(dsp, dsp->sb_test);
|
||||
break;
|
||||
case 0xF2: /* Trigger 8-bit IRQ */
|
||||
sb_dsp_log("Trigger IRQ\n");
|
||||
if (IS_ESS(dsp)) {
|
||||
if (!timer_is_enabled(&dsp->irq_timer)) {
|
||||
timer_set_delay_u64(&dsp->irq_timer, (100ULL * TIMER_USEC));
|
||||
}
|
||||
} else {
|
||||
sb_irq(dsp, 1);
|
||||
dsp->ess_irq_generic = true;
|
||||
sb_dsp_log("Trigger 8-bit IRQ\n");
|
||||
if (!timer_is_enabled(&dsp->irq_timer)) {
|
||||
timer_set_delay_u64(&dsp->irq_timer, (100ULL * TIMER_USEC));
|
||||
}
|
||||
break;
|
||||
case 0xF3: /* Trigger 16-bit IRQ */
|
||||
sb_dsp_log("Trigger IRQ\n");
|
||||
dsp->ess_irq_generic = true;
|
||||
sb_dsp_log("Trigger 16-bit IRQ\n");
|
||||
if (IS_ESS(dsp))
|
||||
dsp->ess_irq_generic = true;
|
||||
else if (!timer_is_enabled(&dsp->irq16_timer)) {
|
||||
timer_set_delay_u64(&dsp->irq16_timer, (100ULL * TIMER_USEC));
|
||||
}
|
||||
break;
|
||||
case 0xF8:
|
||||
if (dsp->sb_type < SB16)
|
||||
@@ -2061,6 +2060,15 @@ sb_dsp_irq_poll(void *priv)
|
||||
dsp->ess_irq_generic = true;
|
||||
}
|
||||
|
||||
void
|
||||
sb_dsp_irq16_poll(void *priv)
|
||||
{
|
||||
sb_dsp_t *dsp = (sb_dsp_t *) priv;
|
||||
|
||||
sb_irq(dsp, 0);
|
||||
dsp->ess_irq_generic = true;
|
||||
}
|
||||
|
||||
void
|
||||
sb_dsp_init(sb_dsp_t *dsp, int type, int subtype, void *parent)
|
||||
{
|
||||
@@ -2095,15 +2103,18 @@ sb_dsp_init(sb_dsp_t *dsp, int type, int subtype, void *parent)
|
||||
timer_add(&dsp->input_timer, sb_poll_i, dsp, 0);
|
||||
timer_add(&dsp->wb_timer, NULL, dsp, 0);
|
||||
timer_add(&dsp->irq_timer, sb_dsp_irq_poll, dsp, 0);
|
||||
timer_add(&dsp->irq16_timer, sb_dsp_irq16_poll, dsp, 0);
|
||||
|
||||
if (IS_ESS(dsp))
|
||||
/* Initialize ESS filter to 8 kHz. This will be recalculated when a set frequency command is
|
||||
sent. */
|
||||
recalc_sb16_filter(0, 8000 * 2);
|
||||
else
|
||||
else {
|
||||
timer_add(&dsp->irq16_timer, sb_dsp_irq16_poll, dsp, 0);
|
||||
/* Initialise SB16 filter to same cutoff as 8-bit SBs (3.2 kHz). This will be recalculated when
|
||||
a set frequency command is sent. */
|
||||
recalc_sb16_filter(0, 3200 * 2);
|
||||
}
|
||||
if (IS_ESS(dsp) || (dsp->sb_type >= SBPRO2)) {
|
||||
/* OPL3 or dual OPL2 is stereo. */
|
||||
if (dsp->sb_has_real_opl)
|
||||
|
||||
@@ -392,7 +392,7 @@ sdl_reload(void)
|
||||
}
|
||||
|
||||
int
|
||||
plat_vidapi(char *api)
|
||||
plat_vidapi(UNUSED(const char *api))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user