add debug tracking to sknsspr, v3021 and vdc

This commit is contained in:
Barry Harris 2014-04-20 20:46:42 +00:00
parent f64f30e549
commit 04e679e504
8 changed files with 147 additions and 4 deletions

View File

@ -167,10 +167,13 @@ extern UINT8 DebugDev_8257DMAInitted;
extern UINT8 DebugDev_EEPROMInitted;
extern UINT8 DebugDev_PandoraInitted;
extern UINT8 DebugDev_SeibuSndInitted;
extern UINT8 DebugDev_SknsSprInitted;
extern UINT8 DebugDev_SlapsticInitted;
extern UINT8 DebugDev_T5182Initted;
extern UINT8 DebugDev_TimeKprInitted;
extern UINT8 DebugDev_Tms34061Initted;
extern UINT8 DebugDev_V3021Initted;
extern UINT8 DebugDev_VDCInitted;
extern UINT8 DebugSnd_AY8910Initted;
extern UINT8 DebugSnd_Y8950Initted;

View File

@ -13,10 +13,13 @@ UINT8 DebugDev_8257DMAInitted;
UINT8 DebugDev_EEPROMInitted;
UINT8 DebugDev_PandoraInitted;
UINT8 DebugDev_SeibuSndInitted;
UINT8 DebugDev_SknsSprInitted;
UINT8 DebugDev_SlapsticInitted;
UINT8 DebugDev_T5182Initted;
UINT8 DebugDev_TimeKprInitted;
UINT8 DebugDev_Tms34061Initted;
UINT8 DebugDev_V3021Initted;
UINT8 DebugDev_VDCInitted;
UINT8 DebugSnd_AY8910Initted;
UINT8 DebugSnd_Y8950Initted;
@ -85,10 +88,13 @@ void DebugTrackerExit()
if (DebugDev_EEPROMInitted) bprintf(PRINT_ERROR, _T("Device EEPROM Not Exited\n"));
if (DebugDev_PandoraInitted) bprintf(PRINT_ERROR, _T("Device Pandora Not Exited\n"));
if (DebugDev_SeibuSndInitted) bprintf(PRINT_ERROR, _T("Device SeibuSnd Not Exited\n"));
if (DebugDev_SknsSprInitted) bprintf(PRINT_ERROR, _T("Device SknsSpr Not Exited\n"));
if (DebugDev_SlapsticInitted) bprintf(PRINT_ERROR, _T("Device Slapstic Not Exited\n"));
if (DebugDev_T5182Initted) bprintf(PRINT_ERROR, _T("Device T5182 Not Exited\n"));
if (DebugDev_TimeKprInitted) bprintf(PRINT_ERROR, _T("Device TimeKpr Not Exited\n"));
if (DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("Device TMS34061 Not Exited\n"));
if (DebugDev_V3021Initted) bprintf(PRINT_ERROR, _T("Device V3021 Not Exited\n"));
if (DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("Device VDC Not Exited\n"));
if (DebugSnd_AY8910Initted) bprintf(PRINT_ERROR, _T("Sound Module AY8910 Not Exited\n"));
if (DebugSnd_Y8950Initted) bprintf(PRINT_ERROR, _T("Sound Module Y8950 Not Exited\n"));

View File

@ -54,6 +54,10 @@ static INT32 skns_rle_decode ( INT32 romoffset, INT32 size, UINT8*gfx_source, IN
void skns_sprite_kludge(INT32 x, INT32 y)
{
#if defined FBA_DEBUG
if (!DebugDev_SknsSprInitted) bprintf(PRINT_ERROR, _T("skns_sprite_kludge called without init\n"));
#endif
sprite_kludge_x = x;
sprite_kludge_y = y;
}
@ -223,6 +227,10 @@ static void (*const blit_z[4])(UINT16 *bitmap, const UINT8 *src, INT32 x, INT32
// disable_priority is a hack to make jchan drawing a bit quicker (rather than moving the sprites around different bitmaps and adding colors
void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram_size, UINT8* gfx_source, INT32 gfx_length, UINT32* sprite_regs, INT32 disable_priority)
{
#if defined FBA_DEBUG
if (!DebugDev_SknsSprInitted) bprintf(PRINT_ERROR, _T("skns_draw_sprites called without init\n"));
#endif
/*- SPR RAM Format -**
16 bytes per sprite
@ -533,3 +541,17 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram
}
}
}
void skns_init()
{
DebugDev_SknsSprInitted = 1;
}
void skns_exit()
{
#if defined FBA_DEBUG
if (!DebugDev_SknsSprInitted) bprintf(PRINT_ERROR, _T("skns_exit called without init\n"));
#endif
DebugDev_SknsSprInitted = 0;
}

View File

@ -1,2 +1,4 @@
void skns_sprite_kludge(INT32 x, INT32 y);
void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram_size, UINT8* gfx_source, INT32 gfx_length, UINT32* sprite_regs, INT32 disable_priority);
void skns_init();
void skns_exit();

View File

@ -11,6 +11,10 @@ static UINT8 bcd(UINT8 data)
UINT8 v3021Read()
{
#if defined FBA_DEBUG
if (!DebugDev_V3021Initted) bprintf(PRINT_ERROR, _T("v3021Read called without init\n"));
#endif
UINT8 calr;
calr = (CalVal & CalMask) ? 1 : 0;
CalMask <<= 1;
@ -19,6 +23,10 @@ UINT8 v3021Read()
void v3021Write(UINT16 data)
{
#if defined FBA_DEBUG
if (!DebugDev_V3021Initted) bprintf(PRINT_ERROR, _T("v3021Write called without init\n"));
#endif
time_t nLocalTime = time(NULL);
tm* tmLocalTime = localtime(&nLocalTime);
@ -76,8 +84,26 @@ void v3021Write(UINT16 data)
}
}
void v3021Init()
{
DebugDev_V3021Initted = 1;
}
void v3021Exit()
{
#if defined FBA_DEBUG
if (!DebugDev_V3021Initted) bprintf(PRINT_ERROR, _T("v3021Exit called without init\n"));
#endif
DebugDev_V3021Initted = 0;
}
INT32 v3021Scan()
{
#if defined FBA_DEBUG
if (!DebugDev_V3021Initted) bprintf(PRINT_ERROR, _T("v3021Scan called without init\n"));
#endif
SCAN_VAR(CalVal);
SCAN_VAR(CalMask);
SCAN_VAR(CalCom);

View File

@ -3,4 +3,7 @@
UINT8 v3021Read();
void v3021Write(UINT16 data);
void v3021Init();
void v3021Exit();
INT32 v3021Scan();

View File

@ -52,6 +52,10 @@ static void vpc_update_prio_map()
void vpc_write(UINT8 offset, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vpc_write called without init\n"));
#endif
switch (offset & 0x07)
{
case 0x00: /* Priority register #0 */
@ -102,6 +106,10 @@ void vpc_write(UINT8 offset, UINT8 data)
UINT8 vpc_read(UINT8 offset)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vpc_read called without init\n"));
#endif
switch (offset & 0x07)
{
case 0x00: /* Priority register #0 */
@ -128,6 +136,10 @@ UINT8 vpc_read(UINT8 offset)
void vpc_reset()
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vpc_reset called without init\n"));
#endif
memset (vpc_prio, 0, 4);
memset (vpc_vdc0_enabled, 0, 4);
memset (vpc_vdc1_enabled, 0, 4);
@ -145,6 +157,10 @@ void vpc_reset()
UINT8 vce_read(UINT8 offset)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vce_read called without init\n"));
#endif
switch (offset & 7)
{
case 0x04:
@ -161,6 +177,10 @@ UINT8 vce_read(UINT8 offset)
void vce_write(UINT8 offset, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vce_write called without init\n"));
#endif
switch (offset & 7)
{
case 0x00:
@ -188,6 +208,10 @@ void vce_write(UINT8 offset, UINT8 data)
void vce_palette_init(UINT32 *Palette)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vce_palette_init called without init\n"));
#endif
for (INT32 i = 0; i < 512; i++)
{
INT32 r = ((i >> 3) & 7) << 5;
@ -203,6 +227,10 @@ void vce_palette_init(UINT32 *Palette)
void vce_reset()
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vce_reset called without init\n"));
#endif
memset (vce_data, 0, 512 * sizeof(UINT16));
vce_address = 0;
@ -361,7 +389,7 @@ static void pce_refresh_sprites(INT32 which, INT32 line, UINT8 *drawn, UINT16 *l
if ( vdc_width[which] != 512 )
{
int dp = 1;
INT32 dp = 1;
while ( pixel_x + dp < ( ( ( obj_x + x + 1 ) * 512 ) / vdc_width[which] ) )
{
drawn[pixel_x + dp] = i + 2;
@ -411,7 +439,7 @@ static void pce_refresh_sprites(INT32 which, INT32 line, UINT8 *drawn, UINT16 *l
line_buffer[pixel_x] = color_base + vce_data[0x100 + (palette << 4) + buf[x]];
if ( vdc_width[which] != 512 )
{
int dp = 1;
INT32 dp = 1;
while ( pixel_x + dp < ( ( ( obj_x + x + 1 ) * 512 ) / vdc_width[which] ) )
{
drawn[pixel_x + dp] = i + 2;
@ -470,7 +498,7 @@ static void pce_refresh_sprites(INT32 which, INT32 line, UINT8 *drawn, UINT16 *l
line_buffer[pixel_x] = color_base + vce_data[0x100 + (palette << 4) + buf[x]];
if ( vdc_width[which] != 512 )
{
int dp = 1;
INT32 dp = 1;
while ( pixel_x + dp < ( ( ( obj_x + x + 17 ) * 512 ) / vdc_width[which] ) )
{
drawn[pixel_x + dp] = i + 2;
@ -771,6 +799,10 @@ static void pce_refresh_line(INT32 which, INT32 /*line*/, INT32 external_input,
void pce_interrupt()
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("pce_interrupt called without init\n"));
#endif
INT32 which = 0; // only 1 on pce
if (vce_current_bitmap_line >= 14 && vce_current_bitmap_line < 256)
@ -805,6 +837,10 @@ void pce_interrupt()
void sgx_interrupt()
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("sgx_interrupt called without init\n"));
#endif
if (vce_current_bitmap_line >= 14 && vce_current_bitmap_line < 256)
{
draw_sgx_overscan_line(vce_current_bitmap_line);
@ -839,7 +875,7 @@ void sgx_interrupt()
for( i = 0; i < 512; i++ )
{
int cur_prio = vpc_prio_map[i];
INT32 cur_prio = vpc_prio_map[i];
if ( vpc_vdc0_enabled[cur_prio] )
{
@ -983,6 +1019,10 @@ static void vdc_do_dma(INT32 which)
void vdc_write(INT32 which, UINT8 offset, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vdc_write called without init\n"));
#endif
switch (offset & 3)
{
case 0x00:
@ -1080,6 +1120,10 @@ void vdc_write(INT32 which, UINT8 offset, UINT8 data)
UINT8 vdc_read(INT32 which, UINT8 offset)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vdc_read called without init\n"));
#endif
switch(offset & 3)
{
case 0x00: {
@ -1106,6 +1150,10 @@ UINT8 vdc_read(INT32 which, UINT8 offset)
void sgx_vdc_write(UINT8 offset, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("sgx_vdc_write called without init\n"));
#endif
if (vpc_vdc_select)
{
vdc_write( 1, offset, data );
@ -1118,11 +1166,19 @@ void sgx_vdc_write(UINT8 offset, UINT8 data)
UINT8 sgx_vdc_read(UINT8 offset)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("sgx_vdc_read called without init\n"));
#endif
return (vpc_vdc_select) ? vdc_read( 1, offset ) : vdc_read( 0, offset );
}
void vdc_reset()
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vdc_reset called without init\n"));
#endif
memset (vdc_register, 0, 2);
memset (vdc_data, 0, 2 * 32 * sizeof(UINT16));
memset (vdc_latch, 0, 2);
@ -1146,12 +1202,34 @@ void vdc_reset()
void vdc_get_dimensions(INT32 which, INT32 *x, INT32 *y)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vdc_get_dimensions called without init\n"));
#endif
*x = vdc_width[which] * 2;
*y = vdc_height[which];
}
void vdc_init()
{
DebugDev_VDCInitted = 1;
}
void vdc_exit()
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vdc_exit called without init\n"));
#endif
DebugDev_VDCInitted = 0;
}
INT32 vdc_scan(INT32 nAction, INT32 *pnMin)
{
#if defined FBA_DEBUG
if (!DebugDev_VDCInitted) bprintf(PRINT_ERROR, _T("vdc_scan called without init\n"));
#endif
struct BurnArea ba;
if (pnMin) {

View File

@ -14,6 +14,9 @@ void vdc_get_dimensions(INT32 which, INT32 *x, INT32 *y); // get resolution
void sgx_vdc_write(UINT8 offset, UINT8 data);
UINT8 sgx_vdc_read(UINT8 offset);
void vdc_init();
void vdc_exit();
// priority
void vpc_reset();