From e62c8270ce5eb5af424bbf1174187c582e684e3e Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Mon, 28 Dec 2009 22:59:14 +0000 Subject: [PATCH] Updated galastrm.c and undrfire.c to use video devices --- src/mame/drivers/galastrm.c | 44 +++++++++------ src/mame/drivers/undrfire.c | 49 ++++++++++++----- src/mame/video/galastrm.c | 72 ++++++++++++------------- src/mame/video/taiicdev.c | 7 +++ src/mame/video/taiicdev.h | 2 +- src/mame/video/undrfire.c | 104 ++++++++++++++++++------------------ 6 files changed, 159 insertions(+), 119 deletions(-) diff --git a/src/mame/drivers/galastrm.c b/src/mame/drivers/galastrm.c index 2be37b978fd..a19be762741 100644 --- a/src/mame/drivers/galastrm.c +++ b/src/mame/drivers/galastrm.c @@ -39,7 +39,7 @@ $305.b invincibility #include "driver.h" #include "cpu/m68000/m68000.h" -#include "video/taitoic.h" +#include "video/taiicdev.h" #include "audio/taitosnd.h" #include "machine/eeprom.h" #include "sound/es5506.h" @@ -187,13 +187,13 @@ static ADDRESS_MAP_START( galastrm_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x40fff0, 0x40fff3) AM_WRITENOP AM_RANGE(0x500000, 0x500007) AM_READWRITE(galastrm_adstick_ctrl_r, galastrm_adstick_ctrl_w) AM_RANGE(0x600000, 0x6007ff) AM_RAM AM_BASE(&f3_shared_ram) /* Sound shared ram */ - AM_RANGE(0x800000, 0x80ffff) AM_READWRITE(TC0480SCP_long_r, TC0480SCP_long_w) - AM_RANGE(0x830000, 0x83002f) AM_READWRITE(TC0480SCP_ctrl_long_r, TC0480SCP_ctrl_long_w) + AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE("tc0480scp", tc0480scp_long_r, tc0480scp_long_w) /* tilemaps */ + AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w) AM_RANGE(0x900000, 0x900003) AM_WRITE(galastrm_palette_w) /* TC0110PCR */ AM_RANGE(0xb00000, 0xb00003) AM_WRITE(galastrm_tc0610_0_w) /* TC0610 */ AM_RANGE(0xc00000, 0xc00003) AM_WRITE(galastrm_tc0610_1_w) - AM_RANGE(0xd00000, 0xd0ffff) AM_READWRITE(TC0100SCN_long_r, TC0100SCN_long_w) /* piv tilemaps */ - AM_RANGE(0xd20000, 0xd2000f) AM_READWRITE(TC0100SCN_ctrl_long_r, TC0100SCN_ctrl_long_w) + AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE("tc0100scn", tc0100scn_long_r, tc0100scn_long_w) /* piv tilemaps */ + AM_RANGE(0xd20000, 0xd2000f) AM_DEVREADWRITE("tc0100scn", tc0100scn_ctrl_long_r, tc0100scn_ctrl_long_w) ADDRESS_MAP_END /*********************************************************** @@ -284,17 +284,6 @@ GFXDECODE_END MACHINE DRIVERS ***********************************************************/ -static const UINT8 default_eeprom[128]={ - 0x45,0x58,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x28,0x00,0x01,0x00,0x00,0x00,0xfa, - 0x00,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -}; - static const eeprom_interface galastrm_eeprom_interface = { 6, /* address bits */ @@ -308,6 +297,26 @@ static const eeprom_interface galastrm_eeprom_interface = /***************************************************************************/ +static const tc0100scn_interface galastrm_tc0100scn_intf = +{ + "screen", + 0, 2, /* gfxnum, txnum */ + -48, -56, /* x_offset, y_offset */ + 0, 0, /* flip_xoff, flip_yoff */ + 0, 0, /* flip_text_xoff, flip_text_yoff */ + 0, 0 +}; + +static const tc0480scp_interface galastrm_tc0480scp_intf = +{ + 1, 3, /* gfxnum, txnum */ + 0, /* pixels */ + -40, -3, /* x_offset, y_offset */ + 0, 0, /* text_xoff, text_yoff */ + 0, 0, /* flip_xoff, flip_yoff */ + 0 /* col_base */ +}; + static MACHINE_DRIVER_START( galastrm ) /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68EC020, 16000000) /* 16 MHz */ @@ -330,6 +339,9 @@ static MACHINE_DRIVER_START( galastrm ) MDRV_VIDEO_START(galastrm) MDRV_VIDEO_UPDATE(galastrm) + MDRV_TC0100SCN_ADD("tc0100scn", galastrm_tc0100scn_intf) + MDRV_TC0480SCP_ADD("tc0480scp", galastrm_tc0480scp_intf) + /* sound hardware */ MDRV_IMPORT_FROM(taito_f3_sound) MACHINE_DRIVER_END diff --git a/src/mame/drivers/undrfire.c b/src/mame/drivers/undrfire.c index a916eb81e37..a4bb300e42d 100644 --- a/src/mame/drivers/undrfire.c +++ b/src/mame/drivers/undrfire.c @@ -188,7 +188,7 @@ Board contains only 29 ROMs and not much else. #include "driver.h" #include "cpu/m68000/m68000.h" -#include "video/taitoic.h" +#include "video/taiicdev.h" #include "audio/taitosnd.h" #include "machine/eeprom.h" #include "sound/es5506.h" @@ -477,10 +477,10 @@ static ADDRESS_MAP_START( undrfire_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x500000, 0x500007) AM_READWRITE(undrfire_input_r, undrfire_input_w) /* eerom etc. */ AM_RANGE(0x600000, 0x600007) AM_READWRITE(unknown_hardware_r, unknown_int_req_w) /* int request for unknown hardware */ AM_RANGE(0x700000, 0x7007ff) AM_RAM AM_BASE(&f3_shared_ram) - AM_RANGE(0x800000, 0x80ffff) AM_READWRITE(TC0480SCP_long_r, TC0480SCP_long_w) /* tilemaps */ - AM_RANGE(0x830000, 0x83002f) AM_READWRITE(TC0480SCP_ctrl_long_r, TC0480SCP_ctrl_long_w) - AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(TC0100SCN_long_r, TC0100SCN_long_w) /* piv tilemaps */ - AM_RANGE(0x920000, 0x92000f) AM_READWRITE(TC0100SCN_ctrl_long_r, TC0100SCN_ctrl_long_w) + AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE("tc0480scp", tc0480scp_long_r, tc0480scp_long_w) /* tilemaps */ + AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w) + AM_RANGE(0x900000, 0x90ffff) AM_DEVREADWRITE("tc0100scn", tc0100scn_long_r, tc0100scn_long_w) /* piv tilemaps */ + AM_RANGE(0x920000, 0x92000f) AM_DEVREADWRITE("tc0100scn", tc0100scn_ctrl_long_r, tc0100scn_ctrl_long_w) AM_RANGE(0xa00000, 0xa0ffff) AM_RAM_WRITE(color_ram_w) AM_BASE_GENERIC(paletteram) AM_RANGE(0xb00000, 0xb003ff) AM_RAM /* single bytes, blending ??? */ AM_RANGE(0xd00000, 0xd00003) AM_WRITE(rotate_control_w) /* perhaps port based rotate control? */ @@ -496,10 +496,10 @@ static ADDRESS_MAP_START( cbombers_cpua_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x500000, 0x500007) AM_READWRITE(undrfire_input_r, undrfire_input_w) AM_RANGE(0x600000, 0x600007) AM_READWRITE(cbombers_adc_r, cbombers_adc_w) AM_RANGE(0x700000, 0x7007ff) AM_RAM AM_BASE(&f3_shared_ram) - AM_RANGE(0x800000, 0x80ffff) AM_READWRITE(TC0480SCP_long_r, TC0480SCP_long_w) /* tilemaps */ - AM_RANGE(0x830000, 0x83002f) AM_READWRITE(TC0480SCP_ctrl_long_r, TC0480SCP_ctrl_long_w) - AM_RANGE(0x900000, 0x90ffff) AM_READWRITE(TC0100SCN_long_r, TC0100SCN_long_w) /* piv tilemaps */ - AM_RANGE(0x920000, 0x92000f) AM_READWRITE(TC0100SCN_ctrl_long_r, TC0100SCN_ctrl_long_w) + AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE("tc0480scp", tc0480scp_long_r, tc0480scp_long_w) /* tilemaps */ + AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w) + AM_RANGE(0x900000, 0x90ffff) AM_DEVREADWRITE("tc0100scn", tc0100scn_long_r, tc0100scn_long_w) /* piv tilemaps */ + AM_RANGE(0x920000, 0x92000f) AM_DEVREADWRITE("tc0100scn", tc0100scn_ctrl_long_r, tc0100scn_ctrl_long_w) AM_RANGE(0xa00000, 0xa0ffff) AM_RAM_WRITE(color_ram_w) AM_BASE_GENERIC(paletteram) AM_RANGE(0xb00000, 0xb0000f) AM_RAM /* ? */ AM_RANGE(0xc00000, 0xc00007) AM_RAM /* LAN controller? */ @@ -510,7 +510,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cbombers_cpub_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x400000, 0x40ffff) AM_RAM /* local ram */ -// AM_RANGE(0x600000, 0x60ffff) AM_WRITE(TC0480SCP_word_w) /* Only written upon errors */ +// AM_RANGE(0x600000, 0x60ffff) AM_DEVWRITE("tc0480scp", tc0480scp_word_w) /* Only written upon errors */ AM_RANGE(0x800000, 0x80ffff) AM_READWRITE(shared_ram_r, shared_ram_w) // AM_RANGE(0xa00000, 0xa001ff) AM_RAM /* Extra road control?? */ ADDRESS_MAP_END @@ -695,10 +695,30 @@ GFXDECODE_END static INTERRUPT_GEN( undrfire_interrupt ) { - frame_counter^=1; + frame_counter ^= 1; cpu_set_input_line(device, 4, HOLD_LINE); } +static const tc0100scn_interface undrfire_tc0100scn_intf = +{ + "screen", + 2, 3, /* gfxnum, txnum */ + 50, 8, /* x_offset, y_offset */ + 0, 0, /* flip_xoff, flip_yoff */ + 0, 0, /* flip_text_xoff, flip_text_yoff */ + 0, 0 +}; + +static const tc0480scp_interface undrfire_tc0480scp_intf = +{ + 1, 4, /* gfxnum, txnum */ + 0, /* pixels */ + 0x24, 0, /* x_offset, y_offset */ + -1, 0, /* text_xoff, text_yoff */ + 0, 0, /* flip_xoff, flip_yoff */ + 0 /* col_base */ +}; + static MACHINE_DRIVER_START( undrfire ) /* basic machine hardware */ @@ -722,6 +742,9 @@ static MACHINE_DRIVER_START( undrfire ) MDRV_VIDEO_START(undrfire) MDRV_VIDEO_UPDATE(undrfire) + MDRV_TC0100SCN_ADD("tc0100scn", undrfire_tc0100scn_intf) + MDRV_TC0480SCP_ADD("tc0480scp", undrfire_tc0480scp_intf) + /* sound hardware */ MDRV_IMPORT_FROM(taito_f3_sound) MACHINE_DRIVER_END @@ -750,13 +773,15 @@ static MACHINE_DRIVER_START( cbombers ) MDRV_SCREEN_SIZE(40*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0, 40*8-1, 3*8, 32*8-1) - MDRV_GFXDECODE(cbombers) MDRV_PALETTE_LENGTH(16384) MDRV_VIDEO_START(undrfire) MDRV_VIDEO_UPDATE(cbombers) + MDRV_TC0100SCN_ADD("tc0100scn", undrfire_tc0100scn_intf) + MDRV_TC0480SCP_ADD("tc0480scp", undrfire_tc0480scp_intf) + /* sound hardware */ MDRV_IMPORT_FROM(taito_f3_sound) MACHINE_DRIVER_END diff --git a/src/mame/video/galastrm.c b/src/mame/video/galastrm.c index 2f7fa0a30c8..e73b8c49c22 100644 --- a/src/mame/video/galastrm.c +++ b/src/mame/video/galastrm.c @@ -1,9 +1,7 @@ #include "driver.h" -#include "video/taitoic.h" +#include "video/taiicdev.h" #include "video/poly.h" -#define TC0100SCN_GFX_NUM 0 -#define TC0480SCP_GFX_NUM 1 #define X_OFFSET 96 #define Y_OFFSET 60 @@ -47,9 +45,6 @@ VIDEO_START( galastrm ) { spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); - TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,48-X_OFFSET,4-Y_OFFSET,0,0,0,0,0); - TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,56-X_OFFSET,-63+Y_OFFSET,0,0,0,0,0); - tmpbitmaps = video_screen_auto_bitmap_alloc(machine->primary_screen); polybitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); @@ -458,6 +453,8 @@ static void tc0610_rotate_draw(running_machine *machine, bitmap_t *bitmap, bitma VIDEO_UPDATE( galastrm ) { + const device_config *tc0100scn = devtag_get_device(screen->machine, "tc0100scn"); + const device_config *tc0480scp = devtag_get_device(screen->machine, "tc0480scp"); UINT8 layer[5]; UINT8 pivlayer[3]; UINT16 priority; @@ -470,41 +467,41 @@ VIDEO_UPDATE( galastrm ) clip.max_x = video_screen_get_width(screen) -1; clip.max_y = video_screen_get_height(screen) -1; - TC0100SCN_tilemap_update(screen->machine); - TC0480SCP_tilemap_update(screen->machine); + tc0100scn_tilemap_update(tc0100scn); + tc0480scp_tilemap_update(tc0480scp); - priority = TC0480SCP_get_bg_priority(); - layer[0] = (priority &0xf000) >> 12; /* tells us which bg layer is bottom */ - layer[1] = (priority &0x0f00) >> 8; - layer[2] = (priority &0x00f0) >> 4; - layer[3] = (priority &0x000f) >> 0; /* tells us which is top */ + priority = tc0480scp_get_bg_priority(tc0480scp); + layer[0] = (priority & 0xf000) >> 12; /* tells us which bg layer is bottom */ + layer[1] = (priority & 0x0f00) >> 8; + layer[2] = (priority & 0x00f0) >> 4; + layer[3] = (priority & 0x000f) >> 0; /* tells us which is top */ layer[4] = 4; /* text layer always over bg layers */ - pivlayer[0] = TC0100SCN_bottomlayer(0); - pivlayer[1] = pivlayer[0]^1; + pivlayer[0] = tc0100scn_bottomlayer(tc0100scn); + pivlayer[1] = pivlayer[0] ^ 1; pivlayer[2] = 2; bitmap_fill(bitmap, cliprect, 0); bitmap_fill(priority_bitmap, &clip, 0); bitmap_fill(tmpbitmaps, &clip, 0); - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[0],0,0); - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[1],0,0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[0], 0, 0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[1], 0, 0); #if 0 if (layer[0]==0 && layer[1]==3 && layer[2]==2 && layer[3]==1) { - if (!input_code_pressed(screen->machine, KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1); - if (!input_code_pressed(screen->machine, KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,4); - if (!input_code_pressed(screen->machine, KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4); - if (!input_code_pressed(screen->machine, KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,4); + if (!input_code_pressed(screen->machine, KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[0], 0, 1); + if (!input_code_pressed(screen->machine, KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[1], 0, 4); + if (!input_code_pressed(screen->machine, KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[2], 0, 4); + if (!input_code_pressed(screen->machine, KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[3], 0, 4); } else { - if (!input_code_pressed(screen->machine, KEYCODE_Z)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1); - if (!input_code_pressed(screen->machine, KEYCODE_X)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,2); - if (!input_code_pressed(screen->machine, KEYCODE_C)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4); - if (!input_code_pressed(screen->machine, KEYCODE_V)) TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,8); + if (!input_code_pressed(screen->machine, KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[0], 0, 1); + if (!input_code_pressed(screen->machine, KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[1], 0, 2); + if (!input_code_pressed(screen->machine, KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[2], 0, 4); + if (!input_code_pressed(screen->machine, KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[3], 0, 8); } if (layer[0]==3 && layer[1]==0 && layer[2]==1 && layer[3]==2) @@ -533,24 +530,25 @@ VIDEO_UPDATE( galastrm ) bitmap_fill(priority_bitmap, cliprect, 0); draw_sprites(screen->machine,bitmap,cliprect,primasks,0); - if (!input_code_pressed(screen->machine, KEYCODE_B)) TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,0); - if (!input_code_pressed(screen->machine, KEYCODE_M)) TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[2],0,0); + if (!input_code_pressed(screen->machine, KEYCODE_B)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); + if (!input_code_pressed(screen->machine, KEYCODE_M)) tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); + #else if (layer[0]==0 && layer[1]==3 && layer[2]==2 && layer[3]==1) { - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1); - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,4); - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4); - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,4); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[0], 0, 1); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[1], 0, 4); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[2], 0, 4); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[3], 0, 4); } else { - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[0],0,1); - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[1],0,2); - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[2],0,4); - TC0480SCP_tilemap_draw(screen->machine,tmpbitmaps,&clip,layer[3],0,8); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[0], 0, 1); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[1], 0, 2); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[2], 0, 4); + tc0480scp_tilemap_draw(tc0480scp, tmpbitmaps, &clip, layer[3], 0, 8); } if (layer[0]==3 && layer[1]==0 && layer[2]==1 && layer[3]==2) @@ -579,8 +577,8 @@ VIDEO_UPDATE( galastrm ) bitmap_fill(priority_bitmap, cliprect, 0); draw_sprites(screen->machine,bitmap,cliprect,primasks,0); - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,0); - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[2],0,0); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); #endif return 0; diff --git a/src/mame/video/taiicdev.c b/src/mame/video/taiicdev.c index 20afc6f7cae..d6791c472ff 100644 --- a/src/mame/video/taiicdev.c +++ b/src/mame/video/taiicdev.c @@ -3541,6 +3541,13 @@ int tc0480scp_get_bg_priority( const device_config *device ) return tc0480scp_bg_pri_lookup[(tc0480scp->pri_reg & 0x1c) >> 2]; } +// undrfire.c also needs to directly access the priority reg +READ8_DEVICE_HANDLER( tc0480scp_pri_reg_r ) +{ + tc0480scp_state *tc0480scp = tc0480scp_get_safe_token(device); + return tc0480scp->pri_reg; +} + static STATE_POSTLOAD( tc0480scp_postload ) { tc0480scp_state *tc0480scp = (tc0480scp_state *)param; diff --git a/src/mame/video/taiicdev.h b/src/mame/video/taiicdev.h index 8a9f0722d6f..94b0125687e 100644 --- a/src/mame/video/taiicdev.h +++ b/src/mame/video/taiicdev.h @@ -315,7 +315,7 @@ void tc0480scp_tilemap_draw(const device_config *device, bitmap_t *bitmap, const int tc0480scp_get_bg_priority(const device_config *device); /* Undrfire needs to read this for a sprite/tile priority hack */ -//extern int TC0480SCP_pri_reg; +READ8_DEVICE_HANDLER( tc0480scp_pri_reg_r ); /** TC0150ROD **/ diff --git a/src/mame/video/undrfire.c b/src/mame/video/undrfire.c index c5ff7f355c9..9e8b45c6f1d 100644 --- a/src/mame/video/undrfire.c +++ b/src/mame/video/undrfire.c @@ -1,8 +1,5 @@ #include "driver.h" -#include "video/taitoic.h" - -#define TC0100SCN_GFX_NUM 2 -#define TC0480SCP_GFX_NUM 1 +#include "video/taiicdev.h" UINT16 undrfire_rotate_ctrl[8]; @@ -26,11 +23,8 @@ VIDEO_START( undrfire ) spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); - TC0100SCN_vh_start(machine,1,TC0100SCN_GFX_NUM,50,8,0,0,0,0,0); - TC0480SCP_vh_start(machine,TC0480SCP_GFX_NUM,0,0x24,0,-1,0,0,0,0); - - for (i=0; i<16384; i++) /* Fix later - some weird colours in places */ - palette_set_color(machine,i,MAKE_RGB(0,0,0)); + for (i = 0; i < 16384; i++) /* Fix later - some weird colours in places */ + palette_set_color(machine, i, MAKE_RGB(0,0,0)); } /*************************************************************** @@ -363,6 +357,8 @@ static void draw_sprites_cbombers(running_machine *machine, bitmap_t *bitmap,con VIDEO_UPDATE( undrfire ) { + const device_config *tc0100scn = devtag_get_device(screen->machine, "tc0100scn"); + const device_config *tc0480scp = devtag_get_device(screen->machine, "tc0480scp"); UINT8 layer[5]; UINT8 pivlayer[3]; UINT16 priority; @@ -408,23 +404,23 @@ VIDEO_UPDATE( undrfire ) } #endif - TC0100SCN_tilemap_update(screen->machine); - TC0480SCP_tilemap_update(screen->machine); + tc0100scn_tilemap_update(tc0100scn); + tc0480scp_tilemap_update(tc0480scp); - priority = TC0480SCP_get_bg_priority(); + priority = tc0480scp_get_bg_priority(tc0480scp); - layer[0] = (priority &0xf000) >> 12; /* tells us which bg layer is bottom */ - layer[1] = (priority &0x0f00) >> 8; - layer[2] = (priority &0x00f0) >> 4; - layer[3] = (priority &0x000f) >> 0; /* tells us which is top */ + layer[0] = (priority & 0xf000) >> 12; /* tells us which bg layer is bottom */ + layer[1] = (priority & 0x0f00) >> 8; + layer[2] = (priority & 0x00f0) >> 4; + layer[3] = (priority & 0x000f) >> 0; /* tells us which is top */ layer[4] = 4; /* text layer always over bg layers */ - pivlayer[0] = TC0100SCN_bottomlayer(0); - pivlayer[1] = pivlayer[0]^1; + pivlayer[0] = tc0100scn_bottomlayer(tc0100scn); + pivlayer[1] = pivlayer[0] ^ 1; pivlayer[2] = 2; - bitmap_fill(screen->machine->priority_bitmap,cliprect,0); - bitmap_fill(bitmap,cliprect,0); /* wrong color? */ + bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); + bitmap_fill(bitmap, cliprect, 0); /* wrong color? */ /* The "PIV" chip seems to be a renamed TC0100SCN. It has a @@ -433,52 +429,52 @@ VIDEO_UPDATE( undrfire ) pointless - it's always hidden by other layers. Does it serve some blending pupose ? */ - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[0],TILEMAP_DRAW_OPAQUE,0); - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[1],0,0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[0], TILEMAP_DRAW_OPAQUE, 0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[1], 0, 0); #ifdef MAME_DEBUG if (dislayer[layer[0]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],0,1); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0], 0, 1); #ifdef MAME_DEBUG if (dislayer[layer[1]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,2); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 2); #ifdef MAME_DEBUG if (dislayer[layer[2]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[2],0,4); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 4); #ifdef MAME_DEBUG if (dislayer[layer[3]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[3],0,8); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 8); #ifdef MAME_DEBUG if (dislayer[4]==0) #endif /* Sprites have variable priority (we kludge this on road levels) */ { - if ((TC0480SCP_pri_reg &0x3) == 3) /* on road levels kludge sprites up 1 priority */ + if ((tc0480scp_pri_reg_r(tc0480scp, 0) & 0x3) == 3) /* on road levels kludge sprites up 1 priority */ { static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0}; - draw_sprites(screen->machine, bitmap,cliprect,primasks,44,-574); + draw_sprites(screen->machine, bitmap, cliprect, primasks, 44, -574); } else { static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0}; - draw_sprites(screen->machine, bitmap,cliprect,primasks,44,-574); + draw_sprites(screen->machine, bitmap, cliprect, primasks, 44, -574); } } #ifdef MAME_DEBUG if (dislayer[5]==0) #endif - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[2],0,0); /* piv text layer */ + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); /* piv text layer */ - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,0); /* TC0480SCP text layer */ + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */ /* See if we should draw artificial gun targets */ /* (not yet implemented...) */ @@ -507,6 +503,8 @@ VIDEO_UPDATE( undrfire ) VIDEO_UPDATE( cbombers ) { + const device_config *tc0100scn = devtag_get_device(screen->machine, "tc0100scn"); + const device_config *tc0480scp = devtag_get_device(screen->machine, "tc0480scp"); UINT8 layer[5]; UINT8 pivlayer[3]; UINT16 priority; @@ -552,23 +550,23 @@ VIDEO_UPDATE( cbombers ) } #endif - TC0100SCN_tilemap_update(screen->machine); - TC0480SCP_tilemap_update(screen->machine); + tc0100scn_tilemap_update(tc0100scn); + tc0480scp_tilemap_update(tc0480scp); - priority = TC0480SCP_get_bg_priority(); + priority = tc0480scp_get_bg_priority(tc0480scp); - layer[0] = (priority &0xf000) >> 12; /* tells us which bg layer is bottom */ - layer[1] = (priority &0x0f00) >> 8; - layer[2] = (priority &0x00f0) >> 4; - layer[3] = (priority &0x000f) >> 0; /* tells us which is top */ + layer[0] = (priority & 0xf000) >> 12; /* tells us which bg layer is bottom */ + layer[1] = (priority & 0x0f00) >> 8; + layer[2] = (priority & 0x00f0) >> 4; + layer[3] = (priority & 0x000f) >> 0; /* tells us which is top */ layer[4] = 4; /* text layer always over bg layers */ - pivlayer[0] = TC0100SCN_bottomlayer(0); - pivlayer[1] = pivlayer[0]^1; + pivlayer[0] = tc0100scn_bottomlayer(tc0100scn); + pivlayer[1] = pivlayer[0] ^ 1; pivlayer[2] = 2; - bitmap_fill(screen->machine->priority_bitmap,cliprect,0); - bitmap_fill(bitmap,cliprect,0); /* wrong color? */ + bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); + bitmap_fill(bitmap, cliprect, 0); /* wrong color? */ /* The "PIV" chip seems to be a renamed TC0100SCN. It has a @@ -577,52 +575,52 @@ VIDEO_UPDATE( cbombers ) pointless - it's always hidden by other layers. Does it serve some blending pupose ? */ - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[0],TILEMAP_DRAW_OPAQUE,0); - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[1],0,0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[0], TILEMAP_DRAW_OPAQUE, 0); + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[1], 0, 0); #ifdef MAME_DEBUG if (dislayer[layer[0]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[0],0,1); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0], 0, 1); #ifdef MAME_DEBUG if (dislayer[layer[1]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[1],0,2); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 2); #ifdef MAME_DEBUG if (dislayer[layer[2]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[2],0,4); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 4); #ifdef MAME_DEBUG if (dislayer[layer[3]]==0) #endif - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[3],0,8); + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 8); #ifdef MAME_DEBUG if (dislayer[4]==0) #endif /* Sprites have variable priority (we kludge this on road levels) */ { - if ((TC0480SCP_pri_reg &0x3) == 3) /* on road levels kludge sprites up 1 priority */ + if ((tc0480scp_pri_reg_r(tc0480scp, 0) & 0x3) == 3) /* on road levels kludge sprites up 1 priority */ { static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0}; - draw_sprites_cbombers(screen->machine, bitmap,cliprect,primasks,80,-208); + draw_sprites_cbombers(screen->machine, bitmap, cliprect, primasks, 80, -208); } else { static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0}; - draw_sprites_cbombers(screen->machine, bitmap,cliprect,primasks,80,-208); + draw_sprites_cbombers(screen->machine, bitmap, cliprect, primasks, 80, -208); } } #ifdef MAME_DEBUG if (dislayer[5]==0) #endif - TC0100SCN_tilemap_draw(screen->machine,bitmap,cliprect,0,pivlayer[2],0,0); /* piv text layer */ + tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); /* piv text layer */ - TC0480SCP_tilemap_draw(screen->machine,bitmap,cliprect,layer[4],0,0); /* TC0480SCP text layer */ + tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */ /* Enable this to see rotation (?) control words */ #if 0