Video changes of the day (November 13th, 2024)

1. Finally add the ATI 8514/A Ultra add-on BIOS in both ISA and MCA variants (despite the ROM page failure on POST).
2. Fixed a mode switch bug in the Mach8 (both add-on and vga combo) when exiting the Win3.x GUI using the native drivers.
3. Corrected (best possible) the eeprom load of the Mach8 products.
4. Partial implementation of the FIFO on the 8514/A compatible products including Mach8/32 and plain IBM 8514/A.
This commit is contained in:
TC1995
2024-11-13 22:55:16 +01:00
parent 62e3daa718
commit afe95cd20c
7 changed files with 338 additions and 241 deletions

View File

@@ -42,6 +42,9 @@ typedef union {
typedef struct ibm8514_t {
rom_t bios_rom;
rom_t bios_rom2;
mem_mapping_t bios_mapping;
uint8_t *rom1;
uint8_t *rom2;
hwcursor8514_t hwcursor;
hwcursor8514_t hwcursor_latch;
uint8_t pos_regs[8];
@@ -212,6 +215,8 @@ typedef struct ibm8514_t {
uint8_t subsys_cntl;
uint8_t subsys_stat;
atomic_int fifo_idx;
atomic_int ext_fifo_idx;
atomic_int force_busy;
atomic_int force_busy2;
@@ -223,11 +228,10 @@ typedef struct ibm8514_t {
int ext_crt_pitch;
int extensions;
int linear;
int _4bpp;
uint32_t vram_amount;
int vram_512k_8514;
PALETTE _8514pal;
int vendor_mode;
PALETTE _8514pal;
latch8514_t latch;
} ibm8514_t;

View File

@@ -47,7 +47,8 @@ typedef struct ati_eeprom_t {
} ati_eeprom_t;
void ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type);
void ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn);
void ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn, int mca);
void ati_eeprom_load_mach8_vga(ati_eeprom_t *eeprom, char *fn);
void ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat);
int ati_eeprom_read(ati_eeprom_t *eeprom);

View File

@@ -312,7 +312,6 @@ extern void ibm8514_accel_out_pixtrans(svga_t *svga, uint16_t port, uint32_t
extern void ibm8514_short_stroke_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, uint8_t ssv, int len);
extern void ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, svga_t *svga, int len);
#ifdef ATI_8514_ULTRA
extern void ati8514_out(uint16_t addr, uint8_t val, void *priv);
extern uint8_t ati8514_in(uint16_t addr, void *priv);
extern void ati8514_recalctimings(svga_t *svga);
@@ -320,7 +319,6 @@ extern uint8_t ati8514_mca_read(int port, void *priv);
extern void ati8514_mca_write(int port, uint8_t val, void *priv);
extern void ati8514_pos_write(uint16_t port, uint8_t val, void *priv);
extern void ati8514_init(svga_t *svga, void *ext8514, void *dev8514);
#endif
extern void xga_write_test(uint32_t addr, uint8_t val, void *priv);
extern uint8_t xga_read_test(uint32_t addr, void *priv);

View File

@@ -43,9 +43,7 @@
#include <86box/vid_ati_mach8.h>
#include "cpu.h"
#ifdef ATI_8514_ULTRA
#define BIOS_MACH8_ROM_PATH "roms/video/mach8/11301113140.BIN"
#endif
#define BIOS_MACH8_ROM_PATH "roms/video/mach8/11301113140_4k.BIN"
static void ibm8514_accel_outb(uint16_t port, uint8_t val, void *priv);
static void ibm8514_accel_outw(uint16_t port, uint16_t val, void *priv);
@@ -337,18 +335,21 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
switch (port) {
case 0x82e8:
case 0xc2e8:
dev->fifo_idx++;
if (len == 2)
dev->accel.cur_y = val & 0x7ff;
break;
case 0x86e8:
case 0xc6e8:
dev->fifo_idx++;
if (len == 2)
dev->accel.cur_x = val & 0x7ff;
break;
case 0x8ae8:
case 0xcae8:
dev->fifo_idx++;
if (len == 2) {
dev->accel.desty = val & 0x7ff;
dev->accel.desty_axstp = val & 0x3fff;
@@ -359,6 +360,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0x8ee8:
case 0xcee8:
dev->fifo_idx++;
if (len == 2) {
dev->accel.destx = val & 0x7ff;
dev->accel.destx_distp = val & 0x3fff;
@@ -368,6 +370,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
break;
case 0x92e8:
dev->fifo_idx++;
if (len == 2)
dev->test = val;
fallthrough;
@@ -382,6 +385,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0x96e8:
case 0xd6e8:
dev->fifo_idx++;
if (len == 2) {
dev->accel.maj_axis_pcnt = val & 0x7ff;
dev->accel.maj_axis_pcnt_no_limit = val;
@@ -390,6 +394,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0x9ae8:
case 0xdae8:
dev->fifo_idx++;
dev->accel.ssv_state = 0;
if (len == 2) {
dev->data_available = 0;
@@ -406,6 +411,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0x9ee8:
case 0xdee8:
dev->fifo_idx++;
dev->accel.ssv_state = 1;
if (len == 2) {
dev->accel.short_stroke = val;
@@ -430,6 +436,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0xa2e8:
case 0xe2e8:
dev->fifo_idx++;
if (port == 0xe2e8) {
if (len == 2) {
if (dev->accel.cmd_back)
@@ -448,6 +455,7 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0xa6e8:
case 0xe6e8:
dev->fifo_idx++;
if (port == 0xe6e8) {
if (len == 2) {
if (dev->accel.cmd_back)
@@ -466,34 +474,40 @@ ibm8514_accel_out_fifo(svga_t *svga, uint16_t port, uint32_t val, int len)
case 0xaae8:
case 0xeae8:
dev->fifo_idx++;
if (len == 2)
dev->accel.wrt_mask = val;
break;
case 0xaee8:
case 0xeee8:
dev->fifo_idx++;
if (len == 2)
dev->accel.rd_mask = val;
break;
case 0xb2e8:
case 0xf2e8:
dev->fifo_idx++;
if (len == 2)
dev->accel.color_cmp = val;
break;
case 0xb6e8:
case 0xf6e8:
dev->fifo_idx++;
dev->accel.bkgd_mix = val & 0xff;
break;
case 0xbae8:
case 0xfae8:
dev->fifo_idx++;
dev->accel.frgd_mix = val & 0xff;
break;
case 0xbee8:
case 0xfee8:
dev->fifo_idx++;
if (len == 2) {
dev->accel.multifunc_cntl = val;
dev->accel.multifunc[dev->accel.multifunc_cntl >> 12] = dev->accel.multifunc_cntl & 0xfff;
@@ -601,7 +615,6 @@ void
ibm8514_accel_out(uint16_t port, uint32_t val, svga_t *svga, int len)
{
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
uint8_t old = 0;
if (port & 0x8000)
ibm8514_accel_out_fifo(svga, port, val, len);
@@ -687,26 +700,31 @@ ibm8514_accel_out(uint16_t port, uint32_t val, svga_t *svga, int len)
break;
case 0x42e8:
if (val & 1)
dev->subsys_stat &= ~1;
if (val & 2)
dev->subsys_stat &= ~2;
if (val & 4)
dev->subsys_stat &= ~4;
if (val & 8)
dev->subsys_stat &= ~8;
if (val & 0x01)
dev->subsys_stat &= ~0x01;
if (val & 0x02)
dev->subsys_stat &= ~0x02;
if (val & 0x04)
dev->subsys_stat &= ~0x04;
if (val & 0x08)
dev->subsys_stat &= ~0x08;
break;
case 0x42e9:
old = dev->subsys_cntl;
dev->subsys_cntl = val;
if ((old ^ val) & 1)
dev->subsys_stat |= 1;
if ((old ^ val) & 2)
dev->subsys_stat |= 2;
if ((old ^ val) & 4)
dev->subsys_stat |= 4;
if ((old ^ val) & 8)
dev->subsys_stat |= 8;
if (val & 0x01)
dev->subsys_stat |= 0x01;
if (val & 0x02)
dev->subsys_stat |= 0x02;
if (val & 0x04)
dev->subsys_stat |= 0x04;
if (val & 0x08)
dev->subsys_stat |= 0x08;
if ((val & 0xc0) == 0xc0) {
dev->fifo_idx = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
}
break;
case 0x4ae8:
@@ -771,6 +789,22 @@ ibm8514_accel_in_fifo(svga_t *svga, uint16_t port, int len)
case 0x9ae8:
case 0xdae8:
if ((dev->fifo_idx >= 1) && (dev->fifo_idx <= 8)) {
temp |= (1 << (dev->fifo_idx - 1));
switch (dev->accel.cmd >> 13) {
case 2:
case 3:
case 4:
case 6:
if (dev->accel.sy < 0)
dev->fifo_idx = 0;
break;
default:
if (!dev->accel.sy)
dev->fifo_idx = 0;
break;
}
}
if (len == 2) {
if (dev->force_busy)
temp |= 0x200; /*Hardware busy*/
@@ -878,10 +912,15 @@ ibm8514_accel_in(uint16_t port, svga_t *svga)
dev->subsys_stat |= 0x02;
}
if (!dev->fifo_idx) {
if (!dev->force_busy && !dev->force_busy2)
temp |= 0x08;
}
if (port & 1)
temp = dev->vram_512k_8514 ? 0x00 : 0x80;
else {
temp |= (dev->subsys_stat | 0x80);
temp |= (dev->subsys_stat | (dev->vram_512k_8514 ? 0x00 : 0x80));
temp |= 0x20;
}
break;
@@ -932,6 +971,8 @@ ibm8514_short_stroke_start(int count, int cpu_input, uint32_t mix_dat, uint32_t
dev->accel.ssv_draw = ssv & 0x10;
if (ibm8514_cpu_src(svga)) {
dev->data_available = 0;
dev->data_available2 = 0;
return; /*Wait for data from CPU*/
}
}
@@ -1242,70 +1283,34 @@ ibm8514_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat
break;
}
if (dev->accel.err_term >= dev->accel.maj_axis_pcnt) {
dev->accel.err_term += dev->accel.destx_distp;
/*Step minor axis*/
switch (dev->accel.cmd & 0xe0) {
case 0x00:
dev->accel.cy--;
break;
case 0x20:
dev->accel.cy--;
break;
case 0x40:
dev->accel.cx--;
break;
case 0x60:
dev->accel.cx++;
break;
case 0x80:
dev->accel.cy++;
break;
case 0xa0:
dev->accel.cy++;
break;
case 0xc0:
dev->accel.cx--;
break;
case 0xe0:
dev->accel.cx++;
break;
default:
break;
}
} else
dev->accel.err_term += dev->accel.desty_axstp;
/*Step major axis*/
switch (dev->accel.cmd & 0xe0) {
case 0x00:
dev->accel.cx--;
break;
case 0x20:
dev->accel.cx++;
break;
case 0x40:
dev->accel.cy--;
break;
case 0x60:
dev->accel.cy--;
break;
case 0x80:
dev->accel.cx--;
break;
case 0xa0:
dev->accel.cx++;
break;
case 0xc0:
if (dev->accel.cmd & 0x40) {
if (dev->accel.cmd & 0x80)
dev->accel.cy++;
break;
case 0xe0:
dev->accel.cy++;
break;
else
dev->accel.cy--;
default:
break;
if (dev->accel.err_term >= 0) {
dev->accel.err_term += dev->accel.destx_distp;
if (dev->accel.cmd & 0x20)
dev->accel.cx++;
else
dev->accel.cx--;
} else
dev->accel.err_term += dev->accel.desty_axstp;
} else {
if (dev->accel.cmd & 0x20)
dev->accel.cx++;
else
dev->accel.cx--;
if (dev->accel.err_term >= 0) {
dev->accel.err_term += dev->accel.destx_distp;
if (dev->accel.cmd & 0x80)
dev->accel.cy++;
else
dev->accel.cy--;
} else
dev->accel.err_term += dev->accel.desty_axstp;
}
dev->accel.ssv_len--;
@@ -2356,8 +2361,8 @@ skip_nibble_rect_write:
}
}
} else {
ibm8514_log("Polygon Draw Type=%02x, CL=%d, CR=%d.\n", dev->accel.multifunc[0x0a] & 0x06, clip_l, clip_r);
while (count-- && dev->accel.sy >= 0) {
ibm8514_log("Polygon Draw Type=%02x, CX=%d, CY=%d, SY=%d, CL=%d, CR=%d.\n", dev->accel.multifunc[0x0a] & 0x06, dev->accel.cx, dev->accel.cy, dev->accel.sy, clip_l, clip_r);
while (count-- && (dev->accel.sy >= 0)) {
if ((dev->accel.cx >= clip_l) &&
(dev->accel.cx <= clip_r) &&
(dev->accel.cy >= clip_t) &&
@@ -3291,16 +3296,16 @@ ibm8514_render_8bpp(svga_t *svga)
for (int x = 0; x <= dev->h_disp; x += 8) {
dat = *(uint32_t *) (&dev->vram[dev->ma & dev->vram_mask]);
p[0] = dev->pallook[dat & dev->dac_mask];
p[1] = dev->pallook[(dat >> 8) & dev->dac_mask];
p[2] = dev->pallook[(dat >> 16) & dev->dac_mask];
p[3] = dev->pallook[(dat >> 24) & dev->dac_mask];
p[0] = dev->pallook[dat & dev->dac_mask & 0xff];
p[1] = dev->pallook[(dat >> 8) & dev->dac_mask & 0xff];
p[2] = dev->pallook[(dat >> 16) & dev->dac_mask & 0xff];
p[3] = dev->pallook[(dat >> 24) & dev->dac_mask & 0xff];
dat = *(uint32_t *) (&dev->vram[(dev->ma + 4) & dev->vram_mask]);
p[4] = dev->pallook[dat & dev->dac_mask];
p[5] = dev->pallook[(dat >> 8) & dev->dac_mask];
p[6] = dev->pallook[(dat >> 16) & dev->dac_mask];
p[7] = dev->pallook[(dat >> 24) & dev->dac_mask];
p[4] = dev->pallook[dat & dev->dac_mask & 0xff];
p[5] = dev->pallook[(dat >> 8) & dev->dac_mask & 0xff];
p[6] = dev->pallook[(dat >> 16) & dev->dac_mask & 0xff];
p[7] = dev->pallook[(dat >> 24) & dev->dac_mask & 0xff];
dev->ma += 8;
p += 8;
@@ -3702,13 +3707,10 @@ ibm8514_recalctimings(svga_t *svga)
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
svga->render8514 = ibm8514_render_blank;
#ifdef ATI_8514_ULTRA
if (dev->extensions) {
if (svga->ext8514 != NULL)
ati8514_recalctimings(svga);
} else
#endif
{
} else {
if (dev->on) {
dev->h_total = dev->htotal + 1;
dev->rowcount = !!(dev->disp_cntl & 0x08);
@@ -3742,7 +3744,6 @@ ibm8514_recalctimings(svga_t *svga)
dev->pitch = 1024;
dev->rowoffset = 0x80;
svga->map8 = dev->pallook;
if (dev->vram_512k_8514) {
if (dev->h_disp == 640)
dev->pitch = 640;
@@ -3795,11 +3796,9 @@ ibm8514_mca_reset(void *priv)
ibm8514_log("MCA reset.\n");
dev->on = 0;
#ifdef ATI_8514_ULTRA
if (dev->extensions)
ati8514_mca_write(0x102, 0, svga);
else
#endif
ibm8514_mca_write(0x102, 0, svga);
timer_set_callback(&svga->timer, svga_poll);
@@ -3808,9 +3807,8 @@ ibm8514_mca_reset(void *priv)
static void *
ibm8514_init(const device_t *info)
{
#ifdef ATI_8514_ULTRA
uint32_t bios_addr = 0;
#endif
uint16_t bios_rom_eeprom = 0x0000;
if (svga_get_pri() == NULL)
return NULL;
@@ -3834,9 +3832,10 @@ ibm8514_init(const device_t *info)
dev->type = info->flags;
dev->bpp = 0;
#ifdef ATI_8514_ULTRA
dev->extensions = device_get_config_int("extensions");
bios_addr = device_get_config_hex20("bios_addr");
if (dev->type & DEVICE_MCA)
bios_addr = 0xc6000;
switch (dev->extensions) {
case 1:
@@ -3844,29 +3843,28 @@ ibm8514_init(const device_t *info)
mach_t * mach = (mach_t *) calloc(1, sizeof(mach_t));
svga->ext8514 = mach;
rom_init(&dev->bios_rom,
BIOS_MACH8_ROM_PATH,
bios_addr, 0x1000, 0xfff,
0, MEM_MAPPING_EXTERNAL);
ati8514_init(svga, svga->ext8514, svga->dev8514);
mach->accel.scratch0 = ((((bios_addr >> 7) - 0x1000) >> 4));
bios_rom_eeprom = mach->accel.scratch0;
if (dev->type & DEVICE_MCA) {
rom_init(&dev->bios_rom,
BIOS_MACH8_ROM_PATH,
0xc6000, 0x2000, 0x1fff,
0, MEM_MAPPING_EXTERNAL);
dev->pos_regs[0] = 0x88;
dev->pos_regs[1] = 0x80;
mach->eeprom.data[0] = 0x0000;
mach->eeprom.data[1] = bios_rom_eeprom | ((bios_rom_eeprom | 0x01) << 8);
mca_add(ati8514_mca_read, ati8514_mca_write, ibm8514_mca_feedb, ibm8514_mca_reset, svga);
ati_eeprom_load_mach8(&mach->eeprom, "ati8514_mca.nvr");
ati_eeprom_load_mach8(&mach->eeprom, "ati8514_mca.nvr", 1);
mem_mapping_disable(&dev->bios_rom.mapping);
} else {
rom_init(&dev->bios_rom,
BIOS_MACH8_ROM_PATH,
bios_addr, 0x2000, 0x1fff,
0, MEM_MAPPING_EXTERNAL);
mach->accel.scratch0 = (((bios_addr >> 7) - 0x1000) >> 4);
ati_eeprom_load_mach8(&mach->eeprom, "ati8514.nvr");
}
ati8514_init(svga, svga->ext8514, svga->dev8514);
} else
ati_eeprom_load_mach8(&mach->eeprom, "ati8514.nvr", 0);
break;
}
fallthrough;
fallthrough;
default:
ibm8514_io_set(svga);
@@ -3877,16 +3875,6 @@ ibm8514_init(const device_t *info)
}
break;
}
#else
ibm8514_io_set(svga);
if (dev->type & DEVICE_MCA) {
dev->pos_regs[0] = 0x7f;
dev->pos_regs[1] = 0xef;
mca_add(ibm8514_mca_read, ibm8514_mca_write, ibm8514_mca_feedb, ibm8514_mca_reset, svga);
}
#endif
return svga;
}
@@ -3895,13 +3883,10 @@ ibm8514_close(void *priv)
{
svga_t *svga = (svga_t *) priv;
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
#ifdef ATI_8514_ULTRA
mach_t *mach = (mach_t *) svga->ext8514;
if (mach)
free(mach);
#endif
if (dev) {
free(dev->vram);
@@ -3927,9 +3912,8 @@ ibm8514_force_redraw(void *priv)
svga->fullchange = changeframecount;
}
#ifdef ATI_8514_ULTRA
// clang-format off
static const device_config_t ext8514_config[] = {
static const device_config_t isa_ext8514_config[] = {
{
.name = "memory",
.description = "Memory size",
@@ -3996,9 +3980,9 @@ static const device_config_t ext8514_config[] = {
.type = CONFIG_END
}
};
#else
// clang-format off
static const device_config_t ext8514_config[] = {
static const device_config_t mca_ext8514_config[] = {
{
.name = "memory",
.description = "Memory size",
@@ -4018,11 +4002,29 @@ static const device_config_t ext8514_config[] = {
}
}
},
{
.name = "extensions",
.description = "Vendor",
.type = CONFIG_SELECTION,
.default_int = 0,
.selection = {
{
.description = "IBM",
.value = 0
},
{
.description = "ATI",
.value = 1
},
{
.description = ""
}
}
},
{
.type = CONFIG_END
}
};
#endif
// clang-format off
const device_t gen8514_isa_device = {
@@ -4036,7 +4038,7 @@ const device_t gen8514_isa_device = {
{ .available = NULL },
.speed_changed = ibm8514_speed_changed,
.force_redraw = ibm8514_force_redraw,
.config = ext8514_config
.config = isa_ext8514_config
};
const device_t ibm8514_mca_device = {
@@ -4050,7 +4052,7 @@ const device_t ibm8514_mca_device = {
{ .available = NULL },
.speed_changed = ibm8514_speed_changed,
.force_redraw = ibm8514_force_redraw,
.config = ext8514_config
.config = mca_ext8514_config
};

View File

@@ -43,11 +43,12 @@ ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type)
}
if (fread(eeprom->data, 1, size, fp) != size)
memset(eeprom->data, 0, size);
fclose(fp);
}
void
ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn)
ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn, int mca)
{
FILE *fp;
int size;
@@ -55,14 +56,43 @@ ati_eeprom_load_mach8(ati_eeprom_t *eeprom, char *fn)
strncpy(eeprom->fn, fn, sizeof(eeprom->fn) - 1);
fp = nvr_fopen(eeprom->fn, "rb");
size = 128;
if (!fp) { /*The ATI Graphics Ultra bios expects an immediate write to nvram if none is present at boot time otherwise
if (!fp) {
if (mca) {
(void) fseek(fp, 2L, SEEK_SET);
memset(eeprom->data + 2, 0xff, size - 2);
fp = nvr_fopen(eeprom->fn, "wb");
fwrite(eeprom->data, 1, size, fp);
fclose(fp);
} else
memset(eeprom->data, 0xff, size);
return;
}
if (fread(eeprom->data, 1, size, fp) != size)
memset(eeprom->data, 0, size);
fclose(fp);
}
void
ati_eeprom_load_mach8_vga(ati_eeprom_t *eeprom, char *fn)
{
FILE *fp;
int size;
eeprom->type = 0;
strncpy(eeprom->fn, fn, sizeof(eeprom->fn) - 1);
fp = nvr_fopen(eeprom->fn, "rb");
size = 128;
if (!fp) { /*The ATI Graphics Ultra bios expects a fresh nvram zero'ed at boot time otherwise
it would hang the machine.*/
memset(eeprom->data, 0, size);
fp = nvr_fopen(eeprom->fn, "wb");
fwrite(eeprom->data, 1, size, fp);
fclose(fp);
return;
}
if (fread(eeprom->data, 1, size, fp) != size)
memset(eeprom->data, 0, size);
fclose(fp);
}
@@ -79,9 +109,9 @@ ati_eeprom_save(ati_eeprom_t *eeprom)
void
ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat)
{
if (!ena) {
if (!ena)
eeprom->out = 1;
}
if (clk && !eeprom->oldclk) {
if (ena && !eeprom->oldena) {
eeprom->state = EEPROM_WAIT;

View File

@@ -56,19 +56,17 @@ static video_timings_t timing_mach32_pci = { .type = VIDEO_PCI, .write_b = 2,
static void mach_accel_outb(uint16_t port, uint8_t val, void *priv);
static void mach_accel_outw(uint16_t port, uint16_t val, void *priv);
static void mach_accel_outl(uint16_t port, uint32_t val, void *priv);
static uint8_t mach_accel_inb(uint16_t port, void *priv);
static uint16_t mach_accel_inw(uint16_t port, void *priv);
static uint8_t mach_in(uint16_t addr, void *priv);
static uint32_t mach_accel_inl(uint16_t port, void *priv);
#ifdef ATI_8514_ULTRA
static void ati8514_accel_outb(uint16_t port, uint8_t val, void *priv);
static void ati8514_accel_outw(uint16_t port, uint16_t val, void *priv);
static void ati8514_accel_outl(uint16_t port, uint32_t val, void *priv);
static uint8_t ati8514_accel_inb(uint16_t port, void *priv);
static uint16_t ati8514_accel_inw(uint16_t port, void *priv);
static uint32_t ati8514_accel_inl(uint16_t port, void *priv);
#endif
static void mach32_updatemapping(mach_t *mach, svga_t *svga);
@@ -1254,10 +1252,12 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if ((mono_src == 2) || (bkgd_sel == 2) || (frgd_sel == 2) || mach_pixel_read(mach)) {
if (mach_pixel_write(mach)) {
mach_log("Write PIXTRANS.\n");
dev->data_available = 0;
dev->data_available2 = 0;
return;
} else if (mach_pixel_read(mach)) {
mach_log("Read PIXTRANS.\n");
dev->data_available = 1;
dev->data_available2 = 1;
return;
@@ -2484,14 +2484,9 @@ mach_in(uint16_t addr, void *priv)
return temp;
}
#ifdef ATI_8514_ULTRA
void
ati8514_out(uint16_t addr, uint8_t val, void *priv)
{
svga_t *svga = (svga_t *)priv;
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
mach_log("[%04X:%08X]: ADDON OUT addr=%03x, val=%02x.\n", CS, cpu_state.pc, addr, val);
svga_out(addr, val, priv);
@@ -2500,8 +2495,6 @@ ati8514_out(uint16_t addr, uint8_t val, void *priv)
uint8_t
ati8514_in(uint16_t addr, void *priv)
{
svga_t *svga = (svga_t *)priv;
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
uint8_t temp = 0xff;
temp = svga_in(addr, priv);
@@ -2526,15 +2519,20 @@ ati8514_recalctimings(svga_t *svga)
dev->accel.ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16));
mach->accel.ge_offset = dev->accel.ge_offset;
mach_log("HDISP=%d, VDISP=%d, shadowset=%x, 8514/A mode=%x, clocksel=%02x.\n", dev->hdisp, dev->vdisp, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x04, mach->accel.clock_sel & 0xfe);
mach_log("HDISP=%d, VDISP=%d, shadowset=%x, 8514/A mode=%x, clocksel=%02x.\n", dev->hdisp, dev->vdisp, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x05, mach->accel.clock_sel & 0x01);
if (mach->accel.clock_sel & 0x01) {
dev->h_disp = dev->hdisp;
dev->dispend = dev->vdisp;
} else {
if (dev->accel.advfunc_cntl & 0x04) {
dev->h_disp = dev->hdisp;
dev->dispend = dev->vdisp;
if (dev->hdisp == 640) {
dev->h_disp = 1024;
dev->dispend = 768;
} else {
dev->h_disp = dev->hdisp;
dev->dispend = dev->vdisp;
}
} else {
dev->h_disp = 640;
dev->dispend = 480;
@@ -2563,7 +2561,6 @@ ati8514_recalctimings(svga_t *svga)
svga->render8514 = ibm8514_render_8bpp;
}
}
#endif
static void
mach_recalctimings(svga_t *svga)
@@ -2803,14 +2800,18 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0x86e8:
case 0xc2e8:
case 0xc6e8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
break;
case 0xf6ee:
ibm8514_accel_out_fifo(svga, 0x82e8, val, len);
dev->ext_fifo_idx++;
if (len == 2)
dev->accel.cur_y = val & 0x7ff;
break;
case 0x8ae8:
case 0xcae8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
if (len == 2) {
mach_log("SRCY=%d.\n", val & 0x07ff);
@@ -2820,6 +2821,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0x8ee8:
case 0xcee8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
if (len == 2) {
mach_log("SRCX=%d.\n", val & 0x07ff);
@@ -2829,11 +2831,13 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0x92e8:
case 0xd2e8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
break;
case 0x96e8:
case 0xd6e8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
if (len == 2)
mach->accel.test = val & 0x1fff;
@@ -2841,17 +2845,21 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0x9ae8:
case 0xdae8:
dev->ext_fifo_idx++;
mach->accel.cmd_type = -1;
ibm8514_accel_out_fifo(svga, port, val, len);
break;
case 0x9ee8:
case 0xdee8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
break;
case 0xa2e8:
case 0xe2e8:
dev->ext_fifo_idx++;
dev->fifo_idx++;
if (port == 0xe2e8) {
if (len == 2) {
if (dev->accel.cmd_back) {
@@ -2883,6 +2891,8 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0xa6e8:
case 0xe6e8:
dev->ext_fifo_idx++;
dev->fifo_idx++;
if (port == 0xe6e8) {
if (len == 2) {
if (dev->accel.cmd_back)
@@ -2913,6 +2923,8 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0xe2e9:
case 0xe6e9:
dev->ext_fifo_idx++;
dev->fifo_idx++;
mach_log("Write PORT=%04x, 8514/A=%x, val=%04x, len=%d.\n", port, dev->accel.cmd_back, val, len);
if (len == 1) {
if (mach->accel.cmd_type >= 0) {
@@ -2964,11 +2976,13 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
case 0xf2e8:
case 0xf6e8:
case 0xfae8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
break;
case 0xbee8:
case 0xfee8:
dev->ext_fifo_idx++;
ibm8514_accel_out_fifo(svga, port, val, len);
if (len == 2) {
if ((dev->accel.multifunc_cntl >> 12) == 5) {
@@ -2980,6 +2994,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
/*ATI Mach8/32 specific registers*/
case 0x82ee:
dev->ext_fifo_idx++;
mach->accel.patt_data_idx_reg = val & 0x1f;
mach->accel.patt_data_idx = mach->accel.patt_data_idx_reg;
@@ -2992,6 +3007,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0x8eee:
dev->ext_fifo_idx++;
if (len == 2) {
if (mach->accel.patt_data_idx_reg < 0x10) {
mach->accel.color_pattern[mach->accel.patt_data_idx] = val & 0xff;
@@ -3007,6 +3023,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0x96ee:
dev->ext_fifo_idx++;
if (len == 2) {
mach->accel.bres_count = val & 0x7ff;
mach_log("BresenhamDraw=%04x.\n", mach->accel.dp_config);
@@ -3026,10 +3043,12 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0x9aee:
dev->ext_fifo_idx++;
mach->accel.line_idx = val & 0x07;
break;
case 0xa2ee:
dev->ext_fifo_idx++;
mach_log("Line OPT=%04x.\n", val);
if (len == 2) {
mach->accel.linedraw_opt = val;
@@ -3047,16 +3066,19 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xa6ee:
dev->ext_fifo_idx++;
if (len == 2)
mach->accel.dest_x_start = val & 0x7ff;
break;
case 0xaaee:
dev->ext_fifo_idx++;
if (len == 2)
mach->accel.dest_x_end = val & 0x7ff;
break;
case 0xaeee:
dev->ext_fifo_idx++;
if (len == 2) {
mach->accel.dest_y_end = val & 0x7ff;
if ((val + 1) == 0x10000) {
@@ -3082,28 +3104,34 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xb2ee:
dev->ext_fifo_idx++;
if (len == 2)
mach->accel.src_x_start = val & 0x7ff;
break;
case 0xb6ee:
ibm8514_accel_out_fifo(svga, 0xb6e8, val, len);
dev->ext_fifo_idx++;
dev->accel.bkgd_mix = val & 0xff;
break;
case 0xbaee:
ibm8514_accel_out_fifo(svga, 0xbae8, val, len);
dev->ext_fifo_idx++;
dev->accel.frgd_mix = val & 0xff;
break;
case 0xbeee:
dev->ext_fifo_idx++;
if (len == 2)
mach->accel.src_x_end = val & 0x7ff;
break;
case 0xc2ee:
dev->ext_fifo_idx++;
mach->accel.src_y_dir = val & 1;
break;
case 0xc6ee:
dev->ext_fifo_idx++;
if (len == 2) {
mach->accel.cmd_type = 0;
mach_log("TODO: Short Stroke.\n");
@@ -3118,6 +3146,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xcaee:
dev->ext_fifo_idx++;
if (len == 2) {
mach->accel.scan_to_x = (val & 0x7ff);
if ((val + 1) == 0x10000) {
@@ -3143,6 +3172,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xceee:
dev->ext_fifo_idx++;
mach_log("CEEE write val = %04x.\n", val);
if (len == 2) {
dev->data_available = 0;
@@ -3152,6 +3182,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xd2ee:
dev->ext_fifo_idx++;
mach->accel.patt_len = val & 0x1f;
mach_log("Write Port d2ee: Pattern Length=%d, val=%04x.\n", val & 0x1f, val);
mach->accel.mono_pattern_enable = !!(val & 0x80);
@@ -3162,11 +3193,13 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xd6ee:
dev->ext_fifo_idx++;
mach->accel.patt_idx = val & 0x1f;
mach_log("Write Port d6ee: Pattern Index=%d.\n", val & 0x1f);
break;
case 0xdaee:
dev->ext_fifo_idx++;
if (len == 2) {
dev->accel.multifunc[2] = val & 0x7ff;
dev->accel.clip_left = dev->accel.multifunc[2];
@@ -3177,6 +3210,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xdeee:
dev->ext_fifo_idx++;
if (len == 2) {
dev->accel.multifunc[1] = val & 0x7ff;
dev->accel.clip_top = dev->accel.multifunc[1];
@@ -3188,6 +3222,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xe2ee:
dev->ext_fifo_idx++;
if (len == 2) {
dev->accel.multifunc[4] = val & 0x7ff;
dev->accel.clip_right = dev->accel.multifunc[4];
@@ -3198,6 +3233,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xe6ee:
dev->ext_fifo_idx++;
if (len == 2) {
dev->accel.multifunc[3] = val & 0x7ff;
dev->accel.clip_bottom = dev->accel.multifunc[3];
@@ -3208,17 +3244,20 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
break;
case 0xeeee:
dev->ext_fifo_idx++;
if (len == 2)
mach->accel.dest_cmp_fn = val;
break;
case 0xf2ee:
dev->ext_fifo_idx++;
mach_log("F2EE.\n");
if (len == 2)
mach->accel.dst_clr_cmp_mask = val;
break;
case 0xfeee:
dev->ext_fifo_idx++;
mach_log("LineDraw=%04x.\n", mach->accel.dp_config);
if (len == 2) {
mach->accel.line_array[mach->accel.line_idx] = val;
@@ -3263,8 +3302,14 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
case 0x1ee8:
case 0x1ee9:
case 0x42e8:
ibm8514_accel_out(port, val, svga, 2);
break;
case 0x42e9:
ibm8514_accel_out(port, val, svga, 2);
if ((val & 0xc0) == 0xc0) {
dev->ext_fifo_idx = 0;
mach->force_busy = 0;
}
break;
case 0x6e8:
@@ -3443,11 +3488,13 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
else
dev->ext_crt_pitch <<= 1;
}
dev->on |= 0x01;
dev->vendor_mode = 1;
if ((dev->local & 0xff) >= 0x02) {
dev->on |= 0x01;
dev->vendor_mode = 1;
}
svga_recalctimings(svga);
mach32_updatemapping(mach, svga);
mach_log("ATI 8514/A: (0x%04x) val=0x%02x.\n", port, val);
mach_log("ATI 8514/A: (0x%04x) val=0x%02x, extended 8514/A mode=%02x.\n", port, val, mach->regs[0xb0] & 0x20);
break;
case 0x32ee:
@@ -3459,8 +3506,10 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
case 0x36ee:
case 0x36ef:
mach_log("ATI 8514/A: (0x%04x) val = %04x.\n", port, val);
WRITE8(port, mach->misc, val);
mach->misc &= 0xfff0;
if ((dev->local & 0xff) >= 0x02) {
WRITE8(port, mach->misc, val);
mach->misc &= 0xfff0;
}
break;
case 0x3aee:
@@ -3599,17 +3648,8 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
svga_set_ramdac_type(svga, !!(mach->accel.ext_ge_config & 0x4000));
mach_log("ATI 8514/A: (0x%04x) val=%02x.\n", port, val);
svga_recalctimings(svga);
} else {
mach_log("ATI 8514/A: (0x%04x) val=%02x.\n", port, val & 0x30);
} else
ati_eeprom_write(&mach->eeprom, !!(mach->accel.ext_ge_config & 0x4000), !!(mach->accel.ext_ge_config & 0x2000), !!(mach->accel.ext_ge_config & 0x1000));
}
break;
case 0x7eee:
case 0x7eef:
WRITE8(port, mach->accel.eeprom_control, val);
ati_eeprom_write(&mach->eeprom, !!(mach->accel.eeprom_control & 8), !!(mach->accel.eeprom_control & 2), !!(mach->accel.eeprom_control & 1));
mach_log("ATI 8514/A: (0x%04x) val=%02x.\n", port, val);
break;
default:
@@ -3631,7 +3671,7 @@ static uint16_t
mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, int len)
{
const uint16_t *vram_w = (uint16_t *) dev->vram;
uint16_t temp = 0;
uint16_t temp = 0x0000;
int cmd;
int frgd_sel;
int bkgd_sel;
@@ -3649,6 +3689,11 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
case 0x9ae8:
case 0xdae8:
if ((dev->fifo_idx >= 1) && (dev->fifo_idx <= 8)) {
temp |= (1 << (dev->fifo_idx - 1));
dev->fifo_idx = 0;
}
if (len == 2) {
if (dev->force_busy)
temp |= 0x200; /*Hardware busy*/
@@ -3672,8 +3717,19 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
break;
}
} else {
if (dev->accel.sy < 0)
dev->data_available = 0;
switch (dev->accel.cmd >> 13) {
case 2:
case 3:
case 4:
case 6:
if (dev->accel.sy < 0)
dev->data_available = 0;
break;
default:
if (!dev->accel.sy)
dev->data_available = 0;
break;
}
}
}
}
@@ -3846,6 +3902,15 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
temp = mach->accel.test >> 8;
break;
case 0x9aee:
if (len == 2) {
if ((dev->ext_fifo_idx >= 1) && (dev->ext_fifo_idx <= 16)) {
temp |= (1 << (dev->ext_fifo_idx - 1));
dev->ext_fifo_idx = 0;
}
}
break;
case 0xa2ee:
if (len == 1)
temp = mach->accel.linedraw_opt & 0xff;
@@ -3991,8 +4056,7 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
break;
}
if (port != 0x9aee && port != 0x62ee)
mach_log("[%04X:%08X]: Port FIFO IN=%04x, temp=%04x, len=%d.\n", CS, cpu_state.pc, port, temp, len);
mach_log("[%04X:%08X]: Port FIFO IN=%04x, temp=%04x, len=%d.\n", CS, cpu_state.pc, port, temp, len);
return temp;
}
@@ -4023,7 +4087,7 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
case 0x42e8:
case 0x42e9:
if (dev->vc == dev->v_syncstart)
dev->subsys_stat |= 0x01;
temp |= 0x01;
if (mach->accel.cmd_type == -1) {
if (cmd == 6) {
@@ -4031,13 +4095,13 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
(dev->accel.dx <= clip_r_ibm) &&
(dev->accel.dy >= clip_t) &&
(dev->accel.dy <= clip_b_ibm))
dev->subsys_stat |= 0x02;
temp |= 0x02;
} else {
if ((dev->accel.cx >= clip_l) &&
(dev->accel.cx <= clip_r_ibm) &&
(dev->accel.cy >= clip_t) &&
(dev->accel.cy <= clip_b_ibm))
dev->subsys_stat |= 0x02;
temp |= 0x02;
}
} else {
switch (mach->accel.cmd_type) {
@@ -4048,25 +4112,29 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
(dev->accel.dx <= clip_r) &&
(dev->accel.dy >= clip_t) &&
(dev->accel.dy <= clip_b))
dev->subsys_stat |= 0x02;
temp |= 0x02;
break;
case 3:
case 4:
if ((dev->accel.cx >= clip_l) &&
(dev->accel.cx <= clip_r) &&
(dev->accel.cy >= clip_t) &&
(dev->accel.cy <= clip_b))
dev->subsys_stat |= 0x02;
if ((dev->accel.cx >= clip_l) &&
(dev->accel.cx <= clip_r) &&
(dev->accel.cy >= clip_t) &&
(dev->accel.cy <= clip_b))
temp |= 0x02;
break;
default:
break;
}
}
if ((!dev->fifo_idx || !dev->ext_fifo_idx)) {
if ((!dev->force_busy && !dev->force_busy2) || !mach->force_busy)
temp |= 0x08;
}
if (port & 1)
temp = dev->vram_512k_8514 ? 0x00 : 0x80;
else {
temp |= (dev->subsys_stat | 0x80);
temp |= (dev->subsys_stat | (dev->vram_512k_8514 ? 0x00 : 0x80));
if (mach->accel.ext_ge_config & 0x08)
temp |= ((mach->accel.ext_ge_config & 0x07) << 4);
else
@@ -4103,23 +4171,25 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
case 0x36ee:
case 0x36ef:
READ8(port, mach->misc);
if ((dev->local & 0xff) >= 0x02) {
READ8(port, mach->misc);
if (!(port & 1)) {
temp &= ~0x0c;
switch (dev->vram_amount) {
case 1024:
temp |= 0x04;
break;
case 2048:
temp |= 0x08;
break;
case 4096:
temp |= 0x0c;
break;
if (!(port & 1)) {
temp &= ~0x0c;
switch (dev->vram_amount) {
case 1024:
temp |= 0x04;
break;
case 2048:
temp |= 0x08;
break;
case 4096:
temp |= 0x0c;
break;
default:
break;
default:
break;
}
}
}
break;
@@ -4142,16 +4212,13 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
case 0x52ee:
case 0x52ef:
READ8(port, mach->accel.scratch0);
#ifdef ATI_8514_ULTRA
if (dev->extensions && ((dev->local & 0xff) == 0x00)) {
if (mach->mca_bus) {
if (mach->mca_bus) {
if (svga->ext8514 != NULL) {
temp = (((dev->bios_rom.mapping.base >> 7) - 0x1000) >> 4);
if (port & 1)
temp = dev->pos_regs[5];
else
temp = dev->pos_regs[4];
temp |= 0x01;
}
}
#endif
break;
case 0x56ee:
@@ -4210,13 +4277,11 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
default:
break;
}
if (port != 0x42e8 && port != 0x42e9 && port != 0x62ee && port != 0x62ef && port != 0x02e8 && port != 0x02e9)
mach_log("[%04X:%08X]: Port NORMAL IN=%04x, temp=%04x.\n", CS, cpu_state.pc, port, temp);
mach_log("[%04X:%08X]: Port NORMAL IN=%04x, temp=%04x.\n", CS, cpu_state.pc, port, temp);
return temp;
}
#ifdef ATI_8514_ULTRA
static void
ati8514_accel_out(uint16_t port, uint8_t val, svga_t *svga)
{
@@ -4267,7 +4332,6 @@ ati8514_accel_outl(uint16_t port, uint32_t val, void *priv)
ati8514_accel_out(port + 3, (val >> 24), svga);
}
}
#endif
static void
mach_accel_outb(uint16_t port, uint8_t val, void *priv)
@@ -4312,7 +4376,6 @@ mach_accel_outl(uint16_t port, uint32_t val, void *priv)
}
}
#ifdef ATI_8514_ULTRA
static uint8_t
ati8514_accel_in(uint16_t port, svga_t *svga)
{
@@ -4368,7 +4431,6 @@ ati8514_accel_inl(uint16_t port, void *priv)
}
return temp;
}
#endif
static uint8_t
mach_accel_in(uint16_t port, mach_t *mach)
@@ -5316,10 +5378,10 @@ mach32_hwcursor_draw(svga_t *svga, int displine)
dev->hwcursor_latch.addr += 16;
}
#ifdef ATI_8514_ULTRA
static void
ati8514_io_set(svga_t *svga)
{
io_sethandler(0x2e8, 0x0002, ati8514_accel_inb, ati8514_accel_inw, ati8514_accel_inl, ati8514_accel_outb, ati8514_accel_outw, ati8514_accel_outl, svga);
io_sethandler(0x6e8, 0x0002, ati8514_accel_inb, ati8514_accel_inw, ati8514_accel_inl, ati8514_accel_outb, ati8514_accel_outw, ati8514_accel_outl, svga);
io_sethandler(0xae8, 0x0002, ati8514_accel_inb, ati8514_accel_inw, ati8514_accel_inl, ati8514_accel_outb, ati8514_accel_outw, ati8514_accel_outl, svga);
io_sethandler(0xee8, 0x0002, ati8514_accel_inb, ati8514_accel_inw, ati8514_accel_inl, ati8514_accel_outb, ati8514_accel_outw, ati8514_accel_outl, svga);
@@ -5430,7 +5492,6 @@ ati8514_io_set(svga_t *svga)
io_sethandler(0xf6ee, 0x0002, ati8514_accel_inb, ati8514_accel_inw, ati8514_accel_inl, ati8514_accel_outb, ati8514_accel_outw, ati8514_accel_outl, svga);
io_sethandler(0xfeee, 0x0002, ati8514_accel_inb, ati8514_accel_inw, ati8514_accel_inl, ati8514_accel_outb, ati8514_accel_outw, ati8514_accel_outl, svga);
}
#endif
static void
mach_io_remove(mach_t *mach)
@@ -5447,7 +5508,6 @@ mach_io_remove(mach_t *mach)
io_removehandler(0x26e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0x2ee8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0x42e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0x46e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0x4ae8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0x52e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0x56e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
@@ -5564,7 +5624,6 @@ mach_io_set(mach_t *mach)
io_sethandler(0x26e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_sethandler(0x2ee8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_sethandler(0x42e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_sethandler(0x46e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_sethandler(0x4ae8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_sethandler(0x52e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_sethandler(0x56e8, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
@@ -5715,7 +5774,6 @@ mach_mca_reset(void *priv)
timer_set_callback(&svga->timer, svga_poll);
}
#ifdef ATI_8514_ULTRA
uint8_t
ati8514_mca_read(int port, void *priv)
{
@@ -5747,7 +5805,6 @@ ati8514_pos_write(uint16_t port, uint8_t val, void *priv)
{
ati8514_mca_write(port, val, priv);
}
#endif
static uint8_t
mach32_pci_read(UNUSED(int func), int addr, void *priv)
@@ -6031,10 +6088,10 @@ mach8_init(const device_t *info)
io_sethandler(0x03c0, 32, mach_in, NULL, NULL, mach_out, NULL, NULL, mach);
io_sethandler(0x02ea, 4, mach_in, NULL, NULL, mach_out, NULL, NULL, mach);
mach_io_set(mach);
mach->accel.cmd_type = -2;
if ((dev->local & 0xff) >= 0x02) {
svga->decode_mask = (4 << 20) - 1;
mach->accel.cmd_type = -1;
mach->cursor_col_1 = 0xff;
mach->ext_cur_col_1_r = 0xff;
mach->ext_cur_col_1_g = 0xff;
@@ -6055,19 +6112,18 @@ mach8_init(const device_t *info)
} else
pci_add_card(PCI_ADD_VIDEO, mach32_pci_read, mach32_pci_write, mach, &mach->pci_slot);
mach->pci_regs[PCI_REG_COMMAND] = 0x83;
mach->pci_regs[PCI_REG_COMMAND] = 0x87;
mach->pci_regs[0x30] = 0x00;
mach->pci_regs[0x32] = 0x0c;
mach->pci_regs[0x33] = 0x00;
} else
ati_eeprom_load(&mach->eeprom, "mach32.nvr", 1);
} else
ati_eeprom_load_mach8(&mach->eeprom, "mach8.nvr");
ati_eeprom_load_mach8_vga(&mach->eeprom, "mach8.nvr");
return mach;
}
#ifdef ATI_8514_ULTRA
void
ati8514_init(svga_t *svga, void *ext8514, void *dev8514)
{
@@ -6086,7 +6142,7 @@ ati8514_init(svga_t *svga, void *ext8514, void *dev8514)
ati8514_io_set(svga);
mach->mca_bus = !!(dev->type & DEVICE_MCA);
mach->config1 = 0x01 | 0x02 | 0x08 | 0x80;
mach->config1 = 0x02 | 0x08 | 0x80;
if (mach->mca_bus)
mach->config1 |= 0x04;
@@ -6096,7 +6152,6 @@ ati8514_init(svga_t *svga, void *ext8514, void *dev8514)
mach->config2 = 0x02;
}
#endif
static int
mach8_vga_available(void)

View File

@@ -458,11 +458,16 @@ svga_in(uint16_t addr, void *priv)
ret = 0x10;
break;
case 0x3c3:
ret = 0x00;
if (xga_active && xga)
ret |= !xga->on;
if (ibm8514_active && dev)
ret |= !dev->on;
ret = 0x01;
if (xga_active && xga) {
if (xga->on)
ret = 0x00;
}
if (ibm8514_active && dev) {
if (dev->on)
ret = 0x00;
}
svga_log("VGA read: (0x%04x) ret=%02x.\n", addr, ret);
break;
case 0x3c4:
ret = svga->seqaddr;
@@ -560,6 +565,8 @@ svga_in(uint16_t addr, void *priv)
if ((addr >= 0x3c6) && (addr <= 0x3c9))
svga_log("VGA IN addr=%03x, temp=%02x.\n", addr, ret);
else if ((addr >= 0x2ea) && (addr <= 0x2ed))
svga_log("8514/A IN addr=%03x, temp=%02x.\n", addr, ret);
return ret;
}