]> Shamusworld >> Repos - apple2/blobdiff - src/apple2.cpp
Docs were missing GPLv3. Thanks to schampailler for the heads up. :-)
[apple2] / src / apple2.cpp
index 72e6f3c8f22705ada373fd55ee1c071ff341d5a5..be5a16d1e805f74c0f9828c7eed6f68ee44a2085 100644 (file)
 #include <stdlib.h>
 #include <string>
 #include <time.h>
-#include "firmware.h"
-//#include "floppydisk.h"
+#include "firmware/apple2-fw.h"
+#include "firmware/apple2e-enh.h"
+#include "firmware/firmware.h"
+#include "floppydrive.h"
+#include "harddrive.h"
 #include "log.h"
 #include "mmu.h"
 #include "mockingboard.h"
@@ -54,8 +57,9 @@
 #include "sound.h"
 #include "timing.h"
 #include "video.h"
-#include "gui/gui.h"
 #include "gui/diskselector.h"
+#include "gui/config.h"
+#include "gui/gui.h"
 
 // Debug and misc. defines
 
@@ -274,7 +278,6 @@ WriteLog("CPU: SDL_mutexV(cpuMutex);\n");
 }
 #endif
 
-
 //
 // Request a change in the power state of the emulated Apple
 //
@@ -283,7 +286,6 @@ void SetPowerState(void)
        powerStateChangeRequested = true;
 }
 
-
 //
 // Load a file into RAM/ROM image space
 //
@@ -300,7 +302,6 @@ bool LoadImg(char * filename, uint8_t * ram, int size)
        return true;
 }
 
-
 const uint8_t stateHeader[19] = "APPLE2SAVESTATE1.2";
 static void SaveApple2State(const char * filename)
 {
@@ -354,7 +355,6 @@ static void SaveApple2State(const char * filename)
        fclose(file);
 }
 
-
 static bool LoadApple2State(const char * filename)
 {
        WriteLog("Main: Loading Apple2 state...\n");
@@ -423,7 +423,6 @@ static bool LoadApple2State(const char * filename)
        return true;
 }
 
-
 static void ResetApple2State(void)
 {
        keyDown = false;
@@ -449,7 +448,6 @@ static void ResetApple2State(void)
        mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
 }
 
-
 static double cyclesForSample = 0;
 static void AppleTimer(uint16_t cycles)
 {
@@ -477,7 +475,6 @@ lastSampleClock = sampleClock;
 #endif
 }
 
-
 #ifdef CPU_CLOCK_CHECKING
 uint8_t counter = 0;
 uint32_t totalCPU = 0;
@@ -546,6 +543,7 @@ int main(int /*argc*/, char * /*argv*/[])
        // Install devices in slots
        InstallFloppy(SLOT6);
        InstallMockingboard(SLOT4);
+       InstallHardDrive(SLOT7);
 
        // Set up V65C02 execution context
        memset(&mainCPU, 0, sizeof(V65C02REGS));
@@ -554,11 +552,15 @@ int main(int /*argc*/, char * /*argv*/[])
        mainCPU.Timer = AppleTimer;
        mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
 
+#if 0
        if (!LoadImg(settings.BIOSPath, rom + 0xC000, 0x4000))
        {
                WriteLog("Could not open file '%s'!\n", settings.BIOSPath);
                return -1;
        }
+#else
+       memcpy(rom + 0xC000, apple2eEnhROM, 0x4000);
+#endif
 
        WriteLog("About to initialize video...\n");
 
@@ -657,23 +659,22 @@ WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
 #if 0
 #include "dis65c02.h"
 static char disbuf[80];
-uint16_t pc=0x801;
-while (pc < 0x9FF)
+uint16_t pc=0xA000;
+while (pc < 0xA3FF)
 {
        pc += Decode65C02(&mainCPU, disbuf, pc);
        WriteLog("%s\n", disbuf);
 }
 #endif
 
+       SaveSettings();
        SoundDone();
        VideoDone();
-       SaveSettings();
        LogDone();
 
        return 0;
 }
 
-
 //
 // Apple //e scancodes. Tables are normal (0), +CTRL (1), +SHIFT (2),
 // +CTRL+SHIFT (3). Order of keys is:
@@ -744,6 +745,10 @@ static void FrameCallback(void)
                        if (event.key.repeat != 0)
                                break;
 
+                       // This breaks IMEs and the like, but we'll do simple for now
+                       if (GUI::KeyDown(event.key.keysym.sym))
+                               break;
+
                        // Use CTRL+SHIFT+Q to exit, as well as the usual window decoration
                        // method
                        if ((event.key.keysym.mod & KMOD_CTRL)
@@ -1025,7 +1030,7 @@ else if (event.key.keysym.sym == SDLK_F9)
 
        // Hide the mouse if it's been 1s since the last time it was moved
        // N.B.: Should disable mouse hiding if it's over the GUI...
-       if ((hideMouseTimeout > 0) && !(GUI::sidebarState == SBS_SHOWN || DiskSelector::showWindow == true))
+       if ((hideMouseTimeout > 0) && !(GUI::sidebarState == SBS_SHOWN || DiskSelector::showWindow == true || Config::showWindow == true))
                hideMouseTimeout--;
        else if (hideMouseTimeout == 0)
        {
@@ -1134,7 +1139,6 @@ if (counter == 60)
 #endif
 }
 
-
 static void BlinkTimer(void)
 {
        // Set up blinking at 1/4 sec intervals
@@ -1142,7 +1146,6 @@ static void BlinkTimer(void)
        SetCallbackTime(BlinkTimer, 250000);
 }
 
-
 /*
 Next problem is this: How to have events occur and synchronize with the rest
 of the threads?
@@ -1168,4 +1171,3 @@ while (!done)
                time = 20;
 }
 */
-