Merge branch '86Box:master' into master

This commit is contained in:
Jos van Mourik
2024-09-15 01:19:12 +02:00
committed by GitHub
161 changed files with 9804 additions and 4701 deletions

View File

@@ -9,22 +9,53 @@
# CMake build script.
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
# Jasmine Iwanek, <jriwanek@gmail.com>
#
# Copyright 2020-2021 David Hrdlička.
# Copyright 2021 Andreas J. Reichel.
# Copyright 2021-2022 Jasmine Iwanek.
# Copyright 2021-2024 Jasmine Iwanek.
#
add_library(dev OBJECT bugger.c cassette.c cartridge.c hasp.c hwm.c hwm_lm75.c hwm_lm78.c hwm_gl518sm.c
hwm_vt82c686.c ibm_5161.c isamem.c isartc.c ../lpt.c pci_bridge.c
postcard.c serial.c unittester.c clock_ics9xxx.c isapnp.c i2c.c i2c_gpio.c
smbus_piix4.c smbus_ali7101.c smbus_sis5595.c keyboard.c keyboard_xt.c
kbc_at.c kbc_at_dev.c
add_library(dev OBJECT
bugger.c
cassette.c
cartridge.c
hasp.c
hwm.c
hwm_lm75.c
hwm_lm78.c
hwm_gl518sm.c
hwm_vt82c686.c
ibm_5161.c
isamem.c
isartc.c
../lpt.c
pci_bridge.c
postcard.c
serial.c
unittester.c
clock_ics9xxx.c
isapnp.c
i2c.c
i2c_gpio.c
smbus_piix4.c
smbus_ali7101.c
smbus_sis5595.c
keyboard.c
keyboard_xt.c
kbc_at.c
kbc_at_dev.c
keyboard_at.c
mouse.c mouse_bus.c mouse_serial.c mouse_ps2.c nec_mate_unk.c phoenix_486_jumper.c
mouse.c
mouse_bus.c
mouse_serial.c
mouse_ps2.c
nec_mate_unk.c
phoenix_486_jumper.c
serial_passthrough.c
novell_cardkey.c
mouse_microtouch_touchscreen.c)
mouse_microtouch_touchscreen.c
)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_libraries(86Box atomic)
@@ -45,3 +76,12 @@ endif()
if(LASERXT)
target_compile_definitions(dev PRIVATE USE_LASERXT)
endif()
if(PCL)
target_compile_definitions(dev PRIVATE USE_PCL)
endif()
if(WACOM)
target_compile_definitions(dev PRIVATE USE_WACOM)
target_sources(dev PRIVATE mouse_wacom_tablet.c)
endif()

View File

@@ -35,6 +35,7 @@ typedef struct cart_t {
} cart_t;
char cart_fns[2][512];
char *cart_image_history[2][CART_IMAGE_HISTORY];
static cart_t carts[2];
@@ -169,6 +170,7 @@ cart_close(int drive)
cart_image_close(drive);
cart_fns[drive][0] = 0;
ui_sb_update_icon_state(SB_CARTRIDGE | drive, 1);
resetx86();
}
void

View File

@@ -45,6 +45,7 @@ pc_cassette_t *cassette;
char cassette_fname[512];
char cassette_mode[512];
char * cassette_image_history[CASSETTE_IMAGE_HISTORY];
unsigned long cassette_pos;
unsigned long cassette_srate;
int cassette_enable;

View File

@@ -1699,7 +1699,7 @@ static const device_t brxt_device = {
.config = brxt_config
};
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_BRAT)
#ifdef USE_ISAMEM_BRAT
static const device_config_t brat_config[] = {
// clang-format off
{
@@ -1804,7 +1804,7 @@ static const device_t brat_device = {
.force_redraw = NULL,
.config = brat_config
};
#endif
#endif /* USE_ISAMEM_BRAT */
static const device_config_t lotech_config[] = {
// clang-format off
@@ -1871,7 +1871,7 @@ static const device_t lotech_device = {
.config = lotech_config
};
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_RAMPAGE)
#ifdef USE_ISAMEM_RAMPAGE
// TODO: Dual Paging support
// TODO: Conventional memory suppport
static const device_config_t rampage_config[] = {
@@ -1939,9 +1939,9 @@ static const device_t rampage_device = {
.force_redraw = NULL,
.config = rampage_config
};
#endif
#endif /* USE_ISAMEM_RAMPAGE */
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_IAB)
#ifdef USE_ISAMEM_IAB
static const device_config_t iab_config[] = {
// clang-format off
{
@@ -2038,7 +2038,7 @@ static const device_t iab_device = {
.force_redraw = NULL,
.config = iab_config
};
#endif
#endif /* USE_ISAMEM_IAB */
static const struct {
const device_t *dev;
@@ -2063,15 +2063,15 @@ static const struct {
{ &ev159_device },
{ &ev165a_device },
{ &brxt_device },
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_BRAT)
#ifdef USE_ISAMEM_BRAT
{ &brat_device },
#endif
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_RAMPAGE)
#endif /* USE_ISAMEM_BRAT */
#ifdef USE_ISAMEM_RAMPAGE
{ &rampage_device },
#endif
#if defined(DEV_BRANCH) && defined(USE_ISAMEM_IAB)
#endif /* USE_ISAMEM_RAMPAGE */
#ifdef USE_ISAMEM_IAB
{ &iab_device },
#endif
#endif /* USE_ISAMEM_IAB */
{ &lotech_device },
{ NULL }
// clang-format on

View File

@@ -277,9 +277,26 @@ kbc_translate(atkbc_t *dev, uint8_t val)
return ret;
}
kbc_at_log("ATkbc: translate is %s, ", translate ? "on" : "off");
#ifdef ENABLE_KEYBOARD_AT_LOG
kbc_at_log("scan code: ");
if (translate) {
kbc_at_log("%02X (original: ", (nont_to_t[val] | dev->sc_or));
if (dev->sc_or == 0x80)
kbc_at_log("F0 ");
kbc_at_log("%02X)\n", val);
} else
kbc_at_log("%02X\n", val);
#endif
ret = translate ? (nont_to_t[val] | dev->sc_or) : val;
if (dev->sc_or == 0x80)
dev->sc_or = 0;
/* Test for T3100E 'Fn' key (Right Alt / Right Ctrl) */
if ((dev != NULL) && (kbc_ven == KBC_VEN_TOSHIBA) &&
(keyboard_recv(0x138) || keyboard_recv(0x11d))) switch (val) {
(keyboard_recv(0x138) || keyboard_recv(0x11d))) switch (ret) {
case 0x4f:
t3100e_notify_set(0x01);
break; /* End */
@@ -329,23 +346,6 @@ kbc_translate(atkbc_t *dev, uint8_t val)
break;
}
kbc_at_log("ATkbc: translate is %s, ", translate ? "on" : "off");
#ifdef ENABLE_KEYBOARD_AT_LOG
kbc_at_log("scan code: ");
if (translate) {
kbc_at_log("%02X (original: ", (nont_to_t[val] | dev->sc_or));
if (dev->sc_or == 0x80)
kbc_at_log("F0 ");
kbc_at_log("%02X)\n", val);
} else
kbc_at_log("%02X\n", val);
#endif
ret = translate ? (nont_to_t[val] | dev->sc_or) : val;
if (dev->sc_or == 0x80)
dev->sc_or = 0;
return ret;
}
@@ -828,7 +828,7 @@ write_p2(atkbc_t *dev, uint8_t val)
and can find out what they actually did to make it boot from FFFFF0
correctly despite A20 being gated when the CPU is reset, this will
have to do. */
if (kbc_ven == KBC_VEN_SIEMENS)
if ((kbc_ven == KBC_VEN_SIEMENS) || !strcmp(machine_get_internal_name(), "acera1g"))
is486 ? loadcs(0xf000) : loadcs_2386(0xf000);
}
}

View File

@@ -25,6 +25,7 @@
#include <86box/86box.h>
#include <86box/machine.h>
#include <86box/keyboard.h>
#include <86box/plat.h>
#include "cpu.h"
@@ -50,7 +51,8 @@ uint16_t key_uncapture_2 = 0x14f; /* End */
void (*keyboard_send)(uint16_t val);
static int recv_key[512]; /* keyboard input buffer */
static int recv_key[512] = { 0 }; /* keyboard input buffer */
static int recv_key_ui[512] = { 0 }; /* keyboard input buffer */
static int oldkey[512];
#if 0
static int keydelay[512];
@@ -238,16 +240,13 @@ keyboard_input(int down, uint16_t scan)
}
}
/* NOTE: Shouldn't this be some sort of bit shift? An array of 8 unsigned 64-bit integers
should be enough. */
#if 0
recv_key[scan >> 6] |= ((uint64_t) down << ((uint64_t) scan & 0x3fLL));
#endif
/* pclog("Received scan code: %03X (%s)\n", scan & 0x1ff, down ? "down" : "up"); */
recv_key[scan & 0x1ff] = down;
recv_key_ui[scan & 0x1ff] = down;
key_process(scan & 0x1ff, down);
if (mouse_capture || !kbd_req_capture || video_fullscreen) {
recv_key[scan & 0x1ff] = down;
key_process(scan & 0x1ff, down);
}
}
static uint8_t
@@ -343,30 +342,36 @@ keyboard_recv(uint16_t key)
return recv_key[key];
}
int
keyboard_recv_ui(uint16_t key)
{
return recv_key_ui[key];
}
/* Do we have Control-Alt-PgDn in the keyboard buffer? */
int
keyboard_isfsenter(void)
{
return ((recv_key[0x01d] || recv_key[0x11d]) && (recv_key[0x038] || recv_key[0x138]) && (recv_key[0x049] || recv_key[0x149]));
return ((recv_key_ui[0x01d] || recv_key_ui[0x11d]) && (recv_key_ui[0x038] || recv_key_ui[0x138]) && (recv_key_ui[0x049] || recv_key_ui[0x149]));
}
int
keyboard_isfsenter_up(void)
{
return (!recv_key[0x01d] && !recv_key[0x11d] && !recv_key[0x038] && !recv_key[0x138] && !recv_key[0x049] && !recv_key[0x149]);
return (!recv_key_ui[0x01d] && !recv_key_ui[0x11d] && !recv_key_ui[0x038] && !recv_key_ui[0x138] && !recv_key_ui[0x049] && !recv_key_ui[0x149]);
}
/* Do we have Control-Alt-PgDn in the keyboard buffer? */
int
keyboard_isfsexit(void)
{
return ((recv_key[0x01d] || recv_key[0x11d]) && (recv_key[0x038] || recv_key[0x138]) && (recv_key[0x051] || recv_key[0x151]));
return ((recv_key_ui[0x01d] || recv_key_ui[0x11d]) && (recv_key_ui[0x038] || recv_key_ui[0x138]) && (recv_key_ui[0x051] || recv_key_ui[0x151]));
}
int
keyboard_isfsexit_up(void)
{
return (!recv_key[0x01d] && !recv_key[0x11d] && !recv_key[0x038] && !recv_key[0x138] && !recv_key[0x051] && !recv_key[0x151]);
return (!recv_key_ui[0x01d] && !recv_key_ui[0x11d] && !recv_key_ui[0x038] && !recv_key_ui[0x138] && !recv_key_ui[0x051] && !recv_key_ui[0x151]);
}
/* Do we have the mouse uncapture combination in the keyboard buffer? */
@@ -374,10 +379,10 @@ int
keyboard_ismsexit(void)
{
if ((key_prefix_2_1 != 0x000) || (key_prefix_2_2 != 0x000))
return ((recv_key[key_prefix_1_1] || recv_key[key_prefix_1_2]) &&
(recv_key[key_prefix_2_1] || recv_key[key_prefix_2_2]) &&
(recv_key[key_uncapture_1] || recv_key[key_uncapture_2]));
return ((recv_key_ui[key_prefix_1_1] || recv_key_ui[key_prefix_1_2]) &&
(recv_key_ui[key_prefix_2_1] || recv_key_ui[key_prefix_2_2]) &&
(recv_key_ui[key_uncapture_1] || recv_key_ui[key_uncapture_2]));
else
return ((recv_key[key_prefix_1_1] || recv_key[key_prefix_1_2]) &&
(recv_key[key_uncapture_1] || recv_key[key_uncapture_2]));
return ((recv_key_ui[key_prefix_1_1] || recv_key_ui[key_prefix_1_2]) &&
(recv_key_ui[key_uncapture_1] || recv_key_ui[key_uncapture_2]));
}

View File

@@ -2102,6 +2102,7 @@ keyboard_at_write(void *priv)
/* TODO: This is supposed to resend multiple bytes after some commands. */
case 0xfe: /* resend last scan code */
keyboard_at_log("%s: resend last scan code\n", dev->name);
kbc_at_dev_queue_add(dev, 0xfa, 0);
kbc_at_dev_queue_add(dev, dev->last_scan_code, 0);
break;

View File

@@ -928,11 +928,11 @@ kbd_read(uint16_t port, void *priv)
else {
/* LaserXT = Always 512k RAM;
LaserXT/3 = Bit 0: set = 512k, clear = 256k. */
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
#ifdef USE_LASERXT
if (kbd->type == KBD_TYPE_VTECH)
ret = ((mem_size == 512) ? 0x0d : 0x0c) | (hasfpu ? 0x02 : 0x00);
else
#endif
#endif /* USE_LASERXT */
ret = (kbd->pd & 0x0d) | (hasfpu ? 0x02 : 0x00);
}
}
@@ -1292,7 +1292,7 @@ const device_t keyboard_xt_t1x00_device = {
.config = NULL
};
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
#ifdef USE_LASERXT
const device_t keyboard_xt_lxt3_device = {
.name = "VTech Laser XT3 Keyboard",
.internal_name = "keyboard_xt_lxt3",
@@ -1306,7 +1306,7 @@ const device_t keyboard_xt_lxt3_device = {
.force_redraw = NULL,
.config = NULL
};
#endif
#endif /* USE_LASERXT */
const device_t keyboard_xt_olivetti_device = {
.name = "Olivetti XT Keyboard",

View File

@@ -98,7 +98,7 @@ static mouse_t mouse_devices[] = {
{ &mouse_wacom_device },
{ &mouse_wacom_artpad_device },
#endif
{ &mouse_mtouch_device },
{ &mouse_mtouch_device },
{ NULL }
// clang-format on
};
@@ -482,10 +482,10 @@ mouse_subtract_z(int *delta_z, int min, int max, int invert)
int z = atomic_load(&mouse_z);
int real_z = invert ? -z : z;
if (mouse_z > max) {
if (real_z > max) {
*delta_z = max;
real_z -= max;
} else if (mouse_z < min) {
} else if (real_z < min) {
*delta_z = min;
real_z += ABS(min);
} else {

View File

@@ -223,7 +223,7 @@ serial_write_fifo(serial_t *dev, uint8_t dat)
((dev->type >= SERIAL_16550) && dev->fifo_enabled) ?
fifo_get_count(dev->rcvr_fifo) : 0);
if (!(dev->mctrl & 0x10))
if ((dev != NULL) && !(dev->mctrl & 0x10))
write_fifo(dev, dat);
}

View File

@@ -148,7 +148,7 @@ smbus_sis5595_read_data(void *priv)
break;
}
smbus_sis5595_log("SMBus SIS5595: read(%02X) = %02x\n", addr, ret);
smbus_sis5595_log("SMBus SIS5595: read(%02X) = %02x\n", dev->addr, ret);
return ret;
}
@@ -171,7 +171,7 @@ smbus_sis5595_write_data(void *priv, uint8_t val)
uint16_t prev_stat;
uint16_t timer_bytes = 0;
smbus_sis5595_log("SMBus SIS5595: write(%02X, %02X)\n", addr, val);
smbus_sis5595_log("SMBus SIS5595: write(%02X, %02X)\n", dev->addr, val);
prev_stat = dev->next_stat;
dev->next_stat = 0x0000;