Fixed TC0180VCU device and converted taito_b.c to use this implementation (cleaning up video/taito_b.c)

Slightly refactored k056832 device to make possible postload call.
This commit is contained in:
Fabio Priuli 2009-12-28 09:14:05 +00:00
parent 45d1ff4d1e
commit 867f102827
6 changed files with 316 additions and 468 deletions

View File

@ -178,6 +178,7 @@ Notes:
#include "sound/2203intf.h" #include "sound/2203intf.h"
#include "sound/2610intf.h" #include "sound/2610intf.h"
#include "sound/okim6295.h" #include "sound/okim6295.h"
#include "video/taiicdev.h"
#include "includes/taito_b.h" #include "includes/taito_b.h"
static WRITE8_HANDLER( bankswitch_w ) static WRITE8_HANDLER( bankswitch_w )
@ -453,14 +454,13 @@ static WRITE16_HANDLER( spacedxo_tc0220ioc_w )
} }
#define TC0180VCU_MEMRW( ADDR ) \ #define TC0180VCU_MEMRW( ADDR ) \
AM_RANGE(ADDR+0x00000, ADDR+0x0ffff) AM_READWRITE(TC0180VCU_word_r, TC0180VCU_word_w) AM_BASE(&TC0180VCU_ram) \ AM_RANGE(ADDR+0x00000, ADDR+0x0ffff) AM_DEVREADWRITE("tc0180vcu", tc0180vcu_word_r, tc0180vcu_word_w) \
AM_RANGE(ADDR+0x10000, ADDR+0x1197f) AM_RAM AM_BASE(&taitob_spriteram) \ AM_RANGE(ADDR+0x10000, ADDR+0x1197f) AM_RAM AM_BASE(&taitob_spriteram) \
AM_RANGE(ADDR+0x11980, ADDR+0x137ff) AM_RAM \ AM_RANGE(ADDR+0x11980, ADDR+0x137ff) AM_RAM \
AM_RANGE(ADDR+0x13800, ADDR+0x13fff) AM_RAM AM_BASE(&taitob_scroll) \ AM_RANGE(ADDR+0x13800, ADDR+0x13fff) AM_DEVREADWRITE("tc0180vcu", tc0180vcu_scroll_r, tc0180vcu_scroll_w) \
AM_RANGE(ADDR+0x18000, ADDR+0x1801f) AM_READWRITE(taitob_v_control_r, taitob_v_control_w) \ AM_RANGE(ADDR+0x18000, ADDR+0x1801f) AM_DEVREADWRITE("tc0180vcu", tc0180vcu_ctrl_r, tc0180vcu_ctrl_w) \
AM_RANGE(ADDR+0x40000, ADDR+0x7ffff) AM_READWRITE(TC0180VCU_framebuffer_word_r, TC0180VCU_framebuffer_word_w) AM_RANGE(ADDR+0x40000, ADDR+0x7ffff) AM_READWRITE(tc0180vcu_framebuffer_word_r, tc0180vcu_framebuffer_word_w)
static ADDRESS_MAP_START( rastsag2_map, ADDRESS_SPACE_PROGRAM, 16 ) static ADDRESS_MAP_START( rastsag2_map, ADDRESS_SPACE_PROGRAM, 16 )
@ -2138,6 +2138,30 @@ static const tc0510nio_interface sbm_io_intf =
DEVCB_INPUT_PORT("JOY"), DEVCB_INPUT_PORT("START"), DEVCB_INPUT_PORT("PHOTOSENSOR") /* port read handlers */ DEVCB_INPUT_PORT("JOY"), DEVCB_INPUT_PORT("START"), DEVCB_INPUT_PORT("PHOTOSENSOR") /* port read handlers */
}; };
/* this is the basic layout used in: Nastar, Ashura Blaster, Hit the Ice, Rambo3, Tetris */
static const tc0180vcu_interface color0_tc0180vcu_intf =
{
0xc0, /* background */
0x80, /* foreground */
0x00 /* text */
};
/* this is the reversed layout used in: Crime City, Puzzle Bobble */
static const tc0180vcu_interface color1_tc0180vcu_intf =
{
0x00, /* background */
0x40, /* foreground */
0xc0 /* text */
};
/* this is used in: rambo3a, masterw, silentd, selfeena, ryujin */
static const tc0180vcu_interface color2_tc0180vcu_intf =
{
0x30, /* background */
0x20, /* foreground */
0x00 /* text */
};
static MACHINE_DRIVER_START( rastsag2 ) static MACHINE_DRIVER_START( rastsag2 )
@ -2168,6 +2192,8 @@ static MACHINE_DRIVER_START( rastsag2 )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color0_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2208,6 +2234,8 @@ static MACHINE_DRIVER_START( ashura )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color0_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2248,6 +2276,8 @@ static MACHINE_DRIVER_START( crimec )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color1_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2288,6 +2318,8 @@ static MACHINE_DRIVER_START( tetrist )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color0_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2327,6 +2359,8 @@ static MACHINE_DRIVER_START( tetrista )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2368,6 +2402,8 @@ static MACHINE_DRIVER_START( hitice )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color0_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2413,6 +2449,8 @@ static MACHINE_DRIVER_START( rambo3 )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color0_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2453,6 +2491,8 @@ static MACHINE_DRIVER_START( rambo3a )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2496,6 +2536,8 @@ static MACHINE_DRIVER_START( pbobble )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color1_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2540,6 +2582,8 @@ static MACHINE_DRIVER_START( spacedx )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color1_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2580,6 +2624,8 @@ static MACHINE_DRIVER_START( spacedxo )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2624,6 +2670,8 @@ static MACHINE_DRIVER_START( qzshowby )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color1_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2664,6 +2712,8 @@ static MACHINE_DRIVER_START( viofight )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2708,6 +2758,8 @@ static MACHINE_DRIVER_START( masterw )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2749,6 +2801,8 @@ static MACHINE_DRIVER_START( silentd )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2789,6 +2843,8 @@ static MACHINE_DRIVER_START( selfeena )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2838,6 +2894,8 @@ static MACHINE_DRIVER_START( ryujin )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color2_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
@ -2885,6 +2943,8 @@ static MACHINE_DRIVER_START( sbm )
MDRV_VIDEO_EOF(taitob) MDRV_VIDEO_EOF(taitob)
MDRV_VIDEO_UPDATE(taitob) MDRV_VIDEO_UPDATE(taitob)
MDRV_TC0180VCU_ADD("tc0180vcu", color0_tc0180vcu_intf)
/* sound hardware */ /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")

View File

@ -1,7 +1,5 @@
/*----------- defined in video/taito_b.c -----------*/ /*----------- defined in video/taito_b.c -----------*/
extern UINT16 *taitob_scroll;
extern UINT16 *TC0180VCU_ram;
extern UINT16 *taitob_spriteram; extern UINT16 *taitob_spriteram;
extern UINT16 *taitob_pixelram; extern UINT16 *taitob_pixelram;
@ -15,14 +13,8 @@ VIDEO_RESET( hitice );
VIDEO_UPDATE( taitob ); VIDEO_UPDATE( taitob );
WRITE16_HANDLER( TC0180VCU_word_w ); READ16_HANDLER( tc0180vcu_framebuffer_word_r );
READ16_HANDLER ( TC0180VCU_word_r ); WRITE16_HANDLER( tc0180vcu_framebuffer_word_w );
READ16_HANDLER( TC0180VCU_framebuffer_word_r );
WRITE16_HANDLER( TC0180VCU_framebuffer_word_w );
WRITE16_HANDLER( taitob_v_control_w );
READ16_HANDLER ( taitob_v_control_r );
WRITE16_HANDLER( hitice_pixelram_w ); WRITE16_HANDLER( hitice_pixelram_w );
WRITE16_HANDLER( hitice_pixel_scroll_w ); WRITE16_HANDLER( hitice_pixel_scroll_w );

View File

@ -6086,10 +6086,8 @@ INLINE const k056832_interface *k056832_get_interface( const device_config *devi
#define k056832_mark_line_dirty(P, L) if (L < 0x100) k056832->line_dirty[P][L >> 5] |= 1 << (L & 0x1f) #define k056832_mark_line_dirty(P, L) if (L < 0x100) k056832->line_dirty[P][L >> 5] |= 1 << (L & 0x1f)
#define k056832_mark_all_lines_dirty(P) k056832->all_lines_dirty[P] = 1 #define k056832_mark_all_lines_dirty(P) k056832->all_lines_dirty[P] = 1
static void k056832_mark_page_dirty( const device_config *device, int page ) static void k056832_mark_page_dirty( k056832_state *k056832, int page )
{ {
k056832_state *k056832 = k056832_get_safe_token(device);
if (k056832->page_tile_mode[page]) if (k056832->page_tile_mode[page])
tilemap_mark_all_tiles_dirty(k056832->tilemap[page]); tilemap_mark_all_tiles_dirty(k056832->tilemap[page]);
else else
@ -6108,14 +6106,13 @@ void k056832_mark_plane_dirty( const device_config *device, int layer )
if (k056832->layer_assoc_with_page[i] == layer) if (k056832->layer_assoc_with_page[i] == layer)
{ {
k056832->page_tile_mode[i] = tilemode; k056832->page_tile_mode[i] = tilemode;
k056832_mark_page_dirty(device, i); k056832_mark_page_dirty(k056832, i);
} }
} }
} }
void k056832_mark_all_tmaps_dirty( const device_config *device ) static void k056832_mark_all_tilemaps_dirty( k056832_state *k056832 )
{ {
k056832_state *k056832 = k056832_get_safe_token(device);
int i; int i;
for (i = 0; i < K056832_PAGE_COUNT; i++) for (i = 0; i < K056832_PAGE_COUNT; i++)
@ -6123,14 +6120,20 @@ void k056832_mark_all_tmaps_dirty( const device_config *device )
if (k056832->layer_assoc_with_page[i] != -1) if (k056832->layer_assoc_with_page[i] != -1)
{ {
k056832->page_tile_mode[i] = k056832->layer_tile_mode[k056832->layer_assoc_with_page[i]]; k056832->page_tile_mode[i] = k056832->layer_tile_mode[k056832->layer_assoc_with_page[i]];
k056832_mark_page_dirty(device, i); k056832_mark_page_dirty(k056832, i);
} }
} }
} }
static void k056832_update_page_layout( const device_config *device ) /* moo.c needs to call this in its VIDEO_UPDATE */
void k056832_mark_all_tmaps_dirty( const device_config *device )
{ {
k056832_state *k056832 = k056832_get_safe_token(device); k056832_state *k056832 = k056832_get_safe_token(device);
k056832_mark_all_tilemaps_dirty(k056832);
}
static void k056832_update_page_layout( k056832_state *k056832 )
{
int layer, rowstart, rowspan, colstart, colspan, r, c, page_idx, setlayer; int layer, rowstart, rowspan, colstart, colspan, r, c, page_idx, setlayer;
// enable layer association by default // enable layer association by default
@ -6179,7 +6182,7 @@ static void k056832_update_page_layout( const device_config *device )
} }
// refresh associated tilemaps // refresh associated tilemaps
k056832_mark_all_tmaps_dirty(device); k056832_mark_all_tilemaps_dirty(k056832);
} }
int k056832_get_lookup( const device_config *device, int bits ) int k056832_get_lookup( const device_config *device, int bits )
@ -6202,7 +6205,7 @@ INLINE void k056832_get_tile_info( const device_config *device, tile_data *tilei
{ {
int flips, palm1, pals2, palm2; int flips, palm1, pals2, palm2;
} }
k056832_shiftmasks[4] = {{6,0x3f,0,0x00},{4,0x0f,2,0x30},{2,0x03,2,0x3c},{0,0x00,2,0x3f}}; k056832_shiftmasks[4] = {{6, 0x3f, 0, 0x00}, {4, 0x0f, 2, 0x30}, {2, 0x03, 2, 0x3c}, {0, 0x00, 2, 0x3f}};
const struct K056832_SHIFTMASKS *smptr; const struct K056832_SHIFTMASKS *smptr;
int layer, flip, fbits, attr, code, color, flags; int layer, flip, fbits, attr, code, color, flags;
@ -6258,12 +6261,11 @@ static TILE_GET_INFO_DEVICE( k056832_get_tile_infod ) { k056832_get_tile_info(de
static TILE_GET_INFO_DEVICE( k056832_get_tile_infoe ) { k056832_get_tile_info(device, tileinfo, tile_index, 0xe); } static TILE_GET_INFO_DEVICE( k056832_get_tile_infoe ) { k056832_get_tile_info(device, tileinfo, tile_index, 0xe); }
static TILE_GET_INFO_DEVICE( k056832_get_tile_infof ) { k056832_get_tile_info(device, tileinfo, tile_index, 0xf); } static TILE_GET_INFO_DEVICE( k056832_get_tile_infof ) { k056832_get_tile_info(device, tileinfo, tile_index, 0xf); }
static void k056832_change_rambank( const device_config *device ) static void k056832_change_rambank( k056832_state *k056832 )
{ {
/* ------xx page col /* ------xx page col
* ---xx--- page row * ---xx--- page row
*/ */
k056832_state *k056832 = k056832_get_safe_token(device);
int bank = k056832->regs[0x19]; int bank = k056832->regs[0x19];
if (k056832->regs[0] & 0x02) // external linescroll enable if (k056832->regs[0] & 0x02) // external linescroll enable
@ -6274,7 +6276,7 @@ static void k056832_change_rambank( const device_config *device )
k056832->selected_page_x4096 = k056832->selected_page << 12; k056832->selected_page_x4096 = k056832->selected_page << 12;
// refresh associated tilemaps // refresh associated tilemaps
k056832_mark_all_tmaps_dirty(device); k056832_mark_all_tilemaps_dirty(k056832);
} }
int k056832_get_current_rambank( const device_config *device ) int k056832_get_current_rambank( const device_config *device )
@ -6285,9 +6287,8 @@ int k056832_get_current_rambank( const device_config *device )
return ((bank >> 1) & 0xc) | (bank & 3); return ((bank >> 1) & 0xc) | (bank & 3);
} }
static void k056832_change_rombank( const device_config *device ) static void k056832_change_rombank( k056832_state *k056832 )
{ {
k056832_state *k056832 = k056832_get_safe_token(device);
int bank; int bank;
if (k056832->uses_tile_banks) /* Asterix */ if (k056832->uses_tile_banks) /* Asterix */
@ -6313,7 +6314,7 @@ void k056832_set_tile_bank( const device_config *device, int bank )
k056832_mark_plane_dirty(device, 3); k056832_mark_plane_dirty(device, 3);
} }
k056832_change_rombank(device); k056832_change_rombank(k056832);
} }
/* call if a game uses external linescroll */ /* call if a game uses external linescroll */
@ -6771,7 +6772,7 @@ WRITE16_DEVICE_HANDLER( k056832_word_w )
if ((new_data & 0x02) != (old_data & 0x02)) if ((new_data & 0x02) != (old_data & 0x02))
{ {
k056832_change_rambank(device); k056832_change_rambank(k056832);
} }
break; break;
@ -6807,12 +6808,12 @@ WRITE16_DEVICE_HANDLER( k056832_word_w )
//case 0x0a/2: break; //case 0x0a/2: break;
case 0x32/2: case 0x32/2:
k056832_change_rambank(device); k056832_change_rambank(k056832);
break; break;
case 0x34/2: /* ROM bank select for checksum */ case 0x34/2: /* ROM bank select for checksum */
case 0x36/2: /* secondary ROM bank select for use with tile banking */ case 0x36/2: /* secondary ROM bank select for use with tile banking */
k056832_change_rombank(device); k056832_change_rombank(k056832);
break; break;
// extended tile address // extended tile address
@ -6832,7 +6833,7 @@ WRITE16_DEVICE_HANDLER( k056832_word_w )
k056832->y[layer] = (new_data & 0x18) >> 3; k056832->y[layer] = (new_data & 0x18) >> 3;
k056832->h[layer] = (new_data & 0x3); k056832->h[layer] = (new_data & 0x3);
k056832->active_layer = layer; k056832->active_layer = layer;
k056832_update_page_layout(device); k056832_update_page_layout(k056832);
} else } else
if (offset >= 0x18/2 && offset <= 0x1e/2) if (offset >= 0x18/2 && offset <= 0x1e/2)
@ -6840,7 +6841,7 @@ WRITE16_DEVICE_HANDLER( k056832_word_w )
k056832->x[layer] = (new_data & 0x18) >> 3; k056832->x[layer] = (new_data & 0x18) >> 3;
k056832->w[layer] = (new_data & 0x03); k056832->w[layer] = (new_data & 0x03);
k056832->active_layer = layer; k056832->active_layer = layer;
k056832_update_page_layout(device); k056832_update_page_layout(k056832);
} else } else
if (offset >= 0x20/2 && offset <= 0x26/2) if (offset >= 0x20/2 && offset <= 0x26/2)
@ -7240,7 +7241,7 @@ void k056832_tilemap_draw( const device_config *device, bitmap_t *bitmap, const
if (k056832->last_colorbase[pageIndex] != new_colorbase) if (k056832->last_colorbase[pageIndex] != new_colorbase)
{ {
k056832->last_colorbase[pageIndex] = new_colorbase; k056832->last_colorbase[pageIndex] = new_colorbase;
k056832_mark_page_dirty(device, pageIndex); k056832_mark_page_dirty(k056832, pageIndex);
} }
} }
else else
@ -7517,7 +7518,7 @@ void k056832_tilemap_draw_dj( const device_config *device, bitmap_t *bitmap, con
if (k056832->last_colorbase[pageIndex] != new_colorbase) if (k056832->last_colorbase[pageIndex] != new_colorbase)
{ {
k056832->last_colorbase[pageIndex] = new_colorbase; k056832->last_colorbase[pageIndex] = new_colorbase;
k056832_mark_page_dirty(device, pageIndex); k056832_mark_page_dirty(k056832, pageIndex);
} }
} }
else else
@ -7668,12 +7669,11 @@ int k056832_read_register( const device_config *device, int regnum )
static STATE_POSTLOAD( k056832_postload ) static STATE_POSTLOAD( k056832_postload )
{ {
// k056832_state *k056832 = (k056832_state *)param; k056832_state *k056832 = (k056832_state *)param;
// still in progress... k056832_update_page_layout(k056832);
// k056832_update_page_layout(device); k056832_change_rambank(k056832);
// k056832_change_rambank(device); k056832_change_rombank(k056832);
// k056832_change_rombank(device);
} }
/***************************************************************************** /*****************************************************************************
@ -7872,10 +7872,10 @@ static DEVICE_START( k056832 )
memset(k056832->regs, 0x00, sizeof(k056832->regs) ); memset(k056832->regs, 0x00, sizeof(k056832->regs) );
memset(k056832->regsb, 0x00, sizeof(k056832->regsb) ); memset(k056832->regsb, 0x00, sizeof(k056832->regsb) );
k056832_update_page_layout(device); k056832_update_page_layout(k056832);
k056832_change_rambank(device); k056832_change_rambank(k056832);
k056832_change_rombank(device); k056832_change_rombank(k056832);
state_save_register_device_item_pointer(device, 0, k056832->videoram, 0x10000); state_save_register_device_item_pointer(device, 0, k056832->videoram, 0x10000);
state_save_register_device_item_array(device, 0, k056832->regs); state_save_register_device_item_array(device, 0, k056832->regs);

View File

@ -4814,6 +4814,9 @@ struct _tc0180vcu_state
int tx_color_base; int tx_color_base;
}; };
#define TC0180VCU_RAM_SIZE 0x10000
#define TC0180VCU_SCROLLRAM_SIZE 0x0800
/***************************************************************************** /*****************************************************************************
INLINE FUNCTIONS INLINE FUNCTIONS
*****************************************************************************/ *****************************************************************************/
@ -4881,12 +4884,24 @@ INLINE const tc0180vcu_interface *tc0180vcu_get_interface( const device_config *
* *
*/ */
READ8_DEVICE_HANDLER( tc0180vcu_fb_page_r ) READ8_DEVICE_HANDLER( tc0180vcu_get_fb_page )
{ {
tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device);
return tc0180vcu->framebuffer_page; return tc0180vcu->framebuffer_page;
} }
WRITE8_DEVICE_HANDLER( tc0180vcu_set_fb_page )
{
tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device);
tc0180vcu->framebuffer_page = data;
}
READ8_DEVICE_HANDLER( tc0180vcu_get_videoctrl )
{
tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device);
return tc0180vcu->video_control;
}
static void tc0180vcu_video_control( const device_config *device, UINT8 data ) static void tc0180vcu_video_control( const device_config *device, UINT8 data )
{ {
tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device);
@ -5000,7 +5015,6 @@ WRITE16_DEVICE_HANDLER( tc0180vcu_scroll_w )
COMBINE_DATA(&tc0180vcu->scrollram[offset]); COMBINE_DATA(&tc0180vcu->scrollram[offset]);
} }
READ16_DEVICE_HANDLER( tc0180vcu_word_r ) READ16_DEVICE_HANDLER( tc0180vcu_word_r )
{ {
tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device); tc0180vcu_state *tc0180vcu = tc0180vcu_get_safe_token(device);
@ -5096,6 +5110,12 @@ static DEVICE_START( tc0180vcu )
tilemap_set_scrolldx(tc0180vcu->tilemap[1], 0, 24 * 8); tilemap_set_scrolldx(tc0180vcu->tilemap[1], 0, 24 * 8);
tilemap_set_scrolldx(tc0180vcu->tilemap[2], 0, 24 * 8); tilemap_set_scrolldx(tc0180vcu->tilemap[2], 0, 24 * 8);
tc0180vcu->ram = auto_alloc_array_clear(device->machine, UINT16, TC0180VCU_RAM_SIZE / 2);
tc0180vcu->scrollram = auto_alloc_array_clear(device->machine, UINT16, TC0180VCU_SCROLLRAM_SIZE / 2);
state_save_register_device_item_pointer(device, 0, tc0180vcu->ram, TC0180VCU_RAM_SIZE / 2);
state_save_register_device_item_pointer(device, 0, tc0180vcu->scrollram, TC0180VCU_SCROLLRAM_SIZE / 2);
state_save_register_device_item_array(device, 0, tc0180vcu->bg_rambank); state_save_register_device_item_array(device, 0, tc0180vcu->bg_rambank);
state_save_register_device_item_array(device, 0, tc0180vcu->fg_rambank); state_save_register_device_item_array(device, 0, tc0180vcu->fg_rambank);
state_save_register_device_item(device, 0, tc0180vcu->tx_rambank); state_save_register_device_item(device, 0, tc0180vcu->tx_rambank);
@ -5104,12 +5124,6 @@ static DEVICE_START( tc0180vcu )
state_save_register_device_item(device, 0, tc0180vcu->video_control); state_save_register_device_item(device, 0, tc0180vcu->video_control);
state_save_register_device_item_array(device, 0, tc0180vcu->ctrl); state_save_register_device_item_array(device, 0, tc0180vcu->ctrl);
// tc0180vcu->ram = auto_alloc_array_clear(device->machine, UINT16, PC090OJ_RAM_SIZE / 2);
// tc0180vcu->scrollram = auto_alloc_array_clear(device->machine, UINT16, PC090OJ_RAM_SIZE / 2);
// state_save_register_device_item_pointer(device, 0, tc0180vcu->ram, PC090OJ_RAM_SIZE / 2);
// state_save_register_device_item_pointer(device, 0, tc0180vcu->scrollram, PC090OJ_RAM_SIZE / 2);
} }
static DEVICE_RESET( tc0180vcu ) static DEVICE_RESET( tc0180vcu )

View File

@ -355,4 +355,14 @@ WRITE16_DEVICE_HANDLER( tc0110pcr_step1_4bpg_word_w ); /* only 4 bits per color
/** TC0180VCU **/ /** TC0180VCU **/
READ8_DEVICE_HANDLER( tc0180vcu_get_fb_page );
WRITE8_DEVICE_HANDLER( tc0180vcu_set_fb_page );
READ8_DEVICE_HANDLER( tc0180vcu_get_videoctrl );
READ16_DEVICE_HANDLER( tc0180vcu_ctrl_r );
WRITE16_DEVICE_HANDLER( tc0180vcu_ctrl_w );
READ16_DEVICE_HANDLER( tc0180vcu_scroll_r );
WRITE16_DEVICE_HANDLER( tc0180vcu_scroll_w );
READ16_DEVICE_HANDLER( tc0180vcu_word_r );
WRITE16_DEVICE_HANDLER( tc0180vcu_word_w );
void tc0180vcu_tilemap_draw(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect, int tmap_num, int plane);

View File

@ -1,156 +1,32 @@
#include "driver.h" #include "driver.h"
#include "profiler.h" #include "profiler.h"
#include "video/taiicdev.h"
#include "includes/taito_b.h" #include "includes/taito_b.h"
UINT16 *taitob_scroll;
UINT16 *TC0180VCU_ram;
UINT16 *taitob_spriteram; UINT16 *taitob_spriteram;
UINT16 *taitob_pixelram; UINT16 *taitob_pixelram;
static tilemap_t *bg_tilemap, *fg_tilemap, *tx_tilemap;
static UINT16 bg_rambank[2],fg_rambank[2],tx_rambank;
/* framebuffer is a raw bitmap, remapped as a last step */ /* framebuffer is a raw bitmap, remapped as a last step */
static bitmap_t *framebuffer[2],*pixel_bitmap; static bitmap_t *framebuffer[2],*pixel_bitmap;
static UINT16 pixel_scroll[2]; static UINT16 pixel_scroll[2];
static UINT8 framebuffer_page;
static int b_bg_color_base = 0;
static int b_fg_color_base = 0; static int b_fg_color_base = 0;
static int b_sp_color_base = 0; static int b_sp_color_base = 0;
static int b_tx_color_base = 0;
static UINT8 video_control = 0;
static UINT16 TC0180VCU_ctrl[0x10] = {0};
/* TC0180VCU control registers:
* offset:
* 0 - -----xxx bg ram page 0 (tile codes)
* -xxx---- bg ram page 1 (attributes)
* 1 - -----xxx fg ram page 0 (tile codes)
* -xxx---- fg ram page 1 (attributes)
* 2 - xxxxxxxx number of independent foreground scrolling blocks (see below)
* 3 - xxxxxxxx number of independent background scrolling blocks
* 4 - --xxxxxx text tile bank 0
* 5 - --xxxxxx text tile bank 1
* 6 - ----xxxx text ram page
* 7 - xxxxxxxx video control: pixelram page and enable, screen flip, sprite to foreground priority (see below)
* 8 to f - unused (always zero)
*
******************************************************************************************
*
* offset 6 - text video page register:
* This location controls which page of video text ram to view
* hitice:
* 0x08 (00001000) - show game text: credits XX, player1 score
* 0x09 (00001001) - show FBI logo
* rambo3:
* 0x08 (00001000) - show game text
* 0x09 (00001001) - show taito logo
* 0x0a (00001010) - used in pair with 0x09 to smooth screen transitions (attract mode)
*
* Is bit 3 (0x08) video text enable/disable ?
*
******************************************************************************************
*
* offset 7 - video control register:
* bit 0 (0x01) 1 = don't erase sprite frame buffer "after the beam"
* bit 3 (0x08) sprite to foreground priority
* 1 = bg, fg, obj, tx
* 0 = bg, obj1, fg, obj0, tx (obj0/obj1 selected by bit 0 of color code)
* bit 4 (0x10) screen flip (active HI) (this one is for sure)
* bit 5 (0x20) could be global video enable switch (Hit the Ice clears this
* bit, clears videoram portions and sets this bit)
* bit 6 (0x40) frame buffer page to show when bit 7 is set
* bit 7 (0x80) don't flip frame buffer every vblank, use the page selected by bit 6
*
*/
static void taitob_video_control (running_machine *machine, UINT8 data)
{
#if 0
if (data != video_control)
popmessage("video control = %02x",data);
#endif
video_control = data;
if (video_control & 0x80)
framebuffer_page = (~video_control & 0x40) >> 6;
tilemap_set_flip_all(machine, (video_control & 0x10) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0 );
}
READ16_HANDLER( taitob_v_control_r )
{
return (TC0180VCU_ctrl[offset]);
}
WRITE16_HANDLER( taitob_v_control_w )
{
UINT16 oldword = TC0180VCU_ctrl[offset];
COMBINE_DATA (&TC0180VCU_ctrl[offset]);
if (ACCESSING_BITS_8_15)
{
switch(offset)
{
case 0:
if (oldword != TC0180VCU_ctrl[offset])
{
tilemap_mark_all_tiles_dirty(fg_tilemap);
fg_rambank[0] = (((TC0180VCU_ctrl[offset]>>8)&0x0f)<<12);
fg_rambank[1] = (((TC0180VCU_ctrl[offset]>>12)&0x0f)<<12);
}
break;
case 1:
if (oldword != TC0180VCU_ctrl[offset])
{
tilemap_mark_all_tiles_dirty(bg_tilemap);
bg_rambank[0] = (((TC0180VCU_ctrl[offset]>>8)&0x0f)<<12);
bg_rambank[1] = (((TC0180VCU_ctrl[offset]>>12)&0x0f)<<12);
}
break;
case 4:
case 5:
if (oldword != TC0180VCU_ctrl[offset])
tilemap_mark_all_tiles_dirty(tx_tilemap);
break;
case 6:
if (oldword != TC0180VCU_ctrl[offset])
{
tilemap_mark_all_tiles_dirty(tx_tilemap);
tx_rambank = (((TC0180VCU_ctrl[offset]>>8)&0x0f)<<11);
}
break;
case 7:
taitob_video_control( space->machine, (TC0180VCU_ctrl[offset]>>8) & 0xff );
break;
default:
break;
}
}
}
WRITE16_HANDLER( hitice_pixelram_w ) WRITE16_HANDLER( hitice_pixelram_w )
{ {
int sy = offset >> 9; int sy = offset >> 9;
int sx = offset & 0x1ff; int sx = offset & 0x1ff;
COMBINE_DATA(&taitob_pixelram[offset]); COMBINE_DATA(&taitob_pixelram[offset]);
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
/* bit 15 of pixel_scroll[0] is probably flip screen */ /* bit 15 of pixel_scroll[0] is probably flip screen */
*BITMAP_ADDR16(pixel_bitmap, sy, 2 * sx + 0) = b_fg_color_base * 16 + (data & 0xff);
*BITMAP_ADDR16(pixel_bitmap, sy, 2*sx+0) = b_fg_color_base * 16 + (data & 0xff); *BITMAP_ADDR16(pixel_bitmap, sy, 2 * sx + 1) = b_fg_color_base * 16 + (data & 0xff);
*BITMAP_ADDR16(pixel_bitmap, sy, 2*sx+1) = b_fg_color_base * 16 + (data & 0xff); }
}
} }
WRITE16_HANDLER( hitice_pixel_scroll_w ) WRITE16_HANDLER( hitice_pixel_scroll_w )
@ -158,78 +34,23 @@ WRITE16_HANDLER( hitice_pixel_scroll_w )
COMBINE_DATA(&pixel_scroll[offset]); COMBINE_DATA(&pixel_scroll[offset]);
} }
static void hitice_clear_pixel_bitmap(running_machine *machine) static void hitice_clear_pixel_bitmap( running_machine *machine )
{ {
int i; int i;
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
for (i = 0; i < 0x40000; i++) for (i = 0; i < 0x40000; i++)
hitice_pixelram_w(space, i, 0, 0xffff); hitice_pixelram_w(space, i, 0, 0xffff);
} }
static TILE_GET_INFO( get_bg_tile_info )
{
int tile = TC0180VCU_ram[tile_index + bg_rambank[0]];
int color = TC0180VCU_ram[tile_index + bg_rambank[1]];
SET_TILE_INFO(
1,
tile,
b_bg_color_base + (color & 0x3f),
TILE_FLIPYX((color & 0x00c0) >> 6));
}
static TILE_GET_INFO( get_fg_tile_info )
{
int tile = TC0180VCU_ram[tile_index + fg_rambank[0]];
int color = TC0180VCU_ram[tile_index + fg_rambank[1]];
SET_TILE_INFO(
1,
tile,
b_fg_color_base + (color & 0x3f),
TILE_FLIPYX((color & 0x00c0) >> 6));
}
static TILE_GET_INFO( get_tx_tile_info )
{
int tile = TC0180VCU_ram[tile_index + tx_rambank];
SET_TILE_INFO(
0,
(tile & 0x07ff) | ((TC0180VCU_ctrl[4 + ((tile & 0x800) >> 11)]>>8) << 11),
b_tx_color_base + ((tile >> 12) & 0x0f),
0);
}
static VIDEO_START( taitob_core ) static VIDEO_START( taitob_core )
{ {
framebuffer[0] = auto_bitmap_alloc(machine,512,256, video_screen_get_format(machine->primary_screen)); framebuffer[0] = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen));
framebuffer[1] = auto_bitmap_alloc(machine,512,256, video_screen_get_format(machine->primary_screen)); framebuffer[1] = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen));
pixel_bitmap = NULL; /* only hitice needs this */ pixel_bitmap = NULL; /* only hitice needs this */
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 16,16,64,64);
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,16,16,64,64);
tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows, 8, 8,64,32);
tilemap_set_transparent_pen(fg_tilemap,0);
tilemap_set_transparent_pen(tx_tilemap,0);
tilemap_set_scrolldx(bg_tilemap,0,24*8);
tilemap_set_scrolldx(fg_tilemap,0,24*8);
tilemap_set_scrolldx(tx_tilemap,0,24*8);
state_save_register_global_array(machine, bg_rambank);
state_save_register_global_array(machine, fg_rambank);
state_save_register_global(machine, tx_rambank);
state_save_register_global_array(machine, pixel_scroll); state_save_register_global_array(machine, pixel_scroll);
state_save_register_global(machine, framebuffer_page);
state_save_register_global(machine, video_control);
state_save_register_global_array(machine, TC0180VCU_ctrl);
state_save_register_global_bitmap(machine, framebuffer[0]); state_save_register_global_bitmap(machine, framebuffer[0]);
state_save_register_global_bitmap(machine, framebuffer[1]); state_save_register_global_bitmap(machine, framebuffer[1]);
@ -237,51 +58,46 @@ static VIDEO_START( taitob_core )
VIDEO_START( taitob_color_order0 ) VIDEO_START( taitob_color_order0 )
{ {
/*graphics are shared, only that they use different palette*/ /*graphics are shared, only that they use different palette*/
/*this is the basic layout used in: Nastar, Ashura Blaster, Hit the Ice, Rambo3, Tetris*/ /*this is the basic layout used in: Nastar, Ashura Blaster, Hit the Ice, Rambo3, Tetris*/
/*Note that in both this and color order 1 /*Note that in both this and color order 1
* pixel_color_base/color_granularity is equal to sprites color base. * pixel_color_base/color_granularity is equal to sprites color base.
* Pure coincidence ?*/ * Pure coincidence ?*/
b_bg_color_base = 0xc0; /*background*/ b_sp_color_base = 0x40 * 16; /*sprites */
b_fg_color_base = 0x80; /*foreground*/
b_sp_color_base = 0x40*16; /*sprites */
b_tx_color_base = 0x00; /*text */
VIDEO_START_CALL(taitob_core); /* bg, fg, tx color_base are set in the tc0180vcu interface */
VIDEO_START_CALL(taitob_core);
} }
VIDEO_START( taitob_color_order1 ) VIDEO_START( taitob_color_order1 )
{ {
/*and this is the reversed layout used in: Crime City, Puzzle Bobble*/ /* this is the reversed layout used in: Crime City, Puzzle Bobble */
b_bg_color_base = 0x00; b_sp_color_base = 0x80 * 16;
b_fg_color_base = 0x40;
b_sp_color_base = 0x80*16;
b_tx_color_base = 0xc0;
VIDEO_START_CALL(taitob_core); VIDEO_START_CALL(taitob_core);
} }
VIDEO_START( taitob_color_order2 ) VIDEO_START( taitob_color_order2 )
{ {
/*this is used in: rambo3a, masterw, silentd, selfeena, ryujin */ /*this is used in: rambo3a, masterw, silentd, selfeena, ryujin */
b_bg_color_base = 0x30; b_sp_color_base = 0x10 * 16;
b_fg_color_base = 0x20;
b_sp_color_base = 0x10*16;
b_tx_color_base = 0x00;
VIDEO_START_CALL(taitob_core); VIDEO_START_CALL(taitob_core);
} }
VIDEO_START( hitice ) VIDEO_START( hitice )
{ {
VIDEO_START_CALL(taitob_color_order0); VIDEO_START_CALL(taitob_color_order0);
pixel_bitmap = auto_bitmap_alloc(machine,1024,512,video_screen_get_format(machine->primary_screen)); b_fg_color_base = 0x80; /* hitice also uses this for the pixel_bitmap */
state_save_register_global_bitmap(machine, pixel_bitmap); pixel_bitmap = auto_bitmap_alloc(machine, 1024, 512, video_screen_get_format(machine->primary_screen));
state_save_register_global_bitmap(machine, pixel_bitmap);
} }
VIDEO_RESET( hitice ) VIDEO_RESET( hitice )
@ -291,45 +107,27 @@ VIDEO_RESET( hitice )
} }
READ16_HANDLER( TC0180VCU_word_r ) READ16_HANDLER( tc0180vcu_framebuffer_word_r )
{ {
return TC0180VCU_ram[offset]; int sy = offset >> 8;
int sx = 2*(offset & 0xff);
return (*BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 0) << 8) | *BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 1);
} }
WRITE16_HANDLER( TC0180VCU_word_w ) WRITE16_HANDLER( tc0180vcu_framebuffer_word_w )
{ {
COMBINE_DATA(&TC0180VCU_ram[offset]); int sy = offset >> 8;
int sx = 2*(offset & 0xff);
if ((offset & 0x7000) == fg_rambank[0] || (offset & 0x7000) == fg_rambank[1]) if (ACCESSING_BITS_8_15)
tilemap_mark_tile_dirty(fg_tilemap,offset & 0x0fff); *BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 0) = data >> 8;
if ((offset & 0x7000) == bg_rambank[0] || (offset & 0x7000) == bg_rambank[1]) if (ACCESSING_BITS_0_7)
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x0fff); *BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 1) = data & 0xff;
if ((offset & 0x7800) == tx_rambank)
tilemap_mark_tile_dirty(tx_tilemap,offset & 0x7ff);
}
READ16_HANDLER( TC0180VCU_framebuffer_word_r )
{
int sy = offset >> 8;
int sx = 2*(offset & 0xff);
return (*BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 0) << 8) |
*BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 1);
}
WRITE16_HANDLER( TC0180VCU_framebuffer_word_w )
{
int sy = offset >> 8;
int sx = 2*(offset & 0xff);
if (ACCESSING_BITS_8_15)
*BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 0) = data >> 8;
if (ACCESSING_BITS_0_7)
*BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 1) = data & 0xff;
} }
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{ {
/* Sprite format: (16 bytes per sprite) /* Sprite format: (16 bytes per sprite)
offs: bits: offs: bits:
@ -360,146 +158,110 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
000c - 000f: unused 000c - 000f: unused
*/ */
int x,y,xlatch=0,ylatch=0,x_no=0,y_no=0,x_num=0,y_num=0,big_sprite=0; int x, y, xlatch = 0, ylatch = 0, x_no = 0, y_no = 0, x_num = 0, y_num = 0, big_sprite = 0;
int offs,code,color,flipx,flipy; int offs, code, color, flipx, flipy;
UINT32 data, zoomx, zoomy, zx, zy, zoomxlatch=0, zoomylatch=0; UINT32 data, zoomx, zoomy, zx, zy, zoomxlatch = 0, zoomylatch = 0;
for (offs = (0x1980-16)/2; offs >=0; offs -= 8) for (offs = (0x1980-16)/2; offs >=0; offs -= 8)
{
code = taitob_spriteram[offs];
color = taitob_spriteram[offs+1];
flipx = color & 0x4000;
flipy = color & 0x8000;
#if 0
/*check the unknown bits*/
if (color & 0x3fc0){
logerror("sprite color (taitob)=%4x ofs=%4x\n",color,offs);
color = rand()&0x3f;
}
#endif
color = (color & 0x3f) * 16;
x = taitob_spriteram[offs+2] & 0x3ff;
y = taitob_spriteram[offs+3] & 0x3ff;
if (x >= 0x200) x -= 0x400;
if (y >= 0x200) y -= 0x400;
data = taitob_spriteram[offs+5];
if (data)
{
if (!big_sprite)
{
x_num = (data>>8) & 0xff;
y_num = (data) & 0xff;
x_no = 0;
y_no = 0;
xlatch = x;
ylatch = y;
data = taitob_spriteram[offs+4];
zoomxlatch = (data>>8) & 0xff;
zoomylatch = (data) & 0xff;
big_sprite = 1;
}
}
data = taitob_spriteram[offs+4];
zoomx = (data>>8) & 0xff;
zoomy = (data) & 0xff;
zx = (0x100 - zoomx) / 16;
zy = (0x100 - zoomy) / 16;
if (big_sprite)
{
zoomx = zoomxlatch;
zoomy = zoomylatch;
x = xlatch + x_no * (0x100 - zoomx) / 16;
y = ylatch + y_no * (0x100 - zoomy) / 16;
zx = xlatch + (x_no+1) * (0x100 - zoomx) / 16 - x;
zy = ylatch + (y_no+1) * (0x100 - zoomy) / 16 - y;
y_no++;
if (y_no>y_num)
{
y_no = 0;
x_no++;
if (x_no>x_num)
big_sprite = 0;
}
}
if ( zoomx || zoomy )
{
drawgfxzoom_transpen_raw (bitmap,cliprect,machine->gfx[1],
code,
color,
flipx,flipy,
x,y,
(zx << 16) / 16,(zy << 16) / 16,0);
}
else
{
drawgfx_transpen_raw (bitmap,cliprect,machine->gfx[1],
code,
color,
flipx,flipy,
x,y,
0);
}
}
}
static void TC0180VCU_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,tilemap_t *tmap,int plane)
{
/*plane = 0 fg tilemap*/
/*plane = 1 bg tilemap*/
rectangle my_clip;
int i;
int scrollx, scrolly;
int lines_per_block; /* number of lines scrolled by the same amount (per one scroll value) */
int number_of_blocks; /* number of such blocks per _screen_ (256 lines) */
lines_per_block = 256 - (TC0180VCU_ctrl[2 + plane] >> 8);
number_of_blocks = 256 / lines_per_block;
my_clip.min_x = cliprect->min_x;
my_clip.max_x = cliprect->max_x;
for (i = 0;i < number_of_blocks;i++)
{
scrollx = taitob_scroll[ plane*0x200 + i*2*lines_per_block ];
scrolly = taitob_scroll[ plane*0x200 + i*2*lines_per_block+1 ];
my_clip.min_y = i*lines_per_block;
my_clip.max_y = (i+1)*lines_per_block -1;
if (video_control&0x10) /*flip screen*/
{ {
my_clip.min_y = bitmap->height - 1 - (i+1)*lines_per_block -1; code = taitob_spriteram[offs];
my_clip.max_y = bitmap->height - 1 - i*lines_per_block;
}
sect_rect(&my_clip, cliprect);
if (my_clip.min_y <= my_clip.max_y) color = taitob_spriteram[offs + 1];
{ flipx = color & 0x4000;
tilemap_set_scrollx(tmap,0,-scrollx); flipy = color & 0x8000;
tilemap_set_scrolly(tmap,0,-scrolly); #if 0
tilemap_draw(bitmap,&my_clip,tmap,0,0); /*check the unknown bits*/
} if (color & 0x3fc0)
} {
logerror("sprite color (taitob)=%4x ofs=%4x\n",color,offs);
color = rand()&0x3f;
}
#endif
color = (color & 0x3f) * 16;
x = taitob_spriteram[offs + 2] & 0x3ff;
y = taitob_spriteram[offs + 3] & 0x3ff;
if (x >= 0x200) x -= 0x400;
if (y >= 0x200) y -= 0x400;
data = taitob_spriteram[offs + 5];
if (data)
{
if (!big_sprite)
{
x_num = (data >> 8) & 0xff;
y_num = (data) & 0xff;
x_no = 0;
y_no = 0;
xlatch = x;
ylatch = y;
data = taitob_spriteram[offs + 4];
zoomxlatch = (data >> 8) & 0xff;
zoomylatch = (data) & 0xff;
big_sprite = 1;
}
}
data = taitob_spriteram[offs+4];
zoomx = (data >> 8) & 0xff;
zoomy = (data) & 0xff;
zx = (0x100 - zoomx) / 16;
zy = (0x100 - zoomy) / 16;
if (big_sprite)
{
zoomx = zoomxlatch;
zoomy = zoomylatch;
x = xlatch + x_no * (0x100 - zoomx) / 16;
y = ylatch + y_no * (0x100 - zoomy) / 16;
zx = xlatch + (x_no+1) * (0x100 - zoomx) / 16 - x;
zy = ylatch + (y_no+1) * (0x100 - zoomy) / 16 - y;
y_no++;
if (y_no > y_num)
{
y_no = 0;
x_no++;
if (x_no > x_num)
big_sprite = 0;
}
}
if ( zoomx || zoomy )
{
drawgfxzoom_transpen_raw(bitmap, cliprect, machine->gfx[1],
code,
color,
flipx,flipy,
x,y,
(zx << 16) / 16,(zy << 16) / 16,0);
}
else
{
drawgfx_transpen_raw (bitmap,cliprect,machine->gfx[1],
code,
color,
flipx,flipy,
x,y,
0);
}
}
} }
static void draw_framebuffer(bitmap_t *bitmap,const rectangle *cliprect,int priority) static void draw_framebuffer( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
{ {
rectangle myclip = *cliprect; const device_config *tc0180vcu = devtag_get_device(machine, "tc0180vcu");
int x,y; rectangle myclip = *cliprect;
int x, y;
UINT8 video_control = tc0180vcu_get_videoctrl(tc0180vcu, 0);
UINT8 framebuffer_page = tc0180vcu_get_fb_page(tc0180vcu, 0);
profiler_mark_start(PROFILER_USER1); profiler_mark_start(PROFILER_USER1);
priority <<= 4; priority <<= 4;
if (video_control & 0x08) if (video_control & 0x08)
{ {
@ -509,17 +271,17 @@ profiler_mark_start(PROFILER_USER1);
return; return;
} }
if (video_control & 0x10) /*flip screen*/ if (video_control & 0x10) /*flip screen*/
{ {
/*popmessage("1. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ /*popmessage("1. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/
for (y = myclip.min_y;y <= myclip.max_y;y++) for (y = myclip.min_y; y <= myclip.max_y; y++)
{ {
UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x);
UINT16 *dst; UINT16 *dst;
dst = BITMAP_ADDR16(bitmap, bitmap->height-1-y, myclip.max_x); dst = BITMAP_ADDR16(bitmap, bitmap->height-1-y, myclip.max_x);
for (x = myclip.min_x;x <= myclip.max_x;x++) for (x = myclip.min_x; x <= myclip.max_x; x++)
{ {
UINT16 c = *src++; UINT16 c = *src++;
@ -532,12 +294,12 @@ profiler_mark_start(PROFILER_USER1);
} }
else else
{ {
for (y = myclip.min_y;y <= myclip.max_y;y++) for (y = myclip.min_y; y <= myclip.max_y; y++)
{ {
UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x);
UINT16 *dst = BITMAP_ADDR16(bitmap, y, myclip.min_x); UINT16 *dst = BITMAP_ADDR16(bitmap, y, myclip.min_x);
for (x = myclip.min_x;x <= myclip.max_x;x++) for (x = myclip.min_x; x <= myclip.max_x; x++)
{ {
UINT16 c = *src++; UINT16 c = *src++;
@ -554,14 +316,14 @@ profiler_mark_start(PROFILER_USER1);
if (video_control & 0x10) /*flip screen*/ if (video_control & 0x10) /*flip screen*/
{ {
/*popmessage("3. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ /*popmessage("3. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/
for (y = myclip.min_y;y <= myclip.max_y;y++) for (y = myclip.min_y ;y <= myclip.max_y; y++)
{ {
UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x);
UINT16 *dst; UINT16 *dst;
dst = BITMAP_ADDR16(bitmap, bitmap->height-1-y, myclip.max_x); dst = BITMAP_ADDR16(bitmap, bitmap->height-1-y, myclip.max_x);
for (x = myclip.min_x;x <= myclip.max_x;x++) for (x = myclip.min_x; x <= myclip.max_x; x++)
{ {
UINT16 c = *src++; UINT16 c = *src++;
@ -574,12 +336,12 @@ profiler_mark_start(PROFILER_USER1);
} }
else else
{ {
for (y = myclip.min_y;y <= myclip.max_y;y++) for (y = myclip.min_y; y <= myclip.max_y; y++)
{ {
UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x);
UINT16 *dst = BITMAP_ADDR16(bitmap, y, myclip.min_x); UINT16 *dst = BITMAP_ADDR16(bitmap, y, myclip.min_x);
for (x = myclip.min_x;x <= myclip.max_x;x++) for (x = myclip.min_x; x <= myclip.max_x; x++)
{ {
UINT16 c = *src++; UINT16 c = *src++;
@ -596,31 +358,35 @@ profiler_mark_end();
VIDEO_UPDATE( taitob ) VIDEO_UPDATE( taitob )
{ {
if ((video_control & 0x20) == 0) const device_config *tc0180vcu = devtag_get_device(screen->machine, "tc0180vcu");
{ UINT8 video_control = tc0180vcu_get_videoctrl(tc0180vcu, 0);
bitmap_fill(bitmap,cliprect,0);
return 0;
}
/* Draw playfields */ if ((video_control & 0x20) == 0)
TC0180VCU_tilemap_draw(bitmap,cliprect,bg_tilemap,1); {
bitmap_fill(bitmap, cliprect, 0);
return 0;
}
draw_framebuffer(bitmap,cliprect,1); /* Draw playfields */
tc0180vcu_tilemap_draw(tc0180vcu, bitmap, cliprect, 0, 1);
TC0180VCU_tilemap_draw(bitmap,cliprect,fg_tilemap,0); draw_framebuffer(screen->machine, bitmap, cliprect, 1);
if (pixel_bitmap) /* hitice only */ tc0180vcu_tilemap_draw(tc0180vcu, bitmap, cliprect, 1, 0);
{
int scrollx = -2*pixel_scroll[0]; //+320;
int scrolly = -pixel_scroll[1]; //+240;
/* bit 15 of pixel_scroll[0] is probably flip screen */
copyscrollbitmap_trans(bitmap,pixel_bitmap,1,&scrollx,1,&scrolly,cliprect,b_fg_color_base * 16); if (pixel_bitmap) /* hitice only */
} {
int scrollx = -2 * pixel_scroll[0]; //+320;
int scrolly = - pixel_scroll[1]; //+240;
/* bit 15 of pixel_scroll[0] is probably flip screen */
draw_framebuffer(bitmap,cliprect,0); copyscrollbitmap_trans(bitmap, pixel_bitmap, 1, &scrollx, 1, &scrolly, cliprect, b_fg_color_base * 16);
}
draw_framebuffer(screen->machine, bitmap, cliprect, 0);
tc0180vcu_tilemap_draw(tc0180vcu, bitmap, cliprect, 2, 0);
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
return 0; return 0;
} }
@ -628,12 +394,18 @@ VIDEO_UPDATE( taitob )
VIDEO_EOF( taitob ) VIDEO_EOF( taitob )
{ {
if (~video_control & 0x01) const device_config *tc0180vcu = devtag_get_device(machine, "tc0180vcu");
bitmap_fill(framebuffer[framebuffer_page],video_screen_get_visible_area(machine->primary_screen),0); UINT8 video_control = tc0180vcu_get_videoctrl(tc0180vcu, 0);
UINT8 framebuffer_page = tc0180vcu_get_fb_page(tc0180vcu, 0);
if (~video_control & 0x80) if (~video_control & 0x01)
framebuffer_page ^= 1; bitmap_fill(framebuffer[framebuffer_page], video_screen_get_visible_area(machine->primary_screen), 0);
draw_sprites(machine, framebuffer[framebuffer_page],video_screen_get_visible_area(machine->primary_screen)); if (~video_control & 0x80)
{
framebuffer_page ^= 1;
tc0180vcu_set_fb_page(tc0180vcu, 0, framebuffer_page);
}
draw_sprites(machine, framebuffer[framebuffer_page], video_screen_get_visible_area(machine->primary_screen));
} }