]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/blitter.cpp
Fixes for compilation against GCC 6.
[virtualjaguar] / src / blitter.cpp
index 3f725ce288d92c1c0f8827dfe78cc2901d1a0612..7193daf19ca1cbaa26ebf80007a8b54dbfd6d83c 100644 (file)
@@ -7,7 +7,7 @@
 // JLH = James Hammons <jlhamm@acm.org>
 //
 // Who  When        What
-// ---  ----------  -------------------------------------------------------------
+// ---  ----------  -----------------------------------------------------------
 // JLH  01/16/2010  Created this log ;-)
 //
 
@@ -17,7 +17,6 @@
 // to Curt. ;-) Without that excellent documentation which shows *exactly*
 // what's going on inside the TOM chip, we'd all still be guessing as to how
 // the wily blitter and other pieces of the Jaguar puzzle actually work.
-// Now how about those JERRY ASIC nets gentlemen...? [We have those now!] ;-)
 //
 
 #include "blitter.h"
 #include "jaguar.h"
 #include "log.h"
 //#include "memory.h"
+#include "settings.h"
 
 // Various conditional compilation goodies...
 
 //#define LOG_BLITS
 
-//#define USE_ORIGINAL_BLITTER
+#define USE_ORIGINAL_BLITTER
 //#define USE_MIDSUMMER_BLITTER
 #define USE_MIDSUMMER_BLITTER_MKII
 
+#ifdef USE_ORIGINAL_BLITTER
+#ifdef USE_MIDSUMMER_BLITTER_MKII
+#define USE_BOTH_BLITTERS
+#endif
+#endif
+
+
 // External global variables
 
 extern int jaguar_active_memory_dumps;
@@ -45,6 +52,8 @@ extern int jaguar_active_memory_dumps;
 
 int start_logging = 0;
 uint8_t blitter_working = 0;
+bool startConciseBlitLogging = false;
+bool logBlit = false;
 
 // Blitter register RAM (most of it is hidden from the user)
 
@@ -1469,9 +1478,9 @@ Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd:
 //extern int op_start_log;
 if (blit_start_log)
 {
-       char * ctrlStr[4] = { "XADDPHR\0", "XADDPIX\0", "XADD0\0", "XADDINC\0" };
-       char * bppStr[8] = { "1bpp\0", "2bpp\0", "4bpp\0", "8bpp\0", "16bpp\0", "32bpp\0", "???\0", "!!!\0" };
-       char * opStr[16] = { "LFU_CLEAR", "LFU_NSAND", "LFU_NSAD", "LFU_NOTS", "LFU_SAND", "LFU_NOTD", "LFU_N_SXORD", "LFU_NSORND",
+       const char * ctrlStr[4] = { "XADDPHR\0", "XADDPIX\0", "XADD0\0", "XADDINC\0" };
+       const char * bppStr[8] = { "1bpp\0", "2bpp\0", "4bpp\0", "8bpp\0", "16bpp\0", "32bpp\0", "???\0", "!!!\0" };
+       const char * opStr[16] = { "LFU_CLEAR", "LFU_NSAND", "LFU_NSAD", "LFU_NOTS", "LFU_SAND", "LFU_NOTD", "LFU_N_SXORD", "LFU_NSORND",
                "LFU_SAD", "LFU_XOR", "LFU_D", "LFU_NSORD", "LFU_REPLACE", "LFU_SORND", "LFU_SORD", "LFU_ONE" };
        uint32_t /*src = cmd & 0x07, dst = (cmd >> 3) & 0x07, misc = (cmd >> 6) & 0x03,
                a1ctl = (cmd >> 8) & 0x07,*/ mode = (cmd >> 11) & 0x07/*, ity = (cmd >> 14) & 0x0F,
@@ -1723,6 +1732,7 @@ if (blit_start_log)
        WriteLog("BLIT: Blitter started by %s...\n", whoName[who]);
        doGPUDis = true;
 }//*/
+#ifndef USE_BOTH_BLITTERS
 #ifdef USE_ORIGINAL_BLITTER
                blitter_blit(GET32(blitter_ram, 0x38));
 #endif
@@ -1732,6 +1742,14 @@ if (blit_start_log)
 #ifdef USE_MIDSUMMER_BLITTER_MKII
                BlitterMidsummer2();
 #endif
+#else
+       {
+               if (vjs.useFastBlitter)
+                       blitter_blit(GET32(blitter_ram, 0x38));
+               else
+                       BlitterMidsummer2();
+       }
+#endif
 }
 //F02278,9,A,B
 
@@ -2690,8 +2708,6 @@ void COMP_CTRL(uint8_t &dbinh, bool &nowrite,
        bool bcompen, bool big_pix, bool bkgwren, uint8_t dcomp, bool dcompen, uint8_t icount,
        uint8_t pixsize, bool phrase_mode, uint8_t srcd, uint8_t zcomp);
 #define VERBOSE_BLITTER_LOGGING
-bool logBlit = false;
-bool startConciseBlitLogging = false;
 
 void BlitterMidsummer2(void)
 {
@@ -5371,7 +5387,7 @@ Addq_x            := JOIN (addq_x, addq_x[0..5], addqt_x[6..15]);
 Addq_y         := JOIN (addq_y, addq_y[0..15]);*/
 
 ////////////////////////////////////// C++ CODE //////////////////////////////////////
-       int16_t mask[8] = { 0xFFFF, 0xFFFE, 0xFFFC, 0xFFF8, 0xFFF0, 0xFFE0, 0xFFC0, 0x0000 };
+       uint16_t mask[8] = { 0xFFFF, 0xFFFE, 0xFFFC, 0xFFF8, 0xFFF0, 0xFFE0, 0xFFC0, 0x0000 };
        addq_x = addqt_x & mask[modx];
        addq_y = addqt_y & 0xFFFF;
 //////////////////////////////////////////////////////////////////////////////////////