// Originally by David Raingeard (cal2)
// GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
// Cleanups and endian wrongness amelioration by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -------------------------------------------------------------
+// JLH 01/16/2010 Created this log ;-)
+//
// Note: Endian wrongness probably stems from the MAME origins of this emu and
// the braindead way in which MAME handles memory. :-)
//
#include "jaguar.h"
#include "log.h"
#include "m68k.h"
+//#include "memory.h"
#include "objectp.h"
#include "settings.h"
#include "video.h"
uint8 tomRam8[0x4000];
uint32 tomWidth, tomHeight;
-static uint32 tom_timer_prescaler;
-static uint32 tom_timer_divider;
-static int32 tom_timer_counter;
+uint32 tomTimerPrescaler;
+uint32 tomTimerDivider;
+int32 tomTimerCounter;
//uint32 tom_scanline;
//uint32 hblankWidthInPixels = 0;
uint16 tom_jerry_int_pending, tom_timer_int_pending, tom_object_int_pending,
uint32 CRY16ToRGB32[0x10000];
uint32 MIX16ToRGB32[0x10000];
+#warning "This is not endian-safe. !!! FIX !!!"
void TOMFillLookupTables(void)
{
for(uint32 i=0; i<0x10000; i++)
b = (((uint32)bluecv[chrm][chrl]) * y) >> 8;
CRY16ToRGB32[i] = 0xFF000000 | (b << 16) | (g << 8) | r;
- MIX16ToRGB32[i] = CRY16ToRGB32[i];
+ MIX16ToRGB32[i] = (i & 0x01 ? RGB16ToRGB32[i] : CRY16ToRGB32[i]);
}
- for(uint32 i=0; i<0x10000; i++)
- if (i & 0x01)
- MIX16ToRGB32[i] = RGB16ToRGB32[i];
+// for(uint32 i=0; i<0x10000; i++)
+// if (i & 0x01)
+// MIX16ToRGB32[i] = RGB16ToRGB32[i];
}
void TOMSetPendingJERRYInt(void)
}
//Used in only one place (and for debug purposes): OBJECTP.CPP
+#warning "Used in only one place (and for debug purposes): OBJECTP.CPP !!! FIX !!!"
uint16 TOMGetVDB(void)
{
-// This in NOT VDB!!!
-// return GET16(tomRam8, VBE);
return GET16(tomRam8, VDB);
}
if (inActiveDisplayArea)
{
//NOTE: The following doesn't put BORDER color on the sides... !!! FIX !!!
-#warning The following doesn't put BORDER color on the sides... !!! FIX !!!
+#warning "The following doesn't put BORDER color on the sides... !!! FIX !!!"
if (vjs.renderType == RT_NORMAL)
scanline_render[TOMGetVideoMode()](TOMBackbuffer);
else//TV type render
tom_gpu_int_pending = 0;
tom_video_int_pending = 0;
- tom_timer_prescaler = 0; // TOM PIT is disabled
- tom_timer_divider = 0;
- tom_timer_counter = 0;
+ tomTimerPrescaler = 0; // TOM PIT is disabled
+ tomTimerDivider = 0;
+ tomTimerCounter = 0;
memcpy(scanline_render, scanline_render_normal, sizeof(scanline_render));
}
else if ((offset >= 0xF02200) && (offset < 0xF022A0))
return BlitterReadByte(offset, who);
else if (offset == 0xF00050)
- return tom_timer_prescaler >> 8;
+ return tomTimerPrescaler >> 8;
else if (offset == 0xF00051)
- return tom_timer_prescaler & 0xFF;
+ return tomTimerPrescaler & 0xFF;
else if (offset == 0xF00052)
- return tom_timer_divider >> 8;
+ return tomTimerDivider >> 8;
else if (offset == 0xF00053)
- return tom_timer_divider & 0xFF;
+ return tomTimerDivider & 0xFF;
return tomRam8[offset & 0x3FFF];
}
else if ((offset >= 0xF02200) && (offset < 0xF022A0))
return BlitterReadWord(offset, who);
else if (offset == 0xF00050)
- return tom_timer_prescaler;
+ return tomTimerPrescaler;
else if (offset == 0xF00052)
- return tom_timer_divider;
+ return tomTimerDivider;
offset &= 0x3FFF;
return (TOMReadByte(offset, who) << 8) | TOMReadByte(offset + 1, who);
}
else if (offset == 0xF00050)
{
- tom_timer_prescaler = (tom_timer_prescaler & 0x00FF) | (data << 8);
+ tomTimerPrescaler = (tomTimerPrescaler & 0x00FF) | (data << 8);
TOMResetPIT();
return;
}
else if (offset == 0xF00051)
{
- tom_timer_prescaler = (tom_timer_prescaler & 0xFF00) | data;
+ tomTimerPrescaler = (tomTimerPrescaler & 0xFF00) | data;
TOMResetPIT();
return;
}
else if (offset == 0xF00052)
{
- tom_timer_divider = (tom_timer_divider & 0x00FF) | (data << 8);
+ tomTimerDivider = (tomTimerDivider & 0x00FF) | (data << 8);
TOMResetPIT();
return;
}
else if (offset == 0xF00053)
{
- tom_timer_divider = (tom_timer_divider & 0xFF00) | data;
+ tomTimerDivider = (tomTimerDivider & 0xFF00) | data;
TOMResetPIT();
return;
}
}*/
else if (offset == 0xF00050)
{
- tom_timer_prescaler = data;
+ tomTimerPrescaler = data;
TOMResetPIT();
return;
}
else if (offset == 0xF00052)
{
- tom_timer_divider = data;
+ tomTimerDivider = data;
TOMResetPIT();
return;
}
offset &= 0x3FFF;
if (offset == 0x28) // VMODE (Why? Why not OBF?)
//Actually, we should check to see if the Enable bit of VMODE is set before doing this... !!! FIX !!!
-#warning Actually, we should check to see if the Enable bit of VMODE is set before doing this... !!! FIX !!!
+#warning "Actually, we should check to see if the Enable bit of VMODE is set before doing this... !!! FIX !!!"
objectp_running = 1;
if (offset >= 0x30 && offset <= 0x4E)
// Need to remove previous timer from the queue, if it exists...
RemoveCallback(TOMPITCallback);
- if (tom_timer_prescaler)
+ if (tomTimerPrescaler)
{
- double usecs = (float)(tom_timer_prescaler + 1) * (float)(tom_timer_divider + 1) * RISC_CYCLE_IN_USEC;
+ double usecs = (float)(tomTimerPrescaler + 1) * (float)(tomTimerDivider + 1) * RISC_CYCLE_IN_USEC;
SetCallbackTime(TOMPITCallback, usecs);
}
#endif
// once the timer system is stable.
void TOMExecPIT(uint32 cycles)
{
- if (tom_timer_prescaler)
+ if (tomTimerPrescaler)
{
- tom_timer_counter -= cycles;
+ tomTimerCounter -= cycles;
- if (tom_timer_counter <= 0)
+ if (tomTimerCounter <= 0)
{
TOMSetPendingTimerInt();
GPUSetIRQLine(GPUIRQ_TIMER, ASSERT_LINE); // GPUSetIRQLine does the 'IRQ enabled' checking