uint8 diskRom[0x100]; // Disk ROM space
V65C02REGS mainCPU;
uint8 appleType = APPLE_TYPE_II;
+FloppyDrive floppyDrive;
// Local variables
static uint8 lastKeyPressed = 0;
static bool keyDown = false;
-static FloppyDrive floppyDrive;
+//static FloppyDrive floppyDrive;
enum { LC_BANK_1, LC_BANK_2 };
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;
}
{
//Actually, according to the A2 ref, this should do nothing since a write
//is immediately preceded by a read leaving it in the same state it was...
-// keyDown = false;
+//But leaving this out seems to fuck up the key handling of some games...
+ keyDown = false;
}
else if (addr == 0xC050)
{
}
//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)
return false;
}
+//#define CPU_CLOCK_CHECKING
+#ifdef CPU_CLOCK_CHECKING
+uint8 counter = 0;
+uint32 totalCPU = 0;
+#endif
//
// Main loop
//
//Load up disk image from config file (for now)...
floppyDrive.LoadImage(settings.diskImagePath1, 0);
-// floppyDrive.LoadImage(settings.diskImagePath2, 1);
+ floppyDrive.LoadImage(settings.diskImagePath2, 1);
// floppyDrive.LoadImage("./disks/temp.nib", 1); // Load temp .nib file into second drive...
//Kill the DOS ROM in slot 6 for now...
SoundInit();
SDL_EnableUNICODE(1); // Needed to do key translation shit
- gui = new GUI(surface); // Set up the GUI system object...
+// gui = new GUI(surface); // Set up the GUI system object...
+ gui = new GUI(mainSurface); // Set up the GUI system object...
+#if 0
gui->AddMenuTitle("Apple2");
gui->AddMenuItem("Test!", TestWindow/*, hotkey*/);
gui->AddMenuItem("");
gui->AddMenuItem("Quit", QuitEmulator, SDLK_q);
gui->CommitItemsToMenu();
+#endif
SetupBlurTable(); // Set up the color TV emulation blur table
running = true; // Set running status...
//(Fix so that this is not a requirement!)
//Fixed, but mainCPU.clock is destroyed in the bargain. Oh well.
// mainCPU.clock -= USEC_TO_M6502_CYCLES(timeToNextEvent);
+#ifdef CPU_CLOCK_CHECKING
+totalCPU += USEC_TO_M6502_CYCLES(timeToNextEvent);
+#endif
// Handle CPU time delta for sound...
- AddToSoundTimeBase(USEC_TO_M6502_CYCLES(timeToNextEvent));
+//Don't need this anymore now that we use absolute time...
+// AddToSoundTimeBase(USEC_TO_M6502_CYCLES(timeToNextEvent));
HandleNextEvent();
}
if (event.key.keysym.sym == SDLK_F12)
dumpDis = !dumpDis; // Toggle the disassembly process
- else if (event.key.keysym.sym == SDLK_F11)
- floppyDrive.LoadImage("./disks/bt1_char.dsk");//Kludge to load char disk...
+// else if (event.key.keysym.sym == SDLK_F11)
+// floppyDrive.LoadImage("./disks/bt1_char.dsk");//Kludge to load char disk...
else if (event.key.keysym.sym == SDLK_F9)
{
floppyDrive.CreateBlankImage();
// to quit completely... !!! FIX !!!
gui->Run();
+ if (event.key.keysym.sym == SDLK_F5)
+ {
+ VolumeDown();
+ char volStr[10] = "*********";
+ volStr[GetVolume()] = 0;
+ SpawnMessage("Volume: %s", volStr);
+ }
+ else if (event.key.keysym.sym == SDLK_F6)
+ {
+ VolumeUp();
+ char volStr[10] = "*********";
+ volStr[GetVolume()] = 0;
+ SpawnMessage("Volume: %s", volStr);
+ }
+
break;
case SDL_QUIT:
running = false;
}
}
-//ick. HandleSoundAtFrameEdge(); // Sound stuff... (ick)
RenderVideoFrame();
SetCallbackTime(FrameCallback, 16666.66666667);
+#ifdef CPU_CLOCK_CHECKING
+counter++;
+if (counter == 60)
+{
+ printf("Executed %u cycles...\n", totalCPU);
+ totalCPU = 0;
+ counter = 0;
+}
+#endif
//Instead of this, we should yield remaining time to other processes... !!! FIX !!!
//lessee...
//nope. SDL_Delay(10);