mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 01:48:21 -07:00
Merge remote-tracking branch 'origin/master' into version/4.1
This commit is contained in:
@@ -14,8 +14,8 @@
|
||||
#
|
||||
|
||||
# Define our flags
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -fomit-frame-pointer -Wall -fno-strict-aliasing -Werror=implicit-int -Werror=implicit-function-declaration -Werror=int-conversion -Werror=strict-prototypes -Werror=old-style-definition")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -fomit-frame-pointer -Wall -fno-strict-aliasing")
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -std=c99 -fomit-frame-pointer -Wall -fno-strict-aliasing -Werror=implicit-int -Werror=implicit-function-declaration -Werror=int-conversion -Werror=strict-prototypes -Werror=old-style-definition")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -std=c++11 -fomit-frame-pointer -Wall -fno-strict-aliasing")
|
||||
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -g0 -O3")
|
||||
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -g0 -O3")
|
||||
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -ggdb -Og")
|
||||
|
||||
12
src/86box.c
12
src/86box.c
@@ -918,11 +918,15 @@ pc_init_modules(void)
|
||||
|
||||
#ifdef USE_DYNAREC
|
||||
# if defined(__APPLE__) && defined(__aarch64__)
|
||||
pthread_jit_write_protect_np(0);
|
||||
if (__builtin_available(macOS 11.0, *)) {
|
||||
pthread_jit_write_protect_np(0);
|
||||
}
|
||||
# endif
|
||||
codegen_init();
|
||||
# if defined(__APPLE__) && defined(__aarch64__)
|
||||
pthread_jit_write_protect_np(1);
|
||||
if (__builtin_available(macOS 11.0, *)) {
|
||||
pthread_jit_write_protect_np(1);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -1105,6 +1109,10 @@ pc_reset_hard_init(void)
|
||||
/* Reset any ISA RTC cards. */
|
||||
isartc_reset();
|
||||
|
||||
/* Initialize the Voodoo cards here inorder to minmize
|
||||
the chances of the SCSI controller ending up on the bridge. */
|
||||
video_voodoo_init();
|
||||
|
||||
ui_sb_update_panes();
|
||||
|
||||
if (config_changed) {
|
||||
|
||||
@@ -429,7 +429,7 @@ viso_fill_time(uint8_t *data, time_t time, int format, int longform)
|
||||
or way too far into 64-bit space (Linux). Fall back to epoch. */
|
||||
time_t epoch = 0;
|
||||
time_s = localtime(&epoch);
|
||||
if (!time_s)
|
||||
if (UNLIKELY(!time_s))
|
||||
fatal("VISO: localtime(0) = NULL\n");
|
||||
|
||||
/* Force year clamping if the timestamp is known to be outside the supported ranges. */
|
||||
@@ -636,12 +636,8 @@ pad_susp:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((p - data) > 255)
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
fatal("VISO: Directory record overflow (%d) on entry %016" PRIX64 "\n", (uint32_t) (uintptr_t) (p - data), (uint64_t) (uintptr_t) entry);
|
||||
#else
|
||||
fatal("VISO: Directory record overflow (%d) on entry %08X\n", (uint32_t) (uintptr_t) (p - data), (uint32_t) (uintptr_t) entry);
|
||||
#endif
|
||||
if (UNLIKELY((p - data) > 255))
|
||||
fatal("VISO: Directory record overflow (%" PRIuPTR ") on entry %08" PRIXPTR "\n", (uintptr_t) (p - data), (uintptr_t) entry);
|
||||
|
||||
data[0] = p - data; /* length */
|
||||
return data[0];
|
||||
|
||||
@@ -684,7 +684,7 @@ host_arm64_CMPX_IMM(codeblock_t *block, int src_n_reg, uint64_t imm_data)
|
||||
} else if (!(imm_data & 0xfffffffffffff000ull)) {
|
||||
codegen_addlong(block, OPCODE_CMPX_IMM | Rd(REG_XZR) | Rn(src_n_reg) | IMM12(imm_data & 0xfff) | DATPROC_IMM_SHIFT(0));
|
||||
} else
|
||||
fatal("CMPX_IMM %08x\n", imm_data);
|
||||
fatal("CMPX_IMM %08llx\n", imm_data);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -484,7 +484,9 @@ exec386_dynarec_dyn(void)
|
||||
x86_was_reset = 0;
|
||||
|
||||
# if defined(__APPLE__) && defined(__aarch64__)
|
||||
pthread_jit_write_protect_np(0);
|
||||
if (__builtin_available(macOS 11.0, *)) {
|
||||
pthread_jit_write_protect_np(0);
|
||||
}
|
||||
# endif
|
||||
codegen_block_start_recompile(block);
|
||||
codegen_in_recompile = 1;
|
||||
@@ -568,7 +570,9 @@ exec386_dynarec_dyn(void)
|
||||
|
||||
codegen_in_recompile = 0;
|
||||
# if defined(__APPLE__) && defined(__aarch64__)
|
||||
pthread_jit_write_protect_np(1);
|
||||
if (__builtin_available(macOS 11.0, *)) {
|
||||
pthread_jit_write_protect_np(1);
|
||||
}
|
||||
# endif
|
||||
} else if (!cpu_state.abrt) {
|
||||
/* Mark block but do not recompile */
|
||||
|
||||
@@ -42,12 +42,14 @@
|
||||
/* TODO: Move to cpu.h so this can eventually be reused for 286+ as well. */
|
||||
#define QUEUE_MAX 6
|
||||
|
||||
/* NOTE: When porting from Rust to C, please use uintptr_t and not size_t,
|
||||
so it can be printed with PRIuPTR. */
|
||||
typedef struct queue_t
|
||||
{
|
||||
size_t size;
|
||||
size_t len;
|
||||
size_t back;
|
||||
size_t front;
|
||||
uintptr_t size;
|
||||
uintptr_t len;
|
||||
uintptr_t back;
|
||||
uintptr_t front;
|
||||
uint8_t q[QUEUE_MAX];
|
||||
uint16_t preload;
|
||||
queue_delay_t delay;
|
||||
@@ -74,19 +76,15 @@ queue_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
void
|
||||
queue_set_size(size_t size)
|
||||
queue_set_size(uintptr_t size)
|
||||
{
|
||||
if (size > QUEUE_MAX)
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
fatal("Requested prefetch queue of %" PRIi64 " bytes is too big\n", size);
|
||||
#else
|
||||
fatal("Requested prefetch queue of %i bytes is too big\n", size);
|
||||
#endif
|
||||
fatal("Requested prefetch queue of %" PRIuPTR " bytes is too big\n", size);
|
||||
|
||||
queue.size = size;
|
||||
}
|
||||
|
||||
size_t
|
||||
uintptr_t
|
||||
queue_get_len(void)
|
||||
{
|
||||
return queue.len;
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef enum queue_delay_t
|
||||
|
||||
#define FLAG_PRELOADED 0x8000
|
||||
|
||||
extern void queue_set_size(size_t size);
|
||||
extern size_t queue_get_len(void);
|
||||
extern void queue_set_size(uintptr_t size);
|
||||
extern uintptr_t queue_get_len(void);
|
||||
extern int queue_is_full(void);
|
||||
extern uint16_t queue_get_preload(void);
|
||||
extern int queue_has_preload(void);
|
||||
|
||||
@@ -394,8 +394,13 @@ typedef struct {
|
||||
MMX_REG MM[8];
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
# if defined(__APPLE__) && defined(__aarch64__)
|
||||
uint64_t old_fp_control;
|
||||
uint64_t new_fp_control;
|
||||
# else
|
||||
uint32_t old_fp_control;
|
||||
uint32_t new_fp_control;
|
||||
# endif
|
||||
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
uint16_t old_fp_control2;
|
||||
uint16_t new_fp_control2;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
#define CHECK_CURRENT_CARD() \
|
||||
if (1) { \
|
||||
do { \
|
||||
card = dev->first_card; \
|
||||
while (card) { \
|
||||
if (card->enable && (card->state == PNP_STATE_CONFIG)) \
|
||||
@@ -46,7 +46,7 @@
|
||||
isapnp_log("ISAPnP: No card in CONFIG state\n"); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
} while (0);
|
||||
|
||||
static const uint8_t pnp_init_key[32] = { 0x6A, 0xB5, 0xDA, 0xED, 0xF6, 0xFB, 0x7D, 0xBE,
|
||||
0xDF, 0x6F, 0x37, 0x1B, 0x0D, 0x86, 0xC3, 0x61,
|
||||
|
||||
@@ -493,10 +493,7 @@ pci_bridge_init(const device_t *info)
|
||||
|
||||
pci_bridge_reset(dev);
|
||||
|
||||
if (AGP_BRIDGE(dev->local))
|
||||
pci_add_card(PCI_ADD_AGPBRIDGE, pci_bridge_read, pci_bridge_write, dev, &dev->slot);
|
||||
else
|
||||
dev->slot = pci_add_bridge(pci_bridge_read, pci_bridge_write, dev);
|
||||
pci_add_bridge(AGP_BRIDGE(dev->local), pci_bridge_read, pci_bridge_write, dev, &dev->slot);
|
||||
|
||||
interrupt_count = sizeof(interrupts);
|
||||
interrupt_mask = interrupt_count - 1;
|
||||
|
||||
@@ -29,10 +29,14 @@
|
||||
#include <86box/postcard.h>
|
||||
#include "cpu.h"
|
||||
|
||||
#define POSTCARDS_NUM 4
|
||||
#define POSTCARD_MASK (POSTCARDS_NUM - 1)
|
||||
|
||||
static uint16_t postcard_port;
|
||||
static uint8_t postcard_written;
|
||||
static uint8_t postcard_code;
|
||||
static uint8_t postcard_prev_code;
|
||||
static uint8_t postcard_written[POSTCARDS_NUM];
|
||||
static uint8_t postcard_ports_num = 1;
|
||||
static uint8_t postcard_codes[POSTCARDS_NUM];
|
||||
static uint8_t postcard_prev_codes[POSTCARDS_NUM];
|
||||
#define UISTR_LEN 13
|
||||
static char postcard_str[UISTR_LEN]; /* UI output string */
|
||||
|
||||
@@ -61,12 +65,46 @@ int postcard_do_log = 0;
|
||||
static void
|
||||
postcard_setui(void)
|
||||
{
|
||||
if (!postcard_written)
|
||||
sprintf(postcard_str, "POST: -- --");
|
||||
else if (postcard_written == 1)
|
||||
sprintf(postcard_str, "POST: %02X --", postcard_code);
|
||||
else
|
||||
sprintf(postcard_str, "POST: %02X %02X", postcard_code, postcard_prev_code);
|
||||
if (postcard_ports_num > 1) {
|
||||
char ps[2][POSTCARDS_NUM][64] = { { 0 },
|
||||
{ 0 } };
|
||||
for (uint8_t i = 0; i < POSTCARDS_NUM; i++) {
|
||||
if (!postcard_written[i]) {
|
||||
sprintf(ps[0][i], "--");
|
||||
sprintf(ps[1][i], "--");
|
||||
} else if (postcard_written[i] == 1) {
|
||||
sprintf(ps[0][i], "%02X", postcard_codes[i]);
|
||||
sprintf(ps[1][i], "--");
|
||||
} else {
|
||||
sprintf(ps[0][i], "%02X", postcard_codes[i]);
|
||||
sprintf(ps[1][i], "%02X", postcard_prev_codes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
switch (postcard_ports_num) {
|
||||
default:
|
||||
case 2:
|
||||
sprintf(postcard_str, "POST: %s%s %s%s",
|
||||
ps[0][0], ps[0][1], ps[1][0], ps[1][1]);
|
||||
break;
|
||||
case 3:
|
||||
sprintf(postcard_str, "POST: %s/%s%s %s/%s%s",
|
||||
ps[0][0], ps[0][1], ps[0][2], ps[1][0], ps[1][1], ps[1][2]);
|
||||
break;
|
||||
case 4:
|
||||
sprintf(postcard_str, "POST: %s%s/%s%s %s%s/%s%s",
|
||||
ps[0][0], ps[0][1], ps[0][2], ps[0][3],
|
||||
ps[1][0], ps[1][1], ps[1][2], ps[1][3]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!postcard_written[0])
|
||||
sprintf(postcard_str, "POST: -- --");
|
||||
else if (postcard_written[0] == 1)
|
||||
sprintf(postcard_str, "POST: %02X --", postcard_codes[0]);
|
||||
else
|
||||
sprintf(postcard_str, "POST: %02X %02X", postcard_codes[0], postcard_prev_codes[0]);
|
||||
}
|
||||
|
||||
ui_sb_bugui(postcard_str);
|
||||
|
||||
@@ -79,22 +117,27 @@ postcard_setui(void)
|
||||
static void
|
||||
postcard_reset(void)
|
||||
{
|
||||
postcard_written = 0;
|
||||
postcard_code = postcard_prev_code = 0x00;
|
||||
memset(postcard_written, 0x00, POSTCARDS_NUM * sizeof(uint8_t));
|
||||
|
||||
memset(postcard_codes, 0x00, POSTCARDS_NUM * sizeof(uint8_t));
|
||||
memset(postcard_prev_codes, 0x00, POSTCARDS_NUM * sizeof(uint8_t));
|
||||
|
||||
postcard_setui();
|
||||
}
|
||||
|
||||
static void
|
||||
postcard_write(UNUSED(uint16_t port), uint8_t val, UNUSED(void *priv))
|
||||
postcard_write(uint16_t port, uint8_t val, UNUSED(void *priv))
|
||||
{
|
||||
if (postcard_written && (val == postcard_code))
|
||||
uint8_t matches = 0;
|
||||
|
||||
if (postcard_written[port & POSTCARD_MASK] &&
|
||||
(val == postcard_codes[port & POSTCARD_MASK]))
|
||||
return;
|
||||
|
||||
postcard_prev_code = postcard_code;
|
||||
postcard_code = val;
|
||||
if (postcard_written < 2)
|
||||
postcard_written++;
|
||||
postcard_prev_codes[port & POSTCARD_MASK] = postcard_codes[port & POSTCARD_MASK];
|
||||
postcard_codes[port & POSTCARD_MASK] = val;
|
||||
if (postcard_written[port & POSTCARD_MASK] < 2)
|
||||
postcard_written[port & POSTCARD_MASK]++;
|
||||
|
||||
postcard_setui();
|
||||
}
|
||||
@@ -102,7 +145,7 @@ postcard_write(UNUSED(uint16_t port), uint8_t val, UNUSED(void *priv))
|
||||
static void *
|
||||
postcard_init(UNUSED(const device_t *info))
|
||||
{
|
||||
postcard_reset();
|
||||
postcard_ports_num = 1;
|
||||
|
||||
if (machine_has_bus(machine, MACHINE_BUS_MCA))
|
||||
postcard_port = 0x680; /* MCA machines */
|
||||
@@ -110,16 +153,21 @@ postcard_init(UNUSED(const device_t *info))
|
||||
postcard_port = 0x190; /* ISA PS/2 machines */
|
||||
else if (strstr(machines[machine].name, " IBM XT "))
|
||||
postcard_port = 0x60; /* IBM XT */
|
||||
else if (strstr(machines[machine].name, " IBM PCjr"))
|
||||
else if (strstr(machines[machine].name, " IBM PCjr")) {
|
||||
postcard_port = 0x10; /* IBM PCjr */
|
||||
else if (strstr(machines[machine].name, " Compaq ") && !machine_has_bus(machine, MACHINE_BUS_PCI))
|
||||
postcard_ports_num = 3; /* IBM PCjr error ports 11h and 12h */
|
||||
} else if (strstr(machines[machine].name, " Compaq ") && !machine_has_bus(machine, MACHINE_BUS_PCI))
|
||||
postcard_port = 0x84; /* ISA Compaq machines */
|
||||
else if (strstr(machines[machine].name, "Olivetti"))
|
||||
postcard_port = 0x378; /* Olivetti machines */
|
||||
else
|
||||
postcard_port = 0x80; /* AT and clone machines */
|
||||
postcard_log("POST card initializing on port %04Xh\n", postcard_port);
|
||||
|
||||
postcard_reset();
|
||||
|
||||
if (postcard_port)
|
||||
io_sethandler(postcard_port, 1,
|
||||
io_sethandler(postcard_port, postcard_ports_num,
|
||||
NULL, NULL, NULL, postcard_write, NULL, NULL, NULL);
|
||||
|
||||
return postcard_write;
|
||||
@@ -129,7 +177,7 @@ static void
|
||||
postcard_close(UNUSED(void *priv))
|
||||
{
|
||||
if (postcard_port)
|
||||
io_removehandler(postcard_port, 1,
|
||||
io_removehandler(postcard_port, postcard_ports_num,
|
||||
NULL, NULL, NULL, postcard_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1015,13 +1015,8 @@ e14:
|
||||
|
||||
/* Add our supported features to the end. */
|
||||
if (client->response_pos < (sizeof(client->response) - 1))
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
client->response_pos += snprintf(&client->response[client->response_pos], sizeof(client->response) - client->response_pos,
|
||||
"PacketSize=%lX;swbreak+;hwbreak+;qXfer:features:read+", sizeof(client->packet) - 1);
|
||||
#else
|
||||
client->response_pos += snprintf(&client->response[client->response_pos], sizeof(client->response) - client->response_pos,
|
||||
"PacketSize=%X;swbreak+;hwbreak+;qXfer:features:read+", sizeof(client->packet) - 1);
|
||||
#endif
|
||||
"PacketSize=%X;swbreak+;hwbreak+;qXfer:features:read+", (int) (sizeof(client->packet) - 1));
|
||||
break;
|
||||
} else if (!strcmp(client->response, "Xfer")) {
|
||||
/* Read the transfer object. */
|
||||
|
||||
@@ -255,8 +255,9 @@ extern void pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int
|
||||
void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot);
|
||||
|
||||
/* Add an instance of the PCI bridge. */
|
||||
extern uint8_t pci_add_bridge(uint8_t (*read)(int func, int addr, void *priv),
|
||||
void (*write)(int func, int addr, uint8_t val, void *priv), void *priv);
|
||||
extern void pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv),
|
||||
void (*write)(int func, int addr, uint8_t val, void *priv), void *priv,
|
||||
uint8_t *slot);
|
||||
|
||||
/* Register the cards that have been added into slots. */
|
||||
extern void pci_register_cards(void);
|
||||
|
||||
@@ -137,6 +137,7 @@ extern void plat_vidapi_reload(void);
|
||||
extern void plat_vid_reload_options(void);
|
||||
extern uint32_t plat_language_code(char *langcode);
|
||||
extern void plat_language_code_r(uint32_t lcid, char *outbuf, int len);
|
||||
extern void plat_get_cpu_string(char *outbuf, uint8_t len);
|
||||
|
||||
/* Resource management. */
|
||||
extern void set_language(uint32_t id);
|
||||
|
||||
@@ -263,6 +263,8 @@ extern void video_close(void);
|
||||
extern void video_reset_close(void);
|
||||
extern void video_pre_reset(int card);
|
||||
extern void video_reset(int card);
|
||||
extern void video_post_reset(void);
|
||||
extern void video_voodoo_init(void);
|
||||
extern uint8_t video_force_resize_get_monitor(int monitor_index);
|
||||
extern void video_force_resize_set_monitor(uint8_t res, int monitor_index);
|
||||
extern void video_update_timing(void);
|
||||
|
||||
62
src/io.c
62
src/io.c
@@ -286,16 +286,22 @@ inb(uint16_t port)
|
||||
io_t *p;
|
||||
io_t *q;
|
||||
int found = 0;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int qfound = 0;
|
||||
#endif
|
||||
|
||||
if ((pci_flags & FLAG_CONFIG_IO_ON) && (port >= pci_base) && (port < (pci_base + pci_size))) {
|
||||
ret = pci_read(port, NULL);
|
||||
found = 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else if ((pci_flags & FLAG_CONFIG_DEV0_IO_ON) && (port >= 0xc000) && (port < 0xc100)) {
|
||||
ret = pci_read(port, NULL);
|
||||
found = 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else {
|
||||
p = io[port];
|
||||
while (p) {
|
||||
@@ -303,7 +309,9 @@ inb(uint16_t port)
|
||||
if (p->inb) {
|
||||
ret &= p->inb(port, p->priv);
|
||||
found |= 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -338,16 +346,22 @@ outb(uint16_t port, uint8_t val)
|
||||
io_t *p;
|
||||
io_t *q;
|
||||
int found = 0;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int qfound = 0;
|
||||
#endif
|
||||
|
||||
if ((pci_flags & FLAG_CONFIG_IO_ON) && (port >= pci_base) && (port < (pci_base + pci_size))) {
|
||||
pci_write(port, val, NULL);
|
||||
found = 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else if ((pci_flags & FLAG_CONFIG_DEV0_IO_ON) && (port >= 0xc000) && (port < 0xc100)) {
|
||||
pci_write(port, val, NULL);
|
||||
found = 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else {
|
||||
p = io[port];
|
||||
while (p) {
|
||||
@@ -355,7 +369,9 @@ outb(uint16_t port, uint8_t val)
|
||||
if (p->outb) {
|
||||
p->outb(port, val, p->priv);
|
||||
found |= 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -381,17 +397,23 @@ inw(uint16_t port)
|
||||
io_t *q;
|
||||
uint16_t ret = 0xffff;
|
||||
int found = 0;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int qfound = 0;
|
||||
#endif
|
||||
uint8_t ret8[2];
|
||||
|
||||
if ((pci_flags & FLAG_CONFIG_IO_ON) && (port >= pci_base) && (port < (pci_base + pci_size))) {
|
||||
ret = pci_readw(port, NULL);
|
||||
found = 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else if ((pci_flags & FLAG_CONFIG_DEV0_IO_ON) && (port >= 0xc000) && (port < 0xc100)) {
|
||||
ret = pci_readw(port, NULL);
|
||||
found = 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else {
|
||||
p = io[port];
|
||||
while (p) {
|
||||
@@ -399,7 +421,9 @@ inw(uint16_t port)
|
||||
if (p->inw) {
|
||||
ret &= p->inw(port, p->priv);
|
||||
found |= 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -413,7 +437,9 @@ inw(uint16_t port)
|
||||
if (p->inb && !p->inw) {
|
||||
ret8[i] &= p->inb(port + i, p->priv);
|
||||
found |= 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -444,16 +470,22 @@ outw(uint16_t port, uint16_t val)
|
||||
io_t *p;
|
||||
io_t *q;
|
||||
int found = 0;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int qfound = 0;
|
||||
#endif
|
||||
|
||||
if ((pci_flags & FLAG_CONFIG_IO_ON) && (port >= pci_base) && (port < (pci_base + pci_size))) {
|
||||
pci_writew(port, val, NULL);
|
||||
found = 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else if ((pci_flags & FLAG_CONFIG_DEV0_IO_ON) && (port >= 0xc000) && (port < 0xc100)) {
|
||||
pci_writew(port, val, NULL);
|
||||
found = 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else {
|
||||
p = io[port];
|
||||
while (p) {
|
||||
@@ -461,7 +493,9 @@ outw(uint16_t port, uint16_t val)
|
||||
if (p->outw) {
|
||||
p->outw(port, val, p->priv);
|
||||
found |= 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -473,7 +507,9 @@ outw(uint16_t port, uint16_t val)
|
||||
if (p->outb && !p->outw) {
|
||||
p->outb(port + i, val >> (i << 3), p->priv);
|
||||
found |= 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -502,16 +538,22 @@ inl(uint16_t port)
|
||||
uint16_t ret16[2];
|
||||
uint8_t ret8[4];
|
||||
int found = 0;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int qfound = 0;
|
||||
#endif
|
||||
|
||||
if ((pci_flags & FLAG_CONFIG_IO_ON) && (port >= pci_base) && (port < (pci_base + pci_size))) {
|
||||
ret = pci_readl(port, NULL);
|
||||
found = 4;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else if ((pci_flags & FLAG_CONFIG_DEV0_IO_ON) && (port >= 0xc000) && (port < 0xc100)) {
|
||||
ret = pci_readl(port, NULL);
|
||||
found = 4;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else {
|
||||
p = io[port];
|
||||
while (p) {
|
||||
@@ -519,7 +561,9 @@ inl(uint16_t port)
|
||||
if (p->inl) {
|
||||
ret &= p->inl(port, p->priv);
|
||||
found |= 4;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -532,7 +576,9 @@ inl(uint16_t port)
|
||||
if (p->inw && !p->inl) {
|
||||
ret16[0] &= p->inw(port, p->priv);
|
||||
found |= 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -543,7 +589,9 @@ inl(uint16_t port)
|
||||
if (p->inw && !p->inl) {
|
||||
ret16[1] &= p->inw(port + 2, p->priv);
|
||||
found |= 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -560,7 +608,9 @@ inl(uint16_t port)
|
||||
if (p->inb && !p->inw && !p->inl) {
|
||||
ret8[i] &= p->inb(port + i, p->priv);
|
||||
found |= 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -591,17 +641,23 @@ outl(uint16_t port, uint32_t val)
|
||||
io_t *p;
|
||||
io_t *q;
|
||||
int found = 0;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
int qfound = 0;
|
||||
#endif
|
||||
int i = 0;
|
||||
|
||||
if ((pci_flags & FLAG_CONFIG_IO_ON) && (port >= pci_base) && (port < (pci_base + pci_size))) {
|
||||
pci_writel(port, val, NULL);
|
||||
found = 4;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else if ((pci_flags & FLAG_CONFIG_DEV0_IO_ON) && (port >= 0xc000) && (port < 0xc100)) {
|
||||
pci_writel(port, val, NULL);
|
||||
found = 4;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound = 1;
|
||||
#endif
|
||||
} else {
|
||||
p = io[port];
|
||||
if (p) {
|
||||
@@ -610,7 +666,9 @@ outl(uint16_t port, uint32_t val)
|
||||
if (p->outl) {
|
||||
p->outl(port, val, p->priv);
|
||||
found |= 4;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -623,7 +681,9 @@ outl(uint16_t port, uint32_t val)
|
||||
if (p->outw && !p->outl) {
|
||||
p->outw(port + i, val >> (i << 3), p->priv);
|
||||
found |= 2;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
@@ -636,7 +696,9 @@ outl(uint16_t port, uint32_t val)
|
||||
if (p->outb && !p->outw && !p->outl) {
|
||||
p->outb(port + i, val >> (i << 3), p->priv);
|
||||
found |= 1;
|
||||
#ifdef ENABLE_IO_LOG
|
||||
qfound++;
|
||||
#endif
|
||||
}
|
||||
p = q;
|
||||
}
|
||||
|
||||
@@ -122,12 +122,20 @@ static int key_queue_end = 0;
|
||||
static void
|
||||
recalc_address(pcjr_t *pcjr)
|
||||
{
|
||||
uint8_t masked_memctrl = pcjr->memctrl;
|
||||
|
||||
/* According to the Technical Reference, bits 2 and 5 are
|
||||
ignored if there is only 64k of RAM and there are only
|
||||
4 pages. */
|
||||
if (mem_size < 128)
|
||||
masked_memctrl &= ~0x24;
|
||||
|
||||
if ((pcjr->memctrl & 0xc0) == 0xc0) {
|
||||
pcjr->vram = &ram[(pcjr->memctrl & 0x06) << 14];
|
||||
pcjr->b8000 = &ram[(pcjr->memctrl & 0x30) << 11];
|
||||
pcjr->vram = &ram[(masked_memctrl & 0x06) << 14];
|
||||
pcjr->b8000 = &ram[(masked_memctrl & 0x30) << 11];
|
||||
} else {
|
||||
pcjr->vram = &ram[(pcjr->memctrl & 0x07) << 14];
|
||||
pcjr->b8000 = &ram[(pcjr->memctrl & 0x38) << 11];
|
||||
pcjr->vram = &ram[(masked_memctrl & 0x07) << 14];
|
||||
pcjr->b8000 = &ram[(masked_memctrl & 0x38) << 11];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,11 +168,17 @@ vid_out(uint16_t addr, uint8_t val, void *priv)
|
||||
uint8_t old;
|
||||
|
||||
switch (addr) {
|
||||
case 0x3d0:
|
||||
case 0x3d2:
|
||||
case 0x3d4:
|
||||
case 0x3d6:
|
||||
pcjr->crtcreg = val & 0x1f;
|
||||
return;
|
||||
|
||||
case 0x3d1:
|
||||
case 0x3d3:
|
||||
case 0x3d5:
|
||||
case 0x3d7:
|
||||
old = pcjr->crtc[pcjr->crtcreg];
|
||||
pcjr->crtc[pcjr->crtcreg] = val & crtcmask[pcjr->crtcreg];
|
||||
if (old != val) {
|
||||
@@ -190,6 +204,10 @@ vid_out(uint16_t addr, uint8_t val, void *priv)
|
||||
|
||||
case 0x3df:
|
||||
pcjr->memctrl = val;
|
||||
pcjr->pa = val; /* The PCjr BIOS expects the value written to 3DF to
|
||||
then be readable from port 60, others it errors out
|
||||
with only 64k RAM set (but somehow, still works with
|
||||
128k or more RAM). */
|
||||
pcjr->addr_mode = val >> 6;
|
||||
recalc_address(pcjr);
|
||||
break;
|
||||
@@ -206,11 +224,17 @@ vid_in(uint16_t addr, void *priv)
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
switch (addr) {
|
||||
case 0x3d0:
|
||||
case 0x3d2:
|
||||
case 0x3d4:
|
||||
case 0x3d6:
|
||||
ret = pcjr->crtcreg;
|
||||
break;
|
||||
|
||||
case 0x3d1:
|
||||
case 0x3d3:
|
||||
case 0x3d5:
|
||||
case 0x3d7:
|
||||
ret = pcjr->crtc[pcjr->crtcreg];
|
||||
break;
|
||||
|
||||
@@ -591,8 +615,6 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
case 0x61:
|
||||
pcjr->pb = val;
|
||||
|
||||
timer_process();
|
||||
|
||||
if (cassette != NULL)
|
||||
pc_cas_set_motor(cassette, (pcjr->pb & 0x08) == 0);
|
||||
|
||||
@@ -647,7 +669,9 @@ kbd_read(uint16_t port, void *priv)
|
||||
|
||||
case 0x62:
|
||||
ret = (pcjr->latched ? 1 : 0);
|
||||
ret |= 0x02; /*Modem card not installed*/
|
||||
ret |= 0x02; /* Modem card not installed */
|
||||
if (mem_size < 128)
|
||||
ret |= 0x08; /* 64k expansion card not installed */
|
||||
if ((pcjr->pb & 0x08) || (cassette == NULL))
|
||||
ret |= (ppispeakon ? 0x10 : 0);
|
||||
else
|
||||
@@ -810,6 +834,8 @@ machine_pcjr_init(UNUSED(const machine_t *model))
|
||||
pcjr = malloc(sizeof(pcjr_t));
|
||||
memset(pcjr, 0x00, sizeof(pcjr_t));
|
||||
pcjr->memctrl = -1;
|
||||
if (mem_size < 128)
|
||||
pcjr->memctrl &= ~0x24;
|
||||
display_type = machine_get_config_int("display_type");
|
||||
pcjr->composite = (display_type != PCJR_RGB);
|
||||
|
||||
@@ -853,7 +879,10 @@ machine_pcjr_init(UNUSED(const machine_t *model))
|
||||
device_add(&ns8250_pcjr_device);
|
||||
serial_set_next_inst(SERIAL_MAX); /* So that serial_standalone_init() won't do anything. */
|
||||
|
||||
/* "All the inputs are 'read' with one 'IN' from address hex 201." - PCjr Technical Reference (Nov. 83), p.2-119 */
|
||||
/* "All the inputs are 'read' with one 'IN' from address hex 201." - PCjr Technical Reference (Nov. 83), p.2-119
|
||||
|
||||
Note by Miran Grca: Meanwhile, the same Technical Reference clearly says that
|
||||
the gameport is on ports 201-207. */
|
||||
standalone_gameport_type = &gameport_201_device;
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -118,17 +118,7 @@ machine_init_ex(int m)
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
if (gfxcard[0] != VID_NONE) {
|
||||
if (ibm8514_enabled) {
|
||||
ibm8514_device_add();
|
||||
}
|
||||
if (xga_enabled)
|
||||
xga_device_add();
|
||||
}
|
||||
|
||||
/* Reset the graphics card (or do nothing if it was already done
|
||||
by the machine's init function). */
|
||||
video_reset(gfxcard[0]);
|
||||
video_post_reset();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ const machine_t machines[] = {
|
||||
.bus_flags = MACHINE_PCJR,
|
||||
.flags = MACHINE_VIDEO_FIXED,
|
||||
.ram = {
|
||||
.min = 128,
|
||||
.min = 64,
|
||||
.max = 640,
|
||||
.step = 64
|
||||
},
|
||||
|
||||
@@ -797,17 +797,18 @@ pci_register_card(int pci_card)
|
||||
}
|
||||
|
||||
/* Add an instance of the PCI bridge. */
|
||||
uint8_t
|
||||
pci_add_bridge(uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv)
|
||||
void
|
||||
pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot)
|
||||
{
|
||||
pci_card_t *card;
|
||||
uint8_t bridge_slot = agp ? pci_find_slot(PCI_ADD_AGPBRIDGE, 0xff) : last_normal_pci_card_id;
|
||||
|
||||
card = &pci_cards[last_normal_pci_card_id];
|
||||
card = &pci_cards[bridge_slot];
|
||||
card->read = read;
|
||||
card->write = write;
|
||||
card->priv = priv;
|
||||
|
||||
return last_normal_pci_card_id;
|
||||
*slot = bridge_slot;
|
||||
}
|
||||
|
||||
/* Register the cards that have been added into slots. */
|
||||
|
||||
@@ -17,7 +17,8 @@ typedef struct pci_dummy_t {
|
||||
|
||||
bar_t pci_bar[2];
|
||||
|
||||
uint8_t card;
|
||||
uint8_t pci_slot;
|
||||
uint8_t irq_state;
|
||||
uint8_t interrupt_on;
|
||||
|
||||
uint8_t irq_level;
|
||||
@@ -28,9 +29,9 @@ pci_dummy_interrupt(int set, pci_dummy_t *dev)
|
||||
{
|
||||
if (set != dev->irq_level) {
|
||||
if (set)
|
||||
pci_set_irq(dev->card, PCI_INTA);
|
||||
pci_set_irq(dev->pci_slot, PCI_INTA, &dev->irq_state);
|
||||
else
|
||||
pci_clear_irq(dev->card, PCI_INTA);
|
||||
pci_clear_irq(dev->pci_slot, PCI_INTA, &dev->irq_state);
|
||||
}
|
||||
|
||||
dev->irq_level = set;
|
||||
@@ -166,8 +167,8 @@ pci_dummy_pci_read(int func, int addr, void *priv)
|
||||
ret = dev->pci_regs[addr];
|
||||
break;
|
||||
|
||||
case 0x08: /* Techncially, revision, but we return the card (slot) here. */
|
||||
ret = dev->card;
|
||||
case 0x08: /* Techncially, revision, but we return the slot here. */
|
||||
ret = dev->pci_slot;
|
||||
break;
|
||||
|
||||
case 0x10: /* PCI_BAR 7:5 */
|
||||
@@ -242,7 +243,7 @@ pci_dummy_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
|
||||
case 0x3c: /* PCI_ILR */
|
||||
pclog("AB0B:071A Device %02X: IRQ now: %i\n", dev->card, val);
|
||||
pclog("AB0B:071A Device %02X: IRQ now: %i\n", dev->pci_slot, val);
|
||||
dev->pci_regs[addr] = val;
|
||||
return;
|
||||
|
||||
@@ -279,7 +280,7 @@ pci_dummy_card_init(UNUSED(const device_t *info))
|
||||
{
|
||||
pci_dummy_t *dev = (pci_dummy_t *) calloc(1, sizeof(pci_dummy_t));
|
||||
|
||||
dev->card = pci_add_card(PCI_ADD_NORMAL, pci_dummy_pci_read, pci_dummy_pci_write, dev);
|
||||
pci_add_card(PCI_ADD_NORMAL, pci_dummy_pci_read, pci_dummy_pci_write, dev, &dev->pci_slot);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
68
src/pic.c
68
src/pic.c
@@ -65,6 +65,8 @@ static int pic_pci = 0;
|
||||
static void (*update_pending)(void);
|
||||
|
||||
static void pic_update_request(pic_t *dev, int irq);
|
||||
static void pic_update_irr(pic_t *dev, uint16_t num);
|
||||
|
||||
static void pic_cascade(int set);
|
||||
|
||||
#ifdef ENABLE_PIC_LOG
|
||||
@@ -224,17 +226,23 @@ find_best_interrupt(pic_t *dev)
|
||||
static __inline void
|
||||
pic_update_pending_xt(void)
|
||||
{
|
||||
pic.int_pending = (find_best_interrupt(&pic) != -1);
|
||||
if (!(pic.flags & PIC_FREEZE))
|
||||
pic.int_pending = (find_best_interrupt(&pic) != -1);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
pic_update_pending_at(void)
|
||||
{
|
||||
pic2.int_pending = (find_best_interrupt(&pic2) != -1);
|
||||
if (!(pic2.flags & PIC_FREEZE)) {
|
||||
pic2.int_pending = (find_best_interrupt(&pic2) != -1);
|
||||
|
||||
pic_cascade(pic2.int_pending);
|
||||
pic_cascade(pic2.int_pending);
|
||||
}
|
||||
|
||||
pic.int_pending = (find_best_interrupt(&pic) != -1);
|
||||
if (!(pic.flags & PIC_FREEZE))
|
||||
pic.int_pending = (find_best_interrupt(&pic) != -1);
|
||||
|
||||
pic_log("pic_update_pending_at(): dev->int_pending = %i (%i)\n", pic.int_pending, !!(pic.flags & PIC_FREEZE));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -312,7 +320,7 @@ picint_is_level(int irq)
|
||||
}
|
||||
|
||||
static void
|
||||
pic_acknowledge(pic_t *dev)
|
||||
pic_acknowledge(pic_t *dev, int poll)
|
||||
{
|
||||
int pic_int = dev->interrupt & 7;
|
||||
int pic_int_num = 1 << pic_int;
|
||||
@@ -324,10 +332,13 @@ pic_acknowledge(pic_t *dev)
|
||||
/* Clear the edge sense latch. */
|
||||
dev->irq_latch &= ~pic_int_num;
|
||||
|
||||
dev->flags |= PIC_FREEZE; /* Freeze it so it still takes interrupts but they do not
|
||||
override the one currently being processed. */
|
||||
/* Clear the reset latch. */
|
||||
pic_update_request(dev, pic_int);
|
||||
if (!poll) {
|
||||
dev->flags |= PIC_FREEZE; /* Freeze it so it still takes interrupts but they do not
|
||||
override the one currently being processed. */
|
||||
|
||||
/* Clear the reset latch. */
|
||||
pic_update_request(dev, pic_int);
|
||||
}
|
||||
}
|
||||
|
||||
/* Find IRQ for non-specific EOI (either by command or automatic) by finding the highest IRQ
|
||||
@@ -434,15 +445,16 @@ pic_read(uint16_t addr, void *priv)
|
||||
} else {
|
||||
/* Standard 8259 PIC read */
|
||||
if (dev->ocw3 & 0x04) {
|
||||
dev->flags &= ~PIC_FREEZE; /* Freeze the interrupt until the poll is over. */
|
||||
if (dev->int_pending) {
|
||||
dev->data_bus = 0x80 | (dev->interrupt & 7);
|
||||
pic_acknowledge(dev);
|
||||
pic_acknowledge(dev, 1);
|
||||
dev->int_pending = 0;
|
||||
update_pending();
|
||||
} else
|
||||
dev->data_bus = 0x00;
|
||||
dev->ocw3 &= ~0x04;
|
||||
dev->flags &= ~PIC_FREEZE; /* Freeze the interrupt until the poll is over. */
|
||||
pic_update_irr(dev, 0x00ff); /* Update IRR, just in case anything came while frozen. */
|
||||
update_pending();
|
||||
} else if (addr & 0x0001)
|
||||
dev->data_bus = dev->imr;
|
||||
else if (dev->ocw3 & 0x02) {
|
||||
@@ -492,7 +504,7 @@ pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if (is286)
|
||||
update_pending();
|
||||
else
|
||||
timer_on_auto(&pic_timer, .0 * ((10000000.0 * (double) xt_cpu_multi) / (double) cpu_s->rspeed));
|
||||
timer_on_auto(&pic_timer, 1.0 * ((10000000.0 * (double) xt_cpu_multi) / (double) cpu_s->rspeed));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -509,10 +521,10 @@ pic_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if (!(dev->icw1 & 1))
|
||||
dev->icw4 = 0x00;
|
||||
dev->ocw2 = dev->ocw3 = 0x00;
|
||||
dev->flags = PIC_MASTER_CLEAR;
|
||||
dev->irr = 0x00;
|
||||
dev->edge_lines = 0x00;
|
||||
dev->irq_latch = 0x00;
|
||||
dev->flags |= PIC_MASTER_CLEAR;
|
||||
for (i = 0; i <= 7; i++)
|
||||
pic_update_request(dev, i);
|
||||
dev->flags &= ~PIC_MASTER_CLEAR;
|
||||
@@ -668,7 +680,6 @@ pic_irq_get_request(pic_t *dev, int irq)
|
||||
|
||||
ret = ((dev->edge_lines & (1 << irq)) || (dev->lines[irq] > 0));
|
||||
|
||||
pic_log("pic_irq_get_request(%08X, %i) = %02X\n", (uint32_t) (uintptr_t) dev, irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -679,7 +690,6 @@ pic_es_latch_clear(pic_t *dev, int irq)
|
||||
|
||||
ret = (dev->isr & (1 << irq)) || (dev->flags & PIC_MASTER_CLEAR);
|
||||
|
||||
pic_log("pic_es_latch_clear(%08X, %i) = %02X\n", (uint32_t) (uintptr_t) dev, irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -690,7 +700,6 @@ pic_es_latch_out(pic_t *dev, int irq)
|
||||
|
||||
ret = !((pic_es_latch_clear(dev, irq) && (dev->irq_latch & (1 << irq))) || !pic_irq_get_request(dev, irq));
|
||||
|
||||
pic_log("pic_es_latch_out(%08X, %i) = %02X\n", (uint32_t) (uintptr_t) dev, irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -701,7 +710,6 @@ pic_es_latch_nor(pic_t *dev, int irq)
|
||||
|
||||
ret = !(pic_es_latch_out(dev, irq) || picint_is_level(irq));
|
||||
|
||||
pic_log("pic_es_latch_nor(%08X, %i) = %02X\n", (uint32_t) (uintptr_t) dev, irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -712,7 +720,6 @@ pic_irq_request_nor(pic_t *dev, int irq)
|
||||
|
||||
ret = !(pic_es_latch_nor(dev, irq) || !pic_irq_get_request(dev, irq));
|
||||
|
||||
pic_log("pic_irq_request_nor(%08X, %i) = %02X\n", (uint32_t) (uintptr_t) dev, irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -721,12 +728,8 @@ pic_update_request(pic_t *dev, int irq)
|
||||
{
|
||||
dev->irr &= ~(1 << irq);
|
||||
|
||||
if (dev->flags & PIC_FREEZE) {
|
||||
pic_log("pic_update_request(%08X, %i): FREEZE#\n", (uint32_t) (uintptr_t) dev, irq);
|
||||
} else {
|
||||
if (!(dev->flags & PIC_FREEZE))
|
||||
dev->irr |= (pic_irq_request_nor(dev, irq) << irq);
|
||||
pic_log("pic_update_request(%08X, %i): IRR = %02X\n", (uint32_t) (uintptr_t) dev, irq, dev->irr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -736,8 +739,6 @@ pic_update_irr(pic_t *dev, uint16_t num)
|
||||
if (num & (1 << i))
|
||||
pic_update_request(dev, i);
|
||||
}
|
||||
|
||||
pic_log("IRQ %04x: IRR now: %02X\n", num, dev->irr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -792,8 +793,7 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state)
|
||||
pic_update_irr(&pic, num & 0x00ff);
|
||||
}
|
||||
|
||||
if (!(pic.flags & PIC_FREEZE) && !(pic2.flags & PIC_FREEZE))
|
||||
update_pending();
|
||||
update_pending();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -818,7 +818,7 @@ pic_irq_ack_read(pic_t *dev, int phase)
|
||||
|
||||
if (dev != NULL) {
|
||||
if (phase == 0) {
|
||||
pic_acknowledge(dev);
|
||||
pic_acknowledge(dev, 0);
|
||||
if (slave)
|
||||
dev->data_bus = pic_irq_ack_read(dev->slaves[intr], phase);
|
||||
else
|
||||
@@ -850,6 +850,9 @@ pic_irq_ack_read(pic_t *dev, int phase)
|
||||
return dev->data_bus;
|
||||
}
|
||||
|
||||
/* 808x: Update the requests for all interrupts since any of them
|
||||
could have arrived during the freeze. */
|
||||
|
||||
uint8_t
|
||||
pic_irq_ack(void)
|
||||
{
|
||||
@@ -873,11 +876,11 @@ pic_irq_ack(void)
|
||||
/* Needed for Xi8088. */
|
||||
if (pic.flags & PIC_SLAVE_PENDING) {
|
||||
pic2.flags &= ~PIC_FREEZE;
|
||||
pic_update_request(&pic2, pic2.interrupt & 0x07);
|
||||
pic_update_irr(&pic2, 0x00ff);
|
||||
pic2.interrupt = 0x17;
|
||||
}
|
||||
pic.flags &= ~(PIC_SLAVE_PENDING | PIC_FREEZE);
|
||||
pic_update_request(&pic, pic.interrupt & 0x07);
|
||||
pic_update_irr(&pic, 0x00ff);
|
||||
pic.interrupt = 0x17;
|
||||
update_pending();
|
||||
}
|
||||
@@ -885,6 +888,9 @@ pic_irq_ack(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 286+: Only update the request for the pending interrupt as it is
|
||||
impossible that any other interrupt has arrived during the
|
||||
freeze. */
|
||||
int
|
||||
picinterrupt(void)
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QLocalSocket>
|
||||
#include <QTimer>
|
||||
#include <QProcess>
|
||||
|
||||
#include <QLibrary>
|
||||
#include <QElapsedTimer>
|
||||
@@ -660,3 +661,69 @@ plat_init_rom_paths()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_cpu_string(char *outbuf, uint8_t len) {
|
||||
auto cpu_string = QString("Unknown");
|
||||
/* Write the default string now in case we have to exit early from an error */
|
||||
qstrncpy(outbuf, cpu_string.toUtf8().constData(), len);
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
auto *process = new QProcess(nullptr);
|
||||
QStringList arguments;
|
||||
QString program = "/usr/sbin/sysctl";
|
||||
arguments << "machdep.cpu.brand_string";
|
||||
process->start(program, arguments);
|
||||
if (!process->waitForStarted()) {
|
||||
return;
|
||||
}
|
||||
if (!process->waitForFinished()) {
|
||||
return;
|
||||
}
|
||||
QByteArray result = process->readAll();
|
||||
auto command_result = QString(result).split(": ").last();
|
||||
if(!command_result.isEmpty()) {
|
||||
cpu_string = command_result;
|
||||
}
|
||||
#elif defined(Q_OS_WINDOWS)
|
||||
const LPCSTR keyName = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
|
||||
const LPCSTR valueName = "ProcessorNameString";
|
||||
unsigned char buf[32768];
|
||||
DWORD bufSize;
|
||||
HKEY hKey;
|
||||
bufSize = 32768;
|
||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, keyName, 0, 1, &hKey) == ERROR_SUCCESS) {
|
||||
if (RegQueryValueExA(hKey, valueName, NULL, NULL, buf, &bufSize) == ERROR_SUCCESS) {
|
||||
cpu_string = reinterpret_cast<const char*>(buf);
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
auto cpuinfo = QString("/proc/cpuinfo");
|
||||
auto cpuinfo_fi = QFileInfo(cpuinfo);
|
||||
if(!cpuinfo_fi.isReadable()) {
|
||||
return;
|
||||
}
|
||||
QFile file(cpuinfo);
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream textStream(&file);
|
||||
while(true) {
|
||||
QString line = textStream.readLine();
|
||||
if (line.isNull()) {
|
||||
break;
|
||||
}
|
||||
if(line.contains(QRegExp("model name.*:"))) {
|
||||
auto list = line.split(": ");
|
||||
if(!list.last().isEmpty()) {
|
||||
cpu_string = list.last();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
qstrncpy(outbuf, cpu_string.toUtf8().constData(), len);
|
||||
|
||||
}
|
||||
@@ -39,7 +39,9 @@
|
||||
#include <86box/isapnp.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
/* This ROM was reconstructed out of many assumptions, some of which based on the IT8671F. */
|
||||
/* Real chips don't have a PnP ROM and instead rely on the BIOS going in blind.
|
||||
We create a fake ROM here (with values based on the IT8671F) to delegate
|
||||
all the logical device register handling over to the ISAPnP subsystem. */
|
||||
static uint8_t um8669f_pnp_rom[] = {
|
||||
0x55, 0xa3, 0x86, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, /* UMC8669, dummy checksum (filled in by isapnp_add_card) */
|
||||
0x0a, 0x10, 0x10, /* PnP version 1.0, vendor version 1.0 */
|
||||
@@ -61,7 +63,7 @@ static uint8_t um8669f_pnp_rom[] = {
|
||||
0x22, 0xfa, 0x1f, /* IRQ 1/3/4/5/6/7/8/9/10/11/12 */
|
||||
0x47, 0x00, 0x00, 0x01, 0xf8, 0x03, 0x08, 0x08, /* I/O 0x100-0x3F8, decodes 10-bit, 8-byte alignment, 8 addresses */
|
||||
|
||||
0x15, 0x41, 0xd0, 0xff, 0xff, 0x00, /* logical device PNPFFFF (just a dummy to create a gap in LDNs) */
|
||||
0x15, 0x41, 0xd0, 0xff, 0xff, 0x00, /* logical device PNPFFFF (dummy to create a gap in LDNs) */
|
||||
|
||||
0x15, 0x41, 0xd0, 0xb0, 0x2f, 0x01, /* logical device PNPB02F, can participate in boot */
|
||||
0x47, 0x00, 0x00, 0x01, 0xf8, 0x03, 0x08, 0x08, /* I/O 0x100-0x3F8, decodes 10-bit, 8-byte alignment, 8 addresses */
|
||||
@@ -113,10 +115,9 @@ um8669f_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
typedef struct um8669f_t {
|
||||
int locked;
|
||||
int cur_reg_108;
|
||||
void *pnp_card;
|
||||
isapnp_device_config_t *pnp_config[5];
|
||||
uint8_t locked;
|
||||
uint8_t cur_reg_108;
|
||||
void *pnp_card;
|
||||
|
||||
uint8_t regs_108[256];
|
||||
|
||||
|
||||
@@ -1309,6 +1309,12 @@ plat_language_code(char *langcode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_cpu_string(char *outbuf, uint8_t len) {
|
||||
char cpu_string[] = "Unknown";
|
||||
strncpy(outbuf, cpu_string, len);
|
||||
}
|
||||
|
||||
/* Converts back the language code to LCID */
|
||||
void
|
||||
plat_language_code_r(uint32_t lcid, char *outbuf, int len)
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
*
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* W. M. Martinez, <anikom15@outlook.com>
|
||||
*
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2023 W. M. Martinez
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -33,7 +35,6 @@
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_cga.h>
|
||||
#include <86box/vid_cga_comp.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define CGA_RGB 0
|
||||
#define CGA_COMPOSITE 1
|
||||
@@ -51,9 +52,9 @@ static video_timings_t timing_cga = { .type = VIDEO_ISA, .write_b = 8, .write_w
|
||||
void cga_recalctimings(cga_t *cga);
|
||||
|
||||
void
|
||||
cga_out(uint16_t addr, uint8_t val, void *priv)
|
||||
cga_out(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
uint8_t old;
|
||||
|
||||
if ((addr >= 0x3d0) && (addr <= 0x3d7))
|
||||
@@ -90,16 +91,13 @@ cga_out(uint16_t addr, uint8_t val, void *priv)
|
||||
if (old ^ val)
|
||||
cga_recalctimings(cga);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cga_in(uint16_t addr, void *priv)
|
||||
cga_in(uint16_t addr, void *p)
|
||||
{
|
||||
const cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
@@ -116,32 +114,29 @@ cga_in(uint16_t addr, void *priv)
|
||||
case 0x3DA:
|
||||
ret = cga->cgastat;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
cga_pravetz_out(UNUSED(uint16_t addr), uint8_t val, void *priv)
|
||||
cga_pravetz_out(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
cga->fontbase = (((unsigned int) val) << 8);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cga_pravetz_in(UNUSED(uint16_t addr), void *priv)
|
||||
cga_pravetz_in(uint16_t addr, void *p)
|
||||
{
|
||||
const cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
return (cga->fontbase >> 8);
|
||||
}
|
||||
|
||||
void
|
||||
cga_waitstates(UNUSED(void *priv))
|
||||
cga_waitstates(void *p)
|
||||
{
|
||||
int ws_array[16] = { 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8 };
|
||||
int ws;
|
||||
@@ -151,9 +146,9 @@ cga_waitstates(UNUSED(void *priv))
|
||||
}
|
||||
|
||||
void
|
||||
cga_write(uint32_t addr, uint8_t val, void *priv)
|
||||
cga_write(uint32_t addr, uint8_t val, void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
cga->vram[addr & 0x3fff] = val;
|
||||
if (cga->snow_enabled) {
|
||||
@@ -165,9 +160,9 @@ cga_write(uint32_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cga_read(uint32_t addr, void *priv)
|
||||
cga_read(uint32_t addr, void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
cga_waitstates(cga);
|
||||
if (cga->snow_enabled) {
|
||||
@@ -182,8 +177,7 @@ void
|
||||
cga_recalctimings(cga_t *cga)
|
||||
{
|
||||
double disptime;
|
||||
double _dispontime;
|
||||
double _dispofftime;
|
||||
double _dispontime, _dispofftime;
|
||||
|
||||
if (cga->cgamode & 1) {
|
||||
disptime = (double) (cga->crtc[0] + 1);
|
||||
@@ -200,18 +194,14 @@ cga_recalctimings(cga_t *cga)
|
||||
}
|
||||
|
||||
void
|
||||
cga_poll(void *priv)
|
||||
cga_poll(void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
uint16_t ca = (cga->crtc[15] | (cga->crtc[14] << 8)) & 0x3fff;
|
||||
int drawcursor;
|
||||
int x;
|
||||
int c;
|
||||
int xs_temp;
|
||||
int ys_temp;
|
||||
int x, c, xs_temp, ys_temp;
|
||||
int oldvc;
|
||||
uint8_t chr;
|
||||
uint8_t attr;
|
||||
uint8_t chr, attr;
|
||||
uint8_t border;
|
||||
uint16_t dat;
|
||||
int cols[4];
|
||||
@@ -231,21 +221,21 @@ cga_poll(void *priv)
|
||||
video_wait_for_buffer();
|
||||
}
|
||||
cga->lastline = cga->displine;
|
||||
for (c = 0; c < 8; c++) {
|
||||
if ((cga->cgamode & 0x12) == 0x12) {
|
||||
buffer32->line[cga->displine << 1][c] = buffer32->line[(cga->displine << 1) + 1][c] = 0;
|
||||
if (cga->cgamode & 1) {
|
||||
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 3) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 3) + 8] = 0;
|
||||
} else {
|
||||
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 4) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 4) + 8] = 0;
|
||||
}
|
||||
} else {
|
||||
buffer32->line[cga->displine << 1][c] = buffer32->line[(cga->displine << 1) + 1][c] = (cga->cgacol & 15) + 16;
|
||||
if (cga->cgamode & 1) {
|
||||
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 3) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 3) + 8] = (cga->cgacol & 15) + 16;
|
||||
} else {
|
||||
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 4) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 4) + 8] = (cga->cgacol & 15) + 16;
|
||||
}
|
||||
if ((cga->cgamode & 0x12) == 0x12) {
|
||||
for (c = 0; c < 8; ++c) {
|
||||
buffer32->line[cga->displine][c] = 0;
|
||||
if (cga->cgamode & 1)
|
||||
buffer32->line[cga->displine][c + (cga->crtc[1] << 3) + 8] = 0;
|
||||
else
|
||||
buffer32->line[cga->displine][c + (cga->crtc[1] << 4) + 8] = 0;
|
||||
}
|
||||
} else {
|
||||
for (c = 0; c < 8; ++c) {
|
||||
buffer32->line[cga->displine][c] = (cga->cgacol & 15) + 16;
|
||||
if (cga->cgamode & 1)
|
||||
buffer32->line[cga->displine][c + (cga->crtc[1] << 3) + 8] = (cga->cgacol & 15) + 16;
|
||||
else
|
||||
buffer32->line[cga->displine][c + (cga->crtc[1] << 4) + 8] = (cga->cgacol & 15) + 16;
|
||||
}
|
||||
}
|
||||
if (cga->cgamode & 1) {
|
||||
@@ -265,11 +255,11 @@ cga_poll(void *priv)
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
if (drawcursor) {
|
||||
for (c = 0; c < 8; c++) {
|
||||
buffer32->line[cga->displine << 1][(x << 3) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
buffer32->line[cga->displine][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
}
|
||||
} else {
|
||||
for (c = 0; c < 8; c++) {
|
||||
buffer32->line[cga->displine << 1][(x << 3) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
buffer32->line[cga->displine][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
}
|
||||
cga->ma++;
|
||||
@@ -277,8 +267,8 @@ cga_poll(void *priv)
|
||||
} else if (!(cga->cgamode & 2)) {
|
||||
for (x = 0; x < cga->crtc[1]; x++) {
|
||||
if (cga->cgamode & 8) {
|
||||
chr = cga->vram[(cga->ma << 1) & 0x3fff];
|
||||
attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff];
|
||||
chr = cga->vram[((cga->ma << 1) & 0x3fff)];
|
||||
attr = cga->vram[(((cga->ma << 1) + 1) & 0x3fff)];
|
||||
} else
|
||||
chr = attr = 0;
|
||||
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
|
||||
@@ -292,11 +282,15 @@ cga_poll(void *priv)
|
||||
cga->ma++;
|
||||
if (drawcursor) {
|
||||
for (c = 0; c < 8; c++) {
|
||||
buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
buffer32->line[cga->displine][(x << 4) + (c << 1) + 8]
|
||||
= buffer32->line[cga->displine][(x << 4) + (c << 1) + 9]
|
||||
= cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
}
|
||||
} else {
|
||||
for (c = 0; c < 8; c++) {
|
||||
buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
buffer32->line[cga->displine][(x << 4) + (c << 1) + 8]
|
||||
= buffer32->line[cga->displine][(x << 4) + (c << 1) + 9]
|
||||
= cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +317,9 @@ cga_poll(void *priv)
|
||||
dat = 0;
|
||||
cga->ma++;
|
||||
for (c = 0; c < 8; c++) {
|
||||
buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
buffer32->line[cga->displine][(x << 4) + (c << 1) + 8]
|
||||
= buffer32->line[cga->displine][(x << 4) + (c << 1) + 9]
|
||||
= cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
@@ -337,7 +333,7 @@ cga_poll(void *priv)
|
||||
dat = 0;
|
||||
cga->ma++;
|
||||
for (c = 0; c < 16; c++) {
|
||||
buffer32->line[cga->displine << 1][(x << 4) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
buffer32->line[cga->displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
@@ -345,11 +341,9 @@ cga_poll(void *priv)
|
||||
} else {
|
||||
cols[0] = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15) + 16;
|
||||
if (cga->cgamode & 1) {
|
||||
hline(buffer32, 0, (cga->displine << 1), ((cga->crtc[1] << 3) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (cga->displine << 1) + 1, ((cga->crtc[1] << 3) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, cga->displine, (cga->crtc[1] << 3) + 16, cols[0]);
|
||||
} else {
|
||||
hline(buffer32, 0, (cga->displine << 1), ((cga->crtc[1] << 4) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (cga->displine << 1) + 1, ((cga->crtc[1] << 4) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, cga->displine, (cga->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,11 +355,9 @@ cga_poll(void *priv)
|
||||
if (cga->composite) {
|
||||
border = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15);
|
||||
|
||||
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[cga->displine << 1]);
|
||||
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[(cga->displine << 1) + 1]);
|
||||
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[cga->displine]);
|
||||
} else {
|
||||
video_process_8(x, cga->displine << 1);
|
||||
video_process_8(x, (cga->displine << 1) + 1);
|
||||
video_process_8(x, cga->displine);
|
||||
}
|
||||
|
||||
cga->sc = oldsc;
|
||||
@@ -440,31 +432,31 @@ cga_poll(void *priv)
|
||||
cga->lastline++;
|
||||
|
||||
xs_temp = x;
|
||||
ys_temp = (cga->lastline - cga->firstline) << 1;
|
||||
ys_temp = cga->lastline - cga->firstline;
|
||||
|
||||
if ((xs_temp > 0) && (ys_temp > 0)) {
|
||||
if (xs_temp < 64)
|
||||
xs_temp = 656;
|
||||
if (ys_temp < 32)
|
||||
ys_temp = 400;
|
||||
ys_temp = 200;
|
||||
if (!enable_overscan)
|
||||
xs_temp -= 16;
|
||||
|
||||
if ((cga->cgamode & 8) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
xsize = xs_temp;
|
||||
ysize = ys_temp;
|
||||
set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0));
|
||||
set_screen_size(xsize, ysize + (enable_overscan ? 8 : 0));
|
||||
|
||||
if (video_force_resize_get())
|
||||
video_force_resize_set(0);
|
||||
}
|
||||
|
||||
if (enable_overscan) {
|
||||
video_blit_memtoscreen(0, (cga->firstline - 4) << 1,
|
||||
xsize, ((cga->lastline - cga->firstline) + 8) << 1);
|
||||
video_blit_memtoscreen(0, cga->firstline - 4,
|
||||
xsize, (cga->lastline - cga->firstline) + 8);
|
||||
} else {
|
||||
video_blit_memtoscreen(8, cga->firstline << 1,
|
||||
xsize, (cga->lastline - cga->firstline) << 1);
|
||||
video_blit_memtoscreen(8, cga->firstline,
|
||||
xsize, cga->lastline - cga->firstline);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,11 +490,11 @@ cga_poll(void *priv)
|
||||
}
|
||||
if (cga->cgadispon)
|
||||
cga->cgastat &= ~1;
|
||||
if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1)))
|
||||
if ((cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1))))
|
||||
cga->con = 1;
|
||||
if (cga->cgadispon && (cga->cgamode & 1)) {
|
||||
for (x = 0; x < (cga->crtc[1] << 1); x++)
|
||||
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];
|
||||
cga->charbuffer[x] = cga->vram[(((cga->ma << 1) + x) & 0x3fff)];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,7 +507,7 @@ cga_init(cga_t *cga)
|
||||
}
|
||||
|
||||
void *
|
||||
cga_standalone_init(UNUSED(const device_t *info))
|
||||
cga_standalone_init(const device_t *info)
|
||||
{
|
||||
int display_type;
|
||||
cga_t *cga = malloc(sizeof(cga_t));
|
||||
@@ -561,18 +553,18 @@ cga_pravetz_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
cga_close(void *priv)
|
||||
cga_close(void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
free(cga->vram);
|
||||
free(cga);
|
||||
}
|
||||
|
||||
void
|
||||
cga_speed_changed(void *priv)
|
||||
cga_speed_changed(void *p)
|
||||
{
|
||||
cga_t *cga = (cga_t *) priv;
|
||||
cga_t *cga = (cga_t *) p;
|
||||
|
||||
cga_recalctimings(cga);
|
||||
}
|
||||
|
||||
@@ -363,11 +363,31 @@ video_reset(int card)
|
||||
device_add(video_cards[card].device);
|
||||
}
|
||||
|
||||
was_reset = 1;
|
||||
}
|
||||
|
||||
void
|
||||
video_post_reset(void)
|
||||
{
|
||||
if (gfxcard[0] != VID_NONE) {
|
||||
if (ibm8514_enabled) {
|
||||
ibm8514_device_add();
|
||||
}
|
||||
if (xga_enabled)
|
||||
xga_device_add();
|
||||
}
|
||||
|
||||
/* Reset the graphics card (or do nothing if it was already done
|
||||
by the machine's init function). */
|
||||
video_reset(gfxcard[0]);
|
||||
}
|
||||
|
||||
void
|
||||
video_voodoo_init(void)
|
||||
{
|
||||
/* Enable the Voodoo if configured. */
|
||||
if (voodoo_enabled)
|
||||
device_add(&voodoo_device);
|
||||
|
||||
was_reset = 1;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -1250,6 +1250,12 @@ plat_language_code_r(uint32_t lcid, char *outbuf, int len)
|
||||
c16stombs(outbuf, buffer, len);
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_cpu_string(char *outbuf, uint8_t len) {
|
||||
char cpu_string[] = "Unknown";
|
||||
strncpy(outbuf, cpu_string, len);
|
||||
}
|
||||
|
||||
void
|
||||
take_screenshot(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user