mirror of
https://github.com/robmcmullen/apple2.git
synced 2024-06-09 10:29:27 +00:00
Fixed stupid bug that caused LC RAM bank #1 to get clobbered when writing
to I/O block $C000-$CFFF.
This commit is contained in:
parent
2cd6e924eb
commit
834dd9b03b
|
@ -256,7 +256,7 @@ deltaT to zero. In the sound IRQ, if deltaT > buffer size, then subtract buffer
|
|||
A = PEEK($C082)
|
||||
*/
|
||||
|
||||
#define DEBUG_LC
|
||||
//#define DEBUG_LC
|
||||
else if ((addr & 0xFFFB) == 0xC080)
|
||||
{
|
||||
#ifdef DEBUG_LC
|
||||
|
@ -371,23 +371,76 @@ WriteLog("LC(R): $C08B 49291 OECG RR Read/Write RAM bank 1\n");
|
|||
floppyDrive.SetWriteMode();
|
||||
}
|
||||
|
||||
//#define LC_DEBUGGING
|
||||
#ifdef LC_DEBUGGING
|
||||
bool showpath = false;
|
||||
if (addr >= 0xD000 && addr <= 0xD00F)
|
||||
showpath = true;
|
||||
#endif
|
||||
//This sux...
|
||||
if (addr >= 0xC100 && addr <= 0xCFFF) // The $C000-$CFFF block is *never* RAM
|
||||
#ifdef LC_DEBUGGING
|
||||
{
|
||||
#endif
|
||||
b = rom[addr];
|
||||
#ifdef LC_DEBUGGING
|
||||
if (showpath)
|
||||
WriteLog("b is from $C100-$CFFF block...\n");
|
||||
}
|
||||
#endif
|
||||
else if (addr >= 0xD000)
|
||||
{
|
||||
if (readRAM)
|
||||
{
|
||||
if (addr <= 0xDFFF && visibleBank == LC_BANK_1)
|
||||
#ifdef LC_DEBUGGING
|
||||
{
|
||||
#endif
|
||||
b = ram[addr - 0x1000];
|
||||
#ifdef LC_DEBUGGING
|
||||
if (showpath)
|
||||
WriteLog("b is from LC bank #1 (ram[addr - 0x1000])...\n");
|
||||
}
|
||||
#endif
|
||||
else
|
||||
#ifdef LC_DEBUGGING
|
||||
{
|
||||
#endif
|
||||
b = ram[addr];
|
||||
#ifdef LC_DEBUGGING
|
||||
if (showpath)
|
||||
WriteLog("b is from LC bank #2 (ram[addr])...\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#ifdef LC_DEBUGGING
|
||||
{
|
||||
#endif
|
||||
b = rom[addr];
|
||||
#ifdef LC_DEBUGGING
|
||||
if (showpath)
|
||||
WriteLog("b is from LC ROM (rom[addr])...\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#ifdef LC_DEBUGGING
|
||||
{
|
||||
#endif
|
||||
b = ram[addr];
|
||||
#ifdef LC_DEBUGGING
|
||||
if (showpath)
|
||||
WriteLog("b is from ram[addr]...\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LC_DEBUGGING
|
||||
if (addr >= 0xD000 && addr <= 0xD00F)
|
||||
{
|
||||
WriteLog("*** Read from $%04X: $%02X (readRAM=%s, PC=%04X, ram$D000=%02X)\n", addr, b, (readRAM ? "T" : "F"), mainCPU.pc, ram[0xC000]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -648,6 +701,16 @@ WriteLog("LC(R): $C08B 49291 OECG RR Read/Write RAM bank 1\n");
|
|||
}
|
||||
//Still need to add missing I/O switches here...
|
||||
|
||||
//DEEE: BD 10 BF LDA $BF10,X [PC=DEF1, SP=01F4, CC=--.B-IZ-, A=00, X=0C, Y=07]
|
||||
#if 0
|
||||
if (addr >= 0xD000 && addr <= 0xD00F)
|
||||
{
|
||||
WriteLog("*** Write to $%04X: $%02X (writeRAM=%s, PC=%04X, ram$D000=%02X)\n", addr, b, (writeRAM ? "T" : "F"), mainCPU.pc, ram[0xC000]);
|
||||
}
|
||||
#endif
|
||||
if (addr >= 0xC000 && addr <= 0xCFFF)
|
||||
return; // Protect LC bank #1 from being written to!
|
||||
|
||||
if (addr >= 0xD000)
|
||||
{
|
||||
if (writeRAM)
|
||||
|
|
|
@ -566,3 +566,38 @@ void FloppyDrive::SetWriteMode(void)
|
|||
// $C0EF
|
||||
ioMode = IO_MODE_WRITE;
|
||||
}
|
||||
|
||||
/*
|
||||
PRODOS 8 MLI ERROR CODES
|
||||
|
||||
$00: No error
|
||||
$01: Bad system call number
|
||||
$04: Bad system call parameter count
|
||||
$25: Interrupt table full
|
||||
$27: I/O error
|
||||
$28: No device connected
|
||||
$2B: Disk write protected
|
||||
$2E: Disk switched
|
||||
$40: Invalid pathname
|
||||
$42: Maximum number of files open
|
||||
$43: Invalid reference number
|
||||
$44: Directory not found
|
||||
$45: Volume not found
|
||||
$46: File not found
|
||||
$47: Duplicate filename
|
||||
$48: Volume full
|
||||
$49: Volume directory full
|
||||
$4A: Incompatible file format, also a ProDOS directory
|
||||
$4B: Unsupported storage_type
|
||||
$4C: End of file encountered
|
||||
$4D: Position out of range
|
||||
$4E: File access error, also file locked
|
||||
$50: File is open
|
||||
$51: Directory structure damaged
|
||||
$52: Not a ProDOS volume
|
||||
$53: Invalid system call parameter
|
||||
$55: Volume Control Block table full
|
||||
$56: Bad buffer address
|
||||
$57: Duplicate volume
|
||||
$5A: File structure damaged
|
||||
*/
|
||||
|
|
|
@ -63,7 +63,7 @@ void SetCallbackTime(void (* callback)(void), double time)
|
|||
}
|
||||
}
|
||||
|
||||
WriteLog("SetCallbackTime() failed to find an empty slot in the list!\n");
|
||||
WriteLog("TIMING: SetCallbackTime() failed to find an empty slot in the list!\n");
|
||||
}
|
||||
|
||||
void RemoveCallback(void (* callback)(void))
|
||||
|
@ -94,6 +94,10 @@ void AdjustCallbackTime(void (* callback)(void), double time)
|
|||
|
||||
double GetTimeToNextEvent(void)
|
||||
{
|
||||
// Find the next event. Since the events are not necessarily in order of
|
||||
// increasing time, we have to search through the list for the lowest one.
|
||||
|
||||
//ALSO: There's a bug here--nextEvent is getting a bogus value/getting clobbered...
|
||||
double time = 0;
|
||||
bool firstTime = true;
|
||||
|
||||
|
@ -102,15 +106,25 @@ double GetTimeToNextEvent(void)
|
|||
if (eventList[i].valid)
|
||||
{
|
||||
if (firstTime)
|
||||
time = eventList[i].eventTime, nextEvent = i, firstTime = false;
|
||||
{
|
||||
time = eventList[i].eventTime;
|
||||
nextEvent = i;
|
||||
firstTime = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eventList[i].eventTime < time)
|
||||
time = eventList[i].eventTime, nextEvent = i;
|
||||
{
|
||||
time = eventList[i].eventTime;
|
||||
nextEvent = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (time == 0)
|
||||
WriteLog("TIMING: GetTimeToNextEvent() failed to find next event!\n");
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
|
|
|
@ -1700,6 +1700,9 @@ RTI Implied RTI 40 1 6
|
|||
static void Op40(void) // RTI
|
||||
{
|
||||
regs.cc = regs.RdMem(0x0100 + ++regs.sp);
|
||||
//clear I (seems to be the case, either that or clear it in the IRQ setup...)
|
||||
//I can't find *any* verification that this is the case.
|
||||
// regs.cc &= ~FLAG_I;
|
||||
regs.pc = regs.RdMem(0x0100 + ++regs.sp);
|
||||
regs.pc |= (uint16)(regs.RdMem(0x0100 + ++regs.sp)) << 8;
|
||||
}
|
||||
|
@ -2296,6 +2299,11 @@ if (regs.pc == 0xFDED)
|
|||
dumpDis = false;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
// ProDOS debugging
|
||||
if (regs.pc == 0x2000)
|
||||
dumpDis = true;
|
||||
#endif
|
||||
|
||||
#ifdef __DEBUG__
|
||||
if (dumpDis)
|
||||
|
|
Loading…
Reference in New Issue
Block a user