]> Shamusworld >> Repos - apple2/blobdiff - src/v65c02.cpp
Changes to sound system relating to the new threaded CPU core. It works,
[apple2] / src / v65c02.cpp
index b5c8716747e02fb22da6cf94b934d4d3629afae0..6f2c969d8681a3c074a97763dd6a2f97d4efb4f0 100755 (executable)
@@ -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;
 }
@@ -2253,8 +2256,9 @@ Let's see...
        if (regs.clock + cycles > 0xFFFFFFFF)
                wraparound = true;
 */
+       uint64 endCycles = regs.clock + (uint64)cycles;
 
-       while (regs.clock < cycles)
+       while (regs.clock < endCycles)
        {
 #if 0
 /*if (regs.pc == 0x4007)
@@ -2296,6 +2300,11 @@ if (regs.pc == 0xFDED)
        dumpDis = false;
 }
 #endif
+#if 0
+// ProDOS debugging
+if (regs.pc == 0x2000)
+       dumpDis = true;
+#endif
 
 #ifdef __DEBUG__
 if (dumpDis)
@@ -2394,7 +2403,8 @@ WriteLog("\n*** IRQ ***\n\n");
 
 //This is a lame way of doing it, but in the end the simplest--however, it destroys any
 //record of elasped CPU time. Not sure that it's important to keep track, but there it is.
-       regs.clock -= cycles;
+// Now we use a 64-bit integer, so it won't wrap for about 500 millenia. ;-)
+//     regs.clock -= cycles;
 
        myMemcpy(context, &regs, sizeof(V65C02REGS));
 }
@@ -2402,7 +2412,7 @@ WriteLog("\n*** IRQ ***\n\n");
 //
 // Get the clock of the currently executing CPU
 //
-uint32 GetCurrentV65C02Clock(void)
+uint64 GetCurrentV65C02Clock(void)
 {
        return regs.clock;
 }