Merge branch 'master' into pc98x1

This commit is contained in:
TC1995
2024-12-21 23:14:40 +01:00
52 changed files with 1287 additions and 545 deletions

View File

@@ -6,7 +6,15 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
## Thanks for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Checklist
options:
- label: I **have searched** the issue tracker and **was unable** to find an [open](../issues?q=is%3Aissue+is%3Aopen) or [closed](../issues?q=is%3Aissue+is%3Aclosed) issue matching what I'm seeing.
required: true
- label: I **have verified** that the issue is happening in the **[latest nightly build](https://ci.86box.net/job/86Box/lastSuccessfulBuild/artifact/)**, or the latest commit, if building from source.
required: true
- type: textarea
attributes:
label: What happened?
@@ -25,20 +33,13 @@ body:
attributes:
label: Operating system
description: What is your host operating system?
placeholder: e.g. Windows 10
validations:
required: true
- type: input
attributes:
label: CPU
description: What is your host CPU?
placeholder: e.g. AMD Ryzen 5 5600G
placeholder: e.g. Windows 11 24H2
validations:
required: true
- type: input
attributes:
label: 86Box version
description: What version of 86Box are you running? (Saying "Latest from Jenkins" is not helpful.)
description: What version of 86Box are you running? (Please ensure you have updated to the [latest build](https://ci.86box.net/job/86Box/lastSuccessfulBuild/artifact/) before reporting. Merely saying "Latest from Jenkins" is not helpful.)
placeholder: e.g. v4.0 build 5000
validations:
required: true
@@ -47,13 +48,13 @@ body:
label: Build architecture
description: 86Box for what architecture are you using?
options:
- Linux - ARM (32-bit)
- Linux - ARM (64-bit)
- Linux - x64 (64-bit)
- Linux - x86 (32-bit)
- macOS - Universal (Intel and Apple Silicon)
- Windows - x64 (64-bit)
- macOS - Universal (Intel and Apple Silicon)
- Linux - x64 (64-bit)
- Linux - ARM (64-bit)
- Windows - x86 (32-bit)
- Linux - ARM (32-bit)
- Linux - x86 (32-bit)
validations:
required: true
- type: checkboxes
@@ -63,18 +64,7 @@ body:
options:
- label: New recompiler
- label: Debug build
- type: dropdown
attributes:
label: Download source
description: Where did you download 86Box from?
options:
- Official website (Jenkins, GitHub)
- Manager auto-update
- I built 86Box myself (please tell us more about your build configuration)
- I got 86Box from a third party repository (please tell us where)
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Is there anything else you want to tell us?
description: Is there anything else you want to tell us? If you build 86Box from source, please post your build configuration here.

View File

@@ -1,8 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Machine Request
url: https://github.com/86Box/86Box/issues/3577#issue-comment-box
about: Please submit machine addition requests under this tracking issue.
url: https://github.com/86Box/86Box/discussions/4823#issue-comment-box
about: Please submit machine addition requests in this discussion thread.
- name: Feature Request or Question
url: https://github.com/86Box/86Box/discussions
about: Please submit feature requests and ask questions here.

View File

@@ -76,6 +76,7 @@ enum {
CPUID_MCA = (1 << 14), /* Machine Check Architecture */
CPUID_CMOV = (1 << 15), /* Conditional move instructions */
CPUID_PAT = (1 << 16), /* Page Attribute Table */
CPUID_PSE36 = (1 << 17), /* 36-bit Page Size Extension */
CPUID_MMX = (1 << 23), /* MMX technology */
CPUID_FXSR = (1 << 24) /* FXSAVE and FXRSTOR instructions */
};
@@ -1744,8 +1745,10 @@ cpu_set(void)
if (cpu_s->cpu_type >= CPU_PENTIUM2)
cpu_features |= CPU_FEATURE_MMX;
cpu_CR4_mask = CR4_VME | CR4_PVI | CR4_TSD | CR4_DE | CR4_PSE | CR4_MCE | CR4_PAE | CR4_PCE | CR4_PGE;
if (cpu_s->cpu_type == CPU_PENTIUM2D)
if (cpu_s->cpu_type == CPU_PENTIUM2D) {
cpu_CR4_mask |= CR4_OSFXSR;
cpu_features |= CPU_FEATURE_PSE36;
}
#ifdef USE_DYNAREC
codegen_timing_set(&codegen_timing_p6);
@@ -2490,7 +2493,7 @@ cpu_CPUID(void)
} else if (EAX == 1) {
EAX = CPUID;
EBX = ECX = 0;
EDX = CPUID_FPU | CPUID_VME | CPUID_DE | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_SEP | CPUID_FXSR | CPUID_CMOV;
EDX = CPUID_FPU | CPUID_VME | CPUID_DE | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_SEP | CPUID_FXSR | CPUID_CMOV | CPUID_PSE36;
} else if (EAX == 2) {
EAX = 0x03020101; /* Instruction TLB: 4 KB pages, 4-way set associative, 32 entries
Instruction TLB: 4 MB pages, fully associative, 2 entries

View File

@@ -531,6 +531,7 @@ extern int hasfpu;
#define CPU_FEATURE_3DNOW (1 << 6)
#define CPU_FEATURE_SYSCALL (1 << 7)
#define CPU_FEATURE_3DNOWE (1 << 8)
#define CPU_FEATURE_PSE36 (1 << 9)
extern uint32_t cpu_features;

View File

@@ -4,7 +4,6 @@
static int
opESCAPE_d8_a16(uint32_t fetchdat)
{
//pclog("D8 A16: fetchdat=%02x.\n", (fetchdat >> 3) & 0x1f);
return x86_opcodes_d8_a16[(fetchdat >> 3) & 0x1f](fetchdat);
}
static int
@@ -16,7 +15,6 @@ opESCAPE_d8_a32(uint32_t fetchdat)
static int
opESCAPE_d9_a16(uint32_t fetchdat)
{
//pclog("D9 A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_d9_a16[fetchdat & 0xff](fetchdat);
}
static int
@@ -28,7 +26,6 @@ opESCAPE_d9_a32(uint32_t fetchdat)
static int
opESCAPE_da_a16(uint32_t fetchdat)
{
//pclog("DA A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_da_a16[fetchdat & 0xff](fetchdat);
}
static int
@@ -40,7 +37,6 @@ opESCAPE_da_a32(uint32_t fetchdat)
static int
opESCAPE_db_a16(uint32_t fetchdat)
{
//pclog("DB A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_db_a16[fetchdat & 0xff](fetchdat);
}
static int
@@ -52,7 +48,6 @@ opESCAPE_db_a32(uint32_t fetchdat)
static int
opESCAPE_dc_a16(uint32_t fetchdat)
{
//pclog("DC A16: fetchdat=%02x.\n", (fetchdat >> 3) & 0x1f);
return x86_opcodes_dc_a16[(fetchdat >> 3) & 0x1f](fetchdat);
}
static int
@@ -64,7 +59,6 @@ opESCAPE_dc_a32(uint32_t fetchdat)
static int
opESCAPE_dd_a16(uint32_t fetchdat)
{
//pclog("DD A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_dd_a16[fetchdat & 0xff](fetchdat);
}
static int
@@ -76,7 +70,6 @@ opESCAPE_dd_a32(uint32_t fetchdat)
static int
opESCAPE_de_a16(uint32_t fetchdat)
{
//pclog("DE A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_de_a16[fetchdat & 0xff](fetchdat);
}
static int
@@ -88,7 +81,6 @@ opESCAPE_de_a32(uint32_t fetchdat)
static int
opESCAPE_df_a16(uint32_t fetchdat)
{
//pclog("DF A16: fetchdat=%02x.\n", fetchdat & 0xff);
return x86_opcodes_df_a16[fetchdat & 0xff](fetchdat);
}
static int
@@ -105,15 +97,13 @@ opWAIT(uint32_t fetchdat)
return 1;
}
#if 0
if (!cpu_use_dynarec && fpu_softfloat) {
#endif
if (fpu_softfloat) {
if (fpu_state.swd & FPU_SW_Summary) {
if (cr0 & 0x20) {
if (is486 && (cr0 & 0x20))
x86_int(16);
return 1;
}
else
picint(1 << 13);
return 1;
}
}
CLOCK_CYCLES(4);

View File

@@ -97,15 +97,10 @@ opWAIT(uint32_t fetchdat)
return 1;
}
#if 0
if (!cpu_use_dynarec && fpu_softfloat) {
#endif
if (fpu_softfloat) {
if (fpu_state.swd & FPU_SW_Summary) {
if (cr0 & 0x20) {
x86_int(16);
return 1;
}
picint(1 << 13);
return 1;
}
}
CLOCK_CYCLES(4);

View File

@@ -355,7 +355,10 @@ FPU_exception(uint32_t fetchdat, uint16_t exceptions, int store)
nmi = 1;
}
#else
picint(1 << 13);
if (is486 && (cr0 & 0x20))
x86_int(16);
else
picint(1 << 13);
#endif // FPU_8087
}
return unmasked;

View File

@@ -228,12 +228,10 @@ FPU_save_regi_tag(extFloat80_t reg, int tag, int stnr)
#define FPU_check_pending_exceptions() \
do { \
if (fpu_state.swd & FPU_SW_Summary) { \
if (cr0 & 0x20) { \
if (is486 && (cr0 & 0x20)) \
x86_int(16); \
return 1; \
} else { \
else \
picint(1 << 13); \
return 1; \
} \
return 1; \
} \
} while (0)

View File

@@ -99,7 +99,10 @@ typedef union {
dst = src1 / (double) src2; \
else { \
fpu_log("FPU : divide by zero\n"); \
picint(1 << 13); \
if (is486 && (cr0 & 0x20)) \
x86_int(16); \
else \
picint(1 << 13); \
return 1; \
} \
} else \

View File

@@ -732,7 +732,7 @@ extern int machine_at_pb680_init(const machine_t *);
extern int machine_at_pb810_init(const machine_t *);
extern int machine_at_mb520n_init(const machine_t *);
extern int machine_at_i430vx_init(const machine_t *);
extern int machine_at_hitman_init(const machine_t *);
extern int machine_at_gw2kte_init(const machine_t *);
extern int machine_at_ma23c_init(const machine_t *);
extern int machine_at_nupro592_init(const machine_t *);

View File

@@ -179,6 +179,7 @@ typedef struct _mem_mapping_ {
uint32_t base;
uint32_t size;
uint32_t base_ignore;
uint32_t mask;
uint8_t (*read_b)(uint32_t addr, void *priv);
@@ -400,6 +401,7 @@ extern void mem_mapping_set_p(mem_mapping_t *, void *priv);
extern void mem_mapping_set_addr(mem_mapping_t *,
uint32_t base, uint32_t size);
extern void mem_mapping_set_base_ignore(mem_mapping_t *, uint32_t base_ignore);
extern void mem_mapping_set_exec(mem_mapping_t *, uint8_t *exec);
extern void mem_mapping_set_mask(mem_mapping_t *, uint32_t mask);
extern void mem_mapping_disable(mem_mapping_t *);

View File

@@ -18,13 +18,35 @@
#define SOUND_OPL_H
enum fm_type {
FM_YM3812 = 0, /* OPL2 */
FM_YMF262 = 1, /* OPL3 */
FM_YMF289B = 2, /* OPL3-L */
FM_YMF278B = 3, /* OPL 4 */
FM_ESFM = 4, /* ESFM */
FM_OPL2BOARD = 5, /* OPL2BOARD (External Device)*/
FM_MAX = 6
FM_YM2149 = 0, /* SSG */
FM_YM3526 = 1, /* OPL */
FM_Y8950 = 2, /* MSX-Audio (OPL with ADPCM) */
FM_YM3812 = 3, /* OPL2 */
FM_YMF262 = 4, /* OPL3 */
FM_YMF289B = 5, /* OPL3-L */
FM_YMF278B = 6, /* OPL4 */
FM_YM2413 = 7, /* OPLL */
FM_YM2423 = 8, /* OPLL-X */
FM_YMF281 = 9, /* OPLLP */
FM_DS1001 = 10, /* Konami VRC7 MMC */
FM_YM2151 = 11, /* OPM */
FM_YM2203 = 12, /* OPN */
FM_YM2608 = 13, /* OPNA */
FM_YMF288 = 14, /* OPN3L */
FM_YM2610 = 15, /* OPNB */
FM_YM2610B = 16, /* OPNB2 */
FM_YM2612 = 17, /* OPN2 */
FM_YM3438 = 18, /* OPN2C */
FM_YMF276 = 19, /* OPN2L */
FM_YM2164 = 20, /* OPP */
FM_YM3806 = 21, /* OPQ */
#if 0
FM_YMF271 = 22, /* OPX */
#endif
FM_YM2414 = 23, /* OPZ */
FM_ESFM = 24, /* ESFM */
FM_OPL2BOARD = 25, /* OPL2Board (External Device) */
FM_MAX = 26
};
enum fm_driver {
@@ -48,18 +70,55 @@ extern uint8_t fm_driver_get(int chip_id, fm_drv_t *drv);
extern const fm_drv_t nuked_opl_drv;
extern const fm_drv_t ymfm_drv;
extern const fm_drv_t esfmu_opl_drv;
extern const fm_drv_t ymfm_opl2board_drv;
extern const fm_drv_t ymfm_opl2board_drv;
#ifdef EMU_DEVICE_H
extern const device_t ym3812_nuked_device;
extern const device_t ymf262_nuked_device;
extern const device_t ym2149_ymfm_device;
/* OPL Series */
extern const device_t ym3526_ymfm_device;
extern const device_t y8950_ymfm_device;
extern const device_t ym3812_ymfm_device;
extern const device_t ymf262_ymfm_device;
extern const device_t ymf289b_ymfm_device;
extern const device_t ymf278b_ymfm_device;
extern const device_t ym2413_ymfm_device;
extern const device_t ym2423_ymfm_device;
extern const device_t ymf281_ymfm_device;
extern const device_t ds1001_ymfm_device;
/* OPM Series */
extern const device_t ym2151_ymfm_device;
/* OPN Series */
extern const device_t ym2203_ymfm_device;
extern const device_t ym2608_ymfm_device;
extern const device_t ymf288_ymfm_device;
extern const device_t ym2610_ymfm_device;
extern const device_t ym2610b_ymfm_device;
extern const device_t ym2612_ymfm_device;
extern const device_t ym3438_ymfm_device;
extern const device_t ymf276_ymfm_device;
/* OPP Series */
extern const device_t ym2164_ymfm_device;
/* OPQ Series */
extern const device_t ym3806_ymfm_device;
/* OPX Series */
#if 0
extern const device_t ymf271_ymfm_device;
#endif
/* OPZ Series */
extern const device_t ym2414_ymfm_device;
extern const device_t esfm_esfmu_device;
#ifdef USE_LIBSERIALPORT
extern const device_t ym_opl2board_device;
#endif

View File

@@ -825,15 +825,15 @@ machine_at_i430vx_init(const machine_t *model)
}
int
machine_at_hitman_init(const machine_t *model)
machine_at_gw2kte_init(const machine_t *model)
{
int ret;
ret = bios_load_linear_combined2("roms/machines/hitman/1008CY1T.BIO",
"roms/machines/hitman/1008CY1T.BI1",
"roms/machines/hitman/1008CY1T.BI2",
"roms/machines/hitman/1008CY1T.BI3",
"roms/machines/hitman/1008CY1T.RCV",
ret = bios_load_linear_combined2("roms/machines/gw2kte/1008CY1T.BIO",
"roms/machines/gw2kte/1008CY1T.BI1",
"roms/machines/gw2kte/1008CY1T.BI2",
"roms/machines/gw2kte/1008CY1T.BI3",
"roms/machines/gw2kte/1008CY1T.RCV",
0x3a000, 128);
if (bios_only || !ret)

View File

@@ -11953,16 +11953,14 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* 430VX */
/* Has a SM(S)C FDC37C932FR Super I/O chip with on-chip KBC with AMI
MegaKey (revision '5') KBC firmware. */
{
.name = "[i430VX] Gateway 2000 Hitman",
.internal_name = "hitman",
.internal_name = "gw2kte",
.type = MACHINE_TYPE_SOCKET7,
.chipset = MACHINE_CHIPSET_INTEL_430VX,
.init = machine_at_hitman_init,
.init = machine_at_gw2kte_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
@@ -11996,8 +11994,6 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* Has a SM(S)C FDC37C935 Super I/O chip with on-chip KBC with Phoenix
MultiKey/42 (version 1.38) KBC firmware. */
{

View File

@@ -320,6 +320,7 @@ mmutranslatereal_normal(uint32_t addr, int rw)
if ((temp & 0x80) && (cr4 & CR4_PSE)) {
/*4MB page*/
uint64_t ret = temp & ~0x3fffff;
if (((CPL == 3) && !(temp & 4) && !cpl_override) || (rw && !cpl_override && !(temp & 2) && (((CPL == 3) && !cpl_override) || ((is486 || isibm486) && (cr0 & WP_FLAG))))) {
cr2 = addr;
temp &= 1;
@@ -336,7 +337,10 @@ mmutranslatereal_normal(uint32_t addr, int rw)
mmu_perm = temp & 4;
rammap(addr2) |= (rw ? 0x60 : 0x20);
return (temp & ~0x3fffff) + (addr & 0x3fffff);
if (cpu_features & CPU_FEATURE_PSE36)
ret |= (uint64_t) (temp & 0x1e000) << 32;
return ret + (addr & 0x3fffff);
}
temp = rammap((temp & ~0xfff) + ((addr >> 10) & 0xffc));
@@ -488,10 +492,14 @@ mmutranslate_noabrt_normal(uint32_t addr, int rw)
if ((temp & 0x80) && (cr4 & CR4_PSE)) {
/*4MB page*/
uint64_t ret = temp & ~0x3fffff;
if (((CPL == 3) && !(temp & 4) && !cpl_override) || (rw && !cpl_override && !(temp & 2) && ((CPL == 3) || (cr0 & WP_FLAG))))
return 0xffffffffffffffffULL;
return (temp & ~0x3fffff) + (addr & 0x3fffff);
if (cpu_features & CPU_FEATURE_PSE36)
ret |= (uint64_t) (temp & 0x1e000) << 32;
return ret + (addr & 0x3fffff);
}
temp = rammap((temp & ~0xfff) + ((addr >> 10) & 0xffc));
@@ -2351,41 +2359,47 @@ mem_mapping_recalc(uint64_t base, uint64_t size)
/* In range? */
if (map->enable && (uint64_t) map->base < ((uint64_t) base + (uint64_t) size) &&
((uint64_t) map->base + (uint64_t) map->size) > (uint64_t) base) {
uint64_t i_a = ((~map->base_ignore) & 0xffffffffULL) + 0x00000001ULL;
uint64_t i_s = 0x00000000ULL;
uint64_t i_e = map->base_ignore;
uint64_t i_c = 0x00000000ULL;
uint64_t start = (map->base < base) ? map->base : base;
uint64_t end = (((uint64_t) map->base + (uint64_t) map->size) < (base + size)) ?
((uint64_t) map->base + (uint64_t) map->size) : (base + size);
if (start < map->base)
start = map->base;
for (c = start; c < end; c += MEM_GRANULARITY_SIZE) {
/* CPU */
n = !!in_smm;
wp = _mem_wp[c >> MEM_GRANULARITY_BITS];
for (i_c = i_s; i_c <= i_e; i_c += i_a) {
for (c = (start + i_c); c < (end + i_c); c += MEM_GRANULARITY_SIZE) {
/* CPU */
n = !!in_smm;
wp = _mem_wp[c >> MEM_GRANULARITY_BITS];
if (map->exec && mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].x))
_mem_exec[c >> MEM_GRANULARITY_BITS] = map->exec + (c - map->base);
if (!wp && (map->write_b || map->write_w || map->write_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].w))
write_mapping[c >> MEM_GRANULARITY_BITS] = map;
if ((map->read_b || map->read_w || map->read_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].r))
read_mapping[c >> MEM_GRANULARITY_BITS] = map;
if (map->exec && mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].x))
_mem_exec[c >> MEM_GRANULARITY_BITS] = map->exec + (c - map->base);
if (!wp && (map->write_b || map->write_w || map->write_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].w))
write_mapping[c >> MEM_GRANULARITY_BITS] = map;
if ((map->read_b || map->read_w || map->read_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].r))
read_mapping[c >> MEM_GRANULARITY_BITS] = map;
/* Bus */
n |= STATE_BUS;
wp = _mem_wp_bus[c >> MEM_GRANULARITY_BITS];
/* Bus */
n |= STATE_BUS;
wp = _mem_wp_bus[c >> MEM_GRANULARITY_BITS];
if (!wp && (map->write_b || map->write_w || map->write_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].w))
write_mapping_bus[c >> MEM_GRANULARITY_BITS] = map;
if ((map->read_b || map->read_w || map->read_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].r))
read_mapping_bus[c >> MEM_GRANULARITY_BITS] = map;
if (!wp && (map->write_b || map->write_w || map->write_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].w))
write_mapping_bus[c >> MEM_GRANULARITY_BITS] = map;
if ((map->read_b || map->read_w || map->read_l) &&
mem_mapping_access_allowed(map->flags,
_mem_state[c >> MEM_GRANULARITY_BITS].states[n].r))
read_mapping_bus[c >> MEM_GRANULARITY_BITS] = map;
}
}
}
map = map->next;
@@ -2597,6 +2611,20 @@ mem_mapping_set_addr(mem_mapping_t *map, uint32_t base, uint32_t size)
mem_mapping_recalc(map->base, map->size);
}
void
mem_mapping_set_base_ignore(mem_mapping_t *map, uint32_t base_ignore)
{
/* Remove old mapping. */
map->enable = 0;
mem_mapping_recalc(map->base, map->size);
/* Set new mapping. */
map->enable = 1;
map->base_ignore = base_ignore;
mem_mapping_recalc(map->base, map->size);
}
void
mem_mapping_set_exec(mem_mapping_t *map, uint8_t *exec)
{

View File

@@ -2481,36 +2481,58 @@ pcnet_readl(uint16_t addr, void *priv)
static void
pcnet_mmio_writeb(uint32_t addr, uint8_t val, void *priv)
{
if (!(addr & 0x10)) {
pcnet_aprom_writeb((nic_t *) priv, addr, val);
return;
}
pcnet_write((nic_t *) priv, addr, val, 1);
}
static void
pcnet_mmio_writew(uint32_t addr, uint16_t val, void *priv)
{
if (!(addr & 0x10)) {
pcnet_aprom_writeb((nic_t *) priv, addr, val);
pcnet_aprom_writeb((nic_t *) priv, addr + 1, val >> 8);
return;
}
pcnet_write((nic_t *) priv, addr, val, 2);
}
static void
pcnet_mmio_writel(uint32_t addr, uint32_t val, void *priv)
{
if (!(addr & 0x10)) {
pcnet_aprom_writeb((nic_t *) priv, addr, val);
pcnet_aprom_writeb((nic_t *) priv, addr + 1, val >> 8);
pcnet_aprom_writeb((nic_t *) priv, addr + 2, val >> 16);
pcnet_aprom_writeb((nic_t *) priv, addr + 3, val >> 24);
return;
}
pcnet_write((nic_t *) priv, addr, val, 4);
}
static uint8_t
pcnet_mmio_readb(uint32_t addr, void *priv)
{
if (!(addr & 0x10))
return pcnet_aprom_readb((nic_t *) priv, addr);
return (pcnet_read((nic_t *) priv, addr, 1));
}
static uint16_t
pcnet_mmio_readw(uint32_t addr, void *priv)
{
if (!(addr & 0x10))
return pcnet_aprom_readb((nic_t *) priv, addr) | (pcnet_aprom_readb((nic_t *) priv, addr + 1) << 8);
return (pcnet_read((nic_t *) priv, addr, 2));
}
static uint32_t
pcnet_mmio_readl(uint32_t addr, void *priv)
{
if (!(addr & 0x10))
return pcnet_aprom_readb((nic_t *) priv, addr) | (pcnet_aprom_readb((nic_t *) priv, addr + 1) << 8) | (pcnet_aprom_readb((nic_t *) priv, addr + 2) << 16) | (pcnet_aprom_readb((nic_t *) priv, addr + 3) << 24);
return (pcnet_read((nic_t *) priv, addr, 4));
}
@@ -2607,7 +2629,7 @@ pcnet_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
/* Then let's set the PCI regs. */
pcnet_pci_bar[0].addr_regs[addr & 3] = val;
/* Then let's calculate the new I/O base. */
pcnet_pci_bar[0].addr &= 0xff00;
pcnet_pci_bar[0].addr &= 0xffe0;
dev->PCIBase = pcnet_pci_bar[0].addr;
/* Log the new base. */
pcnet_log(4, "%s: New I/O base is %04X\n", dev->name, dev->PCIBase);
@@ -2685,7 +2707,7 @@ pcnet_pci_read(UNUSED(int func), int addr, void *priv)
case 0x0E:
return 0; /*Header type */
case 0x10:
return 1; /*I/O space*/
return pcnet_pci_bar[0].addr_regs[0] | 1; /*I/O space*/
case 0x11:
return pcnet_pci_bar[0].addr_regs[1];
case 0x12:

View File

@@ -1240,7 +1240,7 @@ msgid "Tablet tool"
msgstr "Ferramenta para tablet"
msgid "Qt (OpenGL &ES)"
msgstr "Qt (OpenGL e ES)"
msgstr "Qt (OpenGL &ES)"
msgid "About Qt"
msgstr "Sobre o Qt"
@@ -1303,7 +1303,7 @@ msgid "Error linking shader program in file \"%1\""
msgstr "Erro ao vincular o programa de shader no arquivo \"%1\""
msgid "OpenGL 3.0 renderer options"
msgstr "Opções de renderização OpenGL 3.0"
msgstr "Opções do renderizador OpenGL 3.0"
msgid "Render behavior"
msgstr "Comportamento de renderização"
@@ -1321,7 +1321,7 @@ msgid "&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Render each frame immediate
msgstr "&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Renderize cada quadro imediatamente, em sincronia com a tela emulada.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Essa é a opção recomendada se os shaders em uso não utilizarem o frametime para efeitos animados.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"
msgid "Synchronize with video"
msgstr "Sincronizar com vídeo"
msgstr "Sincronizar com o vídeo"
msgid "Shaders"
msgstr "Shaders"
@@ -1411,7 +1411,7 @@ msgid "Adapter"
msgstr "Adaptador"
msgid "VDE Socket"
msgstr "Socket VDE"
msgstr "Soquete VDE"
msgid "86Box Unit Tester"
msgstr "Testador de unidade 86Box"
@@ -1474,7 +1474,7 @@ msgid "Roland CM-32LN Emulation"
msgstr "Emulação do Roland CM-32LN"
msgid "OPL4-ML Daughterboard"
msgstr "Placa-mãe OPL4-ML"
msgstr "Placa Filha OPL4-ML"
msgid "System MIDI"
msgstr "Sistema MIDI"
@@ -1558,16 +1558,16 @@ msgid "Chorus Voices"
msgstr "Vozes do coro"
msgid "Chorus Level"
msgstr "Nível de coro"
msgstr "Nível do coro"
msgid "Chorus Speed"
msgstr "Velocidade do chorus"
msgstr "Velocidade do coro"
msgid "Chorus Depth"
msgstr "Profundidade do chorus"
msgstr "Profundidade do coro"
msgid "Chorus Waveform"
msgstr "Forma de onda do chorus"
msgstr "Forma de onda do coro"
msgid "Reverb"
msgstr "Reverberação"
@@ -1588,7 +1588,7 @@ msgid "Interpolation Method"
msgstr "Método de interpolação"
msgid "Reverb Output Gain"
msgstr "Ganho da saída do reverb"
msgstr "Ganho da saída da reverberação"
msgid "Reversed stereo"
msgstr "Estéreo invertido"
@@ -1624,7 +1624,7 @@ msgid "MAC Address"
msgstr "Endereço MAC"
msgid "MAC Address OUI"
msgstr "Endereço MAC OUI"
msgstr "OUI do Endereço MAC"
msgid "Enable BIOS"
msgstr "Habilitar BIOS"
@@ -1663,7 +1663,7 @@ msgid "MPU-401 Address"
msgstr "Endereço da MPU-401"
msgid "MPU-401 IRQ"
msgstr "MPU-401 IRQ"
msgstr "IRQ MPU-401"
msgid "Receive MIDI input"
msgstr "Receber entrada MIDI"
@@ -1699,7 +1699,7 @@ msgid "Receive MIDI input (MPU-401)"
msgstr "Receber entrada MIDI (MPU-401)"
msgid "SB low DMA"
msgstr "SB low DMA"
msgstr "DMA baixo SB"
msgid "6CH variant (6-channel)"
msgstr "Variante 6CH (6 canais)"
@@ -1714,7 +1714,7 @@ msgid "High DMA"
msgstr "DMA alto"
msgid "Control PC speaker"
msgstr "Controle do alto-falante do PC"
msgstr "Controlar alto-falante do PC"
msgid "Memory size"
msgstr "Tamanho da memória"
@@ -1729,7 +1729,7 @@ msgid "Codec"
msgstr "Codec"
msgid "GUS type"
msgstr "Tipo GUS"
msgstr "Tipo de GUS"
msgid "Enable 0x04 \"Exit 86Box\" command"
msgstr "Ativar o comando 0x04 \"Sair do 86Box\""
@@ -1738,10 +1738,10 @@ msgid "Display type"
msgstr "Tipo de tela"
msgid "Composite type"
msgstr "Tipo composto"
msgstr "Tipo de composto"
msgid "RGB type"
msgstr "Tipo RGB"
msgstr "Tipo de RGB"
msgid "Line doubling type"
msgstr "Tipo de duplicação de linha"
@@ -1756,7 +1756,7 @@ msgid "Character set"
msgstr "Conjunto de caracteres"
msgid "XGA type"
msgstr "Tipo XGA"
msgstr "Tipo de XGA"
msgid "Instance"
msgstr "Instância"
@@ -1774,13 +1774,13 @@ msgid "Bilinear filtering"
msgstr "Filtragem bilinear"
msgid "Dithering"
msgstr "Dithering"
msgstr "Pontilhamento"
msgid "Enable NMI for CGA emulation"
msgstr "Ativar NMI para emulação CGA"
msgid "Voodoo type"
msgstr "Tipo vodu"
msgstr "Tipo de Voodoo"
msgid "Framebuffer memory size"
msgstr "Tamanho da memória do framebuffer"
@@ -1789,13 +1789,13 @@ msgid "Texture memory size"
msgstr "Tamanho da memória da textura"
msgid "Dither subtraction"
msgstr "Subtração de dither"
msgstr "Subtração de pontilhado"
msgid "Screen Filter"
msgstr "Filtro de tela"
msgid "Render threads"
msgstr "Renderizar threads"
msgstr "Threads de renderização"
msgid "SLI"
msgstr "SLI"
@@ -1942,7 +1942,7 @@ msgid "New"
msgstr "Novo"
msgid "Color (generic)"
msgstr "Cor (genérico)"
msgstr "Colorido (genérico)"
msgid "Green Monochrome"
msgstr "Monocromático verde"
@@ -1954,10 +1954,10 @@ msgid "Gray Monochrome"
msgstr "Monocromático cinza"
msgid "Color (no brown)"
msgstr "Cor (sem marrom)"
msgstr "Colorido (sem marrom)"
msgid "Color (IBM 5153)"
msgstr "Cor (IBM 5153)"
msgstr "Colorido (IBM 5153)"
msgid "Simple doubling"
msgstr "Duplicação simples"
@@ -1984,13 +1984,13 @@ msgid "Color 40x25 (5153/CGA)"
msgstr "Colorido 40x25 (5153/CGA)"
msgid "Color 80x25 (5153/CGA)"
msgstr "Cor 80x25 (5153/CGA)"
msgstr "Colorido 80x25 (5153/CGA)"
msgid "Enhanced Color - Normal Mode (5154/ECD)"
msgstr "Cor aprimorada - Modo normal (5154/ECD)"
msgstr "Colorido aprimorado - Modo normal (5154/ECD)"
msgid "Enhanced Color - Enhanced Mode (5154/ECD)"
msgstr "Cor aprimorada - Modo aprimorado (5154/ECD)"
msgstr "Colorido aprimorado - Modo aprimorado (5154/ECD)"
msgid "Green"
msgstr "Verde"
@@ -2002,10 +2002,10 @@ msgid "Gray"
msgstr "Cinza"
msgid "Color"
msgstr "Cor"
msgstr "Colorido"
msgid "U.S. English"
msgstr "Inglês dos EUA"
msgstr "Inglês Americano"
msgid "Scandinavian"
msgstr "Escandinavo"
@@ -2020,10 +2020,10 @@ msgid "Mono Non-Interlaced"
msgstr "Monocromático não entrelaçado"
msgid "Color Interlaced"
msgstr "Cor entrelaçado"
msgstr "Colorido entrelaçado"
msgid "Color Non-Interlaced"
msgstr "Cor não entrelaçado"
msgstr "Colorido não entrelaçado"
msgid "3Dfx Voodoo Graphics"
msgstr "Gráficos 3Dfx Voodoo"
@@ -2053,7 +2053,7 @@ msgid "High-Speed"
msgstr "Alta velocidade"
msgid "Stereo LPT DAC"
msgstr "DAC estéreo LPT"
msgstr "DAC LPT estéreo"
msgid "Generic Text Printer"
msgstr "Impressora de texto genérica"
@@ -2065,7 +2065,7 @@ msgid "Generic PostScript Printer"
msgstr "Impressora PostScript genérica"
msgid "Generic PCL5e Printer"
msgstr "Impressora genérica PCL5e"
msgstr "Impressora PCL5e genérica"
msgid "Parallel Line Internet Protocol"
msgstr "Protocolo de Internet de linha paralela"
@@ -2120,3 +2120,15 @@ msgstr "Clone IBM 8514/A (ISA)"
msgid "Vendor"
msgstr "Fabricante"
msgid "30 Hz (JMP2 = 1)"
msgstr "30 Hz (JMP2 = 1)"
msgid "60 Hz (JMP2 = 2)"
msgstr "60 Hz (JMP2 = 2)"
msgid "Generic PC/XT Memory Expansion"
msgstr "Expansão de memória genérica PC/XT"
msgid "Generic PC/AT Memory Expansion"
msgstr "Expansão de memória genérica PC/AT"

View File

@@ -491,7 +491,7 @@ const device_t fluidsynth_device = {
.init = fluidsynth_init,
.close = fluidsynth_close,
.reset = NULL,
{ .available = fluidsynth_available },
.available = fluidsynth_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = fluidsynth_config

View File

@@ -427,7 +427,7 @@ const device_t mt32_old_device = {
.init = mt32_old_init,
.close = mt32_close,
.reset = NULL,
{ .available = mt32_old_available },
.available = mt32_old_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mt32_config
@@ -441,7 +441,7 @@ const device_t mt32_new_device = {
.init = mt32_new_init,
.close = mt32_close,
.reset = NULL,
{ .available = mt32_new_available },
.available = mt32_new_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mt32_config
@@ -455,7 +455,7 @@ const device_t cm32l_device = {
.init = cm32l_init,
.close = mt32_close,
.reset = NULL,
{ .available = cm32l_available },
.available = cm32l_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mt32_config
@@ -469,7 +469,7 @@ const device_t cm32ln_device = {
.init = cm32ln_init,
.close = mt32_close,
.reset = NULL,
{ .available = cm32ln_available },
.available = cm32ln_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mt32_config

View File

@@ -724,7 +724,7 @@ const device_t opl4_midi_device = {
.init = opl4_init,
.close = opl4_close,
.reset = NULL,
{ .available = opl4_midi_available },
.available = opl4_midi_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -285,7 +285,7 @@ const device_t rtmidi_output_device = {
.init = rtmidi_output_init,
.close = rtmidi_output_close,
.reset = NULL,
{ .available = rtmidi_out_get_num_devs },
.available = rtmidi_out_get_num_devs,
.speed_changed = NULL,
.force_redraw = NULL,
.config = system_midi_config
@@ -299,7 +299,7 @@ const device_t rtmidi_input_device = {
.init = rtmidi_input_init,
.close = rtmidi_input_close,
.reset = NULL,
{ .available = rtmidi_in_get_num_devs },
.available = rtmidi_in_get_num_devs,
.speed_changed = NULL,
.force_redraw = NULL,
.config = midi_input_config

View File

@@ -43,73 +43,73 @@ static const struct {
} ac97_codecs[] = {
// clang-format off
{
.device = &ad1881_device,
.min_rate = 7000,
.max_rate = 48000,
.misc_flags = AC97_MASTER_6B | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_POP | AC97_MS | AC97_LPBK,
.reset_flags = (1 << AC97_3D_SHIFT), /* datasheet contradicts itself on AC97_HPOUT */
.extid_flags = AC97_VRA,
.pcsr_mask = 0xbf,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x74, 0x0000, 0xff07}, {0, 0x76, 0x0404, 0xdde5}, {0, 0x78, 48000, 0x0000}, {0, 0x7a, 48000, 0x0000}, {0}}
.device = &ad1881_device,
.min_rate = 7000,
.max_rate = 48000,
.misc_flags = AC97_MASTER_6B | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_POP | AC97_MS | AC97_LPBK,
.reset_flags = (1 << AC97_3D_SHIFT), /* datasheet contradicts itself on AC97_HPOUT */
.extid_flags = AC97_VRA,
.pcsr_mask = 0xbf,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x74, 0x0000, 0xff07}, {0, 0x76, 0x0404, 0xdde5}, {0, 0x78, 48000, 0x0000}, {0, 0x7a, 48000, 0x0000}, {0}}
},
{
.device = &ak4540_device,
.misc_flags = AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.pcsr_mask = 0x1f
.device = &ak4540_device,
.misc_flags = AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.pcsr_mask = 0x1f
},
{
.device = &alc100_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_POP | AC97_MS | AC97_LPBK,
.reset_flags = (22 << AC97_3D_SHIFT),
.extid_flags = AC97_AMAP,
.pcsr_mask = 0xbf
.device = &alc100_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_POP | AC97_MS | AC97_LPBK,
.reset_flags = (22 << AC97_3D_SHIFT),
.extid_flags = AC97_AMAP,
.pcsr_mask = 0xbf
},
{
.device = &cs4297_device,
.misc_flags = AC97_MASTER_6B | AC97_AUXOUT | AC97_AUXOUT_6B | AC97_MONOOUT | AC97_MONOOUT_6B | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = AC97_HPOUT | AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = 0,
.pcsr_mask = 0x7f,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x5a, 0x0301, 0x0000}, {0}}
.device = &cs4297_device,
.misc_flags = AC97_MASTER_6B | AC97_AUXOUT | AC97_AUXOUT_6B | AC97_MONOOUT | AC97_MONOOUT_6B | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = AC97_HPOUT | AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = 0,
.pcsr_mask = 0x7f,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x5a, 0x0301, 0x0000}, {0}}
},
{
.device = &cs4297a_device,
.misc_flags = AC97_MASTER_6B | AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = AC97_HPOUT | AC97_DAC_20B | AC97_ADC_18B | (6 << AC97_3D_SHIFT),
.extid_flags = AC97_AMAP,
.pcsr_mask = 0xff,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x5e, 0x0000, 0x01b0}, {0, 0x60, 0x0023, 0x0001}, {0, 0x68, 0x0000, 0xdfff}, {0}}
.device = &cs4297a_device,
.misc_flags = AC97_MASTER_6B | AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = AC97_HPOUT | AC97_DAC_20B | AC97_ADC_18B | (6 << AC97_3D_SHIFT),
.extid_flags = AC97_AMAP,
.pcsr_mask = 0xff,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x5e, 0x0000, 0x01b0}, {0, 0x60, 0x0023, 0x0001}, {0, 0x68, 0x0000, 0xdfff}, {0}}
},
{
.device = &stac9708_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = (26 << AC97_3D_SHIFT) | AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = AC97_SDAC,
.pcsr_mask = 0xff,
.eascr_mask = 0x02,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x6c, 0x0000, 0x0003}, {0, 0x74, 0x0000, 0x0003}, {0}}
.device = &stac9708_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = (26 << AC97_3D_SHIFT) | AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = AC97_SDAC,
.pcsr_mask = 0xff,
.eascr_mask = 0x02,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x6c, 0x0000, 0x0003}, {0, 0x74, 0x0000, 0x0003}, {0}}
},
{
.device = &stac9721_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = (26 << AC97_3D_SHIFT) | AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = AC97_AMAP,
.pcsr_mask = 0xff,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x6c, 0x0000, 0x0000}, {0, 0x6e, 0x0000, 0x0003}, {0, 0x70, 0x0000, 0xffff}, {0, 0x72, 0x0000, 0x0006}, {0, 0x74, 0x0000, 0x0003}, {0, 0x76, 0x0000, 0xffff}, {0, 0x78, 0x0000, 0x3802}, {0}}
.device = &stac9721_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = (26 << AC97_3D_SHIFT) | AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = AC97_AMAP,
.pcsr_mask = 0xff,
.vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x6c, 0x0000, 0x0000}, {0, 0x6e, 0x0000, 0x0003}, {0, 0x70, 0x0000, 0xffff}, {0, 0x72, 0x0000, 0x0006}, {0, 0x74, 0x0000, 0x0003}, {0, 0x76, 0x0000, 0xffff}, {0, 0x78, 0x0000, 0x3802}, {0}}
},
{
.device = &tr28023_device,
.misc_flags = AC97_MASTER_6B | AC97_MONOOUT | AC97_MONOOUT_6B | AC97_PCBEEP | AC97_PHONE | AC97_POP | AC97_MS | AC97_LPBK,
.reset_flags = 0,
.extid_flags = 0,
.pcsr_mask = 0x3f
.device = &tr28023_device,
.misc_flags = AC97_MASTER_6B | AC97_MONOOUT | AC97_MONOOUT_6B | AC97_PCBEEP | AC97_PHONE | AC97_POP | AC97_MS | AC97_LPBK,
.reset_flags = 0,
.extid_flags = 0,
.pcsr_mask = 0x3f
},
{
.device = &wm9701a_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = 0,
.pcsr_mask = 0x3f
.device = &wm9701a_device,
.misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK,
.reset_flags = AC97_DAC_18B | AC97_ADC_18B,
.extid_flags = 0,
.pcsr_mask = 0x3f
}
// clang-format on
};
@@ -661,7 +661,7 @@ const device_t ad1881_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -675,7 +675,7 @@ const device_t ak4540_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -689,7 +689,7 @@ const device_t alc100_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -703,7 +703,7 @@ const device_t cs4297_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -717,7 +717,7 @@ const device_t cs4297a_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -731,7 +731,7 @@ const device_t stac9708_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -745,7 +745,7 @@ const device_t stac9721_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -759,7 +759,7 @@ const device_t tr28023_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -773,7 +773,7 @@ const device_t wm9701a_device = {
.init = ac97_codec_init,
.close = ac97_codec_close,
.reset = ac97_codec_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -839,7 +839,7 @@ const device_t ac97_via_device = {
.init = ac97_via_init,
.close = ac97_via_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = ac97_via_speed_changed,
.force_redraw = NULL,
.config = NULL

View File

@@ -151,7 +151,7 @@ const device_t adlib_device = {
.init = adlib_init,
.close = adlib_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -165,7 +165,7 @@ const device_t adlib_mca_device = {
.init = adlib_mca_init,
.close = adlib_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -1273,7 +1273,7 @@ const device_t adgold_device = {
.init = adgold_init,
.close = adgold_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = adgold_config

View File

@@ -2405,7 +2405,7 @@ const device_t es1371_device = {
.init = es1371_init,
.close = es1371_close,
.reset = es1371_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = es1371_speed_changed,
.force_redraw = NULL,
.config = es1371_config
@@ -2419,7 +2419,7 @@ const device_t es1371_onboard_device = {
.init = es1371_init,
.close = es1371_close,
.reset = es1371_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = es1371_speed_changed,
.force_redraw = NULL,
.config = es1371_onboard_config
@@ -2433,7 +2433,7 @@ const device_t es1373_device = {
.init = es1371_init,
.close = es1371_close,
.reset = es1371_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = es1371_speed_changed,
.force_redraw = NULL,
.config = es1373_config
@@ -2447,7 +2447,7 @@ const device_t es1373_onboard_device = {
.init = es1371_init,
.close = es1371_close,
.reset = es1371_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = es1371_speed_changed,
.force_redraw = NULL,
.config = es1371_onboard_config
@@ -2461,7 +2461,7 @@ const device_t ct5880_device = {
.init = es1371_init,
.close = es1371_close,
.reset = es1371_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = es1371_speed_changed,
.force_redraw = NULL,
.config = ct5880_config
@@ -2475,7 +2475,7 @@ const device_t ct5880_onboard_device = {
.init = es1371_init,
.close = es1371_close,
.reset = es1371_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = es1371_speed_changed,
.force_redraw = NULL,
.config = es1371_onboard_config

View File

@@ -1588,7 +1588,7 @@ const device_t azt2316a_device = {
.init = azt_init,
.close = azt_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = azt_speed_changed,
.force_redraw = NULL,
.config = azt2316a_config
@@ -1602,7 +1602,7 @@ const device_t azt1605_device = {
.init = azt_init,
.close = azt_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = azt_speed_changed,
.force_redraw = NULL,
.config = azt1605_config

View File

@@ -1547,7 +1547,7 @@ const device_t cmi8338_device = {
.init = cmi8x38_init,
.close = cmi8x38_close,
.reset = cmi8x38_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = cmi8x38_speed_changed,
.force_redraw = NULL,
.config = cmi8x38_config
@@ -1561,7 +1561,7 @@ const device_t cmi8338_onboard_device = {
.init = cmi8x38_init,
.close = cmi8x38_close,
.reset = cmi8x38_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = cmi8x38_speed_changed,
.force_redraw = NULL,
.config = cmi8x38_config
@@ -1575,7 +1575,7 @@ const device_t cmi8738_device = {
.init = cmi8x38_init,
.close = cmi8x38_close,
.reset = cmi8x38_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = cmi8x38_speed_changed,
.force_redraw = NULL,
.config = cmi8738_config
@@ -1589,7 +1589,7 @@ const device_t cmi8738_onboard_device = {
.init = cmi8x38_init,
.close = cmi8x38_close,
.reset = cmi8x38_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = cmi8x38_speed_changed,
.force_redraw = NULL,
.config = cmi8x38_config
@@ -1603,7 +1603,7 @@ const device_t cmi8738_6ch_onboard_device = {
.init = cmi8x38_init,
.close = cmi8x38_close,
.reset = cmi8x38_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = cmi8x38_speed_changed,
.force_redraw = NULL,
.config = cmi8x38_config

View File

@@ -249,7 +249,7 @@ const device_t cms_device = {
.init = cms_init,
.close = cms_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = cms_config

View File

@@ -869,7 +869,7 @@ const device_t cs4235_device = {
.init = cs423x_init,
.close = cs423x_close,
.reset = cs423x_reset,
{ .available = cs423x_available },
.available = cs423x_available,
.speed_changed = cs423x_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -883,7 +883,7 @@ const device_t cs4235_onboard_device = {
.init = cs423x_init,
.close = cs423x_close,
.reset = cs423x_reset,
{ .available = cs423x_available },
.available = cs423x_available,
.speed_changed = cs423x_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -897,7 +897,7 @@ const device_t cs4236b_device = {
.init = cs423x_init,
.close = cs423x_close,
.reset = cs423x_reset,
{ .available = cs423x_available },
.available = cs423x_available,
.speed_changed = cs423x_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -911,7 +911,7 @@ const device_t cs4237b_device = {
.init = cs423x_init,
.close = cs423x_close,
.reset = cs423x_reset,
{ .available = cs423x_available },
.available = cs423x_available,
.speed_changed = cs423x_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -925,7 +925,7 @@ const device_t cs4238b_device = {
.init = cs423x_init,
.close = cs423x_close,
.reset = cs423x_reset,
{ .available = cs423x_available },
.available = cs423x_available,
.speed_changed = cs423x_speed_changed,
.force_redraw = NULL,
.config = NULL

View File

@@ -1525,15 +1525,15 @@ static const device_config_t gus_config[] = {
};
const device_t gus_device = {
.name = "Gravis UltraSound",
.name = "Gravis UltraSound",
.internal_name = "gus",
.flags = DEVICE_ISA | DEVICE_AT,
.local = 0,
.init = gus_init,
.close = gus_close,
.reset = gus_reset,
{ .available = NULL },
.flags = DEVICE_ISA | DEVICE_AT,
.local = 0,
.init = gus_init,
.close = gus_close,
.reset = gus_reset,
.available = NULL,
.speed_changed = gus_speed_changed,
.force_redraw = NULL,
.config = gus_config
.force_redraw = NULL,
.config = gus_config
};

View File

@@ -1965,7 +1965,7 @@ const device_t mpu401_device = {
.init = mpu401_standalone_init,
.close = mpu401_standalone_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mpu401_standalone_config
@@ -1979,7 +1979,7 @@ const device_t mpu401_mca_device = {
.init = mpu401_standalone_init,
.close = mpu401_standalone_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mpu401_standalone_mca_config

View File

@@ -39,7 +39,22 @@ uint8_t
fm_driver_get(int chip_id, fm_drv_t *drv)
{
switch (chip_id) {
case FM_YM3812:
case FM_YM2149: /* SSG */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2149_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM3526: /* OPL */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym3526_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_Y8950: /* MSX-Audio (OPL with ADPCM) */
*drv = ymfm_drv;
drv->priv = device_add_inst(&y8950_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM3812: /* OPL2 */
if (fm_driver == FM_DRV_NUKED) {
*drv = nuked_opl_drv;
drv->priv = device_add_inst(&ym3812_nuked_device, fm_dev_inst[fm_driver][chip_id]++);
@@ -49,7 +64,7 @@ fm_driver_get(int chip_id, fm_drv_t *drv)
}
break;
case FM_YMF262:
case FM_YMF262: /* OPL3 */
if (fm_driver == FM_DRV_NUKED) {
*drv = nuked_opl_drv;
drv->priv = device_add_inst(&ymf262_nuked_device, fm_dev_inst[fm_driver][chip_id]++);
@@ -58,27 +73,116 @@ fm_driver_get(int chip_id, fm_drv_t *drv)
drv->priv = device_add_inst(&ymf262_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
}
break;
#ifdef USE_LIBSERIALPORT
case FM_OPL2BOARD:
*drv = ymfm_opl2board_drv;
drv->priv = device_add_inst(&ym_opl2board_device, fm_dev_inst[fm_driver][chip_id]++);
break;
#endif
case FM_YMF289B:
case FM_YMF289B: /* OPL3-L */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ymf289b_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YMF278B:
case FM_YMF278B: /* OPL4 */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ymf278b_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2413: /* OPLL */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2413_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2423: /* OPLL-X */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2423_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YMF281: /* OPLLP */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ymf281_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_DS1001: /* Konami VRC7 MMC */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ds1001_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2151: /* OPM */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2151_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2203: /* OPN */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2203_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2608: /* OPNA */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2608_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YMF288: /* OPN3L */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ymf288_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2610: /* OPNB */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2610_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2610B: /* OPNB2 */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2610b_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2612: /* OPN2 */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2612_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM3438: /* OPN2C */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym3438_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YMF276: /* OPN2L */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ymf276_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM2164: /* OPP */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2164_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM3806: /* OPQ */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym3806_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
#if 0
case FM_YMF271: /* OPX */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ymf271_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
#endif
case FM_YM2414: /* OPZ */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2414_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_ESFM:
*drv = esfmu_opl_drv;
drv->priv = device_add_inst(&esfm_esfmu_device, fm_dev_inst[fm_driver][chip_id]++);
break;
#ifdef USE_LIBSERIALPORT
case FM_OPL2BOARD:
*drv = ymfm_opl2board_drv;
drv->priv = device_add_inst(&ym_opl2board_device, fm_dev_inst[fm_driver][chip_id]++);
break;
#endif
default:
return 0;
}

View File

@@ -167,14 +167,14 @@ opl2board_device_close(void *priv)
static const device_config_t opl2board_config[] = {
{
.name = "host_serial_path",
.description = "Host Serial Device",
.type = CONFIG_SERPORT,
.default_string = "",
.file_filter = NULL,
.spinner = {},
.selection = {}
{
.name = "host_serial_path",
.description = "Host Serial Device",
.type = CONFIG_SERPORT,
.default_string = "",
.file_filter = NULL,
.spinner = {},
.selection = {}
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -187,7 +187,7 @@ const device_t opl2board_device = {
.init = opl2board_device_init,
.close = opl2board_device_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = opl2board_config

View File

@@ -242,6 +242,7 @@ esfm_drv_read(uint16_t port, void *priv)
if (dev->status & STAT_TMR_OVER)
ret |= STAT_TMR_ANY;
break;
case 0x0001:
ret = ESFM_read_port(&dev->opl, port & 3);
switch (dev->opl.addr_latch & 0x5ff) {
@@ -256,6 +257,7 @@ esfm_drv_read(uint16_t port, void *priv)
break;
}
break;
case 0x0002:
case 0x0003:
ret = 0xff;
@@ -338,18 +340,18 @@ const device_t esfm_esfmu_device = {
.init = esfm_drv_init,
.close = esfm_drv_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const fm_drv_t esfmu_opl_drv = {
&esfm_drv_read,
&esfm_drv_write,
&esfm_drv_update,
&esfm_drv_reset_buffer,
&esfm_drv_set_do_cycles,
NULL,
NULL,
.read = &esfm_drv_read,
.write = &esfm_drv_write,
.update = &esfm_drv_update,
.reset_buffer = &esfm_drv_reset_buffer,
.set_do_cycles = &esfm_drv_set_do_cycles,
.priv = NULL,
.generate = NULL,
};

View File

@@ -68,9 +68,6 @@
#define RSM_FRAC 10
// #define OPL_FREQ FREQ_48000
#define OPL_FREQ FREQ_49716
// Channel types
enum {
ch_2op = 0,
@@ -1276,7 +1273,7 @@ OPL3_Reset(opl3_chip *chip, uint32_t samplerate)
}
chip->noise = 1;
chip->rateratio = (samplerate << RSM_FRAC) / 49716;
chip->rateratio = (samplerate << RSM_FRAC) / FREQ_49716;
chip->tremoloshift = 4;
chip->vibshift = 1;
@@ -1538,7 +1535,7 @@ nuked_drv_init(const device_t *info)
dev->status = 0x06;
/* Initialize the NukedOPL object. */
OPL3_Reset(&dev->opl, OPL_FREQ);
OPL3_Reset(&dev->opl, FREQ_49716);
timer_add(&dev->timers[0], nuked_timer_1, dev, 0);
timer_add(&dev->timers[1], nuked_timer_2, dev, 0);
@@ -1659,7 +1656,7 @@ const device_t ym3812_nuked_device = {
.init = nuked_drv_init,
.close = nuked_drv_close,
.reset = NULL,
{ .available = NULL },
.available = NULL ,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -1673,18 +1670,18 @@ const device_t ymf262_nuked_device = {
.init = nuked_drv_init,
.close = nuked_drv_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const fm_drv_t nuked_opl_drv = {
&nuked_drv_read,
&nuked_drv_write,
&nuked_drv_update,
&nuked_drv_reset_buffer,
&nuked_drv_set_do_cycles,
NULL,
NULL,
.read = &nuked_drv_read,
.write = &nuked_drv_write,
.update = &nuked_drv_update,
.reset_buffer = &nuked_drv_reset_buffer,
.set_do_cycles = &nuked_drv_set_do_cycles,
.priv = NULL,
.generate = NULL,
};

View File

@@ -23,7 +23,6 @@
#include "ymfm/ymfm_opl.h"
#include <libserialport.h>
extern "C" {
#define HAVE_STDARG_H
#include <86box/86box.h>
@@ -38,7 +37,6 @@ extern "C" {
#include <86box/ini.h>
#include <86box/device.h>
// Disable c99-designator to avoid the warnings in *_ymfm_device
#ifdef __clang__
# if __has_warning("-Wc99-designator")
@@ -46,21 +44,16 @@ extern "C" {
# pragma clang diagnostic ignored "-Wc99-designator"
# endif
#endif
}
#define RSM_FRAC 10
#define OPL_FREQ FREQ_48000
enum {
FLAG_CYCLES = (1 << 0)
};
uint8_t lastval = 0x00;
class OPLBOARDChipBase {
public:
OPLBOARDChipBase(UNUSED(uint32_t clock), fm_type type, uint32_t samplerate)
@@ -90,7 +83,6 @@ public:
virtual uint8_t read(uint16_t addr) = 0;
virtual void set_clock(uint32_t clock) = 0;
protected:
int32_t m_buffer[MUSICBUFLEN * 2];
int m_buf_pos;
@@ -244,7 +236,6 @@ public:
virtual void write(uint16_t addr, uint8_t data) override
{
m_chip.write(addr, data);
}
@@ -315,31 +306,27 @@ extern "C" {
#include <86box/config.h>
#include <86box/ini.h>
#ifdef ENABLE_OPL_LOG
int ymfm_do_log = ENABLE_OPL_LOG;
#ifdef ENABLE_OPL_LOG
int oplboard_do_log = ENABLE_OPL_LOG;
static void
ymfm_log(const char *fmt, ...)
oplboard_log(const char *fmt, ...)
{
va_list ap;
if (ymfm_do_log) {
if (oplboard_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
# define ymfm_log(fmt, ...)
# define oplboard_log(fmt, ...)
#endif
struct sp_port *port;
void opl2board_init() {
device_add(&opl2board_device);
const char* port_name = device_get_config_string("host_serial_path");
device_context_restore();
@@ -348,13 +335,13 @@ void opl2board_init() {
result = sp_get_port_by_name(port_name, &port);
if (result != SP_OK) {
ymfm_log("Error: Cannot find port %s\n", port_name);
oplboard_log("Error: Cannot find port %s\n", port_name);
return;
}
result = sp_open(port, SP_MODE_READ_WRITE);
if (result != SP_OK) {
ymfm_log ("Error: Cannot open port %s\n", port_name);
oplboard_log ("Error: Cannot open port %s\n", port_name);
return;
}
@@ -364,33 +351,29 @@ void opl2board_init() {
sp_set_parity(port, SP_PARITY_NONE);
sp_set_stopbits(port, 1);
sp_set_flowcontrol(port, SP_FLOWCONTROL_NONE);
ymfm_log("OPL2Board Serial port %s initialized at 115200 baud.\n", port_name);
oplboard_log("OPL2Board Serial port %s initialized at 115200 baud.\n", port_name);
}
void opl2board_write(uint8_t data) {
if (port == NULL) {
ymfm_log(stderr, "Error: OPL2Board Port not initialized.\n");
oplboard_log(stderr, "Error: OPL2Board Port not initialized.\n");
return;
}
enum sp_return result = sp_blocking_write(port, &data, sizeof(data), 1000);
if (result < 0) {
ymfm_log(stderr, "Error: Failed to write to OPL2Board port.\n");
oplboard_log(stderr, "Error: Failed to write to OPL2Board port.\n");
} else {
ymfm_log("OPL2Board: data sent: %02X\n", data);
oplboard_log("OPL2Board: data sent: %02X\n", data);
}
}
void opl2board_reset() {
// Reset all voices to 0
ymfm_log("Performing OPL2Board reset\n");
oplboard_log("Performing OPL2Board reset\n");
for (uint8_t i = 0x00; i < 0xFF; i++) {
if (i >= 0x40 && i <= 0x55) {
opl2board_write(i);
@@ -408,11 +391,10 @@ void opl2board_close() {
sp_close(port);
sp_free_port(port);
port = NULL;
ymfm_log("OPL2Board port closed.\n");
oplboard_log("OPL2Board port closed.\n");
}
}
static void *
ymfm_opl2board_drv_init(const device_t *info)
{
@@ -433,6 +415,7 @@ static void
ymfm_opl2board_drv_close(void *priv)
{
OPLBOARDChipBase *drv = (OPLBOARDChipBase *) priv;
opl2board_close();
if (drv != NULL)
delete drv;
@@ -453,29 +436,27 @@ ymfm_opl2board_drv_read(uint16_t port, void *priv)
uint8_t ret = drv->read(port);
drv->update();
ymfm_log("YMFM read port %04x, status = %02x\n", port, ret);
oplboard_log("OPLBoard read port %04x, status = %02x\n", port, ret);
return ret;
}
static void
ymfm_opl2board_drv_write(uint16_t port, uint8_t val, void *priv)
{
OPLBOARDChipBase *drv = (OPLBOARDChipBase *) priv;
ymfm_log("YMFM write port %04x value = %02x\n", port, val);
oplboard_log("OPLBoard write port %04x value = %02x\n", port, val);
if ((port == 0x380) || (port == 0x381))
port |= 4;
// Allow initialization of adlib
if ((val == 0x04 || val == 0x02) || (lastval == 0x04 || lastval == 0x02)) {
// Allow initialization of adlib
if ((val == 0x04 || val == 0x02) || (lastval == 0x04 || lastval == 0x02))
drv->write(port, val);
}
lastval = val;
opl2board_write(val);
drv->update();
}
static int32_t *
ymfm_opl2board_drv_update(void *priv)
{
@@ -500,22 +481,19 @@ static void
ymfm_opl2board_drv_set_do_cycles(void *priv, int8_t do_cycles)
{
OPLBOARDChipBase *drv = (OPLBOARDChipBase *) priv;
drv->set_do_cycles(do_cycles);
}
static void
ymfm_opl2board_drv_generate(void *priv, int32_t *data, uint32_t num_samples)
{
{
OPLBOARDChipBase *drv = (OPLBOARDChipBase *) priv;
// drv->generate_resampled(data, num_samples);
drv->generate(data, num_samples);
}
const device_t ym_opl2board_device = {
.name = "YMOPL2Board (External Device)",
.internal_name = "ym_opl2board_device",
@@ -524,21 +502,20 @@ const device_t ym_opl2board_device = {
.init = ymfm_opl2board_drv_init,
.close = ymfm_opl2board_drv_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const fm_drv_t ymfm_opl2board_drv {
&ymfm_opl2board_drv_read,
&ymfm_opl2board_drv_write,
&ymfm_opl2board_drv_update,
&ymfm_opl2board_drv_reset_buffer,
&ymfm_opl2board_drv_set_do_cycles,
NULL,
ymfm_opl2board_drv_generate
.read = &ymfm_opl2board_drv_read,
.write = &ymfm_opl2board_drv_write,
.update = &ymfm_opl2board_drv_update,
.reset_buffer = &ymfm_opl2board_drv_reset_buffer,
.set_do_cycles = &ymfm_opl2board_drv_set_do_cycles,
.priv = NULL,
.generate = ymfm_opl2board_drv_generate
};
#ifdef __clang__

View File

@@ -18,7 +18,16 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "ymfm/ymfm_ssg.h"
#include "ymfm/ymfm_misc.h"
#include "ymfm/ymfm_opl.h"
#include "ymfm/ymfm_opm.h"
#include "ymfm/ymfm_opn.h"
#include "ymfm/ymfm_opq.h"
#if 0
#include "ymfm/ymfm_opx.h"
#endif
#include "ymfm/ymfm_opz.h"
extern "C" {
#define HAVE_STDARG_H
@@ -38,13 +47,10 @@ extern "C" {
# pragma clang diagnostic ignored "-Wc99-designator"
# endif
#endif
}
#define RSM_FRAC 10
#define OPL_FREQ FREQ_48000
enum {
FLAG_CYCLES = (1 << 0)
};
@@ -322,24 +328,126 @@ ymfm_drv_init(const device_t *info)
YMFMChipBase *fm;
switch (info->local) {
case FM_YM2149: /* OPL */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2149>(14318181, FM_YM2149, FREQ_49716);
break;
case FM_YM3526: /* OPL */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym3526>(14318181, FM_YM3526, FREQ_49716);
break;
case FM_Y8950: /* MSX-Audio (OPL with ADPCM) */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::y8950>(14318181, FM_Y8950, FREQ_49716);
break;
default:
case FM_YM3812:
case FM_YM3812: /* OPL2 */
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym3812>(3579545, FM_YM3812, FREQ_49716);
break;
case FM_YMF262:
case FM_YMF262: /* OPL3 */
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf262>(14318181, FM_YMF262, FREQ_49716);
break;
case FM_YMF289B:
case FM_YMF289B: /* OPL3-L */
/* According to the datasheet, we should be using 33868800, but YMFM appears
to cheat and does it using the same values as the YMF262. */
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf289b>(14318181, FM_YMF289B, FREQ_49716);
break;
case FM_YMF278B:
case FM_YMF278B: /* OPL4 */
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf278b>(33868800, FM_YMF278B, FREQ_44100);
break;
case FM_YM2413: /* OPLL */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2413>(14318181, FM_YM2413, FREQ_49716);
break;
case FM_YM2423: /* OPLL-X */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2423>(14318181, FM_YM2423, FREQ_49716);
break;
case FM_YMF281: /* OPLLP */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf281>(14318181, FM_YMF281, FREQ_49716);
break;
case FM_DS1001: /* Konami VRC7 MMC */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ds1001>(14318181, FM_DS1001, FREQ_49716);
break;
case FM_YM2151: /* OPM */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2151>(14318181, FM_YM2151, FREQ_49716);
break;
case FM_YM2203: /* OPN */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2203>(14318181, FM_YM2203, FREQ_49716);
break;
case FM_YM2608: /* OPNA */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2608>(14318181, FM_YM2608, FREQ_49716);
break;
case FM_YMF288: /* OPN3L */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf288>(14318181, FM_YMF288, FREQ_49716);
break;
case FM_YM2610: /* OPNB */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2610>(14318181, FM_YM2610, FREQ_49716);
break;
case FM_YM2610B: /* OPNB2 */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2610b>(14318181, FM_YM2610B, FREQ_49716);
break;
case FM_YM2612: /* OPN2 */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2612>(14318181, FM_YM2612, FREQ_49716);
break;
case FM_YM3438: /* OPN2C */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym3438>(14318181, FM_YM3438, FREQ_49716);
break;
case FM_YMF276: /* OPN2L */
// TODO: Check function call, rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf276>(14318181, FM_YMF276, FREQ_49716);
break;
case FM_YM2164: /* OPP */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2164>(14318181, FM_YM2164, FREQ_49716);
break;
case FM_YM3806: /* OPQ */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym3806>(14318181, FM_YM3806, FREQ_49716);
break;
#if 0
case FM_YMF271: /* OPX */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ymf271>(14318181, FM_YMF271, FREQ_49716);
break;
#endif
case FM_YM2414: /* OPZ */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2414>(14318181, FM_YM2414, FREQ_49716);
break;
}
fm->set_do_cycles(1);
@@ -379,6 +487,7 @@ static void
ymfm_drv_write(uint16_t port, uint8_t val, void *priv)
{
YMFMChipBase *drv = (YMFMChipBase *) priv;
ymfm_log("YMFM write port %04x value = %02x\n", port, val);
if ((port == 0x380) || (port == 0x381))
port |= 4;
@@ -406,6 +515,7 @@ static void
ymfm_drv_set_do_cycles(void *priv, int8_t do_cycles)
{
YMFMChipBase *drv = (YMFMChipBase *) priv;
drv->set_do_cycles(do_cycles);
}
@@ -413,10 +523,53 @@ static void
ymfm_drv_generate(void *priv, int32_t *data, uint32_t num_samples)
{
YMFMChipBase *drv = (YMFMChipBase *) priv;
// drv->generate_resampled(data, num_samples);
drv->generate(data, num_samples);
}
const device_t ym2149_ymfm_device = {
.name = "Yamaha 2149 SSG (YMFM)",
.internal_name = "ym2149_ymfm",
.flags = 0,
.local = FM_YM2149,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym3526_ymfm_device = {
.name = "Yamaha YM3526 OPL (YMFM)",
.internal_name = "ym3526_ymfm",
.flags = 0,
.local = FM_YM3526,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t y8950_ymfm_device = {
.name = "Yamaha Y8950 (YMFM)",
.internal_name = "y8950_ymfm",
.flags = 0,
.local = FM_Y8950,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym3812_ymfm_device = {
.name = "Yamaha YM3812 OPL2 (YMFM)",
.internal_name = "ym3812_ymfm",
@@ -473,14 +626,255 @@ const device_t ymf278b_ymfm_device = {
.config = NULL
};
const device_t ym2413_ymfm_device = {
.name = "Yamaha YM2413 OPLL (YMFM)",
.internal_name = "ym2413_ymfm",
.flags = 0,
.local = FM_YM2413,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2423_ymfm_device = {
.name = "Yamaha YM2423 OPLL-X (YMFM)",
.internal_name = "ym2423_ymfm",
.flags = 0,
.local = FM_YM2423,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ymf281_ymfm_device = {
.name = "Yamaha YMF281 OPLLP (YMFM)",
.internal_name = "ymf281_ymfm",
.flags = 0,
.local = FM_YMF281,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ds1001_ymfm_device = {
.name = "Konami VRC7 MMC (YMFM)",
.internal_name = "ds1001_ymfm",
.flags = 0,
.local = FM_DS1001,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2151_ymfm_device = {
.name = "Yamaha YM2151 OPM (YMFM)",
.internal_name = "ym2151_ymfm",
.flags = 0,
.local = FM_YM2151,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2203_ymfm_device = {
.name = "Yamaha YM2203 OPN (YMFM)",
.internal_name = "ym2203_ymfm",
.flags = 0,
.local = FM_YM2203,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2608_ymfm_device = {
.name = "Yamaha YM2608 OPNA (YMFM)",
.internal_name = "ym2608_ymfm",
.flags = 0,
.local = FM_YM2608,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ymf288_ymfm_device = {
.name = "Yamaha YMF288 OPN3L (YMFM)",
.internal_name = "ymf288_ymfm",
.flags = 0,
.local = FM_YMF288,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2610_ymfm_device = {
.name = "Yamaha YM2610 OPNB (YMFM)",
.internal_name = "ym2610_ymfm",
.flags = 0,
.local = FM_YM2610,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2610b_ymfm_device = {
.name = "Yamaha YM2610b OPNB2 (YMFM)",
.internal_name = "ym2610b_ymfm",
.flags = 0,
.local = FM_YM2610B,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2612_ymfm_device = {
.name = "Yamaha YM2612 OPN2 (YMFM)",
.internal_name = "ym2612_ymfm",
.flags = 0,
.local = FM_YM2612,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym3438_ymfm_device = {
.name = "Yamaha YM3438 OPN2C (YMFM)",
.internal_name = "ym3438_ymfm",
.flags = 0,
.local = FM_YM3438,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ymf276_ymfm_device = {
.name = "Yamaha YMF276 OPN2L (YMFM)",
.internal_name = "ymf276_ymfm",
.flags = 0,
.local = FM_YMF276,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym2164_ymfm_device = {
.name = "Yamaha YM2164 OPP (YMFM)",
.internal_name = "ym2164_ymfm",
.flags = 0,
.local = FM_YM2164,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym3806_ymfm_device = {
.name = "Yamaha YM3806 OPQ (YMFM)",
.internal_name = "ym3806_ymfm",
.flags = 0,
.local = FM_YM3806,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
#if 0
const device_t ymf271_ymfm_device = {
.name = "Yamaha YMF271 OPX (YMFM)",
.internal_name = "ym271_ymfm",
.flags = 0,
.local = FM_YMF271,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
#endif
const device_t ym2414_ymfm_device = {
.name = "Yamaha YM2414 OPZ (YMFM)",
.internal_name = "ym2414_ymfm",
.flags = 0,
.local = FM_YM2414,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const fm_drv_t ymfm_drv {
&ymfm_drv_read,
&ymfm_drv_write,
&ymfm_drv_update,
&ymfm_drv_reset_buffer,
&ymfm_drv_set_do_cycles,
NULL,
ymfm_drv_generate,
.read = &ymfm_drv_read,
.write = &ymfm_drv_write,
.update = &ymfm_drv_update,
.reset_buffer = &ymfm_drv_reset_buffer,
.set_do_cycles = &ymfm_drv_set_do_cycles,
.priv = NULL,
.generate = ymfm_drv_generate,
};
#ifdef __clang__

View File

@@ -482,7 +482,7 @@ const device_t acermagic_s20_device = {
.init = optimc_init,
.close = optimc_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = optimc_speed_changed,
.force_redraw = NULL,
.config = optimc_config
@@ -496,7 +496,7 @@ const device_t mirosound_pcm10_device = {
.init = optimc_init,
.close = optimc_close,
.reset = NULL,
{ .available = mirosound_pcm10_available },
.available = mirosound_pcm10_available,
.speed_changed = optimc_speed_changed,
.force_redraw = NULL,
.config = optimc_config

View File

@@ -2428,7 +2428,7 @@ const device_t pasplus_device = {
.init = pas16_init,
.close = pas16_close,
.reset = pas16_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = pas16_speed_changed,
.force_redraw = NULL,
.config = pas16_config
@@ -2442,7 +2442,7 @@ const device_t pas16_device = {
.init = pas16_init,
.close = pas16_close,
.reset = pas16_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = pas16_speed_changed,
.force_redraw = NULL,
.config = pas16_config
@@ -2456,7 +2456,7 @@ const device_t pas16d_device = {
.init = pas16_init,
.close = pas16_close,
.reset = pas16_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = pas16_speed_changed,
.force_redraw = NULL,
.config = pas16_config

View File

@@ -203,7 +203,7 @@ const device_t ps1snd_device = {
.init = ps1snd_init,
.close = ps1snd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -295,7 +295,7 @@ const device_t pssj_device = {
.init = pssj_init,
.close = pssj_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -309,7 +309,7 @@ const device_t pssj_1e0_device = {
.init = pssj_1e0_init,
.close = pssj_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -323,7 +323,7 @@ const device_t pssj_isa_device = {
.init = pssj_isa_init,
.close = pssj_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pssj_isa_config

View File

@@ -5525,7 +5525,7 @@ const device_t sb_1_device = {
.init = sb_1_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_config
@@ -5539,7 +5539,7 @@ const device_t sb_15_device = {
.init = sb_15_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb15_config
@@ -5553,7 +5553,7 @@ const device_t sb_mcv_device = {
.init = sb_mcv_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_mcv_config
@@ -5567,7 +5567,7 @@ const device_t sb_2_device = {
.init = sb_2_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb2_config
@@ -5581,7 +5581,7 @@ const device_t sb_pro_v1_device = {
.init = sb_pro_v1_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_pro_config
@@ -5595,7 +5595,7 @@ const device_t sb_pro_v2_device = {
.init = sb_pro_v2_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_pro_config
@@ -5609,7 +5609,7 @@ const device_t sb_pro_mcv_device = {
.init = sb_pro_mcv_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_pro_mcv_config
@@ -5623,7 +5623,7 @@ const device_t sb_pro_compat_device = {
.init = sb_pro_compat_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -5637,7 +5637,7 @@ const device_t sb_16_device = {
.init = sb_16_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_config
@@ -5651,7 +5651,7 @@ const device_t sb_vibra16s_onboard_device = {
.init = sb_16_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_config
@@ -5665,7 +5665,7 @@ const device_t sb_vibra16s_device = {
.init = sb_16_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_config
@@ -5679,7 +5679,7 @@ const device_t sb_vibra16xv_device = {
.init = sb_vibra16_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = sb_vibra16xv_available },
.available = sb_vibra16xv_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_pnp_config
@@ -5693,7 +5693,7 @@ const device_t sb_vibra16c_onboard_device = {
.init = sb_vibra16_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = sb_vibra16c_available },
.available = sb_vibra16c_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_pnp_config
@@ -5707,7 +5707,7 @@ const device_t sb_vibra16c_device = {
.init = sb_vibra16_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = sb_vibra16c_available },
.available = sb_vibra16c_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_pnp_config
@@ -5721,7 +5721,7 @@ const device_t sb_16_reply_mca_device = {
.init = sb_16_reply_mca_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_pnp_config
@@ -5735,7 +5735,7 @@ const device_t sb_16_pnp_device = {
.init = sb_16_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = sb_16_pnp_available },
.available = sb_16_pnp_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_16_pnp_config
@@ -5749,7 +5749,7 @@ const device_t sb_16_compat_device = {
.init = sb_16_compat_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -5763,7 +5763,7 @@ const device_t sb_16_compat_nompu_device = {
.init = sb_16_compat_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = NULL
@@ -5777,7 +5777,7 @@ const device_t sb_32_pnp_device = {
.init = sb_awe32_pnp_init,
.close = sb_awe32_close,
.reset = NULL,
{ .available = sb_32_pnp_available },
.available = sb_32_pnp_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_32_pnp_config
@@ -5791,7 +5791,7 @@ const device_t sb_awe32_device = {
.init = sb_awe32_init,
.close = sb_awe32_close,
.reset = NULL,
{ .available = sb_awe32_available },
.available = sb_awe32_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_awe32_config
@@ -5805,7 +5805,7 @@ const device_t sb_awe32_pnp_device = {
.init = sb_awe32_pnp_init,
.close = sb_awe32_close,
.reset = NULL,
{ .available = sb_awe32_pnp_available },
.available = sb_awe32_pnp_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_awe32_pnp_config
@@ -5819,7 +5819,7 @@ const device_t sb_awe64_value_device = {
.init = sb_awe32_pnp_init,
.close = sb_awe32_close,
.reset = NULL,
{ .available = sb_awe64_value_available },
.available = sb_awe64_value_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_awe64_value_config
@@ -5833,7 +5833,7 @@ const device_t sb_awe64_device = {
.init = sb_awe32_pnp_init,
.close = sb_awe32_close,
.reset = NULL,
{ .available = sb_awe64_available },
.available = sb_awe64_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_awe64_config
@@ -5847,7 +5847,7 @@ const device_t sb_awe64_gold_device = {
.init = sb_awe32_pnp_init,
.close = sb_awe32_close,
.reset = NULL,
{ .available = sb_awe64_gold_available },
.available = sb_awe64_gold_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = sb_awe64_gold_config
@@ -5861,7 +5861,7 @@ const device_t ess_688_device = {
.init = ess_x688_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_688_config
@@ -5875,7 +5875,7 @@ const device_t ess_ess0100_pnp_device = {
.init = ess_x688_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = ess_688_pnp_available },
.available = ess_688_pnp_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_688_pnp_config
@@ -5889,7 +5889,7 @@ const device_t ess_1688_device = {
.init = ess_x688_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_1688_config
@@ -5903,7 +5903,7 @@ const device_t ess_ess0102_pnp_device = {
.init = ess_x688_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = ess_1688_pnp_available },
.available = ess_1688_pnp_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_1688_pnp_config
@@ -5917,7 +5917,7 @@ const device_t ess_ess0968_pnp_device = {
.init = ess_x688_pnp_init,
.close = sb_close,
.reset = NULL,
{ .available = ess_1688_968_pnp_available },
.available = ess_1688_968_pnp_available,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_1688_pnp_config
@@ -5931,7 +5931,7 @@ const device_t ess_soundpiper_16_mca_device = {
.init = ess_x688_mca_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_688_pnp_config
@@ -5945,7 +5945,7 @@ const device_t ess_soundpiper_32_mca_device = {
.init = ess_x688_mca_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_1688_pnp_config
@@ -5959,7 +5959,7 @@ const device_t ess_chipchat_16_mca_device = {
.init = ess_x688_mca_init,
.close = sb_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = sb_speed_changed,
.force_redraw = NULL,
.config = ess_1688_pnp_config

View File

@@ -318,7 +318,7 @@ const device_t sn76489_device = {
.init = sn76489_device_init,
.close = sn76489_device_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -332,7 +332,7 @@ const device_t ncr8496_device = {
.init = ncr8496_device_init,
.close = sn76489_device_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
@@ -346,7 +346,7 @@ const device_t tndy_device = {
.init = tndy_device_init,
.close = sn76489_device_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = tndy_config

View File

@@ -186,7 +186,7 @@ const device_t ssi2001_device = {
.init = ssi2001_init,
.close = ssi2001_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ssi2001_config
@@ -200,7 +200,7 @@ const device_t entertainer_device = {
.init = entertainer_init,
.close = entertainer_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = entertainer_config

View File

@@ -293,7 +293,7 @@ const device_t wss_device = {
.init = wss_init,
.close = wss_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = wss_speed_changed,
.force_redraw = NULL,
.config = wss_config
@@ -307,7 +307,7 @@ const device_t ncr_business_audio_device = {
.init = ncr_audio_init,
.close = wss_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = wss_speed_changed,
.force_redraw = NULL,
.config = NULL

View File

@@ -9,4 +9,14 @@
# CMake build script.
#
add_library(ymfm STATIC ymfm_misc.cpp ymfm_opl.cpp ymfm_opm.cpp ymfm_opn.cpp ymfm_opq.cpp ymfm_opz.cpp ymfm_pcm.cpp ymfm_adpcm.cpp)
add_library(ymfm STATIC
ymfm_adpcm.cpp
ymfm_misc.cpp
ymfm_opl.cpp
ymfm_opm.cpp
ymfm_opn.cpp
ymfm_opq.cpp
ymfm_opz.cpp
ymfm_pcm.cpp
ymfm_ssg.cpp
)

View File

@@ -1473,11 +1473,14 @@ void fm_engine_base<RegisterType>::assign_operators()
template<class RegisterType>
void fm_engine_base<RegisterType>::update_timer(uint32_t tnum, uint32_t enable, int32_t delta_clocks)
{
uint32_t subtract = !!(tnum >> 15);
tnum &= 0x7fff;
// if the timer is live, but not currently enabled, set the timer
if (enable && !m_timer_running[tnum])
{
// period comes from the registers, and is different for each
uint32_t period = (tnum == 0) ? (1024 - m_regs.timer_a_value()) : 16 * (256 - m_regs.timer_b_value());
uint32_t period = (tnum == 0) ? (1024 - subtract - m_regs.timer_a_value()) : 16 * (256 - subtract - m_regs.timer_b_value());
// caller can also specify a delta to account for other effects
period += delta_clocks;
@@ -1504,8 +1507,6 @@ void fm_engine_base<RegisterType>::update_timer(uint32_t tnum, uint32_t enable,
template<class RegisterType>
void fm_engine_base<RegisterType>::engine_timer_expired(uint32_t tnum)
{
assert(tnum == 0 || tnum == 1);
// update status
if (tnum == 0 && m_regs.enable_timer_a())
set_reset_status(STATUS_TIMERA, 0);
@@ -1521,8 +1522,11 @@ void fm_engine_base<RegisterType>::engine_timer_expired(uint32_t tnum)
m_modified_channels |= 1 << chnum;
}
// reset
m_timer_running[tnum] = false;
// Make sure the array does not go out of bounds to keep gcc happy
if ((tnum < 2) || (sizeof(m_timer_running) > (2 * sizeof(uint8_t)))) {
// reset
m_timer_running[tnum] = false;
}
update_timer(tnum, 1, 0);
}

View File

@@ -793,7 +793,7 @@ public:
ymf276(ymfm_interface &intf) : ym2612(intf) { }
// generate one sample of sound
void generate(output_data *output, uint32_t numsamples);
void generate(output_data *output, uint32_t numsamples = 1);
};
}

View File

@@ -105,7 +105,7 @@ public:
static constexpr uint8_t STATUS_IRQ = 0;
// constructor
opz_registers();
opx_registers();
// reset to initial state
void reset();
@@ -244,17 +244,17 @@ protected:
// IMPLEMENTATION CLASSES
//*********************************************************
// ======================> ym2414
// ======================> ymf271
class ym2414
class ymf271
{
public:
using fm_engine = fm_engine_base<opz_registers>;
using fm_engine = fm_engine_base<opx_registers>;
static constexpr uint32_t OUTPUTS = fm_engine::OUTPUTS;
using output_data = fm_engine::output_data;
// constructor
ym2414(ymfm_interface &intf);
ymf271(ymfm_interface &intf);
// reset
void reset();
@@ -287,4 +287,4 @@ protected:
}
#endif // YMFM_OPZ_H
#endif // YMFM_OPX_H

View File

@@ -249,6 +249,7 @@ typedef struct gd54xx_t {
uint8_t status;
uint8_t extensions;
uint8_t crtcreg_mask;
uint8_t aperture_mask;
uint8_t fc; /* Feature Connector */
@@ -271,9 +272,15 @@ typedef struct gd54xx_t {
void *ddc;
} gd54xx_t;
static video_timings_t timing_gd54xx_isa = { .type = VIDEO_ISA, .write_b = 3, .write_w = 3, .write_l = 6, .read_b = 8, .read_w = 8, .read_l = 12 };
static video_timings_t timing_gd54xx_vlb = { .type = VIDEO_BUS, .write_b = 4, .write_w = 4, .write_l = 8, .read_b = 10, .read_w = 10, .read_l = 20 };
static video_timings_t timing_gd54xx_pci = { .type = VIDEO_PCI, .write_b = 4, .write_w = 4, .write_l = 8, .read_b = 10, .read_w = 10, .read_l = 20 };
static video_timings_t timing_gd54xx_isa = { .type = VIDEO_ISA,
.write_b = 3, .write_w = 3, .write_l = 6,
.read_b = 8, .read_w = 8, .read_l = 12 };
static video_timings_t timing_gd54xx_vlb = { .type = VIDEO_BUS,
.write_b = 4, .write_w = 4, .write_l = 8,
.read_b = 10, .read_w = 10, .read_l = 20 };
static video_timings_t timing_gd54xx_pci = { .type = VIDEO_PCI, .write_b = 4,
.write_w = 4, .write_l = 8, .read_b = 10,
.read_w = 10, .read_l = 20 };
static void
gd543x_mmio_write(uint32_t addr, uint8_t val, void *priv);
@@ -512,7 +519,8 @@ gd54xx_interrupt_enabled(gd54xx_t *gd54xx)
static int
gd54xx_vga_vsync_enabled(gd54xx_t *gd54xx)
{
if (!(gd54xx->svga.crtc[0x11] & 0x20) && (gd54xx->svga.crtc[0x11] & 0x10) && gd54xx_interrupt_enabled(gd54xx))
if (!(gd54xx->svga.crtc[0x11] & 0x20) && (gd54xx->svga.crtc[0x11] & 0x10) &&
gd54xx_interrupt_enabled(gd54xx))
return 1;
return 0;
}
@@ -573,7 +581,8 @@ gd54xx_overlay_draw(svga_t *svga, int displine)
OVERLAY_SAMPLE();
for (int x = 0; (x < gd54xx->overlay.region2size) && ((x + gd54xx->overlay.region1size) < svga->hdisp); x++) {
for (int x = 0; (x < gd54xx->overlay.region2size) &&
((x + gd54xx->overlay.region1size) < svga->hdisp); x++) {
if (gd54xx->overlay.occlusion) {
occl = 1;
ckval = gd54xx->overlay.ck;
@@ -615,8 +624,10 @@ gd54xx_update_overlay(gd54xx_t *gd54xx)
int bpp = svga->bpp;
svga->overlay.cur_ysize = gd54xx->overlay.wve - gd54xx->overlay.wvs + 1;
gd54xx->overlay.region1size = 32 * gd54xx->overlay.r1sz / bpp + (gd54xx->overlay.r1adjust * 8 / bpp);
gd54xx->overlay.region2size = 32 * gd54xx->overlay.r2sz / bpp + (gd54xx->overlay.r2adjust * 8 / bpp);
gd54xx->overlay.region1size = 32 * gd54xx->overlay.r1sz / bpp +
(gd54xx->overlay.r1adjust * 8 / bpp);
gd54xx->overlay.region2size = 32 * gd54xx->overlay.r2sz / bpp +
(gd54xx->overlay.r2adjust * 8 / bpp);
gd54xx->overlay.occlusion = (svga->crtc[0x3e] & 0x80) != 0 && svga->bpp <= 16;
@@ -624,7 +635,8 @@ gd54xx_update_overlay(gd54xx_t *gd54xx)
if (gd54xx->overlay.colorkeymode == 0)
gd54xx->overlay.ck = gd54xx->overlay.colorkeycompare;
else if (gd54xx->overlay.colorkeymode == 1)
gd54xx->overlay.ck = gd54xx->overlay.colorkeycompare | (gd54xx->overlay.colorkeycomparemask << 8);
gd54xx->overlay.ck = gd54xx->overlay.colorkeycompare |
(gd54xx->overlay.colorkeycomparemask << 8);
else
gd54xx->overlay.occlusion = 0;
}
@@ -633,7 +645,8 @@ gd54xx_update_overlay(gd54xx_t *gd54xx)
static int
gd54xx_has_transp(svga_t *svga, int mask)
{
if (((svga->crtc[0x27] == CIRRUS_ID_CLGD5446) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5480)) && !mask)
if (((svga->crtc[0x27] == CIRRUS_ID_CLGD5446) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5480)) &&
!mask)
return 1; /* 5446 and 5480 have mask but not transparency. */
if ((svga->crtc[0x27] == CIRRUS_ID_CLGD5426) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5428))
return 1; /* 5426 and 5428 have both. */
@@ -699,12 +712,17 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
if (svga->attraddr == 0x10 || svga->attraddr == 0x14 || svga->attraddr < 0x10) {
for (uint8_t c = 0; c < 16; c++) {
if (svga->attrregs[0x10] & 0x80)
svga->egapal[c] = (svga->attrregs[c] & 0xf) | ((svga->attrregs[0x14] & 0xf) << 4);
svga->egapal[c] = (svga->attrregs[c] & 0xf) |
((svga->attrregs[0x14] & 0xf) << 4);
else
svga->egapal[c] = (svga->attrregs[c] & 0x3f) | ((svga->attrregs[0x14] & 0xc) << 4);
svga->egapal[c] = (svga->attrregs[c] & 0x3f) |
((svga->attrregs[0x14] & 0xc) << 4);
}
}
/* Recalculate timings on change of attribute register 0x11 (overscan border color) too. */
/*
Recalculate timings on change of attribute register
0x11 (overscan border color) too.
*/
if (svga->attraddr == 0x10) {
if (o != val)
svga_recalctimings(svga);
@@ -794,20 +812,28 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
svga_recalctimings(svga);
svga->hwcursor.ena = val & CIRRUS_CURSOR_SHOW;
if (svga->crtc[0x27] >= CIRRUS_ID_CLGD5422)
svga->hwcursor.cur_xsize = svga->hwcursor.cur_ysize = ((val & CIRRUS_CURSOR_LARGE) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5422)) ? 64 : 32;
svga->hwcursor.cur_xsize = svga->hwcursor.cur_ysize =
((svga->crtc[0x27] >= CIRRUS_ID_CLGD5422) &&
(val & CIRRUS_CURSOR_LARGE)) ? 64 : 32;
else
svga->hwcursor.cur_xsize = 32;
if ((svga->seqregs[0x12] & CIRRUS_CURSOR_LARGE) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5422))
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) + ((svga->seqregs[0x13] & 0x3c) * 256));
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5422) &&
(svga->seqregs[0x12] & CIRRUS_CURSOR_LARGE))
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) +
((svga->seqregs[0x13] & 0x3c) * 256));
else
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) + ((svga->seqregs[0x13] & 0x3f) * 256));
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) +
((svga->seqregs[0x13] & 0x3f) * 256));
break;
case 0x13:
if ((svga->seqregs[0x12] & CIRRUS_CURSOR_LARGE) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5422))
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) + ((val & 0x3c) * 256));
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5422) &&
(svga->seqregs[0x12] & CIRRUS_CURSOR_LARGE))
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) +
((val & 0x3c) * 256));
else
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) + ((val & 0x3f) * 256));
svga->hwcursor.addr = ((gd54xx->vram_size - 0x4000) +
((val & 0x3f) * 256));
break;
case 0x07:
svga->packed_chain4 = svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA;
@@ -869,7 +895,9 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
gd54xx->extpal[index].r = svga->dac_r;
gd54xx->extpal[index].g = svga->dac_g;
gd54xx->extpal[index].b = val;
gd54xx->extpallook[index] = makecol32(video_6to8[gd54xx->extpal[index].r & 0x3f], video_6to8[gd54xx->extpal[index].g & 0x3f], video_6to8[gd54xx->extpal[index].b & 0x3f]);
gd54xx->extpallook[index] = makecol32(video_6to8[gd54xx->extpal[index].r & 0x3f],
video_6to8[gd54xx->extpal[index].g & 0x3f],
video_6to8[gd54xx->extpal[index].b & 0x3f]);
if (svga->ext_overscan && (index == 2)) {
o32 = svga->overscan_color;
svga->overscan_color = gd54xx->extpallook[2];
@@ -880,7 +908,9 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
svga->vgapal[index].r = svga->dac_r;
svga->vgapal[index].g = svga->dac_g;
svga->vgapal[index].b = val;
svga->pallook[index] = makecol32(video_6to8[svga->vgapal[index].r & 0x3f], video_6to8[svga->vgapal[index].g & 0x3f], video_6to8[svga->vgapal[index].b & 0x3f]);
svga->pallook[index] = makecol32(video_6to8[svga->vgapal[index].r & 0x3f],
video_6to8[svga->vgapal[index].g & 0x3f],
video_6to8[svga->vgapal[index].b & 0x3f]);
}
svga->dac_addr = (svga->dac_addr + 1) & 255;
svga->dac_pos = 0;
@@ -895,7 +925,8 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
svga->gdcaddr = val /* & 0x3f*/;
return;
case 0x3cf:
if ((svga->gdcaddr > 0x1f) && ((svga->crtc[0x27] <= CIRRUS_ID_CLGD5422) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5424)))
if (((svga->crtc[0x27] <= CIRRUS_ID_CLGD5422) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5424)) &&
(svga->gdcaddr > 0x1f))
return;
o = svga->gdcreg[svga->gdcaddr];
@@ -941,7 +972,8 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
gd54xx_set_svga_fast(gd54xx);
if (((svga->gdcaddr == 5) && ((val ^ o) & 0x70)) || ((svga->gdcaddr == 6) && ((val ^ o) & 1)))
if (((svga->gdcaddr == 5) && ((val ^ o) & 0x70)) ||
((svga->gdcaddr == 6) && ((val ^ o) & 1)))
svga_recalctimings(svga);
} else {
switch (svga->gdcaddr) {
@@ -1102,7 +1134,10 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
svga->crtcreg = val & gd54xx->crtcreg_mask;
return;
case 0x3d5:
if (((svga->crtcreg == 0x19) || (svga->crtcreg == 0x1a) || (svga->crtcreg == 0x1b) || (svga->crtcreg == 0x1d) || (svga->crtcreg == 0x25) || (svga->crtcreg == 0x27)) && !gd54xx->unlocked)
if (!gd54xx->unlocked &&
((svga->crtcreg == 0x19) || (svga->crtcreg == 0x1a) ||
(svga->crtcreg == 0x1b) || (svga->crtcreg == 0x1d) ||
(svga->crtcreg == 0x25) || (svga->crtcreg == 0x27)))
return;
if ((svga->crtcreg == 0x25) || (svga->crtcreg == 0x27))
return;
@@ -1217,7 +1252,8 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv)
if (svga->crtcreg < 0xe || svga->crtcreg > 0x10) {
if ((svga->crtcreg == 0xc) || (svga->crtcreg == 0xd)) {
svga->fullchange = 3;
svga->ma_latch = ((svga->crtc[0xc] << 8) | svga->crtc[0xd]) + ((svga->crtc[8] & 0x60) >> 5);
svga->ma_latch = ((svga->crtc[0xc] << 8) | svga->crtc[0xd]) +
((svga->crtc[8] & 0x60) >> 5);
} else {
svga->fullchange = changeframecount;
svga_recalctimings(svga);
@@ -1283,7 +1319,8 @@ gd54xx_in(uint16_t addr, void *priv)
ret |= 0x80;
}
break;
case 0x0a: /*Scratch Pad 1 (Memory size for 5402/542x)*/
case 0x0a:
/* Scratch Pad 1 (Memory size for 5402/542x) */
ret = svga->seqregs[0x0a] & ~0x1a;
if (svga->crtc[0x27] == CIRRUS_ID_CLGD5402) {
ret |= 0x01; /*512K of memory*/
@@ -1310,17 +1347,21 @@ gd54xx_in(uint16_t addr, void *priv)
case 0x0e:
ret = gd54xx->vclk_n[svga->seqaddr - 0x0b];
break;
case 0x0f: /*DRAM control*/
case 0x0f: /* DRAM control */
ret = svga->seqregs[0x0f] & ~0x98;
switch (gd54xx->vram_size >> 10) {
case 512:
ret |= 0x08; /*16-bit DRAM data bus width*/
ret |= 0x08; /* 16-bit DRAM data bus width */
break;
case 1024:
ret |= 0x10; /*32-bit DRAM data bus width for 1M of memory*/
ret |= 0x10; /* 32-bit DRAM data bus width for 1M of memory */
break;
case 2048:
ret |= (gd54xx_is_5434(svga)) ? 0x98 : 0x18; /*32-bit (Pre-5434)/64-bit (5434 and up) DRAM data bus width for 2M of memory*/
/*
32-bit (Pre-5434)/64-bit (5434 and up) DRAM data bus width
for 2M of memory
*/
ret |= (gd54xx_is_5434(svga)) ? 0x98 : 0x18;
break;
case 4096:
ret |= 0x98; /*64-bit (5434 and up) DRAM data bus width for 4M of memory*/
@@ -1352,7 +1393,8 @@ gd54xx_in(uint16_t addr, void *priv)
case 0x17:
ret = svga->seqregs[0x17] & ~(7 << 3);
if (svga->crtc[0x27] <= CIRRUS_ID_CLGD5429) {
if ((svga->crtc[0x27] == CIRRUS_ID_CLGD5428) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5426)) {
if ((svga->crtc[0x27] == CIRRUS_ID_CLGD5428) ||
(svga->crtc[0x27] == CIRRUS_ID_CLGD5426)) {
if (gd54xx->vlb)
ret |= (CL_GD5428_SYSTEM_BUS_VESA << 3);
else if (gd54xx->mca)
@@ -1453,7 +1495,9 @@ gd54xx_in(uint16_t addr, void *priv)
if (svga->gdcaddr >= 0x10) {
if ((svga->gdcaddr > 8) && !gd54xx->unlocked)
ret = 0xff;
else if ((svga->gdcaddr > 0x1f) && ((svga->crtc[0x27] <= CIRRUS_ID_CLGD5422) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5424)))
else if (((svga->crtc[0x27] <= CIRRUS_ID_CLGD5422) ||
(svga->crtc[0x27] == CIRRUS_ID_CLGD5424)) &&
(svga->gdcaddr > 0x1f))
ret = 0xff;
else
switch (svga->gdcaddr) {
@@ -1583,7 +1627,10 @@ gd54xx_in(uint16_t addr, void *priv)
break;
case 0x3d5:
ret = svga->crtc[svga->crtcreg];
if (((svga->crtcreg == 0x19) || (svga->crtcreg == 0x1a) || (svga->crtcreg == 0x1b) || (svga->crtcreg == 0x1d) || (svga->crtcreg == 0x25) || (svga->crtcreg == 0x27)) && !gd54xx->unlocked)
if (((svga->crtcreg == 0x19) || (svga->crtcreg == 0x1a) ||
(svga->crtcreg == 0x1b) || (svga->crtcreg == 0x1d) ||
(svga->crtcreg == 0x25) || (svga->crtcreg == 0x27)) &&
!gd54xx->unlocked)
ret = 0xff;
else
switch (svga->crtcreg) {
@@ -1601,7 +1648,8 @@ gd54xx_in(uint16_t addr, void *priv)
ret = svga->crtc[0x27]; /*GD542x/GD543x*/
break;
case 0x28: /*Class ID*/
if ((svga->crtc[0x27] == CIRRUS_ID_CLGD5430) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5440))
if ((svga->crtc[0x27] == CIRRUS_ID_CLGD5430) ||
(svga->crtc[0x27] == CIRRUS_ID_CLGD5440))
ret = 0xff; /*Standard CL-GD5430/40*/
break;
@@ -1630,13 +1678,15 @@ gd54xx_recalc_banking(gd54xx_t *gd54xx)
else
svga->extra_banks[1] = svga->extra_banks[0] + 0x8000;
} else {
if ((svga->gdcreg[0x0b] & CIRRUS_BANKING_GRANULARITY_16K) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5426) && (svga->crtc[0x27] != CIRRUS_ID_CLGD5424))
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5426) && (svga->crtc[0x27] != CIRRUS_ID_CLGD5424) &&
(svga->gdcreg[0x0b] & CIRRUS_BANKING_GRANULARITY_16K))
svga->extra_banks[0] = svga->gdcreg[0x09] << 14;
else
svga->extra_banks[0] = svga->gdcreg[0x09] << 12;
if (svga->gdcreg[0x0b] & CIRRUS_BANKING_DUAL) {
if ((svga->gdcreg[0x0b] & CIRRUS_BANKING_GRANULARITY_16K) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5426) && (svga->crtc[0x27] != CIRRUS_ID_CLGD5424))
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5426) && (svga->crtc[0x27] != CIRRUS_ID_CLGD5424) &&
(svga->gdcreg[0x0b] & CIRRUS_BANKING_GRANULARITY_16K))
svga->extra_banks[1] = svga->gdcreg[0x0a] << 14;
else
svga->extra_banks[1] = svga->gdcreg[0x0a] << 12;
@@ -1652,6 +1702,8 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx)
uint32_t base;
uint32_t size;
gd54xx->aperture_mask = 0x00;
if (gd54xx->pci && (!(gd54xx->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM))) {
mem_mapping_disable(&svga->mapping);
mem_mapping_disable(&gd54xx->linear_mapping);
@@ -1661,7 +1713,8 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx)
gd54xx->mmio_vram_overlap = 0;
if (!gd54xx_is_5422(svga) || !(svga->seqregs[0x07] & 0xf0) || !(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA)) {
if (!gd54xx_is_5422(svga) || !(svga->seqregs[0x07] & 0xf0) ||
!(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA)) {
mem_mapping_disable(&gd54xx->linear_mapping);
mem_mapping_disable(&gd54xx->aperture2_mapping);
switch (svga->gdcreg[6] & 0x0c) {
@@ -1687,7 +1740,8 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx)
break;
}
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) && (svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5429)) {
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5429) && (svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) &&
(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA)) {
if (gd54xx->mmio_vram_overlap) {
mem_mapping_disable(&svga->mapping);
mem_mapping_set_addr(&gd54xx->mmio_mapping, 0xb8000, 0x08000);
@@ -1723,19 +1777,28 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx)
size = 4 * 1024 * 1024;
}
if (size >= (16 * 1024 * 1024))
gd54xx->aperture_mask = 0x03;
mem_mapping_disable(&svga->mapping);
mem_mapping_set_addr(&gd54xx->linear_mapping, base, size);
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) && (svga->crtc[0x27] >= CIRRUS_ID_CLGD5429)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) &&
(svga->crtc[0x27] >= CIRRUS_ID_CLGD5429)) {
if (svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)
mem_mapping_disable(&gd54xx->mmio_mapping); /* MMIO is handled in the linear read/write functions */
/* MMIO is handled in the linear read/write functions */
mem_mapping_disable(&gd54xx->mmio_mapping);
else
mem_mapping_set_addr(&gd54xx->mmio_mapping, 0xb8000, 0x00100);
} else
mem_mapping_disable(&gd54xx->mmio_mapping);
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) && (gd54xx->blt.status & CIRRUS_BLT_APERTURE2) && ((gd54xx->blt.mode & (CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_MEMSYSSRC)) == (CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_MEMSYSSRC))) {
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) &&
(gd54xx->blt.status & CIRRUS_BLT_APERTURE2) &&
((gd54xx->blt.mode & (CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_MEMSYSSRC)) ==
(CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_MEMSYSSRC))) {
if (svga->crtc[0x27] == CIRRUS_ID_CLGD5480)
mem_mapping_set_addr(&gd54xx->aperture2_mapping, gd54xx->lfb_base + 16777216, 16777216);
mem_mapping_set_addr(&gd54xx->aperture2_mapping,
gd54xx->lfb_base + 16777216, 16777216);
else
mem_mapping_set_addr(&gd54xx->aperture2_mapping, 0xbc000, 0x04000);
} else
@@ -1754,10 +1817,14 @@ gd54xx_recalctimings(svga_t *svga)
svga->hblankstart = svga->crtc[2];
if (svga->crtc[0x1b] & ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5424) ? 0xa0 : 0x20)) {
/* Special blanking mode: the blank start and end become components of the window generator,
and the actual blanking comes from the display enable signal. */
/* This means blanking during overscan, we already calculate it that way, so just use the
same calculation and force otvercan to 0. */
/*
Special blanking mode: the blank start and end become components
of the window generator, and the actual blanking comes from the
display enable signal.
This means blanking during overscan, we already calculate it that
way, so just use the same calculation and force otvercan to 0.
*/
svga->hblank_end_val = (svga->crtc[3] & 0x1f) | ((svga->crtc[5] & 0x80) ? 0x20 : 0x00) |
(((svga->crtc[0x1a] >> 4) & 3) << 6);
@@ -1895,7 +1962,8 @@ gd54xx_recalctimings(svga_t *svga)
break;
case CIRRUS_SR7_BPP_16:
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5428) || (svga->crtc[0x27] == CIRRUS_ID_CLGD5426)) {
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5428) ||
(svga->crtc[0x27] == CIRRUS_ID_CLGD5426)) {
svga->bpp = 16;
if (linedbl)
svga->render = svga_render_16bpp_lowres;
@@ -1947,7 +2015,8 @@ gd54xx_recalctimings(svga_t *svga)
clocksel = (svga->miscout >> 2) & 3;
if (!gd54xx->vclk_n[clocksel] || !gd54xx->vclk_d[clocksel])
svga->clock = (cpuclock * (float) (1ULL << 32)) / ((svga->miscout & 0xc) ? 28322000.0 : 25175000.0);
svga->clock = (cpuclock * (float) (1ULL << 32)) /
((svga->miscout & 0xc) ? 28322000.0 : 25175000.0);
else {
int n = gd54xx->vclk_n[clocksel] & 0x7f;
int d = (gd54xx->vclk_d[clocksel] & 0x3e) >> 1;
@@ -2112,10 +2181,10 @@ gd54xx_rop(gd54xx_t *gd54xx, uint8_t *res, uint8_t *dst, const uint8_t *src)
}
static uint8_t
gd54xx_get_aperture(uint32_t addr)
gd54xx_get_aperture(gd54xx_t *gd54xx, uint32_t addr)
{
uint32_t ap = addr >> 22;
return (uint8_t) (ap & 0x03);
return (uint8_t) (ap & gd54xx->aperture_mask);
}
static uint32_t
@@ -2191,7 +2260,8 @@ gd54xx_write(uint32_t addr, uint8_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_mem_sys_src_write(gd54xx, val, 0);
return;
}
@@ -2209,7 +2279,8 @@ gd54xx_writew(uint32_t addr, uint16_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_write(addr, val, gd54xx);
gd54xx_write(addr + 1, val >> 8, gd54xx);
return;
@@ -2235,7 +2306,8 @@ gd54xx_writel(uint32_t addr, uint32_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_write(addr, val, gd54xx);
gd54xx_write(addr + 1, val >> 8, gd54xx);
gd54xx_write(addr + 2, val >> 16, gd54xx);
@@ -2297,8 +2369,10 @@ gd54xx_write_modes45(svga_t *svga, uint8_t val, uint32_t addr)
for (i = 0; i < 8; i++) {
j = (0x80 >> i);
if (svga->seqregs[2] & j) {
svga->vram[addr + (i << 1)] = (val & j) ? svga->gdcreg[1] : svga->gdcreg[0];
svga->vram[addr + (i << 1) + 1] = (val & j) ? svga->gdcreg[0x11] : svga->gdcreg[0x10];
svga->vram[addr + (i << 1)] = (val & j) ?
svga->gdcreg[1] : svga->gdcreg[0];
svga->vram[addr + (i << 1) + 1] = (val & j) ?
svga->gdcreg[0x11] : svga->gdcreg[0x10];
}
}
} else {
@@ -2343,19 +2417,24 @@ gd54xx_readb_linear(uint32_t addr, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
addr &= 0x003fffff; /* 4 MB mask */
if (!(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA))
return svga_read_linear(addr, svga);
if ((addr >= (svga->vram_max - 256)) && (addr < svga->vram_max)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) && (svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR))
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) &&
(svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR))
return gd543x_mmio_read(addr & 0x000000ff, gd54xx);
}
/* Do mem sys dest reads here if the blitter is neither paused, nor is there a second aperture. */
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
/*
Do mem sys dest reads here if the blitter is neither paused,
nor is there a second aperture.
*/
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
return gd54xx_mem_sys_dest_read(gd54xx, ap);
switch (ap) {
@@ -2384,7 +2463,7 @@ gd54xx_readw_linear(uint32_t addr, void *priv)
svga_t *svga = &gd54xx->svga;
uint32_t old_addr = addr;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
uint16_t temp;
addr &= 0x003fffff; /* 4 MB mask */
@@ -2399,8 +2478,12 @@ gd54xx_readw_linear(uint32_t addr, void *priv)
}
}
/* Do mem sys dest reads here if the blitter is neither paused, nor is there a second aperture. */
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
/*
Do mem sys dest reads here if the blitter is neither paused,
nor is there a second aperture.
*/
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
temp = gd54xx_readb_linear(old_addr, priv);
temp |= gd54xx_readb_linear(old_addr + 1, priv) << 8;
return temp;
@@ -2434,7 +2517,7 @@ gd54xx_readl_linear(uint32_t addr, void *priv)
svga_t *svga = &gd54xx->svga;
uint32_t old_addr = addr;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
uint32_t temp;
addr &= 0x003fffff; /* 4 MB mask */
@@ -2449,8 +2532,12 @@ gd54xx_readl_linear(uint32_t addr, void *priv)
}
}
/* Do mem sys dest reads here if the blitter is neither paused, nor is there a second aperture. */
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
/*
Do mem sys dest reads here if the blitter is neither paused,
nor is there a second aperture.
*/
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
temp = gd54xx_readb_linear(old_addr, priv);
temp |= gd54xx_readb_linear(old_addr + 1, priv) << 8;
temp |= gd54xx_readb_linear(old_addr + 2, priv) << 16;
@@ -2491,7 +2578,7 @@ static uint8_t
gd5436_aperture2_readb(UNUSED(uint32_t addr), void *priv)
{
gd54xx_t *gd54xx = (gd54xx_t *) priv;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
@@ -2538,7 +2625,7 @@ static void
gd5436_aperture2_writeb(UNUSED(uint32_t addr), uint8_t val, void *priv)
{
gd54xx_t *gd54xx = (gd54xx_t *) priv;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
@@ -2577,7 +2664,7 @@ gd54xx_writeb_linear(uint32_t addr, uint8_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
if (!(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA)) {
svga_write_linear(addr, val, svga);
@@ -2587,14 +2674,19 @@ gd54xx_writeb_linear(uint32_t addr, uint8_t val, void *priv)
addr &= 0x003fffff; /* 4 MB mask */
if ((addr >= (svga->vram_max - 256)) && (addr < svga->vram_max)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) && (svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) &&
(svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)) {
gd543x_mmio_write(addr & 0x000000ff, val, gd54xx);
return;
}
}
/* Do mem sys src writes here if the blitter is neither paused, nor is there a second aperture. */
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
/*
Do mem sys src writes here if the blitter is neither paused,
nor is there a second aperture.
*/
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_mem_sys_src_write(gd54xx, val, ap);
return;
}
@@ -2624,7 +2716,7 @@ gd54xx_writew_linear(uint32_t addr, uint16_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
uint32_t old_addr = addr;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
if (!(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA)) {
svga_writew_linear(addr, val, svga);
@@ -2634,14 +2726,19 @@ gd54xx_writew_linear(uint32_t addr, uint16_t val, void *priv)
addr &= 0x003fffff; /* 4 MB mask */
if ((addr >= (svga->vram_max - 256)) && (addr < svga->vram_max)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) && (svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) &&
(svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)) {
gd543x_mmio_writew(addr & 0x000000ff, val, gd54xx);
return;
}
}
/* Do mem sys src writes here if the blitter is neither paused, nor is there a second aperture. */
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
/*
Do mem sys src writes here if the blitter is neither paused,
nor is there a second aperture.
*/
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_writeb_linear(old_addr, val, gd54xx);
gd54xx_writeb_linear(old_addr + 1, val >> 8, gd54xx);
return;
@@ -2691,7 +2788,7 @@ gd54xx_writel_linear(uint32_t addr, uint32_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
uint32_t old_addr = addr;
uint8_t ap = gd54xx_get_aperture(addr);
uint8_t ap = gd54xx_get_aperture(gd54xx, addr);
if (!(svga->seqregs[0x07] & CIRRUS_SR7_BPP_SVGA)) {
svga_writel_linear(addr, val, svga);
@@ -2701,14 +2798,19 @@ gd54xx_writel_linear(uint32_t addr, uint32_t val, void *priv)
addr &= 0x003fffff; /* 4 MB mask */
if ((addr >= (svga->vram_max - 256)) && (addr < svga->vram_max)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) && (svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)) {
if ((svga->seqregs[0x17] & CIRRUS_MMIO_ENABLE) &&
(svga->seqregs[0x17] & CIRRUS_MMIO_USE_PCIADDR)) {
gd543x_mmio_writel(addr & 0x000000ff, val, gd54xx);
return;
}
}
/* Do mem sys src writes here if the blitter is neither paused, nor is there a second aperture. */
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
/*
Do mem sys src writes here if the blitter is neither paused,
nor is there a second aperture.
*/
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!gd54xx_aperture2_enabled(gd54xx) && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_writeb_linear(old_addr, val, gd54xx);
gd54xx_writeb_linear(old_addr + 1, val >> 8, gd54xx);
gd54xx_writeb_linear(old_addr + 2, val >> 16, gd54xx);
@@ -2770,7 +2872,8 @@ gd54xx_read(uint32_t addr, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
return gd54xx_mem_sys_dest_read(gd54xx, 0);
(void) xga_read_test(addr, svga);
@@ -2787,7 +2890,8 @@ gd54xx_readw(uint32_t addr, void *priv)
svga_t *svga = &gd54xx->svga;
uint16_t ret;
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
ret = gd54xx_read(addr, priv);
ret |= gd54xx_read(addr + 1, priv) << 8;
return ret;
@@ -2808,7 +2912,8 @@ gd54xx_readl(uint32_t addr, void *priv)
svga_t *svga = &gd54xx->svga;
uint32_t ret;
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
ret = gd54xx_read(addr, priv);
ret |= gd54xx_read(addr + 1, priv) << 8;
ret |= gd54xx_read(addr + 2, priv) << 16;
@@ -2934,7 +3039,9 @@ gd543x_mmio_write(uint32_t addr, uint8_t val, void *priv)
else
gd54xx->blt.dst_addr &= 0x1fffff;
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) && (gd54xx->blt.status & CIRRUS_BLT_AUTOSTART) && !(gd54xx->blt.status & CIRRUS_BLT_BUSY)) {
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) &&
(gd54xx->blt.status & CIRRUS_BLT_AUTOSTART) &&
!(gd54xx->blt.status & CIRRUS_BLT_BUSY)) {
gd54xx->blt.status |= CIRRUS_BLT_BUSY;
gd54xx_start_blit(0, 0xffffffff, gd54xx, svga);
}
@@ -3010,7 +3117,8 @@ gd543x_mmio_writeb(uint32_t addr, uint8_t val, void *priv)
gd54xx_t *gd54xx = (gd54xx_t *) priv;
svga_t *svga = &gd54xx->svga;
if (!gd543x_do_mmio(svga, addr) && !gd54xx->blt.ms_is_dest && gd54xx->countminusone && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (!gd543x_do_mmio(svga, addr) && !gd54xx->blt.ms_is_dest && gd54xx->countminusone &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd54xx_mem_sys_src_write(gd54xx, val, 0);
return;
}
@@ -3028,7 +3136,8 @@ gd543x_mmio_writew(uint32_t addr, uint16_t val, void *priv)
gd543x_mmio_write(addr, val & 0xff, gd54xx);
gd543x_mmio_write(addr + 1, val >> 8, gd54xx);
} else if (gd54xx->mmio_vram_overlap) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd543x_mmio_write(addr, val & 0xff, gd54xx);
gd543x_mmio_write(addr + 1, val >> 8, gd54xx);
} else {
@@ -3050,7 +3159,8 @@ gd543x_mmio_writel(uint32_t addr, uint32_t val, void *priv)
gd543x_mmio_write(addr + 2, val >> 16, gd54xx);
gd543x_mmio_write(addr + 3, val >> 24, gd54xx);
} else if (gd54xx->mmio_vram_overlap) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
if (gd54xx->countminusone && !gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
gd543x_mmio_write(addr, val & 0xff, gd54xx);
gd543x_mmio_write(addr + 1, val >> 8, gd54xx);
gd543x_mmio_write(addr + 2, val >> 16, gd54xx);
@@ -3199,9 +3309,9 @@ gd543x_mmio_read(uint32_t addr, void *priv)
}
} else if (gd54xx->mmio_vram_overlap)
ret = gd54xx_read(addr, gd54xx);
else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED))
ret = gd54xx_mem_sys_dest_read(gd54xx, 0);
}
return ret;
}
@@ -3217,7 +3327,8 @@ gd543x_mmio_readw(uint32_t addr, void *priv)
ret = gd543x_mmio_read(addr, gd54xx) | (gd543x_mmio_read(addr + 1, gd54xx) << 8);
else if (gd54xx->mmio_vram_overlap)
ret = gd54xx_read(addr, gd54xx) | (gd54xx_read(addr + 1, gd54xx) << 8);
else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
ret = gd543x_mmio_read(addr, priv);
ret |= gd543x_mmio_read(addr + 1, priv) << 8;
return ret;
@@ -3234,10 +3345,14 @@ gd543x_mmio_readl(uint32_t addr, void *priv)
uint32_t ret = 0xffffffff;
if (gd543x_do_mmio(svga, addr))
ret = gd543x_mmio_read(addr, gd54xx) | (gd543x_mmio_read(addr + 1, gd54xx) << 8) | (gd543x_mmio_read(addr + 2, gd54xx) << 16) | (gd543x_mmio_read(addr + 3, gd54xx) << 24);
ret = gd543x_mmio_read(addr, gd54xx) | (gd543x_mmio_read(addr + 1, gd54xx) << 8) |
(gd543x_mmio_read(addr + 2, gd54xx) << 16) |
(gd543x_mmio_read(addr + 3, gd54xx) << 24);
else if (gd54xx->mmio_vram_overlap)
ret = gd54xx_read(addr, gd54xx) | (gd54xx_read(addr + 1, gd54xx) << 8) | (gd54xx_read(addr + 2, gd54xx) << 16) | (gd54xx_read(addr + 3, gd54xx) << 24);
else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest && !(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
ret = gd54xx_read(addr, gd54xx) | (gd54xx_read(addr + 1, gd54xx) << 8) |
(gd54xx_read(addr + 2, gd54xx) << 16) | (gd54xx_read(addr + 3, gd54xx) << 24);
else if (gd54xx->countminusone && gd54xx->blt.ms_is_dest &&
!(gd54xx->blt.status & CIRRUS_BLT_PAUSED)) {
ret = gd543x_mmio_read(addr, priv);
ret |= gd543x_mmio_read(addr + 1, priv) << 8;
ret |= gd543x_mmio_read(addr + 2, priv) << 16;
@@ -3379,20 +3494,25 @@ gd54xx_blit(gd54xx_t *gd54xx, uint8_t mask, uint8_t *dst, uint8_t target, int sk
int is_transp;
int is_bgonly;
/* skip indicates whether or not it is a pixel to be skipped (used for left skip);
/*
skip indicates whether or not it is a pixel to be skipped (used for left skip);
mask indicates transparency or not (only when transparent comparison is enabled):
color expand: direct pattern bit; 1 = write, 0 = do not write
(the other way around in inverse mode);
normal 8-bpp or 16-bpp: does not match transparent color = write,
matches transparent color = do not write */
color expand: direct pattern bit; 1 = write, 0 = do not write
(the other way around in inverse mode);
normal 8-bpp or 16-bpp: does not match transparent color = write,
matches transparent color = do not write
*/
/* Make sure to always ignore transparency and skip in case of mem sys dest. */
is_transp = (gd54xx->blt.mode & CIRRUS_BLTMODE_MEMSYSDEST) ? 0 : (gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP);
is_bgonly = (gd54xx->blt.mode & CIRRUS_BLTMODE_MEMSYSDEST) ? 0 : (gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_BACKGROUNDONLY);
is_transp = (gd54xx->blt.mode & CIRRUS_BLTMODE_MEMSYSDEST) ?
0 : (gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP);
is_bgonly = (gd54xx->blt.mode & CIRRUS_BLTMODE_MEMSYSDEST) ?
0 : (gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_BACKGROUNDONLY);
skip = (gd54xx->blt.mode & CIRRUS_BLTMODE_MEMSYSDEST) ? 0 : skip;
if (is_transp) {
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) && (gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_COLOREXPINV))
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) &&
(gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_COLOREXPINV))
mask = !mask;
/* If mask is 1 and it is not a pixel to be skipped, write it. */
@@ -3531,9 +3651,9 @@ gd54xx_mem_sys_src(gd54xx_t *gd54xx, uint32_t cpu_dat, uint32_t count)
gd54xx->countminusone = 1;
gd54xx->blt.sys_src32 = 0x00000000;
gd54xx->blt.sys_cnt = 0;
return;
} else if (gd54xx->countminusone) {
if (!(gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) || (gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)) {
if (!(gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) ||
(gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)) {
if (!gd54xx->blt.xx_count && !gd54xx->blt.x_count)
byte_pos = (((gd54xx->blt.mask >> 5) & 3) << 3);
else
@@ -3541,6 +3661,9 @@ gd54xx_mem_sys_src(gd54xx_t *gd54xx, uint32_t cpu_dat, uint32_t count)
mask_shift = 31 - byte_pos;
if (!(gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND))
cpu_dat >>= byte_pos;
else if (gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
cpu_dat = ((cpu_dat & 0xff000000) >> 24) | ((cpu_dat & 0x00ff0000) >> 8) |
((cpu_dat & 0x0000ff00) << 8) | ((cpu_dat & 0x000000ff) << 24);
} else
mask_shift = 7;
@@ -3557,7 +3680,8 @@ gd54xx_mem_sys_src(gd54xx_t *gd54xx, uint32_t cpu_dat, uint32_t count)
target = *dst;
gd54xx_rop(gd54xx, &target, &target, &exp);
if ((gd54xx->blt.pixel_width == 3) && (gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND))
gd54xx_blit(gd54xx, bitmask, dst, target, ((gd54xx->blt.x_count + gd54xx->blt.xx_count) < gd54xx->blt.pattern_x));
gd54xx_blit(gd54xx, bitmask, dst, target,
((gd54xx->blt.x_count + gd54xx->blt.xx_count) < gd54xx->blt.pattern_x));
else
gd54xx_blit(gd54xx, bitmask, dst, target, (gd54xx->blt.x_count < gd54xx->blt.pattern_x));
@@ -3585,13 +3709,14 @@ gd54xx_mem_sys_src(gd54xx_t *gd54xx, uint32_t cpu_dat, uint32_t count)
if (!gd54xx->blt.x_count) {
gd54xx->blt.y_count = (gd54xx->blt.y_count + 1) % (gd54xx->blt.height + 1);
if (gd54xx->blt.y_count)
gd54xx->blt.dst_addr_backup = gd54xx->blt.dst_addr + (gd54xx->blt.dst_pitch * gd54xx->blt.y_count * gd54xx->blt.dir);
else {
gd54xx->blt.dst_addr_backup = gd54xx->blt.dst_addr +
(gd54xx->blt.dst_pitch * gd54xx->blt.y_count *
gd54xx->blt.dir);
else
/* If we're here, the blit is over, reset. */
gd54xx_reset_blit(gd54xx);
}
/* Stop blitting and request new data if end of line reached. */
return;
break;
}
}
}
@@ -3642,12 +3767,15 @@ gd54xx_normal_blit(uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
mask = !mask;
/* This handles 8bpp and 16bpp non-color-expanding transparent comparisons. */
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) && !(gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) && ((gd54xx->blt.mode & CIRRUS_BLTMODE_PIXELWIDTHMASK) <= CIRRUS_BLTMODE_PIXELWIDTH16) && (src != ((gd54xx->blt.trans_mask >> (shift << 3)) & 0xff)))
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) &&
!(gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) &&
((gd54xx->blt.mode & CIRRUS_BLTMODE_PIXELWIDTHMASK) <= CIRRUS_BLTMODE_PIXELWIDTH16) &&
(src != ((gd54xx->blt.trans_mask >> (shift << 3)) & 0xff)))
mask = 0;
if (((gd54xx->blt.width - width) >= gd54xx->blt.pattern_x) && !((gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) && !mask)) {
if (((gd54xx->blt.width - width) >= gd54xx->blt.pattern_x) &&
!((gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) && !mask))
svga->vram[dst_addr & gd54xx->vram_mask] = dst;
}
dst_addr += gd54xx->blt.dir;
gd54xx->blt.x_count++;
@@ -3661,14 +3789,16 @@ gd54xx_normal_blit(uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
width--;
if (width == 0xffff) {
width = gd54xx->blt.width;
dst_addr = gd54xx->blt.dst_addr_backup = gd54xx->blt.dst_addr_backup + (gd54xx->blt.dst_pitch * gd54xx->blt.dir);
dst_addr = gd54xx->blt.dst_addr_backup = gd54xx->blt.dst_addr_backup +
(gd54xx->blt.dst_pitch * gd54xx->blt.dir);
gd54xx->blt.y_count = (gd54xx->blt.y_count + gd54xx->blt.dir) & 7;
if (gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) {
if (gd54xx->blt.x_count != 0)
src_addr++;
} else
src_addr = gd54xx->blt.src_addr_backup = gd54xx->blt.src_addr_backup + (gd54xx->blt.src_pitch * gd54xx->blt.dir);
src_addr = gd54xx->blt.src_addr_backup = gd54xx->blt.src_addr_backup +
(gd54xx->blt.src_pitch * gd54xx->blt.dir);
dst_addr &= gd54xx->vram_mask;
gd54xx->blt.dst_addr_backup &= gd54xx->vram_mask;
@@ -3679,8 +3809,7 @@ gd54xx_normal_blit(uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
gd54xx->blt.height_internal--;
if (gd54xx->blt.height_internal == 0xffff) {
gd54xx_reset_blit(gd54xx);
return;
break;
}
}
}
@@ -3714,7 +3843,8 @@ gd54xx_mem_sys_dest(uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
gd54xx->blt.msd_buf_pos = 0;
while (gd54xx->blt.msd_buf_pos < 32) {
gd54xx->blt.msd_buf[gd54xx->blt.msd_buf_pos & 0x1f] = svga->vram[gd54xx->blt.src_addr_backup & gd54xx->vram_mask];
gd54xx->blt.msd_buf[gd54xx->blt.msd_buf_pos & 0x1f] = svga->vram[gd54xx->blt.src_addr_backup &
gd54xx->vram_mask];
gd54xx->blt.src_addr_backup += gd54xx->blt.dir;
gd54xx->blt.msd_buf_pos++;
@@ -3724,17 +3854,21 @@ gd54xx_mem_sys_dest(uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
gd54xx->blt.y_count = (gd54xx->blt.y_count + 1) % (gd54xx->blt.height + 1);
if (gd54xx->blt.y_count)
gd54xx->blt.src_addr_backup = gd54xx->blt.src_addr + (gd54xx->blt.src_pitch * gd54xx->blt.y_count * gd54xx->blt.dir);
gd54xx->blt.src_addr_backup = gd54xx->blt.src_addr +
(gd54xx->blt.src_pitch * gd54xx->blt.y_count * gd54xx->blt.dir);
else
gd54xx->countminusone = 2; /* Signal end of blit. */
/* End of line reached, stop and notify regardless of how much we already transferred. */
goto request_more_data;
break;
}
}
/* End of while. */
request_more_data:
/* If the byte count we have blitted are not divisible by 4, round them up. */
/*
End of while.
If the byte count we have blitted are not divisible by 4,
round them up.
*/
if (gd54xx->blt.msd_buf_pos & 3)
gd54xx->blt.msd_buf_cnt = (gd54xx->blt.msd_buf_pos & ~3) + 4;
else
@@ -3747,7 +3881,9 @@ request_more_data:
static void
gd54xx_start_blit(uint32_t cpu_dat, uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
{
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_BACKWARDS) && !(gd54xx->blt.mode & (CIRRUS_BLTMODE_PATTERNCOPY | CIRRUS_BLTMODE_COLOREXPAND)) && !(gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP))
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_BACKWARDS) &&
!(gd54xx->blt.mode & (CIRRUS_BLTMODE_PATTERNCOPY | CIRRUS_BLTMODE_COLOREXPAND)) &&
!(gd54xx->blt.mode & CIRRUS_BLTMODE_TRANSPARENTCOMP))
gd54xx->blt.dir = -1;
else
gd54xx->blt.dir = 1;
@@ -3758,7 +3894,8 @@ gd54xx_start_blit(uint32_t cpu_dat, uint32_t count, gd54xx_t *gd54xx, svga_t *sv
if (gd54xx->blt.pixel_width == 3)
gd54xx->blt.pattern_x = gd54xx->blt.mask & 0x1f; /* (Mask & 0x1f) bytes. */
else
gd54xx->blt.pattern_x = (gd54xx->blt.mask & 0x07) * gd54xx->blt.pixel_width; /* (Mask & 0x07) pixels. */
/* (Mask & 0x07) pixels. */
gd54xx->blt.pattern_x = (gd54xx->blt.mask & 0x07) * gd54xx->blt.pixel_width;
} else
gd54xx->blt.pattern_x = 0; /* No skip in normal blit mode. */
@@ -3798,7 +3935,8 @@ cl_pci_read(UNUSED(int func), int addr, void *priv)
break;
case PCI_REG_COMMAND:
ret = gd54xx->pci_regs[PCI_REG_COMMAND]; /*Respond to IO and memory accesses*/
/* Respond to IO and memory accesses */
ret = gd54xx->pci_regs[PCI_REG_COMMAND];
break;
case 0x07:
@@ -3912,8 +4050,10 @@ cl_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
break;
case 0x13:
/* 5480, like 5446 rev. B, has a 32 MB aperture, with the second set used for
BitBLT transfers. */
/*
5480, like 5446 rev. B, has a 32 MB aperture, with the second set used for
BitBLT transfers.
*/
if (svga->crtc[0x27] == CIRRUS_ID_CLGD5480)
val &= 0xfe;
gd54xx->lfb_base = val << 24;
@@ -3931,7 +4071,8 @@ cl_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
val &= 0xf0;
gd54xx->vgablt_base |= (val << byte);
mem_mapping_disable(&gd54xx->vgablt_mapping);
if ((gd54xx->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM) && (gd54xx->vgablt_base != 0x00000000) && (gd54xx->vgablt_base < 0xfff00000))
if ((gd54xx->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM) &&
(gd54xx->vgablt_base != 0x00000000) && (gd54xx->vgablt_base < 0xfff00000))
mem_mapping_set_addr(&gd54xx->vgablt_mapping, gd54xx->vgablt_base, 0x1000);
break;
@@ -4260,7 +4401,8 @@ gd54xx_init(const device_t *info)
svga->decode_mask = gd54xx->vram_mask;
if (gd54xx->bit32) {
mem_mapping_set_handler(&svga->mapping, gd54xx_read, gd54xx_readw, gd54xx_readl, gd54xx_write, gd54xx_writew, gd54xx_writel);
mem_mapping_set_handler(&svga->mapping, gd54xx_read, gd54xx_readw, gd54xx_readl,
gd54xx_write, gd54xx_writew, gd54xx_writel);
mem_mapping_add(&gd54xx->mmio_mapping, 0, 0,
gd543x_mmio_read, gd543x_mmio_readw, gd543x_mmio_readl,
gd543x_mmio_writeb, gd543x_mmio_writew, gd543x_mmio_writel,
@@ -4278,7 +4420,8 @@ gd54xx_init(const device_t *info)
gd5480_vgablt_write, gd5480_vgablt_writew, gd5480_vgablt_writel,
NULL, MEM_MAPPING_EXTERNAL, gd54xx);
} else {
mem_mapping_set_handler(&svga->mapping, gd54xx_read, gd54xx_readw, NULL, gd54xx_write, gd54xx_writew, NULL);
mem_mapping_set_handler(&svga->mapping, gd54xx_read, gd54xx_readw, NULL,
gd54xx_write, gd54xx_writew, NULL);
mem_mapping_add(&gd54xx->mmio_mapping, 0, 0,
gd543x_mmio_read, gd543x_mmio_readw, NULL,
gd543x_mmio_writeb, gd543x_mmio_writew, NULL,
@@ -4306,6 +4449,9 @@ gd54xx_init(const device_t *info)
mem_mapping_disable(&gd54xx->bios_rom.mapping);
}
if ((id <= CIRRUS_ID_CLGD5429) || (!gd54xx->pci && !gd54xx->vlb))
mem_mapping_set_base_ignore(&gd54xx->linear_mapping, 0xff000000);
mem_mapping_set_p(&svga->mapping, gd54xx);
mem_mapping_disable(&gd54xx->mmio_mapping);
mem_mapping_disable(&gd54xx->linear_mapping);

View File

@@ -4312,7 +4312,7 @@ s3_recalctimings(svga_t *svga)
}
}
if ((s3->chip == S3_TRIO32) || (s3->chip == S3_TRIO64) || (s3->chip == S3_VISION864))
if ((s3->chip == S3_TRIO32) || (s3->chip == S3_TRIO64) || (s3->chip == S3_VISION864) || (s3->chip == S3_VISION868) || (s3->chip == S3_VISION968))
svga->hoverride = 1;
else
svga->hoverride = 0;
@@ -8337,7 +8337,13 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, voi
if (update) {
READ(s3->accel.dest + s3->accel.cx - s3->accel.minus, dest_dat);
MIX
if (s3_cpu_dest(s3)) {
if (vram_mask) {
MIX
}
} else {
MIX
}
if (s3->accel.cmd & 0x10) {
if (s3->accel.cmd == 0x41b3)