]> Shamusworld >> Repos - virtualjaguar/commitdiff
Renamed clock.cpp/h to event.cpp/h, did some long overdue cleanups to
authorShamus Hammons <jlhamm@acm.org>
Sat, 1 Nov 2008 13:58:48 +0000 (13:58 +0000)
committerShamus Hammons <jlhamm@acm.org>
Sat, 1 Nov 2008 13:58:48 +0000 (13:58 +0000)
function names, removed version.cpp/h since they were completely
unnecessary. :-)

34 files changed:
Makefile
src/blitter.cpp
src/blitter.h
src/dac.cpp
src/dsp.cpp
src/dsp.h
src/eeprom.cpp
src/eeprom.h
src/event.cpp [moved from src/clock.cpp with 99% similarity]
src/event.h [moved from src/clock.h with 85% similarity]
src/gpu.cpp
src/gpu.h
src/gui.cpp
src/gui.h
src/jaguar.cpp
src/jaguar.h
src/jerry.cpp
src/jerry.h
src/joystick.cpp
src/log.cpp
src/log.h
src/memory.cpp
src/memory.h
src/objectp.cpp
src/objectp.h
src/sdlemu_opengl.c
src/tom.cpp
src/tom.h
src/version.cpp [deleted file]
src/version.h [deleted file]
src/video.cpp
src/video.h
src/vj.cpp
vj.cfg

index 2d417f7938c8e62d9c844765324bea7197962609..3a1a4dab305714a4c610a1e4d172635190a894e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -65,14 +65,20 @@ LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLL
 INCS = -I. -I./src -I/usr/local/include -I/usr/include
 
 OBJS = \
 INCS = -I. -I./src -I/usr/local/include -I/usr/include
 
 OBJS = \
+       obj/m68kcpu.o       \
+       obj/m68kops.o       \
+       obj/m68kopac.o      \
+       obj/m68kopdm.o      \
+       obj/m68kopnz.o      \
+       obj/m68kdasm.o      \
        obj/blitter.o       \
        obj/cdrom.o         \
        obj/cdintf.o        \
        obj/blitter.o       \
        obj/cdrom.o         \
        obj/cdintf.o        \
-       obj/clock.o         \
        obj/crc32.o         \
        obj/dac.o           \
        obj/dsp.o           \
        obj/eeprom.o        \
        obj/crc32.o         \
        obj/dac.o           \
        obj/dsp.o           \
        obj/eeprom.o        \
+       obj/event.o         \
        obj/file.o          \
        obj/gpu.o           \
        obj/gui.o           \
        obj/file.o          \
        obj/gpu.o           \
        obj/gui.o           \
@@ -81,12 +87,6 @@ OBJS = \
        obj/jerry.o         \
        obj/joystick.o      \
        obj/log.o           \
        obj/jerry.o         \
        obj/joystick.o      \
        obj/log.o           \
-       obj/m68kcpu.o       \
-       obj/m68kops.o       \
-       obj/m68kopac.o      \
-       obj/m68kopdm.o      \
-       obj/m68kopnz.o      \
-       obj/m68kdasm.o      \
        obj/memory.o        \
        obj/objectp.o       \
        obj/sdlemu_config.o \
        obj/memory.o        \
        obj/objectp.o       \
        obj/sdlemu_config.o \
@@ -94,7 +94,6 @@ OBJS = \
        obj/settings.o      \
        obj/tom.o           \
        obj/unzip.o         \
        obj/settings.o      \
        obj/tom.o           \
        obj/unzip.o         \
-       obj/version.o       \
        obj/video.o         \
        obj/vj.o            \
        $(ICON)
        obj/video.o         \
        obj/vj.o            \
        $(ICON)
index c767e5b045c4a2f9ac30d32d0a4714d1ccb11630..90f04386109258e99b604d74a8a47feb77ededf6 100644 (file)
@@ -201,7 +201,7 @@ void BlitterMidsummer2(void);
 //#define WRITE_ZDATA_16(a,d)     {  JaguarWriteWord(a##_addr+(ZDATA_OFFSET_16(a)<<1), d); }
 
 // z data write
 //#define WRITE_ZDATA_16(a,d)     {  JaguarWriteWord(a##_addr+(ZDATA_OFFSET_16(a)<<1), d); }
 
 // z data write
-#define WRITE_ZDATA(a,f,d) WRITE_ZDATA_16(a,d); 
+#define WRITE_ZDATA(a,f,d) WRITE_ZDATA_16(a,d);
 
 // 1 bpp r data read
 #define READ_RDATA_1(r,a,p)  ((p) ?  ((REG(r+(((uint32)a##_x >> 19) & 0x04))) >> (((uint32)a##_x >> 16) & 0x1F)) & 0x0001 : (REG(r) & 0x0001))
 
 // 1 bpp r data read
 #define READ_RDATA_1(r,a,p)  ((p) ?  ((REG(r+(((uint32)a##_x >> 19) & 0x04))) >> (((uint32)a##_x >> 16) & 0x1F)) & 0x0001 : (REG(r) & 0x0001))
@@ -252,8 +252,8 @@ void BlitterMidsummer2(void);
 //#define WRITE_PIXEL_16(a,d)     {  JaguarWriteWord(a##_addr+(PIXEL_OFFSET_16(a)<<1), d); if (specialLog) WriteLog("Pixel write address: %08X\n", a##_addr+(PIXEL_OFFSET_16(a)<<1)); }
 
 // 32 bpp pixel write
 //#define WRITE_PIXEL_16(a,d)     {  JaguarWriteWord(a##_addr+(PIXEL_OFFSET_16(a)<<1), d); if (specialLog) WriteLog("Pixel write address: %08X\n", a##_addr+(PIXEL_OFFSET_16(a)<<1)); }
 
 // 32 bpp pixel write
-#define WRITE_PIXEL_32(a,d)            { JaguarWriteLong(a##_addr+(PIXEL_OFFSET_32(a)<<2), d, BLITTER); } 
-//#define WRITE_PIXEL_32(a,d)          { JaguarWriteLong(a##_addr+(PIXEL_OFFSET_32(a)<<2), d); } 
+#define WRITE_PIXEL_32(a,d)            { JaguarWriteLong(a##_addr+(PIXEL_OFFSET_32(a)<<2), d, BLITTER); }
+//#define WRITE_PIXEL_32(a,d)          { JaguarWriteLong(a##_addr+(PIXEL_OFFSET_32(a)<<2), d); }
 
 // pixel write
 #define WRITE_PIXEL(a,f,d) {\
 
 // pixel write
 #define WRITE_PIXEL(a,f,d) {\
@@ -273,8 +273,8 @@ void BlitterMidsummer2(void);
 // as a floating point bit pattern being followed by a number of zeroes. So, e.g., 001101 translates to
 // 1.01 (the "1." being implied) x (2 ^ 3) or 1010 -> 10 in base 10 (i.e., 1.01 with the decimal place
 // being shifted to the right 3 places).
 // as a floating point bit pattern being followed by a number of zeroes. So, e.g., 001101 translates to
 // 1.01 (the "1." being implied) x (2 ^ 3) or 1010 -> 10 in base 10 (i.e., 1.01 with the decimal place
 // being shifted to the right 3 places).
-/*static uint32 blitter_scanline_width[48] = 
-{             
+/*static uint32 blitter_scanline_width[48] =
+{
      0,    0,    0,    0,                                      // Note: This would really translate to 1, 1, 1, 1
      2,    0,    0,    0,
      4,    0,    6,    0,
      0,    0,    0,    0,                                      // Note: This would really translate to 1, 1, 1, 1
      2,    0,    0,    0,
      4,    0,    6,    0,
@@ -357,7 +357,7 @@ void blitter_generic(uint32 cmd)
 {
 /*
 Blit! (0018FA70 <- 008DDC40) count: 2 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
 {
 /*
 Blit! (0018FA70 <- 008DDC40) count: 2 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -2 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -2 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -433,7 +433,7 @@ if (specialLog)
                                                srczdata = READ_RDATA(SRCZINT, a2, REG(A2_FLAGS), a2_phrase_mode);
                                }
 
                                                srczdata = READ_RDATA(SRCZINT, a2, REG(A2_FLAGS), a2_phrase_mode);
                                }
 
-                               // load dst data and Z 
+                               // load dst data and Z
                                if (DSTEN)
                                {
                                        dstdata = READ_PIXEL(a1, REG(A1_FLAGS));
                                if (DSTEN)
                                {
                                        dstdata = READ_PIXEL(a1, REG(A1_FLAGS));
@@ -459,14 +459,14 @@ if (specialLog)
                                                inhibit = 1;
                                }//*/
 
                                                inhibit = 1;
                                }//*/
 
-                               if (GOURZ) 
+                               if (GOURZ)
                                        srczdata = z_i[colour_index] >> 16;
 
                                // apply z comparator
                                if (Z_OP_INF && srczdata <  dstzdata)   inhibit = 1;
                                if (Z_OP_EQU && srczdata == dstzdata)   inhibit = 1;
                                if (Z_OP_SUP && srczdata >  dstzdata)   inhibit = 1;
                                        srczdata = z_i[colour_index] >> 16;
 
                                // apply z comparator
                                if (Z_OP_INF && srczdata <  dstzdata)   inhibit = 1;
                                if (Z_OP_EQU && srczdata == dstzdata)   inhibit = 1;
                                if (Z_OP_SUP && srczdata >  dstzdata)   inhibit = 1;
-                               
+
                                // apply data comparator
 // Note: DCOMPEN only works in 8/16 bpp modes! !!! FIX !!!
 // Does BCOMPEN only work in 1 bpp mode???
                                // apply data comparator
 // Note: DCOMPEN only works in 8/16 bpp modes! !!! FIX !!!
 // Does BCOMPEN only work in 1 bpp mode???
@@ -496,7 +496,7 @@ if (specialLog)
 Interesting (Hover Strike--large letter):
 
 Blit! (0018FA70 <- 008DDC40) count: 2 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
 Interesting (Hover Strike--large letter):
 
 Blit! (0018FA70 <- 008DDC40) count: 2 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -2 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -2 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -504,7 +504,7 @@ Blit! (0018FA70 <- 008DDC40) count: 2 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd:
         A1 x/y: 100/12, A2 x/y: 106/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
         A1 x/y: 100/12, A2 x/y: 106/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -8 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -8 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -512,7 +512,7 @@ Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd:
         A1 x/y: 102/12, A2 x/y: 107/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 1 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
         A1 x/y: 102/12, A2 x/y: 107/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 1 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -1 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -1 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -520,7 +520,7 @@ Blit! (0018FA70 <- 008DDC40) count: 1 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd:
         A1 x/y: 118/12, A2 x/y: 70/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
         A1 x/y: 118/12, A2 x/y: 70/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -8 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -8 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -528,7 +528,7 @@ Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd:
         A1 x/y: 119/12, A2 x/y: 71/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 1 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
         A1 x/y: 119/12, A2 x/y: 71/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 1 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -1 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -1 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -536,7 +536,7 @@ Blit! (0018FA70 <- 008DDC40) count: 1 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd:
         A1 x/y: 127/12, A2 x/y: 66/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
         A1 x/y: 127/12, A2 x/y: 66/0 Pattern: 000000F300000000
 
 Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd: 1401060C]
- CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN 
+ CMD -> src: SRCENX dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: BCOMPEN BKGWREN
   A1 step values: -8 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -8 (X), 1 (Y)
   A2 step values: -1 (X), 1 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 1 phrases, depth: 8bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -551,7 +551,7 @@ Blit! (0018FA70 <- 008DDC40) count: 8 x 13, A1/2_FLAGS: 00014218/00013C18 [cmd:
                                                // compare source pixel with pattern pixel
 /*
 Blit! (000B8250 <- 0012C3A0) count: 16 x 1, A1/2_FLAGS: 00014420/00012000 [cmd: 05810001]
                                                // compare source pixel with pattern pixel
 /*
 Blit! (000B8250 <- 0012C3A0) count: 16 x 1, A1/2_FLAGS: 00014420/00012000 [cmd: 05810001]
- CMD -> src: SRCEN  dst:  misc:  a1ctl:  mode:  ity: PATDSEL z-op:  op: LFU_REPLACE ctrl: BCOMPEN 
+ CMD -> src: SRCEN  dst:  misc:  a1ctl:  mode:  ity: PATDSEL z-op:  op: LFU_REPLACE ctrl: BCOMPEN
   A1 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 384 (22), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 1bpp, z-off: 0, width: 16 (10), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         x/y: 0/20
   A1 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 384 (22), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 1bpp, z-off: 0, width: 16 (10), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         x/y: 0/20
@@ -598,12 +598,12 @@ Blit! (000B8250 <- 0012C3A0) count: 16 x 1, A1/2_FLAGS: 00014420/00012000 [cmd:
 
                                // compute the write data and store
                                if (!inhibit)
 
                                // compute the write data and store
                                if (!inhibit)
-                               {                       
+                               {
 // Houston, we have a problem...
 // Look here, at PATDSEL and GOURD. If both are active (as they are on the BIOS intro), then there's
 // a conflict! E.g.:
 //Blit! (00100000 <- 000095D0) count: 3 x 1, A1/2_FLAGS: 00014220/00004020 [cmd: 00011008]
 // Houston, we have a problem...
 // Look here, at PATDSEL and GOURD. If both are active (as they are on the BIOS intro), then there's
 // a conflict! E.g.:
 //Blit! (00100000 <- 000095D0) count: 3 x 1, A1/2_FLAGS: 00014220/00004020 [cmd: 00011008]
-// CMD -> src:  dst: DSTEN  misc:  a1ctl:  mode: GOURD  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+// CMD -> src:  dst: DSTEN  misc:  a1ctl:  mode: GOURD  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
 //  A1 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
 //  A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 256 (20), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
 //        A1 x/y: 90/171, A2 x/y: 808/0 Pattern: 776D770077007700
 //  A1 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 320 (21), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
 //  A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 256 (20), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
 //        A1 x/y: 90/171, A2 x/y: 808/0 Pattern: 776D770077007700
@@ -636,7 +636,7 @@ Blit! (000B8250 <- 0012C3A0) count: 16 x 1, A1/2_FLAGS: 00014420/00012000 [cmd:
 Hover Strike ADDDSEL blit:
 
 Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cmd: 00020208]
 Hover Strike ADDDSEL blit:
 
 Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cmd: 00020208]
- CMD -> src:  dst: DSTEN  misc:  a1ctl: UPDA1  mode:  ity: ADDDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst: DSTEN  misc:  a1ctl: UPDA1  mode:  ity: ADDDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 step values: -320 (X), 1 (Y)
   A1 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 256 (20), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -320 (X), 1 (Y)
   A1 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 256 (20), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -681,10 +681,10 @@ Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cm
 //According to JTRM, this is part of the four things the blitter does with the write data (the other
 //three being PATDSEL, ADDDSEL, and LFU (default). I'm not sure which gets precedence, this or PATDSEL
 //(see above blit example)...
 //According to JTRM, this is part of the four things the blitter does with the write data (the other
 //three being PATDSEL, ADDDSEL, and LFU (default). I'm not sure which gets precedence, this or PATDSEL
 //(see above blit example)...
-                                       if (GOURD) 
+                                       if (GOURD)
                                                writedata = ((gd_c[colour_index]) << 8) | (gd_i[colour_index] >> 16);
 
                                                writedata = ((gd_c[colour_index]) << 8) | (gd_i[colour_index] >> 16);
 
-                                       if (SRCSHADE) 
+                                       if (SRCSHADE)
                                        {
                                                int intensity = srcdata & 0xFF;
                                                int ia = gd_ia >> 16;
                                        {
                                                int intensity = srcdata & 0xFF;
                                                int ia = gd_ia >> 16;
@@ -739,7 +739,7 @@ Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cm
                                                srczdata = READ_RDATA(SRCZINT, a1, REG(A1_FLAGS), a1_phrase_mode);
                                }
 
                                                srczdata = READ_RDATA(SRCZINT, a1, REG(A1_FLAGS), a1_phrase_mode);
                                }
 
-                               // load dst data and Z 
+                               // load dst data and Z
                                if (DSTEN)
                                {
                                        dstdata = READ_PIXEL(a2, REG(A2_FLAGS));
                                if (DSTEN)
                                {
                                        dstdata = READ_PIXEL(a2, REG(A2_FLAGS));
@@ -755,14 +755,14 @@ Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cm
                                                dstzdata = READ_RDATA(DSTZ, a2, REG(A2_FLAGS), a2_phrase_mode);
                                }
 
                                                dstzdata = READ_RDATA(DSTZ, a2, REG(A2_FLAGS), a2_phrase_mode);
                                }
 
-                               if (GOURZ) 
+                               if (GOURZ)
                                        srczdata = z_i[colour_index] >> 16;
 
                                // apply z comparator
                                if (Z_OP_INF && srczdata < dstzdata)    inhibit = 1;
                                if (Z_OP_EQU && srczdata == dstzdata)   inhibit = 1;
                                if (Z_OP_SUP && srczdata > dstzdata)    inhibit = 1;
                                        srczdata = z_i[colour_index] >> 16;
 
                                // apply z comparator
                                if (Z_OP_INF && srczdata < dstzdata)    inhibit = 1;
                                if (Z_OP_EQU && srczdata == dstzdata)   inhibit = 1;
                                if (Z_OP_SUP && srczdata > dstzdata)    inhibit = 1;
-                               
+
                                // apply data comparator
 //NOTE: The bit comparator (BCOMPEN) is NOT the same at the data comparator!
                                if (DCOMPEN | BCOMPEN)
                                // apply data comparator
 //NOTE: The bit comparator (BCOMPEN) is NOT the same at the data comparator!
                                if (DCOMPEN | BCOMPEN)
@@ -801,7 +801,7 @@ Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cm
 //                                     if (a1_phrase_mode || a2_phrase_mode)
 //                                             inhibit = !inhibit;
                                }
 //                                     if (a1_phrase_mode || a2_phrase_mode)
 //                                             inhibit = !inhibit;
                                }
-                               
+
                                if (CLIPA1)
                                {
                                        inhibit |= (((a1_x >> 16) < a1_clip_x && (a1_x >> 16) >= 0
                                if (CLIPA1)
                                {
                                        inhibit |= (((a1_x >> 16) < a1_clip_x && (a1_x >> 16) >= 0
@@ -810,7 +810,7 @@ Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cm
 
                                // compute the write data and store
                                if (!inhibit)
 
                                // compute the write data and store
                                if (!inhibit)
-                               {                       
+                               {
                                        if (PATDSEL)
                                        {
                                                // use pattern data for write data
                                        if (PATDSEL)
                                        {
                                                // use pattern data for write data
@@ -839,10 +839,10 @@ Blit! (00098D90 <- 0081DDC0) count: 320 x 287, A1/2_FLAGS: 00004220/00004020 [cm
                                                        writedata |= srcdata & dstdata;
                                        }
 
                                                        writedata |= srcdata & dstdata;
                                        }
 
-                                       if (GOURD) 
+                                       if (GOURD)
                                                writedata = ((gd_c[colour_index]) << 8) | (gd_i[colour_index] >> 16);
 
                                                writedata = ((gd_c[colour_index]) << 8) | (gd_i[colour_index] >> 16);
 
-                                       if (SRCSHADE) 
+                                       if (SRCSHADE)
                                        {
                                                int intensity = srcdata & 0xFF;
                                                int ia = gd_ia >> 16;
                                        {
                                                int intensity = srcdata & 0xFF;
                                                int ia = gd_ia >> 16;
@@ -946,7 +946,7 @@ Below fixes it, but then borks:
 ; O
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
 ; O
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
- CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN 
+ CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN
   A1 step values: -15 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -15 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -1054,8 +1054,8 @@ Lesse, with pre-add we'd have:
                a2_y += a2_step_y;//*/
 #endif
        }
                a2_y += a2_step_y;//*/
 #endif
        }
-       
-       // write values back to registers 
+
+       // write values back to registers
        WREG(A1_PIXEL,  (a1_y & 0xFFFF0000) | ((a1_x >> 16) & 0xFFFF));
        WREG(A1_FPIXEL, (a1_y << 16) | (a1_x & 0xFFFF));
        WREG(A2_PIXEL,  (a2_y & 0xFFFF0000) | ((a2_x >> 16) & 0xFFFF));
        WREG(A1_PIXEL,  (a1_y & 0xFFFF0000) | ((a1_x >> 16) & 0xFFFF));
        WREG(A1_FPIXEL, (a1_y << 16) | (a1_x & 0xFFFF));
        WREG(A2_PIXEL,  (a2_y & 0xFFFF0000) | ((a2_x >> 16) & 0xFFFF));
@@ -1091,7 +1091,7 @@ void blitter_blit(uint32 cmd)
 
        a1_zoffs = (REG(A1_FLAGS) >> 6) & 7;
        a2_zoffs = (REG(A2_FLAGS) >> 6) & 7;
 
        a1_zoffs = (REG(A1_FLAGS) >> 6) & 7;
        a2_zoffs = (REG(A2_FLAGS) >> 6) & 7;
-       
+
        xadd_a1_control = (REG(A1_FLAGS) >> 16) & 0x03;
        xadd_a2_control = (REG(A2_FLAGS) >> 16) & 0x03;
 
        xadd_a1_control = (REG(A1_FLAGS) >> 16) & 0x03;
        xadd_a2_control = (REG(A2_FLAGS) >> 16) & 0x03;
 
@@ -1160,7 +1160,7 @@ void blitter_blit(uint32 cmd)
                // add pixelsize (1) to X
                a1_xadd = 1 << 16;
                break;
                // add pixelsize (1) to X
                a1_xadd = 1 << 16;
                break;
-       case XADD0:     
+       case XADD0:
                // add zero (for those nice vertical lines)
                a1_xadd = 0;
                break;
                // add zero (for those nice vertical lines)
                a1_xadd = 0;
                break;
@@ -1204,7 +1204,7 @@ void blitter_blit(uint32 cmd)
                // add pixelsize (1) to X
                a2_xadd = 1 << 16;
                break;
                // add pixelsize (1) to X
                a2_xadd = 1 << 16;
                break;
-       case XADD0:     
+       case XADD0:
                // add zero (for those nice vertical lines)
                a2_xadd = 0;
                break;
                // add zero (for those nice vertical lines)
                a2_xadd = 0;
                break;
@@ -1282,7 +1282,7 @@ WriteLog("BLIT: Asked to use invalid bit combo (XADDINC) for A2...\n");
                        | ((uint32)blitter_ram[SRCDATA + 0] << 8) | blitter_ram[SRCDATA + 1];
 
                gouraud_add = REG(INTENSITYINC);
                        | ((uint32)blitter_ram[SRCDATA + 0] << 8) | blitter_ram[SRCDATA + 1];
 
                gouraud_add = REG(INTENSITYINC);
-               
+
                gd_ia = gouraud_add & 0x00FFFFFF;
                if (gd_ia & 0x00800000)
                        gd_ia = 0xFF000000 | gd_ia;
                gd_ia = gouraud_add & 0x00FFFFFF;
                if (gd_ia & 0x00800000)
                        gd_ia = 0xFF000000 | gd_ia;
@@ -1352,7 +1352,7 @@ WriteLog("BLIT: Asked to use invalid bit combo (XADDINC) for A2...\n");
                WriteLog("  GOURZ   = %i\n",GOURZ);
                WriteLog("  GOURD   = %i\n",GOURD);
                WriteLog("  SRCSHADE= %i\n",SRCSHADE);
                WriteLog("  GOURZ   = %i\n",GOURZ);
                WriteLog("  GOURD   = %i\n",GOURD);
                WriteLog("  SRCSHADE= %i\n",SRCSHADE);
-       }       
+       }
 #endif
 
 //NOTE: Pitch is ignored!
 #endif
 
 //NOTE: Pitch is ignored!
@@ -1362,24 +1362,24 @@ WriteLog("BLIT: Asked to use invalid bit combo (XADDINC) for A2...\n");
 //Black is short by 3, pink is short by 1...
 /*
 Blit! (00110000 <- 000BF010) count: 9 x 31, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
 //Black is short by 3, pink is short by 1...
 /*
 Blit! (00110000 <- 000BF010) count: 9 x 31, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
- CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         A1 x/y: 262/124, A2 x/y: 128/0
 Blit! (00110000 <- 000BF010) count: 5 x 38, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         A1 x/y: 262/124, A2 x/y: 128/0
 Blit! (00110000 <- 000BF010) count: 5 x 38, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
- CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         A1 x/y: 264/117, A2 x/y: 407/0
 
 Blit! (00110000 <- 000BF010) count: 9 x 23, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         A1 x/y: 264/117, A2 x/y: 407/0
 
 Blit! (00110000 <- 000BF010) count: 9 x 23, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
- CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 step values: -10 (X), 1 (Y)
   A1 -> pitch: 4(2) phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1(0) phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         A1 x/y: 262/132, A2 x/y: 129/0
 Blit! (00110000 <- 000BF010) count: 5 x 27, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
   A1 step values: -10 (X), 1 (Y)
   A1 -> pitch: 4(2) phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1(0) phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
         A1 x/y: 262/132, A2 x/y: 129/0
 Blit! (00110000 <- 000BF010) count: 5 x 27, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
- CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 step values: -8 (X), 1 (Y)
   A1 -> pitch: 4(2) phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1(0) phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -8 (X), 1 (Y)
   A1 -> pitch: 4(2) phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1(0) phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -1398,7 +1398,7 @@ Fixed! Now for more:
 ; This looks like the ship icon in the upper left corner...
 
 Blit! (00110000 <- 0010B2A8) count: 11 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
 ; This looks like the ship icon in the upper left corner...
 
 Blit! (00110000 <- 0010B2A8) count: 11 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
- CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN 
+ CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN
   A1 step values: -12 (X), 1 (Y)
   A2 step values: 0 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -12 (X), 1 (Y)
   A2 step values: 0 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -1415,7 +1415,7 @@ Actually, if you look at the A1 step values, there IS a discrepancy!
 ; D
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
 ; D
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
- CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN 
+ CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN
   A1 step values: -14 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -14 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -1426,7 +1426,7 @@ Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd:
 ; E
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
 ; E
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
- CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN 
+ CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN
   A1 step values: -13 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -13 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -1436,7 +1436,7 @@ Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd:
 ; M
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
 ; M
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
- CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN 
+ CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN
   A1 step values: -12 (X), 1 (Y)
   A2 step values: 0 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -12 (X), 1 (Y)
   A2 step values: 0 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -1446,7 +1446,7 @@ Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd:
 ; O
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
 ; O
 
 Blit! (00110000 <- 0010B2A8) count: 12 x 12, A1/2_FLAGS: 000042E2/00000020 [cmd: 09800609]
- CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN 
+ CMD -> src: SRCEN  dst: DSTEN  misc:  a1ctl: UPDA1 UPDA2 mode:  ity:  z-op:  op: LFU_REPLACE ctrl: DCOMPEN
   A1 step values: -15 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A1 step values: -15 (X), 1 (Y)
   A2 step values: -4 (X), 0 (Y) [mask (unused): 00000000 - FFFFFFFF/FFFFFFFF]
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
@@ -1525,17 +1525,17 @@ if (blit_start_log)
 ********************** STUFF CUT ABOVE THIS LINE! ******************************
 *******************************************************************************/
 
 ********************** STUFF CUT ABOVE THIS LINE! ******************************
 *******************************************************************************/
 
-void blitter_init(void)
+void BlitterInit(void)
 {
 {
-       blitter_reset();
+       BlitterReset();
 }
 
 }
 
-void blitter_reset(void)
+void BlitterReset(void)
 {
        memset(blitter_ram, 0x00, 0xA0);
 }
 
 {
        memset(blitter_ram, 0x00, 0xA0);
 }
 
-void blitter_done(void)
+void BlitterDone(void)
 {
        WriteLog("BLIT: Done.\n");
 }
 {
        WriteLog("BLIT: Done.\n");
 }
@@ -1602,12 +1602,12 @@ void BlitterWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/)
                case 0x81: blitter_ram[PATTERNDATA + 5] = data; break;
                case 0x82: blitter_ram[SRCDATA + 4] = data; break;
                case 0x83: blitter_ram[SRCDATA + 5] = data; break;
                case 0x81: blitter_ram[PATTERNDATA + 5] = data; break;
                case 0x82: blitter_ram[SRCDATA + 4] = data; break;
                case 0x83: blitter_ram[SRCDATA + 5] = data; break;
-               
+
                case 0x84: break;
                case 0x85: blitter_ram[PATTERNDATA + 3] = data; break;
                case 0x86: blitter_ram[SRCDATA + 2] = data; break;
                case 0x87: blitter_ram[SRCDATA + 3] = data; break;
                case 0x84: break;
                case 0x85: blitter_ram[PATTERNDATA + 3] = data; break;
                case 0x86: blitter_ram[SRCDATA + 2] = data; break;
                case 0x87: blitter_ram[SRCDATA + 3] = data; break;
-               
+
                case 0x88: break;
                case 0x89: blitter_ram[PATTERNDATA + 1] = data; break;
                case 0x8A: blitter_ram[SRCDATA + 0] = data; break;
                case 0x88: break;
                case 0x89: blitter_ram[PATTERNDATA + 1] = data; break;
                case 0x8A: blitter_ram[SRCDATA + 0] = data; break;
@@ -1624,12 +1624,12 @@ void BlitterWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/)
                case 0x91: blitter_ram[SRCZINT + 5] = data; break;
                case 0x92: blitter_ram[SRCZFRAC + 4] = data; break;
                case 0x93: blitter_ram[SRCZFRAC + 5] = data; break;
                case 0x91: blitter_ram[SRCZINT + 5] = data; break;
                case 0x92: blitter_ram[SRCZFRAC + 4] = data; break;
                case 0x93: blitter_ram[SRCZFRAC + 5] = data; break;
-               
+
                case 0x94: blitter_ram[SRCZINT + 2] = data; break;
                case 0x95: blitter_ram[SRCZINT + 3] = data; break;
                case 0x96: blitter_ram[SRCZFRAC + 2] = data; break;
                case 0x97: blitter_ram[SRCZFRAC + 3] = data; break;
                case 0x94: blitter_ram[SRCZINT + 2] = data; break;
                case 0x95: blitter_ram[SRCZINT + 3] = data; break;
                case 0x96: blitter_ram[SRCZFRAC + 2] = data; break;
                case 0x97: blitter_ram[SRCZFRAC + 3] = data; break;
-               
+
                case 0x98: blitter_ram[SRCZINT + 0] = data; break;
                case 0x99: blitter_ram[SRCZINT + 1] = data; break;
                case 0x9A: blitter_ram[SRCZFRAC + 0] = data; break;
                case 0x98: blitter_ram[SRCZINT + 0] = data; break;
                case 0x99: blitter_ram[SRCZINT + 1] = data; break;
                case 0x9A: blitter_ram[SRCZFRAC + 0] = data; break;
@@ -2015,7 +2015,7 @@ sread:                                                    // Source data read
 //pointing at. Likewise, the pixel (if in BPP 1, 2 & 4, chopped) otherwise. It probably still
 //transfers an entire phrase even in pixel mode.
 //Odd thought: Does it expand, e.g., 1 BPP pixels into 32 BPP internally? Hmm...
 //pointing at. Likewise, the pixel (if in BPP 1, 2 & 4, chopped) otherwise. It probably still
 //transfers an entire phrase even in pixel mode.
 //Odd thought: Does it expand, e.g., 1 BPP pixels into 32 BPP internally? Hmm...
-//No. 
+//No.
 /*
        a1_addr = REG(A1_BASE) & 0xFFFFFFF8;
        a2_addr = REG(A2_BASE) & 0xFFFFFFF8;
 /*
        a1_addr = REG(A1_BASE) & 0xFFFFFFF8;
        a2_addr = REG(A2_BASE) & 0xFFFFFFF8;
@@ -2036,7 +2036,7 @@ sread:                                                    // Source data read
        a1_width = ((0x04 | m) << e) >> 2;
        a2_width = ((0x04 | m) << e) >> 2;
 
        a1_width = ((0x04 | m) << e) >> 2;
        a2_width = ((0x04 | m) << e) >> 2;
 
-       // write values back to registers 
+       // write values back to registers
        WREG(A1_PIXEL,  (a1_y & 0xFFFF0000) | ((a1_x >> 16) & 0xFFFF));
        WREG(A1_FPIXEL, (a1_y << 16) | (a1_x & 0xFFFF));
        WREG(A2_PIXEL,  (a2_y & 0xFFFF0000) | ((a2_x >> 16) & 0xFFFF));
        WREG(A1_PIXEL,  (a1_y & 0xFFFF0000) | ((a1_x >> 16) & 0xFFFF));
        WREG(A1_FPIXEL, (a1_y << 16) | (a1_x & 0xFFFF));
        WREG(A2_PIXEL,  (a2_y & 0xFFFF0000) | ((a2_x >> 16) & 0xFFFF));
@@ -2251,7 +2251,7 @@ Blit!
        }
 
        // Figure out what gets written...
        }
 
        // Figure out what gets written...
-       
+
        if (PATDSEL)
        {
                writeData = GET64(blitter_ram, PATTERNDATA);
        if (PATDSEL)
        {
                writeData = GET64(blitter_ram, PATTERNDATA);
@@ -2274,7 +2274,7 @@ Blit!
        else    // LFUFUNC is the default...
        {
                writeData = 0;
        else    // LFUFUNC is the default...
        {
                writeData = 0;
-               
+
                if (LFU_NAN)
                        writeData |= ~srcData & ~dstData;
                if (LFU_NA)
                if (LFU_NAN)
                        writeData |= ~srcData & ~dstData;
                if (LFU_NA)
@@ -2376,7 +2376,7 @@ inhibitWrite://Should this go here? or on the other side of the X/Y incrementing
                a2_x += (blitter_ram[A2_FLAGS + 1] & 0x08 ? -1 << 16 : 1 << 16);
 /*     else if ((blitter_ram[A2_FLAGS + 1] & 0x03) == 2)
                a2_x += 0 << 16;                              */
                a2_x += (blitter_ram[A2_FLAGS + 1] & 0x08 ? -1 << 16 : 1 << 16);
 /*     else if ((blitter_ram[A2_FLAGS + 1] & 0x03) == 2)
                a2_x += 0 << 16;                              */
-       
+
        if (blitter_ram[A2_FLAGS + 1] & 0x04)
                a2_y += (blitter_ram[A2_FLAGS + 1] & 0x10 ? -1 << 16 : 1 << 16);
 
        if (blitter_ram[A2_FLAGS + 1] & 0x04)
                a2_y += (blitter_ram[A2_FLAGS + 1] & 0x10 ? -1 << 16 : 1 << 16);
 
@@ -2708,9 +2708,9 @@ if (
        && cmd != 0x00011040    // CLIP_A1 GOURD PATDSEL
 //Checkered flag:
        && cmd != 0x01800000    // LFUFUNC=C
        && cmd != 0x00011040    // CLIP_A1 GOURD PATDSEL
 //Checkered flag:
        && cmd != 0x01800000    // LFUFUNC=C
-       && cmd != 0x01800401    // 
-       && cmd != 0x01800040    // 
-       && cmd != 0x00020008    // 
+       && cmd != 0x01800401    //
+       && cmd != 0x01800040    //
+       && cmd != 0x00020008    //
 //     && cmd != 0x09800F41    // SRCEN CLIP_A1 UPDA1 UPDA1F UPDA2 DSTA2 LFUFUNC=C DCOMPEN
        )
        logBlit = true;//*/
 //     && cmd != 0x09800F41    // SRCEN CLIP_A1 UPDA1 UPDA1F UPDA2 DSTA2 LFUFUNC=C DCOMPEN
        )
        logBlit = true;//*/
@@ -2807,7 +2807,7 @@ fflush(stdout);
 #endif
 
        // Lines that don't exist in Jaguar I (and will never be asserted)
 #endif
 
        // Lines that don't exist in Jaguar I (and will never be asserted)
-       
+
        bool polygon = false, datinit = false, a1_stepld = false, a2_stepld = false, ext_int = false;
        bool istepadd = false, istepfadd = false, finneradd = false, inneradd = false;
        bool zstepfadd = false, zstepadd = false;
        bool polygon = false, datinit = false, a1_stepld = false, a2_stepld = false, ext_int = false;
        bool istepadd = false, istepfadd = false, finneradd = false, inneradd = false;
        bool zstepfadd = false, zstepadd = false;
@@ -2932,7 +2932,7 @@ if ((cmd == 0x00010200) && (GET16(blitter_ram, PIXLINECOUNTER + 2) == 9))
 ; Pink altimeter bar
 
 Blit! (00110000 <- 000BF010) count: 9 x 23, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
 ; Pink altimeter bar
 
 Blit! (00110000 <- 000BF010) count: 9 x 23, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
- CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 step values: -10 (X), 1 (Y)
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -10 (X), 1 (Y)
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -2943,7 +2943,7 @@ Blit! (00110000 <- 000BF010) count: 9 x 23, A1/2_FLAGS: 000042E2/00010020 [cmd:
 ; Black altimeter bar
 
 Blit! (00110000 <- 000BF010) count: 5 x 29, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
 ; Black altimeter bar
 
 Blit! (00110000 <- 000BF010) count: 5 x 29, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
- CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl: 
+ CMD -> src:  dst:  misc:  a1ctl: UPDA1  mode:  ity: PATDSEL z-op:  op: LFU_CLEAR ctrl:
   A1 step values: -8 (X), 1 (Y)
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
   A1 step values: -8 (X), 1 (Y)
   A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
   A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
@@ -2987,7 +2987,7 @@ Flags: UPDA1 PATDSEL
 */
 
        // Bugs in Jaguar I
 */
 
        // Bugs in Jaguar I
-       
+
        a2addy = a1addy;                                                        // A2 channel Y add bit is tied to A1's
 
 //if (logBlit && (ocount > 20)) logBlit = false;
        a2addy = a1addy;                                                        // A2 channel Y add bit is tied to A1's
 
 //if (logBlit && (ocount > 20)) logBlit = false;
@@ -3013,7 +3013,7 @@ printf("  srcz1=%08X%08X srcz2=%08X%08X dstz=%08X%08X zinc=%08X, coll=%X\n",
        (uint32)(srcz2 >> 32), (uint32)(srcz2 & 0xFFFFFFFF),
        (uint32)(dstz >> 32), (uint32)(dstz & 0xFFFFFFFF), zinc, collision);
 }
        (uint32)(srcz2 >> 32), (uint32)(srcz2 & 0xFFFFFFFF),
        (uint32)(dstz >> 32), (uint32)(dstz & 0xFFFFFFFF), zinc, collision);
 }
-#endif 
+#endif
 
        // Various state lines set up by user
 
 
        // Various state lines set up by user
 
@@ -3034,7 +3034,7 @@ fflush(stdout);
        while (true)
        {
                // IDLE
        while (true)
        {
                // IDLE
-       
+
                if ((idle && !go) || (inner && outer0 && indone))
                {
 #ifdef VERBOSE_BLITTER_LOGGING
                if ((idle && !go) || (inner && outer0 && indone))
                {
 #ifdef VERBOSE_BLITTER_LOGGING
@@ -3052,7 +3052,7 @@ break;
                }
                else
                        idlei = false;
                }
                else
                        idlei = false;
-       
+
                // INNER LOOP ACTIVE
 /*
   Entering DWRITE state... (icount=0000, inc=4)
                // INNER LOOP ACTIVE
 /*
   Entering DWRITE state... (icount=0000, inc=4)
@@ -3063,7 +3063,7 @@ break;
 Now:
   [in=F a1f=F a1=F zf=F z=F a2=F iif=F iii=F izf=F izi=F]
 */
 Now:
   [in=F a1f=F a1=F zf=F z=F a2=F iif=F iii=F izf=F izi=F]
 */
-       
+
                if ((idle && go && !datinit)
                        || (inner && !indone)
                        || (inner && indone && !outer0 && !upda1f && !upda1 && notgzandp && !upda2 && !datinit)
                if ((idle && go && !datinit)
                        || (inner && !indone)
                        || (inner && indone && !outer0 && !upda1f && !upda1 && notgzandp && !upda2 && !datinit)
@@ -3077,9 +3077,9 @@ Now:
                }
                else
                        inneri = false;
                }
                else
                        inneri = false;
-       
+
                // A1 FRACTION UPDATE
                // A1 FRACTION UPDATE
-       
+
                if (inner && indone && !outer0 && upda1f)
                {
                        a1fupdatei = true;
                if (inner && indone && !outer0 && upda1f)
                {
                        a1fupdatei = true;
@@ -3126,9 +3126,9 @@ Now:
                }
                else
                        a2updatei = false;
                }
                else
                        a2updatei = false;
-       
+
                // INITIALIZE INTENSITY FRACTION
                // INITIALIZE INTENSITY FRACTION
-       
+
                if ((zupdate && !upda2 && datinit)
                        || (a1update && !upda2 && datinit && notgzandp)
                        || (inner && indone && !outer0 && !upda1f && !upda1 && notgzandp && !upda2 && datinit)
                if ((zupdate && !upda2 && datinit)
                        || (a1update && !upda2 && datinit && notgzandp)
                        || (inner && indone && !outer0 && !upda1f && !upda1 && notgzandp && !upda2 && datinit)
@@ -3139,34 +3139,34 @@ Now:
                }
                else
                        init_ifi = false;
                }
                else
                        init_ifi = false;
-       
+
                // INITIALIZE INTENSITY INTEGER
                // INITIALIZE INTENSITY INTEGER
-       
+
                if (init_if)
                {
                        init_iii = true;
                }
                else
                        init_iii = false;
                if (init_if)
                {
                        init_iii = true;
                }
                else
                        init_iii = false;
-       
+
                // INITIALIZE Z FRACTION
                // INITIALIZE Z FRACTION
-       
+
                if (init_ii && gourz)
                {
                        init_zfi = true;
                }
                else
                        init_zfi = false;
                if (init_ii && gourz)
                {
                        init_zfi = true;
                }
                else
                        init_zfi = false;
-       
+
                // INITIALIZE Z INTEGER
                // INITIALIZE Z INTEGER
-       
+
                if (init_zf)
                {
                        init_zii = true;
                }
                else
                        init_zii = false;
                if (init_zf)
                {
                        init_zii = true;
                }
                else
                        init_zii = false;
-       
+
 // Here we move the fooi into their foo counterparts in order to simulate the moving
 // of data into the various FDSYNCs... Each time we loop we simulate one clock cycle...
 
 // Here we move the fooi into their foo counterparts in order to simulate the moving
 // of data into the various FDSYNCs... Each time we loop we simulate one clock cycle...
 
@@ -3604,14 +3604,14 @@ daddbsel |= (istepadd && istepfadd && zstepadd && zstepfadd ? 0x08 : 0x00);
 /* Data adder mode control
 000    16-bit normal add
 001    16-bit saturating add with carry
 /* Data adder mode control
 000    16-bit normal add
 001    16-bit saturating add with carry
-010    8-bit saturating add with carry, carry into top byte is 
+010    8-bit saturating add with carry, carry into top byte is
        inhibited (YCrCb)
        inhibited (YCrCb)
-011    8-bit saturating add with carry, carry into top byte and 
+011    8-bit saturating add with carry, carry into top byte and
        between top nybbles is inhibited (CRY)
 100    16-bit normal add with carry
 101    16-bit saturating add
 110    8-bit saturating add, carry into top byte is inhibited
        between top nybbles is inhibited (CRY)
 100    16-bit normal add with carry
 101    16-bit saturating add
 110    8-bit saturating add, carry into top byte is inhibited
-111    8-bit saturating add, carry into top byte and between top 
+111    8-bit saturating add, carry into top byte and between top
        nybbles is inhibited
 
 The first five are used for Gouraud calculations, the latter three
        nybbles is inhibited
 
 The first five are used for Gouraud calculations, the latter three
@@ -3630,7 +3630,7 @@ Bit 0 =   dzwrite . gourz . atick[1]
        + init_ii . /topnen . /topben . /ext_int
        + init_ii .  topnen .  topben . /ext_int
        + init_zi
        + init_ii . /topnen . /topben . /ext_int
        + init_ii .  topnen .  topben . /ext_int
        + init_zi
-               
+
 Bit 1 =   dwrite . gourd . atick[1] . /topben . /ext_int
        + istepadd . /topben . /ext_int
        + /gourd . /gourz .  /topben
 Bit 1 =   dwrite . gourd . atick[1] . /topben . /ext_int
        + istepadd . /topben . /ext_int
        + /gourd . /gourz .  /topben
@@ -3655,8 +3655,8 @@ daddmode |= ((dwrite && gourd && !topben && !ext_int) || (istepadd && !topben &&
        || (init_ii && !topben && !ext_int) ? 0x02 : 0x00);
 daddmode |= ((!gourd && !gourz) || shadeadd || (dwrite && gourd && ext_int)
        || (istepadd && ext_int) || (init_ii && ext_int) ? 0x04 : 0x00);
        || (init_ii && !topben && !ext_int) ? 0x02 : 0x00);
 daddmode |= ((!gourd && !gourz) || shadeadd || (dwrite && gourd && ext_int)
        || (istepadd && ext_int) || (init_ii && ext_int) ? 0x04 : 0x00);
-/* Data add load controls 
-Pattern fraction (dest data) is loaded on 
+/* Data add load controls
+Pattern fraction (dest data) is loaded on
          dwrite . gourd . atick[0]
        + istepfadd . /datinit
        + init_if
          dwrite . gourd . atick[0]
        + istepfadd . /datinit
        + init_if
@@ -3664,11 +3664,11 @@ Pattern data is loaded on
          dwrite . gourd . atick[1]
        + istepadd . /datinit . /datinit
        + init_ii
          dwrite . gourd . atick[1]
        + istepadd . /datinit . /datinit
        + init_ii
-Source z1 is loaded on 
+Source z1 is loaded on
          dzwrite . gourz . atick[1]
        + zstepadd . /datinit . /datinit
        + init_zi
          dzwrite . gourz . atick[1]
        + zstepadd . /datinit . /datinit
        + init_zi
-Source z2 is loaded on 
+Source z2 is loaded on
          dzwrite . gourz . atick[0]
        + zstepfadd
        + init_zf
          dzwrite . gourz . atick[0]
        + zstepfadd
        + init_zf
@@ -3709,17 +3709,17 @@ if (!justify)
 
 /* Generate source alignment shift
    -------------------------------
 
 /* Generate source alignment shift
    -------------------------------
-The source alignment shift for data move is the difference between 
-the source and destination X pointers, multiplied by the pixel 
-size.  Only the low six bits of the pointers are of interest, as 
-pixel sizes are always a power of 2 and window rows are always 
-phrase aligned.  
+The source alignment shift for data move is the difference between
+the source and destination X pointers, multiplied by the pixel
+size.  Only the low six bits of the pointers are of interest, as
+pixel sizes are always a power of 2 and window rows are always
+phrase aligned.
 
 When not in phrase mode, the top 3 bits of the shift value are
 set to zero (2/26).
 
 Source shifting is also used to extract bits for bit-to-byte
 
 When not in phrase mode, the top 3 bits of the shift value are
 set to zero (2/26).
 
 Source shifting is also used to extract bits for bit-to-byte
-expansion in phrase mode.  This involves only the bottom three 
+expansion in phrase mode.  This involves only the bottom three
 bits of the shift value, and is based on the offset within the
 phrase of the destination X pointer, in pixels.
 
 bits of the shift value, and is based on the offset within the
 phrase of the destination X pointer, in pixels.
 
@@ -4569,7 +4569,7 @@ cause the inner state to go active */
 //Since we don't get here until the inner loop is finished (indone = true) we can get
 //away with doing it here...!
                        ocount--;
 //Since we don't get here until the inner loop is finished (indone = true) we can get
 //away with doing it here...!
                        ocount--;
-               
+
                        if (ocount == 0)
                                outer0 = true;
 #ifdef VERBOSE_BLITTER_LOGGING
                        if (ocount == 0)
                                outer0 = true;
 #ifdef VERBOSE_BLITTER_LOGGING
@@ -4617,7 +4617,7 @@ fflush(stdout);
 }
 #endif
                }
 }
 #endif
                }
-               
+
                if (a2update)
                {
 #ifdef VERBOSE_BLITTER_LOGGING
                if (a2update)
                {
 #ifdef VERBOSE_BLITTER_LOGGING
@@ -4644,7 +4644,7 @@ fflush(stdout);
 #ifdef VERBOSE_BLITTER_LOGGING
 if (logBlit)
 {
 #ifdef VERBOSE_BLITTER_LOGGING
 if (logBlit)
 {
-       printf("Done!\na1_x=%04X a1_y=%04X a1_frac_x=%04X a1_frac_y=%04X a2_x=%04X a2_y%04X\n", 
+       printf("Done!\na1_x=%04X a1_y=%04X a1_frac_x=%04X a1_frac_y=%04X a2_x=%04X a2_y%04X\n",
                GET16(blitter_ram, A1_PIXEL + 2),
                GET16(blitter_ram, A1_PIXEL + 0),
                GET16(blitter_ram, A1_FPIXEL + 2),
                GET16(blitter_ram, A1_PIXEL + 2),
                GET16(blitter_ram, A1_PIXEL + 0),
                GET16(blitter_ram, A1_FPIXEL + 2),
@@ -4666,7 +4666,7 @@ if (logBlit)
 #ifdef VERBOSE_BLITTER_LOGGING
 if (logBlit)
 {
 #ifdef VERBOSE_BLITTER_LOGGING
 if (logBlit)
 {
-       printf("Writeback!\na1_x=%04X a1_y=%04X a1_frac_x=%04X a1_frac_y=%04X a2_x=%04X a2_y%04X\n", 
+       printf("Writeback!\na1_x=%04X a1_y=%04X a1_frac_x=%04X a1_frac_y=%04X a2_x=%04X a2_y%04X\n",
                GET16(blitter_ram, A1_PIXEL + 2),
                GET16(blitter_ram, A1_PIXEL + 0),
                GET16(blitter_ram, A1_FPIXEL + 2),
                GET16(blitter_ram, A1_PIXEL + 2),
                GET16(blitter_ram, A1_PIXEL + 0),
                GET16(blitter_ram, A1_FPIXEL + 2),
@@ -5119,7 +5119,7 @@ addasel[0..2] select the register to add
 adda_xconst[0..2] generate a power of 2 in the range 1-64 or all zeroes when
 they are all 1.
 
 adda_xconst[0..2] generate a power of 2 in the range 1-64 or all zeroes when
 they are all 1.
 
-addareg selects register value to be added as opposed to constant 
+addareg selects register value to be added as opposed to constant
 value.
 
 suba_x, suba_y complement the X and Y values
 value.
 
 suba_x, suba_y complement the X and Y values
@@ -5154,7 +5154,7 @@ void ADDAMUX(int16 &adda_x, int16 &adda_y, uint8 addasel, int16 a1_step_x, int16
        bool adda_yconst, bool addareg, bool suba_x, bool suba_y)
 {
 
        bool adda_yconst, bool addareg, bool suba_x, bool suba_y)
 {
 
-/*INT16/       addac_x, addac_y, addar_x, addar_y, addart_x, addart_y, 
+/*INT16/       addac_x, addac_y, addar_x, addar_y, addart_x, addart_y,
 INT16/ addas_x, addas_y, suba_x16, suba_y16
 :LOCAL;
 BEGIN
 INT16/ addas_x, addas_y, suba_x16, suba_y16
 :LOCAL;
 BEGIN
@@ -5177,7 +5177,7 @@ Addar_y           := MX2 (addar_y, addart_y, a2_step_y, addaselb[2]);*/
        int16 addar_y = (addasel & 0x04 ? a2_step_y : yterm[addasel & 0x03]);
 //////////////////////////////////////////////////////////////////////////////////////
 
        int16 addar_y = (addasel & 0x04 ? a2_step_y : yterm[addasel & 0x03]);
 //////////////////////////////////////////////////////////////////////////////////////
 
-/* Generate a constant value - this is a power of 2 in the range 
+/* Generate a constant value - this is a power of 2 in the range
 0-64, or zero.  The control bits are adda_xconst[0..2], when they
 are all 1  the result is 0.
 Constants for Y can only be 0 or 1 */
 0-64, or zero.  The control bits are adda_xconst[0..2], when they
 are all 1  the result is 0.
 Constants for Y can only be 0 or 1 */
@@ -5186,7 +5186,7 @@ Constants for Y can only be 0 or 1 */
 Unused[0]      := DUMMY (unused[0]);
 
 Addac_x                := JOIN (addac_x, addac_x[0..6], zero, zero, zero, zero, zero, zero, zero, zero, zero);
 Unused[0]      := DUMMY (unused[0]);
 
 Addac_x                := JOIN (addac_x, addac_x[0..6], zero, zero, zero, zero, zero, zero, zero, zero, zero);
-Addac_y                := JOIN (addac_y, adda_yconst, zero, zero, zero, zero, zero, zero, zero, zero, zero, zero, 
+Addac_y                := JOIN (addac_y, adda_yconst, zero, zero, zero, zero, zero, zero, zero, zero, zero, zero,
                        zero, zero, zero, zero, zero);*/
 ////////////////////////////////////// C++ CODE //////////////////////////////////////
        int16 addac_x = (adda_xconst == 0x07 ? 0 : 1 << adda_xconst);
                        zero, zero, zero, zero, zero);*/
 ////////////////////////////////////// C++ CODE //////////////////////////////////////
        int16 addac_x = (adda_xconst == 0x07 ? 0 : 1 << adda_xconst);
@@ -5204,9 +5204,9 @@ Addas_y           := MX2 (addas_y, addac_y, addar_y, addareg);*/
 
 /* Complement these values (complement flag gives adder carry in)*/
 
 
 /* Complement these values (complement flag gives adder carry in)*/
 
-/*Suba_x16     := JOIN (suba_x16, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, 
+/*Suba_x16     := JOIN (suba_x16, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x,
                        suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x);
                        suba_x, suba_x, suba_x, suba_x, suba_x, suba_x, suba_x);
-Suba_y16       := JOIN (suba_y16, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, 
+Suba_y16       := JOIN (suba_y16, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y,
                        suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y);
 Adda_x         := EO (adda_x, suba_x16, addas_x);
 Adda_y         := EO (adda_y, suba_y16, addas_y);*/
                        suba_y, suba_y, suba_y, suba_y, suba_y, suba_y, suba_y);
 Adda_x         := EO (adda_x, suba_x16, addas_x);
 Adda_y         := EO (adda_y, suba_y16, addas_y);*/
@@ -5220,9 +5220,9 @@ Adda_y            := EO (adda_y, suba_y16, addas_y);*/
 
 /**  ADDBMUX - Address adder input B selection  *******************
 
 
 /**  ADDBMUX - Address adder input B selection  *******************
 
-This module selects the register to be updated by the address 
-adder.  This can be one of three registers, the A1 and A2 
-pointers, or the A1 fractional part. It can also be zero, so that the step 
+This module selects the register to be updated by the address
+adder.  This can be one of three registers, the A1 and A2
+pointers, or the A1 fractional part. It can also be zero, so that the step
 registers load directly into the pointers.
 */
 
 registers load directly into the pointers.
 */
 
@@ -5245,7 +5245,7 @@ void ADDBMUX(int16 &addb_x, int16 &addb_y, uint8 addbsel, int16 a1_x, int16 a1_y
 {
 
 /*Zero         := TIE0 (zero);
 {
 
 /*Zero         := TIE0 (zero);
-Zero16         := JOIN (zero16, zero, zero, zero, zero, zero, zero, zero, 
+Zero16         := JOIN (zero16, zero, zero, zero, zero, zero, zero, zero,
                        zero, zero, zero, zero, zero, zero, zero, zero, zero);
 Addbselb[0-1]  := BUF8 (addbselb[0-1], addbsel[0-1]);
 Addb_x         := MX4 (addb_x, a1_x, a2_x, a1_frac_x, zero16, addbselb[0..1]);
                        zero, zero, zero, zero, zero, zero, zero, zero, zero);
 Addbselb[0-1]  := BUF8 (addbselb[0-1], addbsel[0-1]);
 Addb_x         := MX4 (addb_x, a1_x, a2_x, a1_frac_x, zero16, addbselb[0..1]);
@@ -5301,10 +5301,10 @@ addradd
 
 Blitter Address Adder
 ---------------------
 
 Blitter Address Adder
 ---------------------
-The blitter address adder is a pair of sixteen bit adders, one 
-each for X and Y.  The multiplexing of the input terms is 
-performed elsewhere, but this adder can also perform modulo 
-arithmetic to align X-addresses onto phrase boundaries. 
+The blitter address adder is a pair of sixteen bit adders, one
+each for X and Y.  The multiplexing of the input terms is
+performed elsewhere, but this adder can also perform modulo
+arithmetic to align X-addresses onto phrase boundaries.
 
 modx[0..2] take values
 000    no mask
 
 modx[0..2] take values
 000    no mask
@@ -5330,7 +5330,7 @@ INT16/    addb_y
                modx[0..2]
                suba_x
                suba_y
                modx[0..2]
                suba_x
                suba_y
-               :IN); 
+               :IN);
 
 BEGIN
 
 
 BEGIN
 
@@ -5394,7 +5394,7 @@ DEF DATA (
                dcomp[0..7]             // data byte equal flags
                srcd[0..7]              // bits to use for bit to byte expansion
                zcomp[0..3]             // output from Z comparators
                dcomp[0..7]             // data byte equal flags
                srcd[0..7]              // bits to use for bit to byte expansion
                zcomp[0..3]             // output from Z comparators
-               :OUT; 
+               :OUT;
                a1_x[0..1]              // low two bits of A1 X pointer
                big_pix                 // pixel organisation is big-endian
                blitter_active  // blitter is active
                a1_x[0..1]              // low two bits of A1 X pointer
                big_pix                 // pixel organisation is big-endian
                blitter_active  // blitter is active
@@ -5477,13 +5477,13 @@ Srcd[0-7]       := JOIN (srcd[0-7], srcdlo{0-7});
 Srcd[8-31]     := JOIN (srcd[8-31], srcdlo{8-31});
 Srcd[32-63]    := JOIN (srcd[32-63], srcdhi{0-31});*/
 
 Srcd[8-31]     := JOIN (srcd[8-31], srcdlo{8-31});
 Srcd[32-63]    := JOIN (srcd[32-63], srcdhi{0-31});*/
 
-// Destination data registers 
+// Destination data registers
 
 /*Data_dst     := DATA_DST (dstd[0..63], dstz[0..1], clk, dstdld[0..1], dstzld[0..1], load_data[0..1]);
 Dstdlo         := JOIN (dstdlo, dstd[0..31]);
 Dstdhi         := JOIN (dstdhi, dstd[32..63]);*/
 
 
 /*Data_dst     := DATA_DST (dstd[0..63], dstz[0..1], clk, dstdld[0..1], dstzld[0..1], load_data[0..1]);
 Dstdlo         := JOIN (dstdlo, dstd[0..31]);
 Dstdhi         := JOIN (dstdhi, dstd[32..63]);*/
 
-// Pattern and Color data registers 
+// Pattern and Color data registers
 
 // Looks like this is simply another register file for the pattern data registers. No adding or anything funky
 // going on. Note that patd & patdv will output the same info.
 
 // Looks like this is simply another register file for the pattern data registers. No adding or anything funky
 // going on. Note that patd & patdv will output the same info.
@@ -5497,7 +5497,7 @@ Patdhi            := JOIN (patdhi, patd[32..63]);*/
 
 // Multiplying data Mixer (NOT IN JAGUAR I)
 
 
 // Multiplying data Mixer (NOT IN JAGUAR I)
 
-/*Datamix              := DATAMIX (patdo[0..1], clk, colord[0..15], dpipe[1], dstd[0..63], int0dp[8..10], int1dp[8..10], 
+/*Datamix              := DATAMIX (patdo[0..1], clk, colord[0..15], dpipe[1], dstd[0..63], int0dp[8..10], int1dp[8..10],
                        int2dp[8..10], int3dp[8..10], mixsel[0..2], patd[0..63], pdsel[0..1], srcd[0..63], textrgb, txtd[0..63]);*/
 
 // Logic function unit
                        int2dp[8..10], int3dp[8..10], mixsel[0..2], patd[0..63], pdsel[0..1], srcd[0..63], textrgb, txtd[0..63]);*/
 
 // Logic function unit
@@ -5513,7 +5513,7 @@ Patdhi            := JOIN (patdhi, patd[32..63]);*/
 //////////////////////////////////////////////////////////////////////////////////////
 
 // Increment and Step Registers
 //////////////////////////////////////////////////////////////////////////////////////
 
 // Increment and Step Registers
-   
+
 // Does it do anything without the step add lines? Check it!
 // No. This is pretty much just a register file without the Jaguar II lines...
 /*Inc_step     := INC_STEP (iinc, istep[0..31], zinc, zstep[0..31], clk, ext_int, gpu_din, iincld, iincldx, istepadd,
 // Does it do anything without the step add lines? Check it!
 // No. This is pretty much just a register file without the Jaguar II lines...
 /*Inc_step     := INC_STEP (iinc, istep[0..31], zinc, zstep[0..31], clk, ext_int, gpu_din, iincld, iincldx, istepadd,
@@ -5609,7 +5609,7 @@ if (logBlit)
 // 22 Mar 94
 // The data initializer - allows all four initial values to be computed from one (NOT IN JAGUAR I)
 
 // 22 Mar 94
 // The data initializer - allows all four initial values to be computed from one (NOT IN JAGUAR I)
 
-/*Datinit              := DATINIT (initcin[0..3], initinc[0..63], initpix[0..15], a1_x[0..1], big_pix, clk, iinc, init_if, init_ii, 
+/*Datinit              := DATINIT (initcin[0..3], initinc[0..63], initpix[0..15], a1_x[0..1], big_pix, clk, iinc, init_if, init_ii,
                        init_zf, istep[0..31], zinc, zstep[0..31]);*/
 
 // Adder array for Z and intensity increments
                        init_zf, istep[0..31], zinc, zstep[0..31]);*/
 
 // Adder array for Z and intensity increments
@@ -5738,7 +5738,7 @@ Maskt[9-14]       := OAN1P (maskt[9-14], maskt[8-13], s_coarse[2-7], e_coarse\[2-7]);*
 //////////////////////////////////////////////////////////////////////////////////////
 
 /* The bit terms are mirrored for big-endian pixels outside phrase
 //////////////////////////////////////////////////////////////////////////////////////
 
 /* The bit terms are mirrored for big-endian pixels outside phrase
-mode.  The byte terms are mirrored for big-endian pixels in phrase 
+mode.  The byte terms are mirrored for big-endian pixels in phrase
 mode.  */
 
 /*Mirror_bit   := AN2M (mir_bit, phrase_mode\, big_pix);
 mode.  */
 
 /*Mirror_bit   := AN2M (mir_bit, phrase_mode\, big_pix);
@@ -5887,7 +5887,7 @@ END;*/
 /**  COMP_CTRL - Comparator output control logic  *****************
 
 This block is responsible for taking the comparator outputs and
 /**  COMP_CTRL - Comparator output control logic  *****************
 
 This block is responsible for taking the comparator outputs and
-using them as appropriate to inhibit writes.  Two methods are 
+using them as appropriate to inhibit writes.  Two methods are
 supported for inhibiting write data:
 
 -      suppression of the inner loop controlled write operation
 supported for inhibiting write data:
 
 -      suppression of the inner loop controlled write operation
@@ -5900,13 +5900,13 @@ and sixteen bit pixel modes.
 Writes can be suppressed by data being equal, by the Z comparator
 conditions being met, or by the bit to pixel expansion scheme.
 
 Writes can be suppressed by data being equal, by the Z comparator
 conditions being met, or by the bit to pixel expansion scheme.
 
-Pipe-lining issues: the data derived comparator outputs are stable 
+Pipe-lining issues: the data derived comparator outputs are stable
 until the next data read, well after the affected write from this
 operation.  However, the inner counter bits can count immediately
 until the next data read, well after the affected write from this
 operation.  However, the inner counter bits can count immediately
-before the ack for the last write.  Therefore, it is necessary to 
+before the ack for the last write.  Therefore, it is necessary to
 delay bcompbit select terms by one inner loop pipe-line stage,
 when generating the select for the data control - the output is
 delay bcompbit select terms by one inner loop pipe-line stage,
 when generating the select for the data control - the output is
-delayed one further tick to give it write data timing (2/34). 
+delayed one further tick to give it write data timing (2/34).
 
 There is also a problem with computed data - the new values are
 calculated before the write associated with the old value has been
 
 There is also a problem with computed data - the new values are
 calculated before the write associated with the old value has been
@@ -5955,7 +5955,7 @@ In phrase mode, the eight bits are used directly, and this mode is
 only applicable to 8-bit pixel mode (2/34) */
 
 /*Bcompselt[0-2]       := EO (bcompselt[0-2], icount[0-2], big_pix);
 only applicable to 8-bit pixel mode (2/34) */
 
 /*Bcompselt[0-2]       := EO (bcompselt[0-2], icount[0-2], big_pix);
-Bcompbit       := MX8 (bcompbit, srcd[7], srcd[6], srcd[5], 
+Bcompbit       := MX8 (bcompbit, srcd[7], srcd[6], srcd[5],
                        srcd[4], srcd[3], srcd[2], srcd[1], srcd[0], bcompselt[0..2]);
 Bcompbit\      := INV1 (bcompbit\, bcompbit);*/
 ////////////////////////////////////// C++ CODE //////////////////////////////////////
                        srcd[4], srcd[3], srcd[2], srcd[1], srcd[0], bcompselt[0..2]);
 Bcompbit\      := INV1 (bcompbit\, bcompbit);*/
 ////////////////////////////////////// C++ CODE //////////////////////////////////////
@@ -5974,14 +5974,14 @@ if (logBlit)
 
 /* pipe-line the count */
 /*Bcompsel[0-2]        := FDSYNC (bcompsel[0-2], bcompselt[0-2], step_inner, clk);
 
 /* pipe-line the count */
 /*Bcompsel[0-2]        := FDSYNC (bcompsel[0-2], bcompselt[0-2], step_inner, clk);
-Bcompbt                := MX8 (bcompbitpt, srcd[7], srcd[6], srcd[5], 
+Bcompbt                := MX8 (bcompbitpt, srcd[7], srcd[6], srcd[5],
                        srcd[4], srcd[3], srcd[2], srcd[1], srcd[0], bcompsel[0..2]);
 Bcompbitp      := FD1Q (bcompbitp, bcompbitpt, clk);
 Bcompbitp\     := INV1 (bcompbitp\, bcompbitp);*/
 
 /* For pixel mode, generate the write inhibit signal for all modes
 on bit inhibit, for 8 and 16 bit modes on comparator inhibit, and
                        srcd[4], srcd[3], srcd[2], srcd[1], srcd[0], bcompsel[0..2]);
 Bcompbitp      := FD1Q (bcompbitp, bcompbitpt, clk);
 Bcompbitp\     := INV1 (bcompbitp\, bcompbitp);*/
 
 /* For pixel mode, generate the write inhibit signal for all modes
 on bit inhibit, for 8 and 16 bit modes on comparator inhibit, and
-for 16 bit mode on Z inhibit 
+for 16 bit mode on Z inhibit
 
 Nowrite = bcompen . /bcompbit . /phrase_mode
        + dcompen . dcomp[0] . /phrase_mode . pixsize = 011
 
 Nowrite = bcompen . /bcompbit . /phrase_mode
        + dcompen . dcomp[0] . /phrase_mode . pixsize = 011
@@ -6023,7 +6023,7 @@ if (logBlit)
 //////////////////////////////////////////////////////////////////////////////////////
 
 /* For phrase mode, generate the byte inhibit signals for eight bit
 //////////////////////////////////////////////////////////////////////////////////////
 
 /* For phrase mode, generate the byte inhibit signals for eight bit
-mode 011, or sixteen bit mode 100 
+mode 011, or sixteen bit mode 100
 dbinh\[0] =  pixsize[2] . zcomp[0]
         +  pixsize[2] . dcomp[0] . dcomp[1] . dcompen
         + /pixsize[2] . dcomp[0] . dcompen
 dbinh\[0] =  pixsize[2] . zcomp[0]
         +  pixsize[2] . dcomp[0] . dcomp[1] . dcompen
         + /pixsize[2] . dcomp[0] . dcompen
index 73680e6ab1034cb82d3f2d993b4372412d81facc..535f7cb77fd5e2d4c9b9ad0ae418ec8b201d0522 100644 (file)
@@ -1,11 +1,15 @@
+//
+// Jaguar blitter implementation
+//
+
 #ifndef __BLITTER_H__
 #define __BLITTER_H__
 
 #include "types.h"
 
 #ifndef __BLITTER_H__
 #define __BLITTER_H__
 
 #include "types.h"
 
-void blitter_init(void);
-void blitter_reset(void);
-void blitter_done(void);
+void BlitterInit(void);
+void BlitterReset(void);
+void BlitterDone(void);
 
 uint8 BlitterReadByte(uint32, uint32 who = UNKNOWN);
 uint16 BlitterReadWord(uint32, uint32 who = UNKNOWN);
 
 uint8 BlitterReadByte(uint32, uint32 who = UNKNOWN);
 uint16 BlitterReadWord(uint32, uint32 who = UNKNOWN);
index 59019f8d14d5fd25d83c717ee415a5246eefd575..0e266841d692c6a43e274cd4e54c71414b5f9059 100644 (file)
 #include "dac.h"
 
 #include "SDL.h"
 #include "dac.h"
 
 #include "SDL.h"
-#include "m68k.h"
+#include "gui.h"
 #include "jaguar.h"
 #include "jaguar.h"
-#include "settings.h"
 #include "log.h"
 #include "log.h"
+#include "m68k.h"
+#include "settings.h"
 
 //#define DEBUG_DAC
 
 
 //#define DEBUG_DAC
 
@@ -219,8 +220,10 @@ WriteLog("Tail=%X, Head=%X", ltail, lhead);
        WriteLog("LTail=%X, LHead=%X, BUFFER_SIZE-1=%X\n", LeftFIFOTailPtr, LeftFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("RTail=%X, RHead=%X, BUFFER_SIZE-1=%X\n", RightFIFOTailPtr, RightFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("From while: Tail=%X, Head=%X", (LeftFIFOTailPtr + 2) & (BUFFER_SIZE - 1), LeftFIFOHeadPtr);
        WriteLog("LTail=%X, LHead=%X, BUFFER_SIZE-1=%X\n", LeftFIFOTailPtr, LeftFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("RTail=%X, RHead=%X, BUFFER_SIZE-1=%X\n", RightFIFOTailPtr, RightFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("From while: Tail=%X, Head=%X", (LeftFIFOTailPtr + 2) & (BUFFER_SIZE - 1), LeftFIFOHeadPtr);
-       log_done();
-       exit(0);
+//     LogDone();
+//     exit(0);
+       GUICrashGracefully("Stuck in left DAC spinlock!");
+       return;
 }
                }//*/
 
 }
                }//*/
 
@@ -306,8 +309,10 @@ WriteLog("Tail=%X, Head=%X", rtail, rhead);
        WriteLog("LTail=%X, LHead=%X, BUFFER_SIZE-1=%X\n", LeftFIFOTailPtr, LeftFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("RTail=%X, RHead=%X, BUFFER_SIZE-1=%X\n", RightFIFOTailPtr, RightFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("From while: Tail=%X, Head=%X", (RightFIFOTailPtr + 2) & (BUFFER_SIZE - 1), RightFIFOHeadPtr);
        WriteLog("LTail=%X, LHead=%X, BUFFER_SIZE-1=%X\n", LeftFIFOTailPtr, LeftFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("RTail=%X, RHead=%X, BUFFER_SIZE-1=%X\n", RightFIFOTailPtr, RightFIFOHeadPtr, BUFFER_SIZE - 1);
        WriteLog("From while: Tail=%X, Head=%X", (RightFIFOTailPtr + 2) & (BUFFER_SIZE - 1), RightFIFOHeadPtr);
-       log_done();
-       exit(0);
+//     LogDone();
+//     exit(0);
+       GUICrashGracefully("Stuck in right DAC spinlock!");
+       return;
 }
                }//*/
 
 }
                }//*/
 
@@ -342,8 +347,10 @@ WriteLog("Tail=%X, Head=%X", rtail, rhead);
 // This is bad, Bad, BAD !!! DON'T ABORT BECAUSE WE DIDN'T GET OUR FREQ! !!! FIX !!!
 #warning !!! FIX !!! Aborting because of SDL audio problem is bad!
                                                WriteLog("DAC: Failed to initialize SDL sound: %s.\nDesired freq: %u\nShutting down!\n", SDL_GetError(), desired.freq);
 // This is bad, Bad, BAD !!! DON'T ABORT BECAUSE WE DIDN'T GET OUR FREQ! !!! FIX !!!
 #warning !!! FIX !!! Aborting because of SDL audio problem is bad!
                                                WriteLog("DAC: Failed to initialize SDL sound: %s.\nDesired freq: %u\nShutting down!\n", SDL_GetError(), desired.freq);
-                                               log_done();
-                                               exit(1);
+//                                             LogDone();
+//                                             exit(1);
+                                               GUICrashGracefully("Failed to initialize SDL sound!");
+                                               return;
                                        }
                                }
 
                                        }
                                }
 
index f77edec9896ab0c3f3defcbe61b976852c2f1fd6..4a9ba85252f605efecddc31df5aae3a6a12928d4 100644 (file)
@@ -8,15 +8,15 @@
 
 #include "dsp.h"
 
 
 #include "dsp.h"
 
+#include <SDL.h>                                                               // Used only for SDL_GetTicks...
 #include <stdlib.h>
 #include <stdlib.h>
-#include <SDL.h>       // Used only for SDL_GetTicks...
-#include "memory.h"
-#include "log.h"
-#include "jaguar.h"
-#include "jerry.h"
 #include "gpu.h"
 #include "jagdasm.h"
 #include "gpu.h"
 #include "jagdasm.h"
+#include "jaguar.h"
+#include "jerry.h"
+#include "log.h"
 #include "m68k.h"
 #include "m68k.h"
+#include "memory.h"
 
 //#define DSP_DEBUG
 //#define DSP_DEBUG_IRQ
 
 //#define DSP_DEBUG
 //#define DSP_DEBUG_IRQ
@@ -231,7 +231,7 @@ static void dsp_opcode_abs(void);
 static void dsp_opcode_add(void);
 static void dsp_opcode_addc(void);
 static void dsp_opcode_addq(void);
 static void dsp_opcode_add(void);
 static void dsp_opcode_addc(void);
 static void dsp_opcode_addq(void);
-static void dsp_opcode_addqmod(void);  
+static void dsp_opcode_addqmod(void);
 static void dsp_opcode_addqt(void);
 static void dsp_opcode_and(void);
 static void dsp_opcode_bclr(void);
 static void dsp_opcode_addqt(void);
 static void dsp_opcode_and(void);
 static void dsp_opcode_bclr(void);
@@ -252,7 +252,7 @@ static void dsp_opcode_load_r14_indexed(void);
 static void dsp_opcode_load_r14_ri(void);
 static void dsp_opcode_load_r15_indexed(void);
 static void dsp_opcode_load_r15_ri(void);
 static void dsp_opcode_load_r14_ri(void);
 static void dsp_opcode_load_r15_indexed(void);
 static void dsp_opcode_load_r15_ri(void);
-static void dsp_opcode_mirror(void);   
+static void dsp_opcode_mirror(void);
 static void dsp_opcode_mmult(void);
 static void dsp_opcode_move(void);
 static void dsp_opcode_movei(void);
 static void dsp_opcode_mmult(void);
 static void dsp_opcode_move(void);
 static void dsp_opcode_movei(void);
@@ -271,8 +271,8 @@ static void dsp_opcode_resmac(void);
 static void dsp_opcode_ror(void);
 static void dsp_opcode_rorq(void);
 static void dsp_opcode_xor(void);
 static void dsp_opcode_ror(void);
 static void dsp_opcode_rorq(void);
 static void dsp_opcode_xor(void);
-static void dsp_opcode_sat16s(void);   
-static void dsp_opcode_sat32s(void);   
+static void dsp_opcode_sat16s(void);
+static void dsp_opcode_sat32s(void);
 static void dsp_opcode_sh(void);
 static void dsp_opcode_sha(void);
 static void dsp_opcode_sharq(void);
 static void dsp_opcode_sh(void);
 static void dsp_opcode_sha(void);
 static void dsp_opcode_sharq(void);
@@ -288,25 +288,25 @@ static void dsp_opcode_store_r15_ri(void);
 static void dsp_opcode_sub(void);
 static void dsp_opcode_subc(void);
 static void dsp_opcode_subq(void);
 static void dsp_opcode_sub(void);
 static void dsp_opcode_subc(void);
 static void dsp_opcode_subq(void);
-static void dsp_opcode_subqmod(void);  
+static void dsp_opcode_subqmod(void);
 static void dsp_opcode_subqt(void);
 
 uint8 dsp_opcode_cycles[64] =
 {
 static void dsp_opcode_subqt(void);
 
 uint8 dsp_opcode_cycles[64] =
 {
-       3,  3,  3,  3,  3,  3,  3,  3,  
        3,  3,  3,  3,  3,  3,  3,  3,
        3,  3,  3,  3,  3,  3,  3,  3,
-       3,  3,  1,  3,  1, 18,  3,  3,  
        3,  3,  3,  3,  3,  3,  3,  3,
        3,  3,  3,  3,  3,  3,  3,  3,
-       3,  3,  2,  2,  2,  2,  3,  4,  
+       3,  3,  1,  3,  1, 18,  3,  3,
+       3,  3,  3,  3,  3,  3,  3,  3,
+       3,  3,  2,  2,  2,  2,  3,  4,
        5,  4,  5,  6,  6,  1,  1,  1,
        5,  4,  5,  6,  6,  1,  1,  1,
-       1,  2,  2,  2,  1,  1,  9,  3,  
+       1,  2,  2,  2,  1,  1,  9,  3,
        3,  1,  6,  6,  2,  2,  3,  3
 };//*/
 //Here's a QnD kludge...
 //This is wrong, wrong, WRONG, but it seems to work for the time being...
 //(That is, it fixes Flip Out which relies on GPU timing rather than semaphores. Bad developers! Bad!)
 //What's needed here is a way to take pipeline effects into account (including pipeline stalls!)...
        3,  1,  6,  6,  2,  2,  3,  3
 };//*/
 //Here's a QnD kludge...
 //This is wrong, wrong, WRONG, but it seems to work for the time being...
 //(That is, it fixes Flip Out which relies on GPU timing rather than semaphores. Bad developers! Bad!)
 //What's needed here is a way to take pipeline effects into account (including pipeline stalls!)...
-/*uint8 dsp_opcode_cycles[64] = 
+/*uint8 dsp_opcode_cycles[64] =
 {
        1,  1,  1,  1,  1,  1,  1,  1,
        1,  1,  1,  1,  1,  1,  1,  1,
 {
        1,  1,  1,  1,  1,  1,  1,  1,
        1,  1,  1,  1,  1,  1,  1,  1,
@@ -319,7 +319,7 @@ uint8 dsp_opcode_cycles[64] =
 };//*/
 
 void (* dsp_opcode[64])() =
 };//*/
 
 void (* dsp_opcode[64])() =
-{      
+{
        dsp_opcode_add,                                 dsp_opcode_addc,                                dsp_opcode_addq,                                dsp_opcode_addqt,
        dsp_opcode_sub,                                 dsp_opcode_subc,                                dsp_opcode_subq,                                dsp_opcode_subqt,
        dsp_opcode_neg,                                 dsp_opcode_and,                                 dsp_opcode_or,                                  dsp_opcode_xor,
        dsp_opcode_add,                                 dsp_opcode_addc,                                dsp_opcode_addq,                                dsp_opcode_addqt,
        dsp_opcode_sub,                                 dsp_opcode_subc,                                dsp_opcode_subq,                                dsp_opcode_subqt,
        dsp_opcode_neg,                                 dsp_opcode_and,                                 dsp_opcode_or,                                  dsp_opcode_xor,
@@ -341,7 +341,7 @@ void (* dsp_opcode[64])() =
 uint32 dsp_opcode_use[65];
 
 const char * dsp_opcode_str[65]=
 uint32 dsp_opcode_use[65];
 
 const char * dsp_opcode_str[65]=
-{      
+{
        "add",                          "addc",                         "addq",                         "addqt",
        "sub",                          "subc",                         "subq",                         "subqt",
        "neg",                          "and",                          "or",                           "xor",
        "add",                          "addc",                         "addq",                         "addqt",
        "sub",                          "subc",                         "subq",                         "subqt",
        "neg",                          "and",                          "or",                           "xor",
@@ -371,7 +371,7 @@ static uint32 dsp_pointer_to_matrix;
 static uint32 dsp_data_organization;
 uint32 dsp_control;
 static uint32 dsp_div_control;
 static uint32 dsp_data_organization;
 uint32 dsp_control;
 static uint32 dsp_div_control;
-static uint8 dsp_flag_z, dsp_flag_n, dsp_flag_c;    
+static uint8 dsp_flag_z, dsp_flag_n, dsp_flag_c;
 static uint32 * dsp_reg = NULL, * dsp_alternate_reg = NULL;
 static uint32 dsp_reg_bank_0[32], dsp_reg_bank_1[32];
 
 static uint32 * dsp_reg = NULL, * dsp_alternate_reg = NULL;
 static uint32 dsp_reg_bank_0[32], dsp_reg_bank_1[32];
 
@@ -431,7 +431,7 @@ void dsp_reset_stats(void)
                dsp_opcode_use[i] = 0;
 }
 
                dsp_opcode_use[i] = 0;
 }
 
-void dsp_releaseTimeslice(void)
+void DSPReleaseTimeslice(void)
 {
 //This does absolutely nothing!!! !!! FIX !!!
        dsp_releaseTimeSlice_flag = 1;
 {
 //This does absolutely nothing!!! !!! FIX !!!
        dsp_releaseTimeSlice_flag = 1;
@@ -520,7 +520,7 @@ uint8 DSPReadByte(uint32 offset, uint32 who/*=UNKNOWN*/)
        }
 
        return JaguarReadByte(offset, who);
        }
 
        return JaguarReadByte(offset, who);
-} 
+}
 
 uint16 DSPReadWord(uint32 offset, uint32 who/*=UNKNOWN*/)
 {
 
 uint16 DSPReadWord(uint32 offset, uint32 who/*=UNKNOWN*/)
 {
@@ -659,7 +659,7 @@ void DSPWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/)
        {
                uint32 reg = offset & 0x1C;
                int bytenum = offset & 0x03;
        {
                uint32 reg = offset & 0x1C;
                int bytenum = offset & 0x03;
-               
+
                if ((reg >= 0x1C) && (reg <= 0x1F))
                        dsp_div_control = (dsp_div_control & (~(0xFF << (bytenum << 3)))) | (data << (bytenum << 3));
                else
                if ((reg >= 0x1C) && (reg <= 0x1F))
                        dsp_div_control = (dsp_div_control & (~(0xFF << (bytenum << 3)))) | (data << (bytenum << 3));
                else
@@ -667,7 +667,7 @@ void DSPWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/)
 //This looks funky. !!! FIX !!!
                        uint32 old_data = DSPReadLong(offset&0xFFFFFFC, who);
                        bytenum = 3 - bytenum; // convention motorola !!!
 //This looks funky. !!! FIX !!!
                        uint32 old_data = DSPReadLong(offset&0xFFFFFFC, who);
                        bytenum = 3 - bytenum; // convention motorola !!!
-                       old_data = (old_data & (~(0xFF << (bytenum << 3)))) | (data << (bytenum << 3)); 
+                       old_data = (old_data & (~(0xFF << (bytenum << 3)))) | (data << (bytenum << 3));
                        DSPWriteLong(offset & 0xFFFFFFC, old_data, who);
                }
                return;
                        DSPWriteLong(offset & 0xFFFFFFC, old_data, who);
                }
                return;
@@ -840,7 +840,7 @@ if (who != DSP)
 //!!!!!!!!
                        break;
                case 0x14:
 //!!!!!!!!
                        break;
                case 0x14:
-               {       
+               {
 //#ifdef DSP_DEBUG
 WriteLog("Write to DSP CTRL by %s: %08X\n", whoName[who], data);
 //#endif
 //#ifdef DSP_DEBUG
 WriteLog("Write to DSP CTRL by %s: %08X\n", whoName[who], data);
 //#endif
@@ -857,7 +857,7 @@ WriteLog("Write to DSP CTRL by %s: %08X\n", whoName[who], data);
                                if (JERRYIRQEnabled(IRQ2_DSP))// && jaguar_interrupt_handler_is_valid(64))
                                {
                                        JERRYSetPendingIRQ(IRQ2_DSP);
                                if (JERRYIRQEnabled(IRQ2_DSP))// && jaguar_interrupt_handler_is_valid(64))
                                {
                                        JERRYSetPendingIRQ(IRQ2_DSP);
-                                       dsp_releaseTimeslice();
+                                       DSPReleaseTimeslice();
                                        m68k_set_irq(7);                        // Set 68000 NMI...
                                }
                                data &= ~CPUINT;
                                        m68k_set_irq(7);                        // Set 68000 NMI...
                                }
                                data &= ~CPUINT;
@@ -869,7 +869,7 @@ WriteLog("Write to DSP CTRL by %s: %08X\n", whoName[who], data);
                                WriteLog("DSP: CPU -> DSP interrupt\n");
 #endif
                                m68k_end_timeslice();
                                WriteLog("DSP: CPU -> DSP interrupt\n");
 #endif
                                m68k_end_timeslice();
-                               gpu_releaseTimeslice();
+                               GPUReleaseTimeslice();
                                DSPSetIRQLine(DSPIRQ_CPU, ASSERT_LINE);
                                data &= ~DSPINT0;
                        }
                                DSPSetIRQLine(DSPIRQ_CPU, ASSERT_LINE);
                                data &= ~DSPINT0;
                        }
@@ -916,7 +916,7 @@ WriteLog("\n");
                                if (who == M68K)
                                        m68k_end_timeslice();
                                else if (who == GPU)
                                if (who == M68K)
                                        m68k_end_timeslice();
                                else if (who == GPU)
-                                       gpu_releaseTimeslice();
+                                       GPUReleaseTimeslice();
 
                                if (!wasRunning)
                                        FlushDSPPipeline();
 
                                if (!wasRunning)
                                        FlushDSPPipeline();
@@ -978,7 +978,7 @@ void DSPHandleIRQs(void)
        if (!bits)                                                                              // Bail if nothing is enabled
                return;
 
        if (!bits)                                                                              // Bail if nothing is enabled
                return;
 
-       int which = 0;                                                                  // Determine which interrupt 
+       int which = 0;                                                                  // Determine which interrupt
        if (bits & 0x01)
                which = 0;
        if (bits & 0x02)
        if (bits & 0x01)
                which = 0;
        if (bits & 0x02)
@@ -1060,8 +1060,8 @@ ctrl2[4] = dsp_flags;
        WriteLog(" [PC will return to %08X, R31 = %08X]\n", dsp_pc - (pipeline[plPtrExec].opcode == 38 ? 6 : (pipeline[plPtrExec].opcode == PIPELINE_STALL ? 0 : 2)), dsp_reg[31]);
 #endif
 
        WriteLog(" [PC will return to %08X, R31 = %08X]\n", dsp_pc - (pipeline[plPtrExec].opcode == 38 ? 6 : (pipeline[plPtrExec].opcode == PIPELINE_STALL ? 0 : 2)), dsp_reg[31]);
 #endif
 
-       // subqt  #4,r31                ; pre-decrement stack pointer 
-       // move   pc,r30                ; address of interrupted code 
+       // subqt  #4,r31                ; pre-decrement stack pointer
+       // move   pc,r30                ; address of interrupted code
        // store  r30,(r31)     ; store return address
        dsp_reg[31] -= 4;
 //CC only!
        // store  r30,(r31)     ; store return address
        dsp_reg[31] -= 4;
 //CC only!
@@ -1092,8 +1092,8 @@ SET32(ram2, regs2[31] - 0xF1B000, dsp_pc - 2 - (pipeline[plPtrExec].opcode == 38
 #endif
 //!!!!!!!!
 
 #endif
 //!!!!!!!!
 
-       // movei  #service_address,r30  ; pointer to ISR entry 
-       // jump  (r30)                                  ; jump to ISR 
+       // movei  #service_address,r30  ; pointer to ISR entry
+       // jump  (r30)                                  ; jump to ISR
        // nop
        dsp_pc = dsp_reg[30] = DSP_WORK_RAM_BASE + (which * 0x10);
 //CC only!
        // nop
        dsp_pc = dsp_reg[30] = DSP_WORK_RAM_BASE + (which * 0x10);
 //CC only!
@@ -1144,7 +1144,7 @@ DSPUpdateRegisterBanks();
        if (!bits)                                                                              // Bail if nothing is enabled
                return;
 
        if (!bits)                                                                              // Bail if nothing is enabled
                return;
 
-       int which = 0;                                                                  // Determine which interrupt 
+       int which = 0;                                                                  // Determine which interrupt
        if (bits & 0x01)
                which = 0;
        if (bits & 0x02)
        if (bits & 0x01)
                which = 0;
        if (bits & 0x02)
@@ -1173,8 +1173,8 @@ ctrl1[4] = dsp_flags;
        WriteLog(" [PC will return to %08X, R31 = %08X]\n", dsp_pc, dsp_reg[31]);
 #endif
 
        WriteLog(" [PC will return to %08X, R31 = %08X]\n", dsp_pc, dsp_reg[31]);
 #endif
 
-       // subqt  #4,r31                ; pre-decrement stack pointer 
-       // move   pc,r30                ; address of interrupted code 
+       // subqt  #4,r31                ; pre-decrement stack pointer
+       // move   pc,r30                ; address of interrupted code
        // store  r30,(r31)     ; store return address
        dsp_reg[31] -= 4;
 //CC only!
        // store  r30,(r31)     ; store return address
        dsp_reg[31] -= 4;
 //CC only!
@@ -1189,8 +1189,8 @@ SET32(ram1, regs1[31] - 0xF1B000, dsp_pc - 2);
 #endif
 //!!!!!!!!
 
 #endif
 //!!!!!!!!
 
-       // movei  #service_address,r30  ; pointer to ISR entry 
-       // jump  (r30)                                  ; jump to ISR 
+       // movei  #service_address,r30  ; pointer to ISR entry
+       // jump  (r30)                                  ; jump to ISR
        // nop
        dsp_pc = dsp_reg[30] = DSP_WORK_RAM_BASE + (which * 0x10);
 //CC only!
        // nop
        dsp_pc = dsp_reg[30] = DSP_WORK_RAM_BASE + (which * 0x10);
 //CC only!
@@ -1313,9 +1313,9 @@ void DSPDone(void)
        WriteLog("DSP: Stopped at PC=%08X dsp_modulo=%08X (dsp %s running)\n", dsp_pc, dsp_modulo, (DSP_RUNNING ? "was" : "wasn't"));
        WriteLog("DSP: %sin interrupt handler\n", (dsp_flags & IMASK ? "" : "not "));
 
        WriteLog("DSP: Stopped at PC=%08X dsp_modulo=%08X (dsp %s running)\n", dsp_pc, dsp_modulo, (DSP_RUNNING ? "was" : "wasn't"));
        WriteLog("DSP: %sin interrupt handler\n", (dsp_flags & IMASK ? "" : "not "));
 
-       // get the active interrupt bits 
+       // get the active interrupt bits
        int bits = ((dsp_control >> 10) & 0x20) | ((dsp_control >> 6) & 0x1F);
        int bits = ((dsp_control >> 10) & 0x20) | ((dsp_control >> 6) & 0x1F);
-       // get the interrupt mask 
+       // get the interrupt mask
        int mask = ((dsp_flags >> 11) & 0x20) | ((dsp_flags >> 4) & 0x1F);
 
        WriteLog("DSP: pending=%08X enabled=%08X\n", bits, mask);
        int mask = ((dsp_flags >> 11) & 0x20) | ((dsp_flags >> 4) & 0x1F);
 
        WriteLog("DSP: pending=%08X enabled=%08X\n", bits, mask);
@@ -2286,7 +2286,7 @@ static void dsp_opcode_imacn(void)
        if (doDSPDis)
                WriteLog("[NCZ:%u%u%u, DSP_ACC=%02X%08X]\n", dsp_flag_n, dsp_flag_c, dsp_flag_z, (uint8)(dsp_acc >> 32), (uint32)(dsp_acc & 0xFFFFFFFF));
 #endif
        if (doDSPDis)
                WriteLog("[NCZ:%u%u%u, DSP_ACC=%02X%08X]\n", dsp_flag_n, dsp_flag_c, dsp_flag_z, (uint8)(dsp_acc >> 32), (uint32)(dsp_acc & 0xFFFFFFFF));
 #endif
-} 
+}
 
 static void dsp_opcode_mtoi(void)
 {
 
 static void dsp_opcode_mtoi(void)
 {
@@ -2326,7 +2326,7 @@ static void dsp_opcode_mmult(void)
        if (!(dsp_matrix_control & 0x10))
        {
                for (int i = 0; i < count; i++)
        if (!(dsp_matrix_control & 0x10))
        {
                for (int i = 0; i < count; i++)
-               { 
+               {
                        int16 a;
                        if (i&0x01)
                                a=(int16)((dsp_alternate_reg[dsp_opcode_first_parameter + (i>>1)]>>16)&0xffff);
                        int16 a;
                        if (i&0x01)
                                a=(int16)((dsp_alternate_reg[dsp_opcode_first_parameter + (i>>1)]>>16)&0xffff);
@@ -2365,7 +2365,7 @@ static void dsp_opcode_abs(void)
 #endif
        uint32 _Rn = RN;
        uint32 res;
 #endif
        uint32 _Rn = RN;
        uint32 res;
-       
+
        if (_Rn == 0x80000000)
                dsp_flag_n = 1;
        else
        if (_Rn == 0x80000000)
                dsp_flag_n = 1;
        else
@@ -2597,25 +2597,25 @@ void dsp_opcode_addqmod(void)
 #endif
 }
 
 #endif
 }
 
-void dsp_opcode_subqmod(void)  
+void dsp_opcode_subqmod(void)
 {
        uint32 r1 = dsp_convert_zero[IMM_1];
        uint32 r2 = RN;
        uint32 res = r2 - r1;
        res = (res & (~dsp_modulo)) | (r2 & dsp_modulo);
        RN = res;
 {
        uint32 r1 = dsp_convert_zero[IMM_1];
        uint32 r2 = RN;
        uint32 res = r2 - r1;
        res = (res & (~dsp_modulo)) | (r2 & dsp_modulo);
        RN = res;
-       
+
        SET_ZNC_SUB(r2, r1, res);
 }
 
        SET_ZNC_SUB(r2, r1, res);
 }
 
-void dsp_opcode_mirror(void)   
+void dsp_opcode_mirror(void)
 {
        uint32 r1 = RN;
        RN = (mirror_table[r1 & 0xFFFF] << 16) | mirror_table[r1 >> 16];
        SET_ZN(RN);
 }
 
 {
        uint32 r1 = RN;
        RN = (mirror_table[r1 & 0xFFFF] << 16) | mirror_table[r1 >> 16];
        SET_ZN(RN);
 }
 
-void dsp_opcode_sat32s(void)           
+void dsp_opcode_sat32s(void)
 {
        int32 r2 = (uint32)RN;
        int32 temp = dsp_acc >> 32;
 {
        int32 r2 = (uint32)RN;
        int32 temp = dsp_acc >> 32;
@@ -2624,7 +2624,7 @@ void dsp_opcode_sat32s(void)
        SET_ZN(res);
 }
 
        SET_ZN(res);
 }
 
-void dsp_opcode_sat16s(void)           
+void dsp_opcode_sat16s(void)
 {
        int32 r2 = RN;
        uint32 res = (r2 < -32768) ? -32768 : (r2 > 32767) ? 32767 : r2;
 {
        int32 r2 = RN;
        uint32 res = (r2 < -32768) ? -32768 : (r2 > 32767) ? 32767 : r2;
@@ -2640,7 +2640,7 @@ static void DSP_abs(void);
 static void DSP_add(void);
 static void DSP_addc(void);
 static void DSP_addq(void);
 static void DSP_add(void);
 static void DSP_addc(void);
 static void DSP_addq(void);
-static void DSP_addqmod(void); 
+static void DSP_addqmod(void);
 static void DSP_addqt(void);
 static void DSP_and(void);
 static void DSP_bclr(void);
 static void DSP_addqt(void);
 static void DSP_and(void);
 static void DSP_bclr(void);
@@ -2662,7 +2662,7 @@ static void DSP_load_r14_i(void);
 static void DSP_load_r14_r(void);
 static void DSP_load_r15_i(void);
 static void DSP_load_r15_r(void);
 static void DSP_load_r14_r(void);
 static void DSP_load_r15_i(void);
 static void DSP_load_r15_r(void);
-static void DSP_mirror(void);  
+static void DSP_mirror(void);
 static void DSP_mmult(void);
 static void DSP_move(void);
 static void DSP_movefa(void);
 static void DSP_mmult(void);
 static void DSP_move(void);
 static void DSP_movefa(void);
@@ -2680,8 +2680,8 @@ static void DSP_or(void);
 static void DSP_resmac(void);
 static void DSP_ror(void);
 static void DSP_rorq(void);
 static void DSP_resmac(void);
 static void DSP_ror(void);
 static void DSP_rorq(void);
-static void DSP_sat16s(void);  
-static void DSP_sat32s(void);  
+static void DSP_sat16s(void);
+static void DSP_sat32s(void);
 static void DSP_sh(void);
 static void DSP_sha(void);
 static void DSP_sharq(void);
 static void DSP_sh(void);
 static void DSP_sha(void);
 static void DSP_sharq(void);
@@ -2697,7 +2697,7 @@ static void DSP_store_r15_r(void);
 static void DSP_sub(void);
 static void DSP_subc(void);
 static void DSP_subq(void);
 static void DSP_sub(void);
 static void DSP_subc(void);
 static void DSP_subq(void);
-static void DSP_subqmod(void); 
+static void DSP_subqmod(void);
 static void DSP_subqt(void);
 static void DSP_xor(void);
 
 static void DSP_subqt(void);
 static void DSP_xor(void);
 
@@ -3418,7 +3418,7 @@ static void DSP_abs(void)
                WriteLog("%06X: ABS    R%02u [NCZ:%u%u%u, R%02u=%08X] -> ", DSP_PPC, PIMM2, dsp_flag_n, dsp_flag_c, dsp_flag_z, PIMM2, PRN);
 #endif
        uint32 _Rn = PRN;
                WriteLog("%06X: ABS    R%02u [NCZ:%u%u%u, R%02u=%08X] -> ", DSP_PPC, PIMM2, dsp_flag_n, dsp_flag_c, dsp_flag_z, PIMM2, PRN);
 #endif
        uint32 _Rn = PRN;
-       
+
        if (_Rn == 0x80000000)
                dsp_flag_n = 1;
        else
        if (_Rn == 0x80000000)
                dsp_flag_n = 1;
        else
@@ -3641,7 +3641,7 @@ static void DSP_imacn(void)
        if (doDSPDis)
                WriteLog("[NCZ:%u%u%u, DSP_ACC=%02X%08X]\n", dsp_flag_n, dsp_flag_c, dsp_flag_z, (uint8)(dsp_acc >> 32), (uint32)(dsp_acc & 0xFFFFFFFF));
 #endif
        if (doDSPDis)
                WriteLog("[NCZ:%u%u%u, DSP_ACC=%02X%08X]\n", dsp_flag_n, dsp_flag_c, dsp_flag_z, (uint8)(dsp_acc >> 32), (uint32)(dsp_acc & 0xFFFFFFFF));
 #endif
-} 
+}
 
 static void DSP_imult(void)
 {
 
 static void DSP_imult(void)
 {
@@ -3717,7 +3717,7 @@ const char * condition[32] =
                // Now that we've branched, we have to make sure that the following instruction
                // is executed atomically with this one and then flush the pipeline before setting
                // the new PC.
                // Now that we've branched, we have to make sure that the following instruction
                // is executed atomically with this one and then flush the pipeline before setting
                // the new PC.
-               
+
                // Step 1: Handle writebacks at stage 3 of pipeline
 /*             if (pipeline[plPtrWrite].opcode != PIPELINE_STALL)
                {
                // Step 1: Handle writebacks at stage 3 of pipeline
 /*             if (pipeline[plPtrWrite].opcode != PIPELINE_STALL)
                {
@@ -3822,7 +3822,7 @@ const char * condition[32] =
                // Now that we've branched, we have to make sure that the following instruction
                // is executed atomically with this one and then flush the pipeline before setting
                // the new PC.
                // Now that we've branched, we have to make sure that the following instruction
                // is executed atomically with this one and then flush the pipeline before setting
                // the new PC.
-               
+
                // Step 1: Handle writebacks at stage 3 of pipeline
 /*             if (pipeline[plPtrWrite].opcode != PIPELINE_STALL)
                {
                // Step 1: Handle writebacks at stage 3 of pipeline
 /*             if (pipeline[plPtrWrite].opcode != PIPELINE_STALL)
                {
@@ -4000,7 +4000,7 @@ static void DSP_load_r15_r(void)
 #endif
 }
 
 #endif
 }
 
-static void DSP_mirror(void)   
+static void DSP_mirror(void)
 {
        uint32 r1 = PRN;
        PRES = (mirror_table[r1 & 0xFFFF] << 16) | mirror_table[r1 >> 16];
 {
        uint32 r1 = PRN;
        PRES = (mirror_table[r1 & 0xFFFF] << 16) | mirror_table[r1 >> 16];
@@ -4017,7 +4017,7 @@ static void DSP_mmult(void)
        if (!(dsp_matrix_control & 0x10))
        {
                for (int i = 0; i < count; i++)
        if (!(dsp_matrix_control & 0x10))
        {
                for (int i = 0; i < count; i++)
-               { 
+               {
                        int16 a;
                        if (i&0x01)
                                a=(int16)((dsp_alternate_reg[dsp_opcode_first_parameter + (i>>1)]>>16)&0xffff);
                        int16 a;
                        if (i&0x01)
                                a=(int16)((dsp_alternate_reg[dsp_opcode_first_parameter + (i>>1)]>>16)&0xffff);
@@ -4279,7 +4279,7 @@ static void DSP_rorq(void)
 #endif
 }
 
 #endif
 }
 
-static void DSP_sat16s(void)           
+static void DSP_sat16s(void)
 {
        int32 r2 = PRN;
        uint32 res = (r2 < -32768) ? -32768 : (r2 > 32767) ? 32767 : r2;
 {
        int32 r2 = PRN;
        uint32 res = (r2 < -32768) ? -32768 : (r2 > 32767) ? 32767 : r2;
@@ -4287,7 +4287,7 @@ static void DSP_sat16s(void)
        SET_ZN(res);
 }
 
        SET_ZN(res);
 }
 
-static void DSP_sat32s(void)           
+static void DSP_sat32s(void)
 {
        int32 r2 = (uint32)PRN;
        int32 temp = dsp_acc >> 32;
 {
        int32 r2 = (uint32)PRN;
        int32 temp = dsp_acc >> 32;
@@ -4587,7 +4587,7 @@ static void DSP_subq(void)
 #endif
 }
 
 #endif
 }
 
-static void DSP_subqmod(void)  
+static void DSP_subqmod(void)
 {
        uint32 r1 = dsp_convert_zero[PIMM1];
        uint32 r2 = PRN;
 {
        uint32 r1 = dsp_convert_zero[PIMM1];
        uint32 r2 = PRN;
index dc4b13c697943de84319922d0bba14fee3b381a7..7e09e5903a22e570f5e7d98112d87919bab93be7 100644 (file)
--- a/src/dsp.h
+++ b/src/dsp.h
@@ -5,7 +5,6 @@
 #ifndef __DSP_H__
 #define __DSP_H__
 
 #ifndef __DSP_H__
 #define __DSP_H__
 
-//#include "jaguar.h"
 #include "types.h"
 
 #define DSP_CONTROL_RAM_BASE    0x00F1A100
 #include "types.h"
 
 #define DSP_CONTROL_RAM_BASE    0x00F1A100
@@ -24,7 +23,7 @@ uint32 DSPReadLong(uint32 offset, uint32 who = UNKNOWN);
 void DSPWriteByte(uint32 offset, uint8 data, uint32 who = UNKNOWN);
 void DSPWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void DSPWriteLong(uint32 offset, uint32 data, uint32 who = UNKNOWN);
 void DSPWriteByte(uint32 offset, uint8 data, uint32 who = UNKNOWN);
 void DSPWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void DSPWriteLong(uint32 offset, uint32 data, uint32 who = UNKNOWN);
-void dsp_releaseTimeslice(void);
+void DSPReleaseTimeslice(void);
 
 void DSPExecP(int32 cycles);
 void DSPExecP2(int32 cycles);
 
 void DSPExecP(int32 cycles);
 void DSPExecP2(int32 cycles);
index 6b2ef65d68f837ded862b17d59a5328d6dd23abe..35e0d4d63ce575690407b5e0642bbfd97619a842 100644 (file)
@@ -1,5 +1,5 @@
 //
 //
-// EEPROM handler
+// Jaguar EEPROM handler
 //
 // by Cal2
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
 //
 // by Cal2
 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
@@ -8,11 +8,11 @@
 
 #include "eeprom.h"
 
 
 #include "eeprom.h"
 
-#include <string.h>                                                            // For memset
 #include <stdlib.h>
 #include <stdlib.h>
-#include "settings.h"
-#include "log.h"
+#include <string.h>                                                            // For memset
 #include "jaguar.h"
 #include "jaguar.h"
+#include "log.h"
+#include "settings.h"
 
 #define eeprom_LOG
 
 
 #define eeprom_LOG
 
@@ -22,10 +22,10 @@ static uint16 eeprom_ram[64];
 // Private function prototypes
 //
 
 // Private function prototypes
 //
 
-void EEPROMSave(void);
-void eeprom_set_di(uint32 state); 
-void eeprom_set_cs(uint32 state);
-uint32 eeprom_get_do(void);
+static void EEPROMSave(void);
+static void eeprom_set_di(uint32 state);
+static void eeprom_set_cs(uint32 state);
+static uint32 eeprom_get_do(void);
 
 enum { EE_STATE_START = 1, EE_STATE_OP_A, EE_STATE_OP_B, EE_STATE_0, EE_STATE_1,
        EE_STATE_2, EE_STATE_3, EE_STATE_0_0, EE_READ_ADDRESS, EE_STATE_0_0_0,
 
 enum { EE_STATE_START = 1, EE_STATE_OP_A, EE_STATE_OP_B, EE_STATE_0, EE_STATE_1,
        EE_STATE_2, EE_STATE_3, EE_STATE_0_0, EE_READ_ADDRESS, EE_STATE_0_0_0,
@@ -34,26 +34,27 @@ enum { EE_STATE_START = 1, EE_STATE_OP_A, EE_STATE_OP_B, EE_STATE_0, EE_STATE_1,
 
 // Local global variables
 
 
 // Local global variables
 
-uint16 jerry_ee_state = EE_STATE_START;
-uint16 jerry_ee_op = 0;
-uint16 jerry_ee_rstate = 0;
-uint16 jerry_ee_address_data = 0;
-uint16 jerry_ee_address_cnt = 6;
-uint16 jerry_ee_data = 0;
-uint16 jerry_ee_data_cnt = 16;
-uint16 jerry_writes_enabled = 0;
-uint16 jerry_ee_direct_jump = 0;
+static uint16 jerry_ee_state = EE_STATE_START;
+static uint16 jerry_ee_op = 0;
+static uint16 jerry_ee_rstate = 0;
+static uint16 jerry_ee_address_data = 0;
+static uint16 jerry_ee_address_cnt = 6;
+static uint16 jerry_ee_data = 0;
+static uint16 jerry_ee_data_cnt = 16;
+static uint16 jerry_writes_enabled = 0;
+static uint16 jerry_ee_direct_jump = 0;
 static char eeprom_filename[MAX_PATH];
 static bool foundEEPROM = false;
 
 static char eeprom_filename[MAX_PATH];
 static bool foundEEPROM = false;
 
-void eeprom_init(void)
+void EepromInit(void)
 {
 {
-       sprintf(eeprom_filename, "%s%08X.eep", vjs.EEPROMPath, (unsigned int)jaguar_mainRom_crc32);
-       FILE * jerry_ee_fp = fopen(eeprom_filename, "rb");
-       if (jerry_ee_fp)
+       sprintf(eeprom_filename, "%s%08X.eep", vjs.EEPROMPath, (unsigned int)jaguarMainRomCRC32);
+       FILE * fp = fopen(eeprom_filename, "rb");
+
+       if (fp)
        {
        {
-               fread(eeprom_ram, 1, 128, jerry_ee_fp);
-               fclose(jerry_ee_fp);
+               fread(eeprom_ram, 1, 128, fp);
+               fclose(fp);
                WriteLog("EEPROM: Loaded from %s\n", eeprom_filename);
                foundEEPROM = true;
        }
                WriteLog("EEPROM: Loaded from %s\n", eeprom_filename);
                foundEEPROM = true;
        }
@@ -61,31 +62,32 @@ void eeprom_init(void)
                WriteLog("EEPROM: Could not open file \"%s\"!\n", eeprom_filename);
 }
 
                WriteLog("EEPROM: Could not open file \"%s\"!\n", eeprom_filename);
 }
 
-void eeprom_reset(void)
+void EepromReset(void)
 {
        if (!foundEEPROM)
                memset(eeprom_ram, 0xFF, 64 * sizeof(uint16));
 }
 
 {
        if (!foundEEPROM)
                memset(eeprom_ram, 0xFF, 64 * sizeof(uint16));
 }
 
-void eeprom_done(void)
+void EepromDone(void)
 {
 {
+       WriteLog("EEPROM: Done.\n");
 }
 
 }
 
-void EEPROMSave(void)
+static void EEPROMSave(void)
 {
 {
-       FILE * jerry_ee_fp = fopen(eeprom_filename, "wb");
+       FILE * fp = fopen(eeprom_filename, "wb");
 
 
-       if (jerry_ee_fp == NULL)
+       if (fp == NULL)
        {
                WriteLog("EEPROM: Could not create file \"%s!\"\n", eeprom_filename);
                return;
        }
 
        {
                WriteLog("EEPROM: Could not create file \"%s!\"\n", eeprom_filename);
                return;
        }
 
-       fwrite(eeprom_ram, 1, 128, jerry_ee_fp);
-       fclose(jerry_ee_fp);
+       fwrite(eeprom_ram, 1, 128, fp);
+       fclose(fp);
 }
 
 }
 
-uint8 eeprom_byte_read(uint32 offset)
+uint8 EepromReadByte(uint32 offset)
 {
        switch (offset)
        {
 {
        switch (offset)
        {
@@ -96,18 +98,18 @@ uint8 eeprom_byte_read(uint32 offset)
        case 0xF15001:
                eeprom_set_cs(1);
                break;
        case 0xF15001:
                eeprom_set_cs(1);
                break;
-//     default: WriteLog("eeprom: unmapped 0x%.8x\n",offset); break;
+//     default: WriteLog("EEPROM: unmapped 0x%.8x\n", offset); break;
        }
 
        return 0x00;
 }
 
        }
 
        return 0x00;
 }
 
-uint16 eeprom_word_read(uint32 offset)
+uint16 EepromReadWord(uint32 offset)
 {
 {
-       return ((uint16)eeprom_byte_read(offset+0) << 8) | eeprom_byte_read(offset+1);
+       return ((uint16)EepromReadByte(offset + 0) << 8) | EepromReadByte(offset + 1);
 }
 
 }
 
-void eeprom_byte_write(uint32 offset, uint8 data)
+void EepromWriteByte(uint32 offset, uint8 data)
 {
        switch (offset)
        {
 {
        switch (offset)
        {
@@ -123,13 +125,13 @@ void eeprom_byte_write(uint32 offset, uint8 data)
        }
 }
 
        }
 }
 
-void eeprom_word_write(uint32 offset, uint16 data)
+void EepromWriteWord(uint32 offset, uint16 data)
 {
 {
-       eeprom_byte_write(offset+0, (data >> 8) & 0xFF);
-       eeprom_byte_write(offset+1, data & 0xFF);
+       EepromWriteByte(offset + 0, (data >> 8) & 0xFF);
+       EepromWriteByte(offset + 1, data & 0xFF);
 }
 
 }
 
-void eeprom_set_di(uint32 data)
+static void eeprom_set_di(uint32 data)
 {
 //     WriteLog("eeprom: di=%i\n",data);
 //     WriteLog("eeprom: state %i\n",jerry_ee_state);
 {
 //     WriteLog("eeprom: di=%i\n",data);
 //     WriteLog("eeprom: state %i\n",jerry_ee_state);
@@ -253,7 +255,7 @@ void eeprom_set_di(uint32 data)
                        eeprom_ram[jerry_ee_address_data] = 0xFFFF;
                jerry_ee_state = EE_STATE_BUSY;
                break;
                        eeprom_ram[jerry_ee_address_data] = 0xFFFF;
                jerry_ee_state = EE_STATE_BUSY;
                break;
-       case EE_READ_DATA: 
+       case EE_READ_DATA:
                //WriteLog("eeprom:\t\t\t%i bit %i\n",data,jerry_ee_data_cnt-1);
                jerry_ee_data <<= 1;
                jerry_ee_data |= data;
                //WriteLog("eeprom:\t\t\t%i bit %i\n",data,jerry_ee_data_cnt-1);
                jerry_ee_data <<= 1;
                jerry_ee_data |= data;
@@ -265,7 +267,7 @@ void eeprom_set_di(uint32 data)
                                eeprom_set_di(data);
                }
                break;
                                eeprom_set_di(data);
                }
                break;
-       case EE_READ_ADDRESS: 
+       case EE_READ_ADDRESS:
                jerry_ee_address_data <<= 1;
                jerry_ee_address_data |= data;
                jerry_ee_address_cnt--;
                jerry_ee_address_data <<= 1;
                jerry_ee_address_data |= data;
                jerry_ee_address_cnt--;
@@ -279,11 +281,11 @@ void eeprom_set_di(uint32 data)
                }
                break;
        default:
                }
                break;
        default:
-               jerry_ee_state = EE_STATE_OP_A; 
+               jerry_ee_state = EE_STATE_OP_A;
        }
 }
 
        }
 }
 
-void eeprom_set_cs(uint32 state)
+static void eeprom_set_cs(uint32 state)
 {
 //     WriteLog("eeprom: cs=%i\n",state);
        jerry_ee_state = EE_STATE_START;
 {
 //     WriteLog("eeprom: cs=%i\n",state);
        jerry_ee_state = EE_STATE_START;
@@ -296,7 +298,7 @@ void eeprom_set_cs(uint32 state)
        jerry_writes_enabled = 1;
 }
 
        jerry_writes_enabled = 1;
 }
 
-uint32 eeprom_get_do(void)
+static uint32 eeprom_get_do(void)
 {
        uint16 data = 1;
 
 {
        uint16 data = 1;
 
index 776e651b03bd455afcd159f32b8035cef137d69c..02b92c2412cde2f36994db982738031bc375b3c4 100644 (file)
@@ -5,17 +5,16 @@
 #ifndef __EEPROM_H__
 #define __EEPROM_H__
 
 #ifndef __EEPROM_H__
 #define __EEPROM_H__
 
-//#include "jaguar.h"
 #include "types.h"
 
 #include "types.h"
 
-void eeprom_init(void);
-void eeprom_reset(void);
-void eeprom_done(void);
-void eeprom_update(void);
+void EepromInit(void);
+void EepromReset(void);
+void EepromDone(void);
+void EepromUpdate(void);
 
 
-uint8 eeprom_byte_read(uint32 offset);
-uint16 eeprom_word_read(uint32 offset);
-void eeprom_byte_write(uint32 offset, uint8 data);
-void eeprom_word_write(uint32 offset, uint16 data);
+uint8 EepromReadByte(uint32 offset);
+uint16 EepromReadWord(uint32 offset);
+void EepromWriteByte(uint32 offset, uint8 data);
+void EepromWriteWord(uint32 offset, uint16 data);
 
 #endif // __EEPROM_H__
 
 #endif // __EEPROM_H__
similarity index 99%
rename from src/clock.cpp
rename to src/event.cpp
index 9353b1aa0d6c831e422d51c57de60705f241a295..734ad87bdad92709038988cd0d3cb461a64e6c19 100644 (file)
@@ -8,7 +8,7 @@
 // - Handling for an event that occurs NOW
 //
 
 // - Handling for an event that occurs NOW
 //
 
-#include "clock.h"
+#include "event.h"
 
 #include "log.h"
 
 
 #include "log.h"
 
similarity index 85%
rename from src/clock.h
rename to src/event.h
index cd0afe769a01c8a9a3a72b9a9cff8fdfc28bf668..35f84468240984c090f50ea230e2dea3878a3267 100644 (file)
@@ -1,11 +1,11 @@
 //
 //
-// CLOCK.H: System timing support functionality
+// EVENT.H: System timing support functionality
 //
 // by James L. Hammons
 //
 
 //
 // by James L. Hammons
 //
 
-#ifndef __CLOCK_H__
-#define __CLOCK_H__
+#ifndef __EVENT_H__
+#define __EVENT_H__
 
 #include "types.h"
 
 
 #include "types.h"
 
@@ -25,4 +25,4 @@ void AdjustCallbackTime(void (* callback)(void), double time);
 double GetTimeToNextEvent(void);
 void HandleNextEvent(void);
 
 double GetTimeToNextEvent(void);
 void HandleNextEvent(void);
 
-#endif // __CLOCK_H__
+#endif // __EVENT_H__
index 461017132812d5612a08c847ec314d5183314b22..0275a26da1676490e582e7257906da806200ff87 100644 (file)
 
 #include "gpu.h"
 
 
 #include "gpu.h"
 
-#include <string.h>                                                            // For memset
 #include <stdlib.h>
 #include <stdlib.h>
-#include "log.h"
+#include <string.h>                                                            // For memset
+#include "dsp.h"
+#include "jagdasm.h"
 #include "jaguar.h"
 #include "jaguar.h"
+#include "log.h"
 #include "m68k.h"
 #include "m68k.h"
-#include "tom.h"
 #include "memory.h"
 #include "memory.h"
-#include "jagdasm.h"
-#include "dsp.h"
+#include "tom.h"
 
 //#define GPU_DEBUG
 
 
 //#define GPU_DEBUG
 
@@ -163,7 +163,6 @@ extern int gpu_start_log;
 // Private function prototypes
 
 void GPUUpdateRegisterBanks(void);
 // Private function prototypes
 
 void GPUUpdateRegisterBanks(void);
-
 void GPUDumpDisassembly(void);
 void GPUDumpRegisters(void);
 void GPUDumpMemory(void);
 void GPUDumpDisassembly(void);
 void GPUDumpRegisters(void);
 void GPUDumpMemory(void);
@@ -234,7 +233,7 @@ static void gpu_opcode_sat24(void);
 static void gpu_opcode_pack(void);
 
 // This is wrong, since it doesn't take pipeline effects into account. !!! FIX !!!
 static void gpu_opcode_pack(void);
 
 // This is wrong, since it doesn't take pipeline effects into account. !!! FIX !!!
-/*uint8 gpu_opcode_cycles[64] = 
+/*uint8 gpu_opcode_cycles[64] =
 {
        3,  3,  3,  3,  3,  3,  3,  3,
        3,  3,  3,  3,  3,  3,  3,  3,
 {
        3,  3,  3,  3,  3,  3,  3,  3,
        3,  3,  3,  3,  3,  3,  3,  3,
@@ -249,7 +248,7 @@ static void gpu_opcode_pack(void);
 //This is wrong, wrong, WRONG, but it seems to work for the time being...
 //(That is, it fixes Flip Out which relies on GPU timing rather than semaphores. Bad developers! Bad!)
 //What's needed here is a way to take pipeline effects into account (including pipeline stalls!)...
 //This is wrong, wrong, WRONG, but it seems to work for the time being...
 //(That is, it fixes Flip Out which relies on GPU timing rather than semaphores. Bad developers! Bad!)
 //What's needed here is a way to take pipeline effects into account (including pipeline stalls!)...
-/*uint8 gpu_opcode_cycles[64] = 
+/*uint8 gpu_opcode_cycles[64] =
 {
        1,  1,  1,  1,  1,  1,  1,  1,
        1,  1,  1,  1,  1,  1,  1,  1,
 {
        1,  1,  1,  1,  1,  1,  1,  1,
        1,  1,  1,  1,  1,  1,  1,  1,
@@ -260,7 +259,7 @@ static void gpu_opcode_pack(void);
        1,  1,  1,  1,  1,  1,  4,  1,
        1,  1,  3,  3,  1,  1,  1,  1
 };//*/
        1,  1,  1,  1,  1,  1,  4,  1,
        1,  1,  3,  3,  1,  1,  1,  1
 };//*/
-uint8 gpu_opcode_cycles[64] = 
+uint8 gpu_opcode_cycles[64] =
 {
        1,  1,  1,  1,  1,  1,  1,  1,
        1,  1,  1,  1,  1,  1,  1,  1,
 {
        1,  1,  1,  1,  1,  1,  1,  1,
        1,  1,  1,  1,  1,  1,  1,  1,
@@ -272,8 +271,8 @@ uint8 gpu_opcode_cycles[64] =
        1,  1,  1,  1,  1,  1,  1,  1
 };//*/
 
        1,  1,  1,  1,  1,  1,  1,  1
 };//*/
 
-void (*gpu_opcode[64])()= 
-{      
+void (*gpu_opcode[64])()=
+{
        gpu_opcode_add,                                 gpu_opcode_addc,                                gpu_opcode_addq,                                gpu_opcode_addqt,
        gpu_opcode_sub,                                 gpu_opcode_subc,                                gpu_opcode_subq,                                gpu_opcode_subqt,
        gpu_opcode_neg,                                 gpu_opcode_and,                                 gpu_opcode_or,                                  gpu_opcode_xor,
        gpu_opcode_add,                                 gpu_opcode_addc,                                gpu_opcode_addq,                                gpu_opcode_addqt,
        gpu_opcode_sub,                                 gpu_opcode_subc,                                gpu_opcode_subq,                                gpu_opcode_subqt,
        gpu_opcode_neg,                                 gpu_opcode_and,                                 gpu_opcode_or,                                  gpu_opcode_xor,
@@ -330,7 +329,7 @@ static uint32 gpu_opcode_second_parameter;
 
 #define RESET_FLAG_Z() gpu_flag_z = 0;
 #define RESET_FLAG_N() gpu_flag_n = 0;
 
 #define RESET_FLAG_Z() gpu_flag_z = 0;
 #define RESET_FLAG_N() gpu_flag_n = 0;
-#define RESET_FLAG_C() gpu_flag_c = 0;    
+#define RESET_FLAG_C() gpu_flag_c = 0;
 
 #define CLR_Z                          (gpu_flag_z = 0)
 #define CLR_ZN                         (gpu_flag_z = gpu_flag_n = 0)
 
 #define CLR_Z                          (gpu_flag_z = 0)
 #define CLR_ZN                         (gpu_flag_z = gpu_flag_n = 0)
@@ -351,8 +350,8 @@ uint8 * branch_condition_table = 0;
 
 uint32 gpu_opcode_use[64];
 
 
 uint32 gpu_opcode_use[64];
 
-const char * gpu_opcode_str[64]= 
-{      
+const char * gpu_opcode_str[64]=
+{
        "add",                          "addc",                         "addq",                         "addqt",
        "sub",                          "subc",                         "subq",                         "subqt",
        "neg",                          "and",                          "or",                           "xor",
        "add",                          "addc",                         "addq",                         "addqt",
        "sub",                          "subc",                         "subq",                         "subqt",
        "neg",                          "and",                          "or",                           "xor",
@@ -374,12 +373,12 @@ const char * gpu_opcode_str[64]=
 static uint32 gpu_in_exec = 0;
 static uint32 gpu_releaseTimeSlice_flag = 0;
 
 static uint32 gpu_in_exec = 0;
 static uint32 gpu_releaseTimeSlice_flag = 0;
 
-void gpu_releaseTimeslice(void)
+void GPUReleaseTimeslice(void)
 {
        gpu_releaseTimeSlice_flag = 1;
 }
 
 {
        gpu_releaseTimeSlice_flag = 1;
 }
 
-uint32 gpu_get_pc(void)
+uint32 GPUGetPC(void)
 {
        return gpu_pc;
 }
 {
        return gpu_pc;
 }
@@ -507,7 +506,7 @@ uint32 GPUReadLong(uint32 offset, uint32 who/*=UNKNOWN*/)
                        gpu_flag_n = (gpu_flag_n ? 1 : 0);
 
                        gpu_flags = (gpu_flags & 0xFFFFFFF8) | (gpu_flag_n << 2) | (gpu_flag_c << 1) | gpu_flag_z;
                        gpu_flag_n = (gpu_flag_n ? 1 : 0);
 
                        gpu_flags = (gpu_flags & 0xFFFFFFF8) | (gpu_flag_n << 2) | (gpu_flag_c << 1) | gpu_flag_z;
-                                       
+
                        return gpu_flags & 0xFFFFC1FF;
                case 0x04:
                        return gpu_matrix_control;
                        return gpu_flags & 0xFFFFC1FF;
                case 0x04:
                        return gpu_matrix_control;
@@ -627,7 +626,7 @@ void GPUWriteWord(uint32 offset, uint16 data, uint32 who/*=UNKNOWN*/)
                        else
                                gpu_div_control = (gpu_div_control & 0x0000FFFF) | ((data & 0xFFFF) << 16);
                }
                        else
                                gpu_div_control = (gpu_div_control & 0x0000FFFF) | ((data & 0xFFFF) << 16);
                }
-               else 
+               else
                {
 //WriteLog("[GPU W16:%08X,%04X]", offset, data);
                        uint32 old_data = GPUReadLong(offset & 0xFFFFFFC, who);
                {
 //WriteLog("[GPU W16:%08X,%04X]", offset, data);
                        uint32 old_data = GPUReadLong(offset & 0xFFFFFFC, who);
@@ -719,7 +718,7 @@ WriteLog("GPU: %s setting GPU PC to %08X %s\n", whoName[who], gpu_pc, (GPU_RUNNI
 #endif // GPU_DEBUG
                        break;
                case 0x14:
 #endif // GPU_DEBUG
                        break;
                case 0x14:
-               {       
+               {
 //                     uint32 gpu_was_running = GPU_RUNNING;
                        data &= ~0xF7C0;                // Disable writes to INT_LAT0-4 & TOM version number
 
 //                     uint32 gpu_was_running = GPU_RUNNING;
                        data &= ~0xF7C0;                // Disable writes to INT_LAT0-4 & TOM version number
 
@@ -727,13 +726,13 @@ WriteLog("GPU: %s setting GPU PC to %08X %s\n", whoName[who], gpu_pc, (GPU_RUNNI
                        if (data & 0x02)
                        {
 //WriteLog("GPU->CPU interrupt\n");
                        if (data & 0x02)
                        {
 //WriteLog("GPU->CPU interrupt\n");
-                               if (tom_irq_enabled(IRQ_GPU))
+                               if (TOMIRQEnabled(IRQ_GPU))
                                {
                                {
-                                       if ((tom_irq_enabled(IRQ_GPU)) && (jaguar_interrupt_handler_is_valid(64)))
+                                       if ((TOMIRQEnabled(IRQ_GPU)) && (JaguarInterruptHandlerIsValid(64)))
                                        {
                                        {
-                                               tom_set_pending_gpu_int();
+                                               TOMSetPendingGPUInt();
                                                m68k_set_irq(7);                        // Set 68000 NMI
                                                m68k_set_irq(7);                        // Set 68000 NMI
-                                               gpu_releaseTimeslice();
+                                               GPUReleaseTimeslice();
                                        }
                                }
                                data &= ~0x02;
                                        }
                                }
                                data &= ~0x02;
@@ -745,7 +744,7 @@ WriteLog("GPU: %s setting GPU PC to %08X %s\n", whoName[who], gpu_pc, (GPU_RUNNI
 //WriteLog("CPU->GPU interrupt\n");
                                GPUSetIRQLine(0, ASSERT_LINE);
                                m68k_end_timeslice();
 //WriteLog("CPU->GPU interrupt\n");
                                GPUSetIRQLine(0, ASSERT_LINE);
                                m68k_end_timeslice();
-                               dsp_releaseTimeslice();
+                               DSPReleaseTimeslice();
                                data &= ~0x04;
                        }
 
                                data &= ~0x04;
                        }
 
@@ -763,13 +762,13 @@ WriteLog("GPU: %s setting GPU PC to %08X %s\n", whoName[who], gpu_pc, (GPU_RUNNI
                        {
                                WriteLog("GPU: Write32--About to do stupid braindead GPU execution for 200 cycles.\n");
 #endif // GPU_DEBUG
                        {
                                WriteLog("GPU: Write32--About to do stupid braindead GPU execution for 200 cycles.\n");
 #endif // GPU_DEBUG
-                               gpu_exec(200);
+                               GPUExec(200);
 #ifdef GPU_DEBUG
                        }
 #endif // GPU_DEBUG//*/
 #else
                        if (gpu_control & 0x18)
 #ifdef GPU_DEBUG
                        }
 #endif // GPU_DEBUG//*/
 #else
                        if (gpu_control & 0x18)
-                               gpu_exec(1);
+                               GPUExec(1);
 #endif // #ifndef GPU_SINGLE_STEPPING
 #ifdef GPU_DEBUG
 WriteLog("Write to GPU CTRL by %s: %08X ", whoName[who], data);
 #endif // #ifndef GPU_SINGLE_STEPPING
 #ifdef GPU_DEBUG
 WriteLog("Write to GPU CTRL by %s: %08X ", whoName[who], data);
@@ -821,7 +820,7 @@ if (GPU_RUNNING && effect_start5 && gpu_pc == 0xF035D8)
                for(int x=0; x<2; x++)
                {
                        JaguarWriteLong(dst, JaguarReadLong(src));
                for(int x=0; x<2; x++)
                {
                        JaguarWriteLong(dst, JaguarReadLong(src));
-                       
+
                        src += 4;
                        dst += 4;
                }
                        src += 4;
                        dst += 4;
                }
@@ -918,12 +917,12 @@ void GPUHandleIRQs(void)
 
        // Get the interrupt latch & enable bits
        uint32 bits = (gpu_control >> 6) & 0x1F, mask = (gpu_flags >> 4) & 0x1F;
 
        // Get the interrupt latch & enable bits
        uint32 bits = (gpu_control >> 6) & 0x1F, mask = (gpu_flags >> 4) & 0x1F;
-       
+
        // Bail out if latched interrupts aren't enabled
        bits &= mask;
        if (!bits)
                return;
        // Bail out if latched interrupts aren't enabled
        bits &= mask;
        if (!bits)
                return;
-       
+
        // Determine which interrupt to service
        uint32 which = 0; //Isn't there a #pragma to disable this warning???
        if (bits & 0x01)
        // Determine which interrupt to service
        uint32 which = 0; //Isn't there a #pragma to disable this warning???
        if (bits & 0x01)
@@ -940,18 +939,18 @@ void GPUHandleIRQs(void)
        if (start_logging)
                WriteLog("GPU: Generating IRQ #%i\n", which);
 
        if (start_logging)
                WriteLog("GPU: Generating IRQ #%i\n", which);
 
-       // set the interrupt flag 
+       // set the interrupt flag
        gpu_flags |= IMASK;
        GPUUpdateRegisterBanks();
 
        gpu_flags |= IMASK;
        GPUUpdateRegisterBanks();
 
-       // subqt  #4,r31                ; pre-decrement stack pointer 
-       // move  pc,r30                 ; address of interrupted code 
+       // subqt  #4,r31                ; pre-decrement stack pointer
+       // move  pc,r30                 ; address of interrupted code
        // store  r30,(r31)     ; store return address
        gpu_reg[31] -= 4;
        GPUWriteLong(gpu_reg[31], gpu_pc - 2, GPU);
        // store  r30,(r31)     ; store return address
        gpu_reg[31] -= 4;
        GPUWriteLong(gpu_reg[31], gpu_pc - 2, GPU);
-       
-       // movei  #service_address,r30  ; pointer to ISR entry 
-       // jump  (r30)                                  ; jump to ISR 
+
+       // movei  #service_address,r30  ; pointer to ISR entry
+       // jump  (r30)                                  ; jump to ISR
        // nop
        gpu_pc = gpu_reg[30] = GPU_WORK_RAM_BASE + (which * 0x10);
 }
        // nop
        gpu_pc = gpu_reg[30] = GPU_WORK_RAM_BASE + (which * 0x10);
 }
@@ -975,7 +974,7 @@ void GPUSetIRQLine(int irqline, int state)
 //#include "gpu2.h"
 //#include "gpu3.h"
 
 //#include "gpu2.h"
 //#include "gpu3.h"
 
-void gpu_init(void)
+void GPUInit(void)
 {
 //     memory_malloc_secure((void **)&gpu_ram_8, 0x1000, "GPU work RAM");
 //     memory_malloc_secure((void **)&gpu_reg_bank_0, 32 * sizeof(int32), "GPU bank 0 regs");
 {
 //     memory_malloc_secure((void **)&gpu_ram_8, 0x1000, "GPU work RAM");
 //     memory_malloc_secure((void **)&gpu_reg_bank_0, 32 * sizeof(int32), "GPU bank 0 regs");
@@ -983,14 +982,14 @@ void gpu_init(void)
 
        build_branch_condition_table();
 
 
        build_branch_condition_table();
 
-       gpu_reset();
+       GPUReset();
 
 //TEMPORARY: Testing only!
 //     gpu2_init();
 //     gpu3_init();
 }
 
 
 //TEMPORARY: Testing only!
 //     gpu2_init();
 //     gpu3_init();
 }
 
-void gpu_reset(void)
+void GPUReset(void)
 {
        // GPU registers (directly visible)
        gpu_flags                         = 0x00000000;
 {
        // GPU registers (directly visible)
        gpu_flags                         = 0x00000000;
@@ -1016,15 +1015,15 @@ void gpu_reset(void)
        memset(gpu_ram_8, 0xFF, 0x1000);
        gpu_in_exec = 0;
 //not needed   GPUInterruptPending = false;
        memset(gpu_ram_8, 0xFF, 0x1000);
        gpu_in_exec = 0;
 //not needed   GPUInterruptPending = false;
-       gpu_reset_stats();
+       GPUResetStats();
 }
 
 }
 
-uint32 gpu_read_pc(void)
+uint32 GPUReadPC(void)
 {
        return gpu_pc;
 }
 
 {
        return gpu_pc;
 }
 
-void gpu_reset_stats(void)
+void GPUResetStats(void)
 {
        for(uint32 i=0; i<64; i++)
                gpu_opcode_use[i] = 0;
 {
        for(uint32 i=0; i<64; i++)
                gpu_opcode_use[i] = 0;
@@ -1076,11 +1075,11 @@ void GPUDumpMemory(void)
                        gpu_ram_8[i+1], gpu_ram_8[i+2], gpu_ram_8[i+3]);
 }
 
                        gpu_ram_8[i+1], gpu_ram_8[i+2], gpu_ram_8[i+3]);
 }
 
-void gpu_done(void)
-{ 
+void GPUDone(void)
+{
        WriteLog("GPU: Stopped at PC=%08X (GPU %s running)\n", (unsigned int)gpu_pc, GPU_RUNNING ? "was" : "wasn't");
 
        WriteLog("GPU: Stopped at PC=%08X (GPU %s running)\n", (unsigned int)gpu_pc, GPU_RUNNING ? "was" : "wasn't");
 
-       // Get the interrupt latch & enable bits 
+       // Get the interrupt latch & enable bits
        uint8 bits = (gpu_control >> 6) & 0x1F, mask = (gpu_flags >> 4) & 0x1F;
        WriteLog("GPU: Latch bits = %02X, enable bits = %02X\n", bits, mask);
 
        uint8 bits = (gpu_control >> 6) & 0x1F, mask = (gpu_flags >> 4) & 0x1F;
        WriteLog("GPU: Latch bits = %02X, enable bits = %02X\n", bits, mask);
 
@@ -1106,7 +1105,7 @@ void gpu_done(void)
 static int testCount = 1;
 static int len = 0;
 static bool tripwire = false;
 static int testCount = 1;
 static int len = 0;
 static bool tripwire = false;
-void gpu_exec(int32 cycles)
+void GPUExec(int32 cycles)
 {
        if (!GPU_RUNNING)
                return;
 {
        if (!GPU_RUNNING)
                return;
@@ -1161,7 +1160,7 @@ if (gpu_ram_8[0x054] == 0x98 && gpu_ram_8[0x055] == 0x0A && gpu_ram_8[0x056] ==
 /*             gpu_flag_c = (gpu_flag_c ? 1 : 0);
                gpu_flag_z = (gpu_flag_z ? 1 : 0);
                gpu_flag_n = (gpu_flag_n ? 1 : 0);*/
 /*             gpu_flag_c = (gpu_flag_c ? 1 : 0);
                gpu_flag_z = (gpu_flag_z ? 1 : 0);
                gpu_flag_n = (gpu_flag_n ? 1 : 0);*/
-       
+
                uint16 opcode = GPUReadWord(gpu_pc, GPU);
                uint32 index = opcode >> 10;
                gpu_instruction = opcode;                               // Added for GPU #3...
                uint16 opcode = GPUReadWord(gpu_pc, GPU);
                uint32 index = opcode >> 10;
                gpu_instruction = opcode;                               // Added for GPU #3...
@@ -1267,7 +1266,7 @@ WriteLog("GPU: [%08X] %s (RM=%08X, RN=%08X) -> ", gpu_pc, buffer, RM, RN);
 //             gpu3_opcode[index]();
 
 // BIOS hacking
 //             gpu3_opcode[index]();
 
 // BIOS hacking
-//GPU: [00F03548] jr      nz,00F03560 (0xd561) (RM=00F03114, RN=00000004) ->     --> JR: Branch taken. 
+//GPU: [00F03548] jr      nz,00F03560 (0xd561) (RM=00F03114, RN=00000004) ->     --> JR: Branch taken.
 /*static bool firstTime = true;
 if (gpu_pc == 0xF03548 && firstTime)
 {
 /*static bool firstTime = true;
 if (gpu_pc == 0xF03548 && firstTime)
 {
@@ -1368,7 +1367,7 @@ const char * condition[32] =
 if (gpu_start_log)
        WriteLog("    --> JUMP: Branch taken.\n");
                uint32 delayed_pc = RM;
 if (gpu_start_log)
        WriteLog("    --> JUMP: Branch taken.\n");
                uint32 delayed_pc = RM;
-               gpu_exec(1);
+               GPUExec(1);
                gpu_pc = delayed_pc;
 /*             uint16 opcode = GPUReadWord(gpu_pc, GPU);
                gpu_opcode_first_parameter = (opcode >> 5) & 0x1F;
                gpu_pc = delayed_pc;
 /*             uint16 opcode = GPUReadWord(gpu_pc, GPU);
                gpu_opcode_first_parameter = (opcode >> 5) & 0x1F;
@@ -1423,7 +1422,7 @@ if (gpu_start_log)
        WriteLog("    --> JR: Branch taken.\n");
                int32 offset = (IMM_1 & 0x10 ? 0xFFFFFFF0 | IMM_1 : IMM_1);             // Sign extend IMM_1
                int32 delayed_pc = gpu_pc + (offset * 2);
        WriteLog("    --> JR: Branch taken.\n");
                int32 offset = (IMM_1 & 0x10 ? 0xFFFFFFF0 | IMM_1 : IMM_1);             // Sign extend IMM_1
                int32 delayed_pc = gpu_pc + (offset * 2);
-               gpu_exec(1);
+               GPUExec(1);
                gpu_pc = delayed_pc;
 /*             uint16 opcode = GPUReadWord(gpu_pc, GPU);
                gpu_opcode_first_parameter = (opcode >> 5) & 0x1F;
                gpu_pc = delayed_pc;
 /*             uint16 opcode = GPUReadWord(gpu_pc, GPU);
                gpu_opcode_first_parameter = (opcode >> 5) & 0x1F;
@@ -2103,7 +2102,7 @@ static void gpu_opcode_mmult(void)
        if (gpu_matrix_control & 0x10)                          // Column stepping
        {
                for(int i=0; i<count; i++)
        if (gpu_matrix_control & 0x10)                          // Column stepping
        {
                for(int i=0; i<count; i++)
-               { 
+               {
                        int16 a;
                        if (i & 0x01)
                                a = (int16)((gpu_alternate_reg[IMM_1 + (i >> 1)] >> 16) & 0xFFFF);
                        int16 a;
                        if (i & 0x01)
                                a = (int16)((gpu_alternate_reg[IMM_1 + (i >> 1)] >> 16) & 0xFFFF);
index 1af1a3615149c115b756bb58a9dcee5759b011ae..65485447107ea1cf9fd191bbe6c350861263ebc7 100644 (file)
--- a/src/gpu.h
+++ b/src/gpu.h
@@ -5,17 +5,16 @@
 #ifndef __GPU_H__
 #define __GPU_H__
 
 #ifndef __GPU_H__
 #define __GPU_H__
 
-//#include "jaguar.h"
 #include "types.h"
 
 #define GPU_CONTROL_RAM_BASE    0x00F02100
 #define GPU_WORK_RAM_BASE              0x00F03000
 
 #include "types.h"
 
 #define GPU_CONTROL_RAM_BASE    0x00F02100
 #define GPU_WORK_RAM_BASE              0x00F03000
 
-void gpu_init(void);
-void gpu_reset(void);
-void gpu_exec(int32);
-void gpu_done(void);
-void gpu_update_register_banks(void);
+void GPUInit(void);
+void GPUReset(void);
+void GPUExec(int32);
+void GPUDone(void);
+void GPUUpdateRegisterBanks(void);
 void GPUHandleIRQs(void);
 void GPUSetIRQLine(int irqline, int state);
 
 void GPUHandleIRQs(void);
 void GPUSetIRQLine(int irqline, int state);
 
@@ -26,10 +25,10 @@ void GPUWriteByte(uint32 offset, uint8 data, uint32 who = UNKNOWN);
 void GPUWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void GPUWriteLong(uint32 offset, uint32 data, uint32 who = UNKNOWN);
 
 void GPUWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void GPUWriteLong(uint32 offset, uint32 data, uint32 who = UNKNOWN);
 
-uint32 gpu_get_pc(void);
-void gpu_releaseTimeslice(void);
-void gpu_reset_stats(void);
-uint32 gpu_read_pc(void);
+uint32 GPUGetPC(void);
+void GPUReleaseTimeslice(void);
+void GPUResetStats(void);
+uint32 GPUReadPC(void);
 
 // GPU interrupt numbers (from $F00100, bits 4-8)
 
 
 // GPU interrupt numbers (from $F00100, bits 4-8)
 
index 0ff948f70e182f2c1f33761eece233f1e0383463..a8805c9e5f226ed2545ca0e590dd0e84d9b72454 100644 (file)
@@ -7,25 +7,25 @@
 
 #include "gui.h"
 
 
 #include "gui.h"
 
-#include <sys/types.h>                                                         // For MacOS <dirent.h> dependency
-#include <dirent.h>
+#include <algorithm>
+#include <ctype.h>                                                                     // For toupper()
 #include <SDL.h>
 #include <string>
 #include <SDL.h>
 #include <string>
+#include <sys/types.h>                                                         // For MacOS <dirent.h> dependency
+#include <dirent.h>
 #include <vector>
 #include <vector>
-#include <algorithm>
-#include <ctype.h>                                                                     // For toupper()
-#include "settings.h"
-#include "tom.h"
-#include "video.h"
-#include "clock.h"
+#include "crc32.h"
+#include "event.h"
+#include "file.h"
 #include "font1.h"
 #include "font14pt.h"                                                          // Also 15, 16, 17, 18
 #include "guielements.h"
 #include "font1.h"
 #include "font14pt.h"                                                          // Also 15, 16, 17, 18
 #include "guielements.h"
-#include "crc32.h"
-#include "sdlemu_opengl.h"
-#include "log.h"
 #include "jaguar.h"
 #include "jaguar.h"
-#include "file.h"
+#include "log.h"
+#include "sdlemu_opengl.h"
+#include "settings.h"
+#include "tom.h"
+#include "video.h"
 
 using namespace std;                                                           // For STL stuff
 
 
 using namespace std;                                                           // For STL stuff
 
@@ -1610,7 +1610,7 @@ void FillScreenRectangle(uint32 * screen, uint32 x, uint32 y, uint32 w, uint32 h
 // GUI stuff--it's not crunchy, it's GUI! ;-)
 //
 
 // GUI stuff--it's not crunchy, it's GUI! ;-)
 //
 
-void InitGUI(void)
+void GUIInit(void)
 {
        SDL_ShowCursor(SDL_DISABLE);
        SDL_GetMouseState(&mouseX, &mouseY);
 {
        SDL_ShowCursor(SDL_DISABLE);
        SDL_GetMouseState(&mouseX, &mouseY);
@@ -1693,13 +1693,13 @@ Bitmap ptr = { 6, 8, 4,
 //This is crappy!!! !!! FIX !!!
 //Is this even needed any more? Hmm. Maybe. Dunno.
 WriteLog("GUI: Resetting Jaguar...\n");
 //This is crappy!!! !!! FIX !!!
 //Is this even needed any more? Hmm. Maybe. Dunno.
 WriteLog("GUI: Resetting Jaguar...\n");
-       jaguar_reset();
+       JaguarReset();
 
 WriteLog("GUI: Clearing BG save...\n");
        // Set up our background save...
 //     memset(background, 0x11, tom_getVideoModeWidth() * 240 * 2);
 //1111 -> 000100 01000 10001 -> 0001 0000 0100 0010 1000 1100 -> 10 42 8C
 
 WriteLog("GUI: Clearing BG save...\n");
        // Set up our background save...
 //     memset(background, 0x11, tom_getVideoModeWidth() * 240 * 2);
 //1111 -> 000100 01000 10001 -> 0001 0000 0100 0010 1000 1100 -> 10 42 8C
-       for(uint32 i=0; i<tom_getVideoModeWidth()*240; i++)
+       for(uint32 i=0; i<TOMGetVideoModeWidth()*240; i++)
 //             background[i] = 0xFF8C4210;
                backbuffer[i] = 0xFF8C4210;
 
 //             background[i] = 0xFF8C4210;
                backbuffer[i] = 0xFF8C4210;
 
@@ -1774,6 +1774,12 @@ WriteLog("GUI: Entering main loop...\n");
                        }
                        else if (event.type == SDL_KEYDOWN)
                        {
                        }
                        else if (event.type == SDL_KEYDOWN)
                        {
+// Ugly kludge for windowed<-->fullscreen switching...
+uint8 * keystate = SDL_GetKeyState(NULL);
+
+if ((keystate[SDLK_LALT] || keystate[SDLK_RALT]) & keystate[SDLK_RETURN])
+       ToggleFullscreen();
+
                                if (mainWindow)
                                        mainWindow->HandleKey(event.key.keysym.sym);
                                else
                                if (mainWindow)
                                        mainWindow->HandleKey(event.key.keysym.sym);
                                else
@@ -1888,21 +1894,21 @@ Window * LoadROM(void)
 
 Window * ResetJaguar(void)
 {
 
 Window * ResetJaguar(void)
 {
-       jaguar_reset();
+       JaguarReset();
 
        return RunEmu();
 }
 
 Window * ResetJaguarCD(void)
 {
 
        return RunEmu();
 }
 
 Window * ResetJaguarCD(void)
 {
-       memcpy(jaguar_mainRom, jaguar_CDBootROM, 0x40000);
+       memcpy(jaguarMainRom, jaguarCDBootROM, 0x40000);
        jaguarRunAddress = 0x802000;
        jaguarRunAddress = 0x802000;
-       jaguar_mainRom_crc32 = crc32_calcCheckSum(jaguar_mainRom, 0x40000);
-       jaguar_reset();
+       jaguarMainRomCRC32 = crc32_calcCheckSum(jaguarMainRom, 0x40000);
+       JaguarReset();
 //This is a quick kludge to get the CDBIOS to boot properly...
 //Wild speculation: It could be that this memory location is wired into the CD unit
 //somehow, which lets it know whether or not a cart is present in the unit...
 //This is a quick kludge to get the CDBIOS to boot properly...
 //Wild speculation: It could be that this memory location is wired into the CD unit
 //somehow, which lets it know whether or not a cart is present in the unit...
-       jaguar_mainRom[0x0040B] = 0x03;
+       jaguarMainRom[0x0040B] = 0x03;
 
        return RunEmu();
 }
 
        return RunEmu();
 }
@@ -2060,9 +2066,9 @@ Window * RunEmu(void)
                cartType = 0;
        else if (jaguarRomSize == 0x400000)
                cartType = 1;
                cartType = 0;
        else if (jaguarRomSize == 0x400000)
                cartType = 1;
-       else if (jaguar_mainRom_crc32 == 0x687068D5)
+       else if (jaguarMainRomCRC32 == 0x687068D5)
                cartType = 2;
                cartType = 2;
-       else if (jaguar_mainRom_crc32 == 0x55A0669C)
+       else if (jaguarMainRomCRC32 == 0x55A0669C)
                cartType = 3;
 
        const char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" };
                cartType = 3;
 
        const char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" };
@@ -2087,6 +2093,8 @@ else
 
 //Add in a new function for clearing patches of screen (ClearOverlayRect)
 
 
 //Add in a new function for clearing patches of screen (ClearOverlayRect)
 
+// Also: Take frame rate into account when calculating fade time...
+
                // Some QnD GUI stuff here...
                if (showGUI)
                {
                // Some QnD GUI stuff here...
                if (showGUI)
                {
@@ -2101,7 +2109,7 @@ else
                {
                        DrawString2(overlayPixels, 8, 24*FONT_HEIGHT, 0x007F63FF, transparency, "Running...");
                        DrawString2(overlayPixels, 8, 26*FONT_HEIGHT, 0x001FFF3F, transparency, "%s, run address: %06X", cartTypeName[cartType], jaguarRunAddress);
                {
                        DrawString2(overlayPixels, 8, 24*FONT_HEIGHT, 0x007F63FF, transparency, "Running...");
                        DrawString2(overlayPixels, 8, 26*FONT_HEIGHT, 0x001FFF3F, transparency, "%s, run address: %06X", cartTypeName[cartType], jaguarRunAddress);
-                       DrawString2(overlayPixels, 8, 27*FONT_HEIGHT, 0x001FFF3F, transparency, "CRC: %08X", jaguar_mainRom_crc32);
+                       DrawString2(overlayPixels, 8, 27*FONT_HEIGHT, 0x001FFF3F, transparency, "CRC: %08X", jaguarMainRomCRC32);
 
                        if (showMsgFrames == 0)
                        {
 
                        if (showMsgFrames == 0)
                        {
@@ -2127,7 +2135,7 @@ doGPUDis = true;//*/
 
        // Save the background for the GUI...
        // In this case, we squash the color to monochrome, then force it to blue + green...
 
        // Save the background for the GUI...
        // In this case, we squash the color to monochrome, then force it to blue + green...
-       for(uint32 i=0; i<tom_getVideoModeWidth() * 256; i++)
+       for(uint32 i=0; i<TOMGetVideoModeWidth() * 256; i++)
        {
                uint32 pixel = backbuffer[i];
                uint8 b = (pixel >> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF;
        {
                uint32 pixel = backbuffer[i];
                uint8 b = (pixel >> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF;
@@ -2154,7 +2162,6 @@ Window * Quit(void)
 Window * About(void)
 {
        char buf[512];
 Window * About(void)
 {
        char buf[512];
-//     sprintf(buf, "Virtual Jaguar CVS %s", __DATE__);
        sprintf(buf, "SVN %s", __DATE__);
 //fprintf(fp, "VirtualJaguar v1.0.8 (Last full build was on %s %s)\n", __DATE__, __TIME__);
 //VirtualJaguar v1.0.8 (Last full build was on Dec 30 2004 20:01:31)
        sprintf(buf, "SVN %s", __DATE__);
 //fprintf(fp, "VirtualJaguar v1.0.8 (Last full build was on %s %s)\n", __DATE__, __TIME__);
 //VirtualJaguar v1.0.8 (Last full build was on Dec 30 2004 20:01:31)
@@ -2216,3 +2223,30 @@ Window * MiscOptions(void)
 
        return window;
 }
 
        return window;
 }
+
+// Function prototype
+Window * CrashGracefullyCallback(void);
+
+//NOTE: Probably should set a flag as well telling it to do a full reset
+//      of the Jaguar hardware if this happens...
+void GUICrashGracefully(const char * reason)
+{
+       finished = true;                                                        // We're finished for now!
+
+       // Since this is used in the menu code as well, we could create another
+       // internal function called "PushWindowOnQueue" or somesuch
+       SDL_Event event;
+       event.type = SDL_USEREVENT;
+       event.user.code = MENU_ITEM_CHOSEN;
+       event.user.data1 = (void *)CrashGracefullyCallback;
+       SDL_PushEvent(&event);
+}
+
+Window * CrashGracefullyCallback(void)
+{
+       Window * window = new Window(8, 16, 304, 192);
+
+       window->AddElement(new Text(8, 8+0*FONT_HEIGHT, "We CRASHED!!!"));
+
+       return window;
+}
index 512b6c70cced6604b1c649b6b87509617d860b32..6520f53612305e28727d5d0803b8a364f66d437c 100644 (file)
--- a/src/gui.h
+++ b/src/gui.h
 extern "C" {
 #endif
 
 extern "C" {
 #endif
 
-void InitGUI(void);
+void GUIInit(void);
 void GUIDone(void);
 bool GUIMain(char *);
 void GUIDone(void);
 bool GUIMain(char *);
+void GUICrashGracefully(const char *);
 
 // Exported vars
 
 extern bool showGUI;
 
 // Exported vars
 
 extern bool showGUI;
-extern bool finished;
+extern bool exitGUI;                                                   // Hmm.
+extern bool finished;                                                  // Current emulator loop is finished
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index d40d66c96c975508f7e67f2a7c5541d1c7c15f9b..0a54ea4ba1579d5d47f78b44d2e57f4bf128c030 100644 (file)
 
 #include "jaguar.h"
 
 
 #include "jaguar.h"
 
-#include "video.h"
-#include "settings.h"
-//#include "m68kdasmAG.h"
-#include "clock.h"
 #include <SDL.h>
 #include "SDL_opengl.h"
 #include <SDL.h>
 #include "SDL_opengl.h"
-#include "m68k.h"
-#include "log.h"
-#include "tom.h"
-#include "jerry.h"
 #include "cdrom.h"
 #include "dsp.h"
 #include "cdrom.h"
 #include "dsp.h"
+#include "event.h"
 #include "gpu.h"
 #include "gpu.h"
-#include "memory.h"
-#include "joystick.h"
 #include "gui.h"
 #include "gui.h"
+#include "jerry.h"
+#include "joystick.h"
+#include "log.h"
+#include "m68k.h"
+#include "memory.h"
+#include "settings.h"
+#include "tom.h"
+#include "video.h"
 
 #define CPU_DEBUG
 //Do this in makefile??? Yes! Could, but it's easier to define here...
 
 #define CPU_DEBUG
 //Do this in makefile??? Yes! Could, but it's easier to define here...
@@ -59,12 +58,12 @@ const char * whoName[9] =
 
 uint32 jaguar_active_memory_dumps = 0;
 
 
 uint32 jaguar_active_memory_dumps = 0;
 
-uint32 jaguar_mainRom_crc32, jaguarRomSize, jaguarRunAddress;
+uint32 jaguarMainRomCRC32, jaguarRomSize, jaguarRunAddress;
 
 
-uint8 * jaguar_mainRam = NULL;
-uint8 * jaguar_mainRom = NULL;
-uint8 * jaguar_bootRom = NULL;
-uint8 * jaguar_CDBootROM = NULL;
+uint8 * jaguarMainRam = NULL;
+uint8 * jaguarMainRom = NULL;
+uint8 * jaguarBootRom = NULL;
+uint8 * jaguarCDBootROM = NULL;
 bool BIOSLoaded = false;
 bool CDBIOSLoaded = false;
 
 bool BIOSLoaded = false;
 bool CDBIOSLoaded = false;
 
@@ -108,9 +107,9 @@ void M68KInstructionHook(void)
                WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack));
                for(int i=0; i<10; i++)
                        WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4)));
                WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack));
                for(int i=0; i<10; i++)
                        WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4)));
-               WriteLog("Jaguar: VBL interrupt is %s\n", ((tom_irq_enabled(IRQ_VBLANK)) && (jaguar_interrupt_handler_is_valid(64))) ? "enabled" : "disabled");
+               WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
                M68K_show_context();
                M68K_show_context();
-               log_done();
+               LogDone();
                exit(0);
        }
 
                exit(0);
        }
 
@@ -332,7 +331,7 @@ CD_switch:: -> $306C
                WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack));
                for(int i=0; i<10; i++)
                        WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4)));
                WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack));
                for(int i=0; i<10; i++)
                        WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4)));
-               WriteLog("Jaguar: VBL interrupt is %s\n", ((tom_irq_enabled(IRQ_VBLANK)) && (jaguar_interrupt_handler_is_valid(64))) ? "enabled" : "disabled");
+               WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
                M68K_show_context();
 
 //temp
                M68K_show_context();
 
 //temp
@@ -341,7 +340,7 @@ CD_switch:: -> $306C
 //     WriteLog("\n\n");
 //endoftemp
 
 //     WriteLog("\n\n");
 //endoftemp
 
-               log_done();
+               LogDone();
                exit(0);
        }//*/
 #endif
                exit(0);
        }//*/
 #endif
@@ -383,12 +382,12 @@ unsigned int m68k_read_memory_8(unsigned int address)
        unsigned int retVal = 0;
 
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
        unsigned int retVal = 0;
 
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
-               retVal = jaguar_mainRam[address];
+               retVal = jaguarMainRam[address];
 //     else if ((address >= 0x800000) && (address <= 0xDFFFFF))
        else if ((address >= 0x800000) && (address <= 0xDFFEFF))
 //     else if ((address >= 0x800000) && (address <= 0xDFFFFF))
        else if ((address >= 0x800000) && (address <= 0xDFFEFF))
-               retVal = jaguar_mainRom[address - 0x800000];
+               retVal = jaguarMainRom[address - 0x800000];
        else if ((address >= 0xE00000) && (address <= 0xE3FFFF))
        else if ((address >= 0xE00000) && (address <= 0xE3FFFF))
-               retVal = jaguar_bootRom[address - 0xE00000];
+               retVal = jaguarBootRom[address - 0xE00000];
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF))
                retVal = CDROMReadByte(address);
        else if ((address >= 0xF00000) && (address <= 0xF0FFFF))
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF))
                retVal = CDROMReadByte(address);
        else if ((address >= 0xF00000) && (address <= 0xF0FFFF))
@@ -474,12 +473,12 @@ unsigned int m68k_read_memory_16(unsigned int address)
 
        if ((address >= 0x000000) && (address <= 0x3FFFFE))
 //             retVal = (jaguar_mainRam[address] << 8) | jaguar_mainRam[address+1];
 
        if ((address >= 0x000000) && (address <= 0x3FFFFE))
 //             retVal = (jaguar_mainRam[address] << 8) | jaguar_mainRam[address+1];
-               retVal = GET16(jaguar_mainRam, address);
+               retVal = GET16(jaguarMainRam, address);
 //     else if ((address >= 0x800000) && (address <= 0xDFFFFE))
        else if ((address >= 0x800000) && (address <= 0xDFFEFE))
 //     else if ((address >= 0x800000) && (address <= 0xDFFFFE))
        else if ((address >= 0x800000) && (address <= 0xDFFEFE))
-               retVal = (jaguar_mainRom[address - 0x800000] << 8) | jaguar_mainRom[address - 0x800000 + 1];
+               retVal = (jaguarMainRom[address - 0x800000] << 8) | jaguarMainRom[address - 0x800000 + 1];
        else if ((address >= 0xE00000) && (address <= 0xE3FFFE))
        else if ((address >= 0xE00000) && (address <= 0xE3FFFE))
-               retVal = (jaguar_bootRom[address - 0xE00000] << 8) | jaguar_bootRom[address - 0xE00000 + 1];
+               retVal = (jaguarBootRom[address - 0xE00000] << 8) | jaguarBootRom[address - 0xE00000 + 1];
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE))
                retVal = CDROMReadWord(address, M68K);
        else if ((address >= 0xF00000) && (address <= 0xF0FFFE))
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE))
                retVal = CDROMReadWord(address, M68K);
        else if ((address >= 0xF00000) && (address <= 0xF0FFFE))
@@ -532,7 +531,7 @@ void m68k_write_memory_8(unsigned int address, unsigned int value)
                WriteLog("M68K: Byte %02X written at %08X by 68K\n", value, address);//*/
 
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
                WriteLog("M68K: Byte %02X written at %08X by 68K\n", value, address);//*/
 
        if ((address >= 0x000000) && (address <= 0x3FFFFF))
-               jaguar_mainRam[address] = value;
+               jaguarMainRam[address] = value;
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF))
                CDROMWriteByte(address, value, M68K);
        else if ((address >= 0xF00000) && (address <= 0xF0FFFF))
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF))
                CDROMWriteByte(address, value, M68K);
        else if ((address >= 0xF00000) && (address <= 0xF0FFFF))
@@ -592,7 +591,7 @@ if (address == 0xF02110)
        {
 /*             jaguar_mainRam[address] = value >> 8;
                jaguar_mainRam[address + 1] = value & 0xFF;*/
        {
 /*             jaguar_mainRam[address] = value >> 8;
                jaguar_mainRam[address + 1] = value & 0xFF;*/
-               SET16(jaguar_mainRam, address, value);
+               SET16(jaguarMainRam, address, value);
        }
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE))
                CDROMWriteWord(address, value, M68K);
        }
        else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE))
                CDROMWriteWord(address, value, M68K);
@@ -631,18 +630,15 @@ if (address == 0xF03214 && value == 0x88E30047)
 }
 
 
 }
 
 
-uint32 jaguar_get_handler(uint32 i)
+uint32 JaguarGetHandler(uint32 i)
 {
        return JaguarReadLong(i * 4);
 }
 
 {
        return JaguarReadLong(i * 4);
 }
 
-uint32 jaguar_interrupt_handler_is_valid(uint32 i) // Debug use only...
+bool JaguarInterruptHandlerIsValid(uint32 i) // Debug use only...
 {
 {
-       uint32 handler = jaguar_get_handler(i);
-       if (handler && (handler != 0xFFFFFFFF))
-               return 1;
-       else
-               return 0;
+       uint32 handler = JaguarGetHandler(i);
+       return (handler && (handler != 0xFFFFFFFF) ? 1 : 0);
 }
 
 void M68K_show_context(void)
 }
 
 void M68K_show_context(void)
@@ -656,7 +652,7 @@ void M68K_show_context(void)
 
        WriteLog("68K disasm\n");
 //     jaguar_dasm(s68000readPC()-0x1000,0x20000);
 
        WriteLog("68K disasm\n");
 //     jaguar_dasm(s68000readPC()-0x1000,0x20000);
-       jaguar_dasm(m68k_get_reg(NULL, M68K_REG_PC) - 0x80, 0x200);
+       JaguarDasm(m68k_get_reg(NULL, M68K_REG_PC) - 0x80, 0x200);
 //     jaguar_dasm(0x5000, 0x14414);
 
 //     WriteLog("\n.......[Cart start]...........\n\n");
 //     jaguar_dasm(0x5000, 0x14414);
 
 //     WriteLog("\n.......[Cart start]...........\n\n");
@@ -664,10 +660,10 @@ void M68K_show_context(void)
 
        WriteLog("..................\n");
 
 
        WriteLog("..................\n");
 
-       if (tom_irq_enabled(IRQ_VBLANK))
+       if (TOMIRQEnabled(IRQ_VBLANK))
        {
                WriteLog("vblank int: enabled\n");
        {
                WriteLog("vblank int: enabled\n");
-               jaguar_dasm(jaguar_get_handler(64), 0x200);
+               JaguarDasm(JaguarGetHandler(64), 0x200);
        }
        else
                WriteLog("vblank int: disabled\n");
        }
        else
                WriteLog("vblank int: disabled\n");
@@ -675,7 +671,7 @@ void M68K_show_context(void)
        WriteLog("..................\n");
 
        for(int i=0; i<256; i++)
        WriteLog("..................\n");
 
        for(int i=0; i<256; i++)
-               WriteLog("handler %03i at $%08X\n", i, (unsigned int)jaguar_get_handler(i));
+               WriteLog("handler %03i at $%08X\n", i, (unsigned int)JaguarGetHandler(i));
 }
 
 //
 }
 
 //
@@ -775,7 +771,7 @@ unsigned int m68k_read_disassembler_32(unsigned int address)
        return m68k_read_memory_32(address);
 }
 
        return m68k_read_memory_32(address);
 }
 
-void jaguar_dasm(uint32 offset, uint32 qt)
+void JaguarDasm(uint32 offset, uint32 qt)
 {
 #ifdef CPU_DEBUG
        static char buffer[2048];//, mem[64];
 {
 #ifdef CPU_DEBUG
        static char buffer[2048];//, mem[64];
@@ -802,13 +798,13 @@ uint8 JaguarReadByte(uint32 offset, uint32 who/*=UNKNOWN*/)
 
        offset &= 0xFFFFFF;
        if (offset < 0x400000)
 
        offset &= 0xFFFFFF;
        if (offset < 0x400000)
-               data = jaguar_mainRam[offset & 0x3FFFFF];
+               data = jaguarMainRam[offset & 0x3FFFFF];
        else if ((offset >= 0x800000) && (offset < 0xC00000))
        else if ((offset >= 0x800000) && (offset < 0xC00000))
-               data = jaguar_mainRom[offset - 0x800000];
+               data = jaguarMainRom[offset - 0x800000];
        else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
                data = CDROMReadByte(offset, who);
        else if ((offset >= 0xE00000) && (offset < 0xE40000))
        else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
                data = CDROMReadByte(offset, who);
        else if ((offset >= 0xE00000) && (offset < 0xE40000))
-               data = jaguar_bootRom[offset & 0x3FFFF];
+               data = jaguarBootRom[offset & 0x3FFFF];
        else if ((offset >= 0xF00000) && (offset < 0xF10000))
                data = TOMReadByte(offset, who);
        else if ((offset >= 0xF10000) && (offset < 0xF20000))
        else if ((offset >= 0xF00000) && (offset < 0xF10000))
                data = TOMReadByte(offset, who);
        else if ((offset >= 0xF10000) && (offset < 0xF20000))
@@ -824,18 +820,18 @@ uint16 JaguarReadWord(uint32 offset, uint32 who/*=UNKNOWN*/)
        offset &= 0xFFFFFF;
        if (offset <= 0x3FFFFE)
        {
        offset &= 0xFFFFFF;
        if (offset <= 0x3FFFFE)
        {
-               return (jaguar_mainRam[(offset+0) & 0x3FFFFF] << 8) | jaguar_mainRam[(offset+1) & 0x3FFFFF];
+               return (jaguarMainRam[(offset+0) & 0x3FFFFF] << 8) | jaguarMainRam[(offset+1) & 0x3FFFFF];
        }
        else if ((offset >= 0x800000) && (offset <= 0xBFFFFE))
        {
                offset -= 0x800000;
        }
        else if ((offset >= 0x800000) && (offset <= 0xBFFFFE))
        {
                offset -= 0x800000;
-               return (jaguar_mainRom[offset+0] << 8) | jaguar_mainRom[offset+1];
+               return (jaguarMainRom[offset+0] << 8) | jaguarMainRom[offset+1];
        }
 //     else if ((offset >= 0xDFFF00) && (offset < 0xDFFF00))
        else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFE))
                return CDROMReadWord(offset, who);
        else if ((offset >= 0xE00000) && (offset <= 0xE3FFFE))
        }
 //     else if ((offset >= 0xDFFF00) && (offset < 0xDFFF00))
        else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFE))
                return CDROMReadWord(offset, who);
        else if ((offset >= 0xE00000) && (offset <= 0xE3FFFE))
-               return (jaguar_bootRom[(offset+0) & 0x3FFFF] << 8) | jaguar_bootRom[(offset+1) & 0x3FFFF];
+               return (jaguarBootRom[(offset+0) & 0x3FFFF] << 8) | jaguarBootRom[(offset+1) & 0x3FFFF];
        else if ((offset >= 0xF00000) && (offset <= 0xF0FFFE))
                return TOMReadWord(offset, who);
        else if ((offset >= 0xF10000) && (offset <= 0xF1FFFE))
        else if ((offset >= 0xF00000) && (offset <= 0xF0FFFE))
                return TOMReadWord(offset, who);
        else if ((offset >= 0xF10000) && (offset <= 0xF1FFFE))
@@ -854,7 +850,7 @@ void JaguarWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/)
        offset &= 0xFFFFFF;
        if (offset < 0x400000)
        {
        offset &= 0xFFFFFF;
        if (offset < 0x400000)
        {
-               jaguar_mainRam[offset & 0x3FFFFF] = data;
+               jaguarMainRam[offset & 0x3FFFFF] = data;
                return;
        }
        else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
                return;
        }
        else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
@@ -982,8 +978,8 @@ if (who == GPU && (gpu_pc == 0xF03604 || gpu_pc == 0xF03638))
 if (offset == 0x11D31A + 0x48000 || offset == 0x11D31A)
        WriteLog("JWW: %s writing star %04X at %08X...\n", whoName[who], data, offset);//*/
 
 if (offset == 0x11D31A + 0x48000 || offset == 0x11D31A)
        WriteLog("JWW: %s writing star %04X at %08X...\n", whoName[who], data, offset);//*/
 
-               jaguar_mainRam[(offset+0) & 0x3FFFFF] = data >> 8;
-               jaguar_mainRam[(offset+1) & 0x3FFFFF] = data & 0xFF;
+               jaguarMainRam[(offset+0) & 0x3FFFFF] = data >> 8;
+               jaguarMainRam[(offset+1) & 0x3FFFFF] = data & 0xFF;
                return;
        }
        else if (offset >= 0xDFFF00 && offset <= 0xDFFFFE)
                return;
        }
        else if (offset >= 0xDFFF00 && offset <= 0xDFFFFE)
@@ -1033,31 +1029,31 @@ void JaguarWriteLong(uint32 offset, uint32 data, uint32 who/*=UNKNOWN*/)
 //
 // Jaguar console initialization
 //
 //
 // Jaguar console initialization
 //
-void jaguar_init(void)
+void JaguarInit(void)
 {
 #ifdef CPU_DEBUG_MEMORY
        memset(readMem, 0x00, 0x400000);
        memset(writeMemMin, 0xFF, 0x400000);
        memset(writeMemMax, 0x00, 0x400000);
 #endif
 {
 #ifdef CPU_DEBUG_MEMORY
        memset(readMem, 0x00, 0x400000);
        memset(writeMemMin, 0xFF, 0x400000);
        memset(writeMemMax, 0x00, 0x400000);
 #endif
-       memory_malloc_secure((void **)&jaguar_mainRam, 0x400000, "Jaguar 68K CPU RAM");
-       memory_malloc_secure((void **)&jaguar_mainRom, 0x600000, "Jaguar 68K CPU ROM");
-       memory_malloc_secure((void **)&jaguar_bootRom, 0x040000, "Jaguar 68K CPU BIOS ROM"); // Only uses half of this!
-       memory_malloc_secure((void **)&jaguar_CDBootROM, 0x040000, "Jaguar 68K CPU CD BIOS ROM");
-       memset(jaguar_mainRam, 0x00, 0x400000);
+       memory_malloc_secure((void **)&jaguarMainRam, 0x400000, "Jaguar 68K CPU RAM");
+       memory_malloc_secure((void **)&jaguarMainRom, 0x600000, "Jaguar 68K CPU ROM");
+       memory_malloc_secure((void **)&jaguarBootRom, 0x040000, "Jaguar 68K CPU BIOS ROM"); // Only uses half of this!
+       memory_malloc_secure((void **)&jaguarCDBootROM, 0x040000, "Jaguar 68K CPU CD BIOS ROM");
+       memset(jaguarMainRam, 0x00, 0x400000);
 //     memset(jaguar_mainRom, 0xFF, 0x200000); // & set it to all Fs...
 //     memset(jaguar_mainRom, 0x00, 0x200000); // & set it to all 0s...
 //NOTE: This *doesn't* fix FlipOut...
 //Or does it? Hmm...
 //Seems to want $01010101... Dunno why. Investigate!
 //     memset(jaguar_mainRom, 0xFF, 0x200000); // & set it to all Fs...
 //     memset(jaguar_mainRom, 0x00, 0x200000); // & set it to all 0s...
 //NOTE: This *doesn't* fix FlipOut...
 //Or does it? Hmm...
 //Seems to want $01010101... Dunno why. Investigate!
-       memset(jaguar_mainRom, 0x01, 0x600000); // & set it to all 01s...
+       memset(jaguarMainRom, 0x01, 0x600000);  // & set it to all 01s...
 //     memset(jaguar_mainRom, 0xFF, 0x600000); // & set it to all Fs...
 
        m68k_set_cpu_type(M68K_CPU_TYPE_68000);
 //     memset(jaguar_mainRom, 0xFF, 0x600000); // & set it to all Fs...
 
        m68k_set_cpu_type(M68K_CPU_TYPE_68000);
-       gpu_init();
+       GPUInit();
        DSPInit();
        DSPInit();
-       tom_init();
-       jerry_init();
+       TOMInit();
+       JERRYInit();
        CDROMInit();
 }
 
        CDROMInit();
 }
 
@@ -1065,18 +1061,18 @@ void jaguar_init(void)
 void ScanlineCallback(void);
 void RenderCallback(void);
 //extern uint32 * backbuffer;
 void ScanlineCallback(void);
 void RenderCallback(void);
 //extern uint32 * backbuffer;
-void jaguar_reset(void)
+void JaguarReset(void)
 {
 //NOTE: This causes a (virtual) crash if this is set in the config but not found... !!! FIX !!!
        if (vjs.useJaguarBIOS)
 {
 //NOTE: This causes a (virtual) crash if this is set in the config but not found... !!! FIX !!!
        if (vjs.useJaguarBIOS)
-               memcpy(jaguar_mainRam, jaguar_bootRom, 8);
+               memcpy(jaguarMainRam, jaguarBootRom, 8);
        else
        else
-               SET32(jaguar_mainRam, 4, jaguarRunAddress);
+               SET32(jaguarMainRam, 4, jaguarRunAddress);
 
 //     WriteLog("jaguar_reset():\n");
 
 //     WriteLog("jaguar_reset():\n");
-       tom_reset();
-       jerry_reset();
-       gpu_reset();
+       TOMReset();
+       JERRYReset();
+       GPUReset();
        DSPReset();
        CDROMReset();
     m68k_pulse_reset();                                                                // Reset the 68000
        DSPReset();
        CDROMReset();
     m68k_pulse_reset();                                                                // Reset the 68000
@@ -1091,7 +1087,7 @@ void jaguar_reset(void)
 //     SetCallbackTime(RenderCallback, 16651.541);     // # Scanlines * scanline time
 }
 
 //     SetCallbackTime(RenderCallback, 16651.541);     // # Scanlines * scanline time
 }
 
-void jaguar_done(void)
+void JaguarDone(void)
 {
 #ifdef CPU_DEBUG_MEMORY
 /*     WriteLog("\nJaguar: Memory Usage Stats (return addresses)\n\n");
 {
 #ifdef CPU_DEBUG_MEMORY
 /*     WriteLog("\nJaguar: Memory Usage Stats (return addresses)\n\n");
@@ -1166,20 +1162,20 @@ void jaguar_done(void)
 
 //     WriteLog("Jaguar: CD BIOS version %04X\n", JaguarReadWord(0x3004));
        WriteLog("Jaguar: Interrupt enable = %02X\n", TOMReadByte(0xF000E1) & 0x1F);
 
 //     WriteLog("Jaguar: CD BIOS version %04X\n", JaguarReadWord(0x3004));
        WriteLog("Jaguar: Interrupt enable = %02X\n", TOMReadByte(0xF000E1) & 0x1F);
-       WriteLog("Jaguar: VBL interrupt is %s\n", ((tom_irq_enabled(IRQ_VBLANK)) && (jaguar_interrupt_handler_is_valid(64))) ? "enabled" : "disabled");
+       WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
        M68K_show_context();
 //#endif
 
        CDROMDone();
        M68K_show_context();
 //#endif
 
        CDROMDone();
-       gpu_done();
+       GPUDone();
        DSPDone();
        DSPDone();
-       tom_done();
-       jerry_done();
+       TOMDone();
+       JERRYDone();
 
 
-       memory_free(jaguar_mainRom);
-       memory_free(jaguar_mainRam);
-       memory_free(jaguar_bootRom);
-       memory_free(jaguar_CDBootROM);
+       memory_free(jaguarMainRom);
+       memory_free(jaguarMainRam);
+       memory_free(jaguarBootRom);
+       memory_free(jaguarCDBootROM);
 }
 
 //
 }
 
 //
@@ -1227,11 +1223,11 @@ if (effect_start)
 //Not sure if this is correct...
 //Seems to be, kinda. According to the JTRM, this should only fire on odd lines in non-interlace mode...
 //Which means that it normally wouldn't go when it's zero.
 //Not sure if this is correct...
 //Seems to be, kinda. According to the JTRM, this should only fire on odd lines in non-interlace mode...
 //Which means that it normally wouldn't go when it's zero.
-               if (i == vi && i > 0 && tom_irq_enabled(IRQ_VBLANK))    // Time for Vertical Interrupt?
+               if (i == vi && i > 0 && TOMIRQEnabled(IRQ_VBLANK))      // Time for Vertical Interrupt?
                {
                        // We don't have to worry about autovectors & whatnot because the Jaguar
                        // tells you through its HW registers who sent the interrupt...
                {
                        // We don't have to worry about autovectors & whatnot because the Jaguar
                        // tells you through its HW registers who sent the interrupt...
-                       tom_set_pending_video_int();
+                       TOMSetPendingVideoInt();
                        m68k_set_irq(7);
                }
 
                        m68k_set_irq(7);
                }
 
@@ -1246,11 +1242,11 @@ if (effect_start)
                JERRYExecPIT(RISCCyclesPerScanline);
 //if (start_logging)
 //     WriteLog("About to execute JERRY's SSI (%u)...\n", i);
                JERRYExecPIT(RISCCyclesPerScanline);
 //if (start_logging)
 //     WriteLog("About to execute JERRY's SSI (%u)...\n", i);
-               jerry_i2s_exec(RISCCyclesPerScanline);
+               JERRYI2SExec(RISCCyclesPerScanline);
                BUTCHExec(RISCCyclesPerScanline);
 //if (start_logging)
 //     WriteLog("About to execute GPU (%u)...\n", i);
                BUTCHExec(RISCCyclesPerScanline);
 //if (start_logging)
 //     WriteLog("About to execute GPU (%u)...\n", i);
-               gpu_exec(RISCCyclesPerScanline);
+               GPUExec(RISCCyclesPerScanline);
 
                if (vjs.DSPEnabled)
                {
 
                if (vjs.DSPEnabled)
                {
@@ -1276,13 +1272,13 @@ void DumpMainMemory(void)
        if (fp == NULL)
                return;
 
        if (fp == NULL)
                return;
 
-       fwrite(jaguar_mainRam, 1, 0x400000, fp);
+       fwrite(jaguarMainRam, 1, 0x400000, fp);
        fclose(fp);
 }
 
 uint8 * GetRamPtr(void)
 {
        fclose(fp);
 }
 
 uint8 * GetRamPtr(void)
 {
-       return jaguar_mainRam;
+       return jaguarMainRam;
 }
 
 //
 }
 
 //
@@ -1401,7 +1397,7 @@ void JaguarExecuteNew(void)
 //WriteLog("JEN: Time to next event (%u) is %f usec (%u RISC cycles)...\n", nextEvent, timeToNextEvent, USEC_TO_RISC_CYCLES(timeToNextEvent));
 
                m68k_execute(USEC_TO_M68K_CYCLES(timeToNextEvent));
 //WriteLog("JEN: Time to next event (%u) is %f usec (%u RISC cycles)...\n", nextEvent, timeToNextEvent, USEC_TO_RISC_CYCLES(timeToNextEvent));
 
                m68k_execute(USEC_TO_M68K_CYCLES(timeToNextEvent));
-               gpu_exec(USEC_TO_RISC_CYCLES(timeToNextEvent));
+               GPUExec(USEC_TO_RISC_CYCLES(timeToNextEvent));
 
                if (vjs.DSPEnabled)
                {
 
                if (vjs.DSPEnabled)
                {
@@ -1437,11 +1433,11 @@ void ScanlineCallback(void)
 
 //This is a crappy kludge, but maybe it'll work for now...
 //Maybe it's not so bad, since the IRQ happens on a scanline boundary...
 
 //This is a crappy kludge, but maybe it'll work for now...
 //Maybe it's not so bad, since the IRQ happens on a scanline boundary...
-       if (vc == vi && vc > 0 && tom_irq_enabled(IRQ_VBLANK))  // Time for Vertical Interrupt?
+       if (vc == vi && vc > 0 && TOMIRQEnabled(IRQ_VBLANK))    // Time for Vertical Interrupt?
        {
                // We don't have to worry about autovectors & whatnot because the Jaguar
                // tells you through its HW registers who sent the interrupt...
        {
                // We don't have to worry about autovectors & whatnot because the Jaguar
                // tells you through its HW registers who sent the interrupt...
-               tom_set_pending_video_int();
+               TOMSetPendingVideoInt();
                m68k_set_irq(7);
        }
 
                m68k_set_irq(7);
        }
 
index f6a6aec5fdf8a90ef0fe751059c452c2a52a43c4..73f37bbbd2fcd525c0b9e37c5780ca9447692a62 100644 (file)
@@ -3,9 +3,9 @@
 
 #include "types.h"
 
 
 #include "types.h"
 
-void jaguar_init(void);
-void jaguar_reset(void);
-void jaguar_done(void);
+void JaguarInit(void);
+void JaguarReset(void);
+void JaguarDone(void);
 
 uint8 JaguarReadByte(uint32 offset, uint32 who = UNKNOWN);
 uint16 JaguarReadWord(uint32 offset, uint32 who = UNKNOWN);
 
 uint8 JaguarReadByte(uint32 offset, uint32 who = UNKNOWN);
 uint16 JaguarReadWord(uint32 offset, uint32 who = UNKNOWN);
@@ -14,8 +14,8 @@ void JaguarWriteByte(uint32 offset, uint8 data, uint32 who = UNKNOWN);
 void JaguarWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void JaguarWriteLong(uint32 offset, uint32 data, uint32 who = UNKNOWN);
 
 void JaguarWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 void JaguarWriteLong(uint32 offset, uint32 data, uint32 who = UNKNOWN);
 
-uint32 jaguar_interrupt_handler_is_valid(uint32 i);
-void jaguar_dasm(uint32 offset, uint32 qt);
+bool JaguarInterruptHandlerIsValid(uint32 i);
+void JaguarDasm(uint32 offset, uint32 qt);
 
 void JaguarExecute(uint32 * backbuffer, bool render);
 //For testing the new system...
 
 void JaguarExecute(uint32 * backbuffer, bool render);
 //For testing the new system...
@@ -23,15 +23,15 @@ void JaguarExecuteNew(void);
 
 // Exports from JAGUAR.CPP
 
 
 // Exports from JAGUAR.CPP
 
-extern uint8 * jaguar_mainRam;
-extern uint8 * jaguar_mainRom;
-extern uint8 * jaguar_bootRom;
-extern uint8 * jaguar_CDBootROM;
+extern uint8 * jaguarMainRam;
+extern uint8 * jaguarMainRom;
+extern uint8 * jaguarBootRom;
+extern uint8 * jaguarCDBootROM;
 extern bool BIOSLoaded;
 extern bool CDBIOSLoaded;
 extern bool BIOSLoaded;
 extern bool CDBIOSLoaded;
-extern int32 jaguar_cpu_in_exec;
-extern uint32 jaguar_mainRom_crc32, jaguarRomSize, jaguarRunAddress;
-extern char * jaguar_eeproms_path;
+extern int32 jaguarCPUInExec;
+extern uint32 jaguarMainRomCRC32, jaguarRomSize, jaguarRunAddress;
+extern char * jaguarEepromsPath;
 extern const char * whoName[9];
 
 // Some handy macros to help converting native endian to big endian (jaguar native)
 extern const char * whoName[9];
 
 // Some handy macros to help converting native endian to big endian (jaguar native)
index eef8d0152af60c3f9bfd6469c41007917f5771f3..4f2d37b07e978286ef69c34d87f5b79db97ec5cd 100644 (file)
 
 #include <string.h>                                                            // For memcpy
 //#include <math.h>
 
 #include <string.h>                                                            // For memcpy
 //#include <math.h>
-#include "jaguar.h"
-#include "wavetable.h"
-#include "clock.h"
-#include "dsp.h"
+#include "cdrom.h"
 #include "dac.h"
 #include "dac.h"
-#include "joystick.h"
+#include "dsp.h"
 #include "eeprom.h"
 #include "eeprom.h"
+#include "event.h"
+#include "jaguar.h"
+#include "joystick.h"
 #include "log.h"
 #include "log.h"
-#include "cdrom.h"
+#include "wavetable.h"
 
 //Note that 44100 Hz requires samples every 22.675737 usec.
 #define NEW_TIMER_SYSTEM
 
 //Note that 44100 Hz requires samples every 22.675737 usec.
 #define NEW_TIMER_SYSTEM
@@ -196,7 +196,7 @@ void JERRYI2SCallback(void);
 
 //This is only used by the old system, so once the new timer system is working this
 //should be safe to nuke.
 
 //This is only used by the old system, so once the new timer system is working this
 //should be safe to nuke.
-void jerry_i2s_exec(uint32 cycles)
+void JERRYI2SExec(uint32 cycles)
 {
 #ifndef NEW_TIMER_SYSTEM
        extern uint16 serialMode;                                               // From DAC.CPP
 {
 #ifndef NEW_TIMER_SYSTEM
        extern uint16 serialMode;                                               // From DAC.CPP
@@ -411,7 +411,7 @@ void JERRYI2SCallback(void)
 }
 
 
 }
 
 
-void jerry_init(void)
+void JERRYInit(void)
 {
 //     clock_init();
 //     anajoy_init();
 {
 //     clock_init();
 //     anajoy_init();
@@ -428,12 +428,12 @@ void jerry_init(void)
        JERRYPIT2Divider = 0xFFFF;
 }
 
        JERRYPIT2Divider = 0xFFFF;
 }
 
-void jerry_reset(void)
+void JERRYReset(void)
 {
 //     clock_reset();
 //     anajoy_reset();
        JoystickReset();
 {
 //     clock_reset();
 //     anajoy_reset();
        JoystickReset();
-       eeprom_reset();
+       EepromReset();
        JERRYResetI2S();
        DACReset();
 
        JERRYResetI2S();
        DACReset();
 
@@ -446,7 +446,7 @@ void jerry_reset(void)
        jerry_timer_2_counter = 0;
 }
 
        jerry_timer_2_counter = 0;
 }
 
-void jerry_done(void)
+void JERRYDone(void)
 {
        WriteLog("JERRY: M68K Interrupt control ($F10020) = %04X\n", GET16(jerry_ram_8, 0x20));
 //     memory_free(jerry_ram_8);
 {
        WriteLog("JERRY: M68K Interrupt control ($F10020) = %04X\n", GET16(jerry_ram_8, 0x20));
 //     memory_free(jerry_ram_8);
@@ -454,7 +454,7 @@ void jerry_done(void)
 //     anajoy_done();
        JoystickDone();
        DACDone();
 //     anajoy_done();
        JoystickDone();
        DACDone();
-       eeprom_done();
+       EepromDone();
 }
 
 bool JERRYIRQEnabled(int irq)
 }
 
 bool JERRYIRQEnabled(int irq)
@@ -540,9 +540,9 @@ WriteLog("JERRY: Unhandled timer read (BYTE) at %08X...\n", offset);
 //     else if (offset >= 0xF17C00 && offset <= 0xF17C01)
 //             return anajoy_byte_read(offset);
        else if (offset >= 0xF14000 && offset <= 0xF14003)
 //     else if (offset >= 0xF17C00 && offset <= 0xF17C01)
 //             return anajoy_byte_read(offset);
        else if (offset >= 0xF14000 && offset <= 0xF14003)
-               return JoystickReadByte(offset) | eeprom_byte_read(offset);
+               return JoystickReadByte(offset) | EepromReadByte(offset);
        else if (offset >= 0xF14000 && offset <= 0xF1A0FF)
        else if (offset >= 0xF14000 && offset <= 0xF1A0FF)
-               return eeprom_byte_read(offset);
+               return EepromReadByte(offset);
 
        return jerry_ram_8[offset & 0xFFFF];
 }
 
        return jerry_ram_8[offset & 0xFFFF];
 }
@@ -607,11 +607,11 @@ WriteLog("JERRY: Unhandled timer read (WORD) at %08X...\n", offset);
 //     else if ((offset >= 0xF17C00) && (offset <= 0xF17C01))
 //             return anajoy_word_read(offset);
        else if (offset == 0xF14000)
 //     else if ((offset >= 0xF17C00) && (offset <= 0xF17C01))
 //             return anajoy_word_read(offset);
        else if (offset == 0xF14000)
-               return (JoystickReadWord(offset) & 0xFFFE) | eeprom_word_read(offset);
+               return (JoystickReadWord(offset) & 0xFFFE) | EepromReadWord(offset);
        else if ((offset >= 0xF14002) && (offset < 0xF14003))
                return JoystickReadWord(offset);
        else if ((offset >= 0xF14000) && (offset <= 0xF1A0FF))
        else if ((offset >= 0xF14002) && (offset < 0xF14003))
                return JoystickReadWord(offset);
        else if ((offset >= 0xF14000) && (offset <= 0xF1A0FF))
-               return eeprom_word_read(offset);
+               return EepromReadWord(offset);
 
 /*if (offset >= 0xF1D000)
        WriteLog("JERRY: Reading word at %08X [%04X]...\n", offset, ((uint16)jerry_ram_8[(offset+0)&0xFFFF] << 8) | jerry_ram_8[(offset+1)&0xFFFF]);//*/
 
 /*if (offset >= 0xF1D000)
        WriteLog("JERRY: Reading word at %08X [%04X]...\n", offset, ((uint16)jerry_ram_8[(offset+0)&0xFFFF] << 8) | jerry_ram_8[(offset+1)&0xFFFF]);//*/
@@ -723,12 +723,12 @@ WriteLog("JERRY: (68K int en/lat - Unhandled!) Tried to write $%02X to $%08X!\n"
        else if ((offset >= 0xF14000) && (offset <= 0xF14003))
        {
                JoystickWriteByte(offset, data);
        else if ((offset >= 0xF14000) && (offset <= 0xF14003))
        {
                JoystickWriteByte(offset, data);
-               eeprom_byte_write(offset, data);
+               EepromWriteByte(offset, data);
                return;
        }
        else if ((offset >= 0xF14000) && (offset <= 0xF1A0FF))
        {
                return;
        }
        else if ((offset >= 0xF14000) && (offset <= 0xF1A0FF))
        {
-               eeprom_byte_write(offset, data);
+               EepromWriteByte(offset, data);
                return;
        }
 
                return;
        }
 
@@ -828,12 +828,12 @@ WriteLog("JERRY: (68K int en/lat - Unhandled!) Tried to write $%04X to $%08X!\n"
        else if (offset >= 0xF14000 && offset < 0xF14003)
        {
                JoystickWriteWord(offset, data);
        else if (offset >= 0xF14000 && offset < 0xF14003)
        {
                JoystickWriteWord(offset, data);
-               eeprom_word_write(offset, data);
+               EepromWriteWord(offset, data);
                return;
        }
        else if (offset >= 0xF14000 && offset <= 0xF1A0FF)
        {
                return;
        }
        else if (offset >= 0xF14000 && offset <= 0xF1A0FF)
        {
-               eeprom_word_write(offset, data);
+               EepromWriteWord(offset, data);
                return;
        }
 
                return;
        }
 
index 06d6f1dd1e49c02f0626748a6fa2435cb1b01043..c1f1f7ad6d0ad71dc0b24ac60c0c3b588172a55e 100644 (file)
@@ -7,9 +7,9 @@
 
 #include "types.h"
 
 
 #include "types.h"
 
-void jerry_init(void);
-void jerry_reset(void);
-void jerry_done(void);
+void JERRYInit(void);
+void JERRYReset(void);
+void JERRYDone(void);
 
 uint8 JERRYReadByte(uint32 offset, uint32 who = UNKNOWN);
 uint16 JERRYReadWord(uint32 offset, uint32 who = UNKNOWN);
 
 uint8 JERRYReadByte(uint32 offset, uint32 who = UNKNOWN);
 uint16 JERRYReadWord(uint32 offset, uint32 who = UNKNOWN);
@@ -17,7 +17,7 @@ void JERRYWriteByte(uint32 offset, uint8 data, uint32 who = UNKNOWN);
 void JERRYWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 
 void JERRYExecPIT(uint32 cycles);
 void JERRYWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 
 void JERRYExecPIT(uint32 cycles);
-void jerry_i2s_exec(uint32 cycles);
+void JERRYI2SExec(uint32 cycles);
 
 // 68000 Interrupt bit positions (enabled at $F10020)
 
 
 // 68000 Interrupt bit positions (enabled at $F10020)
 
index 5d969d0fd26d0d7b122c30d0ea2d07103968b0f5..aa81c0ff3ebc107412ba38e365a80dd6735bd759 100644 (file)
@@ -8,12 +8,12 @@
 
 #include "joystick.h"
 
 
 #include "joystick.h"
 
-#include <time.h>
 #include <SDL.h>
 #include <SDL.h>
-#include "jaguar.h"
-#include "log.h"
+#include <time.h>
 #include "gpu.h"
 #include "gui.h"
 #include "gpu.h"
 #include "gui.h"
+#include "jaguar.h"
+#include "log.h"
 #include "settings.h"
 #include "video.h"
 
 #include "settings.h"
 #include "video.h"
 
@@ -72,7 +72,6 @@ void JoystickInit(void)
 
 void JoystickExec(void)
 {
 
 void JoystickExec(void)
 {
-//     extern bool useJoystick;
        uint8 * keystate = SDL_GetKeyState(NULL);
 
        memset(joypad_0_buttons, 0, 21);
        uint8 * keystate = SDL_GetKeyState(NULL);
 
        memset(joypad_0_buttons, 0, 21);
@@ -155,7 +154,7 @@ void JoystickExec(void)
        if (keystate[SDLK_q])
                start_logging = 1;
        if (keystate[SDLK_w])
        if (keystate[SDLK_q])
                start_logging = 1;
        if (keystate[SDLK_w])
-               gpu_reset_stats();
+               GPUResetStats();
 //     if (keystate[SDLK_u])           jaguar_long_write(0xf1c384,jaguar_long_read(0xf1c384)+1);
        if (keystate[SDLK_d])
                DumpMainMemory();
 //     if (keystate[SDLK_u])           jaguar_long_write(0xf1c384,jaguar_long_read(0xf1c384)+1);
        if (keystate[SDLK_d])
                DumpMainMemory();
index ce660e8a0cf742fdf189f05d0ddfa4308fc89030..5b2f76317f49b08b1d5433fe37a6a739dc143912 100644 (file)
@@ -17,7 +17,7 @@
 static FILE * log_stream = NULL;
 static uint32 logSize = 0;
 
 static FILE * log_stream = NULL;
 static uint32 logSize = 0;
 
-int log_init(const char * path)
+int LogInit(const char * path)
 {
        log_stream = fopen(path, "wrt");
 
 {
        log_stream = fopen(path, "wrt");
 
@@ -27,12 +27,12 @@ int log_init(const char * path)
        return 1;
 }
 
        return 1;
 }
 
-FILE * log_get(void)
+FILE * LogGet(void)
 {
        return log_stream;
 }
 
 {
        return log_stream;
 }
 
-void log_done(void)
+void LogDone(void)
 {
        fclose(log_stream);
 }
 {
        fclose(log_stream);
 }
index 1c10e687799f0ee00b18e73cf15b15205531ee56..0bf9e092143aac701a0c17fd47daff31c189ee82 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -11,9 +11,9 @@
 extern "C" {
 #endif
 
 extern "C" {
 #endif
 
-int log_init(const char *);
-FILE * log_get(void);
-void log_done(void);
+int LogInit(const char *);
+FILE * LogGet(void);
+void LogDone(void);
 void WriteLog(const char * text, ...);
 
 #ifdef __cplusplus
 void WriteLog(const char * text, ...);
 
 #ifdef __cplusplus
index fe7ac6b1f5d23047fc38bd1efa7ad2adb2c5d417..9cff768f35c6436c403fb92a9343ee39062c5b12 100644 (file)
@@ -12,6 +12,8 @@
 #include <stdlib.h>
 #include "log.h"
 
 #include <stdlib.h>
 #include "log.h"
 
+#warning This module needs some serious cleanup. !!! FIX !!!
+
 // Useful structs (for doubly linked list in this case)
 
 typedef struct sMemBlockInfo
 // Useful structs (for doubly linked list in this case)
 
 typedef struct sMemBlockInfo
@@ -54,7 +56,7 @@ void memory_addMemInfo(void * ptr, uint32 size, const char * info)
        alias->info = info;
 }
 
        alias->info = info;
 }
 
-void InitMemory(void)
+void MemoryInit(void)
 {
        memoryInfo.next = memoryInfo.prev = NULL;
        currentAllocatedMemory = maximumAllocatedMemory = 0;
 {
        memoryInfo.next = memoryInfo.prev = NULL;
        currentAllocatedMemory = maximumAllocatedMemory = 0;
@@ -93,11 +95,11 @@ void memory_malloc_secure(void ** new_ptr, uint32 size, const char * info)
        if (ptr == NULL)
        {
                WriteLog("Failed!\n");
        if (ptr == NULL)
        {
                WriteLog("Failed!\n");
-               log_done();
+               LogDone();
 
 
-//BAD, BAD, BAD! Need to do better than this!!!
-//And since we ARE keeping track of all memory allocations, we should unwind the stack here as well...!
-// !!! FIX !!!
+#warning BAD, BAD, BAD! Need to do better than this!!!
+#warning And since we ARE keeping track of all memory allocations, we should unwind the stack here as well...!
+#warning !!! FIX !!!
 
                exit(0);
        }
 
                exit(0);
        }
index b1a8b5d9c6c2ff11cb7c4729f161ffd5770098b5..5ea70d938630a74ff2e5f2b967995535897ae7d6 100644 (file)
@@ -5,11 +5,10 @@
 #ifndef __MEMORY_H__
 #define __MEMORY_H__
 
 #ifndef __MEMORY_H__
 #define __MEMORY_H__
 
-//This module needs some serious cleanup. !!! FIX !!!
 #include <stdio.h>                                                             // For FILE struct
 #include "types.h"
 
 #include <stdio.h>                                                             // For FILE struct
 #include "types.h"
 
-void InitMemory(void);
+void MemoryInit(void);
 void MemoryDone(void);
 void memory_malloc_secure(void ** new_ptr, uint32 size, const char * info);
 //void * memory_malloc_secure2(uint32 size, const char * info);
 void MemoryDone(void);
 void memory_malloc_secure(void ** new_ptr, uint32 size, const char * info);
 //void * memory_malloc_secure2(uint32 size, const char * info);
index 946714530a5c392a56d17882194ea63de423e971..856b233ca3e6e6563246ce65c6fd160b2189b166 100644 (file)
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
-#include "tom.h"
+#include "gpu.h"
 #include "jaguar.h"
 #include "log.h"
 #include "jaguar.h"
 #include "log.h"
-#include "gpu.h"
 #include "m68k.h"
 #include "m68k.h"
+#include "tom.h"
 
 //#define OP_DEBUG
 //#define OP_DEBUG_BMP
 
 //#define OP_DEBUG
 //#define OP_DEBUG_BMP
@@ -45,7 +45,7 @@ void OPProcessFixedBitmap(uint64 p0, uint64 p1, bool render);
 void OPProcessScaledBitmap(uint64 p0, uint64 p1, uint64 p2, bool render);
 void DumpScaledObject(uint64 p0, uint64 p1, uint64 p2);
 void DumpFixedObject(uint64 p0, uint64 p1);
 void OPProcessScaledBitmap(uint64 p0, uint64 p1, uint64 p2, bool render);
 void DumpScaledObject(uint64 p0, uint64 p1, uint64 p2);
 void DumpFixedObject(uint64 p0, uint64 p1);
-uint64 op_load_phrase(uint32 offset);
+uint64 OPLoadPhrase(uint32 offset);
 
 // Local global variables
 
 
 // Local global variables
 
@@ -71,7 +71,7 @@ int32 phraseWidthToPixels[8] = { 64, 32, 16, 8, 4, 2, 0, 0 };
 //
 // Object Processor initialization
 //
 //
 // Object Processor initialization
 //
-void op_init(void)
+void OPInit(void)
 {
        // Here we calculate the saturating blend of a signed 4-bit value and an
        // existing Cyan/Red value as well as a signed 8-bit value and an existing intensity...
 {
        // Here we calculate the saturating blend of a signed 4-bit value and an
        // existing Cyan/Red value as well as a signed 8-bit value and an existing intensity...
@@ -111,26 +111,26 @@ void op_init(void)
                op_blend_cr[i] = (c2 << 4) | c1;
        }
 
                op_blend_cr[i] = (c2 << 4) | c1;
        }
 
-       op_reset();
+       OPReset();
 }
 
 //
 // Object Processor reset
 //
 }
 
 //
 // Object Processor reset
 //
-void op_reset(void)
+void OPReset(void)
 {
 //     memset(objectp_ram, 0x00, 0x40);
        objectp_running = 0;
 }
 
 {
 //     memset(objectp_ram, 0x00, 0x40);
        objectp_running = 0;
 }
 
-void op_done(void)
+void OPDone(void)
 {
        const char * opType[8] =
        { "(BITMAP)", "(SCALED BITMAP)", "(GPU INT)", "(BRANCH)", "(STOP)", "???", "???", "???" };
        const char * ccType[8] =
                { "\"==\"", "\"<\"", "\">\"", "(opflag set)", "(second half line)", "?", "?", "?" };
 
 {
        const char * opType[8] =
        { "(BITMAP)", "(SCALED BITMAP)", "(GPU INT)", "(BRANCH)", "(STOP)", "???", "???", "???" };
        const char * ccType[8] =
                { "\"==\"", "\"<\"", "\">\"", "(opflag set)", "(second half line)", "?", "?", "?" };
 
-       uint32 olp = op_get_list_pointer();
+       uint32 olp = OPGetListPointer();
        WriteLog("OP: OLP = %08X\n", olp);
        WriteLog("OP: Phrase dump\n    ----------\n");
        for(uint32 i=0; i<0x100; i+=8)
        WriteLog("OP: OLP = %08X\n", olp);
        WriteLog("OP: Phrase dump\n    ----------\n");
        for(uint32 i=0; i<0x100; i+=8)
@@ -146,9 +146,9 @@ void op_done(void)
                }
                WriteLog("\n");
                if ((lo & 0x07) == 0)
                }
                WriteLog("\n");
                if ((lo & 0x07) == 0)
-                       DumpFixedObject(op_load_phrase(olp+i), op_load_phrase(olp+i+8));
+                       DumpFixedObject(OPLoadPhrase(olp+i), OPLoadPhrase(olp+i+8));
                if ((lo & 0x07) == 1)
                if ((lo & 0x07) == 1)
-                       DumpScaledObject(op_load_phrase(olp+i), op_load_phrase(olp+i+8), op_load_phrase(olp+i+16));
+                       DumpScaledObject(OPLoadPhrase(olp+i), OPLoadPhrase(olp+i+8), OPLoadPhrase(olp+i+16));
        }
        WriteLog("\n");
 
        }
        WriteLog("\n");
 
@@ -196,28 +196,28 @@ WriteLog("OP: Setting hi list pointer: %04X\n", data);//*/
 }
 #endif
 
 }
 #endif
 
-uint32 op_get_list_pointer(void)
+uint32 OPGetListPointer(void)
 {
        // Note: This register is LO / HI WORD, hence the funky look of this...
 {
        // Note: This register is LO / HI WORD, hence the funky look of this...
-       return GET16(tom_ram_8, 0x20) | (GET16(tom_ram_8, 0x22) << 16);
+       return GET16(tomRam8, 0x20) | (GET16(tomRam8, 0x22) << 16);
 }
 
 // This is WRONG, since the OBF is only 16 bits wide!!! [FIXED]
 
 }
 
 // This is WRONG, since the OBF is only 16 bits wide!!! [FIXED]
 
-uint32 op_get_status_register(void)
+uint32 OPGetStatusRegister(void)
 {
 {
-       return GET16(tom_ram_8, 0x26);
+       return GET16(tomRam8, 0x26);
 }
 
 // This is WRONG, since the OBF is only 16 bits wide!!! [FIXED]
 
 }
 
 // This is WRONG, since the OBF is only 16 bits wide!!! [FIXED]
 
-void op_set_status_register(uint32 data)
+void OPSetStatusRegister(uint32 data)
 {
 {
-       tom_ram_8[0x26] = (data & 0x0000FF00) >> 8;
-       tom_ram_8[0x27] |= (data & 0xFE);
+       tomRam8[0x26] = (data & 0x0000FF00) >> 8;
+       tomRam8[0x27] |= (data & 0xFE);
 }
 
 }
 
-void op_set_current_object(uint64 object)
+void OPSetCurrentObject(uint64 object)
 {
 //Not sure this is right... Wouldn't it just be stored 64 bit BE?
        // Stored as least significant 32 bits first, ms32 last in big endian
 {
 //Not sure this is right... Wouldn't it just be stored 64 bit BE?
        // Stored as least significant 32 bits first, ms32 last in big endian
@@ -231,18 +231,18 @@ void op_set_current_object(uint64 object)
        objectp_ram[0x15] = object & 0xFF; object >>= 8;
        objectp_ram[0x14] = object & 0xFF;*/
 // Let's try regular good old big endian...
        objectp_ram[0x15] = object & 0xFF; object >>= 8;
        objectp_ram[0x14] = object & 0xFF;*/
 // Let's try regular good old big endian...
-       tom_ram_8[0x17] = object & 0xFF; object >>= 8;
-       tom_ram_8[0x16] = object & 0xFF; object >>= 8;
-       tom_ram_8[0x15] = object & 0xFF; object >>= 8;
-       tom_ram_8[0x14] = object & 0xFF; object >>= 8;
-
-       tom_ram_8[0x13] = object & 0xFF; object >>= 8;
-       tom_ram_8[0x12] = object & 0xFF; object >>= 8;
-       tom_ram_8[0x11] = object & 0xFF; object >>= 8;
-       tom_ram_8[0x10] = object & 0xFF;
+       tomRam8[0x17] = object & 0xFF; object >>= 8;
+       tomRam8[0x16] = object & 0xFF; object >>= 8;
+       tomRam8[0x15] = object & 0xFF; object >>= 8;
+       tomRam8[0x14] = object & 0xFF; object >>= 8;
+
+       tomRam8[0x13] = object & 0xFF; object >>= 8;
+       tomRam8[0x12] = object & 0xFF; object >>= 8;
+       tomRam8[0x11] = object & 0xFF; object >>= 8;
+       tomRam8[0x10] = object & 0xFF;
 }
 
 }
 
-uint64 op_load_phrase(uint32 offset)
+uint64 OPLoadPhrase(uint32 offset)
 {
        offset &= ~0x07;                                                // 8 byte alignment
        return ((uint64)JaguarReadLong(offset, OP) << 32) | (uint64)JaguarReadLong(offset+4, OP);
 {
        offset &= ~0x07;                                                // 8 byte alignment
        return ((uint64)JaguarReadLong(offset, OP) << 32) | (uint64)JaguarReadLong(offset+4, OP);
@@ -319,7 +319,7 @@ extern int op_start_log;
 //     char * condition_to_str[8] =
 //             { "==", "<", ">", "(opflag set)", "(second half line)", "?", "?", "?" };
 
 //     char * condition_to_str[8] =
 //             { "==", "<", ">", "(opflag set)", "(second half line)", "?", "?", "?" };
 
-       op_pointer = op_get_list_pointer();
+       op_pointer = OPGetListPointer();
 
 //     objectp_stop_reading_list = false;
 
 
 //     objectp_stop_reading_list = false;
 
@@ -347,11 +347,11 @@ else
 // *** END OP PROCESSOR TESTING ONLY ***
 //             if (objectp_stop_reading_list)
 //                     return;
 // *** END OP PROCESSOR TESTING ONLY ***
 //             if (objectp_stop_reading_list)
 //                     return;
-                       
-               uint64 p0 = op_load_phrase(op_pointer);
+
+               uint64 p0 = OPLoadPhrase(op_pointer);
 //WriteLog("\t%08X type %i\n", op_pointer, (uint8)p0 & 0x07);
                op_pointer += 8;
 //WriteLog("\t%08X type %i\n", op_pointer, (uint8)p0 & 0x07);
                op_pointer += 8;
-if (scanline == tom_get_vdb() && op_start_log)
+if (scanline == TOMGetVDB() && op_start_log)
 //if (scanline == 215 && op_start_log)
 //if (scanline == 28 && op_start_log)
 {
 //if (scanline == 215 && op_start_log)
 //if (scanline == 28 && op_start_log)
 {
@@ -359,7 +359,7 @@ WriteLog("%08X --> phrase %08X %08X", op_pointer - 8, (int)(p0>>32), (int)(p0&0x
 if ((p0 & 0x07) == OBJECT_TYPE_BITMAP)
 {
 WriteLog(" (BITMAP) ");
 if ((p0 & 0x07) == OBJECT_TYPE_BITMAP)
 {
 WriteLog(" (BITMAP) ");
-uint64 p1 = op_load_phrase(op_pointer);
+uint64 p1 = OPLoadPhrase(op_pointer);
 WriteLog("\n%08X --> phrase %08X %08X ", op_pointer, (int)(p1>>32), (int)(p1&0xFFFFFFFF));
        uint8 bitdepth = (p1 >> 12) & 0x07;
 //WAS: int16 ypos = ((p0 >> 3) & 0x3FF);                       // ??? What if not interlaced (/2)?
 WriteLog("\n%08X --> phrase %08X %08X ", op_pointer, (int)(p1>>32), (int)(p1&0xFFFFFFFF));
        uint8 bitdepth = (p1 >> 12) & 0x07;
 //WAS: int16 ypos = ((p0 >> 3) & 0x3FF);                       // ??? What if not interlaced (/2)?
@@ -381,7 +381,7 @@ WriteLog("\n    [%u (%u) x %u @ (%i, %u) (%u bpp), l: %08X, p: %08X fp: %02X, fl
 if ((p0 & 0x07) == OBJECT_TYPE_SCALE)
 {
 WriteLog(" (SCALED BITMAP)");
 if ((p0 & 0x07) == OBJECT_TYPE_SCALE)
 {
 WriteLog(" (SCALED BITMAP)");
-uint64 p1 = op_load_phrase(op_pointer), p2 = op_load_phrase(op_pointer+8);
+uint64 p1 = OPLoadPhrase(op_pointer), p2 = OPLoadPhrase(op_pointer+8);
 WriteLog("\n%08X --> phrase %08X %08X ", op_pointer, (int)(p1>>32), (int)(p1&0xFFFFFFFF));
 WriteLog("\n%08X --> phrase %08X %08X ", op_pointer+8, (int)(p2>>32), (int)(p2&0xFFFFFFFF));
        uint8 bitdepth = (p1 >> 12) & 0x07;
 WriteLog("\n%08X --> phrase %08X %08X ", op_pointer, (int)(p1>>32), (int)(p1&0xFFFFFFFF));
 WriteLog("\n%08X --> phrase %08X %08X ", op_pointer+8, (int)(p2>>32), (int)(p2&0xFFFFFFFF));
        uint8 bitdepth = (p1 >> 12) & 0x07;
@@ -410,16 +410,16 @@ WriteLog(" (GPU)\n");
 if ((p0 & 0x07) == OBJECT_TYPE_BRANCH)
 {
 WriteLog(" (BRANCH)\n");
 if ((p0 & 0x07) == OBJECT_TYPE_BRANCH)
 {
 WriteLog(" (BRANCH)\n");
-uint8 * jaguar_mainRam = GetRamPtr();
+uint8 * jaguarMainRam = GetRamPtr();
 WriteLog("[RAM] --> ");
 for(int k=0; k<8; k++)
 WriteLog("[RAM] --> ");
 for(int k=0; k<8; k++)
-       WriteLog("%02X ", jaguar_mainRam[op_pointer-8 + k]);
+       WriteLog("%02X ", jaguarMainRam[op_pointer-8 + k]);
 WriteLog("\n");
 }
 if ((p0 & 0x07) == OBJECT_TYPE_STOP)
 WriteLog("    --> List end\n");
 }//*/
 WriteLog("\n");
 }
 if ((p0 & 0x07) == OBJECT_TYPE_STOP)
 WriteLog("    --> List end\n");
 }//*/
-               
+
                switch ((uint8)p0 & 0x07)
                {
                case OBJECT_TYPE_BITMAP:
                switch ((uint8)p0 & 0x07)
                {
                case OBJECT_TYPE_BITMAP:
@@ -447,7 +447,7 @@ if (!inhibit)       // For OP testing only!
 // *** END OP PROCESSOR TESTING ONLY ***
                        if (scanline >= ypos && height > 0)
                        {
 // *** END OP PROCESSOR TESTING ONLY ***
                        if (scanline >= ypos && height > 0)
                        {
-                               uint64 p1 = op_load_phrase(op_pointer);
+                               uint64 p1 = OPLoadPhrase(op_pointer);
                                op_pointer += 8;
 //WriteLog("OP: Writing scanline %d with ypos == %d...\n", scanline, ypos);
 //WriteLog("--> Writing %u BPP bitmap...\n", op_bitmap_bit_depth[(p1 >> 12) & 0x07]);
                                op_pointer += 8;
 //WriteLog("OP: Writing scanline %d with ypos == %d...\n", scanline, ypos);
 //WriteLog("--> Writing %u BPP bitmap...\n", op_bitmap_bit_depth[(p1 >> 12) & 0x07]);
@@ -500,16 +500,16 @@ if (!inhibit)     // For OP testing only!
 if (inhibit && op_start_log)
 {
        WriteLog("!!! ^^^ This object is INHIBITED! ^^^ !!! (scanline=%u, ypos=%u, height=%u)\n", scanline, ypos, height);
 if (inhibit && op_start_log)
 {
        WriteLog("!!! ^^^ This object is INHIBITED! ^^^ !!! (scanline=%u, ypos=%u, height=%u)\n", scanline, ypos, height);
-       DumpScaledObject(p0, op_load_phrase(op_pointer), op_load_phrase(op_pointer+8));
+       DumpScaledObject(p0, OPLoadPhrase(op_pointer), OPLoadPhrase(op_pointer+8));
 }
 bitmapCounter++;
 if (!inhibit)  // For OP testing only!
 // *** END OP PROCESSOR TESTING ONLY ***
                        if (scanline >= ypos && height > 0)
                        {
 }
 bitmapCounter++;
 if (!inhibit)  // For OP testing only!
 // *** END OP PROCESSOR TESTING ONLY ***
                        if (scanline >= ypos && height > 0)
                        {
-                               uint64 p1 = op_load_phrase(op_pointer);
+                               uint64 p1 = OPLoadPhrase(op_pointer);
                                op_pointer += 8;
                                op_pointer += 8;
-                               uint64 p2 = op_load_phrase(op_pointer);
+                               uint64 p2 = OPLoadPhrase(op_pointer);
                                op_pointer += 8;
 //WriteLog("OP: %08X (%d) %08X%08X %08X%08X %08X%08X\n", oldOPP, scanline, (uint32)(p0>>32), (uint32)(p0&0xFFFFFFFF), (uint32)(p1>>32), (uint32)(p1&0xFFFFFFFF), (uint32)(p2>>32), (uint32)(p2&0xFFFFFFFF));
                                OPProcessScaledBitmap(p0, p1, p2, render);
                                op_pointer += 8;
 //WriteLog("OP: %08X (%d) %08X%08X %08X%08X %08X%08X\n", oldOPP, scanline, (uint32)(p0>>32), (uint32)(p0&0xFFFFFFFF), (uint32)(p1>>32), (uint32)(p1&0xFFFFFFFF), (uint32)(p2>>32), (uint32)(p2&0xFFFFFFFF));
                                OPProcessScaledBitmap(p0, p1, p2, render);
@@ -520,7 +520,7 @@ if (!inhibit)       // For OP testing only!
 //Actually, we should skip this object if it has a vscale of zero.
 //Or do we? Not sure... Atari Karts has a few lines that look like:
 // (SCALED BITMAP)
 //Actually, we should skip this object if it has a vscale of zero.
 //Or do we? Not sure... Atari Karts has a few lines that look like:
 // (SCALED BITMAP)
-//000E8268 --> phrase 00010000 7000B00D 
+//000E8268 --> phrase 00010000 7000B00D
 //    [7 (0) x 1 @ (13, 0) (8 bpp), l: 000E82A0, p: 000E0FC0 fp: 00, fl:RELEASE, idx:00, pt:01]
 //    [hsc: 9A, vsc: 00, rem: 00]
 // Could it be the vscale is overridden if the DWIDTH is zero? Hmm...
 //    [7 (0) x 1 @ (13, 0) (8 bpp), l: 000E82A0, p: 000E0FC0 fp: 00, fl:RELEASE, idx:00, pt:01]
 //    [hsc: 9A, vsc: 00, rem: 00]
 // Could it be the vscale is overridden if the DWIDTH is zero? Hmm...
@@ -617,7 +617,7 @@ OP: Scaled bitmap 4x? 4bpp at 34,? hscale=80 fpix=0 data=000756E8 pitch 1 hflipp
                case OBJECT_TYPE_GPU:
                {
 //WriteLog("OP: Asserting GPU IRQ #3...\n");
                case OBJECT_TYPE_GPU:
                {
 //WriteLog("OP: Asserting GPU IRQ #3...\n");
-                       op_set_current_object(p0);
+                       OPSetCurrentObject(p0);
                        GPUSetIRQLine(3, ASSERT_LINE);
 //Also, OP processing is suspended from this point until OBF (F00026) is written to...
 // !!! FIX !!!
                        GPUSetIRQLine(3, ASSERT_LINE);
 //Also, OP processing is suspended from this point until OBF (F00026) is written to...
 // !!! FIX !!!
@@ -633,7 +633,7 @@ OP: Scaled bitmap 4x? 4bpp at 34,? hscale=80 fpix=0 data=000756E8 pitch 1 hflipp
                        uint16 ypos = (p0 >> 3) & 0x7FF;
                        uint8  cc   = (p0 >> 14) & 0x03;
                        uint32 link = (p0 >> 21) & 0x3FFFF8;
                        uint16 ypos = (p0 >> 3) & 0x7FF;
                        uint8  cc   = (p0 >> 14) & 0x03;
                        uint32 link = (p0 >> 21) & 0x3FFFF8;
-                       
+
 //                     if ((ypos!=507)&&(ypos!=25))
 //                             WriteLog("\t%i%s%i link=0x%.8x\n",scanline,condition_to_str[cc],ypos>>1,link);
                        switch (cc)
 //                     if ((ypos!=507)&&(ypos!=25))
 //                             WriteLog("\t%i%s%i link=0x%.8x\n",scanline,condition_to_str[cc],ypos>>1,link);
                        switch (cc)
@@ -651,13 +651,14 @@ OP: Scaled bitmap 4x? 4bpp at 34,? hscale=80 fpix=0 data=000756E8 pitch 1 hflipp
                                        op_pointer = link;
                                break;
                        case CONDITION_OP_FLAG_SET:
                                        op_pointer = link;
                                break;
                        case CONDITION_OP_FLAG_SET:
-                               if (op_get_status_register() & 0x01)
+                               if (OPGetStatusRegister() & 0x01)
                                        op_pointer = link;
                                break;
                        case CONDITION_SECOND_HALF_LINE:
                                // This basically means branch if bit 10 of HC is set
                                WriteLog("OP: Unexpected CONDITION_SECOND_HALF_LINE in BRANCH object\nOP: shuting down\n");
                                        op_pointer = link;
                                break;
                        case CONDITION_SECOND_HALF_LINE:
                                // This basically means branch if bit 10 of HC is set
                                WriteLog("OP: Unexpected CONDITION_SECOND_HALF_LINE in BRANCH object\nOP: shuting down\n");
-                               fclose(log_get());
+//                             fclose(log_get());
+                               LogDone();
                                exit(0);
                                break;
                        default:
                                exit(0);
                                break;
                        default:
@@ -672,12 +673,12 @@ OP: Scaled bitmap 4x? 4bpp at 34,? hscale=80 fpix=0 data=000756E8 pitch 1 hflipp
 //WriteLog("OP: --> STOP\n");
 //                     op_set_status_register(((p0>>3) & 0xFFFFFFFF));
 //This seems more likely...
 //WriteLog("OP: --> STOP\n");
 //                     op_set_status_register(((p0>>3) & 0xFFFFFFFF));
 //This seems more likely...
-                       op_set_current_object(p0);
-                       
+                       OPSetCurrentObject(p0);
+
                        if (p0 & 0x08)
                        {
                        if (p0 & 0x08)
                        {
-                               tom_set_pending_object_int();
-                               if (tom_irq_enabled(IRQ_OPFLAG))// && jaguar_interrupt_handler_is_valid(64))
+                               TOMSetPendingObjectInt();
+                               if (TOMIRQEnabled(IRQ_OPFLAG))// && jaguar_interrupt_handler_is_valid(64))
                                        m68k_set_irq(7);                                // Cause an NMI to occur...
                        }
 
                                        m68k_set_irq(7);                                // Cause an NMI to occur...
                        }
 
@@ -685,7 +686,7 @@ OP: Scaled bitmap 4x? 4bpp at 34,? hscale=80 fpix=0 data=000756E8 pitch 1 hflipp
 //                     break;
                }
                default:
 //                     break;
                }
                default:
-                       WriteLog("op: unknown object type %i\n", ((uint8)p0 & 0x07)); 
+                       WriteLog("op: unknown object type %i\n", ((uint8)p0 & 0x07));
                        return;
                }
 
                        return;
                }
 
@@ -729,8 +730,8 @@ void OPProcessFixedBitmap(uint64 p0, uint64 p1, bool render)
        pitch <<= 3;                                                                    // Optimization: Multiply pitch by 8
 
 //     int16 scanlineWidth = tom_getVideoModeWidth();
        pitch <<= 3;                                                                    // Optimization: Multiply pitch by 8
 
 //     int16 scanlineWidth = tom_getVideoModeWidth();
-       uint8 * tom_ram_8 = tom_get_ram_pointer();
-       uint8 * paletteRAM = &tom_ram_8[0x400];
+       uint8 * tomRam8 = TOMGetRamPointer();
+       uint8 * paletteRAM = &tomRam8[0x400];
        // This is OK as long as it's used correctly: For 16-bit RAM to RAM direct copies--NOT
        // for use when using endian-corrected data (i.e., any of the *_word_read functions!)
        uint16 * paletteRAM16 = (uint16 *)paletteRAM;
        // This is OK as long as it's used correctly: For 16-bit RAM to RAM direct copies--NOT
        // for use when using endian-corrected data (i.e., any of the *_word_read functions!)
        uint16 * paletteRAM16 = (uint16 *)paletteRAM;
@@ -757,7 +758,7 @@ void OPProcessFixedBitmap(uint64 p0, uint64 p1, bool render)
                (!flagREFLECT ? (phraseWidthToPixels[depth] * iwidth) - 1
                : -((phraseWidthToPixels[depth] * iwidth) + 1));
        uint32 clippedWidth = 0, phraseClippedWidth = 0, dataClippedWidth = 0;//, phrasePixel = 0;
                (!flagREFLECT ? (phraseWidthToPixels[depth] * iwidth) - 1
                : -((phraseWidthToPixels[depth] * iwidth) + 1));
        uint32 clippedWidth = 0, phraseClippedWidth = 0, dataClippedWidth = 0;//, phrasePixel = 0;
-       bool in24BPPMode = (((GET16(tom_ram_8, 0x0028) >> 1) & 0x03) == 1 ? true : false);      // VMODE
+       bool in24BPPMode = (((GET16(tomRam8, 0x0028) >> 1) & 0x03) == 1 ? true : false);        // VMODE
        // Not sure if this is Jaguar Two only location or what...
        // From the docs, it is... If we want to limit here we should think of something else.
 //     int32 limit = GET16(tom_ram_8, 0x0008);                 // LIMIT
        // Not sure if this is Jaguar Two only location or what...
        // From the docs, it is... If we want to limit here we should think of something else.
 //     int32 limit = GET16(tom_ram_8, 0x0008);                 // LIMIT
@@ -855,7 +856,7 @@ if (depth > 5)
 //Why does this work right when multiplying startPos by 2 (instead of 4) for 24 BPP mode?
 //Is this a bug in the OP?
        uint32 lbufAddress = 0x1800 + (!in24BPPMode ? startPos * 2 : startPos * 2);
 //Why does this work right when multiplying startPos by 2 (instead of 4) for 24 BPP mode?
 //Is this a bug in the OP?
        uint32 lbufAddress = 0x1800 + (!in24BPPMode ? startPos * 2 : startPos * 2);
-       uint8 * currentLineBuffer = &tom_ram_8[lbufAddress];
+       uint8 * currentLineBuffer = &tomRam8[lbufAddress];
 
        // Render.
 
 
        // Render.
 
@@ -893,9 +894,9 @@ if (depth > 5)
                                                // (i.e., mem-to-mem direct copying)!
                                                *(uint16 *)currentLineBuffer = paletteRAM16[index | bit];
                                        else
                                                // (i.e., mem-to-mem direct copying)!
                                                *(uint16 *)currentLineBuffer = paletteRAM16[index | bit];
                                        else
-                                               *currentLineBuffer = 
+                                               *currentLineBuffer =
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[(index | bit) << 1]),
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[(index | bit) << 1]),
-                                               *(currentLineBuffer + 1) = 
+                                               *(currentLineBuffer + 1) =
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bit) << 1) + 1]);
                                }
 
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bit) << 1) + 1]);
                                }
 
@@ -937,9 +938,9 @@ if (firstPix)
                                        if (!flagRMW)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                        else
                                        if (!flagRMW)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                        else
-                                               *currentLineBuffer = 
+                                               *currentLineBuffer =
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
-                                               *(currentLineBuffer + 1) = 
+                                               *(currentLineBuffer + 1) =
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                                }
 
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                                }
 
@@ -977,9 +978,9 @@ if (firstPix)
                                        if (!flagRMW)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                        else
                                        if (!flagRMW)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                        else
-                                               *currentLineBuffer = 
+                                               *currentLineBuffer =
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
-                                               *(currentLineBuffer + 1) = 
+                                               *(currentLineBuffer + 1) =
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                                }
 
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                                }
 
@@ -1018,9 +1019,9 @@ if (firstPix)
                                        if (!flagRMW)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[bits];
                                        else
                                        if (!flagRMW)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[bits];
                                        else
-                                               *currentLineBuffer = 
+                                               *currentLineBuffer =
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[bits << 1]),
                                                        BLEND_CR(*currentLineBuffer, paletteRAM[bits << 1]),
-                                               *(currentLineBuffer + 1) = 
+                                               *(currentLineBuffer + 1) =
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[(bits << 1) + 1]);
                                }
 
                                                        BLEND_Y(*(currentLineBuffer + 1), paletteRAM[(bits << 1) + 1]);
                                }
 
@@ -1062,9 +1063,9 @@ if (firstPix)
                                                *currentLineBuffer = bitsHi,
                                                *(currentLineBuffer + 1) = bitsLo;
                                        else
                                                *currentLineBuffer = bitsHi,
                                                *(currentLineBuffer + 1) = bitsLo;
                                        else
-                                               *currentLineBuffer = 
+                                               *currentLineBuffer =
                                                        BLEND_CR(*currentLineBuffer, bitsHi),
                                                        BLEND_CR(*currentLineBuffer, bitsHi),
-                                               *(currentLineBuffer + 1) = 
+                                               *(currentLineBuffer + 1) =
                                                        BLEND_Y(*(currentLineBuffer + 1), bitsLo);
                                }
 
                                                        BLEND_Y(*(currentLineBuffer + 1), bitsLo);
                                }
 
@@ -1140,8 +1141,8 @@ if (firstPix)
        uint8 index = (p1 >> 37) & 0xFE;                                // CLUT index offset (upper pix, 1-4 bpp)
        uint32 pitch = (p1 >> 15) & 0x07;                               // Phrase pitch
 
        uint8 index = (p1 >> 37) & 0xFE;                                // CLUT index offset (upper pix, 1-4 bpp)
        uint32 pitch = (p1 >> 15) & 0x07;                               // Phrase pitch
 
-       uint8 * tom_ram_8 = tom_get_ram_pointer();
-       uint8 * paletteRAM = &tom_ram_8[0x400];
+       uint8 * tomRam8 = TOMGetRamPointer();
+       uint8 * paletteRAM = &tomRam8[0x400];
        // This is OK as long as it's used correctly: For 16-bit RAM to RAM direct copies--NOT
        // for use when using endian-corrected data (i.e., any of the *ReadWord functions!)
        uint16 * paletteRAM16 = (uint16 *)paletteRAM;
        // This is OK as long as it's used correctly: For 16-bit RAM to RAM direct copies--NOT
        // for use when using endian-corrected data (i.e., any of the *ReadWord functions!)
        uint16 * paletteRAM16 = (uint16 *)paletteRAM;
@@ -1174,7 +1175,7 @@ if (start_logging)
        int32 startPos = xpos, endPos = xpos +
                (!flagREFLECT ? scaledWidthInPixels - 1 : -(scaledWidthInPixels + 1));
        uint32 clippedWidth = 0, phraseClippedWidth = 0, dataClippedWidth = 0;
        int32 startPos = xpos, endPos = xpos +
                (!flagREFLECT ? scaledWidthInPixels - 1 : -(scaledWidthInPixels + 1));
        uint32 clippedWidth = 0, phraseClippedWidth = 0, dataClippedWidth = 0;
-       bool in24BPPMode = (((GET16(tom_ram_8, 0x0028) >> 1) & 0x03) == 1 ? true : false);      // VMODE
+       bool in24BPPMode = (((GET16(tomRam8, 0x0028) >> 1) & 0x03) == 1 ? true : false);        // VMODE
        // Not sure if this is Jaguar Two only location or what...
        // From the docs, it is... If we want to limit here we should think of something else.
 //     int32 limit = GET16(tom_ram_8, 0x0008);                 // LIMIT
        // Not sure if this is Jaguar Two only location or what...
        // From the docs, it is... If we want to limit here we should think of something else.
 //     int32 limit = GET16(tom_ram_8, 0x0008);                 // LIMIT
@@ -1320,7 +1321,7 @@ if (op_start_log && startPos == 13)
 //     uint32 lbufAddress = 0x1800 + (!in24BPPMode ? leftMargin * 2 : leftMargin * 4);
 //     uint32 lbufAddress = 0x1800 + (!in24BPPMode ? startPos * 2 : startPos * 4);
        uint32 lbufAddress = 0x1800 + startPos * 2;
 //     uint32 lbufAddress = 0x1800 + (!in24BPPMode ? leftMargin * 2 : leftMargin * 4);
 //     uint32 lbufAddress = 0x1800 + (!in24BPPMode ? startPos * 2 : startPos * 4);
        uint32 lbufAddress = 0x1800 + startPos * 2;
-       uint8 * currentLineBuffer = &tom_ram_8[lbufAddress];
+       uint8 * currentLineBuffer = &tomRam8[lbufAddress];
 //uint8 * lineBufferLowerLimit = &tom_ram_8[0x1800],
 //     * lineBufferUpperLimit = &tom_ram_8[0x1800 + 719];
 
 //uint8 * lineBufferLowerLimit = &tom_ram_8[0x1800],
 //     * lineBufferUpperLimit = &tom_ram_8[0x1800 + 719];
 
@@ -1355,9 +1356,9 @@ if (firstPix != 0)
                                        // (i.e., mem-to-mem direct copying)!
                                        *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                else
                                        // (i.e., mem-to-mem direct copying)!
                                        *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                else
-                                       *currentLineBuffer = 
+                                       *currentLineBuffer =
                                                BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
                                                BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
-                                       *(currentLineBuffer + 1) = 
+                                       *(currentLineBuffer + 1) =
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                        }
 
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                        }
 
@@ -1414,9 +1415,9 @@ if (firstPix != 0)
                                        // (i.e., mem-to-mem direct copying)!
                                        *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                else
                                        // (i.e., mem-to-mem direct copying)!
                                        *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                else
-                                       *currentLineBuffer = 
+                                       *currentLineBuffer =
                                                BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
                                                BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
-                                       *(currentLineBuffer + 1) = 
+                                       *(currentLineBuffer + 1) =
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                        }
 
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                        }
 
@@ -1473,9 +1474,9 @@ if (firstPix != 0)
                                        // (i.e., mem-to-mem direct copying)!
                                        *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                else
                                        // (i.e., mem-to-mem direct copying)!
                                        *(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
                                else
-                                       *currentLineBuffer = 
+                                       *currentLineBuffer =
                                                BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
                                                BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
-                                       *(currentLineBuffer + 1) = 
+                                       *(currentLineBuffer + 1) =
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                        }
 
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
                        }
 
@@ -1535,9 +1536,9 @@ if (firstPix)
                                                *(uint16 *)currentLineBuffer = paletteRAM16[bits];
                                }*/
                                else
                                                *(uint16 *)currentLineBuffer = paletteRAM16[bits];
                                }*/
                                else
-                                       *currentLineBuffer = 
+                                       *currentLineBuffer =
                                                BLEND_CR(*currentLineBuffer, paletteRAM[bits << 1]),
                                                BLEND_CR(*currentLineBuffer, paletteRAM[bits << 1]),
-                                       *(currentLineBuffer + 1) = 
+                                       *(currentLineBuffer + 1) =
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[(bits << 1) + 1]);
                        }
 
                                                BLEND_Y(*(currentLineBuffer + 1), paletteRAM[(bits << 1) + 1]);
                        }
 
@@ -1585,9 +1586,9 @@ if (firstPix != 0)
                                        *currentLineBuffer = bitsHi,
                                        *(currentLineBuffer + 1) = bitsLo;
                                else
                                        *currentLineBuffer = bitsHi,
                                        *(currentLineBuffer + 1) = bitsLo;
                                else
-                                       *currentLineBuffer = 
+                                       *currentLineBuffer =
                                                BLEND_CR(*currentLineBuffer, bitsHi),
                                                BLEND_CR(*currentLineBuffer, bitsHi),
-                                       *(currentLineBuffer + 1) = 
+                                       *(currentLineBuffer + 1) =
                                                BLEND_Y(*(currentLineBuffer + 1), bitsLo);
                        }
 
                                                BLEND_Y(*(currentLineBuffer + 1), bitsLo);
                        }
 
index 82327d5d6c7173e8c5b2973cf2d7ba48ec3507b1..130eb0fb6928ef764b25a5e00bb1ec3d45339d67 100644 (file)
@@ -7,15 +7,15 @@
 
 #include "types.h"
 
 
 #include "types.h"
 
-void op_init(void);
-void op_reset(void);
-void op_done(void);
+void OPInit(void);
+void OPReset(void);
+void OPDone(void);
 
 void OPProcessList(int scanline, bool render);
 
 void OPProcessList(int scanline, bool render);
-uint32 op_get_list_pointer(void);
-void op_set_status_register(uint32 data);
-uint32 op_get_status_register(void);
-void op_set_current_object(uint64 object);
+uint32 OPGetListPointer(void);
+void OPSetStatusRegister(uint32 data);
+uint32 OPGetStatusRegister(void);
+void OPSetCurrentObject(uint64 object);
 
 //uint8 OPReadByte(uint32, uint32 who = UNKNOWN);
 //uint16 OPReadWord(uint32, uint32 who = UNKNOWN);
 
 //uint8 OPReadByte(uint32, uint32 who = UNKNOWN);
 //uint16 OPReadWord(uint32, uint32 who = UNKNOWN);
index 348982297f1c2f2c787919d584f0033ca114db8a..7b4e01e61bb419bf3876a367602738e35b557045 100644 (file)
@@ -41,6 +41,8 @@
 
 #include "sdlemu_opengl.h"
 
 
 #include "sdlemu_opengl.h"
 
+#include "log.h"
+
 // We want alpha on our OpenGL contexts...!
 // Or do we? Seems to kill performance on X...
 // Or does it? Could it be bad blitter performance?
 // We want alpha on our OpenGL contexts...!
 // Or do we? Seems to kill performance on X...
 // Or does it? Could it be bad blitter performance?
@@ -71,20 +73,20 @@ static inline int power_of_two(int input)
 
 void sdlemu_init_opengl(SDL_Surface * src, SDL_Surface * dst, int texturetype, int filter, int src_bpp)
 {
 
 void sdlemu_init_opengl(SDL_Surface * src, SDL_Surface * dst, int texturetype, int filter, int src_bpp)
 {
-       printf("\nOpenGL driver information :\n");
-       printf("\n");
-       printf("Vendor:             %s\n", glGetString(GL_VENDOR));
-       printf("Renderer:           %s\n", glGetString(GL_RENDERER));
-       printf("Version:            %s\n", glGetString(GL_VERSION));
-       printf("OpenGL drawmethod: ");
+       WriteLog("\nOpenGL driver information :\n");
+       WriteLog("\n");
+       WriteLog("Vendor:             %s\n", glGetString(GL_VENDOR));
+       WriteLog("Renderer:           %s\n", glGetString(GL_RENDERER));
+       WriteLog("Version:            %s\n", glGetString(GL_VERSION));
+       WriteLog("OpenGL drawmethod: ");
 
        switch (texturetype)
        {
        case 1:
 
        switch (texturetype)
        {
        case 1:
-               printf("GL_QUAD rendering\n\n");
+               WriteLog("GL_QUAD rendering\n\n");
                break;
        default:
                break;
        default:
-               printf("GL_TRIANGLE rendering\n\n");
+               WriteLog("GL_TRIANGLE rendering\n\n");
                break;
        }
 
                break;
        }
 
@@ -207,7 +209,6 @@ glDrawPixels(5, 5, GL_RGBA, GL_UNSIGNED_INT, map);//*/
 //  glFlush();
        SDL_GL_SwapBuffers();
 //     glFinish();
 //  glFlush();
        SDL_GL_SwapBuffers();
 //     glFinish();
-
 }
 
 void sdlemu_close_opengl(void)
 }
 
 void sdlemu_close_opengl(void)
@@ -219,33 +220,35 @@ void sdlemu_close_opengl(void)
                SDL_FreeSurface(overlay);
 }
 
                SDL_FreeSurface(overlay);
 }
 
-void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp)
+void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int src_bpp)
 {
     // Local variables.
 {
     // Local variables.
+       int w , h;                         // w and h contain the width and height of the OpenGL texture.
        Uint32 rmask, gmask, bmask, amask; // Needed for creating RGBA masks.
        Uint32 rmask, gmask, bmask, amask; // Needed for creating RGBA masks.
+       int bpp;
 
        // Delete old texture (if allocated). Useful when there is a screen resize.
 
        // Delete old texture (if allocated). Useful when there is a screen resize.
-       if (overlay)
-               SDL_FreeSurface(overlay);
+       if (texture)
+               SDL_FreeSurface(texture);
 
        // Texture width/height should be power of 2 of the SDL_Surface *src when using OpenGL.
        // So, find the largest power of two that will contain both the width and height
 
        // Texture width/height should be power of 2 of the SDL_Surface *src when using OpenGL.
        // So, find the largest power of two that will contain both the width and height
-       int w = power_of_two(dst->w);
-       int h = power_of_two(dst->h);
+       w = power_of_two(src->w);
+       h = power_of_two(src->h);
 
 
-       printf("OpenGL - Overlay size : %d x %d\n", w, h);
+       WriteLog("OpenGL - Texture size : %d x %d\n", w, h);
 
        // Setting bpp based upon src_bpp.
 
        // Setting bpp based upon src_bpp.
-       int bpp = src_bpp;
+       bpp = src_bpp;
 
        // We allow the developer to set its own texture bpp. But if the value is NULL or
        // not equal to 16, 24 or 32, we make the texturebpp the same as the BPP from src.
        if (bpp == 16 || bpp == 24 || bpp == 32)
                texturebpp = bpp;
        else
 
        // We allow the developer to set its own texture bpp. But if the value is NULL or
        // not equal to 16, 24 or 32, we make the texturebpp the same as the BPP from src.
        if (bpp == 16 || bpp == 24 || bpp == 32)
                texturebpp = bpp;
        else
-               texturebpp = dst->format->BitsPerPixel;
+               texturebpp = src->format->BitsPerPixel;
 
 
-       printf("OpenGL - Overlay depth : %d bpp\n", texturebpp);
+       WriteLog("OpenGL - Texture depth : %d bpp\n", texturebpp);
 
        // Now were are going to create a SDL_Surface named texture. This will be our surface
        // which will function as a buffer between the SDL_Surface *src and SDL_Surface *dst.
 
        // Now were are going to create a SDL_Surface named texture. This will be our surface
        // which will function as a buffer between the SDL_Surface *src and SDL_Surface *dst.
@@ -306,20 +309,65 @@ void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp)
        }
 
        // Creating SDL_Surface texture based upon the above settings.
        }
 
        // Creating SDL_Surface texture based upon the above settings.
-       overlay = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
+       texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
+
+       if (texture == NULL)
+       {
+               WriteLog("sdlemu_opengl: Could not create texture surface! (SDL: %s)\n", SDL_GetError());
+       }
+
+       // Setting up OpenGL
+       glDisable(GL_FOG);
+       glDisable(GL_LIGHTING);
+       glDisable(GL_CULL_FACE);
+       glDisable(GL_DEPTH_TEST);
+//     glDisable(GL_BLEND);
+       glEnable(GL_BLEND);
+       glDisable(GL_NORMALIZE);
+       glDisable(GL_ALPHA_TEST);
+       glEnable(GL_TEXTURE_2D);
+//     glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+//     glBlendFunc(GL_ONE, GL_SRC_ALPHA);
+//This works, but in a wrong way...
+//     glBlendFunc(GL_ONE, GL_ONE);
+
+       // Definitely needed for screen resolution larger then the *src.
+       // This way we can have automatic scaling functionality.
+       glViewport(0, 0, dst->w, dst->h);
+       glMatrixMode(GL_PROJECTION);
+       glPushMatrix();
+       glLoadIdentity();
+       glOrtho(0.0, (GLdouble)dst->w, (GLdouble)dst->h, 0.0, 0.0, 1.0);
+       glMatrixMode(GL_MODELVIEW);
+       glPushMatrix();
+       glLoadIdentity();
 
        // Setting up the texture coordinates.
 
        // Setting up the texture coordinates.
-       overlayCoord[0] = 0.0f;
-       overlayCoord[1] = 0.0f;
-       overlayCoord[2] = (GLfloat)(dst->w) / overlay->w;
-       overlayCoord[3] = (GLfloat)(dst->h) / overlay->h;
+       texcoord[0] = 0.0f;
+       texcoord[1] = 0.0f;
+       texcoord[2] = (GLfloat)(src->w) / texture->w;
+       texcoord[3] = (GLfloat)(src->h) / texture->h;
 
        // create a RGB(A) texture for the texture surface
 
        // create a RGB(A) texture for the texture surface
-       glGenTextures(1, &overlayID);
-       glBindTexture(GL_TEXTURE_2D, overlayID);
+       glGenTextures(1, &texid);
+       glBindTexture(GL_TEXTURE_2D, texid);
 
 
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+       // Setting up the OpenGL Filters. These filters are important when we/you
+       // want to scale the texture.
+       if (filter)
+       {
+               // Textures are rendered in best quality.
+               WriteLog("OpenGL filters: enabled\n");
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+       }
+       else
+       {
+               // Textures are rendered in normal quality.
+               WriteLog("OpenGL filters: disabled\n");
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+       }
 
        // Setting texture mode.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 
        // Setting texture mode.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -330,7 +378,7 @@ void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp)
        {
        case 16:
                // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels.
        {
        case 16:
                // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels.
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, overlay->w, overlay->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
                break;
        case 24:
                // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels.
                break;
        case 24:
                // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels.
@@ -338,65 +386,43 @@ void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp)
                // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp.
                //             If you use Alpha. Use textures with a depth of 32bpp.
                //             24bpp textures are SLOW and avoid them at all costs!
                // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp.
                //             If you use Alpha. Use textures with a depth of 32bpp.
                //             24bpp textures are SLOW and avoid them at all costs!
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, overlay->w, overlay->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
                break;
        case 32:
        default:
                // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels.
                break;
        case 32:
        default:
                // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels.
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, overlay->w, overlay->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
                break;
        }
 }
 
                break;
        }
 }
 
-void * sdlemuGetOverlayPixels(void)
-{
-       return overlay->pixels;
-}
-
-Uint32 sdlemuGetOverlayWidthInPixels(void)
-{
-       return overlay->pitch / 4;
-}
-
-void sdlemuEnableOverlay(void)
-{
-       showOverlay = 1;
-}
-
-void sdlemuDisableOverlay(void)
-{
-       showOverlay = 0;
-}
-
-void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int src_bpp)
+void sdlemu_create_overlay(SDL_Surface * dst, int src_bpp)
 {
     // Local variables.
 {
     // Local variables.
-       int w , h;                         // w and h contain the width and height of the OpenGL texture.
        Uint32 rmask, gmask, bmask, amask; // Needed for creating RGBA masks.
        Uint32 rmask, gmask, bmask, amask; // Needed for creating RGBA masks.
-       int bpp;
 
        // Delete old texture (if allocated). Useful when there is a screen resize.
 
        // Delete old texture (if allocated). Useful when there is a screen resize.
-       if (texture)
-               SDL_FreeSurface(texture);
+       if (overlay)
+               SDL_FreeSurface(overlay);
 
        // Texture width/height should be power of 2 of the SDL_Surface *src when using OpenGL.
        // So, find the largest power of two that will contain both the width and height
 
        // Texture width/height should be power of 2 of the SDL_Surface *src when using OpenGL.
        // So, find the largest power of two that will contain both the width and height
-       w = power_of_two(src->w);
-       h = power_of_two(src->h);
+       int w = power_of_two(dst->w);
+       int h = power_of_two(dst->h);
 
 
-       printf("OpenGL - Texture size : %d x %d\n", w, h);
+       WriteLog("OpenGL - Overlay size : %d x %d\n", w, h);
 
        // Setting bpp based upon src_bpp.
 
        // Setting bpp based upon src_bpp.
-       bpp = src_bpp;
+       int bpp = src_bpp;
 
        // We allow the developer to set its own texture bpp. But if the value is NULL or
        // not equal to 16, 24 or 32, we make the texturebpp the same as the BPP from src.
        if (bpp == 16 || bpp == 24 || bpp == 32)
                texturebpp = bpp;
        else
 
        // We allow the developer to set its own texture bpp. But if the value is NULL or
        // not equal to 16, 24 or 32, we make the texturebpp the same as the BPP from src.
        if (bpp == 16 || bpp == 24 || bpp == 32)
                texturebpp = bpp;
        else
-               texturebpp = src->format->BitsPerPixel;
+               texturebpp = dst->format->BitsPerPixel;
 
 
-       printf("OpenGL - Texture depth : %d bpp\n", texturebpp);
+       WriteLog("OpenGL - Overlay depth : %d bpp\n", texturebpp);
 
        // Now were are going to create a SDL_Surface named texture. This will be our surface
        // which will function as a buffer between the SDL_Surface *src and SDL_Surface *dst.
 
        // Now were are going to create a SDL_Surface named texture. This will be our surface
        // which will function as a buffer between the SDL_Surface *src and SDL_Surface *dst.
@@ -457,60 +483,25 @@ void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int
        }
 
        // Creating SDL_Surface texture based upon the above settings.
        }
 
        // Creating SDL_Surface texture based upon the above settings.
-       texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
-
-       // Setting up OpenGL
-       glDisable(GL_FOG);
-       glDisable(GL_LIGHTING);
-       glDisable(GL_CULL_FACE);
-       glDisable(GL_DEPTH_TEST);
-//     glDisable(GL_BLEND);
-       glEnable(GL_BLEND);
-       glDisable(GL_NORMALIZE);
-       glDisable(GL_ALPHA_TEST);
-       glEnable(GL_TEXTURE_2D);
-//     glBlendFunc(GL_SRC_ALPHA, GL_ONE);
-//     glBlendFunc(GL_ONE, GL_SRC_ALPHA);
-//This works, but in a wrong way...
-//     glBlendFunc(GL_ONE, GL_ONE);
+       overlay = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
 
 
-       // Definitely needed for screen resolution larger then the *src.
-       // This way we can have automatic scaling functionality.
-       glViewport(0, 0, dst->w, dst->h);
-       glMatrixMode(GL_PROJECTION);
-       glPushMatrix();
-       glLoadIdentity();
-       glOrtho(0.0, (GLdouble)dst->w, (GLdouble)dst->h, 0.0, 0.0, 1.0);
-       glMatrixMode(GL_MODELVIEW);
-       glPushMatrix();
-       glLoadIdentity();
+       if (overlay == NULL)
+       {
+               WriteLog("sdlemu_opengl: Could not create overlay surface! (SDL: %s)\n", SDL_GetError());
+       }
 
        // Setting up the texture coordinates.
 
        // Setting up the texture coordinates.
-       texcoord[0] = 0.0f;
-       texcoord[1] = 0.0f;
-       texcoord[2] = (GLfloat)(src->w) / texture->w;
-       texcoord[3] = (GLfloat)(src->h) / texture->h;
+       overlayCoord[0] = 0.0f;
+       overlayCoord[1] = 0.0f;
+       overlayCoord[2] = (GLfloat)(dst->w) / overlay->w;
+       overlayCoord[3] = (GLfloat)(dst->h) / overlay->h;
 
        // create a RGB(A) texture for the texture surface
 
        // create a RGB(A) texture for the texture surface
-       glGenTextures(1, &texid);
-       glBindTexture(GL_TEXTURE_2D, texid);
+       glGenTextures(1, &overlayID);
+       glBindTexture(GL_TEXTURE_2D, overlayID);
 
 
-       // Setting up the OpenGL Filters. These filters are important when we/you
-       // want to scale the texture.
-       if (filter)
-       {
-               // Textures are rendered in best quality.
-               printf("OpenGL filters: enabled\n");
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-       }
-       else
-       {
-               // Textures are rendered in normal quality.
-               printf("OpenGL filters: disabled\n");
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-       }
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 
        // Setting texture mode.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 
        // Setting texture mode.
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -521,7 +512,7 @@ void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int
        {
        case 16:
                // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels.
        {
        case 16:
                // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels.
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, overlay->w, overlay->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
                break;
        case 24:
                // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels.
                break;
        case 24:
                // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels.
@@ -529,12 +520,32 @@ void sdlemu_create_texture(SDL_Surface * src, SDL_Surface * dst, int filter, int
                // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp.
                //             If you use Alpha. Use textures with a depth of 32bpp.
                //             24bpp textures are SLOW and avoid them at all costs!
                // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp.
                //             If you use Alpha. Use textures with a depth of 32bpp.
                //             24bpp textures are SLOW and avoid them at all costs!
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, overlay->w, overlay->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
                break;
        case 32:
        default:
                // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels.
                break;
        case 32:
        default:
                // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels.
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, overlay->w, overlay->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
                break;
        }
 }
                break;
        }
 }
+
+void * sdlemuGetOverlayPixels(void)
+{
+       return overlay->pixels;
+}
+
+Uint32 sdlemuGetOverlayWidthInPixels(void)
+{
+       return overlay->pitch / 4;
+}
+
+void sdlemuEnableOverlay(void)
+{
+       showOverlay = 1;
+}
+
+void sdlemuDisableOverlay(void)
+{
+       showOverlay = 0;
+}
index 44617b3daca40497901b2ba7fe70855e44ce748f..03523bfafbb28bab75849f5d03fd2002b16c5a69 100644 (file)
 
 #include <string.h>                                                            // For memset()
 #include <stdlib.h>                                                            // For rand()
 
 #include <string.h>                                                            // For memset()
 #include <stdlib.h>                                                            // For rand()
-#include "video.h"
-#include "gpu.h"
-#include "objectp.h"
+#include "blitter.h"
 #include "cry2rgb.h"
 #include "cry2rgb.h"
-#include "settings.h"
-#include "clock.h"
+#include "event.h"
+#include "gpu.h"
 #include "jaguar.h"
 #include "log.h"
 #include "jaguar.h"
 #include "log.h"
-#include "blitter.h"
 #include "m68k.h"
 #include "m68k.h"
+#include "objectp.h"
+#include "settings.h"
+#include "video.h"
 
 #define NEW_TIMER_SYSTEM
 
 
 #define NEW_TIMER_SYSTEM
 
 
 extern uint8 objectp_running;
 
 
 extern uint8 objectp_running;
 
-uint8 tom_ram_8[0x4000];
-uint32 tom_width, tom_height;
+uint8 tomRam8[0x4000];
+uint32 tomWidth, tomHeight;
 static uint32 tom_timer_prescaler;
 static uint32 tom_timer_divider;
 static int32 tom_timer_counter;
 static uint32 tom_timer_prescaler;
 static uint32 tom_timer_divider;
 static int32 tom_timer_counter;
@@ -564,11 +564,11 @@ void TOMFillLookupTables(void)
                uint32 chrm = (i & 0xF000) >> 12,
                        chrl = (i & 0x0F00) >> 8,
                        y = (i & 0x00FF);
                uint32 chrm = (i & 0xF000) >> 12,
                        chrl = (i & 0x0F00) >> 8,
                        y = (i & 0x00FF);
-                               
+
                uint32 r = (((uint32)redcv[chrm][chrl]) * y) >> 8,
                        g = (((uint32)greencv[chrm][chrl]) * y) >> 8,
                        b = (((uint32)bluecv[chrm][chrl]) * y) >> 8;
                uint32 r = (((uint32)redcv[chrm][chrl]) * y) >> 8,
                        g = (((uint32)greencv[chrm][chrl]) * y) >> 8,
                        b = (((uint32)bluecv[chrm][chrl]) * y) >> 8;
-               
+
                CRY16ToRGB32[i] = 0xFF000000 | (b << 16) | (g << 8) | r;
                MIX16ToRGB32[i] = CRY16ToRGB32[i];
        }
                CRY16ToRGB32[i] = 0xFF000000 | (b << 16) | (g << 8) | r;
                MIX16ToRGB32[i] = CRY16ToRGB32[i];
        }
@@ -578,48 +578,48 @@ void TOMFillLookupTables(void)
                        MIX16ToRGB32[i] = RGB16ToRGB32[i];
 }
 
                        MIX16ToRGB32[i] = RGB16ToRGB32[i];
 }
 
-void tom_set_pending_jerry_int(void)
+void TOMSetPendingJERRYInt(void)
 {
        tom_jerry_int_pending = 1;
 }
 
 {
        tom_jerry_int_pending = 1;
 }
 
-void tom_set_pending_timer_int(void)
+void TOMSetPendingTimerInt(void)
 {
        tom_timer_int_pending = 1;
 }
 
 {
        tom_timer_int_pending = 1;
 }
 
-void tom_set_pending_object_int(void)
+void TOMSetPendingObjectInt(void)
 {
        tom_object_int_pending = 1;
 }
 
 {
        tom_object_int_pending = 1;
 }
 
-void tom_set_pending_gpu_int(void)
+void TOMSetPendingGPUInt(void)
 {
        tom_gpu_int_pending = 1;
 }
 
 {
        tom_gpu_int_pending = 1;
 }
 
-void tom_set_pending_video_int(void)
+void TOMSetPendingVideoInt(void)
 {
        tom_video_int_pending = 1;
 }
 
 {
        tom_video_int_pending = 1;
 }
 
-uint8 * tom_get_ram_pointer(void)
+uint8 * TOMGetRamPointer(void)
 {
 {
-       return tom_ram_8;
+       return tomRam8;
 }
 
 }
 
-uint8 tom_getVideoMode(void)
+uint8 TOMGetVideoMode(void)
 {
 {
-       uint16 vmode = GET16(tom_ram_8, VMODE);
+       uint16 vmode = GET16(tomRam8, VMODE);
        return ((vmode & VARMOD) >> 6) | ((vmode & MODE) >> 1);
 }
 
 //Used in only one place (and for debug purposes): OBJECTP.CPP
        return ((vmode & VARMOD) >> 6) | ((vmode & MODE) >> 1);
 }
 
 //Used in only one place (and for debug purposes): OBJECTP.CPP
-uint16 tom_get_vdb(void)
+uint16 TOMGetVDB(void)
 {
 // This in NOT VDB!!!
 {
 // This in NOT VDB!!!
-//     return GET16(tom_ram_8, VBE);
-       return GET16(tom_ram_8, VDB);
+//     return GET16(tomRam8, VBE);
+       return GET16(tomRam8, VDB);
 }
 
 //
 }
 
 //
@@ -628,14 +628,14 @@ uint16 tom_get_vdb(void)
 void tom_render_16bpp_cry_rgb_mix_scanline(uint32 * backbuffer)
 {
 //CHANGED TO 32BPP RENDERING
 void tom_render_16bpp_cry_rgb_mix_scanline(uint32 * backbuffer)
 {
 //CHANGED TO 32BPP RENDERING
-       uint16 width = tom_width;
-       uint8 * current_line_buffer = (uint8 *)&tom_ram_8[0x1800];
-       
+       uint16 width = tomWidth;
+       uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
+
        //New stuff--restrict our drawing...
        //New stuff--restrict our drawing...
-       uint8 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
+       uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
        //NOTE: May have to check HDB2 as well!
        // Get start position in HC ticks
        //NOTE: May have to check HDB2 as well!
        // Get start position in HC ticks
-       int16 startPos = GET16(tom_ram_8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL);
+       int16 startPos = GET16(tomRam8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL);
        startPos /= pwidth;
        if (startPos < 0)
                current_line_buffer += 2 * -startPos;
        startPos /= pwidth;
        if (startPos < 0)
                current_line_buffer += 2 * -startPos;
@@ -661,13 +661,13 @@ void tom_render_16bpp_cry_rgb_mix_scanline(uint32 * backbuffer)
 void tom_render_16bpp_cry_scanline(uint32 * backbuffer)
 {
 //CHANGED TO 32BPP RENDERING
 void tom_render_16bpp_cry_scanline(uint32 * backbuffer)
 {
 //CHANGED TO 32BPP RENDERING
-       uint16 width = tom_width;
-       uint8 * current_line_buffer = (uint8 *)&tom_ram_8[0x1800];
+       uint16 width = tomWidth;
+       uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
 
        //New stuff--restrict our drawing...
 
        //New stuff--restrict our drawing...
-       uint8 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
+       uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
        //NOTE: May have to check HDB2 as well!
        //NOTE: May have to check HDB2 as well!
-       int16 startPos = GET16(tom_ram_8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL);// Get start position in HC ticks
+       int16 startPos = GET16(tomRam8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL);// Get start position in HC ticks
        startPos /= pwidth;
        if (startPos < 0)
                current_line_buffer += 2 * -startPos;
        startPos /= pwidth;
        if (startPos < 0)
                current_line_buffer += 2 * -startPos;
@@ -690,13 +690,13 @@ void tom_render_16bpp_cry_scanline(uint32 * backbuffer)
 void tom_render_24bpp_scanline(uint32 * backbuffer)
 {
 //CHANGED TO 32BPP RENDERING
 void tom_render_24bpp_scanline(uint32 * backbuffer)
 {
 //CHANGED TO 32BPP RENDERING
-       uint16 width = tom_width;
-       uint8 * current_line_buffer = (uint8 *)&tom_ram_8[0x1800];
-       
+       uint16 width = tomWidth;
+       uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
+
        //New stuff--restrict our drawing...
        //New stuff--restrict our drawing...
-       uint8 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
+       uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
        //NOTE: May have to check HDB2 as well!
        //NOTE: May have to check HDB2 as well!
-       int16 startPos = GET16(tom_ram_8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL);       // Get start position in HC ticks
+       int16 startPos = GET16(tomRam8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL); // Get start position in HC ticks
        startPos /= pwidth;
        if (startPos < 0)
                current_line_buffer += 4 * -startPos;
        startPos /= pwidth;
        if (startPos < 0)
                current_line_buffer += 4 * -startPos;
@@ -722,9 +722,9 @@ void tom_render_24bpp_scanline(uint32 * backbuffer)
 //
 void tom_render_16bpp_direct_scanline(uint32 * backbuffer)
 {
 //
 void tom_render_16bpp_direct_scanline(uint32 * backbuffer)
 {
-       uint16 width = tom_width;
-       uint8 * current_line_buffer = (uint8 *)&tom_ram_8[0x1800];
-       
+       uint16 width = tomWidth;
+       uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
+
        while (width)
        {
                uint16 color = (*current_line_buffer++) << 8;
        while (width)
        {
                uint16 color = (*current_line_buffer++) << 8;
@@ -742,13 +742,13 @@ void tom_render_16bpp_rgb_scanline(uint32 * backbuffer)
 //CHANGED TO 32BPP RENDERING
        // 16 BPP RGB: 0-5 green, 6-10 blue, 11-15 red
 
 //CHANGED TO 32BPP RENDERING
        // 16 BPP RGB: 0-5 green, 6-10 blue, 11-15 red
 
-       uint16 width = tom_width;
-       uint8 * current_line_buffer = (uint8 *)&tom_ram_8[0x1800];
-       
+       uint16 width = tomWidth;
+       uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
+
        //New stuff--restrict our drawing...
        //New stuff--restrict our drawing...
-       uint8 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
+       uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
        //NOTE: May have to check HDB2 as well!
        //NOTE: May have to check HDB2 as well!
-       int16 startPos = GET16(tom_ram_8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL);       // Get start position in HC ticks
+       int16 startPos = GET16(tomRam8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL); // Get start position in HC ticks
        startPos /= pwidth;
 
        if (startPos < 0)
        startPos /= pwidth;
 
        if (startPos < 0)
@@ -773,9 +773,9 @@ void tom_render_16bpp_rgb_scanline(uint32 * backbuffer)
 
 void tom_render_16bpp_cry_rgb_mix_stretch_scanline(uint32 *backbuffer)
 {
 
 void tom_render_16bpp_cry_rgb_mix_stretch_scanline(uint32 *backbuffer)
 {
-       uint16 width=tom_width;
-       uint8 *current_line_buffer=(uint8*)&tom_ram_8[0x1800];
-       
+       uint16 width=tomWidth;
+       uint8 *current_line_buffer=(uint8*)&tomRam8[0x1800];
+
        while (width)
        {
                uint16 color = *current_line_buffer++;
        while (width)
        {
                uint16 color = *current_line_buffer++;
@@ -791,37 +791,37 @@ void tom_render_16bpp_cry_stretch_scanline(uint32 *backbuffer)
 {
        uint32 chrm, chrl, y;
 
 {
        uint32 chrm, chrl, y;
 
-       uint16 width=tom_width;
-       uint8 *current_line_buffer=(uint8*)&tom_ram_8[0x1800];
-       
+       uint16 width=tomWidth;
+       uint8 *current_line_buffer=(uint8*)&tomRam8[0x1800];
+
        while (width)
        {
                uint16 color;
                color=*current_line_buffer++;
                color<<=8;
                color|=*current_line_buffer++;
        while (width)
        {
                uint16 color;
                color=*current_line_buffer++;
                color<<=8;
                color|=*current_line_buffer++;
-               
-               chrm = (color & 0xF000) >> 12;    
+
+               chrm = (color & 0xF000) >> 12;
                chrl = (color & 0x0F00) >> 8;
                y    = (color & 0x00FF);
                chrl = (color & 0x0F00) >> 8;
                y    = (color & 0x00FF);
-                               
+
                uint16 red   =  ((((uint32)redcv[chrm][chrl])*y)>>11);
                uint16 green =  ((((uint32)greencv[chrm][chrl])*y)>>11);
                uint16 blue  =  ((((uint32)bluecv[chrm][chrl])*y)>>11);
                uint16 red   =  ((((uint32)redcv[chrm][chrl])*y)>>11);
                uint16 green =  ((((uint32)greencv[chrm][chrl])*y)>>11);
                uint16 blue  =  ((((uint32)bluecv[chrm][chrl])*y)>>11);
-               
+
                uint16 color2;
                color2=*current_line_buffer++;
                color2<<=8;
                color2|=*current_line_buffer++;
                uint16 color2;
                color2=*current_line_buffer++;
                color2<<=8;
                color2|=*current_line_buffer++;
-               
-               chrm = (color2 & 0xF000) >> 12;    
+
+               chrm = (color2 & 0xF000) >> 12;
                chrl = (color2 & 0x0F00) >> 8;
                y    = (color2 & 0x00FF);
                chrl = (color2 & 0x0F00) >> 8;
                y    = (color2 & 0x00FF);
-                               
+
                uint16 red2   = ((((uint32)redcv[chrm][chrl])*y)>>11);
                uint16 green2 = ((((uint32)greencv[chrm][chrl])*y)>>11);
                uint16 blue2  = ((((uint32)bluecv[chrm][chrl])*y)>>11);
                uint16 red2   = ((((uint32)redcv[chrm][chrl])*y)>>11);
                uint16 green2 = ((((uint32)greencv[chrm][chrl])*y)>>11);
                uint16 blue2  = ((((uint32)bluecv[chrm][chrl])*y)>>11);
-               
+
                red=(red+red2)>>1;
                green=(green+green2)>>1;
                blue=(blue+blue2)>>1;
                red=(red+red2)>>1;
                green=(green+green2)>>1;
                blue=(blue+blue2)>>1;
@@ -833,9 +833,9 @@ void tom_render_16bpp_cry_stretch_scanline(uint32 *backbuffer)
 
 void tom_render_24bpp_stretch_scanline(uint32 *backbuffer)
 {
 
 void tom_render_24bpp_stretch_scanline(uint32 *backbuffer)
 {
-       uint16 width=tom_width;
-       uint8 *current_line_buffer=(uint8*)&tom_ram_8[0x1800];
-       
+       uint16 width=tomWidth;
+       uint8 *current_line_buffer=(uint8*)&tomRam8[0x1800];
+
        while (width)
        {
                uint16 green=*current_line_buffer++;
        while (width)
        {
                uint16 green=*current_line_buffer++;
@@ -853,9 +853,9 @@ void tom_render_24bpp_stretch_scanline(uint32 *backbuffer)
 
 void tom_render_16bpp_direct_stretch_scanline(uint32 *backbuffer)
 {
 
 void tom_render_16bpp_direct_stretch_scanline(uint32 *backbuffer)
 {
-       uint16 width=tom_width;
-       uint8 *current_line_buffer=(uint8*)&tom_ram_8[0x1800];
-       
+       uint16 width=tomWidth;
+       uint8 *current_line_buffer=(uint8*)&tomRam8[0x1800];
+
        while (width)
        {
                uint16 color=*current_line_buffer++;
        while (width)
        {
                uint16 color=*current_line_buffer++;
@@ -870,9 +870,9 @@ void tom_render_16bpp_direct_stretch_scanline(uint32 *backbuffer)
 
 void tom_render_16bpp_rgb_stretch_scanline(uint32 *backbuffer)
 {
 
 void tom_render_16bpp_rgb_stretch_scanline(uint32 *backbuffer)
 {
-       uint16 width=tom_width;
-       uint8 *current_line_buffer=(uint8*)&tom_ram_8[0x1800];
-       
+       uint16 width=tomWidth;
+       uint8 *current_line_buffer=(uint8*)&tomRam8[0x1800];
+
        while (width)
        {
                uint16 color1=*current_line_buffer++;
        while (width)
        {
                uint16 color1=*current_line_buffer++;
@@ -909,15 +909,15 @@ void TOMExecScanline(uint16 scanline, bool render)
        if (scanline & 0x01)                                                    // Execute OP only on even lines (non-interlaced only!)
                return;
 
        if (scanline & 0x01)                                                    // Execute OP only on even lines (non-interlaced only!)
                return;
 
-       if (scanline >= (uint16)GET16(tom_ram_8, VDB) && scanline < (uint16)GET16(tom_ram_8, VDE))
+       if (scanline >= (uint16)GET16(tomRam8, VDB) && scanline < (uint16)GET16(tomRam8, VDE))
        {
                if (render)
                {
        {
                if (render)
                {
-                       uint8 * current_line_buffer = (uint8 *)&tom_ram_8[0x1800];
-                       uint8 bgHI = tom_ram_8[BG], bgLO = tom_ram_8[BG + 1];
+                       uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
+                       uint8 bgHI = tomRam8[BG], bgLO = tomRam8[BG + 1];
 
                        // Clear line buffer with BG
 
                        // Clear line buffer with BG
-                       if (GET16(tom_ram_8, VMODE) & BGEN) // && (CRY or RGB16)...
+                       if (GET16(tomRam8, VMODE) & BGEN) // && (CRY or RGB16)...
                                for(uint32 i=0; i<720; i++)
                                        *current_line_buffer++ = bgHI, *current_line_buffer++ = bgLO;
 
                                for(uint32 i=0; i<720; i++)
                                        *current_line_buffer++ = bgHI, *current_line_buffer++ = bgLO;
 
@@ -940,7 +940,7 @@ void TOMExecScanline(uint16 scanline, bool render)
                {
 //NOTE: The following doesn't put BORDER color on the sides... !!! FIX !!!
                        if (vjs.renderType == RT_NORMAL)
                {
 //NOTE: The following doesn't put BORDER color on the sides... !!! FIX !!!
                        if (vjs.renderType == RT_NORMAL)
-                               scanline_render[tom_getVideoMode()](TOMBackbuffer);
+                               scanline_render[TOMGetVideoMode()](TOMBackbuffer);
                        else//TV type render
                        {
 /*
                        else//TV type render
                        {
 /*
@@ -956,9 +956,9 @@ void TOMExecScanline(uint16 scanline, bool render)
 #define   MODE         0x0006          // Line buffer to video generator mode
 #define   VARMOD       0x0100          // Mixed CRY/RGB16 mode (only works in MODE 0!)
 */
 #define   MODE         0x0006          // Line buffer to video generator mode
 #define   VARMOD       0x0100          // Mixed CRY/RGB16 mode (only works in MODE 0!)
 */
-                               uint8 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
-                               uint8 mode = ((GET16(tom_ram_8, VMODE) & MODE) >> 1);
-                               bool varmod = GET16(tom_ram_8, VMODE) & VARMOD;
+                               uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
+                               uint8 mode = ((GET16(tomRam8, VMODE) & MODE) >> 1);
+                               bool varmod = GET16(tomRam8, VMODE) & VARMOD;
 //The video texture line buffer ranges from 0 to 1279, with its left edge starting at LEFT_VISIBLE_HC.
 //So, we need to start writing into the backbuffer at HDB1, using pwidth as our scaling factor. The
 //way it generates its image on a real TV!
 //The video texture line buffer ranges from 0 to 1279, with its left edge starting at LEFT_VISIBLE_HC.
 //So, we need to start writing into the backbuffer at HDB1, using pwidth as our scaling factor. The
 //way it generates its image on a real TV!
@@ -972,13 +972,13 @@ void TOMExecScanline(uint16 scanline, bool render)
                {
                        // If outside of VDB & VDE, then display the border color
 /*                     int16 * currentLineBuffer = TOMBackbuffer;
                {
                        // If outside of VDB & VDE, then display the border color
 /*                     int16 * currentLineBuffer = TOMBackbuffer;
-                       uint8 g = tom_ram_8[BORD1], r = tom_ram_8[BORD1 + 1], b = tom_ram_8[BORD2 + 1];
+                       uint8 g = tomRam8[BORD1], r = tomRam8[BORD1 + 1], b = tomRam8[BORD2 + 1];
                        uint16 pixel = ((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3);//*/
                        uint32 * currentLineBuffer = TOMBackbuffer;
                        uint16 pixel = ((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3);//*/
                        uint32 * currentLineBuffer = TOMBackbuffer;
-                       uint8 g = tom_ram_8[BORD1], r = tom_ram_8[BORD1 + 1], b = tom_ram_8[BORD2 + 1];
+                       uint8 g = tomRam8[BORD1], r = tomRam8[BORD1 + 1], b = tomRam8[BORD2 + 1];
                        uint32 pixel = 0xFF000000 | (b << 16) | (g << 8) | r;
 
                        uint32 pixel = 0xFF000000 | (b << 16) | (g << 8) | r;
 
-                       for(uint32 i=0; i<tom_width; i++)
+                       for(uint32 i=0; i<tomWidth; i++)
                                *currentLineBuffer++ = pixel;
                }
 
                                *currentLineBuffer++ = pixel;
                }
 
@@ -990,34 +990,28 @@ void TOMExecScanline(uint16 scanline, bool render)
 //
 // TOM initialization
 //
 //
 // TOM initialization
 //
-void tom_init(void)
+void TOMInit(void)
 {
 {
-//     memory_malloc_secure((void **)&tom_cry_rgb_mix_lut, 2 * 0x10000, "CRY/RGB mixed mode LUT");
-
-       op_init();
-       blitter_init();
-//This should be done by JERRY!        pcm_init();
-//     memory_malloc_secure((void **)&tom_ram_8, 0x4000, "TOM RAM");
-       tom_reset();
+       OPInit();
+       BlitterInit();
+       TOMReset();
        // Setup the non-stretchy scanline rendering...
        memcpy(scanline_render, scanline_render_normal, sizeof(scanline_render));
        // Setup the non-stretchy scanline rendering...
        memcpy(scanline_render, scanline_render_normal, sizeof(scanline_render));
-//     tom_calc_cry_rgb_mix_lut();
        TOMFillLookupTables();
 }
 
        TOMFillLookupTables();
 }
 
-void tom_done(void)
+void TOMDone(void)
 {
 {
-       op_done();
-//This should be done by JERRY!        pcm_done();
-       blitter_done();
-       WriteLog("TOM: Resolution %i x %i %s\n", tom_getVideoModeWidth(), tom_getVideoModeHeight(),
-               videoMode_to_str[tom_getVideoMode()]);
+       OPDone();
+       BlitterDone();
+       WriteLog("TOM: Resolution %i x %i %s\n", TOMGetVideoModeWidth(), TOMGetVideoModeHeight(),
+               videoMode_to_str[TOMGetVideoMode()]);
 //     WriteLog("\ntom: object processor:\n");
 //     WriteLog("tom: pointer to object list: 0x%.8x\n",op_get_list_pointer());
 //     WriteLog("tom: INT1=0x%.2x%.2x\n",TOMReadByte(0xf000e0),TOMReadByte(0xf000e1));
 //     gpu_done();
 //     dsp_done();
 //     WriteLog("\ntom: object processor:\n");
 //     WriteLog("tom: pointer to object list: 0x%.8x\n",op_get_list_pointer());
 //     WriteLog("tom: INT1=0x%.2x%.2x\n",TOMReadByte(0xf000e0),TOMReadByte(0xf000e1));
 //     gpu_done();
 //     dsp_done();
-//     memory_free(tom_ram_8);
+//     memory_free(tomRam8);
 //     memory_free(tom_cry_rgb_mix_lut);
 }
 
 //     memory_free(tom_cry_rgb_mix_lut);
 }
 
@@ -1026,7 +1020,7 @@ void tom_done(void)
        return hblankWidthInPixels;
 }*/
 
        return hblankWidthInPixels;
 }*/
 
-uint32 tom_getVideoModeWidth(void)
+uint32 TOMGetVideoModeWidth(void)
 {
        //These widths are pretty bogus. Should use HDB1/2 & HDE/HBB & PWIDTH to calc the width...
 //     uint32 width[8] = { 1330, 665, 443, 332, 266, 222, 190, 166 };
 {
        //These widths are pretty bogus. Should use HDB1/2 & HDE/HBB & PWIDTH to calc the width...
 //     uint32 width[8] = { 1330, 665, 443, 332, 266, 222, 190, 166 };
@@ -1049,18 +1043,18 @@ uint32 tom_getVideoModeWidth(void)
 
        // NOTE: Even though the PWIDTH value is + 1, here we're using a zero-based index and
        //       so we don't bother to add one...
 
        // NOTE: Even though the PWIDTH value is + 1, here we're using a zero-based index and
        //       so we don't bother to add one...
-//     return width[(GET16(tom_ram_8, VMODE) & PWIDTH) >> 9];
+//     return width[(GET16(tomRam8, VMODE) & PWIDTH) >> 9];
 
        // Now, we just calculate it...
 
        // Now, we just calculate it...
-/*     uint16 hdb1 = GET16(tom_ram_8, HDB1), hde = GET16(tom_ram_8, HDE),
-               hbb = GET16(tom_ram_8, HBB), pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
+/*     uint16 hdb1 = GET16(tomRam8, HDB1), hde = GET16(tomRam8, HDE),
+               hbb = GET16(tomRam8, HBB), pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
 //     return ((hbb < hde ? hbb : hde) - hdb1) / pwidth;
 //Temporary, for testing Doom...
        return ((hbb < hde ? hbb : hde) - hdb1) / (pwidth == 8 ? 4 : pwidth);*/
 
        // To make it easier to make a quasi-fixed display size, we restrict the viewing
        // area to an arbitrary range of the Horizontal Count.
 //     return ((hbb < hde ? hbb : hde) - hdb1) / pwidth;
 //Temporary, for testing Doom...
        return ((hbb < hde ? hbb : hde) - hdb1) / (pwidth == 8 ? 4 : pwidth);*/
 
        // To make it easier to make a quasi-fixed display size, we restrict the viewing
        // area to an arbitrary range of the Horizontal Count.
-       uint16 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
+       uint16 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1;
        return (vjs.hardwareTypeNTSC ? RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC : RIGHT_VISIBLE_HC_PAL - LEFT_VISIBLE_HC_PAL) / pwidth;
 //Temporary, for testing Doom...
 //     return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / (pwidth == 8 ? 4 : pwidth);
        return (vjs.hardwareTypeNTSC ? RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC : RIGHT_VISIBLE_HC_PAL - LEFT_VISIBLE_HC_PAL) / pwidth;
 //Temporary, for testing Doom...
 //     return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / (pwidth == 8 ? 4 : pwidth);
@@ -1090,15 +1084,15 @@ uint32 tom_getVideoModeWidth(void)
 // Same with the width... [Width is pretty much virtualized now.]
 
 // Now that that the width is virtualized, let's virtualize the height. :-)
 // Same with the width... [Width is pretty much virtualized now.]
 
 // Now that that the width is virtualized, let's virtualize the height. :-)
-uint32 tom_getVideoModeHeight(void)
+uint32 TOMGetVideoModeHeight(void)
 {
 {
-//     uint16 vmode = GET16(tom_ram_8, VMODE);
-//     uint16 vbe = GET16(tom_ram_8, VBE);
-//     uint16 vbb = GET16(tom_ram_8, VBB);
-//     uint16 vdb = GET16(tom_ram_8, VDB);
-//     uint16 vde = GET16(tom_ram_8, VDE);
-//     uint16 vp = GET16(tom_ram_8, VP);
-       
+//     uint16 vmode = GET16(tomRam8, VMODE);
+//     uint16 vbe = GET16(tomRam8, VBE);
+//     uint16 vbb = GET16(tomRam8, VBB);
+//     uint16 vdb = GET16(tomRam8, VDB);
+//     uint16 vde = GET16(tomRam8, VDE);
+//     uint16 vp = GET16(tomRam8, VP);
+
 /*     if (vde == 0xFFFF)
                vde = vbb;//*/
 
 /*     if (vde == 0xFFFF)
                vde = vbb;//*/
 
@@ -1123,49 +1117,49 @@ uint32 tom_getVideoModeHeight(void)
 // TOM reset code
 // Now PAL friendly!
 //
 // TOM reset code
 // Now PAL friendly!
 //
-void tom_reset(void)
+void TOMReset(void)
 {
 {
-       op_reset();
-       blitter_reset();
-       memset(tom_ram_8, 0x00, 0x4000);
+       OPReset();
+       BlitterReset();
+       memset(tomRam8, 0x00, 0x4000);
 
        if (vjs.hardwareTypeNTSC)
        {
 
        if (vjs.hardwareTypeNTSC)
        {
-               SET16(tom_ram_8, MEMCON1, 0x1861);
-               SET16(tom_ram_8, MEMCON2, 0x35CC);
-               SET16(tom_ram_8, HP, 844);                              // Horizontal Period (1-based; HP=845)
-               SET16(tom_ram_8, HBB, 1713);                    // Horizontal Blank Begin
-               SET16(tom_ram_8, HBE, 125);                             // Horizontal Blank End
-               SET16(tom_ram_8, HDE, 1665);                    // Horizontal Display End
-               SET16(tom_ram_8, HDB1, 203);                    // Horizontal Display Begin 1
-               SET16(tom_ram_8, VP, 523);                              // Vertical Period (1-based; in this case VP = 524)
-               SET16(tom_ram_8, VBE, 24);                              // Vertical Blank End
-               SET16(tom_ram_8, VDB, 38);                              // Vertical Display Begin
-               SET16(tom_ram_8, VDE, 518);                             // Vertical Display End
-               SET16(tom_ram_8, VBB, 500);                             // Vertical Blank Begin
-               SET16(tom_ram_8, VS, 517);                              // Vertical Sync
-               SET16(tom_ram_8, VMODE, 0x06C1);
+               SET16(tomRam8, MEMCON1, 0x1861);
+               SET16(tomRam8, MEMCON2, 0x35CC);
+               SET16(tomRam8, HP, 844);                                // Horizontal Period (1-based; HP=845)
+               SET16(tomRam8, HBB, 1713);                      // Horizontal Blank Begin
+               SET16(tomRam8, HBE, 125);                               // Horizontal Blank End
+               SET16(tomRam8, HDE, 1665);                      // Horizontal Display End
+               SET16(tomRam8, HDB1, 203);                      // Horizontal Display Begin 1
+               SET16(tomRam8, VP, 523);                                // Vertical Period (1-based; in this case VP = 524)
+               SET16(tomRam8, VBE, 24);                                // Vertical Blank End
+               SET16(tomRam8, VDB, 38);                                // Vertical Display Begin
+               SET16(tomRam8, VDE, 518);                               // Vertical Display End
+               SET16(tomRam8, VBB, 500);                               // Vertical Blank Begin
+               SET16(tomRam8, VS, 517);                                // Vertical Sync
+               SET16(tomRam8, VMODE, 0x06C1);
        }
        else    // PAL Jaguar
        {
        }
        else    // PAL Jaguar
        {
-               SET16(tom_ram_8, MEMCON1, 0x1861);
-               SET16(tom_ram_8, MEMCON2, 0x35CC);
-               SET16(tom_ram_8, HP, 850);                              // Horizontal Period
-               SET16(tom_ram_8, HBB, 1711);                    // Horizontal Blank Begin
-               SET16(tom_ram_8, HBE, 158);                             // Horizontal Blank End
-               SET16(tom_ram_8, HDE, 1665);                    // Horizontal Display End
-               SET16(tom_ram_8, HDB1, 203);                    // Horizontal Display Begin 1
-               SET16(tom_ram_8, VP, 623);                              // Vertical Period (1-based; in this case VP = 624)
-               SET16(tom_ram_8, VBE, 34);                              // Vertical Blank End
-               SET16(tom_ram_8, VDB, 38);                              // Vertical Display Begin
-               SET16(tom_ram_8, VDE, 518);                             // Vertical Display End
-               SET16(tom_ram_8, VBB, 600);                             // Vertical Blank Begin
-               SET16(tom_ram_8, VS, 618);                              // Vertical Sync
-               SET16(tom_ram_8, VMODE, 0x06C1);
+               SET16(tomRam8, MEMCON1, 0x1861);
+               SET16(tomRam8, MEMCON2, 0x35CC);
+               SET16(tomRam8, HP, 850);                                // Horizontal Period
+               SET16(tomRam8, HBB, 1711);                      // Horizontal Blank Begin
+               SET16(tomRam8, HBE, 158);                               // Horizontal Blank End
+               SET16(tomRam8, HDE, 1665);                      // Horizontal Display End
+               SET16(tomRam8, HDB1, 203);                      // Horizontal Display Begin 1
+               SET16(tomRam8, VP, 623);                                // Vertical Period (1-based; in this case VP = 624)
+               SET16(tomRam8, VBE, 34);                                // Vertical Blank End
+               SET16(tomRam8, VDB, 38);                                // Vertical Display Begin
+               SET16(tomRam8, VDE, 518);                               // Vertical Display End
+               SET16(tomRam8, VBB, 600);                               // Vertical Blank Begin
+               SET16(tomRam8, VS, 618);                                // Vertical Sync
+               SET16(tomRam8, VMODE, 0x06C1);
        }
 
        }
 
-       tom_width = 0;
-       tom_height = 0;
+       tomWidth = 0;
+       tomHeight = 0;
 
        tom_jerry_int_pending = 0;
        tom_timer_int_pending = 0;
 
        tom_jerry_int_pending = 0;
        tom_timer_int_pending = 0;
@@ -1211,7 +1205,7 @@ uint8 TOMReadByte(uint32 offset, uint32 who/*=UNKNOWN*/)
        else if (offset == 0xF00053)
                return tom_timer_divider & 0xFF;
 
        else if (offset == 0xF00053)
                return tom_timer_divider & 0xFF;
 
-       return tom_ram_8[offset & 0x3FFF];
+       return tomRam8[offset & 0x3FFF];
 }
 
 //
 }
 
 //
@@ -1331,10 +1325,10 @@ void TOMWriteByte(uint32 offset, uint8 data, uint32 who/*=UNKNOWN*/)
        {
                // Writing to one CLUT writes to the other
                offset &= 0x5FF;                // Mask out $F00600 (restrict to $F00400-5FF)
        {
                // Writing to one CLUT writes to the other
                offset &= 0x5FF;                // Mask out $F00600 (restrict to $F00400-5FF)
-               tom_ram_8[offset] = data, tom_ram_8[offset + 0x200] = data;
+               tomRam8[offset] = data, tomRam8[offset + 0x200] = data;
        }
 
        }
 
-       tom_ram_8[offset & 0x3FFF] = data;
+       tomRam8[offset & 0x3FFF] = data;
 }
 
 //
 }
 
 //
@@ -1412,8 +1406,8 @@ if (offset >= 0xF02000 && offset <= 0xF020FF)
                // Writing to one CLUT writes to the other
                offset &= 0x5FF;                // Mask out $F00600 (restrict to $F00400-5FF)
 // Watch out for unaligned writes here! (Not fixed yet)
                // Writing to one CLUT writes to the other
                offset &= 0x5FF;                // Mask out $F00600 (restrict to $F00400-5FF)
 // Watch out for unaligned writes here! (Not fixed yet)
-               SET16(tom_ram_8, offset, data);
-               SET16(tom_ram_8, offset + 0x200, data);
+               SET16(tomRam8, offset, data);
+               SET16(tomRam8, offset + 0x200, data);
        }
 
        offset &= 0x3FFF;
        }
 
        offset &= 0x3FFF;
@@ -1455,42 +1449,42 @@ if (offset == HBB)
 if (offset == HBE)
        WriteLog("TOM: Horizontal Blank End written by %s: %u\n", whoName[who], data);
 if (offset == VMODE)
 if (offset == HBE)
        WriteLog("TOM: Horizontal Blank End written by %s: %u\n", whoName[who], data);
 if (offset == VMODE)
-       WriteLog("TOM: Video Mode written by %s: %04X. PWIDTH = %u, MODE = %s, flags:%s%s (VC = %u)\n", whoName[who], data, ((data >> 9) & 0x07) + 1, videoMode_to_str[(data & MODE) >> 1], (data & BGEN ? " BGEN" : ""), (data & VARMOD ? " VARMOD" : ""), GET16(tom_ram_8, VC));
+       WriteLog("TOM: Video Mode written by %s: %04X. PWIDTH = %u, MODE = %s, flags:%s%s (VC = %u)\n", whoName[who], data, ((data >> 9) & 0x07) + 1, videoMode_to_str[(data & MODE) >> 1], (data & BGEN ? " BGEN" : ""), (data & VARMOD ? " VARMOD" : ""), GET16(tomRam8, VC));
 
        // detect screen resolution changes
 //This may go away in the future, if we do the virtualized screen thing...
 //This may go away soon!
        if ((offset >= 0x28) && (offset <= 0x4F))
        {
 
        // detect screen resolution changes
 //This may go away in the future, if we do the virtualized screen thing...
 //This may go away soon!
        if ((offset >= 0x28) && (offset <= 0x4F))
        {
-               uint32 width = tom_getVideoModeWidth(), height = tom_getVideoModeHeight();
+               uint32 width = TOMGetVideoModeWidth(), height = TOMGetVideoModeHeight();
 
 
-               if ((width != tom_width) || (height != tom_height))
+               if ((width != tomWidth) || (height != tomHeight))
                {
                {
-                       tom_width = width, tom_height = height;
+                       tomWidth = width, tomHeight = height;
 
                        if (vjs.renderType == RT_NORMAL)
 
                        if (vjs.renderType == RT_NORMAL)
-                               ResizeScreen(tom_width, tom_height);
+                               ResizeScreen(tomWidth, tomHeight);
                }
        }
 }
 
                }
        }
 }
 
-int tom_irq_enabled(int irq)
+int TOMIRQEnabled(int irq)
 {
        // This is the correct byte in big endian... D'oh!
 //     return jaguar_byte_read(0xF000E1) & (1 << irq);
 {
        // This is the correct byte in big endian... D'oh!
 //     return jaguar_byte_read(0xF000E1) & (1 << irq);
-       return tom_ram_8[INT1 + 1/*0xE1*/] & (1 << irq);
+       return tomRam8[INT1 + 1/*0xE1*/] & (1 << irq);
 }
 
 //unused
 /*void tom_set_irq_latch(int irq, int enabled)
 {
 }
 
 //unused
 /*void tom_set_irq_latch(int irq, int enabled)
 {
-       tom_ram_8[0xE0] = (tom_ram_8[0xE0] & (~(1<<irq))) | (enabled ? (1<<irq) : 0);
+       tomRam8[0xE0] = (tomRam8[0xE0] & (~(1<<irq))) | (enabled ? (1<<irq) : 0);
 }*/
 
 //unused
 /*uint16 tom_irq_control_reg(void)
 {
 }*/
 
 //unused
 /*uint16 tom_irq_control_reg(void)
 {
-       return (tom_ram_8[0xE0] << 8) | tom_ram_8[0xE1];
+       return (tomRam8[0xE0] << 8) | tomRam8[0xE1];
 }*/
 
 // NEW:
 }*/
 
 // NEW:
@@ -1513,7 +1507,7 @@ void TOMResetPIT(void)
 #else
        // Need to remove previous timer from the queue, if it exists...
        RemoveCallback(TOMPITCallback);
 #else
        // Need to remove previous timer from the queue, if it exists...
        RemoveCallback(TOMPITCallback);
-       
+
        if (tom_timer_prescaler)
        {
                double usecs = (float)(tom_timer_prescaler + 1) * (float)(tom_timer_divider + 1) * RISC_CYCLE_IN_USEC;
        if (tom_timer_prescaler)
        {
                double usecs = (float)(tom_timer_prescaler + 1) * (float)(tom_timer_divider + 1) * RISC_CYCLE_IN_USEC;
@@ -1536,10 +1530,10 @@ void TOMExecPIT(uint32 cycles)
 
                if (tom_timer_counter <= 0)
                {
 
                if (tom_timer_counter <= 0)
                {
-                       tom_set_pending_timer_int();
+                       TOMSetPendingTimerInt();
                        GPUSetIRQLine(GPUIRQ_TIMER, ASSERT_LINE);       // GPUSetIRQLine does the 'IRQ enabled' checking
 
                        GPUSetIRQLine(GPUIRQ_TIMER, ASSERT_LINE);       // GPUSetIRQLine does the 'IRQ enabled' checking
 
-                       if (tom_irq_enabled(IRQ_TIMER))
+                       if (TOMIRQEnabled(IRQ_TIMER))
                                m68k_set_irq(7);                                // Cause a 68000 NMI...
 
                        TOMResetPIT();
                                m68k_set_irq(7);                                // Cause a 68000 NMI...
 
                        TOMResetPIT();
@@ -1551,11 +1545,11 @@ void TOMExecPIT(uint32 cycles)
 void TOMPITCallback(void)
 {
 //     INT1_RREG |= 0x08;                         // Set TOM PIT interrupt pending
 void TOMPITCallback(void)
 {
 //     INT1_RREG |= 0x08;                         // Set TOM PIT interrupt pending
-       tom_set_pending_timer_int();
+       TOMSetPendingTimerInt();
     GPUSetIRQLine(GPUIRQ_TIMER, ASSERT_LINE);  // It does the 'IRQ enabled' checking
 
 //     if (INT1_WREG & 0x08)
     GPUSetIRQLine(GPUIRQ_TIMER, ASSERT_LINE);  // It does the 'IRQ enabled' checking
 
 //     if (INT1_WREG & 0x08)
-       if (tom_irq_enabled(IRQ_TIMER))
+       if (TOMIRQEnabled(IRQ_TIMER))
                m68k_set_irq(7);                       // Generate 68K NMI
 
        TOMResetPIT();
                m68k_set_irq(7);                       // Generate 68K NMI
 
        TOMResetPIT();
index 091cd0cffa71bbecb1cd8a8f686582136a81c288..0c9511ee9cd9f80a2246bbb616f62fc02e74b84f 100644 (file)
--- a/src/tom.h
+++ b/src/tom.h
@@ -17,9 +17,9 @@
 
 enum { IRQ_VBLANK = 0, IRQ_GPU, IRQ_OPFLAG, IRQ_TIMER, IRQ_DSP };
 
 
 enum { IRQ_VBLANK = 0, IRQ_GPU, IRQ_OPFLAG, IRQ_TIMER, IRQ_DSP };
 
-void tom_init(void);
-void tom_reset(void);
-void tom_done(void);
+void TOMInit(void);
+void TOMReset(void);
+void TOMDone(void);
 
 uint8 TOMReadByte(uint32 offset, uint32 who = UNKNOWN);
 uint16 TOMReadWord(uint32 offset, uint32 who = UNKNOWN);
 
 uint8 TOMReadByte(uint32 offset, uint32 who = UNKNOWN);
 uint16 TOMReadWord(uint32 offset, uint32 who = UNKNOWN);
@@ -28,24 +28,24 @@ void TOMWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 
 //void TOMExecScanline(int16 * backbuffer, int32 scanline, bool render);
 void TOMExecScanline(uint16 scanline, bool render);
 
 //void TOMExecScanline(int16 * backbuffer, int32 scanline, bool render);
 void TOMExecScanline(uint16 scanline, bool render);
-uint32 tom_getVideoModeWidth(void);
-uint32 tom_getVideoModeHeight(void);
-uint8 tom_getVideoMode(void);
-uint8 * tom_get_ram_pointer(void);
-uint16 tom_get_hdb(void);
-uint16 tom_get_vdb(void);
+uint32 TOMGetVideoModeWidth(void);
+uint32 TOMGetVideoModeHeight(void);
+uint8 TOMGetVideoMode(void);
+uint8 * TOMGetRamPointer(void);
+uint16 TOMGetHDB(void);
+uint16 TOMGetVDB(void);
 //uint16 tom_get_scanline(void);
 //uint32 tom_getHBlankWidthInPixels(void);
 
 //uint16 tom_get_scanline(void);
 //uint32 tom_getHBlankWidthInPixels(void);
 
-int    tom_irq_enabled(int irq);
-uint16 tom_irq_control_reg(void);
-void tom_set_irq_latch(int irq, int enabled);
+int    TOMIRQEnabled(int irq);
+uint16 TOMIRQControlReg(void);
+void TOMSetIRQLatch(int irq, int enabled);
 void TOMExecPIT(uint32 cycles);
 void TOMExecPIT(uint32 cycles);
-void tom_set_pending_jerry_int(void);
-void tom_set_pending_timer_int(void);
-void tom_set_pending_object_int(void);
-void tom_set_pending_gpu_int(void);
-void tom_set_pending_video_int(void);
+void TOMSetPendingJERRYInt(void);
+void TOMSetPendingTimerInt(void);
+void TOMSetPendingObjectInt(void);
+void TOMSetPendingGPUInt(void);
+void TOMSetPendingVideoInt(void);
 void TOMResetPIT(void);
 
 //uint32 TOMGetSDLScreenPitch(void);
 void TOMResetPIT(void);
 
 //uint32 TOMGetSDLScreenPitch(void);
@@ -53,8 +53,8 @@ void TOMResetBackbuffer(uint32 * backbuffer);
 
 // Exported variables
 
 
 // Exported variables
 
-extern uint32 tom_width;
-extern uint32 tom_height;
-extern uint8 tom_ram_8[];
+extern uint32 tomWidth;
+extern uint32 tomHeight;
+extern uint8 tomRam8[];
 
 #endif // __TOM_H__
 
 #endif // __TOM_H__
diff --git a/src/version.cpp b/src/version.cpp
deleted file mode 100644 (file)
index 93b3db6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// VERSION.CPP
-//
-// by David Raingeard (Cal2)
-// GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
-// Cleanups by James L. Hammons
-//
-
-#include "version.h"
-
-void InitVersion(void)
-{
-}
-
-void version_display(FILE * fp)
-{
-       fprintf(fp, "Virtual Jaguar v1.1.0 (Last full build was on %s %s)\n", __DATE__, __TIME__);
-}
-
-void VersionDone(void)
-{
-}
diff --git a/src/version.h b/src/version.h
deleted file mode 100644 (file)
index 0e26345..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// VERSION.H: Header file
-//
-
-#ifndef __VERSION_H__
-#define __VERSION_H__
-
-#include <stdio.h>
-
-void InitVersion(void);
-void VersionDone(void);
-void version_display(FILE *);
-
-#endif // __VERSION_H__
index b35cc1a048e50b68abad5a7dc7e8388ab26cc54d..4b9507dc363c9212379f2c0b542e5f95aaff4a32 100644 (file)
@@ -37,7 +37,7 @@ int frame_ticker = 0;
 //
 // Create SDL/OpenGL surfaces
 //
 //
 // Create SDL/OpenGL surfaces
 //
-bool InitVideo(void)
+bool VideoInit(void)
 {
        // Get proper info about the platform we're running on...
        const SDL_VideoInfo * info = SDL_GetVideoInfo();
 {
        // Get proper info about the platform we're running on...
        const SDL_VideoInfo * info = SDL_GetVideoInfo();
@@ -54,7 +54,6 @@ bool InitVideo(void)
            SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
         SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
                mainSurfaceFlags = SDL_OPENGL;
            SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
         SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
                mainSurfaceFlags = SDL_OPENGL;
-
        }
        else
        {
        }
        else
        {
@@ -199,9 +198,9 @@ void RenderBackbuffer(void)
 //     memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 2);
 // This memcpy is expensive--do some profiling to see what the impact is!
        if (vjs.renderType == RT_NORMAL)
 //     memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 2);
 // This memcpy is expensive--do some profiling to see what the impact is!
        if (vjs.renderType == RT_NORMAL)
-               memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 4);
+               memcpy(surface->pixels, backbuffer, TOMGetVideoModeWidth() * TOMGetVideoModeHeight() * 4);
        else if (vjs.renderType == RT_TV)
        else if (vjs.renderType == RT_TV)
-               memcpy(surface->pixels, backbuffer, 1280 * tom_getVideoModeHeight() * 4);
+               memcpy(surface->pixels, backbuffer, 1280 * TOMGetVideoModeHeight() * 4);
 
        if (SDL_MUSTLOCK(surface))
                SDL_UnlockSurface(surface);
 
        if (SDL_MUSTLOCK(surface))
                SDL_UnlockSurface(surface);
@@ -282,11 +281,16 @@ uint32 GetSDLScreenWidthInPixels(void)
 //
 void ToggleFullscreen(void)
 {
 //
 void ToggleFullscreen(void)
 {
+       // Set our internal variable, then toggle the SDL flag
        vjs.fullscreen = !vjs.fullscreen;
        vjs.fullscreen = !vjs.fullscreen;
-       mainSurfaceFlags &= ~SDL_FULLSCREEN;
+       mainSurfaceFlags ^= SDL_FULLSCREEN;
+//     mainSurfaceFlags = (vjs.fullscreen ? mainSurfaceFlags | SDL_FULLSCREEN :
+//             mainSurfaceFlags & ~SDL_FULLSCREEN);
 
 
-       if (vjs.fullscreen)
-               mainSurfaceFlags |= SDL_FULLSCREEN;
+//     mainSurfaceFlags &= ~SDL_FULLSCREEN;
+
+//     if (vjs.fullscreen)
+//             mainSurfaceFlags |= SDL_FULLSCREEN;
 
        if (vjs.useOpenGL)
        {
 
        if (vjs.useOpenGL)
        {
@@ -294,7 +298,7 @@ void ToggleFullscreen(void)
                // This way we have good scaling functionality and when the screen is resized
                // because of the NTSC <-> PAL resize, we only have to re-create the texture
                // instead of initializing the entire OpenGL texture en screens.
                // This way we have good scaling functionality and when the screen is resized
                // because of the NTSC <-> PAL resize, we only have to re-create the texture
                // instead of initializing the entire OpenGL texture en screens.
-               mainSurface = SDL_SetVideoMode(640, 480, 32, mainSurfaceFlags);//*/
+               mainSurface = SDL_SetVideoMode(640, 480, 32, mainSurfaceFlags);
 
                // Reset viewport, etc.
                glViewport(0, 0, mainSurface->w, mainSurface->h);
 
                // Reset viewport, etc.
                glViewport(0, 0, mainSurface->w, mainSurface->h);
index 5e47e0f178e23d3f064f72ee26706f4ff07ce7ac..8dd3364e8aee13a0fc5d7a1d5432b4a8acabad55 100644 (file)
@@ -11,7 +11,7 @@
 #define VIRTUAL_SCREEN_HEIGHT_NTSC     240
 #define VIRTUAL_SCREEN_HEIGHT_PAL      256
 
 #define VIRTUAL_SCREEN_HEIGHT_NTSC     240
 #define VIRTUAL_SCREEN_HEIGHT_PAL      256
 
-bool InitVideo(void);
+bool VideoInit(void);
 void VideoDone(void);
 void RenderBackbuffer(void);
 void ResizeScreen(uint32 width, uint32 height);
 void VideoDone(void);
 void RenderBackbuffer(void);
 void ResizeScreen(uint32 width, uint32 height);
index 3f82f8368185ccb7d260235afe2a64d49e0bdd0c..763d440ba9eb7b218ce2beb3460ea426ee952033 100644 (file)
@@ -6,27 +6,31 @@
 // Cleanups/fixes/enhancements by James L. Hammons and Adam Green
 //
 
 // Cleanups/fixes/enhancements by James L. Hammons and Adam Green
 //
 
-#include <time.h>
 #include <SDL.h>
 #include <SDL.h>
-#include "jaguar.h"
-#include "video.h"
+#include <time.h>
+#include "file.h"
 #include "gui.h"
 #include "gui.h"
-#include "sdlemu_opengl.h"
-#include "settings.h"                                                          // Pull in "vjs" struct
+#include "jaguar.h"
 #include "log.h"
 #include "log.h"
-#include "version.h"
 #include "memory.h"
 #include "memory.h"
-#include "file.h"
+#include "sdlemu_opengl.h"
+#include "settings.h"                                                          // Pull in "vjs" struct
+#include "video.h"
 
 // Uncomment this to use built-in BIOS/CD-ROM BIOS
 // You'll need a copy of jagboot.h & jagcd.h for this to work...!
 //#define USE_BUILT_IN_BIOS
 
 
 // Uncomment this to use built-in BIOS/CD-ROM BIOS
 // You'll need a copy of jagboot.h & jagcd.h for this to work...!
 //#define USE_BUILT_IN_BIOS
 
+// Uncomment this for an official Virtual Jaguar release
+//#define VJ_RELEASE_VERSION "1.1.0"
+#warning !!! FIX !!! Figure out how to use this in GUI.CPP as well!
+
 #ifdef USE_BUILT_IN_BIOS
 #include "jagboot.h"
 #include "jagcd.h"
 #endif
 
 #ifdef USE_BUILT_IN_BIOS
 #include "jagboot.h"
 #include "jagcd.h"
 #endif
 
+
 // Private function prototypes
 
 //
 // Private function prototypes
 
 //
@@ -40,7 +44,11 @@ int main(int argc, char * argv[])
 //NOTE: This isn't actually used anywhere... !!! FIX !!!
        int32 nFrameskip = 0;                                                   // Default: Show every frame
 
 //NOTE: This isn't actually used anywhere... !!! FIX !!!
        int32 nFrameskip = 0;                                                   // Default: Show every frame
 
-       printf("Virtual Jaguar GCC/SDL Portable Jaguar Emulator v1.1.0\n");
+#ifdef VJ_RELEASE_VERSION
+       printf("Virtual Jaguar GCC/SDL Portable Jaguar Emulator v%s\n", VJ_RELEASE_VERSION);
+#else
+       printf("Virtual Jaguar GCC/SDL Portable Jaguar Emulator SVN %s\n", __DATE__);
+#endif
        printf("Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n");
        printf("Written by Niels Wagenaar (Linux/WIN32), Carwin Jones (BeOS),\n");
        printf("James L. Hammons (WIN32) and Adam Green (MacOS)\n");
        printf("Based upon Virtual Jaguar core v1.0.0 by David Raingeard.\n");
        printf("Written by Niels Wagenaar (Linux/WIN32), Carwin Jones (BeOS),\n");
        printf("James L. Hammons (WIN32) and Adam Green (MacOS)\n");
@@ -48,7 +56,7 @@ int main(int argc, char * argv[])
 
        bool haveCart = false;                                                  // Assume there is no cartridge...!
 
 
        bool haveCart = false;                                                  // Assume there is no cartridge...!
 
-       log_init("vj.log");
+       LogInit("vj.log");
        LoadVJSettings();                                                               // Get config file settings...
 
        // Check the switches... ;-)
        LoadVJSettings();                                                               // Get config file settings...
 
        // Check the switches... ;-)
@@ -149,36 +157,38 @@ int main(int argc, char * argv[])
 
        WriteLog("VJ: SDL successfully initialized.\n");
 
 
        WriteLog("VJ: SDL successfully initialized.\n");
 
-WriteLog("Initializing memory subsystem...\n");
-       InitMemory();
-WriteLog("Initializing version...\n");
-       InitVersion();
-       version_display(log_get());
-WriteLog("Initializing jaguar subsystem...\n");
-       jaguar_init();
+       WriteLog("Initializing memory subsystem...\n");
+       MemoryInit();
+#ifdef VJ_RELEASE_VERSION
+       WriteLog("Virtual Jaguar %s (Last full build was on %s %s)\n", VJ_RELEASE_VERSION, __DATE__, __TIME__);
+#else
+       WriteLog("Virtual Jaguar SVN %s (Last full build was on %s %s)\n", __DATE__, __DATE__, __TIME__);
+#endif
+       WriteLog("Initializing jaguar subsystem...\n");
+       JaguarInit();
 
        // Get the BIOS ROM
 #ifdef USE_BUILT_IN_BIOS
        WriteLog("VJ: Using built in BIOS/CD BIOS...\n");
 
        // Get the BIOS ROM
 #ifdef USE_BUILT_IN_BIOS
        WriteLog("VJ: Using built in BIOS/CD BIOS...\n");
-       memcpy(jaguar_bootRom, jagBootROM, 0x20000);
-       memcpy(jaguar_CDBootROM, jagCDROM, 0x40000);
+       memcpy(jaguarBootRom, jagBootROM, 0x20000);
+       memcpy(jaguarCDBootROM, jagCDROM, 0x40000);
        BIOSLoaded = CDBIOSLoaded = true;
 #else
 // What would be nice here would be a way to check if the BIOS was loaded so that we
 // could disable the pushbutton on the Misc Options menu... !!! FIX !!! [DONE here, but needs to be fixed in GUI as well!]
 WriteLog("About to attempt to load BIOSes...\n");
        BIOSLoaded = CDBIOSLoaded = true;
 #else
 // What would be nice here would be a way to check if the BIOS was loaded so that we
 // could disable the pushbutton on the Misc Options menu... !!! FIX !!! [DONE here, but needs to be fixed in GUI as well!]
 WriteLog("About to attempt to load BIOSes...\n");
-       BIOSLoaded = (JaguarLoadROM(jaguar_bootRom, vjs.jagBootPath) == 0x20000 ? true : false);
+       BIOSLoaded = (JaguarLoadROM(jaguarBootRom, vjs.jagBootPath) == 0x20000 ? true : false);
        WriteLog("VJ: BIOS is %savailable...\n", (BIOSLoaded ? "" : "not "));
        WriteLog("VJ: BIOS is %savailable...\n", (BIOSLoaded ? "" : "not "));
-       CDBIOSLoaded = (JaguarLoadROM(jaguar_CDBootROM, vjs.CDBootPath) == 0x40000 ? true : false);
+       CDBIOSLoaded = (JaguarLoadROM(jaguarCDBootROM, vjs.CDBootPath) == 0x40000 ? true : false);
        WriteLog("VJ: CD BIOS is %savailable...\n", (CDBIOSLoaded ? "" : "not "));
 #endif
 
        WriteLog("VJ: CD BIOS is %savailable...\n", (CDBIOSLoaded ? "" : "not "));
 #endif
 
-       SET32(jaguar_mainRam, 0, 0x00200000);                   // Set top of stack...
+       SET32(jaguarMainRam, 0, 0x00200000);                    // Set top of stack...
 
 WriteLog("Initializing video subsystem...\n");
 
 WriteLog("Initializing video subsystem...\n");
-       InitVideo();
+       VideoInit();
 WriteLog("Initializing GUI subsystem...\n");
 WriteLog("Initializing GUI subsystem...\n");
-       InitGUI();
+       GUIInit();
 
        // Now with crunchy GUI goodness!
 WriteLog("About to start GUI...\n");
 
        // Now with crunchy GUI goodness!
 WriteLog("About to start GUI...\n");
@@ -189,11 +199,10 @@ WriteLog("About to start GUI...\n");
 //     int fps = (1000 * totalFrames) / elapsedTime;
 //     WriteLog("VJ: Ran at an average of %i FPS.\n", fps);
 
 //     int fps = (1000 * totalFrames) / elapsedTime;
 //     WriteLog("VJ: Ran at an average of %i FPS.\n", fps);
 
-       jaguar_done();
-       VersionDone();
-       MemoryDone();
+       JaguarDone();
        VideoDone();
        VideoDone();
-       log_done();
+       MemoryDone();
+       LogDone();
 
        // Free SDL components last...!
        SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER);
 
        // Free SDL components last...!
        SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER);
diff --git a/vj.cfg b/vj.cfg
index c7a46c01b80c59b3acf6943d991585e08830f9cc..cb4dc4cb2d6168cd1271834d7641439b556d9bc3 100644 (file)
--- a/vj.cfg
+++ b/vj.cfg
@@ -41,7 +41,7 @@ usePipelinedDSP = 0
 
 useJoystick = 0
 
 
 useJoystick = 0
 
-# Joyport option: If joystick is enabled above, set the port (0 - 3) here 
+# Joyport option: If joystick is enabled above, set the port (0 - 3) here
 
 joyport = 0
 
 
 joyport = 0