Merge branch 'master' into pc98x1

This commit is contained in:
TC1995
2024-08-07 16:07:40 +02:00
38 changed files with 1259 additions and 681 deletions

73
scripts/86Box-install-roms.sh Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/sh
URL="https://github.com/86Box/roms/archive/refs/tags/v4.2.zip"
TMP_FILE="/tmp/86Box-ROMS.zip"
EXTRACT_DIR="/tmp/86Box-ROMS-extracted"
DEFAULT_TARGET_DIR="$HOME/.local/share/86Box/roms/"
TARGET_DIR=${TARGET_DIR:-$DEFAULT_TARGET_DIR}
install_roms() {
if [ -d "$TARGET_DIR" ] && [ "$(ls -A $TARGET_DIR)" ]; then
echo "ROMS already installed in $TARGET_DIR"
echo "To (re)install, please first remove ROMS with -r parameter"
exit 1
fi
fetch -o "$TMP_FILE" "$URL"
if [ $? -ne 0 ]; then
echo "Failed to download the file from $URL"
exit 1
fi
mkdir -p "$EXTRACT_DIR"
unzip "$TMP_FILE" -d "$EXTRACT_DIR"
if [ $? -ne 0 ]; then
echo "Failed to decompress the file"
rm "$TMP_FILE"
exit 1
fi
mkdir -p "$TARGET_DIR"
cd "$EXTRACT_DIR"
TOP_LEVEL_DIR=$(find . -mindepth 1 -maxdepth 1 -type d)
if [ -d "$TOP_LEVEL_DIR" ]; then
mv "$TOP_LEVEL_DIR"/* "$TARGET_DIR"
fi
rm -rf "$TMP_FILE" "$EXTRACT_DIR"
echo "ROMS installed successfully in $TARGET_DIR"
}
remove_roms() {
if [ -d "$TARGET_DIR" ]; then
rm -rf "$TARGET_DIR"
echo "ROMS removed successfully from $TARGET_DIR"
else
echo "No ROMS directory found in $TARGET_DIR"
fi
}
help() {
echo ""
echo "$0 [-h|-i|-r]"
echo " -h : this help"
echo " -i : install (this parameter can be omitted)"
echo " -r : remove the ROMS"
echo ""
}
case "$1" in
-h)
help
;;
-r)
remove_roms
;;
-i|*)
install_roms
;;
esac
exit 0

View File

@@ -170,25 +170,23 @@ cleanup_error:
static int
bin_read(void *priv, uint8_t *buffer, uint64_t seek, size_t count)
{
track_file_t *tf;
cdrom_image_backend_log("CDROM: binary_read(%08lx, pos=%" PRIu64 " count=%lu)\n",
tf->fp, seek, count);
track_file_t *tf = NULL;
if ((tf = (track_file_t *) priv)->fp == NULL)
return 0;
cdrom_image_backend_log("CDROM: binary_read(%08lx, pos=%" PRIu64 " count=%lu)\n",
tf->fp, seek, count);
if (fseeko64(tf->fp, seek, SEEK_SET) == -1) {
#ifdef ENABLE_CDROM_IMAGE_BACKEND_LOG
cdrom_image_backend_log("CDROM: binary_read failed during seek!\n");
#endif
return 0;
}
if (fread(buffer, count, 1, tf->fp) != 1) {
#ifdef ENABLE_CDROM_IMAGE_BACKEND_LOG
cdrom_image_backend_log("CDROM: binary_read failed during read!\n");
#endif
return 0;
}
@@ -207,9 +205,7 @@ bin_read(void *priv, uint8_t *buffer, uint64_t seek, size_t count)
static uint64_t
bin_get_length(void *priv)
{
track_file_t *tf;
cdrom_image_backend_log("CDROM: binary_length(%08lx)\n", tf->fp);
track_file_t *tf = NULL;
if ((tf = (track_file_t *) priv)->fp == NULL)
return 0;
@@ -1159,10 +1155,9 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile)
trk.file = audio_init(filename, &error);
}
if (error) {
#ifdef ENABLE_CDROM_IMAGE_BACKEND_LOG
cdrom_image_backend_log("CUE: cannot open file '%s' in cue sheet!\n",
filename);
#endif
if (trk.file != NULL) {
trk.file->close(trk.file);
trk.file = NULL;
@@ -1177,9 +1172,8 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile)
/* Ignored commands. */
success = 1;
} else {
#ifdef ENABLE_CDROM_IMAGE_BACKEND_LOG
cdrom_image_backend_log("CUE: unsupported command '%s' in cue sheet!\n", command);
#endif
success = 0;
}

View File

@@ -107,8 +107,8 @@ sis_85c50x_shadow_recalc(sis_85c50x_t *dev)
if (dev->states[8 + i] != state) {
mem_set_mem_state_both(base, 0x00004000, state);
sis_85c50x_log("%05X-%05X: R%c, W%c\n", base, base + 0x3fff,
(dev->pci_conf[0x543 & (0x80 >> i)) ?
((dev->pci_conf[0x54] & 0x40) ? 'I' : 'D') : 'E',
(dev->pci_conf[0x54] & (0x80 >> i)) ?
((dev->pci_conf[0x53] & 0x40) ? 'I' : 'D') : 'E',
(dev->pci_conf[0x54] & (0x80 >> i)) ?
((dev->pci_conf[0x53] & 0x20) ? 'P' : 'I') : 'E');
dev->states[8 + i] = state;

View File

@@ -279,7 +279,7 @@ exec386_2386(int32_t cycs)
if (!cpu_state.abrt) {
#ifdef ENABLE_386_LOG
if (in_smm)
x386_2386_log("[%04X:%08X] %08X\n", CS, cpu_state.pc, fetchdat);
x386_log("[%04X:%08X] %08X\n", CS, cpu_state.pc, fetchdat);
#endif
opcode = fetchdat & 0xFF;
fetchdat >>= 8;

View File

@@ -130,10 +130,10 @@ typedef int (*OpFn)(uint32_t fetchdat);
static int tempc_fpu = 0;
#ifdef ENABLE_808X_LOG
#if 0
void dumpregs(int);
#endif
int x808x_do_log = ENABLE_808X_LOG;
int indump = 0;
static void
x808x_log(const char *fmt, ...)

View File

@@ -83,7 +83,9 @@ int fpu_cycles = 0;
int in_lock = 0;
#ifdef ENABLE_X86_LOG
#if 0
void dumpregs(int);
#endif
int x86_do_log = ENABLE_X86_LOG;
int indump = 0;
@@ -93,13 +95,14 @@ x86_log(const char *fmt, ...)
{
va_list ap;
if (x808x_do_log) {
if (x86_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#if 0
void
dumpregs(int force)
{
@@ -144,6 +147,7 @@ dumpregs(int force)
x87_dumpregs();
indump = 0;
}
#endif
#else
# define x86_log(fmt, ...)
#endif

View File

@@ -26,22 +26,22 @@ uint32_t x87_op_off;
uint16_t x87_pc_seg;
uint16_t x87_op_seg;
#ifdef ENABLE_FPU_LOG
int fpu_do_log = ENABLE_FPU_LOG;
#ifdef ENABLE_FPU_X87_LOG
int fpu_x87_do_log = ENABLE_FPU_X87_LOG;
void
fpu_log(const char *fmt, ...)
fpu_x87_log(const char *fmt, ...)
{
va_list ap;
if (fpu_do_log) {
if (fpu_x87_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
# define fpu_log(fmt, ...)
# define fpu_x87_log(fmt, ...)
#endif
#ifdef USE_NEW_DYNAREC
@@ -546,17 +546,17 @@ unpack_FPU_TW(uint16_t tag_byte)
return (twd >> 2);
}
#ifdef ENABLE_808X_LOG
#ifdef ENABLE_FPU_X87_LOG
void
x87_dumpregs(void)
{
if (cpu_state.ismmx) {
fpu_log("MM0=%016llX\tMM1=%016llX\tMM2=%016llX\tMM3=%016llX\n", cpu_state.MM[0].q, cpu_state.MM[1].q, cpu_state.MM[2].q, cpu_state.MM[3].q);
fpu_log("MM4=%016llX\tMM5=%016llX\tMM6=%016llX\tMM7=%016llX\n", cpu_state.MM[4].q, cpu_state.MM[5].q, cpu_state.MM[6].q, cpu_state.MM[7].q);
fpu_x87_log("MM0=%016llX\tMM1=%016llX\tMM2=%016llX\tMM3=%016llX\n", cpu_state.MM[0].q, cpu_state.MM[1].q, cpu_state.MM[2].q, cpu_state.MM[3].q);
fpu_x87_log("MM4=%016llX\tMM5=%016llX\tMM6=%016llX\tMM7=%016llX\n", cpu_state.MM[4].q, cpu_state.MM[5].q, cpu_state.MM[6].q, cpu_state.MM[7].q);
} else {
fpu_log("ST(0)=%f\tST(1)=%f\tST(2)=%f\tST(3)=%f\t\n", cpu_state.ST[cpu_state.TOP], cpu_state.ST[(cpu_state.TOP + 1) & 7], cpu_state.ST[(cpu_state.TOP + 2) & 7], cpu_state.ST[(cpu_state.TOP + 3) & 7]);
fpu_log("ST(4)=%f\tST(5)=%f\tST(6)=%f\tST(7)=%f\t\n", cpu_state.ST[(cpu_state.TOP + 4) & 7], cpu_state.ST[(cpu_state.TOP + 5) & 7], cpu_state.ST[(cpu_state.TOP + 6) & 7], cpu_state.ST[(cpu_state.TOP + 7) & 7]);
fpu_x87_log("ST(0)=%f\tST(1)=%f\tST(2)=%f\tST(3)=%f\t\n", cpu_state.ST[cpu_state.TOP], cpu_state.ST[(cpu_state.TOP + 1) & 7], cpu_state.ST[(cpu_state.TOP + 2) & 7], cpu_state.ST[(cpu_state.TOP + 3) & 7]);
fpu_x87_log("ST(4)=%f\tST(5)=%f\tST(6)=%f\tST(7)=%f\t\n", cpu_state.ST[(cpu_state.TOP + 4) & 7], cpu_state.ST[(cpu_state.TOP + 5) & 7], cpu_state.ST[(cpu_state.TOP + 6) & 7], cpu_state.ST[(cpu_state.TOP + 7) & 7]);
}
fpu_log("Status = %04X Control = %04X Tag = %04X\n", cpu_state.npxs, cpu_state.npxc, x87_gettag());
fpu_x87_log("Status = %04X Control = %04X Tag = %04X\n", cpu_state.npxs, cpu_state.npxc, x87_gettag());
}
#endif

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

@@ -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;

View File

@@ -83,7 +83,7 @@ ali5213_write(uint16_t addr, uint8_t val, void *priv)
{
ali5213_t *dev = (ali5213_t *) priv;
ali5213_log("[%04X:%08X] [W] %02X = %02X (%i)\n", CS, cpu_state.pc, port, val, dev->tries);
ali5213_log("[%04X:%08X] [W] %02X = %02X\n", CS, cpu_state.pc, addr, val);
switch (addr) {
case 0xf4: /* Usually it writes 30h here */
@@ -179,7 +179,7 @@ ali5213_read(uint16_t addr, void *priv)
break;
}
ali5213_log("[%04X:%08X] [R] %02X = %02X\n", CS, cpu_state.pc, port, ret);
ali5213_log("[%04X:%08X] [R] %02X = %02X\n", CS, cpu_state.pc, addr, ret);
return ret;
}

View File

@@ -79,7 +79,7 @@ um8673f_write(uint16_t addr, uint8_t val, void *priv)
{
um8673f_t *dev = (um8673f_t *) priv;
um8673f_log("[%04X:%08X] [W] %02X = %02X (%i)\n", CS, cpu_state.pc, port, val, dev->tries);
um8673f_log("[%04X:%08X] [W] %02X = %02X (%i)\n", CS, cpu_state.pc, addr, val, dev->tries);
switch (addr) {
case 0x108:
@@ -140,7 +140,7 @@ um8673f_read(uint16_t addr, void *priv)
break;
}
um8673f_log("[%04X:%08X] [R] %02X = %02X\n", CS, cpu_state.pc, port, ret);
um8673f_log("[%04X:%08X] [R] %02X = %02X\n", CS, cpu_state.pc, addr, ret);
return ret;
}

View File

@@ -59,7 +59,7 @@ w83769f_log(const char *fmt, ...)
{
va_list ap;
if (cmd640_do_log) {
if (w83769f_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);

View File

@@ -18,6 +18,7 @@
* Copyright 2016-2020 Miran Grca.
* Copyright 2017-2020 Fred N. van Kempen.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>

View File

@@ -21,14 +21,19 @@
#include <86box/86box.h>
#include <86box/fifo8.h>
void
fifo8_reset(Fifo8 *fifo)
{
fifo->num = 0;
fifo->head = 0;
}
void
fifo8_create(Fifo8 *fifo, uint32_t capacity)
{
fifo->data = (uint8_t *) malloc(capacity);
memset(fifo->data, 0, capacity);
fifo->data = (uint8_t *) calloc(1, capacity);
fifo->capacity = capacity;
fifo->head = 0;
fifo->num = 0;
fifo8_reset(fifo);
}
void
@@ -54,7 +59,7 @@ fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
uint32_t start;
uint32_t avail;
assert(fifo->num + num <= fifo->capacity);
assert((fifo->num + num) <= fifo->capacity);
start = (fifo->head + fifo->num) % fifo->capacity;
@@ -81,25 +86,72 @@ fifo8_pop(Fifo8 *fifo)
return ret;
}
const uint8_t *
fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
static const uint8_t
*fifo8_peekpop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr, int do_pop)
{
const uint8_t *ret;
uint8_t *ret;
uint32_t num;
assert((max > 0) && (max <= fifo->num));
num = MIN(fifo->capacity - fifo->head, max);
ret = &fifo->data[fifo->head];
if (do_pop) {
fifo->head += num;
fifo->head %= fifo->capacity;
fifo->num -= num;
}
if (numptr)
*numptr = num;
assert(max > 0 && max <= fifo->num);
*num = MIN(fifo->capacity - fifo->head, max);
ret = &fifo->data[fifo->head];
fifo->head += *num;
fifo->head %= fifo->capacity;
fifo->num -= *num;
return ret;
}
void
fifo8_reset(Fifo8 *fifo)
const uint8_t
*fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
{
fifo->num = 0;
fifo->head = 0;
return fifo8_peekpop_buf(fifo, max, numptr, 0);
}
const uint8_t
*fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
{
return fifo8_peekpop_buf(fifo, max, numptr, 1);
}
uint32_t
fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
{
const uint8_t *buf;
uint32_t n1, n2 = 0;
uint32_t len;
if (destlen == 0)
return 0;
len = destlen;
buf = fifo8_pop_bufptr(fifo, len, &n1);
if (dest)
memcpy(dest, buf, n1);
/* Add FIFO wraparound if needed */
len -= n1;
len = MIN(len, fifo8_num_used(fifo));
if (len) {
buf = fifo8_pop_bufptr(fifo, len, &n2);
if (dest) {
memcpy(&dest[n1], buf, n2);
}
}
return n1 + n2;
}
void
fifo8_drop(Fifo8 *fifo, uint32_t len)
{
len -= fifo8_pop_buf(fifo, NULL, len);
assert(len == 0);
}
int

View File

@@ -11,10 +11,11 @@
*
*
* Authors: Jasmine Iwanek, <jasmine@iwanek.co.uk>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2022 Jasmine Iwanek.
* Copyright 2022-2024 Jasmine Iwanek.
* Copyright 2024 Miran Grca.
*/
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
@@ -103,10 +104,10 @@ monster_fdc_close(void *priv)
monster_fdc_t *dev = (monster_fdc_t *) priv;
if (dev->nvr_path[0] != 0x00) {
FILE *f = nvr_fopen(dev->nvr_path, "wb");
if (f != NULL) {
fwrite(dev->bios_rom.rom, 1, 0x2000, f);
fclose(f);
FILE *fp = nvr_fopen(dev->nvr_path, "wb");
if (fp != NULL) {
fwrite(dev->bios_rom.rom, 1, 0x2000, fp);
fclose(fp);
}
}
@@ -144,10 +145,10 @@ monster_fdc_init(UNUSED(const device_t *info))
if (rom_writes_enabled) {
mem_mapping_set_write_handler(&dev->bios_rom.mapping, rom_write, rom_writew, rom_writel);
sprintf(dev->nvr_path, "monster_fdc_%i.nvr", device_get_instance());
FILE *f = nvr_fopen(dev->nvr_path, "rb");
if (f != NULL) {
fread(dev->bios_rom.rom, 1, 0x2000, f);
fclose(f);
FILE *fp = nvr_fopen(dev->nvr_path, "rb");
if (fp != NULL) {
(void) !fread(dev->bios_rom.rom, 1, 0x2000, fp);
fclose(fp);
}
}

View File

@@ -40,6 +40,7 @@
#include <86box/86box.h>
#include "cpu.h"
#include "x86seg.h"
#include "x87_sf.h"
#include "x87.h"
#include "x87_ops_conv.h"
#include <86box/io.h>

View File

@@ -69,28 +69,80 @@ extern uint8_t fifo8_pop(Fifo8 *fifo);
/**
* fifo8_pop_buf:
* @fifo: FIFO to pop from
* @max: maximum number of bytes to pop
* @num: actual number of returned bytes
* @dest: the buffer to write the data into (can be NULL)
* @destlen: size of @dest and maximum number of bytes to pop
*
* Pop a number of elements from the FIFO up to a maximum of max. The buffer
* Pop a number of elements from the FIFO up to a maximum of @destlen.
* The popped data is copied into the @dest buffer.
* Care is taken when the data wraps around in the ring buffer.
*
* Returns: number of bytes popped.
*/
extern uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen);
/**
* fifo8_pop_bufptr:
* @fifo: FIFO to pop from
* @max: maximum number of bytes to pop
* @numptr: pointer filled with number of bytes returned (can be NULL)
*
* New code should prefer to use fifo8_pop_buf() instead of fifo8_pop_bufptr().
*
* Pop a number of elements from the FIFO up to a maximum of @max. The buffer
* containing the popped data is returned. This buffer points directly into
* the FIFO backing store and data is invalidated once any of the fifo8_* APIs
* are called on the FIFO.
* the internal FIFO backing store and data (without checking for overflow!)
* and is invalidated once any of the fifo8_* APIs are called on the FIFO.
*
* The function may return fewer bytes than requested when the data wraps
* around in the ring buffer; in this case only a contiguous part of the data
* is returned.
*
* The number of valid bytes returned is populated in *num; will always return
* at least 1 byte. max must not be 0 or greater than the number of bytes in
* the FIFO.
* The number of valid bytes returned is populated in *@numptr; will always
* return at least 1 byte. max must not be 0 or greater than the number of
* bytes in the FIFO.
*
* Clients are responsible for checking the availability of requested data
* using fifo8_num_used().
*
* Returns: A pointer to popped data.
*/
extern const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num);
extern const uint8_t *fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr);
/**
* fifo8_peek_bufptr: read upto max bytes from the fifo
* @fifo: FIFO to read from
* @max: maximum number of bytes to peek
* @numptr: pointer filled with number of bytes returned (can be NULL)
*
* Peek into a number of elements from the FIFO up to a maximum of @max.
* The buffer containing the data peeked into is returned. This buffer points
* directly into the FIFO backing store. Since data is invalidated once any
* of the fifo8_* APIs are called on the FIFO, it is the caller responsibility
* to access it before doing further API calls.
*
* The function may return fewer bytes than requested when the data wraps
* around in the ring buffer; in this case only a contiguous part of the data
* is returned.
*
* The number of valid bytes returned is populated in *@numptr; will always
* return at least 1 byte. max must not be 0 or greater than the number of
* bytes in the FIFO.
*
* Clients are responsible for checking the availability of requested data
* using fifo8_num_used().
*
* Returns: A pointer to peekable data.
*/
extern const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr);
/**
* fifo8_drop:
* @fifo: FIFO to drop bytes
* @len: number of bytes to drop
*
* Drop (consume) bytes from a FIFO.
*/
extern void fifo8_drop(Fifo8 *fifo, uint32_t len);
/**
* fifo8_reset:

View File

@@ -272,6 +272,7 @@ extern uint8_t keyboard_get_shift(void);
extern void keyboard_get_states(uint8_t *cl, uint8_t *nl, uint8_t *sl);
extern void keyboard_set_states(uint8_t cl, uint8_t nl, uint8_t sl);
extern int keyboard_recv(uint16_t key);
extern int keyboard_recv_ui(uint16_t key);
extern int keyboard_isfsenter(void);
extern int keyboard_isfsenter_up(void);
extern int keyboard_isfsexit(void);

View File

@@ -900,7 +900,7 @@ extern int machine_ps2_model_70_type4_init(const machine_t *);
/* m_tandy.c */
extern int tandy1k_eeprom_read(void);
extern int machine_tandy_init(const machine_t *);
extern int machine_tandy1000sx_init(const machine_t *);
extern int machine_tandy1000hx_init(const machine_t *);
extern int machine_tandy1000sl2_init(const machine_t *);

View File

@@ -19,6 +19,8 @@
#ifndef EMU_PIT_H
#define EMU_PIT_H
#define NUM_COUNTERS 3
typedef struct ctr_t {
uint8_t m;
uint8_t ctrl;
@@ -68,7 +70,7 @@ typedef struct PIT {
int clock;
pc_timer_t callback_timer;
ctr_t counters[3];
ctr_t counters[NUM_COUNTERS];
uint8_t ctrl;

View File

@@ -68,7 +68,7 @@ typedef struct ctrf_t {
typedef struct pitf_t {
int flags;
ctrf_t counters[3];
ctrf_t counters[NUM_COUNTERS];
uint8_t ctrl;

View File

@@ -25,6 +25,7 @@
#ifndef SCSI_PCSCSI_H
#define SCSI_PCSCSI_H
extern const device_t am53c974_pci_device;
extern const device_t dc390_pci_device;
extern const device_t ncr53c90a_mca_device;

View File

@@ -52,6 +52,7 @@ enum {
enum {
TYPE_TANDY = 0,
TYPE_TANDY1000SX,
TYPE_TANDY1000HX,
TYPE_TANDY1000SL2
};
@@ -129,6 +130,7 @@ typedef struct tandy_t {
uint32_t base;
uint32_t mask;
int is_hx;
int is_sl2;
t1kvid_t *vid;
@@ -715,13 +717,8 @@ recalc_timings(tandy_t *dev)
double _dispofftime;
double disptime;
if (vid->mode & 1) {
disptime = vid->crtc[0] + 1;
_dispontime = vid->crtc[1];
} else {
disptime = (vid->crtc[0] + 1) << 1;
_dispontime = vid->crtc[1] << 1;
}
disptime = vid->crtc[0] + 1;
_dispontime = vid->crtc[1];
_dispofftime = disptime - _dispontime;
_dispontime *= CGACONST;
@@ -984,10 +981,10 @@ vid_poll(void *priv)
for (x = 0; x < vid->crtc[1]; x++) {
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000) + 1];
vid->ma++;
buffer32->line[vid->displine << 1][(x << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 8] = buffer32->line[vid->displine << 1][(x << 3) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 9] = vid->array[((dat >> 12) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 10] = buffer32->line[vid->displine << 1][(x << 3) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 11] = vid->array[((dat >> 8) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 12] = buffer32->line[vid->displine << 1][(x << 3) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 13] = vid->array[((dat >> 4) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 14] = buffer32->line[vid->displine << 1][(x << 3) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 15] = vid->array[(dat & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 8] = buffer32->line[vid->displine << 1][(x << 3) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 9] = vid->array[((dat >> 12) & vid->array[1] & 0x0f) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 10] = buffer32->line[vid->displine << 1][(x << 3) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 11] = vid->array[((dat >> 8) & vid->array[1] & 0x0f) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 12] = buffer32->line[vid->displine << 1][(x << 3) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 13] = vid->array[((dat >> 4) & vid->array[1] & 0x0f) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 3) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 14] = buffer32->line[vid->displine << 1][(x << 3) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 3) + 15] = vid->array[(dat & vid->array[1] & 0x0f) + 16] + 16;
}
} else if (vid->array[3] & 0x10) { /*160x200x16*/
for (x = 0; x < vid->crtc[1]; x++) {
@@ -997,10 +994,10 @@ vid_poll(void *priv)
dat = (vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000)] << 8) | vid->vram[((vid->ma << 1) & 0x1fff) + ((vid->sc & 3) * 0x2000) + 1];
}
vid->ma++;
buffer32->line[vid->displine << 1][(x << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 8] = buffer32->line[vid->displine << 1][(x << 4) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 9] = buffer32->line[vid->displine << 1][(x << 4) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 10] = buffer32->line[vid->displine << 1][(x << 4) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 11] = vid->array[((dat >> 12) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 12] = buffer32->line[vid->displine << 1][(x << 4) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 13] = buffer32->line[vid->displine << 1][(x << 4) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 14] = buffer32->line[vid->displine << 1][(x << 4) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 15] = vid->array[((dat >> 8) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 16] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 16] = buffer32->line[vid->displine << 1][(x << 4) + 17] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 17] = buffer32->line[vid->displine << 1][(x << 4) + 18] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 18] = buffer32->line[vid->displine << 1][(x << 4) + 19] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 19] = vid->array[((dat >> 4) & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 20] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 20] = buffer32->line[vid->displine << 1][(x << 4) + 21] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 21] = buffer32->line[vid->displine << 1][(x << 4) + 22] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 22] = buffer32->line[vid->displine << 1][(x << 4) + 23] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 23] = vid->array[(dat & vid->array[1]) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 8] = buffer32->line[vid->displine << 1][(x << 4) + 9] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 9] = buffer32->line[vid->displine << 1][(x << 4) + 10] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 10] = buffer32->line[vid->displine << 1][(x << 4) + 11] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 11] = vid->array[((dat >> 12) & vid->array[1] & 0x0f) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 12] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 12] = buffer32->line[vid->displine << 1][(x << 4) + 13] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 13] = buffer32->line[vid->displine << 1][(x << 4) + 14] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 14] = buffer32->line[vid->displine << 1][(x << 4) + 15] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 15] = vid->array[((dat >> 8) & vid->array[1] & 0x0f) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 16] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 16] = buffer32->line[vid->displine << 1][(x << 4) + 17] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 17] = buffer32->line[vid->displine << 1][(x << 4) + 18] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 18] = buffer32->line[vid->displine << 1][(x << 4) + 19] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 19] = vid->array[((dat >> 4) & vid->array[1] & 0x0f) + 16] + 16;
buffer32->line[vid->displine << 1][(x << 4) + 20] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 20] = buffer32->line[vid->displine << 1][(x << 4) + 21] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 21] = buffer32->line[vid->displine << 1][(x << 4) + 22] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 22] = buffer32->line[vid->displine << 1][(x << 4) + 23] = buffer32->line[(vid->displine << 1) + 1][(x << 4) + 23] = vid->array[(dat & vid->array[1] & 0x0f) + 16] + 16;
}
} else if (vid->array[3] & 0x08) { /*640x200x4 - this implementation is a complete guess!*/
for (x = 0; x < vid->crtc[1]; x++) {
@@ -1576,12 +1573,12 @@ tandy_write(uint16_t addr, uint8_t val, void *priv)
switch (addr) {
case 0x00a0:
if (val & 0x10) {
if (dev->is_hx && (val & 0x10)) {
dev->base = (mem_size - 256) * 1024;
dev->mask = 0x3ffff;
mem_mapping_set_addr(&ram_low_mapping, 0, dev->base);
mem_mapping_set_addr(&dev->ram_mapping,
((val >> 1) & 7) * 128 * 1024, 0x40000);
(((val >> 1) & 7) - 1) * 128 * 1024, 0x40000);
} else {
dev->base = (mem_size - 128) * 1024;
dev->mask = 0x1ffff;
@@ -1589,6 +1586,22 @@ tandy_write(uint16_t addr, uint8_t val, void *priv)
mem_mapping_set_addr(&dev->ram_mapping,
((val >> 1) & 7) * 128 * 1024, 0x20000);
}
if (dev->is_hx) {
io_removehandler(0x03d0, 16,
vid_in, NULL, NULL, vid_out, NULL, NULL, dev);
if (val & 0x01)
mem_mapping_disable(&dev->vid->mapping);
else {
io_sethandler(0x03d0, 16,
vid_in, NULL, NULL, vid_out, NULL, NULL, dev);
mem_mapping_set_addr(&dev->vid->mapping, 0xb8000, 0x8000);
}
} else {
if (val & 0x01)
mem_mapping_set_addr(&dev->vid->mapping, 0xc0000, 0x10000);
else
mem_mapping_set_addr(&dev->vid->mapping, 0xb8000, 0x8000);
}
dev->ram_bank = val;
break;
@@ -1718,8 +1731,7 @@ machine_tandy1k_init(const machine_t *model, int type)
{
tandy_t *dev;
dev = malloc(sizeof(tandy_t));
memset(dev, 0x00, sizeof(tandy_t));
dev = calloc(1, sizeof(tandy_t));
machine_common_init(model);
@@ -1745,6 +1757,7 @@ machine_tandy1k_init(const machine_t *model, int type)
switch (type) {
case TYPE_TANDY:
case TYPE_TANDY1000SX:
keyboard_set_table(scancode_tandy);
io_sethandler(0x00a0, 1,
tandy_read, NULL, NULL, tandy_write, NULL, NULL, dev);
@@ -1754,6 +1767,7 @@ machine_tandy1k_init(const machine_t *model, int type)
break;
case TYPE_TANDY1000HX:
dev->is_hx = 1;
keyboard_set_table(scancode_tandy);
io_sethandler(0x00a0, 1,
tandy_read, NULL, NULL, tandy_write, NULL, NULL, dev);
@@ -1790,7 +1804,7 @@ tandy1k_eeprom_read(void)
}
int
machine_tandy_init(const machine_t *model)
machine_tandy1000sx_init(const machine_t *model)
{
int ret;
@@ -1800,7 +1814,7 @@ machine_tandy_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_tandy1k_init(model, TYPE_TANDY);
machine_tandy1k_init(model, TYPE_TANDY1000SX);
return ret;
}

View File

@@ -1503,7 +1503,7 @@ const machine_t machines[] = {
.internal_name = "tandy",
.type = MACHINE_TYPE_8088,
.chipset = MACHINE_CHIPSET_PROPRIETARY,
.init = machine_tandy_init,
.init = machine_tandy1000sx_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
@@ -1521,7 +1521,7 @@ const machine_t machines[] = {
.bus_flags = MACHINE_PC,
.flags = MACHINE_VIDEO_FIXED,
.ram = {
.min = 128,
.min = 384,
.max = 640,
.step = 128
},
@@ -1560,7 +1560,7 @@ const machine_t machines[] = {
.bus_flags = MACHINE_PC,
.flags = MACHINE_VIDEO_FIXED,
.ram = {
.min = 384,
.min = 256,
.max = 640,
.step = 128
},

View File

@@ -22,13 +22,14 @@
* Copyright 2011-2023 Benjamin Poirier.
* Copyright 2023 Cacodemon345.
*/
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include <86box/timer.h>
#include <86box/pci.h>

View File

@@ -526,7 +526,7 @@ pit_timer_over(void *priv)
dev->clock ^= 1;
for (uint8_t i = 0; i < 3; i++)
for (uint8_t i = 0; i < NUM_COUNTERS; i++)
pit_ctr_set_clock_common(&dev->counters[i], dev->clock, dev);
timer_advance_u64(&dev->callback_timer, dev->pit_const >> 1ULL);
@@ -874,7 +874,7 @@ pit_device_reset(pit_t *dev)
{
dev->clock = 0;
for (uint8_t i = 0; i < 3; i++)
for (uint8_t i = 0; i < NUM_COUNTERS; i++)
ctr_reset(&dev->counters[i]);
}
@@ -885,7 +885,7 @@ pit_reset(pit_t *dev)
dev->clock = 0;
for (uint8_t i = 0; i < 3; i++)
for (uint8_t i = 0; i < NUM_COUNTERS; i++)
ctr_reset(&dev->counters[i]);
/* Disable speaker gate. */

View File

@@ -47,22 +47,22 @@
#define PIT_CUSTOM_CLOCK 64 /* The PIT uses custom clock inputs provided by another provider. */
#define PIT_SECONDARY 128 /* The PIT is secondary (ports 0048-004B). */
#ifdef ENABLE_PIT_LOG
int pit_do_log = ENABLE_PIT_LOG;
#ifdef ENABLE_PIT_FAST_LOG
int pit_fast_do_log = ENABLE_PIT_FAST_LOG;
static void
pit_log(const char *fmt, ...)
pit_fast_log(const char *fmt, ...)
{
va_list ap;
if (pit_do_log) {
if (pit_fast_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
# define pit_log(fmt, ...)
# define pit_fast_log(fmt, ...)
#endif
static void
@@ -420,7 +420,7 @@ pitf_write(uint16_t addr, uint8_t val, void *priv)
int t = (addr & 3);
ctrf_t *ctr;
pit_log("[%04X:%08X] pit_write(%04X, %02X, %08X)\n", CS, cpu_state.pc, addr, val, priv);
pit_fast_log("[%04X:%08X] pit_write(%04X, %02X, %08X)\n", CS, cpu_state.pc, addr, val, priv);
cycles -= ISA_CYCLES(8);
@@ -438,7 +438,7 @@ pitf_write(uint16_t addr, uint8_t val, void *priv)
pitf_ctr_latch_count(&dev->counters[1]);
if (val & 8)
pitf_ctr_latch_count(&dev->counters[2]);
pit_log("PIT %i: Initiated readback command\n", t);
pit_fast_log("PIT %i: Initiated readback command\n", t);
}
if (!(val & 0x10)) {
if (val & 2)
@@ -456,7 +456,7 @@ pitf_write(uint16_t addr, uint8_t val, void *priv)
if (!(dev->ctrl & 0x30)) {
pitf_ctr_latch_count(ctr);
dev->ctrl |= 0x30;
pit_log("PIT %i: Initiated latched read, %i bytes latched\n",
pit_fast_log("PIT %i: Initiated latched read, %i bytes latched\n",
t, ctr->latched);
} else {
ctr->ctrl = val;
@@ -476,7 +476,7 @@ pitf_write(uint16_t addr, uint8_t val, void *priv)
pitf_ctr_set_out(ctr, 1, dev);
ctr->disabled = 1;
pit_log("PIT %i: M = %i, RM/WM = %i, State = %i, Out = %i\n", t, ctr->m, ctr->rm, ctr->state, ctr->out);
pit_fast_log("PIT %i: M = %i, RM/WM = %i, Out = %i\n", t, ctr->m, ctr->rm, ctr->out);
}
ctr->thit = 0;
}
@@ -619,7 +619,7 @@ pitf_read(uint16_t addr, void *priv)
break;
}
pit_log("[%04X:%08X] pit_read(%04X, %08X) = %02X\n", CS, cpu_state.pc, addr, priv, ret);
pit_fast_log("[%04X:%08X] pit_read(%04X, %08X) = %02X\n", CS, cpu_state.pc, addr, priv, ret);
return ret;
}
@@ -670,7 +670,7 @@ pitf_reset(pitf_t *dev)
{
memset(dev, 0, sizeof(pitf_t));
for (uint8_t i = 0; i < 3; i++)
for (uint8_t i = 0; i < NUM_COUNTERS; i++)
ctr_reset(&dev->counters[i]);
/* Disable speaker gate. */
@@ -683,7 +683,7 @@ pitf_set_pit_const(void *data, uint64_t pit_const)
pitf_t *pit = (pitf_t *) data;
ctrf_t *ctr;
for (uint8_t i = 0; i < 3; i++) {
for (uint8_t i = 0; i < NUM_COUNTERS; i++) {
ctr = &pit->counters[i];
ctr->pit_const = pit_const;
}
@@ -728,7 +728,7 @@ pitf_init(const device_t *info)
dev->flags = info->local;
if (!(dev->flags & PIT_PS2) && !(dev->flags & PIT_CUSTOM_CLOCK)) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < NUM_COUNTERS; i++) {
ctrf_t *ctr = &dev->counters[i];
ctr->priv = dev;
timer_add(&ctr->timer, pitf_timer_over, (void *) ctr, 0);

View File

@@ -1218,7 +1218,7 @@ MainWindow::getTitle(wchar_t *title)
bool
MainWindow::eventFilter(QObject *receiver, QEvent *event)
{
if (!dopause && (mouse_capture || !kbd_req_capture)) {
if (!dopause) {
if (event->type() == QEvent::Shortcut) {
auto shortcutEvent = (QShortcutEvent *) event;
if (shortcutEvent->key() == ui->actionExit->shortcut()) {
@@ -1299,7 +1299,7 @@ MainWindow::showMessage_(int flags, const QString &header, const QString &messag
void
MainWindow::keyPressEvent(QKeyEvent *event)
{
if (send_keyboard_input && !(kbd_req_capture && !mouse_capture)) {
if (send_keyboard_input) {
#ifdef Q_OS_MACOS
processMacKeyboardInput(true, event);
#else
@@ -1312,10 +1312,10 @@ MainWindow::keyPressEvent(QKeyEvent *event)
if (keyboard_ismsexit())
plat_mouse_capture(0);
if ((video_fullscreen > 0) && (keyboard_recv(0x1D) || keyboard_recv(0x11D))) {
if (keyboard_recv(0x57))
if ((video_fullscreen > 0) && (keyboard_recv_ui(0x1D) || keyboard_recv_ui(0x11D))) {
if (keyboard_recv_ui(0x57))
ui->actionTake_screenshot->trigger();
else if (keyboard_recv(0x58))
else if (keyboard_recv_ui(0x58))
pc_send_cad();
}
@@ -1338,7 +1338,7 @@ void
MainWindow::keyReleaseEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Pause) {
if (keyboard_recv(0x38) && keyboard_recv(0x138)) {
if (keyboard_recv_ui(0x38) && keyboard_recv_ui(0x138)) {
plat_pause(dopause ^ 1);
}
}

View File

@@ -373,6 +373,9 @@
<property name="text">
<string>&amp;Fullscreen</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+PgUp</string>
</property>
</action>
<action name="actionSoftware_Renderer">
<property name="checkable">

View File

@@ -176,9 +176,6 @@ WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
RAWKEYBOARD rawKB = raw->data.keyboard;
scancode = rawKB.MakeCode;
if (kbd_req_capture && !mouse_capture)
return;
/* If it's not a scan code that starts with 0xE1 */
if ((rawKB.Flags & RI_KEY_E1)) {
if (rawKB.MakeCode == 0x1D) {

View File

@@ -82,6 +82,7 @@ static SCSI_CARD scsi_cards[] = {
{ &ncr53c825a_pci_device, },
{ &ncr53c860_pci_device, },
{ &ncr53c875_pci_device, },
{ &am53c974_pci_device, },
{ &dc390_pci_device, },
{ &buslogic_445s_device, },
{ &buslogic_445c_device, },

View File

@@ -3231,9 +3231,6 @@ begin:
if (dev->drv->bus_type == CDROM_BUS_SCSI) {
dev->buffer[3] = 0x02;
switch (dev->drv->type) {
case CDROM_TYPE_86BOX_100:
dev->buffer[2] = 0x05; /*SCSI-2 compliant*/
break;
case CDROM_TYPE_CHINON_CDS431_H42:
case CDROM_TYPE_DEC_RRD45_0436:
case CDROM_TYPE_MATSHITA_501_10b:

File diff suppressed because it is too large Load Diff

View File

@@ -752,7 +752,7 @@ cs423x_init(const device_t *info)
FILE *fp = rom_fopen(PNP_ROM_CS4236B, "rb");
if (fp) {
fread(&(dev->eeprom_data[23]), 1, 8201, fp);
(void) !fread(&(dev->eeprom_data[23]), 1, 8201, fp);
fclose(fp);
}

View File

@@ -342,11 +342,15 @@ MPU401_Reset(mpu_t *mpu)
static uint8_t
MPU401_ReadStatus(mpu_t *mpu)
{
uint8_t ret = 0x3f;
uint8_t ret = 0x00;
if (mpu->state.cmd_pending)
ret |= STATUS_OUTPUT_NOT_READY;
ret = STATUS_OUTPUT_NOT_READY;
if (!mpu->queue_used)
ret |= STATUS_INPUT_NOT_READY;
ret = STATUS_INPUT_NOT_READY;
ret |= 0x3f;
return ret;
}
@@ -378,15 +382,6 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
if ((val != 0xff) && (mpu->mode == M_UART))
return;
if (mpu->state.reset) {
if (mpu->state.cmd_pending || (val != 0xff)) {
mpu->state.cmd_pending = val + 1;
return;
}
timer_disable(&mpu->mpu401_reset_callback);
mpu->state.reset = 0;
}
/* In Intelligent mode, UART-only variants of the MPU-401 only support commands 0x3F and 0xFF. */
if (!mpu->intelligent && (val != 0x3f) && (val != 0xff))
return;

View File

@@ -3190,7 +3190,8 @@ sb_16_init(UNUSED(const device_t *info))
if (mpu_addr) {
sb->mpu = (mpu_t *) malloc(sizeof(mpu_t));
memset(sb->mpu, 0, sizeof(mpu_t));
mpu401_init(sb->mpu, device_get_config_hex16("base401"), device_get_config_int("irq"), M_UART, device_get_config_int("receive_input401"));
mpu401_init(sb->mpu, device_get_config_hex16("base401"), 0, M_UART,
device_get_config_int("receive_input401"));
} else
sb->mpu = NULL;
sb_dsp_set_mpu(&sb->dsp, sb->mpu);
@@ -3534,7 +3535,8 @@ sb_awe32_init(UNUSED(const device_t *info))
if (mpu_addr) {
sb->mpu = (mpu_t *) malloc(sizeof(mpu_t));
memset(sb->mpu, 0, sizeof(mpu_t));
mpu401_init(sb->mpu, device_get_config_hex16("base401"), device_get_config_int("irq"), M_UART, device_get_config_int("receive_input401"));
mpu401_init(sb->mpu, device_get_config_hex16("base401"), 0, M_UART,
device_get_config_int("receive_input401"));
} else
sb->mpu = NULL;
sb_dsp_set_mpu(&sb->dsp, sb->mpu);
@@ -4051,7 +4053,7 @@ static const device_config_t sb_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4161,7 +4163,7 @@ static const device_config_t sb15_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4290,7 +4292,7 @@ static const device_config_t sb2_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4356,7 +4358,7 @@ static const device_config_t sb_mcv_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4446,7 +4448,7 @@ static const device_config_t sb_pro_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4457,7 +4459,7 @@ static const device_config_t sb_pro_config[] = {
static const device_config_t sb_pro_mcv_config[] = {
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4610,7 +4612,7 @@ static const device_config_t sb_16_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4635,7 +4637,7 @@ static const device_config_t sb_16_pnp_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4692,7 +4694,7 @@ static const device_config_t sb_32_pnp_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4912,7 +4914,7 @@ static const device_config_t sb_awe32_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -4969,7 +4971,7 @@ static const device_config_t sb_awe32_pnp_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5046,7 +5048,7 @@ static const device_config_t sb_awe64_value_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5119,7 +5121,7 @@ static const device_config_t sb_awe64_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5184,7 +5186,7 @@ static const device_config_t sb_awe64_gold_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5314,7 +5316,7 @@ static const device_config_t ess_688_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5445,7 +5447,7 @@ static const device_config_t ess_1688_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5464,7 +5466,7 @@ static const device_config_t ess_1688_config[] = {
static const device_config_t ess_688_pnp_config[] = {
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
@@ -5483,7 +5485,7 @@ static const device_config_t ess_1688_pnp_config[] = {
},
{
.name = "receive_input",
.description = "Receive input (SB MIDI)",
.description = "Receive input (DSP MIDI)",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1

View File

@@ -205,7 +205,7 @@ plat_cdrom_read_sector(uint8_t *buffer, int raw, uint32_t sector)
/* Cooked */
}
plat_cdrom_close();
dummy_cdrom_ioctl_log("ReadSector status=%d, sector=%d, size=%" PRId64 ".\n", status, sector, (long long) size);
dummy_cdrom_ioctl_log("ReadSector sector=%d.\n", sector);
return 0;
}

View File

@@ -54,11 +54,17 @@ enum {
EGA_TSENG
};
enum {
EGA_TYPE_IBM = 0,
EGA_TYPE_OTHER = 1,
EGA_TYPE_COMPAQ = 2
};
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
static uint8_t ega_rotate[8][256];
static uint32_t pallook16[256];
static uint32_t pallook64[256];
static int ega_type = 0;
static int ega_type = EGA_TYPE_IBM;
static int old_overscan_color = 0;
/* 3C2 controls default mode on EGA. On VGA, it determines monitor type (mono or colour):
@@ -180,7 +186,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
}
break;
case 0x3c6:
if (ega_type == 2)
if (ega_type == EGA_TYPE_COMPAQ)
ega->ctl_mode = val;
break;
case 0x3ce:
@@ -295,47 +301,47 @@ ega_in(uint16_t addr, void *priv)
break;
case 0x3c0:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->attraddr | ega->attr_palette_enable;
break;
case 0x3c1:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->attrregs[ega->attraddr];
break;
case 0x3c2:
ret = (egaswitches & (8 >> egaswitchread)) ? 0x10 : 0x00;
break;
case 0x3c4:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->seqaddr;
break;
case 0x3c5:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->seqregs[ega->seqaddr & 0xf];
break;
case 0x3c6:
if (ega_type == 2)
if (ega_type == EGA_TYPE_COMPAQ)
ret = ega->ctl_mode;
break;
case 0x3c8:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = 2;
break;
case 0x3cc:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->miscout;
break;
case 0x3ce:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->gdcaddr;
break;
case 0x3cf:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->gdcreg[ega->gdcaddr & 0xf];
break;
case 0x3d0:
case 0x3d4:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->crtcreg;
break;
case 0x3d1:
@@ -349,28 +355,28 @@ ega_in(uint16_t addr, void *priv)
break;
case 0x10:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->crtc[ega->crtcreg];
else
ret = ega->light_pen >> 8;
break;
case 0x11:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->crtc[ega->crtcreg];
else
ret = ega->light_pen & 0xff;
break;
default:
if (ega_type == 1)
if (ega_type == EGA_TYPE_OTHER)
ret = ega->crtc[ega->crtcreg];
break;
}
break;
case 0x3da:
ega->attrff = 0;
if (ega_type == 2) {
if (ega_type == EGA_TYPE_COMPAQ) {
ret = ega->stat & 0xcf;
switch ((ega->attrregs[0x12] >> 4) & 0x03) {
case 0x00:
@@ -466,7 +472,7 @@ ega_recalctimings(ega_t *ega)
ega->linedbl = ega->crtc[9] & 0x80;
ega->rowcount = ega->crtc[9] & 0x1f;
if (ega_type == 2) {
if (ega_type == EGA_TYPE_COMPAQ) {
color = (ega->miscout & 1);
clksel = ((ega->miscout & 0xc) >> 2);
@@ -1278,6 +1284,10 @@ ega_read(uint32_t addr, void *priv)
temp4 &= (ega->colournocare & 8) ? 0xff : 0;
return ~(temp | temp2 | temp3 | temp4);
}
if ((ega_type == 2) && (ega->gdcreg[4] & 0x04))
return 0xff;
return ega->vram[addr | readplane];
}
@@ -1392,7 +1402,7 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
ega->crtc[6] = 255;
timer_add(&ega->timer, ega_poll, ega, 1);
if (ega_type == 2)
if (ega_type == EGA_TYPE_COMPAQ)
timer_add(&ega->dot_timer, ega_dot_poll, ega, 1);
}
@@ -1412,11 +1422,11 @@ ega_standalone_init(const device_t *info)
ega->y_add = 14;
if ((info->local == EGA_IBM) || (info->local == EGA_ISKRA) || (info->local == EGA_TSENG))
ega_type = 0;
ega_type = EGA_TYPE_IBM;
else if (info->local == EGA_COMPAQ)
ega_type = 2;
ega_type = EGA_TYPE_COMPAQ;
else
ega_type = 1;
ega_type = EGA_TYPE_OTHER;
ega->actual_type = info->local;
ega->chipset = 0;