diff options
| author | 2012-06-07 16:04:30 +0000 | |
|---|---|---|
| committer | 2012-06-07 16:04:30 +0000 | |
| commit | cba32d02dc560dc413d1f47d9cd79b0f26218b54 (patch) | |
| tree | 9dfe9b3749a49967960f005f94ea76f2c32b9a28 /src | |
| parent | cbbc062ff3810f03f0fe2ecff887f751ab46bb7f (diff) | |
Starting to hook the automat (bootleg of robocop) back up, From Haze (nw)
Diffstat (limited to 'src')
| -rw-r--r-- | src/mame/drivers/dec0.c | 116 | ||||
| -rw-r--r-- | src/mame/includes/dec0.h | 28 | ||||
| -rw-r--r-- | src/mame/video/dec0.c | 178 |
3 files changed, 196 insertions, 126 deletions
diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index 0b549a0ab8f..0cf827a780e 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -167,8 +167,6 @@ Notes: #include "sound/3812intf.h" #include "sound/okim6295.h" #include "sound/msm5205.h" -#include "video/decbac06.h" -#include "video/decmxc06.h" /******************************************************************************/ @@ -220,7 +218,7 @@ WRITE16_MEMBER(dec0_state::dec0_control_w) } -WRITE16_MEMBER(automat_state::automat_control_w) +WRITE16_MEMBER(dec0_automat_state::automat_control_w) { switch (offset << 1) { @@ -426,8 +424,8 @@ void slyspy_set_protection_map(running_machine& machine, int type) dec0_state *state = machine.driver_data<dec0_state>(); address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM); - deco_bac06_device *tilegen1 = (deco_bac06_device*)space->machine().device<deco_bac06_device>("tilegen1"); - deco_bac06_device *tilegen2 = (deco_bac06_device*)space->machine().device<deco_bac06_device>("tilegen2"); + deco_bac06_device *tilegen1 = (deco_bac06_device*)state->m_tilegen1; + deco_bac06_device *tilegen2 = (deco_bac06_device*)state->m_tilegen2; space->install_write_handler( 0x240000, 0x24ffff, write16_delegate(FUNC(dec0_state::unmapped_w),state)); @@ -610,8 +608,22 @@ static ADDRESS_MAP_START( secretab_map, AS_PROGRAM, 16, dec0_state ) AM_RANGE(0xb08000, 0xb087ff) AM_RAM AM_SHARE("spriteram") /* Sprites */ ADDRESS_MAP_END +/* swizzle the palette writes around so we can use the same gfx plane ordering as the originals */ +READ16_MEMBER( dec0_automat_state::automat_palette_r ) +{ + offset ^=0xf; + return m_generic_paletteram_16[offset]; +} + +WRITE16_MEMBER( dec0_automat_state::automat_palette_w ) +{ + offset ^=0xf; + paletteram_xxxxBBBBGGGGRRRR_word_w(space, offset, data, mem_mask); +} -static ADDRESS_MAP_START( automat_map, AS_PROGRAM, 16, automat_state ) + + +static ADDRESS_MAP_START( automat_map, AS_PROGRAM, 16, dec0_automat_state ) AM_RANGE(0x000000, 0x05ffff) AM_ROM AM_RANGE(0x240000, 0x240007) AM_RAM /* text layer */ @@ -619,42 +631,44 @@ static ADDRESS_MAP_START( automat_map, AS_PROGRAM, 16, automat_state ) AM_RANGE(0x242000, 0x24207f) AM_RAM AM_RANGE(0x242400, 0x2427ff) AM_RAM AM_RANGE(0x242800, 0x243fff) AM_RAM - AM_RANGE(0x244000, 0x245fff) AM_RAM + AM_RANGE(0x244000, 0x245fff) AM_RAM AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w) AM_RANGE(0x246000, 0x246007) AM_RAM /* first tile layer */ AM_RANGE(0x246010, 0x246017) AM_RAM AM_RANGE(0x248000, 0x24807f) AM_RAM AM_RANGE(0x248400, 0x2487ff) AM_RAM - AM_RANGE(0x24a000, 0x24a7ff) AM_RAM + AM_RANGE(0x24a000, 0x24a7ff) AM_RAM AM_DEVREADWRITE_LEGACY("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w) AM_RANGE(0x24c000, 0x24c007) AM_RAM /* second tile layer */ AM_RANGE(0x24c010, 0x24c017) AM_RAM AM_RANGE(0x24c800, 0x24c87f) AM_RAM AM_RANGE(0x24cc00, 0x24cfff) AM_RAM - AM_RANGE(0x24d000, 0x24d7ff) AM_RAM + AM_RANGE(0x24d000, 0x24d7ff) AM_RAM AM_DEVREADWRITE_LEGACY("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w) AM_RANGE(0x300000, 0x30001f) AM_READ(dec0_rotary_r) AM_RANGE(0x30c000, 0x30c00b) AM_READ(dec0_controls_r) AM_RANGE(0x30c000, 0x30c01f) AM_WRITE(automat_control_w) /* Priority, sound, etc. */ - AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram") + AM_RANGE(0x310000, 0x3107ff) AM_READWRITE(automat_palette_r, automat_palette_w) AM_SHARE("paletteram") AM_RANGE(0x314000, 0x3147ff) AM_RAM - AM_RANGE(0x400008, 0x400009) AM_WRITE(dec0_priority_w) // NEW + + // video regs are moved to here.. + AM_RANGE(0x400000, 0x400007) AM_WRITE(automat_scroll_w) + AM_RANGE(0x400008, 0x400009) AM_WRITE(dec0_priority_w) + AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_SHARE("ram") /* Main ram */ AM_RANGE(0xffc000, 0xffc7ff) AM_RAM AM_SHARE("spriteram") /* Sprites */ ADDRESS_MAP_END -WRITE8_MEMBER(automat_state::automat_adpcm_w) +WRITE8_MEMBER(dec0_automat_state::automat_adpcm_w) { m_automat_adpcm_byte = data; } -static ADDRESS_MAP_START( automat_s_map, AS_PROGRAM, 8, automat_state ) +static ADDRESS_MAP_START( automat_s_map, AS_PROGRAM, 8, dec0_automat_state ) AM_RANGE(0xc000, 0xc7ff) AM_RAM -// AM_RANGE(0xc800, 0xc800) AM_WRITE_LEGACY(ym2203_control_port_0_w) -// AM_RANGE(0xc801, 0xc801) AM_WRITE_LEGACY(ym2203_write_port_0_w) - AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r) -// AM_RANGE(0xd000, 0xd000) AM_WRITE_LEGACY(ym2203_control_port_1_w) -// AM_RANGE(0xd001, 0xd001) AM_WRITE_LEGACY(ym2203_write_port_1_w) + AM_RANGE(0xc800, 0xc801) AM_DEVWRITE_LEGACY("2203a", ym2203_w) + AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_byte_r) + AM_RANGE(0xd000, 0xd001) AM_DEVWRITE_LEGACY("2203b", ym2203_w) AM_RANGE(0xf000, 0xf000) AM_WRITE(automat_adpcm_w) AM_RANGE(0x0000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -1198,7 +1212,7 @@ static const gfx_layout tilelayout = 16*16 }; -static const gfx_layout automat_tilelayout = +static const gfx_layout automat_spritelayout = { 16,16, RGN_FRAC(1,4), @@ -1244,7 +1258,7 @@ static GFXDECODE_START( automat ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) /* Characters 8x8 */ GFXDECODE_ENTRY( "gfx2", 0, automat_tilelayout3, 512, 16 ) /* Tiles 16x16 */ GFXDECODE_ENTRY( "gfx3", 0, automat_tilelayout2, 768, 16 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx4", 0, automat_tilelayout, 256, 16 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "gfx4", 0, automat_spritelayout, 256, 16 ) /* Sprites 16x16 */ GFXDECODE_END static GFXDECODE_START( midres ) @@ -1401,7 +1415,7 @@ MACHINE_CONFIG_END static void automat_vclk_cb(device_t *device) { - automat_state *state = device->machine().driver_data<automat_state>(); + dec0_automat_state *state = device->machine().driver_data<dec0_automat_state>(); if (state->m_automat_msm5205_vclk_toggle == 0) { msm5205_data_w(device, state->m_automat_adpcm_byte & 0xf); @@ -1422,7 +1436,7 @@ static const msm5205_interface msm5205_config = }; -static MACHINE_CONFIG_START( automat, automat_state ) +static MACHINE_CONFIG_START( automat, dec0_automat_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 10000000) @@ -1439,19 +1453,27 @@ static MACHINE_CONFIG_START( automat, automat_state ) MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART) MCFG_SCREEN_UPDATE_STATIC(automat) + MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0) + deco_bac06_device::set_gfx_region_wide(*device, 0,0,0); + MCFG_DEVICE_ADD("tilegen2", DECO_BAC06, 0) + deco_bac06_device::set_gfx_region_wide(*device, 0,1,0); + MCFG_DEVICE_ADD("tilegen3", DECO_BAC06, 0) + deco_bac06_device::set_gfx_region_wide(*device, 0,2,0); + + MCFG_PALETTE_LENGTH(1024) MCFG_GFXDECODE(automat) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("ym1", YM2203, 1500000) + MCFG_SOUND_ADD("2203a", YM2203, 1500000) MCFG_SOUND_ROUTE(0, "mono", 0.90) MCFG_SOUND_ROUTE(1, "mono", 0.90) MCFG_SOUND_ROUTE(2, "mono", 0.90) MCFG_SOUND_ROUTE(3, "mono", 0.35) - MCFG_SOUND_ADD("ym2", YM2203, 1500000) + MCFG_SOUND_ADD("2203b", YM2203, 1500000) MCFG_SOUND_ROUTE(0, "mono", 0.90) MCFG_SOUND_ROUTE(1, "mono", 0.90) MCFG_SOUND_ROUTE(2, "mono", 0.90) @@ -2297,20 +2319,20 @@ ROM_START( automat ) ROM_LOAD( "12.bin", 0x30000, 0x10000, CRC(00cd0990) SHA1(3fc498fcee2110001e376f5ee38d7dd361bd3ee3) ) // y /* copy out the chars */ - ROM_REGION( 0x20000, "gfx1", 0 ) /* chars */ + ROM_REGION( 0x20000, "gfx1", ROMREGION_INVERT ) /* chars */ ROM_COPY( "gfxload1", 0x00000, 0x00000, 0x8000 ) ROM_COPY( "gfxload1", 0x10000, 0x08000, 0x8000 ) ROM_COPY( "gfxload1", 0x20000, 0x10000, 0x8000 ) ROM_COPY( "gfxload1", 0x30000, 0x18000, 0x8000 ) - ROM_REGION( 0x20000, "gfx3", 0 ) /* tiles */ + ROM_REGION( 0x20000, "gfx3", ROMREGION_INVERT ) /* tiles */ ROM_COPY( "gfxload1", 0x08000, 0x00000, 0x8000 ) ROM_COPY( "gfxload1", 0x18000, 0x08000, 0x8000 ) ROM_COPY( "gfxload1", 0x28000, 0x10000, 0x8000 ) ROM_COPY( "gfxload1", 0x38000, 0x18000, 0x8000 ) // we have to rearrange this with ROM_CONTINUE due to the way gfxdecode works */ - ROM_REGION( 0x40000, "gfx2", 0 ) /* tiles */ + ROM_REGION( 0x40000, "gfx2", ROMREGION_INVERT ) /* tiles */ ROM_LOAD( "9.bin", 0x00000, 0x2000, CRC(ccf91ce0) SHA1(c976eddcea48da6e7fbd28a4d5c48706d61cabfb) ) ROM_CONTINUE( 0x04000, 0x2000 ) ROM_CONTINUE( 0x08000, 0x2000 ) @@ -2346,7 +2368,7 @@ ROM_START( automat ) // the sprite data is the same as robocop, but with the bits in each byte reversed // 21.bin was repaired with this knowledge as the chip was faulty - ROM_REGION( 0x80000, "gfx4", ROMREGION_INVERT) /* sprites */ + ROM_REGION( 0x80000, "gfx4", 0) /* sprites */ ROM_LOAD( "16.bin", 0x00000, 0x10000, CRC(e42e8675) SHA1(5b964477de8278ea330ffc2366e5fc7e10122ef8) ) ROM_LOAD( "17.bin", 0x10000, 0x08000, CRC(9a414c56) SHA1(017eb5a238e24cd6de50afd029c239993fc61a21) ) ROM_LOAD( "20.bin", 0x20000, 0x10000, CRC(7c62a2a1) SHA1(43a40355cdcbb17506f9634e8f12673287e79bd7) ) @@ -3021,44 +3043,6 @@ ROM_START( bouldashj ) ROM_LOAD( "ta-16.21k", 0x0000, 0x0100, CRC(ad26e8d4) SHA1(827337aeb8904429a1c050279240ae38aa6ce064) ) /* Priority (not used) */ ROM_END -// helper function -#if 0 -static void dump_to_file(running_machine& machine, UINT8* ROM, int offset, int size) -{ - { - FILE *fp; - char filename[256]; - sprintf(filename,"%s_%08x_%08x", machine.system().name, offset, size); - fp=fopen(filename, "w+b"); - if (fp) - { - fwrite(ROM+offset, size, 1, fp); - fclose(fp); - } - } -} - - -static DRIVER_INIT( convert_robocop_gfx4_to_automat ) -{ - UINT8* R = machine.root_device().memregion("gfx4")->base(); - int i; - - for (i=0;i<0x80000;i++) - { - R[i] = BITSWAP8(R[i],0,1,2,3,4,5,6,7); - } - - dump_to_file(machine,R, 0x00000, 0x10000); - dump_to_file(machine,R, 0x10000, 0x08000); - dump_to_file(machine,R, 0x20000, 0x10000); - dump_to_file(machine,R, 0x30000, 0x08000); - dump_to_file(machine,R, 0x40000, 0x10000); - dump_to_file(machine,R, 0x50000, 0x08000); - dump_to_file(machine,R, 0x60000, 0x10000); - dump_to_file(machine,R, 0x70000, 0x08000); -} -#endif static DRIVER_INIT( midresb ) { diff --git a/src/mame/includes/dec0.h b/src/mame/includes/dec0.h index 125c9e9cb8d..fee06053ce2 100644 --- a/src/mame/includes/dec0.h +++ b/src/mame/includes/dec0.h @@ -1,3 +1,6 @@ +#include "video/decbac06.h" +#include "video/decmxc06.h" + class dec0_state : public driver_device { public: @@ -5,12 +8,23 @@ public: : driver_device(mconfig, type, tag) , m_ram(*this, "ram"), m_spriteram(*this, "spriteram"), - m_robocop_shared_ram(*this, "robocop_shared"){ } + m_robocop_shared_ram(*this, "robocop_shared"), + m_tilegen1(*this, "tilegen1"), + m_tilegen2(*this, "tilegen2"), + m_tilegen3(*this, "tilegen3"), + m_spritegen(*this, "spritegen") + { } required_shared_ptr<UINT16> m_ram; required_shared_ptr<UINT16> m_spriteram; optional_shared_ptr<UINT8> m_robocop_shared_ram; + optional_device<deco_bac06_device> m_tilegen1; + optional_device<deco_bac06_device> m_tilegen2; + optional_device<deco_bac06_device> m_tilegen3; + optional_device<deco_mxc06_device> m_spritegen; + + int m_GAME; int m_i8751_return; int m_i8751_command; @@ -51,10 +65,10 @@ public: }; -class automat_state : public dec0_state +class dec0_automat_state : public dec0_state { public: - automat_state(const machine_config &mconfig, device_type type, const char *tag) + dec0_automat_state(const machine_config &mconfig, device_type type, const char *tag) : dec0_state(mconfig, type, tag) { } @@ -63,6 +77,14 @@ public: int m_automat_msm5205_vclk_toggle; DECLARE_WRITE16_MEMBER(automat_control_w); DECLARE_WRITE8_MEMBER(automat_adpcm_w); + DECLARE_READ16_MEMBER( automat_palette_r ); + DECLARE_WRITE16_MEMBER( automat_palette_w ); + DECLARE_WRITE16_MEMBER( automat_scroll_w ) + { + COMBINE_DATA(&m_automat_scroll_regs[offset]); + } + UINT16 m_automat_scroll_regs[4]; + }; diff --git a/src/mame/video/dec0.c b/src/mame/video/dec0.c index 78163435529..a9ab126c211 100644 --- a/src/mame/video/dec0.c +++ b/src/mame/video/dec0.c @@ -6,8 +6,7 @@ #include "emu.h" #include "includes/dec0.h" -#include "video/decbac06.h" -#include "video/decmxc06.h" + /******************************************************************************/ @@ -49,16 +48,16 @@ SCREEN_UPDATE_IND16( hbarrel ) { dec0_state *state = screen.machine().driver_data<dec0_state>(); - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x08, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x08, 0x0f); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); /* HB always keeps pf2 on top of pf3, no need explicitly support priority register */ - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x00, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x00, 0x0f); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } @@ -67,37 +66,37 @@ SCREEN_UPDATE_IND16( hbarrel ) SCREEN_UPDATE_IND16( baddudes ) { dec0_state *state = screen.machine().driver_data<dec0_state>(); - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); /* WARNING: inverted wrt Midnight Resistance */ if ((state->m_pri & 0x01) == 0) { - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); if (state->m_pri & 2) - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); if (state->m_pri & 4) - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ } else { - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); if (state->m_pri & 2) - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); if (state->m_pri & 4) - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */ } - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } @@ -108,7 +107,7 @@ SCREEN_UPDATE_IND16( robocop ) dec0_state *state = screen.machine().driver_data<dec0_state>(); int trans; - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); if (state->m_pri & 0x04) trans = 0x08; @@ -121,35 +120,100 @@ SCREEN_UPDATE_IND16( robocop ) /* Robocop uses it only for the title screen, so this might be just */ /* completely wrong. The top 8 bits of the register might mean */ /* something (they are 0x80 in midres, 0x00 here) */ - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); if (state->m_pri & 0x02) - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); } else { - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); if (state->m_pri & 0x02) - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); } if (state->m_pri & 0x02) - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans^0x08, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans^0x08, 0x0f); else - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } SCREEN_UPDATE_IND16( automat ) { + dec0_automat_state *state = screen.machine().driver_data<dec0_automat_state>(); + int trans; + + // layer enables seem different... where are they? + + // the bootleg doesn't write these registers, I think they're hardcoded?, so fake them for compatibility with our implementation.. + deco_bac06_pf_control_0_w(state->m_tilegen1,0,0x0003, 0x00ff); // 8x8 + deco_bac06_pf_control_0_w(state->m_tilegen1,1,0x0003, 0x00ff); + deco_bac06_pf_control_0_w(state->m_tilegen1,2,0x0000, 0x00ff); + deco_bac06_pf_control_0_w(state->m_tilegen1,3,0x0001, 0x00ff); // dimensions + + deco_bac06_pf_control_0_w(state->m_tilegen2,0,0x0082, 0x00ff); // 16x16 + deco_bac06_pf_control_0_w(state->m_tilegen2,1,0x0000, 0x00ff); + deco_bac06_pf_control_0_w(state->m_tilegen2,2,0x0000, 0x00ff); + deco_bac06_pf_control_0_w(state->m_tilegen2,3,0x0001, 0x00ff); // dimensions + + deco_bac06_pf_control_0_w(state->m_tilegen3,0,0x0082, 0x00ff); // 16x16 + deco_bac06_pf_control_0_w(state->m_tilegen3,1,0x0003, 0x00ff); + deco_bac06_pf_control_0_w(state->m_tilegen3,2,0x0000, 0x00ff); + deco_bac06_pf_control_0_w(state->m_tilegen3,3,0x0001, 0x00ff); // dimensions + + // scroll registers got written elsewhere, copy them across + deco_bac06_pf_control_1_w(state->m_tilegen1,0,0x0000, 0xffff); // no scroll? + deco_bac06_pf_control_1_w(state->m_tilegen1,1,0x0000, 0xffff); // no scroll? + + deco_bac06_pf_control_1_w(state->m_tilegen2,0,state->m_automat_scroll_regs[3] - 0x010a, 0xffff); + deco_bac06_pf_control_1_w(state->m_tilegen2,1,state->m_automat_scroll_regs[2], 0xffff); + + deco_bac06_pf_control_1_w(state->m_tilegen3,0,state->m_automat_scroll_regs[1] - 0x0108, 0xffff); + deco_bac06_pf_control_1_w(state->m_tilegen3,1,state->m_automat_scroll_regs[0], 0xffff); + + // sprites seem very different, probably need new functions + + state->flip_screen_set(state->m_tilegen1->get_flip_state()); + + if (state->m_pri & 0x04) + trans = 0x08; + else + trans = 0x00; + + if (state->m_pri & 0x01) + { + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + + if (state->m_pri & 0x02) + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); + + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + } + else + { + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + + if (state->m_pri & 0x02) + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); + + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + } + +// if (state->m_pri & 0x02) +// state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans^0x08, 0x0f); +// else +// state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } @@ -159,14 +223,14 @@ SCREEN_UPDATE_IND16( birdtry ) { dec0_state *state = screen.machine().driver_data<dec0_state>(); - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); /* This game doesn't have the extra playfield chip on the game board, but the palette does show through. */ bitmap.fill(screen.machine().pens[768], cliprect); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } @@ -175,21 +239,21 @@ SCREEN_UPDATE_IND16( birdtry ) SCREEN_UPDATE_IND16( hippodrm ) { dec0_state *state = screen.machine().driver_data<dec0_state>(); - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); if (state->m_pri & 0x01) { - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); } else { - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); } - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } @@ -198,18 +262,18 @@ SCREEN_UPDATE_IND16( hippodrm ) SCREEN_UPDATE_IND16( slyspy ) { dec0_state *state = screen.machine().driver_data<dec0_state>(); - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); /* Redraw top 8 pens of top 8 palettes over sprites */ if (state->m_pri&0x80) - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } @@ -220,7 +284,7 @@ SCREEN_UPDATE_IND16( midres ) dec0_state *state = screen.machine().driver_data<dec0_state>(); int trans; - state->flip_screen_set(screen.machine().device<deco_bac06_device>("tilegen1")->get_flip_state()); + state->flip_screen_set(state->m_tilegen1->get_flip_state()); if (state->m_pri & 0x04) trans = 0x00; @@ -228,29 +292,29 @@ SCREEN_UPDATE_IND16( midres ) if (state->m_pri & 0x01) { - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); if (state->m_pri & 0x02) - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); } else { - screen.machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen3->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); if (state->m_pri & 0x02) - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen2->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); } if (state->m_pri & 0x02) - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans ^ 0x08, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans ^ 0x08, 0x0f); else - screen.machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); + state->m_spritegen->draw_sprites(screen.machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f); - screen.machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); + state->m_tilegen1->deco_bac06_pf_draw(screen.machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00); return 0; } |
