From db8e4df4e5900e9cc98c742dc612383e48f123da Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Wed, 20 Apr 2011 19:36:11 +0000 Subject: [PATCH] Reverted as per-OG complaining ... --- src/mame/drivers/segahang.c | 72 ++++++-------- src/mame/drivers/segaorun.c | 102 +++++++------------ src/mame/drivers/segas16a.c | 55 +++++------ src/mame/drivers/segas16b.c | 167 +++++++++++++++---------------- src/mame/drivers/segas18.c | 99 ++++++++----------- src/mame/drivers/segaxbd.c | 27 ++--- src/mame/drivers/segaybd.c | 34 ++----- src/mame/drivers/system16.c | 93 ++++++++---------- src/mame/includes/segas16.h | 13 +-- src/mame/includes/system16.h | 36 ++++--- src/mame/machine/segaic16.c | 5 +- src/mame/machine/segaic16.h | 2 +- src/mame/video/sega16sp.c | 175 ++++++++++++++++++++------------ src/mame/video/segahang.c | 18 ++-- src/mame/video/segaic16.c | 53 +++++----- src/mame/video/segaic16.h | 186 +++++++++++++++++++++++++++++------ src/mame/video/segaorun.c | 20 ++-- src/mame/video/segas16a.c | 8 +- src/mame/video/segas16b.c | 8 +- src/mame/video/segas18.c | 6 +- src/mame/video/segaxbd.c | 10 +- src/mame/video/segaybd.c | 8 +- src/mame/video/system16.c | 35 +++++-- 23 files changed, 645 insertions(+), 587 deletions(-) diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c index bd8d1632a9f..2930f3548e5 100644 --- a/src/mame/drivers/segahang.c +++ b/src/mame/drivers/segahang.c @@ -33,6 +33,14 @@ #define MASTER_CLOCK_8MHz (8000000) +/************************************* + * + * Statics + * + *************************************/ + +static UINT16 *workram; + /************************************* * * Prototypes @@ -292,10 +300,9 @@ static WRITE8_DEVICE_HANDLER( video_lamps_w ) /* D2 : LAMP1 */ /* D1 : COIN2 */ /* D0 : COIN1 */ - device_t *spr = device->machine().device("segaspr1"); segaic16_tilemap_set_flip(device->machine(), 0, data & 0x80); - segaic16_sprites_set_flip(spr, data & 0x80); - segaic16_sprites_set_shadow(spr, ~data & 0x40); + segaic16_sprites_set_flip(device->machine(), 0, data & 0x80); + segaic16_sprites_set_shadow(device->machine(), 0, ~data & 0x40); segaic16_set_display_enable(device->machine(), data & 0x10); set_led_status(device->machine(), 1, data & 0x08); set_led_status(device->machine(), 0, data & 0x04); @@ -382,8 +389,7 @@ static INTERRUPT_GEN( i8751_main_cpu_vblank ) static void sharrier_i8751_sim(running_machine &machine) { - segas1x_state *state = machine.driver_data(); - state->m_workram[0x492/2] = (input_port_read(machine, "ADC0") << 8) | input_port_read(machine, "ADC1"); + workram[0x492/2] = (input_port_read(machine, "ADC0") << 8) | input_port_read(machine, "ADC1"); } @@ -422,12 +428,12 @@ static ADDRESS_MAP_START( hangon_map, AS_PROGRAM, 16 ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x20c000, 0x20ffff) AM_RAM - AM_RANGE(0x400000, 0x403fff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE_MEMBER(segas1x_state, m_tileram_0) - AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE_MEMBER(segas1x_state, m_textram_0) - AM_RANGE(0x600000, 0x6007ff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_0) - AM_RANGE(0xa00000, 0xa00fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_state, m_paletteram) + AM_RANGE(0x400000, 0x403fff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE(&segaic16_tileram_0) + AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE(&segaic16_textram_0) + AM_RANGE(0x600000, 0x6007ff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0xa00000, 0xa00fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc00000, 0xc3ffff) AM_ROM AM_REGION("sub", 0) - AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(segas1x_state, m_roadram_0) + AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE(&segaic16_roadram_0) AM_RANGE(0xc7c000, 0xc7ffff) AM_RAM AM_SHARE("share2") AM_RANGE(0xe00000, 0xffffff) AM_READWRITE(hangon_io_r, hangon_io_w) ADDRESS_MAP_END @@ -435,14 +441,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sharrier_map, AS_PROGRAM, 16 ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_ROM - AM_RANGE(0x040000, 0x043fff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_workram) - AM_RANGE(0x100000, 0x107fff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE_MEMBER(segas1x_state, m_tileram_0) - AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE_MEMBER(segas1x_state, m_textram_0) - AM_RANGE(0x110000, 0x110fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_state, m_paletteram) + AM_RANGE(0x040000, 0x043fff) AM_RAM AM_BASE(&workram) + AM_RANGE(0x100000, 0x107fff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE(&segaic16_tileram_0) + AM_RANGE(0x108000, 0x108fff) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE(&segaic16_textram_0) + AM_RANGE(0x110000, 0x110fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x124000, 0x127fff) AM_RAM AM_SHARE("share2") - AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_0) + AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0x140000, 0x14ffff) AM_READWRITE(sharrier_io_r, sharrier_io_w) - AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(segas1x_state, m_roadram_0) + AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE(&segaic16_roadram_0) ADDRESS_MAP_END @@ -901,28 +907,6 @@ GFXDECODE_END -static const sega16sp_interface hangon_sega16sp_intf = -{ - 1024, // colorbase - 0x800, // ramsize - 0, // xoffs - segaic16_sprites_hangon_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - -static const sega16sp_interface sharrier_sega16sp_intf = -{ - 1024, // colorbase - 0x1000, // ramsize - 0, // xoffs - segaic16_sprites_sharrier_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - /************************************* * * Generic machine drivers @@ -1072,7 +1056,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( hangon, hangon_base ) MCFG_FRAGMENT_ADD(sound_board_2203) - MCFG_SEGA16SP_ADD("segaspr1", hangon_sega16sp_intf) + MCFG_SEGA16SP_ADD_HANGON("segaspr1") MACHINE_CONFIG_END @@ -1085,7 +1069,7 @@ static MACHINE_CONFIG_DERIVED( shangupb, hangon_base ) MCFG_CPU_MODIFY("sub") MCFG_CPU_CLOCK(10000000) - MCFG_SEGA16SP_ADD("segaspr1", hangon_sega16sp_intf) + MCFG_SEGA16SP_ADD_HANGON("segaspr1") MACHINE_CONFIG_END @@ -1096,28 +1080,28 @@ static MACHINE_CONFIG_DERIVED( sharrier, sharrier_base ) MCFG_CPU_IO_MAP(mcu_io_map) MCFG_CPU_VBLANK_INT("screen", irq0_line_pulse) - MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) + MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( enduror, sharrier_base ) MCFG_FRAGMENT_ADD(sound_board_2151) - MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) + MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( enduror1, sharrier_base ) MCFG_FRAGMENT_ADD(sound_board_2203) - MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) + MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( endurob2, sharrier_base ) MCFG_FRAGMENT_ADD(sound_board_2203x2) - MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) + MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") MACHINE_CONFIG_END diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index 287cdf28afe..b73af8a741b 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -289,15 +289,14 @@ Notes: -class segaorun_state : public segas1x_state -{ -public: - segaorun_state(running_machine &machine, const driver_device_config_base &config) - : segas1x_state(machine, config) { } +/************************************* + * + * Statics + * + *************************************/ - UINT16 *m_cpu1ram; - UINT16 *m_cpu1rom; -}; +static UINT16 *workram; +static UINT16 *cpu1ram, *cpu1rom; /************************************* * @@ -341,21 +340,19 @@ static const ppi8255_interface single_ppi_intf = * *************************************/ -#define state_offset(_name) myoffsetof(segaorun_state, _name) - static const segaic16_memory_map_entry outrun_info[] = { - { 0x35/2, 0x90000, 0x10000, 0xf00000, ~0, FUNC(segaic16_road_control_0_r), NULL, FUNC(segaic16_road_control_0_w), NULL, -1, "road control" }, - { 0x35/2, 0x80000, 0x01000, 0xf0f000, ~0, FUNC_NULL, "bank10", FUNC_NULL, "bank10", state_offset(m_roadram_0), "road RAM" }, - { 0x35/2, 0x60000, 0x08000, 0xf18000, ~0, FUNC_NULL, "bank11", FUNC_NULL, "bank11", state_offset(m_cpu1ram), "CPU 1 RAM" }, - { 0x35/2, 0x00000, 0x60000, 0xf00000, ~0, FUNC_NULL, "bank12", FUNC_NULL, NULL, state_offset(m_cpu1rom), "CPU 1 ROM" }, - { 0x31/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x2d/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x29/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank14", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x25/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank15", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x25/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank16", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x21/2, 0x60000, 0x08000, 0xf98000, ~0, FUNC_NULL, "bank17", FUNC_NULL, "bank17", state_offset(m_workram), "CPU 0 RAM" }, - { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, FUNC_NULL, "bank18", FUNC_NULL, NULL, -1, "CPU 0 ROM" }, + { 0x35/2, 0x90000, 0x10000, 0xf00000, ~0, FUNC(segaic16_road_control_0_r), NULL, FUNC(segaic16_road_control_0_w), NULL, NULL, "road control" }, + { 0x35/2, 0x80000, 0x01000, 0xf0f000, ~0, FUNC_NULL, "bank10", FUNC_NULL, "bank10", &segaic16_roadram_0, "road RAM" }, + { 0x35/2, 0x60000, 0x08000, 0xf18000, ~0, FUNC_NULL, "bank11", FUNC_NULL, "bank11", &cpu1ram, "CPU 1 RAM" }, + { 0x35/2, 0x00000, 0x60000, 0xf00000, ~0, FUNC_NULL, "bank12", FUNC_NULL, NULL, &cpu1rom, "CPU 1 ROM" }, + { 0x31/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x2d/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x29/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank14", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x25/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank15", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x25/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank16", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x21/2, 0x60000, 0x08000, 0xf98000, ~0, FUNC_NULL, "bank17", FUNC_NULL, "bank17", &workram, "CPU 0 RAM" }, + { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, FUNC_NULL, "bank18", FUNC_NULL, NULL, NULL, "CPU 0 ROM" }, { 0 } }; @@ -394,14 +391,14 @@ static READ8_HANDLER( sound_data_r ) static void outrun_generic_init(running_machine &machine) { - segaorun_state *state = machine.driver_data(); + segas1x_state *state = machine.driver_data(); /* allocate memory for regions not automatically assigned */ - state->m_spriteram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); - state->m_paletteram = auto_alloc_array(machine, UINT16, 0x02000/2); - state->m_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); - state->m_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); - state->m_workram = auto_alloc_array(machine, UINT16, 0x08000/2); + segaic16_spriteram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + segaic16_paletteram = auto_alloc_array(machine, UINT16, 0x02000/2); + segaic16_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); + segaic16_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + workram = auto_alloc_array(machine, UINT16, 0x08000/2); /* init the memory mapper */ segaic16_memory_mapper_init(machine.device("maincpu"), outrun_info, sound_data_w, NULL); @@ -421,16 +418,16 @@ static void outrun_generic_init(running_machine &machine) nvram_device *nvram = machine.device("nvram"); if (nvram != NULL) - nvram->set_base(state->m_workram, 0x8000); + nvram->set_base(workram, 0x8000); state->save_item(NAME(state->m_adc_select)); state->save_item(NAME(state->m_vblank_irq_state)); state->save_item(NAME(state->m_irq2_state)); - state_save_register_global_pointer(machine, state->m_spriteram_0, 0x01000/2); - state_save_register_global_pointer(machine, state->m_paletteram, 0x02000/2); - state_save_register_global_pointer(machine, state->m_tileram_0, 0x10000/2); - state_save_register_global_pointer(machine, state->m_textram_0, 0x01000/2); - state_save_register_global_pointer(machine, state->m_workram, 0x08000/2); + state_save_register_global_pointer(machine, segaic16_spriteram_0, 0x01000/2); + state_save_register_global_pointer(machine, segaic16_paletteram, 0x02000/2); + state_save_register_global_pointer(machine, segaic16_tileram_0, 0x10000/2); + state_save_register_global_pointer(machine, segaic16_textram_0, 0x01000/2); + state_save_register_global_pointer(machine, workram, 0x08000/2); } @@ -715,7 +712,7 @@ static WRITE16_HANDLER( outrun_custom_io_w ) return; case 0x70/2: - segaic16_sprites_draw_w(space->machine().device("segaspr1"), offset, data, mem_mask); + segaic16_sprites_draw_0_w(space, offset, data, mem_mask); return; } logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space->device()), offset * 2, data, mem_mask); @@ -807,9 +804,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 16 ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xfffff) - AM_RANGE(0x000000, 0x05ffff) AM_ROM AM_BASE_MEMBER(segaorun_state, m_cpu1rom) - AM_RANGE(0x060000, 0x067fff) AM_MIRROR(0x018000) AM_RAM AM_BASE_MEMBER(segaorun_state, m_cpu1ram) - AM_RANGE(0x080000, 0x080fff) AM_MIRROR(0x00f000) AM_RAM AM_BASE_MEMBER(segaorun_state, m_roadram_0) + AM_RANGE(0x000000, 0x05ffff) AM_ROM AM_BASE(&cpu1rom) + AM_RANGE(0x060000, 0x067fff) AM_MIRROR(0x018000) AM_RAM AM_BASE(&cpu1ram) + AM_RANGE(0x080000, 0x080fff) AM_MIRROR(0x00f000) AM_RAM AM_BASE(&segaic16_roadram_0) AM_RANGE(0x090000, 0x09ffff) AM_READWRITE(segaic16_road_control_0_r, segaic16_road_control_0_w) ADDRESS_MAP_END @@ -1098,29 +1095,6 @@ static GFXDECODE_START( segaorun ) GFXDECODE_END -static const sega16sp_interface outrun_sega16sp_intf = -{ - 2048, // colorbase - 0x1000, // ramsize - 0, // xoffs - segaic16_sprites_outrun_draw, // draw function - 1, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - -static const sega16sp_interface s16b_sega16sp_intf = -{ - 1024, // colorbase - 0x800, // ramsize - 0, // xoffs - segaic16_sprites_16b_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - - /************************************* * @@ -1128,7 +1102,7 @@ static const sega16sp_interface s16b_sega16sp_intf = * *************************************/ -static MACHINE_CONFIG_START( outrun_base, segaorun_state ) +static MACHINE_CONFIG_START( outrun_base, segas1x_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK/4) @@ -1173,13 +1147,13 @@ static MACHINE_CONFIG_START( outrun_base, segaorun_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( outrundx, outrun_base ) - MCFG_SEGA16SP_ADD("segaspr1", outrun_sega16sp_intf) + MCFG_SEGA16SP_ADD_OUTRUN("segaspr1") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( outrun, outrun_base ) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_SEGA16SP_ADD("segaspr1", outrun_sega16sp_intf) + MCFG_SEGA16SP_ADD_OUTRUN("segaspr1") MACHINE_CONFIG_END @@ -1192,7 +1166,7 @@ static MACHINE_CONFIG_DERIVED( shangon, outrun_base ) MCFG_VIDEO_START(shangon) - MCFG_SEGA16SP_ADD("segaspr1", s16b_sega16sp_intf) + MCFG_SEGA16SP_ADD_16B("segaspr1") MACHINE_CONFIG_END diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c index 9c770224d03..80daf48b588 100644 --- a/src/mame/drivers/segas16a.c +++ b/src/mame/drivers/segas16a.c @@ -159,6 +159,15 @@ Tetris - - - - EPR12169 EPR12170 - #include "video/segaic16.h" +/************************************* + * + * Statics + * + *************************************/ + +static UINT16 *workram; + + /************************************* * * Prototypes @@ -366,7 +375,7 @@ static WRITE8_DEVICE_HANDLER( video_control_w ) state->m_video_control = data; segaic16_tilemap_set_flip(device->machine(), 0, data & 0x80); - segaic16_sprites_set_flip(device->machine().device("segaspr1"), data & 0x80); + segaic16_sprites_set_flip(device->machine(), 0, data & 0x80); if (state->m_mcu != NULL) device_set_input_line(state->m_mcu, MCS51_INT1_LINE, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE); @@ -543,10 +552,10 @@ static INTERRUPT_GEN( i8751_main_cpu_vblank ) static void dumpmtmt_i8751_sim(running_machine &machine) { segas1x_state *state = machine.driver_data(); - UINT8 flag = state->m_workram[0x200/2] >> 8; - UINT8 tick = state->m_workram[0x200/2] & 0xff; - UINT8 sec = state->m_workram[0x202/2] >> 8; - UINT8 min = state->m_workram[0x202/2] & 0xff; + UINT8 flag = workram[0x200/2] >> 8; + UINT8 tick = workram[0x200/2] & 0xff; + UINT8 sec = workram[0x202/2] >> 8; + UINT8 min = workram[0x202/2] & 0xff; /* signal a VBLANK to the main CPU */ device_set_input_line(state->m_maincpu, 4, HOLD_LINE); @@ -581,8 +590,8 @@ static void dumpmtmt_i8751_sim(running_machine &machine) } } } - state->m_workram[0x200/2] = (flag << 8) + tick; - state->m_workram[0x202/2] = (sec << 8) + min; + workram[0x200/2] = (flag << 8) + tick; + workram[0x202/2] = (sec << 8) + min; } @@ -595,12 +604,12 @@ static void quartet_i8751_sim(running_machine &machine) device_set_input_line(state->m_maincpu, 4, HOLD_LINE); /* X scroll values */ - segaic16_textram_0_w(space, 0xff8/2, state->m_workram[0x0d14/2], 0xffff); - segaic16_textram_0_w(space, 0xffa/2, state->m_workram[0x0d18/2], 0xffff); + segaic16_textram_0_w(space, 0xff8/2, workram[0x0d14/2], 0xffff); + segaic16_textram_0_w(space, 0xffa/2, workram[0x0d18/2], 0xffff); /* page values */ - segaic16_textram_0_w(space, 0xe9e/2, state->m_workram[0x0d1c/2], 0xffff); - segaic16_textram_0_w(space, 0xe9c/2, state->m_workram[0x0d1e/2], 0xffff); + segaic16_textram_0_w(space, 0xe9e/2, workram[0x0d1c/2], 0xffff); + segaic16_textram_0_w(space, 0xe9c/2, workram[0x0d1e/2], 0xffff); } @@ -996,13 +1005,13 @@ static INTERRUPT_GEN( mcu_irq_assert ) static ADDRESS_MAP_START( system16a_map, AS_PROGRAM, 16 ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x380000) AM_ROM - AM_RANGE(0x400000, 0x407fff) AM_MIRROR(0xb88000) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE_MEMBER(segas1x_state, m_tileram_0) - AM_RANGE(0x410000, 0x410fff) AM_MIRROR(0xb8f000) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE_MEMBER(segas1x_state, m_textram_0) - AM_RANGE(0x440000, 0x4407ff) AM_MIRROR(0x3bf800) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_MIRROR(0x3bf000) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_state, m_paletteram) + AM_RANGE(0x400000, 0x407fff) AM_MIRROR(0xb88000) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE(&segaic16_tileram_0) + AM_RANGE(0x410000, 0x410fff) AM_MIRROR(0xb8f000) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE(&segaic16_textram_0) + AM_RANGE(0x440000, 0x4407ff) AM_MIRROR(0x3bf800) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_MIRROR(0x3bf000) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc43fff) AM_MIRROR(0x39c000) AM_READWRITE(misc_io_r, misc_io_w) AM_RANGE(0xc60000, 0xc6ffff) AM_READ(watchdog_reset16_r) - AM_RANGE(0xc70000, 0xc73fff) AM_MIRROR(0x38c000) AM_RAM AM_BASE_MEMBER(segas1x_state, m_workram) AM_SHARE("nvram") + AM_RANGE(0xc70000, 0xc73fff) AM_MIRROR(0x38c000) AM_RAM AM_BASE(&workram) AM_SHARE("nvram") ADDRESS_MAP_END @@ -1925,18 +1934,6 @@ static GFXDECODE_START( segas16a ) GFXDECODE_END -static const sega16sp_interface s16a_sega16sp_intf = -{ - 1024, // colorbase - 0x800, // ramsize - 0, // xoffs - segaic16_sprites_16a_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - - /************************************* * @@ -1974,7 +1971,7 @@ static MACHINE_CONFIG_START( system16a, segas1x_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE(system16a) - MCFG_SEGA16SP_ADD("segaspr1", s16a_sega16sp_intf) + MCFG_SEGA16SP_ADD_16A("segaspr1") MCFG_GFXDECODE(segas16a) MCFG_PALETTE_LENGTH(2048*3) diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index 3b54f19e585..07f29e5b8b0 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -902,6 +902,16 @@ CPU - 317-0092 |-------------------------------------------------------------- #define ROM_BOARD_171_5797 (4) /* 171-5797 */ +/************************************* + * + * Statics + * + *************************************/ + +static UINT16 *workram; + + + /************************************* * * Prototypes @@ -925,75 +935,73 @@ static WRITE16_HANDLER( atomicp_sound_w ); * *************************************/ -#define state_offset(_name) myoffsetof(segas1x_state, _name) - static const segaic16_memory_map_entry rom_171_5358_info_small[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL, "bank15", FUNC_NULL, NULL, -1, "ROM 2" }, - { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, FUNC_NULL, "bank16", FUNC_NULL, NULL, -1, "ROM 1" }, - { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL, "bank15", FUNC_NULL, NULL, NULL, "ROM 2" }, + { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5358_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, FUNC_NULL, "bank15", FUNC_NULL, NULL, -1, "ROM 2" }, - { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL, "bank16", FUNC_NULL, NULL, -1, "ROM 1" }, - { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, FUNC_NULL, "bank15", FUNC_NULL, NULL, NULL, "ROM 2" }, + { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5704_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(rom_5704_bank_w), NULL, -1, "tile bank" }, - { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, FUNC_NULL, "bank16", FUNC_NULL, NULL, -1, "ROM 1" }, - { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(rom_5704_bank_w), NULL, NULL, "tile bank" }, + { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_atomicp_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(rom_5704_bank_w), NULL, -1, "tile bank" }, - { 0x25/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(atomicp_sound_w), NULL, -1, "sound" }, - { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(rom_5704_bank_w), NULL, NULL, "tile bank" }, + { 0x25/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC(atomicp_sound_w), NULL, NULL, "sound" }, + { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5797_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC(unknown_rgn2_r), NULL, FUNC(unknown_rgn2_w), NULL, -1, "???" }, - { 0x25/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(rom_5797_bank_math_r), NULL, FUNC(rom_5797_bank_math_w), NULL, -1, "tile bank/math" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x01000, 0xfff000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC(unknown_rgn2_r), NULL, FUNC(unknown_rgn2_w), NULL, NULL, "???" }, + { 0x25/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(rom_5797_bank_math_r), NULL, FUNC(rom_5797_bank_math_w), NULL, NULL, "tile bank/math" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; @@ -1064,11 +1072,11 @@ static void system16b_generic_init(running_machine &machine, int _rom_board) system16b_common_init(machine, _rom_board); /* allocate memory for regions not autmatically assigned */ - state->m_spriteram_0 = auto_alloc_array(machine, UINT16, 0x00800 / 2); - state->m_paletteram = auto_alloc_array(machine, UINT16, 0x01000 / 2); - state->m_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000 / 2); - state->m_textram_0 = auto_alloc_array(machine, UINT16, 0x01000 / 2); - state->m_workram = auto_alloc_array(machine, UINT16, 0x04000 / 2); + segaic16_spriteram_0 = auto_alloc_array(machine, UINT16, 0x00800 / 2); + segaic16_paletteram = auto_alloc_array(machine, UINT16, 0x01000 / 2); + segaic16_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000 / 2); + segaic16_textram_0 = auto_alloc_array(machine, UINT16, 0x01000 / 2); + workram = auto_alloc_array(machine, UINT16, 0x04000 / 2); /* init the memory mapper */ segaic16_memory_mapper_init(machine.device("maincpu"), region_info_list[state->m_rom_board], sound_w, NULL); @@ -1076,13 +1084,13 @@ static void system16b_generic_init(running_machine &machine, int _rom_board) /* init the FD1094 */ fd1094_driver_init(machine, "maincpu", segaic16_memory_mapper_set_decrypted); - machine.device("nvram")->set_base(state->m_workram, 0x4000); + machine.device("nvram")->set_base(workram, 0x4000); - state_save_register_global_pointer(machine, state->m_spriteram_0, 0x00800/2); - state_save_register_global_pointer(machine, state->m_paletteram, 0x01000/2); - state_save_register_global_pointer(machine, state->m_tileram_0, 0x10000/2); - state_save_register_global_pointer(machine, state->m_textram_0, 0x01000/2); - state_save_register_global_pointer(machine, state->m_workram, 0x04000/2); + state_save_register_global_pointer(machine, segaic16_spriteram_0, 0x00800/2); + state_save_register_global_pointer(machine, segaic16_paletteram, 0x01000/2); + state_save_register_global_pointer(machine, segaic16_tileram_0, 0x10000/2); + state_save_register_global_pointer(machine, segaic16_textram_0, 0x01000/2); + state_save_register_global_pointer(machine, workram, 0x04000/2); } @@ -1109,9 +1117,9 @@ static TIMER_CALLBACK( boost_interleave ) static MACHINE_RESET( system16b ) { segas1x_state *state = machine.driver_data(); - device_t *spr = machine.device("segaspr1"); static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; static const UINT8 alternate_banklist[] = { 0,255,255,255, 255,255,255,3, 255,255,255,2, 255,1,0,255 }; + int i; segaic16_memory_mapper_reset(machine); if (state->m_i8751_initial_config != NULL) @@ -1127,7 +1135,8 @@ static MACHINE_RESET( system16b ) machine.scheduler().synchronize(FUNC(boost_interleave)); /* configure sprite banks */ - segaic16_sprites_set_banks(spr, (state->m_rom_board == ROM_BOARD_171_5358 || state->m_rom_board == ROM_BOARD_171_5358_SMALL) ? alternate_banklist : default_banklist); + for (i = 0; i < 16; i++) + segaic16_sprites_set_bank(machine, 0, i, (state->m_rom_board == ROM_BOARD_171_5358 || state->m_rom_board == ROM_BOARD_171_5358_SMALL) ? alternate_banklist[i] : default_banklist[i]); } @@ -1188,7 +1197,7 @@ static WRITE16_HANDLER( standard_io_w ) D0 : Output to coin counter 1 */ segaic16_tilemap_set_flip(space->machine(), 0, data & 0x40); - segaic16_sprites_set_flip(space->machine().device("segaspr1"), data & 0x40); + segaic16_sprites_set_flip(space->machine(), 0, data & 0x40); if (!state->m_disable_screen_blanking) segaic16_set_display_enable(space->machine(), data & 0x20); set_led_status(space->machine(), 1, data & 0x08); @@ -1422,7 +1431,6 @@ static INTERRUPT_GEN( i8751_main_cpu_vblank ) static void altbeast_common_i8751_sim(running_machine &machine, offs_t soundoffs, offs_t inputoffs) { segas1x_state *state = machine.driver_data(); - UINT16 *workram = state->m_workram; address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); UINT16 temp; @@ -1463,7 +1471,6 @@ static void altbeast_i8751_sim(running_machine &machine) static void ddux_i8751_sim(running_machine &machine) { segas1x_state *state = machine.driver_data(); - UINT16 *workram = state->m_workram; address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); UINT16 temp; @@ -1502,7 +1509,6 @@ static void goldnaxe_i8751_init(running_machine &machine) static void goldnaxe_i8751_sim(running_machine &machine) { segas1x_state *state = machine.driver_data(); - UINT16 *workram = state->m_workram; address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); UINT16 temp; @@ -1535,7 +1541,6 @@ static void goldnaxe_i8751_sim(running_machine &machine) static void tturf_i8751_sim(running_machine &machine) { segas1x_state *state = machine.driver_data(); - UINT16 *workram = state->m_workram; address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); UINT16 temp; @@ -1560,7 +1565,6 @@ static void tturf_i8751_sim(running_machine &machine) static void wb3_i8751_sim(running_machine &machine) { segas1x_state *state = machine.driver_data(); - UINT16 *workram = state->m_workram; address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); UINT16 temp; @@ -3257,17 +3261,6 @@ static GFXDECODE_START( segas16b ) GFXDECODE_END -static const sega16sp_interface s16b_sega16sp_intf = -{ - 1024, // colorbase - 0x800, // ramsize - 0, // xoffs - segaic16_sprites_16b_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - /************************************* * @@ -3300,7 +3293,7 @@ static MACHINE_CONFIG_START( system16b, segas1x_state ) MCFG_VIDEO_START(system16b) - MCFG_SEGA16SP_ADD("segaspr1", s16b_sega16sp_intf) + MCFG_SEGA16SP_ADD_16B("segaspr1") /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -6998,10 +6991,10 @@ static ADDRESS_MAP_START( isgsm_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0fffff) AM_ROMBANK(ISGSM_MAIN_BANK) // this area is ALWAYS read-only, even when the game is banked in AM_RANGE(0x200000, 0x23ffff) AM_RAM // used during startup for decompression AM_RANGE(0x3f0000, 0x3fffff) AM_WRITE( rom_5704_bank_w ) - AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE_MEMBER(segas1x_state, m_tileram_0) - AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE_MEMBER(segas1x_state, m_textram_0) - AM_RANGE(0x440000, 0x4407ff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_state, m_paletteram) + AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE(&segaic16_tileram_0) + AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE(&segaic16_textram_0) + AM_RANGE(0x440000, 0x4407ff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xC40000, 0xC43fff) AM_READWRITE(misc_io_r, misc_io_w) AM_RANGE(0xe00000, 0xe00001) AM_WRITE( isgsm_data_w ) // writes decompressed data here (copied from RAM..) @@ -7021,7 +7014,7 @@ static ADDRESS_MAP_START( isgsm_map, AS_PROGRAM, 16 ) AM_RANGE(0xfe0006, 0xfe0007) AM_WRITE( isgsm_sound_w16 ) AM_RANGE(0xfe0008, 0xfe0009) AM_WRITE( isgsm_sound_reset_w ) AM_RANGE(0xfe000a, 0xfe000b) AM_WRITE( isgsm_main_bank_change_w ) - AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_workram) + AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE(&workram) ADDRESS_MAP_END @@ -7143,12 +7136,11 @@ INPUT_PORTS_END static MACHINE_RESET( isgsm ) { - device_t *spr = machine.device("segaspr1"); - static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; segaic16_tilemap_reset(machine, 0); /* configure sprite banks */ - segaic16_sprites_set_banks(spr, default_banklist); + for (int i = 0; i < 16; i++) + segaic16_sprites_set_bank(machine, 0, i, i); memory_set_bankptr(machine,ISGSM_CART_BANK, machine.region("gamecart_rgn")->base()); memory_set_bankptr(machine,ISGSM_MAIN_BANK, machine.region("bios")->base()); @@ -7173,10 +7165,9 @@ MACHINE_CONFIG_END DRIVER_INIT( isgsm ) { - segas1x_state *state = machine.driver_data(); system16b_common_init(machine, ROM_BOARD_171_5521); - machine.device("nvram")->set_base(state->m_workram, 0x4000); + machine.device("nvram")->set_base(workram, 0x4000); // decrypt the bios... UINT16* temp = (UINT16*)malloc(0x20000); diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 939344e05cc..fe831bb7fbf 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -58,6 +58,7 @@ * *************************************/ +static UINT16 *workram; static UINT16 has_guns; @@ -79,47 +80,45 @@ static WRITE16_HANDLER( rom_5987_bank_w ); * *************************************/ -#define state_offset(_name) myoffsetof(segas1x_state, _name) - static const segaic16_memory_map_entry rom_171_shad_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC_NULL, NULL, -1, "????" }, - { 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, -1, "VDP" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x10000, 0xff0000, ~0, FUNC_NULL, NULL, FUNC_NULL, NULL, NULL, "????" }, + { 0x25/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, NULL, "VDP" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5874_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, -1, "VDP" }, - { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL, "bank16", FUNC_NULL, NULL, -1, "ROM 1" }, - { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, NULL, "VDP" }, + { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL, "bank16", FUNC_NULL, NULL, NULL, "ROM 1" }, + { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; static const segaic16_memory_map_entry rom_171_5987_info[] = { - { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, -1, "I/O space" }, - { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, state_offset(m_paletteram), "color RAM" }, - { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, state_offset(m_tileram_0), "tile RAM" }, - { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, state_offset(m_textram_0), "text RAM" }, - { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", state_offset(m_spriteram_0), "object RAM" }, - { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", state_offset(m_workram), "work RAM" }, - { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, -1, "VDP" }, - { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL, "bank16", FUNC(rom_5987_bank_w), NULL, -1, "ROM 1/banking" }, - { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, -1, "ROM 0" }, + { 0x3d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC(misc_io_r), NULL, FUNC(misc_io_w), NULL, NULL, "I/O space" }, + { 0x39/2, 0x00000, 0x02000, 0xffe000, ~0, FUNC_NULL, "bank10", FUNC(segaic16_paletteram_w), NULL, &segaic16_paletteram, "color RAM" }, + { 0x35/2, 0x00000, 0x10000, 0xfe0000, ~0, FUNC_NULL, "bank11", FUNC(segaic16_tileram_0_w), NULL, &segaic16_tileram_0, "tile RAM" }, + { 0x35/2, 0x10000, 0x01000, 0xfef000, ~0, FUNC_NULL, "bank12", FUNC(segaic16_textram_0_w), NULL, &segaic16_textram_0, "text RAM" }, + { 0x31/2, 0x00000, 0x00800, 0xfff800, ~0, FUNC_NULL, "bank13", FUNC_NULL, "bank13", &segaic16_spriteram_0, "object RAM" }, + { 0x2d/2, 0x00000, 0x04000, 0xffc000, ~0, FUNC_NULL, "bank14", FUNC_NULL, "bank14", &workram, "work RAM" }, + { 0x29/2, 0x00000, 0x00010, 0xfffff0, ~0, FUNC(genesis_vdp_r), NULL, FUNC(genesis_vdp_w), NULL, NULL, "VDP" }, + { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL, "bank16", FUNC(rom_5987_bank_w), NULL, NULL, "ROM 1/banking" }, + { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, FUNC_NULL, "bank17", FUNC_NULL, NULL, NULL, "ROM 0" }, { 0 } }; @@ -161,11 +160,11 @@ static void system18_generic_init(running_machine &machine, int _rom_board) state->m_rom_board = _rom_board; /* allocate memory for regions not autmatically assigned */ - state->m_spriteram_0 = auto_alloc_array(machine, UINT16, 0x00800/2); - state->m_paletteram = auto_alloc_array(machine, UINT16, 0x04000/2); - state->m_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); - state->m_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); - state->m_workram = auto_alloc_array(machine, UINT16, 0x04000/2); + segaic16_spriteram_0 = auto_alloc_array(machine, UINT16, 0x00800/2); + segaic16_paletteram = auto_alloc_array(machine, UINT16, 0x04000/2); + segaic16_tileram_0 = auto_alloc_array(machine, UINT16, 0x10000/2); + segaic16_textram_0 = auto_alloc_array(machine, UINT16, 0x01000/2); + workram = auto_alloc_array(machine, UINT16, 0x04000/2); /* init the memory mapper */ segaic16_memory_mapper_init(machine.device("maincpu"), region_info_list[state->m_rom_board], sound_w, sound_r); @@ -181,7 +180,7 @@ static void system18_generic_init(running_machine &machine, int _rom_board) state->m_soundcpu = machine.device("soundcpu"); state->m_mcu = machine.device("mcu"); - machine.device("nvram")->set_base(state->m_workram, 0x4000); + machine.device("nvram")->set_base(workram, 0x4000); state->save_item(NAME(state->m_mcu_data)); state->save_item(NAME(state->m_lghost_value)); @@ -189,11 +188,11 @@ static void system18_generic_init(running_machine &machine, int _rom_board) state->save_item(NAME(state->m_misc_io_data)); state->save_item(NAME(state->m_wwally_last_x)); state->save_item(NAME(state->m_wwally_last_y)); - state_save_register_global_pointer(machine, state->m_spriteram_0, 0x00800/2); - state_save_register_global_pointer(machine, state->m_paletteram, 0x04000/2); - state_save_register_global_pointer(machine, state->m_tileram_0, 0x10000/2); - state_save_register_global_pointer(machine, state->m_textram_0, 0x01000/2); - state_save_register_global_pointer(machine, state->m_workram, 0x04000/2); + state_save_register_global_pointer(machine, segaic16_spriteram_0, 0x00800/2); + state_save_register_global_pointer(machine, segaic16_paletteram, 0x04000/2); + state_save_register_global_pointer(machine, segaic16_tileram_0, 0x10000/2); + state_save_register_global_pointer(machine, segaic16_textram_0, 0x01000/2); + state_save_register_global_pointer(machine, workram, 0x04000/2); } @@ -312,7 +311,7 @@ static WRITE16_HANDLER( io_chip_w ) case 0x06/2: system18_set_grayscale(space->machine(), ~data & 0x40); segaic16_tilemap_set_flip(space->machine(), 0, data & 0x20); - segaic16_sprites_set_flip(space->machine().device("segaspr1"), data & 0x20); + segaic16_sprites_set_flip(space->machine(), 0, data & 0x20); /* These are correct according to cgfm's docs, but mwalker and ddcrew both enable the lockout and never turn it off coin_lockout_w(space->machine(), 1, data & 0x08); @@ -430,12 +429,11 @@ static WRITE16_HANDLER( rom_5987_bank_w ) /* sprite banking */ else { - device_t *spr = space->machine().device("segaspr1"); int maxbanks = space->machine().region("gfx2")->bytes() / 0x40000; if (data >= maxbanks) data = 255; - segaic16_sprites_set_bank(spr, (offset - 8) * 2 + 0, data * 2 + 0); - segaic16_sprites_set_bank(spr, (offset - 8) * 2 + 1, data * 2 + 1); + segaic16_sprites_set_bank(space->machine(), 0, (offset - 8) * 2 + 0, data * 2 + 0); + segaic16_sprites_set_bank(space->machine(), 0, (offset - 8) * 2 + 1, data * 2 + 1); } } @@ -1270,17 +1268,6 @@ static GFXDECODE_START( segas18 ) GFXDECODE_END -static const sega16sp_interface s16b_sega16sp_intf = -{ - 1024, // colorbase - 0x800, // ramsize - 0, // xoffs - segaic16_sprites_16b_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - /************************************* * @@ -1315,7 +1302,7 @@ static MACHINE_CONFIG_START( system18, segas1x_state ) MCFG_VIDEO_START(system18) - MCFG_SEGA16SP_ADD("segaspr1", s16b_sega16sp_intf ) + MCFG_SEGA16SP_ADD_16B("segaspr1") /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c index 5262fb33911..c95b7e9dd42 100644 --- a/src/mame/drivers/segaxbd.c +++ b/src/mame/drivers/segaxbd.c @@ -715,14 +715,14 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x083fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("backup1") AM_RANGE(0x0a0000, 0x0a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("backup2") - AM_RANGE(0x0c0000, 0x0cffff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE_MEMBER(segas1x_state, m_tileram_0) - AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE_MEMBER(segas1x_state, m_textram_0) + AM_RANGE(0x0c0000, 0x0cffff) AM_RAM_WRITE(segaic16_tileram_0_w) AM_BASE(&segaic16_tileram_0) + AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE(&segaic16_textram_0) AM_RANGE(0x0e0000, 0x0e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("5248_main", segaic16_multiply_r, segaic16_multiply_w) AM_RANGE(0x0e4000, 0x0e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("5249_main", segaic16_divide_r, segaic16_divide_w) AM_RANGE(0x0e8000, 0x0e801f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("5250_main", segaic16_compare_timer_r, segaic16_compare_timer_w) - AM_RANGE(0x100000, 0x100fff) AM_MIRROR(0x00f000) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_0) - AM_RANGE(0x110000, 0x11ffff) AM_DEVWRITE("segaspr1", segaic16_sprites_draw_w) - AM_RANGE(0x120000, 0x123fff) AM_MIRROR(0x00c000) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_state, m_paletteram) + AM_RANGE(0x100000, 0x100fff) AM_MIRROR(0x00f000) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x110000, 0x11ffff) AM_WRITE(segaic16_sprites_draw_0_w) + AM_RANGE(0x120000, 0x123fff) AM_MIRROR(0x00c000) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x130000, 0x13ffff) AM_READWRITE(adc_r, adc_w) AM_RANGE(0x140000, 0x14000f) AM_MIRROR(0x00fff0) AM_READWRITE(iochip_0_r, iochip_0_w) AM_RANGE(0x150000, 0x15000f) AM_MIRROR(0x00fff0) AM_READWRITE(iochip_1_r, iochip_1_w) @@ -733,7 +733,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 ) AM_RANGE(0x2e0000, 0x2e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("5248_subx", segaic16_multiply_r, segaic16_multiply_w) AM_RANGE(0x2e4000, 0x2e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("5249_subx", segaic16_divide_r, segaic16_divide_w) AM_RANGE(0x2e8000, 0x2e800f) AM_MIRROR(0x003ff0) AM_DEVREADWRITE("5250_subx", segaic16_compare_timer_r, segaic16_compare_timer_w) - AM_RANGE(0x2ec000, 0x2ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("share5") AM_BASE_MEMBER(segas1x_state, m_roadram_0) + AM_RANGE(0x2ec000, 0x2ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("share5") AM_BASE(&segaic16_roadram_0) AM_RANGE(0x2ee000, 0x2effff) AM_READWRITE(segaic16_road_control_0_r, segaic16_road_control_0_w) // AM_RANGE(0x2f0000, 0x2f3fff) AM_READWRITE(excs_r, excs_w) AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_SHARE("backup1") @@ -1332,19 +1332,6 @@ static const ic_315_5250_interface segaxb_5250_2_intf = NULL, NULL }; -static const sega16sp_interface xboard_sega16sp_intf = -{ - 0, // colorbase - 0x1000, // ramsize - 0, // xoffs - segaic16_sprites_xboard_draw, // draw function - 1, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - - - static MACHINE_CONFIG_START( xboard, segas1x_state ) /* basic machine hardware */ @@ -1383,7 +1370,7 @@ static MACHINE_CONFIG_START( xboard, segas1x_state ) MCFG_VIDEO_START(xboard) - MCFG_SEGA16SP_ADD("segaspr1", xboard_sega16sp_intf) + MCFG_SEGA16SP_ADD_XBOARD("segaspr1") /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c index e4a98a5084a..4d93a12d048 100644 --- a/src/mame/drivers/segaybd.c +++ b/src/mame/drivers/segaybd.c @@ -444,7 +444,7 @@ static ADDRESS_MAP_START( subx_map, AS_PROGRAM, 16 ) AM_RANGE(0x080000, 0x080007) AM_MIRROR(0x001ff8) AM_DEVREADWRITE("5248_subx", segaic16_multiply_r, segaic16_multiply_w) AM_RANGE(0x084000, 0x08401f) AM_MIRROR(0x001fe0) AM_DEVREADWRITE("5249_subx", segaic16_divide_r, segaic16_divide_w) AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_1) + AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE(&segaic16_spriteram_1) AM_RANGE(0x1f8000, 0x1fbfff) AM_RAM AM_RANGE(0x1fc000, 0x1fffff) AM_RAM AM_SHARE("backupram") ADDRESS_MAP_END @@ -457,9 +457,9 @@ static ADDRESS_MAP_START( suby_map, AS_PROGRAM, 16 ) AM_RANGE(0x080000, 0x080007) AM_MIRROR(0x001ff8) AM_DEVREADWRITE("5248_suby", segaic16_multiply_r, segaic16_multiply_w) AM_RANGE(0x084000, 0x08401f) AM_MIRROR(0x001fe0) AM_DEVREADWRITE("5249_suby", segaic16_divide_r, segaic16_divide_w) AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x180000, 0x1807ff) AM_MIRROR(0x007800) AM_RAM AM_BASE_MEMBER(segas1x_state, m_rotateram_0) - AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_BASE_MEMBER(segas1x_state, m_spriteram_0) - AM_RANGE(0x190000, 0x193fff) AM_MIRROR(0x004000) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_state, m_paletteram) + AM_RANGE(0x180000, 0x1807ff) AM_MIRROR(0x007800) AM_RAM AM_BASE(&segaic16_rotateram_0) + AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x190000, 0x193fff) AM_MIRROR(0x004000) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x198000, 0x19ffff) AM_READ(segaic16_rotate_control_0_r) AM_RANGE(0x1f0000, 0x1fffff) AM_RAM ADDRESS_MAP_END @@ -979,28 +979,6 @@ static const sega_pcm_interface segapcm_interface = }; -static const sega16sp_interface yboard_16b_sega16sp_intf = -{ - 2048, // colorbase - 0x800, // ramsize - 0, // xoffs - segaic16_sprites_yboard_16b_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_0), -}; - -static const sega16sp_interface yboard_sega16sp_intf = -{ - 4096, // colorbase - 0x10000, // ramsize - 0, // xoffs - segaic16_sprites_yboard_draw, // draw function - 0, // use buffer - myoffsetof(segas1x_state, m_paletteram), - myoffsetof(segas1x_state, m_spriteram_1), -}; - /************************************* * @@ -1046,8 +1024,8 @@ static MACHINE_CONFIG_START( yboard, segas1x_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE(yboard) - MCFG_SEGA16SP_ADD("segaspr1", yboard_16b_sega16sp_intf ) - MCFG_SEGA16SP_ADD("segaspr2", yboard_sega16sp_intf) + MCFG_SEGA16SP_ADD_YBOARD_16B("segaspr1") + MCFG_SEGA16SP_ADD_YBOARD("segaspr2") MCFG_PALETTE_LENGTH(8192*3) diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c index 51f83fd6326..b8c675dd51d 100644 --- a/src/mame/drivers/system16.c +++ b/src/mame/drivers/system16.c @@ -126,8 +126,8 @@ static ADDRESS_MAP_START( shinobib_map, AS_PROGRAM, 16 ) AM_RANGE(0x410000, 0x410fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) AM_RANGE(0x411000, 0x411fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg0_tileram) AM_RANGE(0x412000, 0x412fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg1_tileram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sound_command_nmi_w) AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE") AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") @@ -184,8 +184,8 @@ static ADDRESS_MAP_START( passshtb_map, AS_PROGRAM, 16 ) AM_RANGE(0x40a000, 0x40afff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg1_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") AM_RANGE(0xc41004, 0xc41005) AM_READ_PORT("P2") @@ -266,8 +266,8 @@ static ADDRESS_MAP_START( passht4b_map, AS_PROGRAM, 16 ) AM_RANGE(0x409000, 0x40afff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg0_tileram) AM_RANGE(0x40a000, 0x40bfff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg1_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc41000, 0xc41001) AM_READ(passht4b_service_r) AM_RANGE(0xc41002, 0xc41003) AM_READ(passht4b_io1_r) AM_RANGE(0xc41004, 0xc41005) AM_READ(passht4b_io2_r) @@ -316,8 +316,8 @@ static ADDRESS_MAP_START( wb3bbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x409000, 0x40afff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg0_tileram) AM_RANGE(0x40a000, 0x40bfff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_bg1_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE") AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") @@ -520,10 +520,10 @@ static ADDRESS_MAP_START( bayroute_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_RANGE(0x100000, 0x100003) AM_WRITENOP // tilebank control? AM_RANGE(0x500000, 0x503fff) AM_RAM // work ram - AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x710000, 0x710fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x900000, 0x900001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0x901002, 0x901003) AM_READ_PORT("P1") AM_RANGE(0x901006, 0x901007) AM_READ_PORT("P2") @@ -621,8 +621,8 @@ static ADDRESS_MAP_START( goldnaxeb1_map, AS_PROGRAM, 16 ) AM_RANGE(0x118018, 0x118019) AM_WRITE(s16bl_bgscrollx_w) AM_RANGE(0x118020, 0x118021) AM_WRITE(s16bl_fgpage_w) AM_RANGE(0x118028, 0x118029) AM_WRITE(s16bl_bgpage_w) - AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) - AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P2") @@ -639,7 +639,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bayrouteb1_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_RANGE(0x500000, 0x503fff) AM_RAM // work ram - AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x710000, 0x710fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) AM_RANGE(0x718000, 0x718001) AM_WRITE(s16bl_fgscrolly_w) @@ -648,7 +648,7 @@ static ADDRESS_MAP_START( bayrouteb1_map, AS_PROGRAM, 16 ) AM_RANGE(0x718018, 0x718019) AM_WRITE(s16bl_bgscrollx_w) AM_RANGE(0x718020, 0x718021) AM_WRITE(s16bl_fgpage_w) AM_RANGE(0x718028, 0x718029) AM_WRITE(s16bl_bgpage_w) - AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x901000, 0x901001) AM_READ_PORT("SERVICE") AM_WRITE(sys16_coinctrl_w) AM_RANGE(0x901002, 0x901003) AM_READ_PORT("P1") AM_RANGE(0x901006, 0x901007) AM_READ_PORT("P2") @@ -712,7 +712,7 @@ static WRITE16_HANDLER( datsu_page3_w ) static ADDRESS_MAP_START( bayrouteb2_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_RANGE(0x500000, 0x503fff) AM_RAM // work ram - AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0x700000, 0x70ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x710000, 0x710fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) AM_RANGE(0x718000, 0x718001) AM_WRITE(s16bl_fgscrolly_w) @@ -724,7 +724,7 @@ static ADDRESS_MAP_START( bayrouteb2_map, AS_PROGRAM, 16 ) AM_RANGE(0x718024, 0x718025) AM_WRITE(datsu_page2_w) AM_RANGE(0x718026, 0x718027) AM_WRITE(datsu_page3_w) - AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x900000, 0x900001) AM_READ_PORT("DSW1") AM_RANGE(0x900002, 0x900003) AM_READ_PORT("DSW2") AM_RANGE(0x900006, 0x900007) AM_WRITE(sound_command_w) @@ -738,8 +738,8 @@ static ADDRESS_MAP_START( dduxbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x3f0000, 0x3fffff) AM_WRITE(sys16_tilebank_w) AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0xc40006, 0xc40007) AM_WRITE(sound_command_w) AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") @@ -836,8 +836,8 @@ static ADDRESS_MAP_START( goldnaxeb2_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0bffff) AM_ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x110000, 0x110fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) - AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0xc40000, 0xc40001) AM_READ_PORT("DSW2") AM_WRITENOP AM_RANGE(0xc40002, 0xc40003) AM_READ_PORT("DSW1") AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE") @@ -865,7 +865,7 @@ static ADDRESS_MAP_START( fpointbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0x600006, 0x600007) AM_WRITE(sound_command_w) AM_RANGE(0x601000, 0x601001) AM_READ_PORT("SERVICE") @@ -874,7 +874,7 @@ static ADDRESS_MAP_START( fpointbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW2") AM_RANGE(0x600002, 0x600003) AM_READ_PORT("DSW1") - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x843000, 0x843001) AM_WRITENOP AM_RANGE(0xC46000, 0xC46001) AM_WRITE(s16bl_fgscrolly_w) @@ -915,8 +915,8 @@ static ADDRESS_MAP_START( eswatbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x418020, 0x418021) AM_WRITE(s16bl_bgpage_w) AM_RANGE(0x418028, 0x418029) AM_WRITE(s16bl_fgpage_w) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P2") @@ -942,8 +942,8 @@ static ADDRESS_MAP_START( tetrisbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x418020, 0x418021) AM_WRITE(s16bl_fgpage_w) AM_RANGE(0x418028, 0x418029) AM_WRITE(s16bl_bgpage_w) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE") AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1") @@ -983,8 +983,8 @@ static ADDRESS_MAP_START( beautyb_map, AS_PROGRAM, 16 ) AM_RANGE(0x418020, 0x418021) AM_WRITE(s16bl_bgpage_w) AM_RANGE(0x418028, 0x418029) AM_WRITE(s16bl_fgpage_w) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xC41000, 0xC41001) AM_READ(beautyb_unkx_r ) AM_RANGE(0xC41002, 0xC41003) AM_READ(beautyb_unkx_r ) @@ -1000,10 +1000,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tturfbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x200000, 0x203fff) AM_RAM // work ram - AM_RANGE(0x300000, 0x300fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x300000, 0x300fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0x600000, 0x600001) AM_WRITE(sys16_coinctrl_w) AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW2") AM_RANGE(0x600002, 0x600003) AM_READ_PORT("DSW1") @@ -1149,8 +1149,8 @@ static ADDRESS_MAP_START( shdancbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) AM_RANGE(0xc00000, 0xc0ffff) AM_NOP AM_RANGE(0xc40000, 0xc40001) AM_READ_PORT("COINAGE") AM_RANGE(0xc40002, 0xc40003) AM_READ_PORT("DSW1") @@ -1293,8 +1293,8 @@ static ADDRESS_MAP_START( mwalkbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) /* bootleg video regs */ /*AM_RANGE(0xc00000, 0xc00001) AM_NOP @@ -1335,8 +1335,8 @@ static ADDRESS_MAP_START( astormbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM_WRITE(sys16_tileram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_tileram) AM_RANGE(0x110000, 0x110fff) AM_RAM_WRITE(sys16_textram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_textram) - AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_paletteram) - AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_spriteram_0) + AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(&segaic16_spriteram_0) AM_RANGE(0xa00000, 0xa00001) AM_READ_PORT("COINAGE") AM_RANGE(0xa00002, 0xa00003) AM_READ_PORT("DSW1") AM_RANGE(0xa00006, 0xa00007) AM_WRITE(sound_command_nmi_w) @@ -2135,13 +2135,12 @@ MACHINE_CONFIG_END static const sega16sp_interface shinobld_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 117, // xoffs segaic16_sprites_16a_bootleg_shinobld_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_DERIVED( shinobib, system16 ) @@ -2159,13 +2158,12 @@ MACHINE_CONFIG_END static const sega16sp_interface passshtb_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 117, // xoffs segaic16_sprites_16a_bootleg_passhtb_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_DERIVED( passshtb, system16_7759 ) @@ -2198,13 +2196,12 @@ MACHINE_CONFIG_END static const sega16sp_interface wb3bbl_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 117, // xoffs segaic16_sprites_16a_bootleg_wb3bl_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_DERIVED( wb3bb, system16 ) @@ -2223,13 +2220,12 @@ MACHINE_CONFIG_END static const sega16sp_interface s16bbl_x121_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 121, // xoffs segaic16_sprites_16b_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_START( goldnaxeb1, segas1x_bootleg_state ) @@ -2276,13 +2272,12 @@ MACHINE_CONFIG_END static const sega16sp_interface s16bbl_x107_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 107, // xoffs segaic16_sprites_16b_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_DERIVED( bayrouteb2, goldnaxeb1 ) @@ -2318,13 +2313,12 @@ MACHINE_CONFIG_END static const sega16sp_interface s16bbl_x112_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 112, // xoffs segaic16_sprites_16b_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_DERIVED( dduxbl, system16 ) @@ -2338,13 +2332,12 @@ MACHINE_CONFIG_END static const sega16sp_interface s16bbl_x124_sega16sp_intf = { + 0, // which spriteram 1024, // colorbase 0x800, // ramsize 124, // xoffs segaic16_sprites_16b_draw, // draw function 0, // use buffer - myoffsetof(segas1x_bootleg_state, m_paletteram), - myoffsetof(segas1x_bootleg_state, m_spriteram_0), }; static MACHINE_CONFIG_DERIVED( eswatbl, system16_7759 ) diff --git a/src/mame/includes/segas16.h b/src/mame/includes/segas16.h index c7d6219a723..fefc0497aae 100644 --- a/src/mame/includes/segas16.h +++ b/src/mame/includes/segas16.h @@ -7,14 +7,11 @@ public: m_interrupt_timer(*this, "int_timer") { } /* memory pointers */ - UINT16 * m_workram; - UINT16 * m_paletteram; - UINT16 * m_tileram_0; - UINT16 * m_textram_0; - UINT16 * m_spriteram_0; - UINT16 * m_spriteram_1; - UINT16 * m_roadram_0; - UINT16 * m_rotateram_0; +// UINT16 * m_workram; // this is used in the nvram handler, hence it cannot be added here +// UINT16 * m_paletteram; // this is used in the segaic16 mapper, hence it cannot be added here (yet) +// UINT16 * m_tileram_0; // this is used in the segaic16 mapper, hence it cannot be added here (yet) +// UINT16 * m_textram_0; // this is used in the segaic16 mapper, hence it cannot be added here (yet) +// UINT16 * m_spriteram_0; // this is used in the segaic16 mapper, hence it cannot be added here (yet) /* misc video */ UINT8 m_road_priority; // segaxbd diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index eb49811e26f..40dca40376f 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -11,8 +11,6 @@ public: UINT16 * m_bg1_tileram; UINT16 * m_textram; UINT16 * m_tileram; - UINT16 * m_spriteram_0; - UINT16 * m_paletteram; UINT16 m_coinctrl; @@ -104,26 +102,26 @@ public: /*----------- defined in video/system16.c -----------*/ -VIDEO_START( s16a_bootleg ); -VIDEO_START( s16a_bootleg_wb3bl ); -VIDEO_START( s16a_bootleg_shinobi ); -VIDEO_START( s16a_bootleg_passsht ); -SCREEN_UPDATE( s16a_bootleg ); -SCREEN_UPDATE( s16a_bootleg_passht4b ); -WRITE16_HANDLER( s16a_bootleg_tilemapselect_w ); -WRITE16_HANDLER( s16a_bootleg_bgscrolly_w ); -WRITE16_HANDLER( s16a_bootleg_bgscrollx_w ); -WRITE16_HANDLER( s16a_bootleg_fgscrolly_w ); -WRITE16_HANDLER( s16a_bootleg_fgscrollx_w ); +extern VIDEO_START( s16a_bootleg ); +extern VIDEO_START( s16a_bootleg_wb3bl ); +extern VIDEO_START( s16a_bootleg_shinobi ); +extern VIDEO_START( s16a_bootleg_passsht ); +extern SCREEN_UPDATE( s16a_bootleg ); +extern SCREEN_UPDATE( s16a_bootleg_passht4b ); +extern WRITE16_HANDLER( s16a_bootleg_tilemapselect_w ); +extern WRITE16_HANDLER( s16a_bootleg_bgscrolly_w ); +extern WRITE16_HANDLER( s16a_bootleg_bgscrollx_w ); +extern WRITE16_HANDLER( s16a_bootleg_fgscrolly_w ); +extern WRITE16_HANDLER( s16a_bootleg_fgscrollx_w ); /* video hardware */ -WRITE16_HANDLER( sys16_tileram_w ); -WRITE16_HANDLER( sys16_textram_w ); +extern WRITE16_HANDLER( sys16_tileram_w ); +extern WRITE16_HANDLER( sys16_textram_w ); /* "normal" video hardware */ -VIDEO_START( system16 ); -SCREEN_UPDATE( system16 ); +extern VIDEO_START( system16 ); +extern SCREEN_UPDATE( system16 ); /* system18 video hardware */ -VIDEO_START( system18old ); -SCREEN_UPDATE( system18old ); +extern VIDEO_START( system18old ); +extern SCREEN_UPDATE( system18old ); diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 708ff673151..4cb2111b3ff 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -347,10 +347,9 @@ static void update_memory_mapping(running_machine &machine, struct memory_mapper /* set the bank pointer */ if (readbank != NULL) { - if (rgn->base != -1) + if (rgn->base != NULL) { - void *base = *(void **)((UINT8 *)machine.driver_data() + rgn->base); - memory_configure_bank(machine, readbank, 0, 1, base, 0); + memory_configure_bank(machine, readbank, 0, 1, *rgn->base, 0); memory_set_bank(machine, readbank, 0); } else if (rgn->romoffset != ~0) diff --git a/src/mame/machine/segaic16.h b/src/mame/machine/segaic16.h index 1e4a9ea41ed..279748988fe 100644 --- a/src/mame/machine/segaic16.h +++ b/src/mame/machine/segaic16.h @@ -24,7 +24,7 @@ struct _segaic16_memory_map_entry write16_space_func write; /* write handler */ const char * writename; const char * writebank; /* bank for writing */ - int base; /* offset to memory base */ + UINT16 ** base; /* pointer to memory base */ const char * name; /* friendly name for debugging */ }; diff --git a/src/mame/video/sega16sp.c b/src/mame/video/sega16sp.c index 44747c77158..3a150b6905c 100644 --- a/src/mame/video/sega16sp.c +++ b/src/mame/video/sega16sp.c @@ -2,6 +2,12 @@ #include "segaic16.h" +UINT16 *segaic16_spriteram_0; +UINT16 *segaic16_spriteram_1; + + + + /***************************************************************************** INLINE FUNCTIONS *****************************************************************************/ @@ -59,7 +65,7 @@ INLINE const sega16sp_interface *get_interface( device_t *device ) { \ /* shadow/hilight mode? */ \ if (color == sega16sp->colorbase + (0x3f << 4)) \ - dest[x] += sega16sp->shadow ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + dest[x] += sega16sp->shadow ? segaic16_palette.entries*2 : segaic16_palette.entries; \ \ /* regular draw */ \ else \ @@ -70,9 +76,8 @@ INLINE const sega16sp_interface *get_interface( device_t *device ) pri[x] = 0xff; \ } \ -void segaic16_sprites_hangon_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_hangon_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000; const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base(); const UINT8 *zoom = (const UINT8 *)machine.region("proms")->base(); @@ -225,7 +230,7 @@ void segaic16_sprites_hangon_draw(device_t *device, bitmap_t *bitmap, const rect { \ /* shadow/hilight mode? */ \ if (shadow && pix == 0xa) \ - dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ \ /* regular draw */ \ else \ @@ -236,9 +241,8 @@ void segaic16_sprites_hangon_draw(device_t *device, bitmap_t *bitmap, const rect pri[x] = 0xff; \ } \ -void segaic16_sprites_sharrier_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_sharrier_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x20000; const UINT32 *spritebase = (const UINT32 *)machine.region("gfx2")->base(); const UINT8 *zoom = (const UINT8 *)machine.region("proms")->base(); @@ -397,7 +401,7 @@ void segaic16_sprites_sharrier_draw(device_t *device, bitmap_t *bitmap, const re { \ /* shadow/hilight mode? */ \ if (color == sega16sp->colorbase + (0x3f << 4)) \ - dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ \ /* regular draw */ \ else \ @@ -408,9 +412,8 @@ void segaic16_sprites_sharrier_draw(device_t *device, bitmap_t *bitmap, const re pri[x] = 0xff; \ } \ -void segaic16_sprites_16a_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16a_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000; const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base(); sega16sp_state *sega16sp = get_safe_token(device); @@ -557,8 +560,8 @@ void segaic16_sprites_16a_draw(device_t *device, bitmap_t *bitmap, const rectang { \ /* we have to check this for System 18 so that we don't */ \ /* attempt to shadow VDP pixels */ \ - if (dest[x] < sega16sp->palette_entries) \ - dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + if (dest[x] < segaic16_palette.entries) \ + dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ } \ \ /* regular draw */ \ @@ -570,9 +573,8 @@ void segaic16_sprites_16a_draw(device_t *device, bitmap_t *bitmap, const rectang pri[x] = 0xff; \ } \ -void segaic16_sprites_16b_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16b_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks; const UINT16 *spritebase; sega16sp_state *sega16sp = get_safe_token(device); @@ -726,7 +728,7 @@ void segaic16_sprites_16b_draw(device_t *device, bitmap_t *bitmap, const rectang { \ /* shadow/hilight mode? */ \ if (pix == 14) \ - dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ \ /* regular draw */ \ else \ @@ -737,9 +739,8 @@ void segaic16_sprites_16b_draw(device_t *device, bitmap_t *bitmap, const rectang pri[x] = 0; \ } \ -void segaic16_sprites_yboard_16b_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_yboard_16b_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x20000; const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base(); sega16sp_state *sega16sp = get_safe_token(device); @@ -905,7 +906,7 @@ void segaic16_sprites_yboard_16b_draw(device_t *device, bitmap_t *bitmap, const { \ /* shadow/hilight mode? */ \ if (shadow && pix == 0xa) \ - dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ \ /* regular draw */ \ else \ @@ -916,9 +917,8 @@ void segaic16_sprites_yboard_16b_draw(device_t *device, bitmap_t *bitmap, const pri[x] = 0xff; \ } \ -static void segaic16_sprites_xboard_outrun_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect, int type) +static void segaic16_sprites_xboard_outrun_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect, int type) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x40000; const UINT32 *spritebase = (const UINT32 *)machine.region("gfx2")->base(); sega16sp_state *sega16sp = get_safe_token(device); @@ -1043,14 +1043,14 @@ static void segaic16_sprites_xboard_outrun_draw(device_t *device, bitmap_t *bitm } } -void segaic16_sprites_outrun_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_outrun_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - segaic16_sprites_xboard_outrun_draw(device, bitmap, cliprect, SEGAIC16_SPRITES_OUTRUN); + segaic16_sprites_xboard_outrun_draw(machine, device, bitmap, cliprect, SEGAIC16_SPRITES_OUTRUN); } -void segaic16_sprites_xboard_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_xboard_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - segaic16_sprites_xboard_outrun_draw(device, bitmap, cliprect, SEGAIC16_SPRITES_XBOARD); + segaic16_sprites_xboard_outrun_draw(machine, device, bitmap, cliprect, SEGAIC16_SPRITES_XBOARD); } @@ -1088,12 +1088,11 @@ void segaic16_sprites_xboard_draw(device_t *device, bitmap_t *bitmap, const rect if (x >= minx && x <= maxx && ind < 0x1fe) \ dest[x] = ind | colorpri; \ -void segaic16_sprites_yboard_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx1")->bytes() / 0x80000; const UINT64 *spritebase = (const UINT64 *)machine.region("gfx1")->base(); - const UINT16 *rotatebase = segaic16_rotate_base(0); + const UINT16 *rotatebase = segaic16_rotate[0].buffer ? segaic16_rotate[0].buffer : segaic16_rotate[0].rotateram; UINT8 visited[0x1000]; sega16sp_state *sega16sp = get_safe_token(device); int next = 0; @@ -1274,7 +1273,7 @@ void segaic16_sprites_yboard_draw(device_t *device, bitmap_t *bitmap, const rect { \ /* shadow/hilight mode? */ \ if (color == sega16sp->colorbase + (0x3f << 4)) \ - dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ + dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ \ /* regular draw */ \ else \ @@ -1383,9 +1382,8 @@ void segaic16_sprites_yboard_draw(device_t *device, bitmap_t *bitmap, const rect -void segaic16_sprites_16a_bootleg_wb3bl_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000; const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base(); sega16sp_state *sega16sp = get_safe_token(device); @@ -1407,9 +1405,8 @@ void segaic16_sprites_16a_bootleg_wb3bl_draw(device_t *device, bitmap_t *bitmap, } /* 4 player passing shot is different to this.. */ -void segaic16_sprites_16a_bootleg_passhtb_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000; const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base(); sega16sp_state *sega16sp = get_safe_token(device); @@ -1430,9 +1427,8 @@ void segaic16_sprites_16a_bootleg_passhtb_draw(device_t *device, bitmap_t *bitma } } -void segaic16_sprites_16a_bootleg_shinobld_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - running_machine &machine = device->machine(); UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000; const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base(); sega16sp_state *sega16sp = get_safe_token(device); @@ -1459,10 +1455,27 @@ void segaic16_sprites_16a_bootleg_shinobld_draw(device_t *device, bitmap_t *bitm * *************************************/ -void segaic16_sprites_draw(screen_device *screen, bitmap_t *bitmap, const rectangle *cliprect, device_t *device) +void segaic16_sprites_draw(device_t *screen, bitmap_t *bitmap, const rectangle *cliprect, int which) { - sega16sp_state *sega16sp = get_safe_token(device); - (*sega16sp->draw)(device, bitmap, cliprect); + device_t* device = 0; + sega16sp_state *sega16sp; + + if (!which) + device = screen->machine().device("segaspr1"); + else + device = screen->machine().device("segaspr2"); + + if (!device) + fatalerror("segaic16_sprites_draw device not found\n"); + + sega16sp = get_safe_token(device); + + if (!sega16sp->which) + sega16sp->spriteram = segaic16_spriteram_0; + else + sega16sp->spriteram = segaic16_spriteram_1; + + (*sega16sp->draw)(screen->machine(), device, bitmap, cliprect); } @@ -1473,19 +1486,23 @@ void segaic16_sprites_draw(screen_device *screen, bitmap_t *bitmap, const rectan * *************************************/ -void segaic16_sprites_set_banks(device_t *device, const UINT8 *bank) +void segaic16_sprites_set_bank(running_machine &machine, int which, int banknum, int offset) { - sega16sp_state *sega16sp = get_safe_token(device); - memcpy(sega16sp->bank, bank, sizeof(sega16sp->bank)); -} + device_t* device = 0; + + if (!which) + device = machine.device("segaspr1"); + else + device = machine.device("segaspr2"); + + if (!device) + fatalerror("segaic16_sprites_set_bank device not found\n"); -void segaic16_sprites_set_bank(device_t *device, int banknum, int offset) -{ sega16sp_state *sega16sp = get_safe_token(device); if (sega16sp->bank[banknum] != offset) { - screen_device *screen = device->machine().primary_screen; + screen_device *screen = machine.primary_screen; screen->update_partial(screen->vpos()); sega16sp->bank[banknum] = offset; } @@ -1499,14 +1516,24 @@ void segaic16_sprites_set_bank(device_t *device, int banknum, int offset) * *************************************/ -void segaic16_sprites_set_flip(device_t *device, int flip) +void segaic16_sprites_set_flip(running_machine &machine, int which, int flip) { + device_t* device = 0; + + if (!which) + device = machine.device("segaspr1"); + else + device = machine.device("segaspr2"); + + if (!device) + fatalerror("segaic16_sprites_set_flip device not found\n"); + sega16sp_state *sega16sp = get_safe_token(device); flip = (flip != 0); if (sega16sp->flip != flip) { - screen_device *screen = device->machine().primary_screen; + screen_device *screen = machine.primary_screen; screen->update_partial(screen->vpos()); sega16sp->flip = flip; } @@ -1520,14 +1547,24 @@ void segaic16_sprites_set_flip(device_t *device, int flip) * *************************************/ -void segaic16_sprites_set_shadow(device_t *device, int shadow) +void segaic16_sprites_set_shadow(running_machine &machine, int which, int shadow) { + device_t* device = 0; + + if (!which) + device = machine.device("segaspr1"); + else + device = machine.device("segaspr2"); + + if (!device) + fatalerror("segaic16_sprites_set_shadow device not found\n"); + sega16sp_state *sega16sp = get_safe_token(device); shadow = (shadow != 0); if (sega16sp->shadow != shadow) { - screen_device *screen = device->machine().primary_screen; + screen_device *screen = machine.primary_screen; screen->update_partial(screen->vpos()); sega16sp->shadow = shadow; } @@ -1545,6 +1582,12 @@ static void segaic16_sprites_buffer(device_t* device) { sega16sp_state *sega16sp = get_safe_token(device); + if (!sega16sp->which) + sega16sp->spriteram = segaic16_spriteram_0; + else + sega16sp->spriteram = segaic16_spriteram_1; + + if (sega16sp->buffer) { UINT32 *src = (UINT32 *)sega16sp->spriteram; @@ -1567,12 +1610,33 @@ static void segaic16_sprites_buffer(device_t* device) } -WRITE16_DEVICE_HANDLER( segaic16_sprites_draw_w ) +WRITE16_HANDLER( segaic16_sprites_draw_0_w ) { + device_t* device = 0; + + device = space->machine().device("segaspr1"); + + if (!device) + fatalerror("segaic16_sprites_draw_0_w device not found\n"); + segaic16_sprites_buffer(device); } +WRITE16_HANDLER( segaic16_sprites_draw_1_w ) +{ + device_t* device = 0; + + device = space->machine().device("segaspr2"); + + if (!device) + fatalerror("segaic16_sprites_draw_1_w device not found\n"); + + if (device) + segaic16_sprites_buffer(device); +} + + /***************************************************************************** DEVICE INTERFACE *****************************************************************************/ @@ -1589,6 +1653,7 @@ static DEVICE_START( sega16sp ) for (i=0;i<16;i++) sega16sp->bank[i] = i;// intf->bank[i]; + sega16sp->which = intf->which; sega16sp->colorbase = intf->colorbase; sega16sp->ramsize = intf->ramsize; sega16sp->xoffs = intf->xoffs; @@ -1611,18 +1676,6 @@ static DEVICE_START( sega16sp ) } -static DEVICE_RESET( sega16sp ) -{ - sega16sp_state *sega16sp = get_safe_token(device); - const sega16sp_interface *intf = get_interface(device); - UINT8 *base = (UINT8 *)device->machine().driver_data(); - - sega16sp->palette_entries = segaic16_palette_entries(); - sega16sp->paletteram = *(UINT16 **)(base + intf->paletteram_offset); - sega16sp->spriteram = *(UINT16 **)(base + intf->spriteram_offset); -} - - DEVICE_GET_INFO( sega16sp ) { switch (state) @@ -1633,7 +1686,7 @@ DEVICE_GET_INFO( sega16sp ) /* --- the following bits of info are returned as pointers to data or functions --- */ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(sega16sp); break; case DEVINFO_FCT_STOP: /* Nothing */ break; - case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(sega16sp); break; + case DEVINFO_FCT_RESET: /*info->reset = DEVICE_RESET_NAME(sega16sp);*/ break; /* --- the following bits of info are returned as NULL-terminated strings --- */ case DEVINFO_STR_NAME: strcpy(info->s, "Sega System SH/HO/OR/16/18/X/Y Sprites"); break; diff --git a/src/mame/video/segahang.c b/src/mame/video/segahang.c index 8515dee24a2..ccad73ad8ec 100644 --- a/src/mame/video/segahang.c +++ b/src/mame/video/segahang.c @@ -18,31 +18,27 @@ VIDEO_START( hangon ) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_HANGON, 0x038, 0x7c0, 0x7c0, 0, state->m_roadram_0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_HANGON, 0x038, 0x7c0, 0x7c0, 0); } VIDEO_START( sharrier ) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_SHARRIER, 0x038, 0x7c0, 0x7c0, 0, state->m_roadram_0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_SHARRIER, 0x038, 0x7c0, 0x7c0, 0); } @@ -86,7 +82,7 @@ SCREEN_UPDATE( hangon ) segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c index 10a93d191a9..493aff16db1 100644 --- a/src/mame/video/segaic16.c +++ b/src/mame/video/segaic16.c @@ -376,6 +376,15 @@ Quick review of the system16 hardware: *************************************/ UINT8 segaic16_display_enable; +UINT16 *segaic16_tileram_0; +UINT16 *segaic16_textram_0; +UINT16 *segaic16_roadram_0; +UINT16 *segaic16_rotateram_0; +UINT16 *segaic16_paletteram; + +struct palette_info segaic16_palette; +struct rotate_info segaic16_rotate[SEGAIC16_MAX_ROTATE]; +struct road_info segaic16_road[SEGAIC16_MAX_ROADS]; @@ -385,9 +394,6 @@ UINT8 segaic16_display_enable; * *************************************/ -static struct palette_info segaic16_palette; -static struct rotate_info segaic16_rotate[SEGAIC16_MAX_ROTATE]; -static struct road_info segaic16_road[SEGAIC16_MAX_ROADS]; static struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS]; @@ -433,7 +439,7 @@ void segaic16_set_display_enable(running_machine &machine, int enable) is bit 15 of each color RAM entry. */ -void segaic16_palette_init(int entries, UINT16 *paletteram) +void segaic16_palette_init(int entries) { static const int resistances_normal[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 0 }; static const int resistances_sh[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 470 }; @@ -443,7 +449,6 @@ void segaic16_palette_init(int entries, UINT16 *paletteram) /* compute the number of palette entries */ info->entries = entries; - info->paletteram = paletteram; /* compute weight table for regular palette entries */ compute_resistor_weights(0, 255, -1.0, @@ -473,10 +478,6 @@ void segaic16_palette_init(int entries, UINT16 *paletteram) } -int segaic16_palette_entries(void) -{ - return segaic16_palette.entries; -} /************************************* * @@ -491,9 +492,9 @@ WRITE16_HANDLER( segaic16_paletteram_w ) struct palette_info *info = &segaic16_palette; /* get the new value */ - newval = info->paletteram[offset]; + newval = segaic16_paletteram[offset]; COMBINE_DATA(&newval); - info->paletteram[offset] = newval; + segaic16_paletteram[offset] = newval; /* byte 0 byte 1 */ /* sBGR BBBB GGGG RRRR */ @@ -1112,7 +1113,7 @@ static void segaic16_tilemap_16b_reset(running_machine &machine, struct tilemap_ * *************************************/ -void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks, UINT16 *textram, UINT16 *tileram) +void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks) { struct tilemap_info *info = &bg_tilemap[which]; tile_get_info_func get_text_info; @@ -1128,13 +1129,13 @@ void segaic16_tilemap_init(running_machine &machine, int which, int type, int co info->bank[i] = i; info->banksize = 0x2000 / numbanks; info->xoffs = xoffs; - info->textram = textram; - info->tileram = tileram; /* set up based on which tilemap */ switch (which) { case 0: + info->textram = segaic16_textram_0; + info->tileram = segaic16_tileram_0; break; default: @@ -1351,21 +1352,19 @@ void segaic16_tilemap_set_colscroll(running_machine &machine, int which, int ena WRITE16_HANDLER( segaic16_tileram_0_w ) { - struct tilemap_info *info = &bg_tilemap[0]; - COMBINE_DATA(&info->tileram[offset]); - tilemap_mark_tile_dirty(info->tilemaps[offset / (64*32)], offset % (64*32)); + COMBINE_DATA(&segaic16_tileram_0[offset]); + tilemap_mark_tile_dirty(bg_tilemap[0].tilemaps[offset / (64*32)], offset % (64*32)); } WRITE16_HANDLER( segaic16_textram_0_w ) { - struct tilemap_info *info = &bg_tilemap[0]; /* certain ranges need immediate updates */ if (offset >= 0xe80/2) space->machine().primary_screen->update_partial(space->machine().primary_screen->vpos()); - COMBINE_DATA(&info->textram[offset]); - tilemap_mark_tile_dirty(info->textmap, offset); + COMBINE_DATA(&segaic16_textram_0[offset]); + tilemap_mark_tile_dirty(bg_tilemap[0].textmap, offset); } @@ -1875,7 +1874,7 @@ static void segaic16_road_outrun_draw(struct road_info *info, bitmap_t *bitmap, * *************************************/ -void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs, UINT16 *roadram) +void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs) { struct road_info *info = &segaic16_road[which]; @@ -1887,12 +1886,12 @@ void segaic16_road_init(running_machine &machine, int which, int type, int color info->colorbase2 = colorbase2; info->colorbase3 = colorbase3; info->xoffs = xoffs; - info->roadram = roadram; /* set up based on which road generator */ switch (which) { case 0: + info->roadram = segaic16_roadram_0; break; default: @@ -1904,7 +1903,6 @@ void segaic16_road_init(running_machine &machine, int which, int type, int color { case SEGAIC16_ROAD_HANGON: case SEGAIC16_ROAD_SHARRIER: - info->buffer = NULL; info->draw = segaic16_road_hangon_draw; segaic16_road_hangon_decode(machine, info); break; @@ -1984,7 +1982,7 @@ WRITE16_HANDLER( segaic16_road_control_0_w ) * *************************************/ -void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase, UINT16 *rotateram) +void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase) { struct rotate_info *info = &segaic16_rotate[which]; @@ -1993,12 +1991,12 @@ void segaic16_rotate_init(running_machine &machine, int which, int type, int col info->index = which; info->type = type; info->colorbase = colorbase; - info->rotateram = rotateram; /* set up based on which road generator */ switch (which) { case 0: + info->rotateram = segaic16_rotateram_0; break; default: @@ -2087,11 +2085,6 @@ void segaic16_rotate_draw(running_machine &machine, int which, bitmap_t *bitmap, } -UINT16 *segaic16_rotate_base(int which) -{ - struct rotate_info *info = &segaic16_rotate[which]; - return info->buffer ? info->buffer : info->rotateram; -} /************************************* * diff --git a/src/mame/video/segaic16.h b/src/mame/video/segaic16.h index df3e1b4ac24..2200d9edef0 100644 --- a/src/mame/video/segaic16.h +++ b/src/mame/video/segaic16.h @@ -8,13 +8,19 @@ /* globals */ extern UINT8 segaic16_display_enable; +extern UINT16 *segaic16_tileram_0; +extern UINT16 *segaic16_textram_0; +extern UINT16 *segaic16_spriteram_0; +extern UINT16 *segaic16_spriteram_1; +extern UINT16 *segaic16_roadram_0; +extern UINT16 *segaic16_rotateram_0; +extern UINT16 *segaic16_paletteram; /* misc functions */ void segaic16_set_display_enable(running_machine &machine, int enable); /* palette handling */ -void segaic16_palette_init(int entries, UINT16 *paletteram); -int segaic16_palette_entries(void); +void segaic16_palette_init(int entries); WRITE16_HANDLER( segaic16_paletteram_w ); /* tilemap systems */ @@ -29,7 +35,7 @@ WRITE16_HANDLER( segaic16_paletteram_w ); #define SEGAIC16_TILEMAP_BACKGROUND 1 #define SEGAIC16_TILEMAP_TEXT 2 -void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks, UINT16 *textram, UINT16 *tileram); +void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks); void segaic16_tilemap_reset(running_machine &machine, int which); void segaic16_tilemap_draw(device_t *screen, bitmap_t *bitmap, const rectangle *cliprect, int which, int map, int priority, int priority_mark); void segaic16_tilemap_set_bank(running_machine &machine, int which, int banknum, int offset); @@ -41,15 +47,17 @@ WRITE16_HANDLER( segaic16_tileram_0_w ); WRITE16_HANDLER( segaic16_textram_0_w ); /* sprite systems */ +#define SEGAIC16_MAX_SPRITES 2 + #define SEGAIC16_SPRITES_OUTRUN 4 #define SEGAIC16_SPRITES_XBOARD 5 -void segaic16_sprites_draw(screen_device *screen, bitmap_t *bitmap, const rectangle *cliprect, device_t *device); -void segaic16_sprites_set_banks(device_t *device, const UINT8 *bank); -void segaic16_sprites_set_bank(device_t *device, int banknum, int offset); -void segaic16_sprites_set_flip(device_t *device, int flip); -void segaic16_sprites_set_shadow(device_t *device, int shadow); -WRITE16_DEVICE_HANDLER( segaic16_sprites_draw_w ); +void segaic16_sprites_draw(device_t *screen, bitmap_t *bitmap, const rectangle *cliprect, int which); +void segaic16_sprites_set_bank(running_machine &machine, int which, int banknum, int offset); +void segaic16_sprites_set_flip(running_machine &machine, int which, int flip); +void segaic16_sprites_set_shadow(running_machine &machine, int which, int shadow); +WRITE16_HANDLER( segaic16_sprites_draw_0_w ); +WRITE16_HANDLER( segaic16_sprites_draw_1_w ); /* road systems */ #define SEGAIC16_MAX_ROADS 1 @@ -62,7 +70,7 @@ WRITE16_DEVICE_HANDLER( segaic16_sprites_draw_w ); #define SEGAIC16_ROAD_BACKGROUND 0 #define SEGAIC16_ROAD_FOREGROUND 1 -void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs, UINT16 *roadram); +void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs); void segaic16_road_draw(int which, bitmap_t *bitmap, const rectangle *cliprect, int priority); READ16_HANDLER( segaic16_road_control_0_r ); WRITE16_HANDLER( segaic16_road_control_0_w ); @@ -72,9 +80,8 @@ WRITE16_HANDLER( segaic16_road_control_0_w ); #define SEGAIC16_ROTATE_YBOARD 0 -void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase, UINT16 *rotateram); +void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase); void segaic16_rotate_draw(running_machine &machine, int which, bitmap_t *bitmap, const rectangle *cliprect, bitmap_t *srcbitmap); -UINT16 *segaic16_rotate_base(int which); READ16_HANDLER( segaic16_rotate_control_0_r ); /************************************* @@ -138,7 +145,6 @@ struct palette_info UINT8 normal[32]; /* RGB translations for normal pixels */ UINT8 shadow[32]; /* RGB translations for shadowed pixels */ UINT8 hilight[32]; /* RGB translations for hilighted pixels */ - UINT16 * paletteram; }; struct rotate_info @@ -155,13 +161,12 @@ struct rotate_info typedef struct _sega16sp_interface sega16sp_interface; struct _sega16sp_interface { + UINT8 which; /* which sprite RAM */ UINT16 colorbase; /* base color index */ INT32 ramsize; /* size of sprite RAM */ INT32 xoffs; /* X scroll offset */ - void (*draw)(device_t* device, bitmap_t *bitmap, const rectangle *cliprect); + void (*draw)(running_machine &machine, device_t* device, bitmap_t *bitmap, const rectangle *cliprect); int buffer; /* should ram be buffered? */ - int paletteram_offset; - int spriteram_offset; }; @@ -171,15 +176,14 @@ struct _sega16sp_interface typedef struct _sega16sp_state sega16sp_state; struct _sega16sp_state { + UINT8 which; /* which sprite RAM */ UINT8 flip; /* screen flip? */ UINT8 shadow; /* shadow or hilight? */ UINT8 bank[16]; /* banking redirection */ UINT16 colorbase; /* base color index */ INT32 ramsize; /* size of sprite RAM */ INT32 xoffs; /* X scroll offset */ - void (*draw)(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); - INT32 palette_entries; - UINT16 * paletteram; + void (*draw)(running_machine &machine, device_t* device, bitmap_t *bitmap, const rectangle *cliprect); UINT16 * spriteram; /* pointer to spriteram pointer */ UINT16 * buffer; /* buffered spriteram for those that use it */ @@ -191,18 +195,140 @@ struct _sega16sp_state DECLARE_LEGACY_DEVICE(SEGA16SP, sega16sp); -void segaic16_sprites_hangon_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_sharrier_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_16a_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_16b_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_yboard_16b_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_yboard_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_outrun_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_xboard_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_16a_bootleg_wb3bl_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_16a_bootleg_passhtb_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); -void segaic16_sprites_16a_bootleg_shinobld_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_hangon_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_sharrier_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_16a_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_16b_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_yboard_16b_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_outrun_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_xboard_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); +void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect); + +/* the various sprite configs */ +static const sega16sp_interface hangon_sega16sp_intf = +{ + 0, // which spriteram + 1024, // colorbase + 0x800, // ramsize + 0, // xoffs + segaic16_sprites_hangon_draw, // draw function + 0, // use buffer +}; + +static const sega16sp_interface sharrier_sega16sp_intf = +{ + 0, // which spriteram + 1024, // colorbase + 0x1000, // ramsize + 0, // xoffs + segaic16_sprites_sharrier_draw, // draw function + 0, // use buffer +}; + +static const sega16sp_interface yboard_16b_sega16sp_intf = +{ + 0, // which spriteram + 2048, // colorbase + 0x800, // ramsize + 0, // xoffs + segaic16_sprites_yboard_16b_draw, // draw function + 0, // use buffer +}; + +static const sega16sp_interface yboard_sega16sp_intf = +{ + 1, // which spriteram + 4096, // colorbase + 0x10000, // ramsize + 0, // xoffs + segaic16_sprites_yboard_draw, // draw function + 0, // use buffer +}; + +static const sega16sp_interface s16a_sega16sp_intf = +{ + 0, // which spriteram + 1024, // colorbase + 0x800, // ramsize + 0, // xoffs + segaic16_sprites_16a_draw, // draw function + 0, // use buffer +}; + +static const sega16sp_interface s16b_sega16sp_intf = +{ + 0, // which spriteram + 1024, // colorbase + 0x800, // ramsize + 0, // xoffs + segaic16_sprites_16b_draw, // draw function + 0, // use buffer +}; + +static const sega16sp_interface outrun_sega16sp_intf = +{ + 0, // which spriteram + 2048, // colorbase + 0x1000, // ramsize + 0, // xoffs + segaic16_sprites_outrun_draw, // draw function + 1, // use buffer +}; + + +static const sega16sp_interface xboard_sega16sp_intf = +{ + 0, // which spriteram + 0, // colorbase + 0x1000, // ramsize + 0, // xoffs + segaic16_sprites_xboard_draw, // draw function + 1, // use buffer +}; + + #define MCFG_SEGA16SP_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ MCFG_DEVICE_CONFIG(_interface) + +#define MCFG_SEGA16SP_ADD_HANGON(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(hangon_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_SHARRIER(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(sharrier_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_YBOARD(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(yboard_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_YBOARD_16B(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(yboard_16b_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_16A(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(s16a_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_16B(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(s16b_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_OUTRUN(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(outrun_sega16sp_intf) + +#define MCFG_SEGA16SP_ADD_XBOARD(_tag) \ + MCFG_DEVICE_ADD(_tag, SEGA16SP, 0) \ + MCFG_DEVICE_CONFIG(xboard_sega16sp_intf) + + +extern struct palette_info segaic16_palette; +extern struct rotate_info segaic16_rotate[SEGAIC16_MAX_ROTATE]; +extern struct road_info segaic16_road[SEGAIC16_MAX_ROADS]; + diff --git a/src/mame/video/segaorun.c b/src/mame/video/segaorun.c index bd099abec5b..31212d9b510 100644 --- a/src/mame/video/segaorun.c +++ b/src/mame/video/segaorun.c @@ -18,31 +18,27 @@ VIDEO_START( shangon ) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x1000, state->m_paletteram); + segaic16_palette_init(0x1000); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0, state->m_roadram_0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0); } VIDEO_START( outrun ) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x1000, state->m_paletteram); + segaic16_palette_init(0x1000); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0, state->m_roadram_0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0); } @@ -79,7 +75,7 @@ SCREEN_UPDATE( shangon ) segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } @@ -115,6 +111,6 @@ SCREEN_UPDATE( outrun ) segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } diff --git a/src/mame/video/segas16a.c b/src/mame/video/segas16a.c index c87cdaf4c64..ad86b37eb8c 100644 --- a/src/mame/video/segas16a.c +++ b/src/mame/video/segas16a.c @@ -18,13 +18,11 @@ VIDEO_START( system16a ) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1); } @@ -64,6 +62,6 @@ SCREEN_UPDATE( system16a ) segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } diff --git a/src/mame/video/segas16b.c b/src/mame/video/segas16b.c index f3e6b9fba9b..404f5c9a83f 100644 --- a/src/mame/video/segas16b.c +++ b/src/mame/video/segas16b.c @@ -18,13 +18,11 @@ static void video_start_common(running_machine &machine, int type) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, type, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, type, 0x000, 0, 2); } @@ -76,6 +74,6 @@ SCREEN_UPDATE( system16b ) segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index 1774caff71a..b881753a7ad 100644 --- a/src/mame/video/segas18.c +++ b/src/mame/video/segas18.c @@ -36,10 +36,10 @@ VIDEO_START( system18 ) state->m_vdp_mixing = 0; /* compute palette info */ - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); /* create the VDP */ system18_vdp_start(machine); @@ -234,7 +234,7 @@ SCREEN_UPDATE( system18 ) if (state->m_vdp_enable && vdplayer == 3) draw_vdp(screen, bitmap, cliprect, vdppri); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); #if DEBUG_VDP if (state->m_vdp_enable && input_code_pressed(screen->machine(), KEYCODE_V)) diff --git a/src/mame/video/segaxbd.c b/src/mame/video/segaxbd.c index fed15d614ca..1248290b19c 100644 --- a/src/mame/video/segaxbd.c +++ b/src/mame/video/segaxbd.c @@ -17,16 +17,14 @@ VIDEO_START( xboard ) { - segas1x_state *state = machine.driver_data(); - /* compute palette info */ - segaic16_palette_init(0x2000, state->m_paletteram); + segaic16_palette_init(0x2000); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2, state->m_textram_0, state->m_tileram_0); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_XBOARD, 0x1700, 0x1720, 0x1780, -166, state->m_roadram_0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_XBOARD, 0x1700, 0x1720, 0x1780, -166); } @@ -72,6 +70,6 @@ SCREEN_UPDATE( xboard ) segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c index e32d8c58876..bcea3bba4f1 100644 --- a/src/mame/video/segaybd.c +++ b/src/mame/video/segaybd.c @@ -20,13 +20,13 @@ VIDEO_START( yboard ) segas1x_state *state = machine.driver_data(); /* compute palette info */ - segaic16_palette_init(0x2000, state->m_paletteram); + segaic16_palette_init(0x2000); /* allocate a bitmap for the yboard layer */ state->m_tmp_bitmap = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16); /* initialize the rotation layer */ - segaic16_rotate_init(machine, 0, SEGAIC16_ROTATE_YBOARD, 0x000, state->m_rotateram_0); + segaic16_rotate_init(machine, 0, SEGAIC16_ROTATE_YBOARD, 0x000); state->save_item(NAME(*state->m_tmp_bitmap)); } @@ -54,12 +54,12 @@ SCREEN_UPDATE( yboard ) /* draw the yboard sprites */ yboard_clip.min_x = yboard_clip.min_y = 0; yboard_clip.max_x = yboard_clip.max_y = 511; - segaic16_sprites_draw(screen, state->m_tmp_bitmap, &yboard_clip, screen->machine().device("segaspr2")); + segaic16_sprites_draw(screen, state->m_tmp_bitmap, &yboard_clip, 1); /* apply rotation */ segaic16_rotate_draw(screen->machine(), 0, bitmap, cliprect, state->m_tmp_bitmap); /* draw the 16B sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } diff --git a/src/mame/video/system16.c b/src/mame/video/system16.c index fc8aa220a4b..3f77431ff0f 100644 --- a/src/mame/video/system16.c +++ b/src/mame/video/system16.c @@ -33,11 +33,23 @@ static void setup_system16_bootleg_spritebanking( running_machine& machine ) { segas1x_bootleg_state *state = machine.driver_data(); - static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - static const UINT8 alternate_banklist[] = { 0,255,255,255, 255,255,255,3, 255,255,255,2, 255,1,0,255 }; - device_t *spr = machine.device("segaspr1"); - segaic16_sprites_set_banks(spr, (state->m_spritebank_type == 1) ? default_banklist : alternate_banklist); + if (state->m_spritebank_type == 1) + { + static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + int i; + for (i = 0; i < 16; i++) + segaic16_sprites_set_bank(machine, 0, i, default_banklist[i]); + } + else + { + static const UINT8 alternate_banklist[] = { 0,255,255,255, 255,255,255,3, 255,255,255,2, 255,1,0,255 }; + int i; + for (i = 0; i < 16; i++) + segaic16_sprites_set_bank(machine, 0, i, alternate_banklist[i]); + + } + } @@ -422,8 +434,10 @@ VIDEO_START( system16 ) state->m_system18 = 0; } - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); setup_system16_bootleg_spritebanking(machine); + + } VIDEO_START( system18old ) @@ -592,7 +606,8 @@ VIDEO_START( s16a_bootleg ) tilemap_set_transparent_pen(state->m_bg_tilemaps[0], 0); tilemap_set_transparent_pen(state->m_bg_tilemaps[1], 0); - segaic16_palette_init(0x800, state->m_paletteram); + segaic16_palette_init(0x800); + } VIDEO_START( s16a_bootleg_wb3bl ) @@ -666,7 +681,7 @@ SCREEN_UPDATE( s16a_bootleg ) } /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } @@ -707,7 +722,7 @@ SCREEN_UPDATE( s16a_bootleg_passht4b ) } /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } @@ -756,7 +771,7 @@ SCREEN_UPDATE( system16 ) //draw_sprites(screen->machine(), bitmap, cliprect,0); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; } @@ -790,7 +805,7 @@ SCREEN_UPDATE( system18old ) tilemap_draw(bitmap, cliprect, state->m_text_layer, 0, 0xf); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); + segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; }