]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/blitter.cpp
Preliminary fixes for memory accesses between $200000 and $7FFFFF, proper
[virtualjaguar] / src / blitter.cpp
index 75d65a432bbd20879aa6db464dec13e4ab2279a6..13960996e6e9acf7afe55f786ac1a2ef6bfede3a 100644 (file)
@@ -1,7 +1,16 @@
 //
 // Blitter core
 //
-// by James L. Hammons
+// by James Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  01/16/2010  Created this log ;-)
+//
+
 //
 // I owe a debt of gratitude to Curt Vendel and to John Mathieson--to Curt
 // for supplying the Oberon ASIC nets and to John for making them available
 #include <string.h>
 #include "jaguar.h"
 #include "log.h"
+//#include "memory.h"
 
 // Various conditional compilation goodies...
 
+//#define LOG_BLITS
+
 //#define USE_ORIGINAL_BLITTER
 //#define USE_MIDSUMMER_BLITTER
 #define USE_MIDSUMMER_BLITTER_MKII
@@ -1547,10 +1559,17 @@ uint8 BlitterReadByte(uint32 offset, uint32 who/*=UNKNOWN*/)
        // status register
 //This isn't cycle accurate--how to fix? !!! FIX !!!
 //Probably have to do some multi-threaded implementation or at least a reentrant safe implementation...
+//Real hardware returns $00000805, just like the JTRM says.
+       if (offset == (0x38 + 0))
+               return 0x00;
+       if (offset == (0x38 + 1))
+               return 0x00;
+       if (offset == (0x38 + 2))
+               return 0x08;
        if (offset == (0x38 + 3))
-               return 0x01;    // always idle
+               return 0x05;    // always idle/never stopped (collision detection ignored!)
 
-// CHECK HERE ONCE THIS FIX HAS BEEN TESTED: [ ]
+// CHECK HERE ONCE THIS FIX HAS BEEN TESTED: [X]
 //Fix for AvP:
        if (offset >= 0x04 && offset <= 0x07)
 //This is it. I wonder if it just ignores the lower three bits?
@@ -1815,9 +1834,9 @@ void LogBlit(void)
        WriteLog("  UPDA2    = %s\n", (UPDA2 ? "1" : "0"));
        WriteLog("  DSTA2    = %s\n", (DSTA2 ? "1" : "0"));
        WriteLog("  ZOP      = %s %s %s\n", (Z_OP_INF ? "<" : ""), (Z_OP_EQU ? "=" : ""), (Z_OP_SUP ? ">" : ""));
-       WriteLog("--LFUFUNC  = %s\n", opStr[(cmd >> 21) & 0x0F]);
+       WriteLog("+-LFUFUNC  = %s\n", opStr[(cmd >> 21) & 0x0F]);
        WriteLog("| PATDSEL  = %s (PD=%08X%08X)\n", (PATDSEL ? "1" : "0"), REG(PATTERNDATA), REG(PATTERNDATA + 4));
-       WriteLog("--ADDDSEL  = %s\n", (ADDDSEL ? "1" : "0"));
+       WriteLog("+-ADDDSEL  = %s\n", (ADDDSEL ? "1" : "0"));
        WriteLog("  CMPDST   = %s\n", (CMPDST ? "1" : "0"));
        WriteLog("  BCOMPEN  = %s\n", (BCOMPEN ? "1" : "0"));
        WriteLog("  DCOMPEN  = %s\n", (DCOMPEN ? "1" : "0"));
@@ -1844,6 +1863,9 @@ void LogBlit(void)
 
 void BlitterMidsummer(uint32 cmd)
 {
+#ifdef LOG_BLITS
+       LogBlit();
+#endif
 uint32 outer_loop, inner_loop, a1_addr, a2_addr;
 int32 a1_x, a1_y, a2_x, a2_y, a1_width, a2_width;
 uint8 a1_phrase_mode, a2_phrase_mode;
@@ -2662,6 +2684,9 @@ bool logBlit = false;
 
 void BlitterMidsummer2(void)
 {
+#ifdef LOG_BLITS
+       LogBlit();
+#endif
        // Here's what the specs say the state machine does. Note that this can probably be
        // greatly simplified (also, it's different from what John has in his Oberon docs):
 //Will remove stuff that isn't in Jaguar I once fully described (stuff like texture won't