Support AN3 for IIe (#1018)

(Fix IOUDIS for IIc - $C07E/F was backwards)
This commit is contained in:
tomcw 2022-01-15 18:01:41 +00:00
parent 5fbd8339c1
commit af814347f0
3 changed files with 28 additions and 31 deletions

View File

@ -220,6 +220,11 @@ inline bool IsAppleIIeOrAbove(eApple2Type type) // Apple //e,Enhanced//e,//c or
return !IsApple2PlusOrClone(type);
}
inline bool IsAppleIIc(eApple2Type type) // Apple //c
{
return (type & A2TYPE_APPLE2C) != 0;
}
extern eApple2Type g_Apple2Type;
inline bool IsEnhancedIIE(void)
{

View File

@ -509,6 +509,24 @@ static BYTE __stdcall IOWrite_C04x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
//-------------------------------------
static BYTE __stdcall IOReadWrite_ANx(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
{
// $C058..C05F
_ASSERT((addr & 0xf) >= 8);
if (IsAppleIIeOrAbove(GetApple2Type()))
{
if (!IsAppleIIc(GetApple2Type()) || /* IsIIc && */ SW_IOUDIS)
GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles); // Apple //e or (//c && IOUDIS)
}
if (IsAppleIIc(GetApple2Type())) // No ANx lines for //c
return 0;
// GH#1018 - AN3 line is still present on //e (with $C05E/F also toggling DHIRES)
return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
}
static BYTE __stdcall IORead_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
{
switch (addr & 0xf)
@ -521,18 +539,7 @@ static BYTE __stdcall IORead_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
case 0x5: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
case 0x6: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
case 0x7: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
case 0x8: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0x9: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xA: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xB: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xC: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xD: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xE: // fall through...
case 0xF: if (IsApple2PlusOrClone(GetApple2Type()))
IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
else
return (!SW_IOUDIS) ? GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles)
: IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
default: return IOReadWrite_ANx(pc, addr, bWrite, d, nExecutedCycles); // $C058..C05F
}
return 0;
@ -550,21 +557,8 @@ static BYTE __stdcall IOWrite_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
case 0x5: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
case 0x6: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
case 0x7: return MemSetPaging(pc, addr, bWrite, d, nExecutedCycles);
case 0x8: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0x9: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xA: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xB: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xC: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xD: return IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
case 0xE: // fall through...
case 0xF: if (IsApple2PlusOrClone(GetApple2Type()))
IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
else
return (!SW_IOUDIS) ? GetVideo().VideoSetMode(pc, addr, bWrite, d, nExecutedCycles)
: IO_Annunciator(pc, addr, bWrite, d, nExecutedCycles);
default: return IOReadWrite_ANx(pc, addr, bWrite, d, nExecutedCycles); // $C058..C05F
}
return 0;
}
//-------------------------------------
@ -659,12 +653,12 @@ static BYTE __stdcall IOWrite_C07x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
case 0xC: return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
case 0xD: return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
case 0xE: if (IS_APPLE2C())
SetMemMode(memmode & ~MF_IOUDIS); // disable IOU access for addresses $C058 to $C05F; enable access to DHIRES switch
SetMemMode(memmode | MF_IOUDIS); // On: disable IOU access for addresses $C058 to $C05F; enable access to DHIRES switch
else
return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
break;
case 0xF: if (IS_APPLE2C())
SetMemMode(memmode | MF_IOUDIS); // enable IOU access for addresses $C058 to $C05F; disable access to DHIRES switch
SetMemMode(memmode & ~MF_IOUDIS); // Off: enable IOU access for addresses $C058 to $C05F; disable access to DHIRES switch
else
return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
break;
@ -726,8 +720,6 @@ BYTE __stdcall IO_Annunciator(WORD programcounter, WORD address, BYTE write, BYT
// . $C2B5: LDA $C05D (CLRAN2) ;SETUP
// . $C2B8: LDA $C05F (CLRAN3) ; ANNUNCIATORS
// NB. AN3: For //e & //c these locations are now used to enabled/disabled DHIRES
g_Annunciator[(address>>1) & 3] = (address&1) ? true : false;
if (address >= 0xC058 && address <= 0xC05B)

View File

@ -15,7 +15,7 @@
#define MF_SLOTC3ROM 0x00000100
#define MF_INTCXROM 0x00000200
#define MF_WRITERAM 0x00000400 // Language Card RAM is Write Enabled
#define MF_IOUDIS 0x00000800 // Disable IOU access for addresses $C058 to $C05F; enable access to DHIRES switch (0=on) (Enhanced //e only)
#define MF_IOUDIS 0x00000800 // Disable IOU access for addresses $C058 to $C05F; enable access to DHIRES switch (0=on) (//c only)
#define MF_ALTROM0 0x00001000 // Use alternate ROM for $D000 to $FFFF. Two bits for up to 4 pages
#define MF_ALTROM1 0x00002000 // Use alternate ROM, second bit to have four pages
#define MF_IMAGEMASK 0x000003F7