diff --git a/src/burn/burnint.h b/src/burn/burnint.h index f39564acb..b41536cf8 100644 --- a/src/burn/burnint.h +++ b/src/burn/burnint.h @@ -163,10 +163,14 @@ extern UINT8 Debug_HiscoreInitted; extern UINT8 Debug_GenericTilesInitted; extern UINT8 DebugDev_8255PPIInitted; +extern UINT8 DebugDev_8257DMAInitted; extern UINT8 DebugDev_EEPROMInitted; extern UINT8 DebugDev_PandoraInitted; extern UINT8 DebugDev_SeibuSndInitted; +extern UINT8 DebugDev_SlapsticInitted; +extern UINT8 DebugDev_T5182Initted; extern UINT8 DebugDev_TimeKprInitted; +extern UINT8 DebugDev_Tms34061Initted; extern UINT8 DebugSnd_AY8910Initted; extern UINT8 DebugSnd_Y8950Initted; diff --git a/src/burn/debug_track.cpp b/src/burn/debug_track.cpp index ba6143519..e577252e4 100644 --- a/src/burn/debug_track.cpp +++ b/src/burn/debug_track.cpp @@ -9,10 +9,14 @@ UINT8 Debug_HiscoreInitted; UINT8 Debug_GenericTilesInitted; UINT8 DebugDev_8255PPIInitted; +UINT8 DebugDev_8257DMAInitted; UINT8 DebugDev_EEPROMInitted; UINT8 DebugDev_PandoraInitted; UINT8 DebugDev_SeibuSndInitted; +UINT8 DebugDev_SlapsticInitted; +UINT8 DebugDev_T5182Initted; UINT8 DebugDev_TimeKprInitted; +UINT8 DebugDev_Tms34061Initted; UINT8 DebugSnd_AY8910Initted; UINT8 DebugSnd_Y8950Initted; @@ -73,10 +77,14 @@ void DebugTrackerExit() if (Debug_GenericTilesInitted) bprintf(PRINT_ERROR, _T("GenericTiles Not Exited\n")); if (DebugDev_8255PPIInitted) bprintf(PRINT_ERROR, _T("Device 8255PPI Not Exited\n")); + if (DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("Device 8257DMA Not Exited\n")); 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_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 (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")); diff --git a/src/burn/devices/8257dma.cpp b/src/burn/devices/8257dma.cpp index c8b9d89b4..0e79e6ae2 100644 --- a/src/burn/devices/8257dma.cpp +++ b/src/burn/devices/8257dma.cpp @@ -87,6 +87,8 @@ static INT32 trigger_transfer = 0; void i8257Init() { + DebugDev_8257DMAInitted = 1; + // these aren't used atm. m_out_hrq_func = null_line; m_out_tc_func = null_line; @@ -105,6 +107,10 @@ void i8257Init() void i8257Config(UINT8 (*cpuread)(UINT16), void (*cpuwrite)(UINT16,UINT8), INT32 (*idle)(INT32), ior_in_functs *read_f, ior_out_functs *write_f) { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257Config called without init\n")); +#endif + m_in_memr_func = cpuread; m_out_memw_func = cpuwrite; @@ -122,15 +128,19 @@ void i8257Config(UINT8 (*cpuread)(UINT16), void (*cpuwrite)(UINT16,UINT8), INT32 void i8257Reset() { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257Reset called without init\n")); +#endif + trigger_transfer = 0; m_status &= 0xf0; m_mode = 0; i8257_update_status(); } -static int i8257_do_operation(int channel) +static INT32 i8257_do_operation(INT32 channel) { - int done = 0; + INT32 done = 0; UINT8 data; UINT8 mode = m_rwmode[channel]; @@ -183,14 +193,14 @@ static int i8257_do_operation(int channel) return done; } -static void i8257_timer(INT32 id, int param) +static void i8257_timer(INT32 id, INT32 param) { switch (id) { case TIMER_OPERATION: { - int i, channel = 0, rr; - int done; + INT32 i, channel = 0, rr; + INT32 done; rr = DMA_MODE_ROTPRIO(m_mode) ? m_rr : 0; for (i = 0; i < I8257_NUM_CHANNELS; i++) @@ -229,8 +239,8 @@ static void i8257_timer(INT32 id, int param) case TIMER_DRQ_SYNC: { - int channel = param >> 1; - int state = param & 0x01; + INT32 channel = param >> 1; + INT32 state = param & 0x01; /* normalize state */ if (state) @@ -253,6 +263,10 @@ static void i8257_timer(INT32 id, int param) void i8257_update_status() { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257_update_status called without init\n")); +#endif + UINT16 pending_transfer; /* no transfer is active right now; is there a transfer pending right now? */ @@ -277,6 +291,10 @@ static void i8257_prepare_msb_flip() UINT8 i8257Read(UINT8 offset) { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257Read called without init\n")); +#endif + UINT8 data = 0xFF; switch (offset & 0x0f) @@ -311,6 +329,10 @@ UINT8 i8257Read(UINT8 offset) void i8257Write(UINT8 offset, UINT8 data) { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257Write called without init\n")); +#endif + switch (offset & 0x0f) { case 0: @@ -360,15 +382,23 @@ void i8257Write(UINT8 offset, UINT8 data) } } -void i8257_drq_write(int channel, int state) +void i8257_drq_write(INT32 channel, INT32 state) { - int param = (channel << 1) | (state ? 1 : 0); +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257_drq_write called without init\n")); +#endif + + INT32 param = (channel << 1) | (state ? 1 : 0); i8257_timer(TIMER_DRQ_SYNC, param); } -void i8257_do_transfer(int) +void i8257_do_transfer(INT32) { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257_do_transfer called without init\n")); +#endif + if (trigger_transfer) i8257_update_status(); trigger_transfer = 0; @@ -376,6 +406,10 @@ void i8257_do_transfer(int) void i8257Scan() { +#if defined FBA_DEBUG + if (!DebugDev_8257DMAInitted) bprintf(PRINT_ERROR, _T("i8257Scan called without init\n")); +#endif + for (INT32 i = 0; i < I8257_NUM_CHANNELS; i++) { SCAN_VAR(m_registers[i * 2 + 0]); SCAN_VAR(m_registers[i * 2 + 1]); diff --git a/src/burn/devices/8257dma.h b/src/burn/devices/8257dma.h index edf4f20de..a3e6f4523 100644 --- a/src/burn/devices/8257dma.h +++ b/src/burn/devices/8257dma.h @@ -5,8 +5,8 @@ typedef void (*ior_out_functs)(UINT16 address, UINT8 data); void i8257Reset(); UINT8 i8257Read(UINT8 offset); void i8257Write(UINT8 offset, UINT8 data); -void i8257_drq_write(int channel, int state); -void i8257_do_transfer(int state); // call after last drq_write +void i8257_drq_write(INT32 channel, INT32 state); +void i8257_do_transfer(INT32 state); // call after last drq_write void i8257Init(); void i8257Config(UINT8 (*cpuread)(UINT16), void (*cpuwrite)(UINT16,UINT8), INT32 (*idle)(INT32), ior_in_functs *read_f, ior_out_functs *write_f); void i8257Scan(); diff --git a/src/burn/devices/sknsspr.cpp b/src/burn/devices/sknsspr.cpp index 960940457..80a040f25 100644 --- a/src/burn/devices/sknsspr.cpp +++ b/src/burn/devices/sknsspr.cpp @@ -22,15 +22,15 @@ #define SUPRNOVA_DECODE_BUFFER_SIZE 0x2000 -static int sprite_kludge_x, sprite_kludge_y; +static INT32 sprite_kludge_x, sprite_kludge_y; static UINT8 decodebuffer[0x2000]; -static int skns_rle_decode ( int romoffset, int size, UINT8*gfx_source, INT32 gfx_length ) +static INT32 skns_rle_decode ( INT32 romoffset, INT32 size, UINT8*gfx_source, INT32 gfx_length ) { UINT8 *src = gfx_source; INT32 srcsize = gfx_length; UINT8 *dst = decodebuffer; - int decodeoffset = 0; + INT32 decodeoffset = 0; while(size>0) { UINT8 code = src[(romoffset++)%srcsize]; @@ -52,7 +52,7 @@ static int skns_rle_decode ( int romoffset, int size, UINT8*gfx_source, INT32 gf return &src[romoffset%srcsize]-gfx_source; } -void skns_sprite_kludge(int x, int y) +void skns_sprite_kludge(INT32 x, INT32 y) { sprite_kludge_x = x; sprite_kludge_y = y; @@ -66,9 +66,9 @@ void skns_sprite_kludge(int x, int y) UINT16 zxd = 0x40-(zx_s>>2); \ UINT16 zys = 0x40-(zy_m>>2); \ UINT16 zyd = 0x40-(zy_s>>2); \ - int xs, ys, xd, yd, old, old2; \ - int step_spr = step; \ - int bxs = 0, bys = 0; \ + INT32 xs, ys, xd, yd, old, old2; \ + INT32 step_spr = step; \ + INT32 bxs = 0, bys = 0; \ INT32 clip_min_x = cliprect_min_x<<6; \ INT32 clip_max_x = (cliprect_max_x+1)<<6; \ INT32 clip_min_y = cliprect_min_y<<6; \ @@ -157,7 +157,7 @@ void skns_sprite_kludge(int x, int y) old2 += 0x40; \ } -static void blit_nf_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, int colour) +static void blit_nf_z(UINT16 *bitmap, const UINT8 *src, INT32 x, INT32 y, INT32 sx, INT32 sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, INT32 colour) { z_decls(sx); z_clamp_x_min(); @@ -171,7 +171,7 @@ static void blit_nf_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, in } } -static void blit_fy_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, int colour) +static void blit_fy_z(UINT16 *bitmap, const UINT8 *src, INT32 x, INT32 y, INT32 sx, INT32 sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, INT32 colour) { z_decls(sx); z_clamp_x_min(); @@ -185,7 +185,7 @@ static void blit_fy_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, in } } -static void blit_fx_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, int colour) +static void blit_fx_z(UINT16 *bitmap, const UINT8 *src, INT32 x, INT32 y, INT32 sx, INT32 sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, INT32 colour) { z_decls(sx); z_clamp_x_max(); @@ -199,7 +199,7 @@ static void blit_fx_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, in } } -static void blit_fxy_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, int colour) +static void blit_fxy_z(UINT16 *bitmap, const UINT8 *src, INT32 x, INT32 y, INT32 sx, INT32 sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, INT32 colour) { z_decls(sx); z_clamp_x_max(); @@ -213,7 +213,7 @@ static void blit_fxy_z(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, i } } -static void (*const blit_z[4])(UINT16 *bitmap, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, int colour) = { +static void (*const blit_z[4])(UINT16 *bitmap, const UINT8 *src, INT32 x, INT32 y, INT32 sx, INT32 sy, UINT16 zx_m, UINT16 zx_s, UINT16 zy_m, UINT16 zy_s, INT32 colour) = { blit_nf_z, blit_fy_z, blit_fx_z, @@ -258,18 +258,18 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram UINT32 *source = spriteram_source; UINT32 *finish = source + spriteram_size/4; - int group_x_offset[4]; - int group_y_offset[4]; - int group_enable; - int group_number; - int sprite_flip; - int sprite_x_scroll; - int sprite_y_scroll; - int disabled = sprite_regs[0x04/4] & 0x08; // RWR1 - int xsize,ysize, size, xpos=0,ypos=0, pri=0, romoffset, colour=0, xflip,yflip, joint; - int sx,sy; - int endromoffs=0, gfxlen; - int grow; + INT32 group_x_offset[4]; + INT32 group_y_offset[4]; + INT32 group_enable; + INT32 group_number; + INT32 sprite_flip; + INT32 sprite_x_scroll; + INT32 sprite_y_scroll; + INT32 disabled = sprite_regs[0x04/4] & 0x08; // RWR1 + INT32 xsize,ysize, size, xpos=0,ypos=0, pri=0, romoffset, colour=0, xflip,yflip, joint; + INT32 sx,sy; + INT32 endromoffs=0, gfxlen; + INT32 grow; UINT16 zoomx_m, zoomx_s, zoomy_m, zoomy_s; if ((!disabled)){ @@ -432,7 +432,7 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram // pickups etc. pri = 0x03 { - int NewColour = (colour<<8); + INT32 NewColour = (colour<<8); if (disable_priority) { NewColour += disable_priority; // jchan hack } else { @@ -446,7 +446,7 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram else { if (!xflip && !yflip) { - int xx,yy; + INT32 xx,yy; for (xx = 0; xx= cliprect_min_y)) { - int pix; + INT32 pix; pix = decodebuffer[xsize*yy+xx]; if (pix) bitmap[(sy+yy) * nScreenWidth + (sx+xx)] = pix+ NewColour; // change later @@ -465,7 +465,7 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram } } } else if (!xflip && yflip) { - int xx,yy; + INT32 xx,yy; sy -= ysize; for (xx = 0; xx= cliprect_min_y)) { - int pix; + INT32 pix; pix = decodebuffer[xsize*yy+xx]; if (pix) bitmap[(sy+(ysize-1-yy)) * nScreenWidth + (sx+xx)] = pix+ NewColour; // change later @@ -485,7 +485,7 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram } } } else if (xflip && !yflip) { - int xx,yy; + INT32 xx,yy; sx -= xsize; for (xx = 0; xx= cliprect_min_y)) { - int pix; + INT32 pix; pix = decodebuffer[xsize*yy+xx]; if (pix) bitmap[(sy+yy) * nScreenWidth + (sx+(xsize-1-xx))] = pix+ NewColour; // change later @@ -505,7 +505,7 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram } } } else if (xflip && yflip) { - int xx,yy; + INT32 xx,yy; sx -= xsize; sy -= ysize; @@ -517,7 +517,7 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram { if ((sy+(ysize-1-yy) < (cliprect_max_y+1)) && (sy+(ysize-1-yy) >= cliprect_min_y)) { - int pix; + INT32 pix; pix = decodebuffer[xsize*yy+xx]; if (pix) bitmap[(sy+(ysize-1-yy)) * nScreenWidth + (sx+(xsize-1-xx))] = pix+ NewColour; // change later @@ -533,4 +533,3 @@ void skns_draw_sprites(UINT16 *bitmap, UINT32* spriteram_source, INT32 spriteram } } } - diff --git a/src/burn/devices/sknsspr.h b/src/burn/devices/sknsspr.h index 2e42c1086..2ea55f548 100644 --- a/src/burn/devices/sknsspr.h +++ b/src/burn/devices/sknsspr.h @@ -1,2 +1,2 @@ -void skns_sprite_kludge(int x, int y); +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); diff --git a/src/burn/devices/slapstic.cpp b/src/burn/devices/slapstic.cpp index 224b47b5a..4d7d9b4a6 100644 --- a/src/burn/devices/slapstic.cpp +++ b/src/burn/devices/slapstic.cpp @@ -789,6 +789,10 @@ static struct slapstic_data slapstic; void SlapsticReset(void) { +#if defined FBA_DEBUG + if (!DebugDev_SlapsticInitted) bprintf(PRINT_ERROR, _T("SlapsticReset called without init\n")); +#endif + /* reset the chip */ state = DISABLED; @@ -799,6 +803,8 @@ void SlapsticReset(void) void SlapsticInit(INT32 chip) { + DebugDev_SlapsticInitted = 1; + /* only a small number of chips are known to exist */ if (chip < 101 || chip > 118) return; @@ -826,6 +832,10 @@ void SlapsticInit(INT32 chip) INT32 SlapsticBank(void) { +#if defined FBA_DEBUG + if (!DebugDev_SlapsticInitted) bprintf(PRINT_ERROR, _T("SlapsticBank called without init\n")); +#endif + return current_bank; } @@ -886,6 +896,10 @@ static INT32 alt2_kludge(UINT32 /*offset*/) INT32 SlapsticTweak(INT32 offset) { +#if defined FBA_DEBUG + if (!DebugDev_SlapsticInitted) bprintf(PRINT_ERROR, _T("SlapsticTweak called without init\n")); +#endif + /* reset is universal */ if (offset == 0x0000) { @@ -1099,6 +1113,10 @@ INT32 SlapsticTweak(INT32 offset) void SlapsticScan(INT32 nAction) { +#if defined FBA_DEBUG + if (!DebugDev_SlapsticInitted) bprintf(PRINT_ERROR, _T("SlapsticScan called without init\n")); +#endif + if (nAction & ACB_NVRAM) { SCAN_VAR(state); SCAN_VAR(current_bank); diff --git a/src/burn/devices/t5182.cpp b/src/burn/devices/t5182.cpp index cb229b58c..3c1e5b0b0 100644 --- a/src/burn/devices/t5182.cpp +++ b/src/burn/devices/t5182.cpp @@ -5,11 +5,11 @@ #include "burn_ym2151.h" // only used in t5182.c -static int irqstate; +static INT32 irqstate; static UINT8 *t5182RAM = NULL; -static int nCPU; -static int coin_frame; +static INT32 nCPU; +static INT32 coin_frame; // use externally UINT8 *t5182SharedRAM = NULL; // allocate externally @@ -21,6 +21,10 @@ UINT8 t5182_coin_input; void t5182_setirq_callback(INT32 param) { +#if defined FBA_DEBUG + if (!DebugDev_T5182Initted) bprintf(PRINT_ERROR, _T("t5182_setirq_callback called without init\n")); +#endif + switch (param) { case YM2151_ASSERT: @@ -113,6 +117,10 @@ static void t5182YM2151IrqHandler(INT32 Irq) void t5182Reset() { +#if defined FBA_DEBUG + if (!DebugDev_T5182Initted) bprintf(PRINT_ERROR, _T("t5182Reset called without init\n")); +#endif + ZetOpen(nCPU); ZetReset(); ZetClose(); @@ -127,8 +135,10 @@ void t5182Reset() irqstate = 0; } -void t5182Init(int nZ80CPU, int clock) +void t5182Init(INT32 nZ80CPU, INT32 clock) { + DebugDev_T5182Initted = 1; + nCPU = nZ80CPU; t5182RAM = (UINT8*)BurnMalloc(0x800); @@ -137,11 +147,11 @@ void t5182Init(int nZ80CPU, int clock) ZetOpen(nCPU); ZetMapMemory(t5182ROM + 0x0000, 0x0000, 0x1fff, ZET_ROM); - for (int i = 0x2000; i < 0x4000; i += 0x800) { + for (INT32 i = 0x2000; i < 0x4000; i += 0x800) { ZetMapMemory(t5182RAM, i, i + 0x7ff, ZET_RAM); // internal ram } - for (int i = 0x4000; i < 0x8000; i += 0x100) { + for (INT32 i = 0x4000; i < 0x8000; i += 0x100) { ZetMapMemory(t5182SharedRAM, i, i + 0x0ff, ZET_RAM); // shared ram } @@ -159,6 +169,10 @@ void t5182Init(int nZ80CPU, int clock) void t5182Exit() { +#if defined FBA_DEBUG + if (!DebugDev_T5182Initted) bprintf(PRINT_ERROR, _T("t5182Exit called without init\n")); +#endif + BurnYM2151Exit(); if (nHasZet > 0) { @@ -174,6 +188,10 @@ void t5182Exit() INT32 t5182Scan(INT32 nAction) { +#if defined FBA_DEBUG + if (!DebugDev_T5182Initted) bprintf(PRINT_ERROR, _T("t5182Scan called without init\n")); +#endif + struct BurnArea ba; if (nAction & ACB_VOLATILE) { diff --git a/src/burn/devices/t5182.h b/src/burn/devices/t5182.h index 72a888239..ca020387e 100644 --- a/src/burn/devices/t5182.h +++ b/src/burn/devices/t5182.h @@ -20,6 +20,6 @@ extern UINT8 t5182_coin_input; // coin input in driver void t5182_setirq_callback(INT32 param); void t5182Reset(); -void t5182Init(int nZ80CPU, int clock); +void t5182Init(INT32 nZ80CPU, INT32 clock); void t5182Exit(); INT32 t5182Scan(INT32 nAction); diff --git a/src/burn/devices/tms34061.cpp b/src/burn/devices/tms34061.cpp index 309a7504c..b50bbea34 100644 --- a/src/burn/devices/tms34061.cpp +++ b/src/burn/devices/tms34061.cpp @@ -59,6 +59,10 @@ INT32 tms34061_current_scanline; void tms34061_reset() { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_reset called without init\n")); +#endif + memset (m_vram, 0, m_vramsize); memset (m_latchram, 0, m_vramsize); @@ -88,6 +92,8 @@ void tms34061_reset() void tms34061_init(UINT8 rowshift, UINT32 ram_size, void (*partial_update)(), void (*callback)(INT32 state)) { + DebugDev_Tms34061Initted = 1; + m_partial_update = partial_update; m_rowshift = rowshift; m_vramsize = ram_size; @@ -114,6 +120,10 @@ void tms34061_init(UINT8 rowshift, UINT32 ram_size, void (*partial_update)(), vo void tms34061_exit() { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_exit called without init\n")); +#endif + BurnFree(m_vram); m_vram = NULL; BurnFree(m_latchram); @@ -142,6 +152,10 @@ static void update_interrupts() void tms34061_interrupt() { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_interrupt called without init\n")); +#endif + if (tms34061_current_scanline != m_timer) return; /* set the interrupt bit in the status reg */ @@ -398,6 +412,10 @@ static UINT8 xypixel_r(INT32 offset) void tms34061_write(INT32 col, INT32 row, INT32 func, UINT8 data) { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_write called without init\n")); +#endif + INT32 offs; /* the function code determines what to do */ @@ -457,6 +475,10 @@ void tms34061_write(INT32 col, INT32 row, INT32 func, UINT8 data) UINT8 tms34061_read(INT32 col, INT32 row, INT32 func) { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_read called without init\n")); +#endif + INT32 result = 0; INT32 offs; @@ -519,22 +541,38 @@ UINT8 tms34061_read(INT32 col, INT32 row, INT32 func) UINT8 tms34061_latch_read() { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_latch_read called without init\n")); +#endif + return m_latchdata; } void tms34061_latch_write(UINT8 data) { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_latch_write called without init\n")); +#endif + m_latchdata = data; } INT32 tms34061_display_blanked() { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_display_blanked called without init\n")); +#endif + return (~m_regs[TMS34061_CONTROL2] >> 13) & 1; } UINT8 *tms34061_get_vram_pointer() { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_get_vram_pointer called without init\n")); +#endif + return m_vram; } @@ -547,6 +585,10 @@ UINT8 *tms34061_get_vram_pointer() INT32 tms34061_scan(INT32 nAction, INT32 *) { +#if defined FBA_DEBUG + if (!DebugDev_Tms34061Initted) bprintf(PRINT_ERROR, _T("tms34061_scan called without init\n")); +#endif + struct BurnArea ba; if (nAction & ACB_VOLATILE) { diff --git a/src/burn/devices/vdc.cpp b/src/burn/devices/vdc.cpp index 15c61b7a1..3cdba68b0 100644 --- a/src/burn/devices/vdc.cpp +++ b/src/burn/devices/vdc.cpp @@ -190,11 +190,11 @@ void vce_palette_init(UINT32 *Palette) { for (INT32 i = 0; i < 512; i++) { - int r = ((i >> 3) & 7) << 5; - int g = ((i >> 6) & 7) << 5; - int b = ((i >> 0) & 7) << 5; + INT32 r = ((i >> 3) & 7) << 5; + INT32 g = ((i >> 6) & 7) << 5; + INT32 b = ((i >> 0) & 7) << 5; - int y = ((66 * r + 129 * g + 25 * b + 128) >> 8) + 16; + INT32 y = ((66 * r + 129 * g + 25 * b + 128) >> 8) + 16; Palette[0x000 + i] = BurnHighCol(r, g, b, 0); Palette[0x200 + i] = BurnHighCol(y, y, y, 0); @@ -246,11 +246,11 @@ void vce_reset() enum vdc_regs {MAWR = 0, MARR, VxR, reg3, reg4, CR, RCR, BXR, BYR, MWR, HSR, HDR, VPR, VDW, VCR, DCR, SOUR, DESR, LENR, DVSSR }; -static void conv_obj(int which, int i, int l, int hf, int vf, char *buf) +static void conv_obj(INT32 which, INT32 i, INT32 l, INT32 hf, INT32 vf, UINT8 *buf) { - int b0, b1, b2, b3, i0, i1, i2, i3, x; - int xi; - int tmp; + INT32 b0, b1, b2, b3, i0, i1, i2, i3, x; + INT32 xi; + INT32 tmp; l &= 0x0F; if(vf) l = (15 - l); @@ -277,33 +277,33 @@ static void conv_obj(int which, int i, int l, int hf, int vf, char *buf) } } -static void pce_refresh_sprites(int which, int line, UINT8 *drawn, UINT16 *line_buffer) +static void pce_refresh_sprites(INT32 which, INT32 line, UINT8 *drawn, UINT16 *line_buffer) { - int i; + INT32 i; UINT8 sprites_drawn = 0; /* Are we in greyscale mode or in color mode? */ - int color_base = vce_control & 0x80 ? 512 : 0; + INT32 color_base = vce_control & 0x80 ? 512 : 0; /* count up: Highest priority is Sprite 0 */ for(i = 0; i < 64; i++) { - static const int cgy_table[] = {16, 32, 64, 64}; + static const INT32 cgy_table[] = {16, 32, 64, 64}; - int obj_y = (vdc_sprite_ram[which][(i << 2) + 0] & 0x03FF) - 64; - int obj_x = (vdc_sprite_ram[which][(i << 2) + 1] & 0x03FF) - 32; - int obj_i = (vdc_sprite_ram[which][(i << 2) + 2] & 0x07FE); - int obj_a = (vdc_sprite_ram[which][(i << 2) + 3]); - int cgx = (obj_a >> 8) & 1; /* sprite width */ - int cgy = (obj_a >> 12) & 3; /* sprite height */ - int hf = (obj_a >> 11) & 1; /* horizontal flip */ - int vf = (obj_a >> 15) & 1; /* vertical flip */ - int palette = (obj_a & 0x000F); - int priority = (obj_a >> 7) & 1; - int obj_h = cgy_table[cgy]; - int obj_l = (line - obj_y); - int cgypos; - char buf[16]; + INT32 obj_y = (vdc_sprite_ram[which][(i << 2) + 0] & 0x03FF) - 64; + INT32 obj_x = (vdc_sprite_ram[which][(i << 2) + 1] & 0x03FF) - 32; + INT32 obj_i = (vdc_sprite_ram[which][(i << 2) + 2] & 0x07FE); + INT32 obj_a = (vdc_sprite_ram[which][(i << 2) + 3]); + INT32 cgx = (obj_a >> 8) & 1; /* sprite width */ + INT32 cgy = (obj_a >> 12) & 3; /* sprite height */ + INT32 hf = (obj_a >> 11) & 1; /* horizontal flip */ + INT32 vf = (obj_a >> 15) & 1; /* vertical flip */ + INT32 palette = (obj_a & 0x000F); + INT32 priority = (obj_a >> 7) & 1; + INT32 obj_h = cgy_table[cgy]; + INT32 obj_l = (line - obj_y); + INT32 cgypos; + UINT8 buf[16]; if ((obj_y == -64) || (obj_y > line)) continue; if ((obj_x == -32) || (obj_x >= vdc_width[which])) continue; @@ -342,8 +342,8 @@ static void pce_refresh_sprites(int which, int line, UINT8 *drawn, UINT16 *line_ if(cgx == 0) { - int x; - int pixel_x = ( ( obj_x * 512 ) / vdc_width[which] ); + INT32 x; + INT32 pixel_x = ( ( obj_x * 512 ) / vdc_width[which] ); conv_obj(which, obj_i + (cgypos << 2), obj_l, hf, vf, buf); @@ -393,8 +393,8 @@ static void pce_refresh_sprites(int which, int line, UINT8 *drawn, UINT16 *line_ } else { - int x; - int pixel_x = ( ( obj_x * 512 ) / vdc_width[which] ); + INT32 x; + INT32 pixel_x = ( ( obj_x * 512 ) / vdc_width[which] ); conv_obj(which, obj_i + (cgypos << 2) + (hf ? 2 : 0), obj_l, hf, vf, buf); @@ -506,12 +506,12 @@ static void pce_refresh_sprites(int which, int line, UINT8 *drawn, UINT16 *line_ } -static void draw_overscan_line(int line) +static void draw_overscan_line(INT32 line) { - int i; + INT32 i; /* Are we in greyscale mode or in color mode? */ - int color_base = vce_control & 0x80 ? 512 : 0; + INT32 color_base = vce_control & 0x80 ? 512 : 0; /* our line buffer */ UINT16 *line_buffer = vdc_tmp_draw + line * 684; //&vce.bmp->pix16(line); @@ -520,12 +520,12 @@ static void draw_overscan_line(int line) line_buffer[i] = color_base + vce_data[0x100]; } -static void draw_sgx_overscan_line(int line) +static void draw_sgx_overscan_line(INT32 line) { - int i; + INT32 i; /* Are we in greyscale mode or in color mode? */ - int color_base = vce_control & 0x80 ? 512 : 0; + INT32 color_base = vce_control & 0x80 ? 512 : 0; /* our line buffer */ UINT16 *line_buffer = vdc_tmp_draw + line * 684; //&vce.bmp->pix16(line); @@ -534,7 +534,7 @@ static void draw_sgx_overscan_line(int line) line_buffer[i] = color_base + vce_data[0]; } -static void draw_black_line(int line) +static void draw_black_line(INT32 line) { UINT16 *line_buffer = vdc_tmp_draw + line * 684; //&vce.bmp->pix16(line); @@ -542,9 +542,9 @@ static void draw_black_line(int line) line_buffer[i] = 0x400; // black } -static void vdc_advance_line(int which) +static void vdc_advance_line(INT32 which) { - int ret = 0; + INT32 ret = 0; vdc_curline[which] += 1; vdc_current_segment_line[which] += 1; @@ -600,7 +600,7 @@ static void vdc_advance_line(int which) /* do VRAM > SATB DMA if the enable bit is set or the DVSSR reg. was written to */ if( ( vdc_data[which][DCR] & DCR_DSR ) || vdc_dvssr_write[which] ) { - int i; + INT32 i; vdc_dvssr_write[which] = 0; @@ -648,7 +648,7 @@ static void vdc_advance_line(int which) /* do VRAM > SATB DMA if the enable bit is set or the DVSSR reg. was written to */ if ( ( vdc_data[which][DCR] & DCR_DSR ) || vdc_dvssr_write[which] ) { - int i; + INT32 i; vdc_dvssr_write[which] = 0; @@ -669,37 +669,37 @@ static void vdc_advance_line(int which) h6280SetIRQLine(0, H6280_IRQSTATUS_ACK); } -static void pce_refresh_line(int which, int /*line*/, int external_input, UINT8 *drawn, UINT16 *line_buffer) +static void pce_refresh_line(INT32 which, INT32 /*line*/, INT32 external_input, UINT8 *drawn, UINT16 *line_buffer) { - static const int width_table[4] = {5, 6, 7, 7}; + static const INT32 width_table[4] = {5, 6, 7, 7}; - int scroll_y = ( vdc_yscroll[which] & 0x01FF); - int scroll_x = (vdc_data[which][BXR] & 0x03FF); - int nt_index; + INT32 scroll_y = ( vdc_yscroll[which] & 0x01FF); + INT32 scroll_x = (vdc_data[which][BXR] & 0x03FF); + INT32 nt_index; /* is virtual map 32 or 64 characters tall ? (256 or 512 pixels) */ - int v_line = (scroll_y) & (vdc_data[which][MWR] & 0x0040 ? 0x1FF : 0x0FF); + INT32 v_line = (scroll_y) & (vdc_data[which][MWR] & 0x0040 ? 0x1FF : 0x0FF); /* row within character */ - int v_row = (v_line & 7); + INT32 v_row = (v_line & 7); /* row of characters in BAT */ - int nt_row = (v_line >> 3); + INT32 nt_row = (v_line >> 3); /* virtual X size (# bits to shift) */ - int v_width = width_table[(vdc_data[which][MWR] >> 4) & 3]; + INT32 v_width = width_table[(vdc_data[which][MWR] >> 4) & 3]; /* pointer to the name table (Background Attribute Table) in VRAM */ UINT8 *bat = &(vdc_vidram[which][nt_row << (v_width+1)]); /* Are we in greyscale mode or in color mode? */ - int color_base = vce_control & 0x80 ? 512 : 0; + INT32 color_base = vce_control & 0x80 ? 512 : 0; - int b0, b1, b2, b3; - int i0, i1, i2, i3; - int cell_pattern_index; - int cell_palette; - int x, c, i; + INT32 b0, b1, b2, b3; + INT32 i0, i1, i2, i3; + INT32 cell_pattern_index; + INT32 cell_palette; + INT32 x, c, i; /* character blanking bit */ if(!(vdc_data[which][CR] & CR_BB)) @@ -708,8 +708,8 @@ static void pce_refresh_line(int which, int /*line*/, int external_input, UINT8 } else { - int pixel = 0; - int phys_x = - ( scroll_x & 0x07 ); + INT32 pixel = 0; + INT32 phys_x = - ( scroll_x & 0x07 ); for(i=0;i<(vdc_width[which] >> 3) + 1;i++) { @@ -727,7 +727,7 @@ static void pce_refresh_line(int which, int /*line*/, int external_input, UINT8 /* byte-offset within the VRAM space */ cell_pattern_index = ( ( ( bat[nt_index + 1] << 8 ) | bat[nt_index] ) & 0x0FFF) << 5; - int vram_offs = (cell_pattern_index + (v_row << 1)) & 0xffff; + INT32 vram_offs = (cell_pattern_index + (v_row << 1)) & 0xffff; b0 = vdc_vidram[which][vram_offs + 0x00]; b1 = vdc_vidram[which][vram_offs + 0x01]; @@ -771,7 +771,7 @@ static void pce_refresh_line(int which, int /*line*/, int external_input, UINT8 void pce_interrupt() { - int which = 0; // only 1 on pce + INT32 which = 0; // only 1 on pce if (vce_current_bitmap_line >= 14 && vce_current_bitmap_line < 256) { @@ -814,7 +814,7 @@ void sgx_interrupt() UINT8 drawn[2][512]; UINT16 *line_buffer; UINT16 temp_buffer[2][512]; - int i; + INT32 i; memset( drawn, 0, sizeof(drawn) ); @@ -939,15 +939,15 @@ void sgx_interrupt() vdc_advance_line( 1 ); } -static void vdc_do_dma(int which) +static void vdc_do_dma(INT32 which) { - int src = vdc_data[which][0x10]; - int dst = vdc_data[which][0x11]; - int len = vdc_data[which][0x12]; + INT32 src = vdc_data[which][0x10]; + INT32 dst = vdc_data[which][0x11]; + INT32 len = vdc_data[which][0x12]; - int did = (vdc_data[which][0x0f] >> 3) & 1; - int sid = (vdc_data[which][0x0f] >> 2) & 1; - int dvc = (vdc_data[which][0x0f] >> 1) & 1; + INT32 did = (vdc_data[which][0x0f] >> 3) & 1; + INT32 sid = (vdc_data[which][0x0f] >> 2) & 1; + INT32 dvc = (vdc_data[which][0x0f] >> 1) & 1; do { UINT8 l, h; @@ -981,7 +981,7 @@ static void vdc_do_dma(int which) } } -void vdc_write(int which, UINT8 offset, UINT8 data) +void vdc_write(INT32 which, UINT8 offset, UINT8 data) { switch (offset & 3) { @@ -1044,7 +1044,7 @@ void vdc_write(int which, UINT8 offset, UINT8 data) case CR: { - static const unsigned char inctab[] = {1, 32, 64, 128}; + static const UINT8 inctab[] = {1, 32, 64, 128}; vdc_inc[which] = inctab[(data >> 3) & 3]; } break; @@ -1078,7 +1078,7 @@ void vdc_write(int which, UINT8 offset, UINT8 data) } } -UINT8 vdc_read(int which, UINT8 offset) +UINT8 vdc_read(INT32 which, UINT8 offset) { switch(offset & 3) { @@ -1144,7 +1144,7 @@ void vdc_reset() vdc_inc[1] = 1; } -void vdc_get_dimensions(int which, INT32 *x, INT32 *y) +void vdc_get_dimensions(INT32 which, INT32 *x, INT32 *y) { *x = vdc_width[which] * 2; *y = vdc_height[which]; diff --git a/src/burn/devices/vdc.h b/src/burn/devices/vdc.h index 7513bbd71..c3ab89827 100644 --- a/src/burn/devices/vdc.h +++ b/src/burn/devices/vdc.h @@ -1,8 +1,8 @@ // video void vdc_reset(); -void vdc_write(int which, UINT8 offset, UINT8 data); -UINT8 vdc_read(int which, UINT8 offset); +void vdc_write(INT32 which, UINT8 offset, UINT8 data); +UINT8 vdc_read(INT32 which, UINT8 offset); extern UINT8 *vdc_vidram[2]; extern UINT16 *vdc_tmp_draw;