Abstracted away the machine bus'es and flags in order to make the rest of the emulator agnostic as to how they're stored.

This commit is contained in:
OBattler
2021-12-13 01:23:06 +01:00
parent 6fd2cfaf90
commit 6661ff5dcc
15 changed files with 82 additions and 57 deletions

View File

@@ -194,7 +194,7 @@ cart_reset(void)
cart_image_close(1);
cart_image_close(0);
if (!(machines[machine].flags & MACHINE_CARTRIDGE))
if (!machine_has_cartridge(machine))
return;
for (i = 0; i < 2; i++) {

View File

@@ -1063,7 +1063,7 @@ write_output(atkbd_t *dev, uint8_t val)
val |= ((dev->mem[0] << 4) & 0x10);
/*IRQ 12*/
if ((dev->output_port ^ val) & 0x20) {
if ((old ^ val) & 0x20) {
if (val & 0x20)
picint(1 << 12);
else
@@ -1071,14 +1071,14 @@ write_output(atkbd_t *dev, uint8_t val)
}
/*IRQ 1*/
if ((dev->output_port ^ val) & 0x10) {
if ((old ^ val) & 0x10) {
if (val & 0x10)
picint(1 << 1);
else
picintc(1 << 1);
}
if ((dev->output_port ^ val) & 0x02) { /*A20 enable change*/
if ((old ^ val) & 0x02) { /*A20 enable change*/
mem_a20_key = val & 0x02;
mem_a20_recalc();
flushmmucache();
@@ -1086,7 +1086,7 @@ write_output(atkbd_t *dev, uint8_t val)
/* 0 holds the CPU in the RESET state, 1 releases it. To simplify this,
we just do everything on release. */
if ((dev->output_port ^ val) & 0x01) { /*Reset*/
if ((old ^ val) & 0x01) { /*Reset*/
if (! (val & 0x01)) { /* Pin 0 selected. */
/* Pin 0 selected. */
kbd_log("write_output(): Pulse reset!\n");

View File

@@ -111,15 +111,15 @@ postcard_init(const device_t *info)
{
postcard_reset();
if (machines[machine].flags & MACHINE_MCA)
if (machine_has_bus(machine, MACHINE_BUS_MCA))
postcard_port = 0x680; /* MCA machines */
else if (strstr(machines[machine].name, " PS/2 ") || strstr(machines[machine].name, " PS/1 "))
else if (strstr(machines[machine].name, " PS/2 ") || strstr(machine_getname_ex(machine), " PS/1 "))
postcard_port = 0x190; /* ISA PS/2 machines */
else if (strstr(machines[machine].name, " IBM XT "))
postcard_port = 0x60; /* IBM XT */
else if (strstr(machines[machine].name, " IBM PCjr"))
postcard_port = 0x10; /* IBM PCjr */
else if (strstr(machines[machine].name, " Compaq ") && !(machines[machine].flags & MACHINE_PCI))
else if (strstr(machines[machine].name, " Compaq ") && !machine_has_bus(machine, MACHINE_BUS_PCI))
postcard_port = 0x84; /* ISA Compaq machines */
else
postcard_port = 0x80; /* AT and clone machines */