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/clock.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/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/settings.o \
obj/tom.o \
obj/unzip.o \
- obj/version.o \
obj/video.o \
obj/vj.o \
$(ICON)
//#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))
//#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) {\
// 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,
{
/*
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
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));
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;
-
+
// apply data comparator
// Note: DCOMPEN only works in 8/16 bpp modes! !!! FIX !!!
// Does BCOMPEN only work in 1 bpp mode???
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 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 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 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 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 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
// 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
// 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]
-// 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
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
//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);
- if (SRCSHADE)
+ if (SRCSHADE)
{
int intensity = srcdata & 0xFF;
int ia = gd_ia >> 16;
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));
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;
-
+
// apply data comparator
//NOTE: The bit comparator (BCOMPEN) is NOT the same at the data comparator!
if (DCOMPEN | BCOMPEN)
// if (a1_phrase_mode || a2_phrase_mode)
// inhibit = !inhibit;
}
-
+
if (CLIPA1)
{
inhibit |= (((a1_x >> 16) < a1_clip_x && (a1_x >> 16) >= 0
// compute the write data and store
if (!inhibit)
- {
+ {
if (PATDSEL)
{
// use pattern data for write data
writedata |= srcdata & dstdata;
}
- if (GOURD)
+ if (GOURD)
writedata = ((gd_c[colour_index]) << 8) | (gd_i[colour_index] >> 16);
- if (SRCSHADE)
+ if (SRCSHADE)
{
int intensity = srcdata & 0xFF;
int ia = gd_ia >> 16;
; 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
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));
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;
// 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 pixelsize (1) to X
a2_xadd = 1 << 16;
break;
- case XADD0:
+ case XADD0:
// add zero (for those nice vertical lines)
a2_xadd = 0;
break;
| ((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;
WriteLog(" GOURZ = %i\n",GOURZ);
WriteLog(" GOURD = %i\n",GOURD);
WriteLog(" SRCSHADE= %i\n",SRCSHADE);
- }
+ }
#endif
//NOTE: Pitch is ignored!
//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]
- 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]
- 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]
- 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
; 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
; 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
; 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
; 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
; 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
********************** 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);
}
-void blitter_done(void)
+void BlitterDone(void)
{
WriteLog("BLIT: Done.\n");
}
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 0x88: break;
case 0x89: blitter_ram[PATTERNDATA + 1] = data; break;
case 0x8A: blitter_ram[SRCDATA + 0] = 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 0x98: blitter_ram[SRCZINT + 0] = data; break;
case 0x99: blitter_ram[SRCZINT + 1] = data; break;
case 0x9A: blitter_ram[SRCZFRAC + 0] = data; break;
//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_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));
}
// Figure out what gets written...
-
+
if (PATDSEL)
{
writeData = GET64(blitter_ram, PATTERNDATA);
else // LFUFUNC is the default...
{
writeData = 0;
-
+
if (LFU_NAN)
writeData |= ~srcData & ~dstData;
if (LFU_NA)
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);
&& 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;//*/
#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;
; 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
; 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
*/
// Bugs in Jaguar I
-
+
a2addy = a1addy; // A2 channel Y add bit is tied to A1's
//if (logBlit && (ocount > 20)) logBlit = false;
(uint32)(srcz2 >> 32), (uint32)(srcz2 & 0xFFFFFFFF),
(uint32)(dstz >> 32), (uint32)(dstz & 0xFFFFFFFF), zinc, collision);
}
-#endif
+#endif
// Various state lines set up by user
while (true)
{
// IDLE
-
+
if ((idle && !go) || (inner && outer0 && indone))
{
#ifdef VERBOSE_BLITTER_LOGGING
}
else
idlei = false;
-
+
// INNER LOOP ACTIVE
/*
Entering DWRITE state... (icount=0000, inc=4)
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)
}
else
inneri = false;
-
+
// A1 FRACTION UPDATE
-
+
if (inner && indone && !outer0 && upda1f)
{
a1fupdatei = true;
}
else
a2updatei = false;
-
+
// INITIALIZE INTENSITY FRACTION
-
+
if ((zupdate && !upda2 && datinit)
|| (a1update && !upda2 && datinit && notgzandp)
|| (inner && indone && !outer0 && !upda1f && !upda1 && notgzandp && !upda2 && datinit)
}
else
init_ifi = false;
-
+
// INITIALIZE INTENSITY INTEGER
-
+
if (init_if)
{
init_iii = true;
}
else
init_iii = false;
-
+
// INITIALIZE Z FRACTION
-
+
if (init_ii && gourz)
{
init_zfi = true;
}
else
init_zfi = false;
-
+
// INITIALIZE Z INTEGER
-
+
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...
/* 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)
-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
-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
+ 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
|| (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[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
-Source z2 is loaded on
+Source z2 is loaded on
dzwrite . gourz . atick[0]
+ zstepfadd
+ init_zf
/* 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
-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.
//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
}
#endif
}
-
+
if (a2update)
{
#ifdef VERBOSE_BLITTER_LOGGING
#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),
#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),
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
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 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 */
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);
/* 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_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);*/
/** 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.
*/
{
/*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]);
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]
suba_x
suba_y
- :IN);
+ :IN);
BEGIN
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
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]);*/
-// 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.
// 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
//////////////////////////////////////////////////////////////////////////////////////
// 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,
// 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
//////////////////////////////////////////////////////////////////////////////////////
/* 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);
/** 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
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
-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
-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
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 //////////////////////////////////////
/* 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
-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
//////////////////////////////////////////////////////////////////////////////////////
/* 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
+//
+// Jaguar blitter implementation
+//
+
#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);
#include "dac.h"
#include "SDL.h"
-#include "m68k.h"
+#include "gui.h"
#include "jaguar.h"
-#include "settings.h"
#include "log.h"
+#include "m68k.h"
+#include "settings.h"
//#define DEBUG_DAC
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;
}
}//*/
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;
}
}//*/
// 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;
}
}
#include "dsp.h"
+#include <SDL.h> // Used only for SDL_GetTicks...
#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 "jaguar.h"
+#include "jerry.h"
+#include "log.h"
#include "m68k.h"
+#include "memory.h"
//#define DSP_DEBUG
//#define DSP_DEBUG_IRQ
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_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_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_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] =
{
- 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, 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,
- 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!)...
-/*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,
};//*/
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,
uint32 dsp_opcode_use[65];
const char * dsp_opcode_str[65]=
-{
+{
"add", "addc", "addq", "addqt",
"sub", "subc", "subq", "subqt",
"neg", "and", "or", "xor",
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];
dsp_opcode_use[i] = 0;
}
-void dsp_releaseTimeslice(void)
+void DSPReleaseTimeslice(void)
{
//This does absolutely nothing!!! !!! FIX !!!
dsp_releaseTimeSlice_flag = 1;
}
return JaguarReadByte(offset, who);
-}
+}
uint16 DSPReadWord(uint32 offset, uint32 who/*=UNKNOWN*/)
{
{
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
//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;
//!!!!!!!!
break;
case 0x14:
- {
+ {
//#ifdef DSP_DEBUG
WriteLog("Write to DSP CTRL by %s: %08X\n", whoName[who], data);
//#endif
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;
WriteLog("DSP: CPU -> DSP interrupt\n");
#endif
m68k_end_timeslice();
- gpu_releaseTimeslice();
+ GPUReleaseTimeslice();
DSPSetIRQLine(DSPIRQ_CPU, ASSERT_LINE);
data &= ~DSPINT0;
}
if (who == M68K)
m68k_end_timeslice();
else if (who == GPU)
- gpu_releaseTimeslice();
+ GPUReleaseTimeslice();
if (!wasRunning)
FlushDSPPipeline();
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)
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!
#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!
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)
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!
#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!
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);
- // 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);
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)
{
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);
#endif
uint32 _Rn = RN;
uint32 res;
-
+
if (_Rn == 0x80000000)
dsp_flag_n = 1;
else
#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;
-
+
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);
}
-void dsp_opcode_sat32s(void)
+void dsp_opcode_sat32s(void)
{
int32 r2 = (uint32)RN;
int32 temp = dsp_acc >> 32;
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;
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_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_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_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);
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 (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)
{
// 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)
{
// 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)
{
#endif
}
-static void DSP_mirror(void)
+static void DSP_mirror(void)
{
uint32 r1 = PRN;
PRES = (mirror_table[r1 & 0xFFFF] << 16) | mirror_table[r1 >> 16];
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);
#endif
}
-static void DSP_sat16s(void)
+static void DSP_sat16s(void)
{
int32 r2 = PRN;
uint32 res = (r2 < -32768) ? -32768 : (r2 > 32767) ? 32767 : r2;
SET_ZN(res);
}
-static void DSP_sat32s(void)
+static void DSP_sat32s(void)
{
int32 r2 = (uint32)PRN;
int32 temp = dsp_acc >> 32;
#endif
}
-static void DSP_subqmod(void)
+static void DSP_subqmod(void)
{
uint32 r1 = dsp_convert_zero[PIMM1];
uint32 r2 = PRN;
#ifndef __DSP_H__
#define __DSP_H__
-//#include "jaguar.h"
#include "types.h"
#define DSP_CONTROL_RAM_BASE 0x00F1A100
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);
//
-// EEPROM handler
+// Jaguar EEPROM handler
//
// by Cal2
// GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
#include "eeprom.h"
-#include <string.h> // For memset
#include <stdlib.h>
-#include "settings.h"
-#include "log.h"
+#include <string.h> // For memset
#include "jaguar.h"
+#include "log.h"
+#include "settings.h"
#define eeprom_LOG
// 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,
// 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;
-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: Could not open file \"%s\"!\n", eeprom_filename);
}
-void eeprom_reset(void)
+void EepromReset(void)
{
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;
}
- 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)
{
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;
}
-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)
{
}
}
-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);
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;
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--;
}
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;
jerry_writes_enabled = 1;
}
-uint32 eeprom_get_do(void)
+static uint32 eeprom_get_do(void)
{
uint16 data = 1;
#ifndef __EEPROM_H__
#define __EEPROM_H__
-//#include "jaguar.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__
// - Handling for an event that occurs NOW
//
-#include "clock.h"
+#include "event.h"
#include "log.h"
//
-// CLOCK.H: System timing support functionality
+// EVENT.H: System timing support functionality
//
// by James L. Hammons
//
-#ifndef __CLOCK_H__
-#define __CLOCK_H__
+#ifndef __EVENT_H__
+#define __EVENT_H__
#include "types.h"
double GetTimeToNextEvent(void);
void HandleNextEvent(void);
-#endif // __CLOCK_H__
+#endif // __EVENT_H__
#include "gpu.h"
-#include <string.h> // For memset
#include <stdlib.h>
-#include "log.h"
+#include <string.h> // For memset
+#include "dsp.h"
+#include "jagdasm.h"
#include "jaguar.h"
+#include "log.h"
#include "m68k.h"
-#include "tom.h"
#include "memory.h"
-#include "jagdasm.h"
-#include "dsp.h"
+#include "tom.h"
//#define GPU_DEBUG
// Private function prototypes
void GPUUpdateRegisterBanks(void);
-
void GPUDumpDisassembly(void);
void GPUDumpRegisters(void);
void GPUDumpMemory(void);
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,
//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, 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
};//*/
-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,
#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)
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",
static uint32 gpu_in_exec = 0;
static uint32 gpu_releaseTimeSlice_flag = 0;
-void gpu_releaseTimeslice(void)
+void GPUReleaseTimeslice(void)
{
gpu_releaseTimeSlice_flag = 1;
}
-uint32 gpu_get_pc(void)
+uint32 GPUGetPC(void)
{
return gpu_pc;
}
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;
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);
#endif // GPU_DEBUG
break;
case 0x14:
- {
+ {
// uint32 gpu_was_running = GPU_RUNNING;
data &= ~0xF7C0; // Disable writes to INT_LAT0-4 & TOM version number
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
- gpu_releaseTimeslice();
+ GPUReleaseTimeslice();
}
}
data &= ~0x02;
//WriteLog("CPU->GPU interrupt\n");
GPUSetIRQLine(0, ASSERT_LINE);
m68k_end_timeslice();
- dsp_releaseTimeslice();
+ DSPReleaseTimeslice();
data &= ~0x04;
}
{
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)
- gpu_exec(1);
+ GPUExec(1);
#endif // #ifndef GPU_SINGLE_STEPPING
#ifdef GPU_DEBUG
WriteLog("Write to GPU CTRL by %s: %08X ", whoName[who], data);
for(int x=0; x<2; x++)
{
JaguarWriteLong(dst, JaguarReadLong(src));
-
+
src += 4;
dst += 4;
}
// 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;
-
+
// Determine which interrupt to service
uint32 which = 0; //Isn't there a #pragma to disable this warning???
if (bits & 0x01)
if (start_logging)
WriteLog("GPU: Generating IRQ #%i\n", which);
- // set the interrupt flag
+ // set the interrupt flag
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);
-
- // 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);
}
//#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");
build_branch_condition_table();
- gpu_reset();
+ GPUReset();
//TEMPORARY: Testing only!
// gpu2_init();
// gpu3_init();
}
-void gpu_reset(void)
+void GPUReset(void)
{
// GPU registers (directly visible)
gpu_flags = 0x00000000;
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;
}
-void gpu_reset_stats(void)
+void GPUResetStats(void)
{
for(uint32 i=0; i<64; i++)
gpu_opcode_use[i] = 0;
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");
- // 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);
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;
/* 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...
// 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)
{
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;
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;
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);
#ifndef __GPU_H__
#define __GPU_H__
-//#include "jaguar.h"
#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 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)
#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 <sys/types.h> // For MacOS <dirent.h> dependency
+#include <dirent.h>
#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 "crc32.h"
-#include "sdlemu_opengl.h"
-#include "log.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
// GUI stuff--it's not crunchy, it's GUI! ;-)
//
-void InitGUI(void)
+void GUIInit(void)
{
SDL_ShowCursor(SDL_DISABLE);
SDL_GetMouseState(&mouseX, &mouseY);
//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
- for(uint32 i=0; i<tom_getVideoModeWidth()*240; i++)
+ for(uint32 i=0; i<TOMGetVideoModeWidth()*240; i++)
// background[i] = 0xFF8C4210;
backbuffer[i] = 0xFF8C4210;
}
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
Window * ResetJaguar(void)
{
- jaguar_reset();
+ JaguarReset();
return RunEmu();
}
Window * ResetJaguarCD(void)
{
- memcpy(jaguar_mainRom, jaguar_CDBootROM, 0x40000);
+ memcpy(jaguarMainRom, jaguarCDBootROM, 0x40000);
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...
- jaguar_mainRom[0x0040B] = 0x03;
+ jaguarMainRom[0x0040B] = 0x03;
return RunEmu();
}
cartType = 0;
else if (jaguarRomSize == 0x400000)
cartType = 1;
- else if (jaguar_mainRom_crc32 == 0x687068D5)
+ else if (jaguarMainRomCRC32 == 0x687068D5)
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" };
//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)
{
{
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)
{
// 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;
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)
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;
+}
extern "C" {
#endif
-void InitGUI(void);
+void GUIInit(void);
void GUIDone(void);
bool GUIMain(char *);
+void GUICrashGracefully(const char *);
// Exported vars
extern bool showGUI;
-extern bool finished;
+extern bool exitGUI; // Hmm.
+extern bool finished; // Current emulator loop is finished
#ifdef __cplusplus
}
#include "jaguar.h"
-#include "video.h"
-#include "settings.h"
-//#include "m68kdasmAG.h"
-#include "clock.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 "event.h"
#include "gpu.h"
-#include "memory.h"
-#include "joystick.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...
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;
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();
- log_done();
+ LogDone();
exit(0);
}
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
// WriteLog("\n\n");
//endoftemp
- log_done();
+ LogDone();
exit(0);
}//*/
#endif
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))
- retVal = jaguar_mainRom[address - 0x800000];
+ retVal = jaguarMainRom[address - 0x800000];
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))
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))
- 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))
- 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))
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))
{
/* 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);
}
-uint32 jaguar_get_handler(uint32 i)
+uint32 JaguarGetHandler(uint32 i)
{
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)
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");
WriteLog("..................\n");
- if (tom_irq_enabled(IRQ_VBLANK))
+ if (TOMIRQEnabled(IRQ_VBLANK))
{
WriteLog("vblank int: enabled\n");
- jaguar_dasm(jaguar_get_handler(64), 0x200);
+ JaguarDasm(JaguarGetHandler(64), 0x200);
}
else
WriteLog("vblank int: disabled\n");
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));
}
//
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];
offset &= 0xFFFFFF;
if (offset < 0x400000)
- data = jaguar_mainRam[offset & 0x3FFFFF];
+ data = jaguarMainRam[offset & 0x3FFFFF];
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))
- 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))
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;
- 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))
- 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))
offset &= 0xFFFFFF;
if (offset < 0x400000)
{
- jaguar_mainRam[offset & 0x3FFFFF] = data;
+ jaguarMainRam[offset & 0x3FFFFF] = data;
return;
}
else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
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)
//
// 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
- 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, 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);
- gpu_init();
+ GPUInit();
DSPInit();
- tom_init();
- jerry_init();
+ TOMInit();
+ JERRYInit();
CDROMInit();
}
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)
- memcpy(jaguar_mainRam, jaguar_bootRom, 8);
+ memcpy(jaguarMainRam, jaguarBootRom, 8);
else
- SET32(jaguar_mainRam, 4, jaguarRunAddress);
+ SET32(jaguarMainRam, 4, jaguarRunAddress);
// WriteLog("jaguar_reset():\n");
- tom_reset();
- jerry_reset();
- gpu_reset();
+ TOMReset();
+ JERRYReset();
+ GPUReset();
DSPReset();
CDROMReset();
m68k_pulse_reset(); // Reset the 68000
// 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");
// 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();
- gpu_done();
+ GPUDone();
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);
}
//
//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...
- tom_set_pending_video_int();
+ TOMSetPendingVideoInt();
m68k_set_irq(7);
}
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);
- gpu_exec(RISCCyclesPerScanline);
+ GPUExec(RISCCyclesPerScanline);
if (vjs.DSPEnabled)
{
if (fp == NULL)
return;
- fwrite(jaguar_mainRam, 1, 0x400000, fp);
+ fwrite(jaguarMainRam, 1, 0x400000, fp);
fclose(fp);
}
uint8 * GetRamPtr(void)
{
- return jaguar_mainRam;
+ return jaguarMainRam;
}
//
//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)
{
//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...
- tom_set_pending_video_int();
+ TOMSetPendingVideoInt();
m68k_set_irq(7);
}
#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);
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...
// 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 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)
#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 "joystick.h"
+#include "dsp.h"
#include "eeprom.h"
+#include "event.h"
+#include "jaguar.h"
+#include "joystick.h"
#include "log.h"
-#include "cdrom.h"
+#include "wavetable.h"
//Note that 44100 Hz requires samples every 22.675737 usec.
#define NEW_TIMER_SYSTEM
//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
}
-void jerry_init(void)
+void JERRYInit(void)
{
// clock_init();
// anajoy_init();
JERRYPIT2Divider = 0xFFFF;
}
-void jerry_reset(void)
+void JERRYReset(void)
{
// clock_reset();
// anajoy_reset();
JoystickReset();
- eeprom_reset();
+ EepromReset();
JERRYResetI2S();
DACReset();
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);
// anajoy_done();
JoystickDone();
DACDone();
- eeprom_done();
+ EepromDone();
}
bool JERRYIRQEnabled(int irq)
// 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)
- return eeprom_byte_read(offset);
+ return EepromReadByte(offset);
return jerry_ram_8[offset & 0xFFFF];
}
// 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))
- 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]);//*/
else if ((offset >= 0xF14000) && (offset <= 0xF14003))
{
JoystickWriteByte(offset, data);
- eeprom_byte_write(offset, data);
+ EepromWriteByte(offset, data);
return;
}
else if ((offset >= 0xF14000) && (offset <= 0xF1A0FF))
{
- eeprom_byte_write(offset, data);
+ EepromWriteByte(offset, data);
return;
}
else if (offset >= 0xF14000 && offset < 0xF14003)
{
JoystickWriteWord(offset, data);
- eeprom_word_write(offset, data);
+ EepromWriteWord(offset, data);
return;
}
else if (offset >= 0xF14000 && offset <= 0xF1A0FF)
{
- eeprom_word_write(offset, data);
+ EepromWriteWord(offset, data);
return;
}
#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);
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)
#include "joystick.h"
-#include <time.h>
#include <SDL.h>
-#include "jaguar.h"
-#include "log.h"
+#include <time.h>
#include "gpu.h"
#include "gui.h"
+#include "jaguar.h"
+#include "log.h"
#include "settings.h"
#include "video.h"
void JoystickExec(void)
{
-// extern bool useJoystick;
uint8 * keystate = SDL_GetKeyState(NULL);
memset(joypad_0_buttons, 0, 21);
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();
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");
return 1;
}
-FILE * log_get(void)
+FILE * LogGet(void)
{
return log_stream;
}
-void log_done(void)
+void LogDone(void)
{
fclose(log_stream);
}
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
#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
alias->info = info;
}
-void InitMemory(void)
+void MemoryInit(void)
{
memoryInfo.next = memoryInfo.prev = NULL;
currentAllocatedMemory = maximumAllocatedMemory = 0;
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);
}
#ifndef __MEMORY_H__
#define __MEMORY_H__
-//This module needs some serious cleanup. !!! FIX !!!
#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);
#include <stdlib.h>
#include <string.h>
-#include "tom.h"
+#include "gpu.h"
#include "jaguar.h"
#include "log.h"
-#include "gpu.h"
#include "m68k.h"
+#include "tom.h"
//#define OP_DEBUG
//#define OP_DEBUG_BMP
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
//
// 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...
op_blend_cr[i] = (c2 << 4) | c1;
}
- op_reset();
+ OPReset();
}
//
// Object Processor reset
//
-void op_reset(void)
+void OPReset(void)
{
// 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)", "?", "?", "?" };
- 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("\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)
- 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");
}
#endif
-uint32 op_get_list_pointer(void)
+uint32 OPGetListPointer(void)
{
// 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]
-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]
-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
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);
// char * condition_to_str[8] =
// { "==", "<", ">", "(opflag set)", "(second half line)", "?", "?", "?" };
- op_pointer = op_get_list_pointer();
+ op_pointer = OPGetListPointer();
// objectp_stop_reading_list = false;
// *** 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;
-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 ((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)?
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;
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("%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");
}//*/
-
+
switch ((uint8)p0 & 0x07)
{
case OBJECT_TYPE_BITMAP:
// *** 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]);
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)
{
- uint64 p1 = op_load_phrase(op_pointer);
+ uint64 p1 = OPLoadPhrase(op_pointer);
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);
//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...
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 !!!
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)
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");
- fclose(log_get());
+// fclose(log_get());
+ LogDone();
exit(0);
break;
default:
//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)
{
- 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...
}
// break;
}
default:
- WriteLog("op: unknown object type %i\n", ((uint8)p0 & 0x07));
+ WriteLog("op: unknown object type %i\n", ((uint8)p0 & 0x07));
return;
}
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;
(!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
//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.
// (i.e., mem-to-mem direct copying)!
*(uint16 *)currentLineBuffer = paletteRAM16[index | bit];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[(index | bit) << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bit) << 1) + 1]);
}
if (!flagRMW)
*(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
}
if (!flagRMW)
*(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
}
if (!flagRMW)
*(uint16 *)currentLineBuffer = paletteRAM16[bits];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[bits << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[(bits << 1) + 1]);
}
*currentLineBuffer = bitsHi,
*(currentLineBuffer + 1) = bitsLo;
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, bitsHi),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), bitsLo);
}
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;
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
// 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];
// (i.e., mem-to-mem direct copying)!
*(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
}
// (i.e., mem-to-mem direct copying)!
*(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
}
// (i.e., mem-to-mem direct copying)!
*(uint16 *)currentLineBuffer = paletteRAM16[index | bits];
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[(index | bits) << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[((index | bits) << 1) + 1]);
}
*(uint16 *)currentLineBuffer = paletteRAM16[bits];
}*/
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, paletteRAM[bits << 1]),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), paletteRAM[(bits << 1) + 1]);
}
*currentLineBuffer = bitsHi,
*(currentLineBuffer + 1) = bitsLo;
else
- *currentLineBuffer =
+ *currentLineBuffer =
BLEND_CR(*currentLineBuffer, bitsHi),
- *(currentLineBuffer + 1) =
+ *(currentLineBuffer + 1) =
BLEND_Y(*(currentLineBuffer + 1), bitsLo);
}
#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);
-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);
#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?
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:
- printf("GL_QUAD rendering\n\n");
+ WriteLog("GL_QUAD rendering\n\n");
break;
default:
- printf("GL_TRIANGLE rendering\n\n");
+ WriteLog("GL_TRIANGLE rendering\n\n");
break;
}
// glFlush();
SDL_GL_SwapBuffers();
// glFinish();
-
}
void sdlemu_close_opengl(void)
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.
+ 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.
+ int bpp;
// 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
- 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.
- 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
- 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.
}
// 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.
- 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
- 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);
{
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.
// 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.
- 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;
}
}
-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.
- 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.
- int bpp;
// 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
- 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.
- 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
- 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.
}
// 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.
- 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
- 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);
{
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.
// 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.
- 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;
}
}
+
+void * sdlemuGetOverlayPixels(void)
+{
+ return overlay->pixels;
+}
+
+Uint32 sdlemuGetOverlayWidthInPixels(void)
+{
+ return overlay->pitch / 4;
+}
+
+void sdlemuEnableOverlay(void)
+{
+ showOverlay = 1;
+}
+
+void sdlemuDisableOverlay(void)
+{
+ showOverlay = 0;
+}
#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 "settings.h"
-#include "clock.h"
+#include "event.h"
+#include "gpu.h"
#include "jaguar.h"
#include "log.h"
-#include "blitter.h"
#include "m68k.h"
+#include "objectp.h"
+#include "settings.h"
+#include "video.h"
#define NEW_TIMER_SYSTEM
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;
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;
-
+
CRY16ToRGB32[i] = 0xFF000000 | (b << 16) | (g << 8) | r;
MIX16ToRGB32[i] = CRY16ToRGB32[i];
}
MIX16ToRGB32[i] = RGB16ToRGB32[i];
}
-void tom_set_pending_jerry_int(void)
+void TOMSetPendingJERRYInt(void)
{
tom_jerry_int_pending = 1;
}
-void tom_set_pending_timer_int(void)
+void TOMSetPendingTimerInt(void)
{
tom_timer_int_pending = 1;
}
-void tom_set_pending_object_int(void)
+void TOMSetPendingObjectInt(void)
{
tom_object_int_pending = 1;
}
-void tom_set_pending_gpu_int(void)
+void TOMSetPendingGPUInt(void)
{
tom_gpu_int_pending = 1;
}
-void tom_set_pending_video_int(void)
+void TOMSetPendingVideoInt(void)
{
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
-uint16 tom_get_vdb(void)
+uint16 TOMGetVDB(void)
{
// This in NOT VDB!!!
-// return GET16(tom_ram_8, VBE);
- return GET16(tom_ram_8, VDB);
+// return GET16(tomRam8, VBE);
+ return GET16(tomRam8, VDB);
}
//
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...
- 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
- 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;
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...
- 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!
- 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;
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...
- 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!
- 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;
//
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;
//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...
- 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!
- 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)
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++;
{
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++;
-
- chrm = (color & 0xF000) >> 12;
+
+ chrm = (color & 0xF000) >> 12;
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 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);
-
+
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;
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++;
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++;
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++;
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)
{
- 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
- 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;
{
//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
{
/*
#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!
{
// 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;
- 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;
- for(uint32 i=0; i<tom_width; i++)
+ for(uint32 i=0; i<tomWidth; i++)
*currentLineBuffer++ = pixel;
}
//
// 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));
-// tom_calc_cry_rgb_mix_lut();
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();
-// memory_free(tom_ram_8);
+// memory_free(tomRam8);
// memory_free(tom_cry_rgb_mix_lut);
}
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 };
// 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...
-/* 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.
- 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);
// 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;//*/
// 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)
{
- 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
{
- 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;
else if (offset == 0xF00053)
return tom_timer_divider & 0xFF;
- return tom_ram_8[offset & 0x3FFF];
+ return tomRam8[offset & 0x3FFF];
}
//
{
// 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;
}
//
// 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;
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))
{
- 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)
- 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);
- 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)
{
- 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)
{
- return (tom_ram_8[0xE0] << 8) | tom_ram_8[0xE1];
+ return (tomRam8[0xE0] << 8) | tomRam8[0xE1];
}*/
// NEW:
#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_counter <= 0)
{
- tom_set_pending_timer_int();
+ TOMSetPendingTimerInt();
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();
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)
- if (tom_irq_enabled(IRQ_TIMER))
+ if (TOMIRQEnabled(IRQ_TIMER))
m68k_set_irq(7); // Generate 68K NMI
TOMResetPIT();
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);
//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);
-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 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);
// 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__
+++ /dev/null
-//
-// 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)
-{
-}
+++ /dev/null
-//
-// 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__
//
// 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();
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
mainSurfaceFlags = SDL_OPENGL;
-
}
else
{
// 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)
- memcpy(surface->pixels, backbuffer, 1280 * tom_getVideoModeHeight() * 4);
+ memcpy(surface->pixels, backbuffer, 1280 * TOMGetVideoModeHeight() * 4);
if (SDL_MUSTLOCK(surface))
SDL_UnlockSurface(surface);
//
void ToggleFullscreen(void)
{
+ // Set our internal variable, then toggle the SDL flag
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)
{
// 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);
#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);
// Cleanups/fixes/enhancements by James L. Hammons and Adam Green
//
-#include <time.h>
#include <SDL.h>
-#include "jaguar.h"
-#include "video.h"
+#include <time.h>
+#include "file.h"
#include "gui.h"
-#include "sdlemu_opengl.h"
-#include "settings.h" // Pull in "vjs" struct
+#include "jaguar.h"
#include "log.h"
-#include "version.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 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
+
// Private function prototypes
//
//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");
bool haveCart = false; // Assume there is no cartridge...!
- log_init("vj.log");
+ LogInit("vj.log");
LoadVJSettings(); // Get config file settings...
// Check the switches... ;-)
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");
- 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 = (JaguarLoadROM(jaguar_bootRom, vjs.jagBootPath) == 0x20000 ? true : false);
+ BIOSLoaded = (JaguarLoadROM(jaguarBootRom, vjs.jagBootPath) == 0x20000 ? true : false);
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
- SET32(jaguar_mainRam, 0, 0x00200000); // Set top of stack...
+ SET32(jaguarMainRam, 0, 0x00200000); // Set top of stack...
WriteLog("Initializing video subsystem...\n");
- InitVideo();
+ VideoInit();
WriteLog("Initializing GUI subsystem...\n");
- InitGUI();
+ GUIInit();
// Now with crunchy GUI goodness!
WriteLog("About to start GUI...\n");
// int fps = (1000 * totalFrames) / elapsedTime;
// WriteLog("VJ: Ran at an average of %i FPS.\n", fps);
- jaguar_done();
- VersionDone();
- MemoryDone();
+ JaguarDone();
VideoDone();
- log_done();
+ MemoryDone();
+ LogDone();
// Free SDL components last...!
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER);
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