to I/O block $C000-$CFFF.
A = PEEK($C082)
*/
-#define DEBUG_LC
+//#define DEBUG_LC
else if ((addr & 0xFFFB) == 0xC080)
{
#ifdef DEBUG_LC
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;
}
}
//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)
// $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
+*/
}
}
- 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))
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;
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;
}
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;
}
dumpDis = false;
}
#endif
+#if 0
+// ProDOS debugging
+if (regs.pc == 0x2000)
+ dumpDis = true;
+#endif
#ifdef __DEBUG__
if (dumpDis)