Merge branch 'master' of ssh://github.com/86Box/86Box

This commit is contained in:
RichardG867
2023-12-27 13:54:09 -03:00
30 changed files with 866 additions and 705 deletions

View File

@@ -153,7 +153,6 @@ cmake_dependent_option(ISAMEM_RAMPAGE "AST Rampage"
cmake_dependent_option(ISAMEM_IAB "Intel Above Board" ON "DEV_BRANCH" OFF)
cmake_dependent_option(ISAMEM_BRAT "BocaRAM/AT" ON "DEV_BRANCH" OFF)
cmake_dependent_option(LASERXT "VTech Laser XT" ON "DEV_BRANCH" OFF)
cmake_dependent_option(MGA "Matrox Mystique graphics adapters" ON "DEV_BRANCH" OFF)
cmake_dependent_option(OLIVETTI "Olivetti M290" ON "DEV_BRANCH" OFF)
cmake_dependent_option(OPEN_AT "OpenAT" ON "DEV_BRANCH" OFF)
cmake_dependent_option(PAS16 "Pro Audio Spectrum 16" ON "DEV_BRANCH" OFF)

View File

@@ -1581,10 +1581,10 @@ do_pause(int p)
{
int old_p = dopause;
if (p && !old_p)
if ((p == 1) && !old_p)
do_pause_ack = p;
dopause = p;
if (p && !old_p) {
dopause = !!p;
if ((p == 1) && !old_p) {
while (!atomic_load(&pause_ack))
;
}

View File

@@ -723,7 +723,8 @@ acpi_reg_write_common_regs(UNUSED(int size), uint16_t addr, uint8_t val, void *p
/* Since the UI doesn't have a power button at the moment, pause emulation,
then trigger a resume event so that the system resumes after unpausing. */
plat_pause(1);
plat_pause(2); /* 2 means do not wait for pause as
we're already in the CPU thread. */
timer_set_delay_u64(&dev->resume_timer, 50 * TIMER_USEC);
}
}

View File

@@ -489,12 +489,10 @@ static void
ali5229_ide_irq_handler(ali1543_t *dev)
{
int ctl = 0;
int ch = 0;
int bit = 0;
if (dev->ide_conf[0x52] & 0x10) {
ctl ^= 1;
ch ^= 1;
bit ^= 5;
}
@@ -984,7 +982,7 @@ static void
ali7101_write(int func, int addr, uint8_t val, void *priv)
{
ali1543_t *dev = (ali1543_t *) priv;
ali1543_log("M7101: dev->pmu_conf[%02x] = %02x\n", addr, val);
ali1543_log("M7101: [W] dev->pmu_conf[%02x] = %02x\n", addr, val);
if (func > 0)
return;
@@ -1408,65 +1406,78 @@ ali7101_read(int func, int addr, void *priv)
uint8_t ret = 0xff;
if (dev->pmu_dev_enable && (func == 0)) {
if ((dev->pmu_conf[0xc9] & 0x01) && (addr >= 0x40) && (addr != 0xc9))
return 0xff;
/* TODO: C4, C5 = GPIREG (masks: 0D, 0E) */
switch (addr) {
default:
ret = dev->pmu_conf[addr];
break;
case 0x42:
ret = (dev->pmu_conf[addr] & 0xf7) | (nvr_smi_status(dev->nvr) ? 0x08 : 0x00);
break;
case 0x43:
ret = acpi_ali_soft_smi_status_read(dev->acpi) ? 0x10 : 0x00;
break;
case 0x7f:
ret = 0x80;
break;
case 0xbc:
ret = inb(0x70);
break;
}
if (dev->pmu_conf[0x77] & 0x10) {
if (!(dev->pmu_conf[0xc9] & 0x01) || (addr < 0x40) || (addr == 0xc9)) {
/* TODO: C4, C5 = GPIREG (masks: 0D, 0E) */
switch (addr) {
default:
ret = dev->pmu_conf[addr];
break;
case 0x10 ... 0x13:
if (dev->pmu_conf[0x5b] & 0x02)
ret = 0x00;
else
ret = dev->pmu_conf[addr];
break;
case 0x14 ... 0x17:
if (dev->pmu_conf[0x5b] & 0x04)
ret = 0x00;
else
ret = dev->pmu_conf[addr];
break;
case 0x42:
dev->pmu_conf[addr] &= 0xe0;
ret = (dev->pmu_conf[addr] & 0xf7) | (nvr_smi_status(dev->nvr) ? 0x08 : 0x00);
break;
case 0x43:
dev->pmu_conf[addr] &= 0xef;
acpi_ali_soft_smi_status_write(dev->acpi, 0);
ret = acpi_ali_soft_smi_status_read(dev->acpi) ? 0x10 : 0x00;
break;
case 0x7f:
ret = 0x80;
break;
case 0xbc:
ret = inb(0x70);
break;
}
case 0x48:
dev->pmu_conf[addr] = 0x00;
break;
case 0x49:
dev->pmu_conf[addr] &= 0x60;
break;
case 0x4a:
dev->pmu_conf[addr] &= 0xc7;
break;
if (dev->pmu_conf[0x77] & 0x10) {
switch (addr) {
case 0x42:
dev->pmu_conf[addr] &= 0xe0;
break;
case 0x43:
dev->pmu_conf[addr] &= 0xef;
acpi_ali_soft_smi_status_write(dev->acpi, 0);
break;
case 0x4e:
dev->pmu_conf[addr] &= 0xfa;
break;
case 0x4f:
dev->pmu_conf[addr] &= 0xfe;
break;
case 0x48:
dev->pmu_conf[addr] = 0x00;
break;
case 0x49:
dev->pmu_conf[addr] &= 0x60;
break;
case 0x4a:
dev->pmu_conf[addr] &= 0xc7;
break;
case 0x74:
dev->pmu_conf[addr] &= 0xcc;
break;
case 0x4e:
dev->pmu_conf[addr] &= 0xfa;
break;
case 0x4f:
dev->pmu_conf[addr] &= 0xfe;
break;
default:
break;
case 0x74:
dev->pmu_conf[addr] &= 0xcc;
break;
default:
break;
}
}
}
}
ali1543_log("M7101: [R] dev->pmu_conf[%02x] = %02x\n", addr, ret);
return ret;
}

View File

@@ -1104,13 +1104,13 @@ load_floppy_and_cdrom_drives(void)
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > 255)
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 255 "
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 2047 "
"(fdd_image_history[%i][%i])\n", c, i);
else
snprintf(fdd_image_history[c][i], 255, "%s", p);
snprintf(fdd_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else
snprintf(fdd_image_history[c][i], 255, "%s%s%s", usr_path,
snprintf(fdd_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(fdd_image_history[c][i]);
}
@@ -1220,13 +1220,13 @@ load_floppy_and_cdrom_drives(void)
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 511 "
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 2047 "
"(cdrom[%i].image_history[%i])\n", c, i);
else
snprintf(cdrom[c].image_history[i], 511, "%s", p);
snprintf(cdrom[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else
snprintf(cdrom[c].image_history[i], 511, "%s%s%s", usr_path,
snprintf(cdrom[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cdrom[c].image_history[i]);
}
@@ -1353,13 +1353,13 @@ load_other_removable_devices(void)
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("load_other_removable_devices(): strlen(p) > 511 "
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_other_removable_devices(): strlen(p) > 2047 "
"(zip_drives[%i].image_history[%i])\n", c, i);
else
snprintf(zip_drives[c].image_history[i], 511, "%s", p);
snprintf(zip_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else
snprintf(zip_drives[c].image_history[i], 511, "%s%s%s", usr_path,
snprintf(zip_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(zip_drives[c].image_history[i]);
}
@@ -1469,13 +1469,13 @@ load_other_removable_devices(void)
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("load_other_removable_devices(): strlen(p) > 511 "
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_other_removable_devices(): strlen(p) > 2047 "
"(mo_drives[%i].image_history[%i])\n", c, i);
else
snprintf(mo_drives[c].image_history[i], 511, "%s", p);
snprintf(mo_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else
snprintf(mo_drives[c].image_history[i], 511, "%s%s%s", usr_path,
snprintf(mo_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(mo_drives[c].image_history[i]);
}

View File

@@ -124,7 +124,7 @@ static void
isapnp_device_config_changed(isapnp_card_t *card, isapnp_device_t *ld)
{
/* Ignore card if it hasn't signed up for configuration changes. */
if (!card->config_changed)
if ((card == NULL) || !card->config_changed)
return;
/* Populate config structure, performing endianness conversion as needed. */

View File

@@ -563,8 +563,10 @@ fdd_poll(void *priv)
if (fdd_notfound) {
fdd_notfound--;
#ifdef RETURN_NOIDAM
if (!fdd_notfound)
fdc_noidam(fdd_fdc);
#endif
}
}

View File

@@ -33,7 +33,7 @@
/* Recently used images */
#define MAX_PREV_IMAGES 4
#define MAX_IMAGE_PATH_LEN 256
#define MAX_IMAGE_PATH_LEN 2048
/* Default language 0xFFFF = from system, 0x409 = en-US */
#define DEFAULT_LANGUAGE 0x0409

View File

@@ -46,7 +46,8 @@
#ifndef PRINTER_H
#define PRINTER_H
#define FONT_FILE_DOTMATRIX "dotmatrix.ttf"
#define FONT_FILE_DOTMATRIX "dotmatrix.otf"
#define FONT_FILE_DOTMATRIX_ITALIC "dotmatrix_italic.otf"
#define FONT_FILE_ROMAN "roman.ttf"
#define FONT_FILE_SANSSERIF "sansserif.ttf"

View File

@@ -109,6 +109,8 @@ typedef struct ega_t {
int bpp;
int index;
int remap_required;
int actual_type;
int chipset;
uint32_t charseta;
uint32_t charsetb;
@@ -143,7 +145,7 @@ typedef struct ega_t {
extern const device_t ega_device;
extern const device_t cpqega_device;
extern const device_t sega_device;
extern const device_t atiega_device;
extern const device_t atiega800p_device;
extern const device_t iskra_ega_device;
extern const device_t et2000_device;
#endif

View File

@@ -231,6 +231,7 @@ typedef struct svga_t {
uint8_t dac_status;
uint8_t dpms;
uint8_t dpms_ui;
uint8_t color_2bpp;
uint8_t ksc5601_sbyte_mask;
uint8_t ksc5601_udc_area_msb[2];
@@ -268,6 +269,12 @@ typedef struct svga_t {
/* Pointer to monitor */
monitor_t *monitor;
/* Enable LUT mapping of >= 24 bpp modes. */
int lut_map;
/* Return a 32 bpp color from a 15/16 bpp color. */
uint32_t (*conv_16to32)(struct svga_t *svga, uint16_t color, uint8_t bpp);
void * dev8514;
void * xga;
} svga_t;
@@ -334,6 +341,8 @@ enum {
RAMDAC_8BIT
};
uint32_t svga_lookup_lut_ram(svga_t* svga, uint32_t val);
/* We need a way to add a device with a pointer to a parent device so it can attach itself to it, and
possibly also a second ATi 68860 RAM DAC type that auto-sets SVGA render on RAM DAC render change. */
extern void ati68860_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga);

View File

@@ -32,6 +32,9 @@ using atomic_int = std::atomic_int;
#define makecol(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
#define makecol32(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
#define getcolr(color) (((color) >> 16) & 0xFF)
#define getcolg(color) (((color) >> 8) & 0xFF)
#define getcolb(color) ((color) & 0xFF)
enum {
VID_NONE = 0,
@@ -433,10 +436,8 @@ extern const device_t pgc_device;
/* Matrox MGA */
extern const device_t millennium_device;
# if defined(DEV_BRANCH) && defined(USE_MGA)
extern const device_t mystique_device;
extern const device_t mystique_220_device;
# endif
/* Oak OTI-0x7 */
extern const device_t oti037c_device;

View File

@@ -39,6 +39,7 @@
#include <86box/device.h>
#include <86box/thread.h>
#include <86box/network.h>
#include <86box/net_eeprom_nmc93cxx.h>
#include <86box/bswap.h>
#include <86box/nvr.h>
#include "cpu.h"
@@ -351,44 +352,6 @@ enum chip_flags {
#define RTL8139_PCI_REVID RTL8139_PCI_REVID_8139CPLUS
/* Size is 64 * 16bit words */
#define EEPROM_9346_ADDR_BITS 6
#define EEPROM_9346_SIZE (1 << EEPROM_9346_ADDR_BITS)
#define EEPROM_9346_ADDR_MASK (EEPROM_9346_SIZE - 1)
enum Chip9346Operation {
Chip9346_op_mask = 0xc0, /* 10 zzzzzz */
Chip9346_op_read = 0x80, /* 10 AAAAAA */
Chip9346_op_write = 0x40, /* 01 AAAAAA D(15)..D(0) */
Chip9346_op_ext_mask = 0xf0, /* 11 zzzzzz */
Chip9346_op_write_enable = 0x30, /* 00 11zzzz */
Chip9346_op_write_all = 0x10, /* 00 01zzzz */
Chip9346_op_write_disable = 0x00, /* 00 00zzzz */
};
enum Chip9346Mode {
Chip9346_none = 0,
Chip9346_enter_command_mode,
Chip9346_read_command,
Chip9346_data_read, /* from output register */
Chip9346_data_write, /* to input register, then to contents at specified address */
Chip9346_data_write_all, /* to input register, then filling contents */
};
typedef struct EEprom9346 {
uint16_t contents[EEPROM_9346_SIZE];
int mode;
uint32_t tick;
uint8_t address;
uint16_t input;
uint16_t output;
uint8_t eecs;
uint8_t eesk;
uint8_t eedi;
uint8_t eedo;
} EEprom9346;
#pragma pack(push, 1)
typedef struct RTL8139TallyCounters {
/* Tally counters */
@@ -476,8 +439,6 @@ struct RTL8139State {
uint32_t RxRingAddrLO;
uint32_t RxRingAddrHI;
EEprom9346 eeprom;
uint32_t TCTR;
uint32_t TimerInt;
int64_t TCTR_base;
@@ -490,6 +451,8 @@ struct RTL8139State {
int cplus_txbuffer_len;
int cplus_txbuffer_offset;
uint32_t mem_base;
/* PCI interrupt timer */
pc_timer_t timer;
@@ -497,190 +460,14 @@ struct RTL8139State {
/* Support migration to/from old versions */
int rtl8139_mmio_io_addr_dummy;
nmc93cxx_eeprom_t *eeprom;
uint8_t eeprom_data[128];
};
/* Writes tally counters to memory via DMA */
static void RTL8139TallyCounters_dma_write(RTL8139State *s, uint32_t tc_addr);
static void
prom9346_decode_command(EEprom9346 *eeprom, uint8_t command)
{
rtl8139_log("eeprom command 0x%02x\n", command);
switch (command & Chip9346_op_mask) {
case Chip9346_op_read:
{
eeprom->address = command & EEPROM_9346_ADDR_MASK;
eeprom->output = eeprom->contents[eeprom->address];
eeprom->eedo = 0;
eeprom->tick = 0;
eeprom->mode = Chip9346_data_read;
rtl8139_log("eeprom read from address 0x%02x data=0x%04x\n",
eeprom->address, eeprom->output);
}
break;
case Chip9346_op_write:
{
eeprom->address = command & EEPROM_9346_ADDR_MASK;
eeprom->input = 0;
eeprom->tick = 0;
eeprom->mode = Chip9346_none; /* Chip9346_data_write */
rtl8139_log("eeprom begin write to address 0x%02x\n",
eeprom->address);
}
break;
default:
eeprom->mode = Chip9346_none;
switch (command & Chip9346_op_ext_mask) {
case Chip9346_op_write_enable:
rtl8139_log("eeprom write enabled\n");
break;
case Chip9346_op_write_all:
rtl8139_log("eeprom begin write all\n");
break;
case Chip9346_op_write_disable:
rtl8139_log("eeprom write disabled\n");
break;
default:
break;
}
break;
}
}
static void
prom9346_shift_clock(EEprom9346 *eeprom)
{
int bit = eeprom->eedi ? 1 : 0;
++eeprom->tick;
rtl8139_log("eeprom: tick %d eedi=%d eedo=%d\n", eeprom->tick, eeprom->eedi,
eeprom->eedo);
switch (eeprom->mode) {
case Chip9346_enter_command_mode:
if (bit) {
eeprom->mode = Chip9346_read_command;
eeprom->tick = 0;
eeprom->input = 0;
rtl8139_log("eeprom: +++ synchronized, begin command read\n");
}
break;
case Chip9346_read_command:
eeprom->input = (eeprom->input << 1) | (bit & 1);
if (eeprom->tick == 8) {
prom9346_decode_command(eeprom, eeprom->input & 0xff);
}
break;
case Chip9346_data_read:
eeprom->eedo = (eeprom->output & 0x8000) ? 1 : 0;
eeprom->output <<= 1;
if (eeprom->tick == 16) {
#if 1
// the FreeBSD drivers (rl and re) don't explicitly toggle
// CS between reads (or does setting Cfg9346 to 0 count too?),
// so we need to enter wait-for-command state here
eeprom->mode = Chip9346_enter_command_mode;
eeprom->input = 0;
eeprom->tick = 0;
rtl8139_log("eeprom: +++ end of read, awaiting next command\n");
#else
// original behaviour
++eeprom->address;
eeprom->address &= EEPROM_9346_ADDR_MASK;
eeprom->output = eeprom->contents[eeprom->address];
eeprom->tick = 0;
rtl8139_log("eeprom: +++ read next address 0x%02x data=0x%04x\n",
eeprom->address, eeprom->output);
#endif
}
break;
case Chip9346_data_write:
eeprom->input = (eeprom->input << 1) | (bit & 1);
if (eeprom->tick == 16) {
rtl8139_log("eeprom write to address 0x%02x data=0x%04x\n",
eeprom->address, eeprom->input);
eeprom->contents[eeprom->address] = eeprom->input;
eeprom->mode = Chip9346_none; /* waiting for next command after CS cycle */
eeprom->tick = 0;
eeprom->input = 0;
}
break;
case Chip9346_data_write_all:
eeprom->input = (eeprom->input << 1) | (bit & 1);
if (eeprom->tick == 16) {
for (int i = 0; i < EEPROM_9346_SIZE; i++) {
eeprom->contents[i] = eeprom->input;
}
rtl8139_log("eeprom filled with data=0x%04x\n", eeprom->input);
eeprom->mode = Chip9346_enter_command_mode;
eeprom->tick = 0;
eeprom->input = 0;
}
break;
default:
break;
}
}
static int
prom9346_get_wire(RTL8139State *s)
{
const EEprom9346 *eeprom = &s->eeprom;
if (!eeprom->eecs)
return 0;
return eeprom->eedo;
}
/* FIXME: This should be merged into/replaced by eeprom93xx.c. */
static void
prom9346_set_wire(RTL8139State *s, int eecs, int eesk, int eedi)
{
EEprom9346 *eeprom = &s->eeprom;
uint8_t old_eecs = eeprom->eecs;
uint8_t old_eesk = eeprom->eesk;
eeprom->eecs = eecs;
eeprom->eesk = eesk;
eeprom->eedi = eedi;
rtl8139_log("eeprom: +++ wires CS=%d SK=%d DI=%d DO=%d\n", eeprom->eecs,
eeprom->eesk, eeprom->eedi, eeprom->eedo);
if (!old_eecs && eecs) {
/* Synchronize start */
eeprom->tick = 0;
eeprom->input = 0;
eeprom->output = 0;
eeprom->mode = Chip9346_enter_command_mode;
rtl8139_log("=== eeprom: begin access, enter command mode\n");
}
if (!eecs) {
rtl8139_log("=== eeprom: end access\n");
return;
}
if (!old_eesk && eesk) {
/* SK front rules */
prom9346_shift_clock(eeprom);
}
}
static void
rtl8139_update_irq(RTL8139State *s)
{
@@ -1434,9 +1221,8 @@ rtl8139_IntrMitigate_read(UNUSED(RTL8139State *s))
static int
rtl8139_config_writable(RTL8139State *s)
{
if ((s->Cfg9346 & Chip9346_op_mask) == Cfg9346_ConfigWrite) {
if ((s->Cfg9346 & 0xc0) == 0xc0)
return 1;
}
rtl8139_log("Configuration registers are write-protected\n");
@@ -1518,10 +1304,10 @@ rtl8139_Cfg9346_write(RTL8139State *s, uint32_t val)
if (opmode == 0x80) {
/* eeprom access */
int eecs = (eeprom_val & 0x08) ? 1 : 0;
int eesk = (eeprom_val & 0x04) ? 1 : 0;
int eedi = (eeprom_val & 0x02) ? 1 : 0;
prom9346_set_wire(s, eecs, eesk, eedi);
nmc93cxx_eeprom_write(s->eeprom,
!!(eeprom_val & 0x08),
!!(eeprom_val & 0x04),
!!(eeprom_val & 0x02));
} else if (opmode == 0x40) {
/* Reset. */
val = 0;
@@ -1539,13 +1325,10 @@ rtl8139_Cfg9346_read(RTL8139State *s)
uint32_t opmode = ret & 0xc0;
if (opmode == 0x80) {
/* eeprom access */
int eedo = prom9346_get_wire(s);
if (eedo) {
if (nmc93cxx_eeprom_read(s->eeprom))
ret |= 0x01;
} else {
else
ret &= ~0x01;
}
}
rtl8139_log("Cfg9346 read val=0x%02x\n", ret);
@@ -3118,37 +2901,136 @@ rtl8139_io_readl(uint32_t addr, void *priv)
static uint32_t
rtl8139_io_readl_ioport(uint16_t addr, void *priv)
{
return rtl8139_io_readl(addr, priv);
uint32_t ret = 0xffffffff;
ret = rtl8139_io_readl(addr, priv);
rtl8139_log("[%04X:%08X] [RLI] %04X = %08X\n", CS, cpu_state.pc, addr, ret);
return ret;
}
static uint16_t
rtl8139_io_readw_ioport(uint16_t addr, void *priv)
{
return rtl8139_io_readw(addr, priv);
uint16_t ret = 0xffff;
ret = rtl8139_io_readw(addr, priv);
rtl8139_log("[%04X:%08X] [RWI] %04X = %04X\n", CS, cpu_state.pc, addr, ret);
return ret;
}
static uint8_t
rtl8139_io_readb_ioport(uint16_t addr, void *priv)
{
return rtl8139_io_readb(addr, priv);
uint8_t ret = 0xff;
ret = rtl8139_io_readb(addr, priv);
rtl8139_log("[%04X:%08X] [RBI] %04X = %02X\n", CS, cpu_state.pc, addr, ret);
return ret;
}
static void
rtl8139_io_writel_ioport(uint16_t addr, uint32_t val, void *priv)
{
return rtl8139_io_writel(addr, val, priv);
rtl8139_log("[%04X:%08X] [WLI] %04X = %08X\n", CS, cpu_state.pc, addr, val);
rtl8139_io_writel(addr, val, priv);
}
static void
rtl8139_io_writew_ioport(uint16_t addr, uint16_t val, void *priv)
{
return rtl8139_io_writew(addr, val, priv);
rtl8139_log("[%04X:%08X] [WWI] %04X = %04X\n", CS, cpu_state.pc, addr, val);
rtl8139_io_writew(addr, val, priv);
}
static void
rtl8139_io_writeb_ioport(uint16_t addr, uint8_t val, void *priv)
{
return rtl8139_io_writeb(addr, val, priv);
rtl8139_log("[%04X:%08X] [WBI] %04X = %02X\n", CS, cpu_state.pc, addr, val);
rtl8139_io_writeb(addr, val, priv);
}
static uint32_t
rtl8139_io_readl_mem(uint32_t addr, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
uint32_t ret = 0xffffffff;
if ((addr >= s->mem_base) && (addr < (s->mem_base + 0xff)))
ret = rtl8139_io_readl(addr, priv);
rtl8139_log("[%04X:%08X] [RLM] %08X = %08X\n", CS, cpu_state.pc, addr, ret);
return ret;
}
static uint16_t
rtl8139_io_readw_mem(uint32_t addr, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
uint16_t ret = 0xffff;
if ((addr >= s->mem_base) && (addr < (s->mem_base + 0xff)))
ret = rtl8139_io_readw(addr, priv);
rtl8139_log("[%04X:%08X] [RWM] %08X = %04X\n", CS, cpu_state.pc, addr, ret);
return ret;
}
static uint8_t
rtl8139_io_readb_mem(uint32_t addr, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
uint8_t ret = 0xff;
if ((addr >= s->mem_base) && (addr < (s->mem_base + 0xff)))
ret = rtl8139_io_readb(addr, priv);
rtl8139_log("[%04X:%08X] [RBM] %08X = %02X\n", CS, cpu_state.pc, addr, ret);
return ret;
}
static void
rtl8139_io_writel_mem(uint32_t addr, uint32_t val, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
rtl8139_log("[%04X:%08X] [WLM] %08X = %08X\n", CS, cpu_state.pc, addr, val);
if ((addr >= s->mem_base) && (addr < (s->mem_base + 0xff)))
rtl8139_io_writel(addr, val, priv);
}
static void
rtl8139_io_writew_mem(uint32_t addr, uint16_t val, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
rtl8139_log("[%04X:%08X] [WWM] %08X = %04X\n", CS, cpu_state.pc, addr, val);
if ((addr >= s->mem_base) && (addr < (s->mem_base + 0xff)))
rtl8139_io_writew(addr, val, priv);
}
static void
rtl8139_io_writeb_mem(uint32_t addr, uint8_t val, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
rtl8139_log("[%04X:%08X] [WBM] %08X = %02X\n", CS, cpu_state.pc, addr, val);
if ((addr >= s->mem_base) && (addr < (s->mem_base + 0xff)))
rtl8139_io_writeb(addr, val, priv);
}
static int
@@ -3275,6 +3157,7 @@ rtl8139_pci_write(int func, int addr, uint8_t val, void *priv)
rtl8139_io_writeb_ioport, rtl8139_io_writew_ioport, rtl8139_io_writel_ioport,
priv);
s->pci_conf[addr & 0xFF] = val;
rtl8139_log("New I/O base: %04X\n", s->pci_conf[0x11] << 8);
if (s->pci_conf[0x4] & PCI_COMMAND_IO)
io_sethandler((s->pci_conf[0x11] << 8), 256,
rtl8139_io_readb_ioport, rtl8139_io_readw_ioport, rtl8139_io_readl_ioport,
@@ -3286,6 +3169,8 @@ rtl8139_pci_write(int func, int addr, uint8_t val, void *priv)
case 0x16:
case 0x17:
s->pci_conf[addr & 0xFF] = val;
s->mem_base = (s->pci_conf[0x15] << 8) | (s->pci_conf[0x16] << 16) | (s->pci_conf[0x17] << 24);
rtl8139_log("New memory base: %08X\n", s->mem_base);
if (s->pci_conf[0x4] & PCI_COMMAND_MEM)
mem_mapping_set_addr(&s->bar_mem, (s->pci_conf[0x15] << 8) | (s->pci_conf[0x16] << 16) | (s->pci_conf[0x17] << 24), 256);
break;
@@ -3299,42 +3184,42 @@ static void *
nic_init(const device_t *info)
{
RTL8139State *s = calloc(1, sizeof(RTL8139State));
FILE *fp = NULL;
nmc93cxx_eeprom_params_t params;
char eeprom_filename[1024] = { 0 };
uint8_t *mac_bytes;
uint32_t mac;
char filename[1024] = { 0 };
uint8_t *mac_bytes;
uint16_t *eep_data;
uint32_t mac;
mem_mapping_add(&s->bar_mem, 0, 0, rtl8139_io_readb, rtl8139_io_readw, rtl8139_io_readl, rtl8139_io_writeb, rtl8139_io_writew, rtl8139_io_writel, NULL, MEM_MAPPING_EXTERNAL, s);
mem_mapping_add(&s->bar_mem, 0, 0,
rtl8139_io_readb_mem, rtl8139_io_readw_mem, rtl8139_io_readl_mem,
rtl8139_io_writeb_mem, rtl8139_io_writew_mem, rtl8139_io_writel_mem,
NULL, MEM_MAPPING_EXTERNAL, s);
pci_add_card(PCI_ADD_NORMAL, rtl8139_pci_read, rtl8139_pci_write, s, &s->pci_slot);
s->inst = device_get_instance();
snprintf(eeprom_filename, sizeof(eeprom_filename), "eeprom_rtl8139c_plus_%d.nvr", s->inst);
fp = nvr_fopen(eeprom_filename, "rb");
if (fp) {
fread(s->eeprom.contents, 2, 64, fp);
fclose(fp);
fp = NULL;
} else {
/* prepare eeprom */
s->eeprom.contents[0] = 0x8129;
eep_data = (uint16_t *) s->eeprom_data;
/* PCI vendor and device ID should be mirrored here */
s->eeprom.contents[1] = 0x10EC;
s->eeprom.contents[2] = 0x8139;
/* prepare eeprom */
eep_data[0] = 0x8129;
/* XXX: Get proper MAC addresses from real EEPROM dumps. OID taken from net_ne2000.c */
/* PCI vendor and device ID should be mirrored here */
eep_data[1] = 0x10EC;
eep_data[2] = 0x8139;
/* XXX: Get proper MAC addresses from real EEPROM dumps. OID taken from net_ne2000.c */
#ifdef USE_REALTEK_OID
s->eeprom.contents[7] = 0xe000;
s->eeprom.contents[8] = 0x124c;
eep_data[7] = 0xe000;
eep_data[8] = 0x124c;
#else
s->eeprom.contents[7] = 0x1400;
s->eeprom.contents[8] = 0x122a;
eep_data[7] = 0x1400;
eep_data[8] = 0x122a;
#endif
s->eeprom.contents[9] = 0x1413;
}
eep_data[9] = 0x1413;
mac_bytes = (uint8_t *) &(s->eeprom.contents[7]);
mac_bytes = (uint8_t *) &(eep_data[7]);
/* See if we have a local MAC address configured. */
mac = device_get_config_mac("mac", -1);
@@ -3355,7 +3240,20 @@ nic_init(const device_t *info)
mac_bytes[5] = (mac & 0xff);
}
s->nic = network_attach(s, (uint8_t *) &s->eeprom.contents[7], rtl8139_do_receive, rtl8139_set_link_status);
for (uint32_t i = 0; i < 6; i++)
s->phys[MAC0 + i] = mac_bytes[i];
params.nwords = 64;
params.default_content = (uint16_t *) s->eeprom_data;
params.filename = filename;
snprintf(filename, sizeof(filename), "nmc93cxx_eeprom_%s_%d.nvr", info->internal_name, device_get_instance());
s->eeprom = device_add_parameters(&nmc93cxx_device, &params);
if (!s->eeprom) {
free(s);
return NULL;
}
s->nic = network_attach(s, (uint8_t *) &s->phys[MAC0], rtl8139_do_receive, rtl8139_set_link_status);
timer_add(&s->timer, rtl8139_timer, s, 0);
timer_on_auto(&s->timer, 1000000.0 / cpu_pci_speed);
@@ -3369,17 +3267,6 @@ nic_init(const device_t *info)
static void
nic_close(void *priv)
{
const RTL8139State *s = (RTL8139State *) priv;
FILE *fp = NULL;
char eeprom_filename[1024] = { 0 };
snprintf(eeprom_filename, sizeof(eeprom_filename), "eeprom_rtl8139c_plus_%d.nvr", s->inst);
fp = nvr_fopen(eeprom_filename, "wb");
if (fp) {
fwrite(s->eeprom.contents, 2, 64, fp);
fclose(fp);
fp = NULL;
}
free(priv);
}

View File

@@ -437,6 +437,7 @@ reset_printer(escp_t *dev)
dev->cpi = PAGE_CPI;
dev->curr_char_table = 1;
dev->font_style = 0;
dev->print_quality = QUALITY_DRAFT;
dev->extra_intra_space = 0.0;
dev->print_upper_control = 1;
dev->bg_remaining_bytes = 0;
@@ -508,9 +509,12 @@ update_font(escp_t *dev)
if (dev->fontface)
FT_Done_Face(dev->fontface);
if (dev->print_quality == QUALITY_DRAFT)
fn = FONT_FILE_DOTMATRIX;
else
if (dev->print_quality == QUALITY_DRAFT) {
if (dev->font_style & STYLE_ITALICS)
fn = FONT_FILE_DOTMATRIX_ITALIC;
else
fn = FONT_FILE_DOTMATRIX;
} else
switch (dev->lq_typeface) {
case TYPEFACE_ROMAN:
fn = FONT_FILE_ROMAN;
@@ -531,7 +535,7 @@ update_font(escp_t *dev)
fn = FONT_FILE_OCRB;
break;
default:
fn = FONT_FILE_DOTMATRIX;
fn = FONT_FILE_ROMAN;
}
/* Create a full pathname for the ROM file. */
@@ -592,7 +596,7 @@ update_font(escp_t *dev)
(uint16_t) (hpoints * 64), (uint16_t) (vpoints * 64),
dev->dpi, dev->dpi);
if ((dev->font_style & STYLE_ITALICS) || (dev->char_tables[dev->curr_char_table] == 0)) {
if ((dev->print_quality != QUALITY_DRAFT) && ((dev->font_style & STYLE_ITALICS) || (dev->char_tables[dev->curr_char_table] == 0))) {
/* Italics transformation. */
matrix.xx = 0x10000L;
matrix.xy = (FT_Fixed) (0.20 * 0x10000L);
@@ -1578,8 +1582,8 @@ handle_char(escp_t *dev, uint8_t ch)
FT_Render_Glyph(dev->fontface->glyph, FT_RENDER_MODE_NORMAL);
}
pen_x = PIXX + dev->fontface->glyph->bitmap_left;
pen_y = (uint16_t) (PIXY - dev->fontface->glyph->bitmap_top + dev->fontface->size->metrics.ascender / 64);
pen_x = PIXX + fmax(0.0, dev->fontface->glyph->bitmap_left);
pen_y = (uint16_t) (PIXY + fmax(0.0, -dev->fontface->glyph->bitmap_top + dev->fontface->size->metrics.ascender / 64));
if (dev->font_style & STYLE_SUBSCRIPT)
pen_y += dev->fontface->glyph->bitmap.rows / 2;

View File

@@ -194,6 +194,21 @@ main(int argc, char *argv[])
QApplication::setFont(QFont(font_name, font_size.toInt()));
SetCurrentProcessExplicitAppUserModelID(L"86Box.86Box");
#endif
#ifdef RELEASE_BUILD
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-green.ico"));
#elif defined ALPHA_BUILD
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-red.ico"));
#elif defined BETA_BUILD
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
#else
app.setWindowIcon(QIcon(":/settings/win/icons/86Box-gray.ico"));
#endif
#if (!defined(Q_OS_WINDOWS) && !defined(__APPLE__))
app.setDesktopFileName("net.86box.86Box");
#endif
if (!pc_init_modules()) {
ui_msgbox_header(MBX_FATAL, (void *) IDS_2121, (void *) IDS_2056);
return 6;

View File

@@ -196,15 +196,6 @@ MainWindow::MainWindow(QWidget *parent)
auto toolbar_label = new QLabel();
ui->toolBar->addWidget(toolbar_label);
#ifdef RELEASE_BUILD
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-green.ico"));
#elif defined ALPHA_BUILD
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-red.ico"));
#elif defined BETA_BUILD
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
#else
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-gray.ico"));
#endif
this->setWindowFlag(Qt::MSWindowsFixedSizeDialogHint, vid_resize != 1);
this->setWindowFlag(Qt::WindowMaximizeButtonHint, vid_resize == 1);

View File

@@ -371,7 +371,7 @@ plat_pause(int p)
wchar_t title[1024];
wchar_t paused_msg[512];
if (p == dopause) {
if ((!!p) == dopause) {
#ifdef Q_OS_WINDOWS
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSTATUS, (WPARAM) !!p, (LPARAM) (HWND) main_window->winId());

View File

@@ -88,7 +88,7 @@ RendererCommon::onResize(int width, int height)
if (video_fullscreen_scale == FULLSCR_SCALE_INT43) {
gh = gw / r43;
gw = gw;
// gw = gw;
gsr = r43;
}

View File

@@ -830,7 +830,7 @@ plat_init_rom_paths(void)
rom_add_path("/usr/share/86Box/roms/");
}
#else
char default_rom_path[1024] = { '\0 ' };
char default_rom_path[1024] = { '\0' };
getDefaultROMPath(default_rom_path);
rom_add_path(default_rom_path);
#endif
@@ -918,7 +918,7 @@ monitor_thread(void *param)
line = f_readline("(86Box) ");
else {
printf("(86Box) ");
!getline(&line, &n, stdin);
(void) !getline(&line, &n, stdin);
}
if (line) {
int cmdargc = 0;

View File

@@ -28,10 +28,6 @@ add_library(vid OBJECT agpgart.c video.c vid_table.c vid_cga.c vid_cga_comp.c
vid_ibm_rgb528_ramdac.c vid_sdac_ramdac.c vid_ogc.c vid_mga.c vid_nga.c
vid_tvp3026_ramdac.c vid_att2xc498_ramdac.c vid_xga.c)
if(MGA)
target_compile_definitions(vid PRIVATE USE_MGA)
endif()
if(VGAWONDER)
target_compile_definitions(vid PRIVATE USE_VGAWONDER)
endif()

View File

@@ -2940,9 +2940,11 @@ rect_fill:
} else {
while (count-- && dev->accel.sy >= 0) {
if (dev->accel.cx >= dev->accel.clip_left && dev->accel.cx <= clip_r && dev->accel.cy >= dev->accel.clip_top && dev->accel.cy <= clip_b) {
switch ((mix_dat & mix_mask) ? frgd_mix : bkgd_mix) {
switch (frgd_mix) {
case 0:
src_dat = bkgd_color;
if (!bkgd_mix && (dev->accel.cmd & 0x40) && ((dev->accel.frgd_mix & 0x1f) == 7) && ((dev->accel.bkgd_mix & 0x1f) == 3) && !dev->bpp && (bkgd_color == 0x00)) /*For some reason, the September 1992 Mach8/32 drivers for Win3.x don't set the background colors properly.*/
src_dat = frgd_color;
break;
case 1:
src_dat = frgd_color;
@@ -2962,7 +2964,7 @@ rect_fill:
if ((compare_mode == 0) || ((compare_mode == 0x10) && (dest_dat >= compare)) || ((compare_mode == 0x18) && (dest_dat < compare)) || ((compare_mode == 0x20) && (dest_dat != compare)) || ((compare_mode == 0x28) && (dest_dat == compare)) || ((compare_mode == 0x30) && (dest_dat <= compare)) || ((compare_mode == 0x38) && (dest_dat > compare))) {
old_dest_dat = dest_dat;
MIX(mix_dat & mix_mask, dest_dat, src_dat);
MIX(1, dest_dat, src_dat);
dest_dat = (dest_dat & wrt_mask) | (old_dest_dat & ~wrt_mask);
WRITE(dev->accel.dest + dev->accel.cx, dest_dat);
}
@@ -3740,7 +3742,7 @@ bitblt:
case 3:
READ(dev->accel.src + dev->accel.cx, src_dat);
if (pixcntl == 3) {
if (dev->accel.cmd & 0x10) {
if ((dev->accel.cmd & 0x10) && !(dev->accel.cmd & 0x40)) {
src_dat = ((src_dat & rd_mask) == rd_mask);
}
}

View File

@@ -35,8 +35,8 @@
#if defined(DEV_BRANCH) && defined(USE_VGAWONDER)
# define BIOS_ROM_PATH_WONDER "roms/video/ati18800/VGA_Wonder_V3-1.02.bin"
#endif
#define BIOS_ROM_PATH_VGA88 "roms/video/ati18800/vga88.bin"
#define BIOS_ROM_PATH_EDGE16 "roms/video/ati18800/vgaedge16.vbi"
#define BIOS_ROM_PATH_VGA88 "roms/video/ati18800/vga88.bin"
#define BIOS_ROM_PATH_EDGE16 "roms/video/ati18800/vgaedge16.vbi"
enum {
#if defined(DEV_BRANCH) && defined(USE_VGAWONDER)
@@ -57,6 +57,8 @@ typedef struct ati18800_t {
uint8_t regs[256];
int index;
int type;
uint32_t memory;
} ati18800_t;
static video_timings_t timing_ati18800 = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
@@ -76,19 +78,20 @@ ati18800_out(uint16_t addr, uint8_t val, void *priv)
ati18800->index = val;
break;
case 0x1cf:
old = ati18800->regs[ati18800->index];
ati18800->regs[ati18800->index] = val;
switch (ati18800->index) {
case 0xb0:
svga_recalctimings(svga);
if ((old ^ val) & 6)
svga_recalctimings(svga);
break;
case 0xb2:
case 0xbe:
if (ati18800->regs[0xbe] & 8) /*Read/write bank mode*/
{
svga->read_bank = ((ati18800->regs[0xb2] >> 5) & 7) * 0x10000;
svga->write_bank = ((ati18800->regs[0xb2] >> 1) & 7) * 0x10000;
if (ati18800->regs[0xbe] & 8) { /*Read/write bank mode*/
svga->read_bank = ((ati18800->regs[0xb2] & 0xe0) >> 5) * 0x10000;
svga->write_bank = ((ati18800->regs[0xb2] & 0x0e) >> 1) * 0x10000;
} else /*Single bank mode*/
svga->read_bank = svga->write_bank = ((ati18800->regs[0xb2] >> 1) & 7) * 0x10000;
svga->read_bank = svga->write_bank = ((ati18800->regs[0xb2] & 0x0e) >> 1) * 0x10000;
break;
case 0xb3:
ati_eeprom_write(&ati18800->eeprom, val & 8, val & 2, val & 1);
@@ -172,21 +175,57 @@ static void
ati18800_recalctimings(svga_t *svga)
{
const ati18800_t *ati18800 = (ati18800_t *) svga->priv;
int clock_sel;
if (svga->crtc[0x17] & 4) {
svga->vtotal <<= 1;
svga->dispend <<= 1;
svga->vsyncstart <<= 1;
svga->split <<= 1;
svga->vblankstart <<= 1;
clock_sel = ((svga->miscout >> 2) & 3) | ((ati18800->regs[0xbe] & 0x10) >> 1) | ((ati18800->regs[0xb9] & 2) << 1);
if (ati18800->regs[0xb6] & 0x10) {
svga->hdisp <<= 1;
svga->htotal <<= 1;
svga->rowoffset <<= 1;
svga->gdcreg[5] &= ~0x40;
}
if (!svga->scrblank && ((ati18800->regs[0xb0] & 0x02) || (ati18800->regs[0xb0] & 0x04))) /*Extended 256 colour modes*/
{
svga->render = svga_render_8bpp_highres;
svga->bpp = 8;
svga->rowoffset <<= 1;
svga->ma <<= 1;
if (ati18800->regs[0xb0] & 6)
svga->gdcreg[5] |= 0x40;
if (!svga->scrblank && (svga->crtc[0x17] & 0x80) && svga->attr_palette_enable) {
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel, svga->clock_gen);
switch (svga->gdcreg[5] & 0x60) {
case 0x00:
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else
svga->render = svga_render_4bpp_highres;
break;
case 0x20: /*4 colours*/
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_2bpp_lowres;
else
svga->render = svga_render_2bpp_highres;
break;
case 0x40:
case 0x60: /*256+ colours*/
switch (svga->bpp) {
default:
case 8:
svga->map8 = svga->pallook;
if (svga->lowres)
svga->render = svga_render_8bpp_lowres;
else {
svga->render = svga_render_8bpp_highres;
svga->ma_latch <<= 1;
svga->rowoffset <<= 1;
}
break;
}
break;
default:
break;
}
}
}
}
@@ -198,6 +237,8 @@ ati18800_init(const device_t *info)
video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_ati18800);
ati18800->type = info->local;
switch (info->local) {
default:
#if defined(DEV_BRANCH) && defined(USE_VGAWONDER)
@@ -207,30 +248,27 @@ ati18800_init(const device_t *info)
#endif
case ATI18800_VGA88:
rom_init(&ati18800->bios_rom, BIOS_ROM_PATH_VGA88, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
ati18800->memory = 256;
break;
case ATI18800_EDGE16:
rom_init(&ati18800->bios_rom, BIOS_ROM_PATH_EDGE16, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
ati18800->memory = 512;
break;
}
if (info->local == ATI18800_EDGE16) {
svga_init(info, &ati18800->svga, ati18800, 1 << 18, /*256kb*/
ati18800_recalctimings,
ati18800_in, ati18800_out,
NULL,
NULL);
} else {
svga_init(info, &ati18800->svga, ati18800, 1 << 19, /*512kb*/
ati18800_recalctimings,
ati18800_in, ati18800_out,
NULL,
NULL);
}
svga_init(info, &ati18800->svga, ati18800, ati18800->memory << 10,
ati18800_recalctimings,
ati18800_in, ati18800_out,
NULL,
NULL);
ati18800->svga.clock_gen = device_add(&ati18810_device);
ati18800->svga.getclock = ics2494_getclock;
io_sethandler(0x01ce, 0x0002, ati18800_in, NULL, NULL, ati18800_out, NULL, NULL, ati18800);
io_sethandler(0x03c0, 0x0020, ati18800_in, NULL, NULL, ati18800_out, NULL, NULL, ati18800);
ati18800->svga.miscout = 1;
ati18800->svga.bpp = 8;
ati_eeprom_load(&ati18800->eeprom, "ati18800.nvr", 0);
@@ -300,7 +338,7 @@ const device_t ati18800_wonder_device = {
#endif
const device_t ati18800_vga88_device = {
.name = "ATI-18800-1",
.name = "ATI 18800-1",
.internal_name = "ati18800v",
.flags = DEVICE_ISA,
.local = ATI18800_VGA88,
@@ -314,7 +352,7 @@ const device_t ati18800_vga88_device = {
};
const device_t ati18800_device = {
.name = "ATI-18800-5",
.name = "ATI VGA Edge 16",
.internal_name = "ati18800",
.flags = DEVICE_ISA,
.local = ATI18800_EDGE16,

View File

@@ -3628,7 +3628,9 @@ mach_accel_out(uint16_t port, uint8_t val, mach_t *mach)
case 0x6e8:
case 0x6e9:
if (!(port & 1)) {
dev->hdisp = val;
if (!dev->on[0] || !dev->on[1])
dev->hdisp = val;
mach_log("ATI 8514/A: H_DISP write 06E8 = %d\n", dev->hdisp + 1);
}
svga_recalctimings(svga);
@@ -3653,8 +3655,10 @@ mach_accel_out(uint16_t port, uint8_t val, mach_t *mach)
case 0x16e8:
case 0x16e9:
WRITE8(port, dev->vdisp, val);
dev->vdisp &= 0x1fff;
if (!dev->on[0] || !dev->on[1]) {
WRITE8(port, dev->vdisp, val);
dev->vdisp &= 0x1fff;
}
svga_recalctimings(svga);
break;

View File

@@ -41,7 +41,7 @@ void ega_doblit(int wx, int wy, ega_t *ega);
#define BIOS_IBM_PATH "roms/video/ega/ibm_6277356_ega_card_u44_27128.bin"
#define BIOS_CPQ_PATH "roms/video/ega/108281-001.bin"
#define BIOS_SEGA_PATH "roms/video/ega/lega.vbi"
#define BIOS_ATIEGA_PATH "roms/video/ega/ATI EGA Wonder 800+ N1.00.BIN"
#define BIOS_ATIEGA800P_PATH "roms/video/ega/ATI EGA Wonder 800+ N1.00.BIN"
#define BIOS_ISKRA_PATH "roms/video/ega/143-02.bin", "roms/video/ega/143-03.bin"
#define BIOS_TSENG_PATH "roms/video/ega/EGA ET2000.BIN"
@@ -49,7 +49,7 @@ enum {
EGA_IBM = 0,
EGA_COMPAQ,
EGA_SUPEREGA,
EGA_ATI,
EGA_ATI800P,
EGA_ISKRA,
EGA_TSENG
};
@@ -89,16 +89,6 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
case 0xb0:
ega_recalctimings(ega);
break;
case 0xb2:
case 0xbe:
#if 0
if (ega->regs[0xbe] & 8) { /*Read/write bank mode*/
svga->read_bank = ((ega->regs[0xb2] >> 5) & 7) * 0x10000;
svga->write_bank = ((ega->regs[0xb2] >> 1) & 7) * 0x10000;
} else /*Single bank mode*/
svga->read_bank = svga->write_bank = ((ega->regs[0xb2] >> 1) & 7) * 0x10000;
#endif
break;
case 0xb3:
ati_eeprom_write((ati_eeprom_t *) ega->eeprom, val & 8, val & 2, val & 1);
break;
@@ -118,6 +108,8 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
ega_recalctimings(ega);
}
} else {
if ((ega->attraddr == 0x13) && (ega->attrregs[0x13] != val))
ega->fullchange = changeframecount;
o = ega->attrregs[ega->attraddr & 31];
ega->attrregs[ega->attraddr & 31] = val;
if (ega->attraddr < 16)
@@ -156,8 +148,7 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
io_removehandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if (!(val & 1))
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if ((o ^ val) & 0x80)
ega_recalctimings(ega);
ega_recalctimings(ega);
break;
case 0x3c4:
ega->seqaddr = val;
@@ -238,14 +229,24 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
break;
case 0x3d0:
case 0x3d4:
ega->crtcreg = val & 31;
if (ega->chipset)
ega->crtcreg = val & 0x3f;
else
ega->crtcreg = val & 0x1f;
return;
case 0x3d1:
case 0x3d5:
if ((ega->crtcreg < 7) && (ega->crtc[0x11] & 0x80))
return;
if ((ega->crtcreg == 7) && (ega->crtc[0x11] & 0x80))
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
if (ega->chipset) {
if ((ega->crtcreg < 7) && (ega->crtc[0x11] & 0x80) && !(ega->regs[0xb4] & 0x80))
return;
if ((ega->crtcreg == 7) && (ega->crtc[0x11] & 0x80) && !(ega->regs[0xb4] & 0x80))
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
} else {
if ((ega->crtcreg < 7) && (ega->crtc[0x11] & 0x80))
return;
if ((ega->crtcreg == 7) && (ega->crtc[0x11] & 0x80))
val = (ega->crtc[7] & ~0x10) | (val & 0x10);
}
old = ega->crtc[ega->crtcreg];
ega->crtc[ega->crtcreg] = val;
if (old != val) {
@@ -302,8 +303,8 @@ ega_in(uint16_t addr, void *priv)
ret = ega->attrregs[ega->attraddr];
break;
case 0x3c2:
ret = (egaswitches & (8 >> egaswitchread)) ? 0x10 : 0x00;
break;
ret = (egaswitches & (8 >> egaswitchread)) ? 0x10 : 0x00;
break;
case 0x3c4:
if (ega_type)
ret = ega->seqaddr;
@@ -357,6 +358,7 @@ ega_in(uint16_t addr, void *priv)
default:
if (ega_type)
ret = ega->crtc[ega->crtcreg];
break;
}
break;
case 0x3da:
@@ -532,6 +534,15 @@ ega_recalctimings(ega_t *ega)
}
}
if (ega->chipset) {
if (ega->hdisp > 640) {
ega->dispend <<= 1;
ega->vtotal <<= 1;
ega->split <<= 1;
ega->vsyncstart <<= 1;
}
}
if (enable_overscan) {
overscan_y = (ega->rowcount + 1) << 1;
@@ -735,8 +746,18 @@ ega_poll(void *priv)
if ((ega->stat & 8) && ((ega->displine & 15) == (ega->crtc[0x11] & 15)) && ega->vslines)
ega->stat &= ~8;
ega->vslines++;
if (ega->displine > 500)
ega->displine = 0;
if (ega->chipset) {
if (ega->hdisp > 640) {
if (ega->displine > 2000)
ega->displine = 0;
} else {
if (ega->displine > 500)
ega->displine = 0;
}
} else {
if (ega->displine > 500)
ega->displine = 0;
}
} else {
timer_advance_u64(&ega->timer, ega->dispontime);
@@ -772,7 +793,13 @@ ega_poll(void *priv)
}
}
ega->vc++;
ega->vc &= 511;
if (ega->chipset) {
if (ega->hdisp > 640)
ega->vc &= 1023;
else
ega->vc &= 511;
} else
ega->vc &= 511;
if (ega->vc == ega->split) {
// TODO: Implement the hardware bug where the first scanline is drawn twice when the split happens
if (ega->interlace && ega->oddeven)
@@ -1399,6 +1426,9 @@ ega_standalone_init(const device_t *info)
else
ega_type = 1;
ega->actual_type = info->local;
ega->chipset = 0;
switch (info->local) {
default:
case EGA_IBM:
@@ -1414,9 +1444,10 @@ ega_standalone_init(const device_t *info)
rom_init(&ega->bios_rom, BIOS_SEGA_PATH,
0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
break;
case EGA_ATI:
rom_init(&ega->bios_rom, BIOS_ATIEGA_PATH,
case EGA_ATI800P:
rom_init(&ega->bios_rom, BIOS_ATIEGA800P_PATH,
0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
ega->chipset = 1;
break;
case EGA_ISKRA:
rom_init_interleaved(&ega->bios_rom, BIOS_ISKRA_PATH,
@@ -1445,11 +1476,11 @@ ega_standalone_init(const device_t *info)
mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, ega);
io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if (info->local == EGA_ATI) {
if (ega->chipset) {
io_sethandler(0x01ce, 0x0002, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
ega->eeprom = malloc(sizeof(ati_eeprom_t));
memset(ega->eeprom, 0, sizeof(ati_eeprom_t));
ati_eeprom_load((ati_eeprom_t *) ega->eeprom, "egawonder800.nvr", 0);
ati_eeprom_load((ati_eeprom_t *) ega->eeprom, "egawonder800p.nvr", 0);
} else if (info->local == EGA_COMPAQ) {
io_sethandler(0x0084, 0x0001, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
io_sethandler(0x07c6, 0x0001, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
@@ -1479,9 +1510,9 @@ sega_standalone_available(void)
}
static int
atiega_standalone_available(void)
atiega800p_standalone_available(void)
{
return rom_present(BIOS_ATIEGA_PATH);
return rom_present(BIOS_ATIEGA800P_PATH);
}
static int
@@ -1640,15 +1671,15 @@ const device_t sega_device = {
.config = ega_config
};
const device_t atiega_device = {
const device_t atiega800p_device = {
.name = "ATI EGA Wonder 800+",
.internal_name = "egawonder800",
.internal_name = "egawonder800p",
.flags = DEVICE_ISA,
.local = EGA_ATI,
.local = EGA_ATI800P,
.init = ega_standalone_init,
.close = ega_close,
.reset = NULL,
{ .available = atiega_standalone_available },
{ .available = atiega800p_standalone_available },
.speed_changed = ega_speed_changed,
.force_redraw = NULL,
.config = ega_config

View File

@@ -55,7 +55,7 @@
#define FIFO_ADDR 0x00ffffff
#define DMA_POLL_TIME_US 100 /*100us*/
#define DMA_MAX_WORDS 256 /*256 quad words per 100us poll*/
#define DMA_MAX_WORDS (20 * 14) /*280 quad words per 100us poll*/
/*These registers are also mirrored into 0x1dxx, with the mirrored versions starting
the blitter*/
@@ -234,6 +234,7 @@
#define XREG_XPIXPLLSTAT 0x4f
#define XMISCCTRL_VGA8DAC (1 << 3)
#define XMISCCTRL_RAMCS (1 << 4)
#define XMULCTRL_DEPTH_MASK (7 << 0)
#define XMULCTRL_DEPTH_8 (0 << 0)
@@ -440,7 +441,10 @@ typedef struct mystique_t {
uint32_t vram_mask, vram_mask_w, vram_mask_l,
lfb_base, ctrl_base, iload_base,
ma_latch_old, maccess, mctlwtst, maccess_running,
status, softrap_pending_val;
softrap_pending_val;
atomic_uint status;
atomic_bool softrap_status_read;
uint64_t blitter_time, status_time;
@@ -505,13 +509,15 @@ typedef struct mystique_t {
struct
{
int pri_pos, sec_pos, iload_pos,
atomic_int pri_pos, sec_pos, iload_pos,
pri_state, sec_state, iload_state, state;
uint32_t primaddress, primend, secaddress, secend,
atomic_uint primaddress, primend, secaddress, secend,
pri_header, sec_header,
iload_header;
atomic_uint words_expected;
mutex_t *lock;
} dma;
@@ -715,22 +721,36 @@ mystique_out(uint16_t addr, uint8_t val, void *priv)
mystique->crtcext_idx = val;
break;
case 0x3df:
if (mystique->crtcext_idx < 6)
mystique->crtcext_regs[mystique->crtcext_idx] = val;
if (mystique->crtcext_idx == 1)
svga->dpms = !!(val & 0x30);
if (mystique->crtcext_idx < 4) {
svga->fullchange = changeframecount;
svga_recalctimings(svga);
if (mystique->crtcext_idx < 6)
mystique->crtcext_regs[mystique->crtcext_idx] = val;
if ((mystique->type >= MGA_1064SG) && (mystique->crtcext_idx == 0) &&
(mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE)) {
svga->rowoffset = svga->crtc[0x13] |
((mystique->crtcext_regs[0] & CRTCX_R0_OFFSET_MASK) << 4);
svga->rowoffset <<= 1;
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) |
(svga->crtc[0xc] << 8) | svga->crtc[0xd];
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8)) {
svga->rowoffset <<= 1;
svga->ma_latch <<= 1;
}
svga->ma_latch <<= 1;
if (svga->ma_latch != mystique->ma_latch_old) {
if (svga->interlace && svga->oddeven)
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
(svga->ma_latch << 2) + (svga->rowoffset << 1);
else
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
(svga->ma_latch << 2);
mystique->ma_latch_old = svga->ma_latch;
}
}
if (mystique->crtcext_idx == 3) {
if (val & CRTCX_R3_MGAMODE)
svga->fb_only = 1;
else
svga->fb_only = 0;
svga_recalctimings(svga);
}
if (mystique->crtcext_idx == 4) {
if (mystique->crtcext_idx == 4) {
if (svga->gdcreg[6] & 0xc) {
/*64k banks*/
svga->read_bank = (val & 0x7f) << 16;
@@ -816,6 +836,18 @@ mystique_line_compare(svga_t *svga)
return 0;
}
static void
mystique_vblank_start(svga_t *svga)
{
mystique_t *mystique = (mystique_t *) svga->priv;
if (mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE) {
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd];
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8))
svga->ma_latch <<= 1;
}
}
static void
mystique_vsync_callback(svga_t *svga)
{
@@ -874,36 +906,45 @@ mystique_recalctimings(svga_t *svga)
if (mystique->crtcext_regs[2] & CRTCX_R2_LINECOMP10)
svga->split |= 0x400;
if (mystique->type == MGA_2064W)
if (mystique->type == MGA_2064W) {
tvp3026_recalctimings(svga->ramdac, svga);
else
svga->interlace |= !!(mystique->crtcext_regs[0] & 0x80);
} else
svga->interlace = !!(mystique->crtcext_regs[0] & 0x80);
if (mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE) {
svga->packed_chain4 = 1;
svga->lowres = 0;
svga->char_width = 8;
svga->hdisp = (svga->crtc[1] + 1) * 8;
svga->hdisp = (svga->crtc[1] + 1) << 3;
svga->hdisp_time = svga->hdisp;
svga->rowoffset = svga->crtc[0x13] | ((mystique->crtcext_regs[0] & CRTCX_R0_OFFSET_MASK) << 4);
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd];
svga->lut_map = !!(mystique->xmiscctrl & XMISCCTRL_RAMCS);
if (mystique->type >= MGA_1064SG)
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd];
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8)) {
svga->rowoffset <<= 1;
svga->ma_latch <<= 1;
if (mystique->type >= MGA_1064SG)
svga->ma_latch <<= 1;
}
if (mystique->type >= MGA_1064SG) {
/*Mystique, unlike most SVGA cards, allows display start to take
effect mid-screen*/
svga->ma_latch <<= 1;
/* Only change maback so the new display start will take effect on the next
horizontal retrace. */
if (svga->ma_latch != mystique->ma_latch_old) {
if (svga->interlace && svga->oddeven)
svga->ma = svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) + (svga->ma_latch << 2) + (svga->rowoffset << 1);
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
(svga->ma_latch << 2) + (svga->rowoffset << 1);
else
svga->ma = svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) + (svga->ma_latch << 2);
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
(svga->ma_latch << 2);
mystique->ma_latch_old = svga->ma_latch;
}
svga->rowoffset <<= 1;
switch (mystique->xmulctrl & XMULCTRL_DEPTH_MASK) {
case XMULCTRL_DEPTH_8:
case XMULCTRL_DEPTH_2G8V16:
@@ -951,15 +992,26 @@ mystique_recalctimings(svga_t *svga)
break;
}
}
svga->packed_chain4 = 1;
svga->line_compare = mystique_line_compare;
if (mystique->type < MGA_1064SG)
svga->vblank_start = mystique_vblank_start;
} else {
svga->packed_chain4 = 0;
svga->line_compare = NULL;
svga->lut_map = 0;
if (mystique->type >= MGA_1064SG)
svga->bpp = 8;
else
svga->vblank_start = NULL;
}
svga->fb_only = svga->packed_chain4;
svga->disable_blink = (svga->bpp > 4);
video_force_resize_set_monitor(1, svga->monitor_index);
#if 0
pclog("PackedChain4=%d, chain4=%x, fast=%x, bit6 attrreg10=%02x, bits 5-6 gdcreg5=%02x, extmode=%02x.\n", svga->packed_chain4, svga->chain4, svga->fast, svga->attrregs[0x10] & 0x40, svga->gdcreg[5] & 0x60, mystique->pci_regs[0x41] & 1, mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE);
#endif
}
static void
@@ -997,7 +1049,7 @@ mystique_recalc_mapping(mystique_t *mystique)
if (mystique->pci_regs[0x41] & 1) {
switch (svga->gdcreg[6] & 0x0C) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x10000);
mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x20000);
svga->banked_mask = 0x1ffff;
break;
case 0x4: /*64k at A0000*/
@@ -1037,6 +1089,8 @@ mystique_update_irqs(mystique_t *mystique)
if ((mystique->status & mystique->ien) & STATUS_SOFTRAPEN)
irq = 1;
if ((mystique->status & mystique->ien) & STATUS_VLINEPEN)
irq = 1;
if ((mystique->status & STATUS_VSYNCPEN) && (svga->crtc[0x11] & 0x30) == 0x10)
irq = 1;
@@ -1268,6 +1322,8 @@ mystique_write_xreg(mystique_t *mystique, int reg, uint8_t val)
case XREG_XMISCCTRL:
mystique->xmiscctrl = val;
svga_set_ramdac_type(svga, (val & XMISCCTRL_VGA8DAC) ? RAMDAC_8BIT : RAMDAC_6BIT);
if (mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE)
svga->lut_map = !!(mystique->xmiscctrl & XMISCCTRL_RAMCS);
break;
case XREG_XGENCTRL:
@@ -1433,13 +1489,16 @@ mystique_ctrl_read_b(uint32_t addr, void *priv)
ret = mystique->status & 0xff;
if (svga->cgastat & 8)
ret |= REG_STATUS_VSYNCSTS;
if (ret & 1)
mystique->softrap_status_read = 1;
break;
case REG_STATUS + 1:
ret = (mystique->status >> 8) & 0xff;
break;
case REG_STATUS + 2:
ret = (mystique->status >> 16) & 0xff;
if (mystique->busy || ((mystique->blitter_submit_refcount + mystique->blitter_submit_dma_refcount) != mystique->blitter_complete_refcount) || !FIFO_EMPTY)
if (mystique->busy || ((mystique->blitter_submit_refcount + mystique->blitter_submit_dma_refcount) != mystique->blitter_complete_refcount) || !FIFO_EMPTY
|| mystique->dma.state != DMA_STATE_IDLE || mystique->softrap_pending || mystique->endprdmasts_pending)
ret |= (STATUS_DWGENGSTS >> 16);
break;
case REG_STATUS + 3:
@@ -1447,7 +1506,7 @@ mystique_ctrl_read_b(uint32_t addr, void *priv)
break;
case REG_IEN:
ret = mystique->ien & 0x64;
ret = mystique->ien & 0x65;
break;
case REG_IEN + 1:
case REG_IEN + 2:
@@ -1990,6 +2049,7 @@ mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *priv)
switch (addr & 0x3fff) {
case REG_ICLEAR:
if (val & ICLEAR_SOFTRAPICLR) {
//pclog("softrapiclr\n");
mystique->status &= ~STATUS_SOFTRAPEN;
mystique_update_irqs(mystique);
}
@@ -2067,6 +2127,12 @@ mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *priv)
mystique->blitter_complete_refcount = 0;
mystique->dwgreg.iload_rem_count = 0;
mystique->status = STATUS_ENDPRDMASTS;
thread_wait_mutex(mystique->dma.lock);
mystique->dma.pri_state = 0;
mystique->dma.sec_state = 0;
mystique->dma.state = DMA_STATE_IDLE;
mystique->dma.words_expected = 0;
thread_release_mutex(mystique->dma.lock);
break;
case REG_ATTR_IDX:
@@ -2396,9 +2462,11 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *priv)
case REG_SOFTRAP:
mystique->dma.state = DMA_STATE_IDLE;
mystique->dma.pri_state = 0;
mystique->dma.words_expected = 0;
mystique->endprdmasts_pending = 1;
mystique->softrap_pending_val = val;
mystique->softrap_pending = 1;
mystique->softrap_pending += 1;
break;
default:
@@ -2440,9 +2508,19 @@ mystique_ctrl_write_l(uint32_t addr, uint32_t val, void *priv)
mystique->status &= ~STATUS_ENDPRDMASTS;
mystique->dma.state = DMA_STATE_PRI;
mystique->dma.pri_state = 0;
//mystique->dma.pri_state = 0;
wake_fifo_thread(mystique);
}
/* HACK: For DirectX 9.0b Direct3D testing on Windows 98 SE.
The 4.12.013 drivers give an out-of-bounds busmastering range when dxdiag enumerates Direct3D, with exactly 16384 bytes of difference.
Don't attempt busmastering in such cases. This isn't ideal, but there are no more crashes faced in this case. */
if ((mystique->dma.primend & DMA_ADDR_MASK) < (mystique->dma.primaddress & DMA_ADDR_MASK) && ((mystique->dma.primaddress & DMA_ADDR_MASK) - (mystique->dma.primend & DMA_ADDR_MASK)) == 0x4000)
{
mystique->dma.primaddress = mystique->dma.primend;
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
}
thread_release_mutex(mystique->dma.lock);
break;
@@ -2568,6 +2646,9 @@ mystique_readb_linear(uint32_t addr, void *priv)
{
const svga_t *svga = (svga_t *) priv;
if (!svga->fast)
return svga_read_linear(addr, priv);
cycles -= video_timing_read_b;
addr &= svga->decode_mask;
@@ -2610,13 +2691,18 @@ mystique_writeb_linear(uint32_t addr, uint8_t val, void *priv)
{
svga_t *svga = (svga_t *) priv;
if (!svga->fast) {
svga_write_linear(addr, val, priv);
return;
}
cycles -= video_timing_write_b;
addr &= svga->decode_mask;
if (addr >= svga->vram_max)
return;
addr &= svga->vram_mask;
svga->changedvram[addr >> 12] = changeframecount;
svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount;
svga->vram[addr] = val;
}
@@ -2631,7 +2717,7 @@ mystique_writew_linear(uint32_t addr, uint16_t val, void *priv)
if (addr >= svga->vram_max)
return;
addr &= svga->vram_mask;
svga->changedvram[addr >> 12] = changeframecount;
svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount;
*(uint16_t *) &svga->vram[addr] = val;
}
@@ -2646,7 +2732,7 @@ mystique_writel_linear(uint32_t addr, uint32_t val, void *priv)
if (addr >= svga->vram_max)
return;
addr &= svga->vram_mask;
svga->changedvram[addr >> 12] = changeframecount;
svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount;
*(uint32_t *) &svga->vram[addr] = val;
}
@@ -2657,27 +2743,52 @@ run_dma(mystique_t *mystique)
thread_wait_mutex(mystique->dma.lock);
if (mystique->softrap_pending || mystique->endprdmasts_pending || !mystique->softrap_status_read)
{
thread_release_mutex(mystique->dma.lock);
return;
}
if (mystique->dma.state == DMA_STATE_IDLE) {
if (!(mystique->status & STATUS_ENDPRDMASTS))
{
/* Force this to appear. */
mystique->endprdmasts_pending = 1;
}
thread_release_mutex(mystique->dma.lock);
return;
}
while (words_transferred < DMA_MAX_WORDS && mystique->dma.state != DMA_STATE_IDLE) {
switch (mystique->dma.state) {
switch (atomic_load(&mystique->dma.state)) {
case DMA_STATE_PRI:
switch (mystique->dma.primaddress & DMA_MODE_MASK) {
case DMA_MODE_REG:
if (mystique->dma.pri_state == 0) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
break;
}
if (mystique->dma.pri_state == 0 && !mystique->dma.words_expected) {
dma_bm_read(mystique->dma.primaddress & DMA_ADDR_MASK, (uint8_t *) &mystique->dma.pri_header, 4, 4);
//pclog("DMA header: 0x%08X\n", mystique->dma.pri_header);
mystique->dma.primaddress += 4;
mystique->dma.words_expected = 4;
words_transferred++;
}
if ((mystique->dma.pri_header & 0xff) != 0x15) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
break;
}
{
uint32_t val;
uint32_t reg_addr;
dma_bm_read(mystique->dma.primaddress & DMA_ADDR_MASK, (uint8_t *) &val, 4, 4);
mystique->dma.primaddress += 4;
words_transferred++;
reg_addr = (mystique->dma.pri_header & 0x7f) << 2;
if (mystique->dma.pri_header & 0x80)
@@ -2688,15 +2799,24 @@ run_dma(mystique_t *mystique)
if ((reg_addr & 0x300) == 0x100)
mystique->blitter_submit_dma_refcount++;
//pclog("DMA value: 0x%08X to reg 0x%04X\n", val, reg_addr);
mystique_accel_ctrl_write_l(reg_addr, val, mystique);
if (reg_addr == REG_SOFTRAP) {
mystique->dma.primaddress += 4;
break;
}
}
if (mystique->dma.words_expected)
mystique->dma.words_expected--;
mystique->dma.primaddress += 4;
mystique->dma.pri_header >>= 8;
mystique->dma.pri_state = (mystique->dma.pri_state + 1) & 3;
words_transferred++;
if (mystique->dma.state == DMA_STATE_SEC)
mystique->dma.pri_state = 0;
if (mystique->dma.state == DMA_STATE_SEC) {
mystique->dma.sec_state = 0;
}
else if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
@@ -2711,9 +2831,36 @@ run_dma(mystique_t *mystique)
case DMA_STATE_SEC:
switch (mystique->dma.secaddress & DMA_MODE_MASK) {
case DMA_MODE_REG:
if ((mystique->dma.secaddress & DMA_ADDR_MASK) >= (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
mystique->dma.pri_state = 0;
mystique->dma.words_expected = 0;
} else {
mystique->dma.state = DMA_STATE_PRI;
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
}
}
if (mystique->dma.sec_state == 0) {
dma_bm_read(mystique->dma.secaddress & DMA_ADDR_MASK, (uint8_t *) &mystique->dma.sec_header, 4, 4);
mystique->dma.secaddress += 4;
//pclog("DMA header (secondary): 0x%08X\n", mystique->dma.sec_header);
words_transferred++;
}
if ((mystique->dma.secaddress & DMA_ADDR_MASK) >= (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
mystique->dma.pri_state = 0;
mystique->dma.words_expected = 0;
} else {
mystique->dma.state = DMA_STATE_PRI;
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
}
}
uint32_t val;
@@ -2732,23 +2879,40 @@ run_dma(mystique_t *mystique)
mystique->blitter_submit_dma_refcount++;
mystique_accel_ctrl_write_l(reg_addr, val, mystique);
//pclog("DMA value (secondary): 0x%08X\n", val);
mystique->dma.sec_header >>= 8;
mystique->dma.sec_state = (mystique->dma.sec_state + 1) & 3;
words_transferred++;
if ((mystique->dma.secaddress & DMA_ADDR_MASK) == (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.secaddress & DMA_ADDR_MASK) >= (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
} else
mystique->dma.pri_state = 0;
mystique->dma.words_expected = 0;
} else {
mystique->dma.state = DMA_STATE_PRI;
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
}
}
break;
case DMA_MODE_BLIT:
{
uint32_t val;
if ((mystique->dma.secaddress & DMA_ADDR_MASK) >= (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
} else {
mystique->dma.state = DMA_STATE_PRI;
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
}
}
dma_bm_read(mystique->dma.secaddress & DMA_ADDR_MASK, (uint8_t *) &val, 4, 4);
mystique->dma.secaddress += 4;
@@ -2757,12 +2921,17 @@ run_dma(mystique_t *mystique)
blit_iload_write(mystique, val, 32);
words_transferred++;
if ((mystique->dma.secaddress & DMA_ADDR_MASK) == (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.secaddress & DMA_ADDR_MASK) >= (mystique->dma.secend & DMA_ADDR_MASK)) {
if ((mystique->dma.primaddress & DMA_ADDR_MASK) == (mystique->dma.primend & DMA_ADDR_MASK)) {
mystique->endprdmasts_pending = 1;
mystique->dma.state = DMA_STATE_IDLE;
} else
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
} else {
mystique->dma.state = DMA_STATE_PRI;
mystique->dma.words_expected = 0;
mystique->dma.pri_state = 0;
}
}
}
break;
@@ -2881,12 +3050,14 @@ mystique_softrap_pending_timer(void *priv)
mystique->status |= STATUS_ENDPRDMASTS;
}
if (mystique->softrap_pending) {
mystique->softrap_pending = 0;
mystique->dma.secaddress = mystique->softrap_pending_val;
mystique->status |= STATUS_SOFTRAPEN;
mystique->softrap_status_read = 0;
//pclog("softrapen\n");
mystique_update_irqs(mystique);
mystique->softrap_pending--;
}
}
static void
@@ -3950,102 +4121,67 @@ blit_line(mystique_t *mystique, int closed)
uint32_t dst;
uint32_t old_dst;
int x;
int len = 0;
int z_write;
int pattern;
int funcnt = mystique->dwgreg.funcnt;
switch (mystique->dwgreg.dwgctrl_running & DWGCTRL_ATYPE_MASK) {
case DWGCTRL_ATYPE_RSTR:
case DWGCTRL_ATYPE_RPL:
x = mystique->dwgreg.xdst;
while (mystique->dwgreg.length >= 0) {
pattern = mystique->dwgreg.src[0] & (1 << funcnt);
while (len <= mystique->dwgreg.length) {
if (x >= mystique->dwgreg.cxleft && x <= mystique->dwgreg.cxright && mystique->dwgreg.ydst_lin >= mystique->dwgreg.ytop && mystique->dwgreg.ydst_lin <= mystique->dwgreg.ybot) {
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
case MACCESS_PWIDTH_8:
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_SOLID)
src = mystique->dwgreg.fcol;
else {
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC) {
if (pattern)
src = mystique->dwgreg.fcol;
} else
src = pattern ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;
}
src = mystique->dwgreg.fcol;
dst = svga->vram[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask];
dst = bitop(src, dst, mystique->dwgreg.dwgctrl_running);
if (closed) {
svga->vram[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask) >> 12] = changeframecount;
} else if (!closed && mystique->dwgreg.length > 0) {
} else if (!closed && (len < mystique->dwgreg.length)) {
svga->vram[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask) >> 12] = changeframecount;
}
break;
case MACCESS_PWIDTH_16:
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_SOLID)
src = mystique->dwgreg.fcol;
else {
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC) {
if (pattern)
src = mystique->dwgreg.fcol;
} else
src = pattern ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;
}
src = mystique->dwgreg.fcol;
dst = ((uint16_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_w];
dst = bitop(src, dst, mystique->dwgreg.dwgctrl_running);
if (closed) {
((uint16_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_w] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_w) >> 11] = changeframecount;
} else if (!closed && mystique->dwgreg.length > 0) {
} else if (!closed && (len < mystique->dwgreg.length)) {
((uint16_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_w] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_w) >> 11] = changeframecount;
}
break;
case MACCESS_PWIDTH_24:
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_SOLID)
src = mystique->dwgreg.fcol;
else {
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC) {
if (pattern)
src = mystique->dwgreg.fcol;
} else
src = pattern ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;
}
src = mystique->dwgreg.fcol;
old_dst = *(uint32_t *) &svga->vram[((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask];
dst = bitop(src, old_dst, mystique->dwgreg.dwgctrl_running);
if (closed) {
*(uint32_t *) &svga->vram[((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask] = (dst & 0xffffff) | (old_dst & 0xff000000);
svga->changedvram[(((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask) >> 12] = changeframecount;
} else if (!closed && mystique->dwgreg.length > 0) {
} else if (!closed && (len < mystique->dwgreg.length)) {
*(uint32_t *) &svga->vram[((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask] = (dst & 0xffffff) | (old_dst & 0xff000000);
svga->changedvram[(((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask) >> 12] = changeframecount;
}
break;
case MACCESS_PWIDTH_32:
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_SOLID)
src = mystique->dwgreg.fcol;
else {
if (mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC) {
if (pattern)
src = mystique->dwgreg.fcol;
} else
src = pattern ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;
}
src = mystique->dwgreg.fcol;
dst = ((uint32_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l];
dst = bitop(src, dst, mystique->dwgreg.dwgctrl_running);
if (closed) {
((uint32_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l) >> 10] = changeframecount;
} else if (!closed && mystique->dwgreg.length > 0) {
} else if (!closed && (len < mystique->dwgreg.length)) {
((uint32_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l) >> 10] = changeframecount;
}
@@ -4070,10 +4206,7 @@ blit_line(mystique_t *mystique, int closed)
} else
mystique->dwgreg.ar[1] += mystique->dwgreg.ar[0];
mystique->dwgreg.length--;
funcnt = (funcnt - 1) & mystique->dwgreg.stylelen;
if (mystique->dwgreg.length == 0xffff)
break;
len++;
}
break;
@@ -5296,7 +5429,7 @@ mystique_hwcursor_draw(svga_t *svga, int displine)
case XCURCTRL_CURMODE_XGA:
for (uint8_t x = 0; x < 64; x++) {
if (!(dat[1] & (1ULL << 63)))
svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ULL << 63)) ? mystique->cursor.col[1] : mystique->cursor.col[0];
svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ULL << 63)) ? svga_lookup_lut_ram(svga, mystique->cursor.col[1]) : svga_lookup_lut_ram(svga, mystique->cursor.col[0]);
else if (dat[0] & (1ULL << 63))
svga->monitor->target_buffer->line[displine][offset + svga->x_add] ^= 0xffffff;
@@ -5608,6 +5741,38 @@ mystique_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
}
}
static uint32_t
mystique_conv_16to32(svga_t* svga, uint16_t color, uint8_t bpp)
{
mystique_t *mystique = (mystique_t*)svga->priv;
uint32_t ret = 0x00000000;
if (svga->lut_map) {
if (bpp == 15) {
if (mystique->xgenctrl & (1 << 2))
color &= 0x7FFF;
#if 0
uint8_t b = getcolr(svga->pallook[(color & 0x1F) | (!!(color & 0x8000) >> 8)]);
uint8_t g = getcolg(svga->pallook[((color & 0x3E0) >> 5) | (!!(color & 0x8000) >> 8)]);
uint8_t r = getcolb(svga->pallook[((color & 0x7C00) >> 10) | (!!(color & 0x8000) >> 8)]);
#else
uint8_t b = getcolr(svga->pallook[color & 0x1f]);
uint8_t g = getcolg(svga->pallook[(color & 0x3e0) >> 5]);
uint8_t r = getcolb(svga->pallook[(color & 0x7c00) >> 10]);
#endif
ret = (video_15to32[color] & 0xFF000000) | makecol(r, g, b);
} else {
uint8_t b = getcolr(svga->pallook[color & 0x1f]);
uint8_t g = getcolg(svga->pallook[(color & 0x7e0) >> 5]);
uint8_t r = getcolb(svga->pallook[(color & 0xf800) >> 11]);
ret = (video_16to32[color] & 0xFF000000) | makecol(r, g, b);
}
} else
ret = (bpp == 15) ? video_15to32[color] : video_16to32[color];
return ret;
}
static void *
mystique_init(const device_t *info)
{
@@ -5668,7 +5833,7 @@ mystique_init(const device_t *info)
mem_mapping_add(&mystique->lfb_mapping, 0, 0,
mystique_readb_linear, mystique_readw_linear, mystique_readl_linear,
mystique_writeb_linear, mystique_writew_linear, mystique_writel_linear,
NULL, 0, mystique);
NULL, 0, &mystique->svga);
mem_mapping_disable(&mystique->lfb_mapping);
mem_mapping_add(&mystique->iload_mapping, 0, 0,
@@ -5728,8 +5893,11 @@ mystique_init(const device_t *info)
timer_add(&mystique->softrap_pending_timer, mystique_softrap_pending_timer, (void *) mystique, 1);
mystique->status = STATUS_ENDPRDMASTS;
mystique->softrap_status_read = 1;
mystique->svga.vsync_callback = mystique_vsync_callback;
mystique->svga.conv_16to32 = mystique_conv_16to32;
mystique->i2c = i2c_gpio_init("i2c_mga");
mystique->i2c_ddc = i2c_gpio_init("ddc_mga");

View File

@@ -2576,17 +2576,11 @@ s3_out(uint16_t addr, uint8_t val, void *priv)
case 0x3C7:
case 0x3C8:
case 0x3C9:
if ((svga->crtc[0x55] & 0x03) == 0x00)
rs2 = !!(svga->crtc[0x43] & 0x02);
else
rs2 = (svga->crtc[0x55] & 0x01);
rs2 = (svga->crtc[0x55] & 0x01) || !!(svga->crtc[0x43] & 2);
if (s3->chip >= S3_TRIO32)
svga_out(addr, val, svga);
else if ((s3->chip == S3_VISION964 && s3->card_type != S3_ELSAWIN2KPROX_964) || (s3->chip == S3_86C928)) {
if (!(svga->crtc[0x45] & 0x20) || (s3->chip == S3_86C928))
rs3 = !!(svga->crtc[0x55] & 0x02);
else
rs3 = 0;
rs3 = !!(svga->crtc[0x55] & 0x02);
bt48x_ramdac_out(addr, rs2, rs3, val, svga->ramdac, svga);
} else if ((s3->chip == S3_VISION964 && s3->card_type == S3_ELSAWIN2KPROX_964) || (s3->chip == S3_VISION968 && (s3->card_type == S3_ELSAWIN2KPROX || s3->card_type == S3_PHOENIX_VISION968 || s3->card_type == S3_NUMBER9_9FX_771)))
ibm_rgb528_ramdac_out(addr, rs2, val, svga->ramdac, svga);
@@ -2633,10 +2627,7 @@ s3_out(uint16_t addr, uint8_t val, void *priv)
svga->force_dword_mode = !!(val & 0x08);
break;
case 0x32:
if ((svga->crtc[0x31] & 0x30) && (svga->crtc[0x51] & 0x01) && (val & 0x40))
svga->vram_display_mask = 0x3ffff;
else
svga->vram_display_mask = s3->vram_mask;
svga->vram_display_mask = (val & 0x40) ? 0x3ffff : s3->vram_mask;
break;
case 0x40:
@@ -2943,8 +2934,14 @@ s3_in(uint16_t addr, void *priv)
return (s3->chip == S3_TRIO64V2) ? 0x89 : 0x88; /*Extended chip ID*/
case 0x2e:
return s3->id_ext; /*New chip ID*/
case 0x2f:
return (s3->chip == S3_TRIO64V) ? 0x40 : 0; /*Revision level*/
case 0x2f: switch (s3->chip) { /*Revision level*/
case S3_TRIO64V:
return 0x40;
case S3_TRIO64V2:
return 0x16; /*Confirmed on an onboard 64V2/DX*/
default:
return 0x00;
}
case 0x30:
return s3->id; /*Chip ID*/
case 0x31:
@@ -7567,8 +7564,14 @@ s3_pci_read(UNUSED(int func), int addr, void *priv)
case 0x07:
return (s3->chip == S3_TRIO64V2) ? (s3->pci_regs[0x07] & 0x36) : (1 << 1); /*Medium DEVSEL timing*/
case 0x08:
return (s3->chip == S3_TRIO64V) ? 0x40 : 0; /*Revision ID*/
case 0x08: switch (s3->chip) { /*Revision ID*/
case S3_TRIO64V:
return 0x40;
case S3_TRIO64V2:
return 0x16; /*Confirmed on an onboard 64V2/DX*/
default:
return 0x00;
}
case 0x09:
return 0; /*Programming interface*/

View File

@@ -174,8 +174,10 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
svga->fullchange = svga->monitor->mon_changeframecount;
o = svga->attrregs[svga->attraddr & 31];
svga->attrregs[svga->attraddr & 31] = val;
if (svga->attraddr < 16)
if (svga->attraddr < 16) {
svga->color_2bpp = (val >> 4) & 0x03;
svga->fullchange = svga->monitor->mon_changeframecount;
}
if (svga->attraddr == 0x10 || svga->attraddr == 0x14 || svga->attraddr < 0x10) {
for (int c = 0; c < 16; c++) {
if (svga->attrregs[0x10] & 0x80) {
@@ -618,7 +620,7 @@ svga_recalctimings(svga_t *svga)
svga->ma_latch = ((svga->crtc[0xc] << 8) | svga->crtc[0xd]) + ((svga->crtc[8] & 0x60) >> 5);
svga->ca_adj = 0;
svga->rowcount = svga->crtc[9] & 31;
svga->rowcount = svga->crtc[9] & 0x1f;
svga->hdisp_time = svga->hdisp;
svga->render = svga_render_blank;
@@ -639,43 +641,29 @@ svga_recalctimings(svga_t *svga)
svga->hdisp *= (svga->seqregs[1] & 8) ? 16 : 8;
svga->hdisp_old = svga->hdisp;
if (svga->bpp <= 8) {
if (svga->attrregs[0x10] & 0x40) { /*8bpp mode*/
if ((svga->bpp <= 8) || ((svga->gdcreg[5] & 0x60) <= 0x20)) {
if ((svga->gdcreg[5] & 0x60) == 0x00) {
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else
svga->render = svga_render_4bpp_highres;
} else if ((svga->gdcreg[5] & 0x60) == 0x20) {
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_2bpp_lowres;
else
svga->render = svga_render_2bpp_highres;
} else {
svga->map8 = svga->pallook;
if (svga->lowres) /*Low res (320)*/
svga->render = svga_render_8bpp_lowres;
else
svga->render = svga_render_8bpp_highres;
} else {
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else
svga->render = svga_render_4bpp_highres;
}
} else {
switch (svga->gdcreg[5] & 0x60) {
case 0x00:
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_4bpp_lowres;
else
svga->render = svga_render_4bpp_highres;
break;
case 0x20: /*4 colours*/
if (svga->seqregs[1] & 8) /*Low res (320)*/
svga->render = svga_render_2bpp_lowres;
else
svga->render = svga_render_2bpp_highres;
break;
case 0x40:
case 0x60: /*256+ colours*/
switch (svga->bpp) {
case 8:
svga->map8 = svga->pallook;
if (svga->lowres)
svga->render = svga_render_8bpp_lowres;
else
svga->render = svga_render_8bpp_highres;
break;
case 15:
if (svga->lowres)
svga->render = svga_render_15bpp_lowres;
@@ -1115,6 +1103,12 @@ svga_poll(void *priv)
}
}
uint32_t
svga_conv_16to32(struct svga_t *svga, uint16_t color, uint8_t bpp)
{
return (bpp == 15) ? video_15to32[color] : video_16to32[color];
}
int
svga_init(const device_t *info, svga_t *svga, void *priv, int memsize,
void (*recalctimings_ex)(struct svga_t *svga),
@@ -1161,6 +1155,7 @@ svga_init(const device_t *info, svga_t *svga, void *priv, int memsize,
svga->video_out = video_out;
svga->hwcursor_draw = hwcursor_draw;
svga->overlay_draw = overlay_draw;
svga->conv_16to32 = svga_conv_16to32;
svga->hwcursor.cur_xsize = svga->hwcursor.cur_ysize = 32;
@@ -1920,9 +1915,8 @@ svga_readl_common(uint32_t addr, uint8_t linear, void *priv)
{
svga_t *svga = (svga_t *) priv;
if (!svga->fast) {
if (!svga->fast)
return svga_read_common(addr, linear, priv) | (svga_read_common(addr + 1, linear, priv) << 8) | (svga_read_common(addr + 2, linear, priv) << 16) | (svga_read_common(addr + 3, linear, priv) << 24);
}
cycles -= svga->monitor->mon_video_timing_read_l;

View File

@@ -30,6 +30,20 @@
#include <86box/vid_svga_render.h>
#include <86box/vid_svga_render_remap.h>
uint32_t
svga_lookup_lut_ram(svga_t* svga, uint32_t val)
{
if (!svga->lut_map)
return val;
uint8_t r = getcolr(svga->pallook[getcolr(val)]);
uint8_t g = getcolg(svga->pallook[getcolg(val)]);
uint8_t b = getcolb(svga->pallook[getcolb(val)]);
return makecol32(r, g, b) | (val & 0xFF000000);
}
#define lookup_lut(val) svga_lookup_lut_ram(svga, val)
void
svga_render_null(svga_t *svga)
{
@@ -1028,13 +1042,13 @@ svga_render_15bpp_lowres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x << 1] = p[(x << 1) + 1] = video_15to32[dat & 0xffff];
p[(x << 1) + 2] = p[(x << 1) + 3] = video_15to32[dat >> 16];
p[x << 1] = p[(x << 1) + 1] = svga->conv_16to32(svga, dat & 0xffff, 15);
p[(x << 1) + 2] = p[(x << 1) + 3] = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
p[(x << 1) + 4] = p[(x << 1) + 5] = video_15to32[dat & 0xffff];
p[(x << 1) + 6] = p[(x << 1) + 7] = video_15to32[dat >> 16];
p[(x << 1) + 4] = p[(x << 1) + 5] = svga->conv_16to32(svga, dat & 0xffff, 15);
p[(x << 1) + 6] = p[(x << 1) + 7] = svga->conv_16to32(svga, dat >> 16, 15);
}
svga->ma += x << 1;
svga->ma &= svga->vram_display_mask;
@@ -1053,13 +1067,13 @@ svga_render_15bpp_lowres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
}
svga->ma += x << 1;
} else {
@@ -1067,8 +1081,8 @@ svga_render_15bpp_lowres(svga_t *svga)
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
svga->ma += 4;
}
}
@@ -1099,20 +1113,20 @@ svga_render_15bpp_highres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 8) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x] = video_15to32[dat & 0xffff];
p[x + 1] = video_15to32[dat >> 16];
p[x] = svga->conv_16to32(svga, dat & 0xffff, 15);
p[x + 1] = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
p[x + 2] = video_15to32[dat & 0xffff];
p[x + 3] = video_15to32[dat >> 16];
p[x + 2] = svga->conv_16to32(svga, dat & 0xffff, 15);
p[x + 3] = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 8) & svga->vram_display_mask]);
p[x + 4] = video_15to32[dat & 0xffff];
p[x + 5] = video_15to32[dat >> 16];
p[x + 4] = svga->conv_16to32(svga, dat & 0xffff, 15);
p[x + 5] = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 12) & svga->vram_display_mask]);
p[x + 6] = video_15to32[dat & 0xffff];
p[x + 7] = video_15to32[dat >> 16];
p[x + 6] = svga->conv_16to32(svga, dat & 0xffff, 15);
p[x + 7] = svga->conv_16to32(svga, dat >> 16, 15);
}
svga->ma += x << 1;
svga->ma &= svga->vram_display_mask;
@@ -1130,20 +1144,20 @@ svga_render_15bpp_highres(svga_t *svga)
if (!svga->remap_required) {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 8) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 8) & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 12) & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
}
svga->ma += x << 1;
} else {
@@ -1151,8 +1165,8 @@ svga_render_15bpp_highres(svga_t *svga)
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = video_15to32[dat & 0xffff];
*p++ = video_15to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 15);
*p++ = svga->conv_16to32(svga, dat >> 16, 15);
svga->ma += 4;
}
}
@@ -1180,16 +1194,16 @@ svga_render_15bpp_mix_lowres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x << 1] = p[(x << 1) + 1] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x << 1] = p[(x << 1) + 1] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat >>= 16;
p[(x << 1) + 2] = p[(x << 1) + 3] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[(x << 1) + 2] = p[(x << 1) + 3] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
p[(x << 1) + 4] = p[(x << 1) + 5] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[(x << 1) + 4] = p[(x << 1) + 5] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat >>= 16;
p[(x << 1) + 6] = p[(x << 1) + 7] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[(x << 1) + 6] = p[(x << 1) + 7] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
}
svga->ma += x << 1;
svga->ma &= svga->vram_display_mask;
@@ -1215,24 +1229,24 @@ svga_render_15bpp_mix_highres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 8) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat >>= 16;
p[x + 1] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 1] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
p[x + 2] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 2] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat >>= 16;
p[x + 3] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 3] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 8) & svga->vram_display_mask]);
p[x + 4] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 4] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat >>= 16;
p[x + 5] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 5] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 12) & svga->vram_display_mask]);
p[x + 6] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 6] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
dat >>= 16;
p[x + 7] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : video_15to32[dat & 0xffff];
p[x + 7] = (dat & 0x00008000) ? svga->pallook[dat & 0xff] : svga->conv_16to32(svga, dat & 0xffff, 15);
}
svga->ma += x << 1;
svga->ma &= svga->vram_display_mask;
@@ -1261,12 +1275,12 @@ svga_render_16bpp_lowres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x << 1] = p[(x << 1) + 1] = video_16to32[dat & 0xffff];
p[(x << 1) + 2] = p[(x << 1) + 3] = video_16to32[dat >> 16];
p[x << 1] = p[(x << 1) + 1] = svga->conv_16to32(svga, dat & 0xffff, 16);
p[(x << 1) + 2] = p[(x << 1) + 3] = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
p[(x << 1) + 4] = p[(x << 1) + 5] = video_16to32[dat & 0xffff];
p[(x << 1) + 6] = p[(x << 1) + 7] = video_16to32[dat >> 16];
p[(x << 1) + 4] = p[(x << 1) + 5] = svga->conv_16to32(svga, dat & 0xffff, 16);
p[(x << 1) + 6] = p[(x << 1) + 7] = svga->conv_16to32(svga, dat >> 16, 16);
}
svga->ma += x << 1;
svga->ma &= svga->vram_display_mask;
@@ -1285,13 +1299,13 @@ svga_render_16bpp_lowres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
}
svga->ma += x << 1;
} else {
@@ -1299,8 +1313,8 @@ svga_render_16bpp_lowres(svga_t *svga)
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
}
svga->ma += 4;
}
@@ -1331,20 +1345,20 @@ svga_render_16bpp_highres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 8) {
uint32_t dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
p[x] = video_16to32[dat & 0xffff];
p[x + 1] = video_16to32[dat >> 16];
p[x] = svga->conv_16to32(svga, dat & 0xffff, 16);
p[x + 1] = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
p[x + 2] = video_16to32[dat & 0xffff];
p[x + 3] = video_16to32[dat >> 16];
p[x + 2] = svga->conv_16to32(svga, dat & 0xffff, 16);
p[x + 3] = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 8) & svga->vram_display_mask]);
p[x + 4] = video_16to32[dat & 0xffff];
p[x + 5] = video_16to32[dat >> 16];
p[x + 4] = svga->conv_16to32(svga, dat & 0xffff, 16);
p[x + 5] = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 12) & svga->vram_display_mask]);
p[x + 6] = video_16to32[dat & 0xffff];
p[x + 7] = video_16to32[dat >> 16];
p[x + 6] = svga->conv_16to32(svga, dat & 0xffff, 16);
p[x + 7] = svga->conv_16to32(svga, dat >> 16, 16);
}
svga->ma += x << 1;
svga->ma &= svga->vram_display_mask;
@@ -1362,20 +1376,20 @@ svga_render_16bpp_highres(svga_t *svga)
if (!svga->remap_required) {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 8) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1)) & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 4) & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 8) & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 1) + 12) & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
}
svga->ma += x << 1;
} else {
@@ -1383,8 +1397,8 @@ svga_render_16bpp_highres(svga_t *svga)
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = video_16to32[dat & 0xffff];
*p++ = video_16to32[dat >> 16];
*p++ = svga->conv_16to32(svga, dat & 0xffff, 16);
*p++ = svga->conv_16to32(svga, dat >> 16, 16);
svga->ma += 4;
}
@@ -1422,7 +1436,7 @@ svga_render_24bpp_lowres(svga_t *svga)
fg = svga->vram[svga->ma] | (svga->vram[svga->ma + 1] << 8) | (svga->vram[svga->ma + 2] << 16);
svga->ma += 3;
svga->ma &= svga->vram_display_mask;
svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + svga->x_add] = svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + 1 + svga->x_add] = fg;
svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + svga->x_add] = svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + 1 + svga->x_add] = lookup_lut(fg);
}
}
} else {
@@ -1441,10 +1455,10 @@ svga_render_24bpp_lowres(svga_t *svga)
dat1 = *(uint32_t *) (&svga->vram[(svga->ma + 4) & svga->vram_display_mask]);
dat2 = *(uint32_t *) (&svga->vram[(svga->ma + 8) & svga->vram_display_mask]);
p[0] = p[1] = dat0 & 0xffffff;
p[2] = p[3] = (dat0 >> 24) | ((dat1 & 0xffff) << 8);
p[4] = p[5] = (dat1 >> 16) | ((dat2 & 0xff) << 16);
p[6] = p[7] = dat2 >> 8;
p[0] = p[1] = lookup_lut(dat0 & 0xffffff);
p[2] = p[3] = lookup_lut((dat0 >> 24) | ((dat1 & 0xffff) << 8));
p[4] = p[5] = lookup_lut((dat1 >> 16) | ((dat2 & 0xff) << 16));
p[6] = p[7] = lookup_lut(dat2 >> 8);
svga->ma += 12;
}
@@ -1457,10 +1471,10 @@ svga_render_24bpp_lowres(svga_t *svga)
addr = svga->remap_func(svga, svga->ma + 8);
dat2 = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
p[0] = p[1] = dat0 & 0xffffff;
p[2] = p[3] = (dat0 >> 24) | ((dat1 & 0xffff) << 8);
p[4] = p[5] = (dat1 >> 16) | ((dat2 & 0xff) << 16);
p[6] = p[7] = dat2 >> 8;
p[0] = p[1] = lookup_lut(dat0 & 0xffffff);
p[2] = p[3] = lookup_lut((dat0 >> 24) | ((dat1 & 0xffff) << 8));
p[4] = p[5] = lookup_lut((dat1 >> 16) | ((dat2 & 0xff) << 16));
p[6] = p[7] = lookup_lut(dat2 >> 8);
svga->ma += 12;
}
@@ -1495,16 +1509,16 @@ svga_render_24bpp_highres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += 4) {
dat = *(uint32_t *) (&svga->vram[svga->ma & svga->vram_display_mask]);
p[x] = dat & 0xffffff;
p[x] = lookup_lut(dat & 0xffffff);
dat = *(uint32_t *) (&svga->vram[(svga->ma + 3) & svga->vram_display_mask]);
p[x + 1] = dat & 0xffffff;
p[x + 1] = lookup_lut(dat & 0xffffff);
dat = *(uint32_t *) (&svga->vram[(svga->ma + 6) & svga->vram_display_mask]);
p[x + 2] = dat & 0xffffff;
p[x + 2] = lookup_lut(dat & 0xffffff);
dat = *(uint32_t *) (&svga->vram[(svga->ma + 9) & svga->vram_display_mask]);
p[x + 3] = dat & 0xffffff;
p[x + 3] = lookup_lut(dat & 0xffffff);
svga->ma += 12;
}
@@ -1526,10 +1540,10 @@ svga_render_24bpp_highres(svga_t *svga)
dat1 = *(uint32_t *) (&svga->vram[(svga->ma + 4) & svga->vram_display_mask]);
dat2 = *(uint32_t *) (&svga->vram[(svga->ma + 8) & svga->vram_display_mask]);
*p++ = dat0 & 0xffffff;
*p++ = (dat0 >> 24) | ((dat1 & 0xffff) << 8);
*p++ = (dat1 >> 16) | ((dat2 & 0xff) << 16);
*p++ = dat2 >> 8;
*p++ = lookup_lut(dat0 & 0xffffff);
*p++ = lookup_lut((dat0 >> 24) | ((dat1 & 0xffff) << 8));
*p++ = lookup_lut((dat1 >> 16) | ((dat2 & 0xff) << 16));
*p++ = lookup_lut(dat2 >> 8);
svga->ma += 12;
}
@@ -1542,10 +1556,10 @@ svga_render_24bpp_highres(svga_t *svga)
addr = svga->remap_func(svga, svga->ma + 8);
dat2 = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = dat0 & 0xffffff;
*p++ = (dat0 >> 24) | ((dat1 & 0xffff) << 8);
*p++ = (dat1 >> 16) | ((dat2 & 0xff) << 16);
*p++ = dat2 >> 8;
*p++ = lookup_lut(dat0 & 0xffffff);
*p++ = lookup_lut((dat0 >> 24) | ((dat1 & 0xffff) << 8));
*p++ = lookup_lut((dat1 >> 16) | ((dat2 & 0xff) << 16));
*p++ = lookup_lut(dat2 >> 8);
svga->ma += 12;
}
@@ -1577,7 +1591,7 @@ svga_render_32bpp_lowres(svga_t *svga)
dat = svga->vram[svga->ma] | (svga->vram[svga->ma + 1] << 8) | (svga->vram[svga->ma + 2] << 16);
svga->ma += 4;
svga->ma &= svga->vram_display_mask;
svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + svga->x_add] = svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + 1 + svga->x_add] = dat;
svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + svga->x_add] = svga->monitor->target_buffer->line[svga->displine + svga->y_add][(x << 1) + 1 + svga->x_add] = lookup_lut(dat);
}
}
} else {
@@ -1593,16 +1607,16 @@ svga_render_32bpp_lowres(svga_t *svga)
if (!svga->remap_required) {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 2)) & svga->vram_display_mask]);
*p++ = dat & 0xffffff;
*p++ = dat & 0xffffff;
*p++ = lookup_lut(dat & 0xffffff);
*p++ = lookup_lut(dat & 0xffffff);
}
svga->ma += (x * 4);
} else {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = dat & 0xffffff;
*p++ = dat & 0xffffff;
*p++ = lookup_lut(dat & 0xffffff);
*p++ = lookup_lut(dat & 0xffffff);
svga->ma += 4;
}
svga->ma &= svga->vram_display_mask;
@@ -1633,7 +1647,7 @@ svga_render_32bpp_highres(svga_t *svga)
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 2)) & svga->vram_display_mask]);
p[x] = dat & 0xffffff;
p[x] = lookup_lut(dat & 0xffffff);
}
svga->ma += 4;
svga->ma &= svga->vram_display_mask;
@@ -1651,14 +1665,14 @@ svga_render_32bpp_highres(svga_t *svga)
if (!svga->remap_required) {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 2)) & svga->vram_display_mask]);
*p++ = dat & 0xffffff;
*p++ = lookup_lut(dat & 0xffffff);
}
svga->ma += (x * 4);
} else {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = dat & 0xffffff;
*p++ = lookup_lut(dat & 0xffffff);
svga->ma += 4;
}
@@ -1692,14 +1706,14 @@ svga_render_ABGR8888_highres(svga_t *svga)
if (!svga->remap_required) {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 2)) & svga->vram_display_mask]);
*p++ = ((dat & 0xff0000) >> 16) | (dat & 0x00ff00) | ((dat & 0x0000ff) << 16);
*p++ = lookup_lut(((dat & 0xff0000) >> 16) | (dat & 0x00ff00) | ((dat & 0x0000ff) << 16));
}
svga->ma += x * 4;
} else {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = ((dat & 0xff0000) >> 16) | (dat & 0x00ff00) | ((dat & 0x0000ff) << 16);
*p++ = lookup_lut(((dat & 0xff0000) >> 16) | (dat & 0x00ff00) | ((dat & 0x0000ff) << 16));
svga->ma += 4;
}
@@ -1732,14 +1746,14 @@ svga_render_RGBA8888_highres(svga_t *svga)
if (!svga->remap_required) {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
dat = *(uint32_t *) (&svga->vram[(svga->ma + (x << 2)) & svga->vram_display_mask]);
*p++ = dat >> 8;
*p++ = lookup_lut(dat >> 8);
}
svga->ma += (x * 4);
} else {
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
addr = svga->remap_func(svga, svga->ma);
dat = *(uint32_t *) (&svga->vram[addr & svga->vram_display_mask]);
*p++ = dat >> 8;
*p++ = lookup_lut(dat >> 8);
svga->ma += 4;
}

View File

@@ -79,7 +79,7 @@ video_cards[] = {
// clang-format off
{ &vid_none_device },
{ &vid_internal_device },
{ &atiega_device },
{ &atiega800p_device },
{ &mach8_isa_device, VIDEO_FLAG_TYPE_8514 },
{ &mach32_isa_device, VIDEO_FLAG_TYPE_8514 },
{ &mach64gx_isa_device },
@@ -205,10 +205,8 @@ video_cards[] = {
{ &s3_diamond_stealth_4000_pci_device },
{ &s3_trio3d2x_pci_device },
{ &millennium_device },
#if defined(DEV_BRANCH) && defined(USE_MGA)
{ &mystique_device },
{ &mystique_220_device },
#endif
{ &tgui9440_pci_device },
{ &tgui9660_pci_device },
{ &tgui9680_pci_device },

View File

@@ -64,9 +64,6 @@ ifeq ($(DEV_BUILD), y)
ifndef LASERXT
LASERXT := y
endif
ifndef MGA
MGA := y
endif
ifndef OLIVETTI
OLIVETTI := y
endif
@@ -128,9 +125,6 @@ else
ifndef LASERXT
LASERXT := n
endif
ifndef MGA
MGA := n
endif
ifndef OLIVETTI
OLIVETTI := n
endif
@@ -496,10 +490,6 @@ ifeq ($(DEV_BRANCH), y)
DEVBROBJ += m_xt_laserxt.o
endif
ifeq ($(MGA), y)
OPTS += -DUSE_MGA
endif
ifeq ($(OPEN_AT), y)
OPTS += -DUSE_OPEN_AT
endif