Revert "Merge branch 'master' of https://github.com/86Box/86Box"
This reverts commit7a4bddab3c, reversing changes made to416d4f673d.
This commit is contained in:
@@ -43,44 +43,30 @@ typedef struct acc2168_t
|
||||
} acc2168_t;
|
||||
|
||||
|
||||
/*
|
||||
Based on reverse engineering using the AMI 386DX Clone BIOS:
|
||||
Bit 0 of register 02 controls shadowing of C0000-C7FFF (1 = enabled, 0 = disabled);
|
||||
Bit 1 of register 02 controls shadowing of C8000-CFFFF (1 = enabled, 0 = disabled);
|
||||
Bit 2 of register 02 controls shadowing of D0000-DFFFF (1 = enabled, 0 = disabled);
|
||||
Bit 3 of register 02 controls shadowing of E0000-EFFFF (1 = enabled, 0 = disabled);
|
||||
Bit 4 of register 02 controls shadowing of F0000-FFFFF (1 = enabled, 0 = disabled);
|
||||
Bit 5 is most likely: 1 = shadow enabled, 0 = shadow disabled;
|
||||
Bit 6 of register 02 controls shadow RAM cacheability (1 = cacheable, 0 = non-cacheable).
|
||||
*/
|
||||
|
||||
static void
|
||||
acc2168_shadow_recalc(acc2168_t *dev)
|
||||
{
|
||||
if (dev->regs[0x02] & 8) {
|
||||
switch (dev->regs[0x02] & 0x30) {
|
||||
case 0x00:
|
||||
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_EXTANY | MEM_WRITE_INTERNAL);
|
||||
break;
|
||||
case 0x10:
|
||||
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||
break;
|
||||
case 0x20:
|
||||
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
break;
|
||||
case 0x30:
|
||||
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_INTERNAL | MEM_WRITE_EXTANY);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
mem_set_mem_state(0xf0000, 0x10000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
int state;
|
||||
|
||||
if (dev->regs[0x02] & 4) {
|
||||
switch (dev->regs[0x02] & 0x30) {
|
||||
case 0x00:
|
||||
mem_set_mem_state(0xe0000, 0x10000, MEM_READ_EXTANY | MEM_WRITE_INTERNAL);
|
||||
break;
|
||||
case 0x10:
|
||||
mem_set_mem_state(0xe0000, 0x10000, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||
break;
|
||||
case 0x20:
|
||||
mem_set_mem_state(0xe0000, 0x10000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
break;
|
||||
case 0x30:
|
||||
mem_set_mem_state(0xe0000, 0x10000, MEM_READ_INTERNAL | MEM_WRITE_EXTANY);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
mem_set_mem_state(0xe0000, 0x10000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
if (dev->regs[0x02] & 0x20)
|
||||
state = (dev->regs[0x02] & 0x20) ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
|
||||
mem_set_mem_state(0xc0000, 0x08000, (dev->regs[0x02] & 0x01) ? state : (MEM_READ_EXTANY | MEM_WRITE_EXTANY));
|
||||
mem_set_mem_state(0xc8000, 0x08000, (dev->regs[0x02] & 0x02) ? state : (MEM_READ_EXTANY | MEM_WRITE_EXTANY));
|
||||
mem_set_mem_state(0xd0000, 0x10000, (dev->regs[0x02] & 0x04) ? state : (MEM_READ_EXTANY | MEM_WRITE_EXTANY));
|
||||
mem_set_mem_state(0xe0000, 0x10000, (dev->regs[0x02] & 0x08) ? state : (MEM_READ_EXTANY | MEM_WRITE_EXTANY));
|
||||
mem_set_mem_state(0xf0000, 0x10000, (dev->regs[0x02] & 0x10) ? state : (MEM_READ_EXTANY | MEM_WRITE_EXTANY));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ enum
|
||||
INTEL_430VX,
|
||||
INTEL_430TX,
|
||||
INTEL_440FX,
|
||||
INTEL_440LX,
|
||||
INTEL_440EX,
|
||||
INTEL_440BX,
|
||||
INTEL_440ZX
|
||||
};
|
||||
@@ -94,7 +96,7 @@ i4x0_smram_handler_phase0(i4x0_t *dev)
|
||||
|
||||
/* Disable any active mappings. */
|
||||
if (dev->type >= INTEL_430FX) {
|
||||
if (dev->type >= INTEL_440BX) {
|
||||
if (dev->type >= INTEL_440LX) {
|
||||
/* Disable high extended SMRAM. */
|
||||
/* TODO: This area should point to A0000-FFFFF. */
|
||||
for (i = 0x100a0000; i < 0x100fffff; i += MEM_GRANULARITY_SIZE) {
|
||||
@@ -257,7 +259,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
regs[0x04] = (regs[0x04] & ~0x42) | (val & 0x42);
|
||||
break;
|
||||
case INTEL_430FX: case INTEL_430FX_PB640: case INTEL_430HX: case INTEL_430VX: case INTEL_430TX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX: case INTEL_440EX:
|
||||
regs[0x04] = (regs[0x04] & ~0x02) | (val & 0x02);
|
||||
break;
|
||||
}
|
||||
@@ -265,7 +267,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x05:
|
||||
switch (dev->type) {
|
||||
case INTEL_420TX: case INTEL_420ZX: case INTEL_430LX: case INTEL_430NX: case INTEL_430HX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX: case INTEL_440EX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x05] = (regs[0x05] & ~0x01) | (val & 0x01);
|
||||
break;
|
||||
@@ -278,6 +280,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
regs[0x07] &= ~(val & 0x70);
|
||||
break;
|
||||
case INTEL_430FX: case INTEL_430FX_PB640: case INTEL_430VX: case INTEL_430TX:
|
||||
case INTEL_440LX: case INTEL_440EX:
|
||||
regs[0x07] &= ~(val & 0x30);
|
||||
break;
|
||||
case INTEL_440FX:
|
||||
@@ -331,6 +334,14 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x34:
|
||||
switch (dev->type) {
|
||||
case INTEL_440LX: case INTEL_440EX:
|
||||
regs[0x34] = (val & 0xa0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x4f:
|
||||
switch (dev->type) {
|
||||
case INTEL_430HX:
|
||||
@@ -365,6 +376,12 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_440FX:
|
||||
regs[0x50] = (val & 0xf4);
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
regs[0x50] = (val & 0x03);
|
||||
break;
|
||||
case INTEL_440EX:
|
||||
regs[0x50] = (val & 0x23);
|
||||
break;
|
||||
case INTEL_440BX:
|
||||
regs[0x50] = (regs[0x50] & 0x14) | (val & 0xeb);
|
||||
break;
|
||||
@@ -382,6 +399,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_440FX:
|
||||
regs[0x51] = (val & 0xc3);
|
||||
break;
|
||||
case INTEL_440LX: case INTEL_440EX:
|
||||
regs[0x51] = (val & 0x80);
|
||||
break;
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x51] = (regs[0x50] & 0x70) | (val & 0x8f);
|
||||
break;
|
||||
@@ -400,6 +420,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_440FX:
|
||||
regs[0x52] = val;
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
regs[0x52] = (val & 0xd0);
|
||||
break;
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x52] = val & 0x07;
|
||||
break;
|
||||
@@ -417,7 +440,10 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430VX: case INTEL_430TX:
|
||||
regs[0x53] = val & 0x3f;
|
||||
break;
|
||||
case INTEL_440BX:
|
||||
case INTEL_440LX:
|
||||
regs[0x53] = val & 0x0a;
|
||||
break;
|
||||
case INTEL_440EX: case INTEL_440BX:
|
||||
/* Not applicable to 440ZX as that does not support ECC. */
|
||||
regs[0x53] = val;
|
||||
break;
|
||||
@@ -438,6 +464,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_440FX:
|
||||
regs[0x54] = val & 0x82;
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
regs[0x54] = val;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x55:
|
||||
@@ -445,7 +474,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430VX: case INTEL_430TX:
|
||||
regs[0x55] = val & 0x01;
|
||||
break;
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
regs[0x55] = val;
|
||||
break;
|
||||
}
|
||||
@@ -461,7 +491,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430TX:
|
||||
regs[0x56] = val & 0x76;
|
||||
break;
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
regs[0x56] = val;
|
||||
break;
|
||||
}
|
||||
@@ -472,7 +503,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430LX: default:
|
||||
regs[0x57] = val & 0x3f;
|
||||
break;
|
||||
case INTEL_430NX:
|
||||
case INTEL_430NX: case INTEL_440EX:
|
||||
regs[0x57] = val;
|
||||
break;
|
||||
case INTEL_430FX: case INTEL_430FX_PB640:
|
||||
@@ -485,6 +516,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_440FX:
|
||||
regs[0x57] = val & 0x77;
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
regs[0x57] = val & 0x11;
|
||||
break;
|
||||
case INTEL_440BX:
|
||||
regs[0x57] = val & 0x3f;
|
||||
break;
|
||||
@@ -499,7 +533,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430LX: default:
|
||||
regs[0x58] = val & 0x01;
|
||||
break;
|
||||
case INTEL_430NX:
|
||||
case INTEL_430NX: case INTEL_440LX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x58] = val & 0x03;
|
||||
break;
|
||||
@@ -513,6 +547,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430TX:
|
||||
regs[0x57] = val & 0x7b;
|
||||
break;
|
||||
case INTEL_440EX:
|
||||
regs[0x58] = val & 0xbf;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x59: /* PAM0 */
|
||||
@@ -576,7 +613,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_420TX: case INTEL_420ZX:
|
||||
case INTEL_430LX: case INTEL_430NX:
|
||||
case INTEL_430HX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440LX: case INTEL_440EX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
default:
|
||||
regs[addr] = val;
|
||||
@@ -596,6 +634,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430LX: case INTEL_430NX:
|
||||
case INTEL_430HX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440LX: case INTEL_440EX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
@@ -610,7 +649,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x66:
|
||||
switch (dev->type) {
|
||||
case INTEL_430NX: case INTEL_430HX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
@@ -619,7 +659,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x67:
|
||||
switch (dev->type) {
|
||||
case INTEL_430NX: case INTEL_430HX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
@@ -640,7 +681,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430FX: case INTEL_430FX_PB640:
|
||||
regs[0x68] = val & 0x1f;
|
||||
break;
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
regs[0x68] = val & 0xc0;
|
||||
break;
|
||||
case INTEL_440BX:
|
||||
@@ -668,6 +710,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x6a: case 0x6b:
|
||||
switch (dev->type) {
|
||||
case INTEL_430NX:
|
||||
case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
case INTEL_440BX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
@@ -681,6 +725,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
case 0x6c: case 0x6d: case 0x6e:
|
||||
switch (dev->type) {
|
||||
case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
case INTEL_440BX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
@@ -692,6 +738,14 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x6f:
|
||||
switch (dev->type){
|
||||
case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x70:
|
||||
switch (dev->type) {
|
||||
case INTEL_420TX: case INTEL_420ZX:
|
||||
@@ -704,7 +758,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430VX: case INTEL_430TX:
|
||||
regs[addr] = val & 0xfc;
|
||||
break;
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
regs[addr] = val & 0xf8;
|
||||
break;
|
||||
}
|
||||
@@ -715,10 +770,10 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_430LX:
|
||||
regs[addr] = val & 0x4d;
|
||||
break;
|
||||
case INTEL_430TX:
|
||||
case INTEL_430TX: case INTEL_440EX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
regs[addr] = val & 0x1f;
|
||||
break;
|
||||
}
|
||||
@@ -853,6 +908,12 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case INTEL_440FX:
|
||||
regs[0x80] = val & 0x1b;
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
regs[0x80] = val & 0x08;
|
||||
break;
|
||||
case INTEL_440EX:
|
||||
regs[0x80] = val & 0x18;
|
||||
break;
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x7c] = val;
|
||||
break;
|
||||
@@ -861,7 +922,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x91:
|
||||
switch (dev->type) {
|
||||
case INTEL_430HX: case INTEL_440BX:
|
||||
case INTEL_440FX:
|
||||
case INTEL_440FX: case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
/* Not applicable on 82443ZX. */
|
||||
regs[0x91] &= ~(val & 0x11);
|
||||
break;
|
||||
@@ -869,6 +931,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
case 0x92:
|
||||
switch (dev->type) {
|
||||
case INTEL_440LX: case INTEL_440EX:
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x92] &= ~(val & 0x1f);
|
||||
break;
|
||||
@@ -877,6 +940,8 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
case 0x93:
|
||||
switch (dev->type) {
|
||||
case INTEL_440FX:
|
||||
case INTEL_440LX:
|
||||
case INTEL_440EX:
|
||||
regs[0x93] = (val & 0x0f);
|
||||
trc_write(0x0093, val & 0x06, NULL);
|
||||
break;
|
||||
@@ -898,6 +963,9 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
case 0xb1:
|
||||
switch (dev->type) {
|
||||
case INTEL_440EX:
|
||||
regs[0xb1] = (val & 0x22);
|
||||
break;
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0xb1] = (val & 0xa0);
|
||||
break;
|
||||
@@ -918,7 +986,31 @@ i4x0_write(int func, int addr, uint8_t val, void *priv)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xba: case 0xbb:
|
||||
switch (dev->type) {
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[addr] = val;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xbc:
|
||||
switch (dev->type) {
|
||||
case INTEL_440EX:
|
||||
regs[addr] = (val & 0xf8);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xbd:
|
||||
switch (dev->type) {
|
||||
case INTEL_440EX:
|
||||
regs[addr] = (val & 0xf8);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
|
||||
switch (dev->type) {
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
@@ -1097,7 +1189,7 @@ i4x0_reset(void *priv)
|
||||
else
|
||||
i4x0_write(0, 0x72, 0x00, priv);
|
||||
|
||||
if ((dev->type == INTEL_440BX) || (dev->type == INTEL_440ZX)) {
|
||||
if ((dev->type == INTEL_440LX) || (dev->type == INTEL_440BX) || (dev->type == INTEL_440ZX)) {
|
||||
for (i = 0; i <= dev->max_func; i++)
|
||||
memset(dev->regs_locked[i], 0x00, 256 * sizeof(uint8_t));
|
||||
}
|
||||
@@ -1268,6 +1360,50 @@ static void
|
||||
regs[0x71] = 0x10;
|
||||
regs[0x72] = 0x02;
|
||||
break;
|
||||
case INTEL_440LX:
|
||||
dev->max_func = 1;
|
||||
|
||||
regs[0x02] = 0x80; regs[0x03] = 0x71; /* 82443LX */
|
||||
regs[0x06] = 0x90;
|
||||
regs[0x10] = 0x08;
|
||||
regs[0x34] = 0xa0;
|
||||
if (cpu_busspeed <= 66666667)
|
||||
regs[0x51] |= 0x00;
|
||||
else if ((cpu_busspeed > 66666667) && (cpu_busspeed <= 100000000))
|
||||
regs[0x51] |= 0x20;
|
||||
regs[0x53] = 0x83;
|
||||
regs[0x57] = 0x28;
|
||||
regs[0x60] = regs[0x61] = regs[0x62] = regs[0x63] = regs[0x64] = regs[0x65] = regs[0x66] = regs[0x67] = 0x01;
|
||||
regs[0x6c] = regs[0x6d] = regs[0x6e] = regs[0x6f] = 0x55;
|
||||
regs[0x72] = 0x02;
|
||||
regs[0xa0] = 0x02;
|
||||
regs[0xa2] = 0x10;
|
||||
regs[0xa4] = 0x03;
|
||||
regs[0xa5] = 0x02;
|
||||
regs[0xa7] = 0x1f;
|
||||
break;
|
||||
case INTEL_440EX:
|
||||
dev->max_func = 1;
|
||||
|
||||
regs[0x02] = 0x80; regs[0x03] = 0x71; /* 82443EX. Same Vendor ID as 440LX*/
|
||||
regs[0x06] = 0x90;
|
||||
regs[0x10] = 0x08;
|
||||
regs[0x34] = 0xa0;
|
||||
if (cpu_busspeed <= 66666667)
|
||||
regs[0x51] |= 0x00;
|
||||
else if ((cpu_busspeed > 66666667) && (cpu_busspeed <= 100000000))
|
||||
regs[0x51] |= 0x20;
|
||||
regs[0x53] = 0x83;
|
||||
regs[0x57] = 0x28;
|
||||
regs[0x60] = regs[0x61] = regs[0x62] = regs[0x63] = regs[0x64] = regs[0x65] = regs[0x66] = regs[0x67] = 0x01;
|
||||
regs[0x6c] = regs[0x6d] = regs[0x6e] = regs[0x6f] = 0x55;
|
||||
regs[0x72] = 0x02;
|
||||
regs[0xa0] = 0x02;
|
||||
regs[0xa2] = 0x10;
|
||||
regs[0xa4] = 0x03;
|
||||
regs[0xa5] = 0x02;
|
||||
regs[0xa7] = 0x1f;
|
||||
break;
|
||||
case INTEL_440BX: case INTEL_440ZX:
|
||||
regs[0x7a] = (info->local >> 8) & 0xff;
|
||||
dev->max_func = (regs[0x7a] & 0x02) ? 0 : 1;
|
||||
@@ -1313,6 +1449,20 @@ static void
|
||||
i4x0_write(regs[0x5f], 0x5f, 0x00, dev);
|
||||
i4x0_write(regs[0x72], 0x72, 0x00, dev);
|
||||
|
||||
if (((dev->type == INTEL_440LX) || (dev->type == INTEL_440EX)) && (dev->max_func == 1)) {
|
||||
regs = (uint8_t *) dev->regs[1];
|
||||
|
||||
regs[0x00] = 0x86; regs[0x01] = 0x80; /* Intel */
|
||||
regs[0x02] = 0x81; regs[0x03] = 0x71; /* 82443LX */
|
||||
regs[0x06] = 0xa0; regs[0x07] = 0x02;
|
||||
regs[0x0a] = 0x04; regs[0x0b] = 0x06;
|
||||
regs[0x0e] = 0x01;
|
||||
regs[0x1c] = 0xf0;
|
||||
regs[0x1e] = 0xa0; regs[0x1f] = 0x02;
|
||||
regs[0x20] = 0xf0; regs[0x21] = 0xff;
|
||||
regs[0x24] = 0xf0; regs[0x25] = 0xff;
|
||||
}
|
||||
|
||||
if (((dev->type == INTEL_440BX) || (dev->type == INTEL_440ZX)) && (dev->max_func == 1)) {
|
||||
regs = (uint8_t *) dev->regs[1];
|
||||
|
||||
@@ -1484,6 +1634,34 @@ const device_t i440fx_device =
|
||||
NULL
|
||||
};
|
||||
|
||||
const device_t i440lx_device =
|
||||
{
|
||||
"Intel 82443LX",
|
||||
DEVICE_PCI,
|
||||
INTEL_440LX,
|
||||
i4x0_init,
|
||||
i4x0_close,
|
||||
i4x0_reset,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
const device_t i440ex_device =
|
||||
{
|
||||
"Intel 82443EX",
|
||||
DEVICE_PCI,
|
||||
INTEL_440EX,
|
||||
i4x0_init,
|
||||
i4x0_close,
|
||||
i4x0_reset,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t i440bx_device =
|
||||
{
|
||||
|
||||
125
src/chipset/opti5x7.c
Normal file
125
src/chipset/opti5x7.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*Based off the OPTI 82C546/82C547 datasheet.
|
||||
The earlier 596/597 appears to be register compatible with the 546/547 from testing.*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/timer.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/port_92.h>
|
||||
#include <86box/chipset.h>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t cur_reg,
|
||||
regs[64];
|
||||
port_92_t *port_92;
|
||||
} opti5x7_t;
|
||||
|
||||
static void
|
||||
opti5x7_recalcmapping(opti5x7_t *dev)
|
||||
{
|
||||
uint32_t shflags = 0;
|
||||
|
||||
shadowbios = 0;
|
||||
shadowbios_write = 0;
|
||||
|
||||
|
||||
shadowbios |= !!(dev->regs[0x06] & 0x05);
|
||||
shadowbios_write |= !!(dev->regs[0x06] & 0x0a);
|
||||
|
||||
shflags = (dev->regs[0x06] & 0x01) ? MEM_READ_INTERNAL : MEM_READ_EXTANY;
|
||||
shflags |= (dev->regs[0x06] & 0x02) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTANY;
|
||||
mem_set_mem_state(0xe0000, 0x10000, shflags);
|
||||
|
||||
shflags = (dev->regs[0x06] & 0x04) ? MEM_READ_INTERNAL : MEM_READ_EXTANY;
|
||||
shflags |= (dev->regs[0x06] & 0x08) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTANY;
|
||||
mem_set_mem_state(0xf0000, 0x10000, shflags);
|
||||
|
||||
flushmmucache();
|
||||
}
|
||||
static void
|
||||
opti5x7_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
opti5x7_t *dev = (opti5x7_t *) priv;
|
||||
// pclog("Write %02x to OPTi 5x7 address %02x\n", val, addr);
|
||||
|
||||
switch (addr) {
|
||||
case 0x22:
|
||||
dev->cur_reg = val;
|
||||
break;
|
||||
case 0x24:
|
||||
dev->regs[dev->cur_reg] = val;
|
||||
if (dev->cur_reg == 0x02) {
|
||||
cpu_cache_ext_enabled = val & 0x10;
|
||||
}
|
||||
if (dev->cur_reg == 0x06) {
|
||||
opti5x7_recalcmapping(dev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
opti5x7_read(uint16_t addr, void *priv)
|
||||
{
|
||||
uint8_t ret = 0xff;
|
||||
opti5x7_t *dev = (opti5x7_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x24:
|
||||
// pclog("Read from OPTI 5x7 register %02x\n", dev->cur_reg);
|
||||
ret = dev->regs[dev->cur_reg];
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
opti5x7_close(void *priv)
|
||||
{
|
||||
opti5x7_t *dev = (opti5x7_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
opti5x7_init(const device_t *info)
|
||||
{
|
||||
opti5x7_t *dev = (opti5x7_t *) malloc(sizeof(opti5x7_t));
|
||||
memset(dev, 0, sizeof(opti5x7_t));
|
||||
|
||||
io_sethandler(0x0022, 0x0001, opti5x7_read, NULL, NULL, opti5x7_write, NULL, NULL, dev);
|
||||
io_sethandler(0x0024, 0x0001, opti5x7_read, NULL, NULL, opti5x7_write, NULL, NULL, dev);
|
||||
|
||||
dev->port_92 = device_add(&port_92_device);
|
||||
// pclog("OPTi 5x7 init\n");
|
||||
opti5x7_recalcmapping(dev);
|
||||
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
const device_t opti5x7_device = {
|
||||
"OPTi 82C5x6/82C5x7",
|
||||
0,
|
||||
0,
|
||||
opti5x7_init, opti5x7_close, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
150
src/chipset/rabbit.c
Normal file
150
src/chipset/rabbit.c
Normal file
@@ -0,0 +1,150 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/timer.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/chipset.h>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t cur_reg, tries,
|
||||
regs[258];
|
||||
} rabbit_t;
|
||||
|
||||
|
||||
static void
|
||||
rabbit_recalcmapping(rabbit_t *dev)
|
||||
{
|
||||
uint32_t shread, shwrite;
|
||||
uint32_t shflags = 0;
|
||||
|
||||
shread = !!(dev->regs[0x101] & 0x40);
|
||||
shwrite = !!(dev->regs[0x100] & 0x02);
|
||||
|
||||
shflags = shread ? MEM_READ_INTERNAL : MEM_READ_EXTANY;
|
||||
shflags |= shwrite ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTANY;
|
||||
|
||||
shadowbios = !!shread;
|
||||
shadowbios_write = !!shwrite;
|
||||
|
||||
#ifdef USE_SHADOW_C0000
|
||||
mem_set_mem_state(0x000c0000, 0x00040000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
#else
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
#endif
|
||||
|
||||
switch (dev->regs[0x100] & 0x09) {
|
||||
case 0x01:
|
||||
/* The one BIOS we use seems to use something else to control C0000-DFFFF shadow,
|
||||
no idea what. */
|
||||
#ifdef USE_SHADOW_C0000
|
||||
/* 64K at 0C0000-0CFFFF */
|
||||
mem_set_mem_state(0x000c0000, 0x00010000, shflags);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case 0x00:
|
||||
/* 64K at 0F0000-0FFFFF */
|
||||
mem_set_mem_state(0x000f0000, 0x00010000, shflags);
|
||||
break;
|
||||
|
||||
case 0x09:
|
||||
#ifdef USE_SHADOW_C0000
|
||||
/* 128K at 0C0000-0DFFFF */
|
||||
mem_set_mem_state(0x000c0000, 0x00020000, shflags);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case 0x08:
|
||||
/* 128K at 0E0000-0FFFFF */
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, shflags);
|
||||
break;
|
||||
}
|
||||
|
||||
flushmmucache();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rabbit_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x22:
|
||||
dev->cur_reg = val;
|
||||
dev->tries = 0;
|
||||
break;
|
||||
case 0x23:
|
||||
if (dev->cur_reg == 0x83) {
|
||||
if (dev->tries < 0x02) {
|
||||
dev->regs[dev->tries++ | 0x100] = val;
|
||||
if (dev->tries == 0x02)
|
||||
rabbit_recalcmapping(dev);
|
||||
}
|
||||
} else
|
||||
dev->regs[dev->cur_reg] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
rabbit_read(uint16_t addr, void *priv)
|
||||
{
|
||||
uint8_t ret = 0xff;
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x23:
|
||||
if (dev->cur_reg == 0x83) {
|
||||
if (dev->tries < 0x02)
|
||||
ret = dev->regs[dev->tries++ | 0x100];
|
||||
} else
|
||||
ret = dev->regs[dev->cur_reg];
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rabbit_close(void *priv)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
rabbit_init(const device_t *info)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) malloc(sizeof(rabbit_t));
|
||||
memset(dev, 0, sizeof(rabbit_t));
|
||||
|
||||
io_sethandler(0x0022, 0x0002, rabbit_read, NULL, NULL, rabbit_write, NULL, NULL, dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
const device_t rabbit_device = {
|
||||
"SiS Rabbit",
|
||||
0,
|
||||
0,
|
||||
rabbit_init, rabbit_close, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
Reference in New Issue
Block a user