From 025916273b32eb5bb89434600640a68d6d5d030a Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Wed, 20 Apr 2011 13:26:24 +0000 Subject: [PATCH] Removed global variables from segaic16.c [Atari Ace] --- 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, 587 insertions(+), 645 deletions(-) diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c index 2930f3548e5..bd8d1632a9f 100644 --- a/src/mame/drivers/segahang.c +++ b/src/mame/drivers/segahang.c @@ -33,14 +33,6 @@ #define MASTER_CLOCK_8MHz (8000000) -/************************************* - * - * Statics - * - *************************************/ - -static UINT16 *workram; - /************************************* * * Prototypes @@ -300,9 +292,10 @@ 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(device->machine(), 0, data & 0x80); - segaic16_sprites_set_shadow(device->machine(), 0, ~data & 0x40); + segaic16_sprites_set_flip(spr, data & 0x80); + segaic16_sprites_set_shadow(spr, ~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); @@ -389,7 +382,8 @@ static INTERRUPT_GEN( i8751_main_cpu_vblank ) static void sharrier_i8751_sim(running_machine &machine) { - workram[0x492/2] = (input_port_read(machine, "ADC0") << 8) | input_port_read(machine, "ADC1"); + segas1x_state *state = machine.driver_data(); + state->m_workram[0x492/2] = (input_port_read(machine, "ADC0") << 8) | input_port_read(machine, "ADC1"); } @@ -428,12 +422,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(&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(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(0xc00000, 0xc3ffff) AM_ROM AM_REGION("sub", 0) - AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE(&segaic16_roadram_0) + AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(segas1x_state, m_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 @@ -441,14 +435,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(&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(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(0x124000, 0x127fff) AM_RAM AM_SHARE("share2") - AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + AM_RANGE(0x130000, 0x130fff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_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(&segaic16_roadram_0) + AM_RANGE(0xc68000, 0xc68fff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(segas1x_state, m_roadram_0) ADDRESS_MAP_END @@ -907,6 +901,28 @@ 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 @@ -1056,7 +1072,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( hangon, hangon_base ) MCFG_FRAGMENT_ADD(sound_board_2203) - MCFG_SEGA16SP_ADD_HANGON("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", hangon_sega16sp_intf) MACHINE_CONFIG_END @@ -1069,7 +1085,7 @@ static MACHINE_CONFIG_DERIVED( shangupb, hangon_base ) MCFG_CPU_MODIFY("sub") MCFG_CPU_CLOCK(10000000) - MCFG_SEGA16SP_ADD_HANGON("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", hangon_sega16sp_intf) MACHINE_CONFIG_END @@ -1080,28 +1096,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_SHARRIER("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( enduror, sharrier_base ) MCFG_FRAGMENT_ADD(sound_board_2151) - MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( enduror1, sharrier_base ) MCFG_FRAGMENT_ADD(sound_board_2203) - MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( endurob2, sharrier_base ) MCFG_FRAGMENT_ADD(sound_board_2203x2) - MCFG_SEGA16SP_ADD_SHARRIER("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", sharrier_sega16sp_intf) MACHINE_CONFIG_END diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index b73af8a741b..287cdf28afe 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -289,14 +289,15 @@ Notes: -/************************************* - * - * Statics - * - *************************************/ +class segaorun_state : public segas1x_state +{ +public: + segaorun_state(running_machine &machine, const driver_device_config_base &config) + : segas1x_state(machine, config) { } -static UINT16 *workram; -static UINT16 *cpu1ram, *cpu1rom; + UINT16 *m_cpu1ram; + UINT16 *m_cpu1rom; +}; /************************************* * @@ -340,19 +341,21 @@ 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, 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" }, + { 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" }, { 0 } }; @@ -391,14 +394,14 @@ static READ8_HANDLER( sound_data_r ) static void outrun_generic_init(running_machine &machine) { - segas1x_state *state = machine.driver_data(); + segaorun_state *state = machine.driver_data(); /* allocate memory for regions not automatically assigned */ - 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); + 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); /* init the memory mapper */ segaic16_memory_mapper_init(machine.device("maincpu"), outrun_info, sound_data_w, NULL); @@ -418,16 +421,16 @@ static void outrun_generic_init(running_machine &machine) nvram_device *nvram = machine.device("nvram"); if (nvram != NULL) - nvram->set_base(workram, 0x8000); + nvram->set_base(state->m_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, 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); + 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); } @@ -712,7 +715,7 @@ static WRITE16_HANDLER( outrun_custom_io_w ) return; case 0x70/2: - segaic16_sprites_draw_0_w(space, offset, data, mem_mask); + segaic16_sprites_draw_w(space->machine().device("segaspr1"), 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); @@ -804,9 +807,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(&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(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(0x090000, 0x09ffff) AM_READWRITE(segaic16_road_control_0_r, segaic16_road_control_0_w) ADDRESS_MAP_END @@ -1095,6 +1098,29 @@ 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), +}; + + /************************************* * @@ -1102,7 +1128,7 @@ GFXDECODE_END * *************************************/ -static MACHINE_CONFIG_START( outrun_base, segas1x_state ) +static MACHINE_CONFIG_START( outrun_base, segaorun_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK/4) @@ -1147,13 +1173,13 @@ static MACHINE_CONFIG_START( outrun_base, segas1x_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( outrundx, outrun_base ) - MCFG_SEGA16SP_ADD_OUTRUN("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", outrun_sega16sp_intf) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( outrun, outrun_base ) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_SEGA16SP_ADD_OUTRUN("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", outrun_sega16sp_intf) MACHINE_CONFIG_END @@ -1166,7 +1192,7 @@ static MACHINE_CONFIG_DERIVED( shangon, outrun_base ) MCFG_VIDEO_START(shangon) - MCFG_SEGA16SP_ADD_16B("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", s16b_sega16sp_intf) MACHINE_CONFIG_END diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c index 80daf48b588..9c770224d03 100644 --- a/src/mame/drivers/segas16a.c +++ b/src/mame/drivers/segas16a.c @@ -159,15 +159,6 @@ Tetris - - - - EPR12169 EPR12170 - #include "video/segaic16.h" -/************************************* - * - * Statics - * - *************************************/ - -static UINT16 *workram; - - /************************************* * * Prototypes @@ -375,7 +366,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(), 0, data & 0x80); + segaic16_sprites_set_flip(device->machine().device("segaspr1"), data & 0x80); if (state->m_mcu != NULL) device_set_input_line(state->m_mcu, MCS51_INT1_LINE, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE); @@ -552,10 +543,10 @@ static INTERRUPT_GEN( i8751_main_cpu_vblank ) static void dumpmtmt_i8751_sim(running_machine &machine) { segas1x_state *state = machine.driver_data(); - UINT8 flag = workram[0x200/2] >> 8; - UINT8 tick = workram[0x200/2] & 0xff; - UINT8 sec = workram[0x202/2] >> 8; - UINT8 min = workram[0x202/2] & 0xff; + 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; /* signal a VBLANK to the main CPU */ device_set_input_line(state->m_maincpu, 4, HOLD_LINE); @@ -590,8 +581,8 @@ static void dumpmtmt_i8751_sim(running_machine &machine) } } } - workram[0x200/2] = (flag << 8) + tick; - workram[0x202/2] = (sec << 8) + min; + state->m_workram[0x200/2] = (flag << 8) + tick; + state->m_workram[0x202/2] = (sec << 8) + min; } @@ -604,12 +595,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, workram[0x0d14/2], 0xffff); - segaic16_textram_0_w(space, 0xffa/2, workram[0x0d18/2], 0xffff); + 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); /* page values */ - segaic16_textram_0_w(space, 0xe9e/2, workram[0x0d1c/2], 0xffff); - segaic16_textram_0_w(space, 0xe9c/2, workram[0x0d1e/2], 0xffff); + 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); } @@ -1005,13 +996,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(&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(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(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(&workram) AM_SHARE("nvram") + AM_RANGE(0xc70000, 0xc73fff) AM_MIRROR(0x38c000) AM_RAM AM_BASE_MEMBER(segas1x_state, m_workram) AM_SHARE("nvram") ADDRESS_MAP_END @@ -1934,6 +1925,18 @@ 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), +}; + + /************************************* * @@ -1971,7 +1974,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_16A("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", s16a_sega16sp_intf) MCFG_GFXDECODE(segas16a) MCFG_PALETTE_LENGTH(2048*3) diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index 07f29e5b8b0..3b54f19e585 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -902,16 +902,6 @@ CPU - 317-0092 |-------------------------------------------------------------- #define ROM_BOARD_171_5797 (4) /* 171-5797 */ -/************************************* - * - * Statics - * - *************************************/ - -static UINT16 *workram; - - - /************************************* * * Prototypes @@ -935,73 +925,75 @@ 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, 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" }, + { 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" }, { 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, 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" }, + { 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" }, { 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, 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" }, + { 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" }, { 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, 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" }, + { 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" }, { 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, 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" }, + { 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" }, { 0 } }; @@ -1072,11 +1064,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 */ - 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); + 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); /* init the memory mapper */ segaic16_memory_mapper_init(machine.device("maincpu"), region_info_list[state->m_rom_board], sound_w, NULL); @@ -1084,13 +1076,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(workram, 0x4000); + machine.device("nvram")->set_base(state->m_workram, 0x4000); - 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); + 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); } @@ -1117,9 +1109,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) @@ -1135,8 +1127,7 @@ static MACHINE_RESET( system16b ) machine.scheduler().synchronize(FUNC(boost_interleave)); /* configure sprite banks */ - 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]); + 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); } @@ -1197,7 +1188,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(), 0, data & 0x40); + segaic16_sprites_set_flip(space->machine().device("segaspr1"), data & 0x40); if (!state->m_disable_screen_blanking) segaic16_set_display_enable(space->machine(), data & 0x20); set_led_status(space->machine(), 1, data & 0x08); @@ -1431,6 +1422,7 @@ 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; @@ -1471,6 +1463,7 @@ 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; @@ -1509,6 +1502,7 @@ 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; @@ -1541,6 +1535,7 @@ 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; @@ -1565,6 +1560,7 @@ 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; @@ -3261,6 +3257,17 @@ 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), +}; + /************************************* * @@ -3293,7 +3300,7 @@ static MACHINE_CONFIG_START( system16b, segas1x_state ) MCFG_VIDEO_START(system16b) - MCFG_SEGA16SP_ADD_16B("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", s16b_sega16sp_intf) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -6991,10 +6998,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(&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(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(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..) @@ -7014,7 +7021,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(&workram) + AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_workram) ADDRESS_MAP_END @@ -7136,11 +7143,12 @@ 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 */ - for (int i = 0; i < 16; i++) - segaic16_sprites_set_bank(machine, 0, i, i); + segaic16_sprites_set_banks(spr, default_banklist); memory_set_bankptr(machine,ISGSM_CART_BANK, machine.region("gamecart_rgn")->base()); memory_set_bankptr(machine,ISGSM_MAIN_BANK, machine.region("bios")->base()); @@ -7165,9 +7173,10 @@ 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(workram, 0x4000); + machine.device("nvram")->set_base(state->m_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 fe831bb7fbf..939344e05cc 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -58,7 +58,6 @@ * *************************************/ -static UINT16 *workram; static UINT16 has_guns; @@ -80,45 +79,47 @@ 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, 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" }, + { 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" }, { 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, 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" }, + { 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" }, { 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, 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" }, + { 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" }, { 0 } }; @@ -160,11 +161,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 */ - 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); + 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); /* init the memory mapper */ segaic16_memory_mapper_init(machine.device("maincpu"), region_info_list[state->m_rom_board], sound_w, sound_r); @@ -180,7 +181,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(workram, 0x4000); + machine.device("nvram")->set_base(state->m_workram, 0x4000); state->save_item(NAME(state->m_mcu_data)); state->save_item(NAME(state->m_lghost_value)); @@ -188,11 +189,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, 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); + 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); } @@ -311,7 +312,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(), 0, data & 0x20); + segaic16_sprites_set_flip(space->machine().device("segaspr1"), 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); @@ -429,11 +430,12 @@ 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(space->machine(), 0, (offset - 8) * 2 + 0, data * 2 + 0); - segaic16_sprites_set_bank(space->machine(), 0, (offset - 8) * 2 + 1, data * 2 + 1); + segaic16_sprites_set_bank(spr, (offset - 8) * 2 + 0, data * 2 + 0); + segaic16_sprites_set_bank(spr, (offset - 8) * 2 + 1, data * 2 + 1); } } @@ -1268,6 +1270,17 @@ 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), +}; + /************************************* * @@ -1302,7 +1315,7 @@ static MACHINE_CONFIG_START( system18, segas1x_state ) MCFG_VIDEO_START(system18) - MCFG_SEGA16SP_ADD_16B("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", s16b_sega16sp_intf ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c index c95b7e9dd42..5262fb33911 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(&segaic16_tileram_0) - AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_RAM_WRITE(segaic16_textram_0_w) AM_BASE(&segaic16_textram_0) + 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(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(&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(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(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(&segaic16_roadram_0) + AM_RANGE(0x2ec000, 0x2ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("share5") AM_BASE_MEMBER(segas1x_state, m_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,6 +1332,19 @@ 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 */ @@ -1370,7 +1383,7 @@ static MACHINE_CONFIG_START( xboard, segas1x_state ) MCFG_VIDEO_START(xboard) - MCFG_SEGA16SP_ADD_XBOARD("segaspr1") + MCFG_SEGA16SP_ADD("segaspr1", xboard_sega16sp_intf) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c index 4d93a12d048..e4a98a5084a 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(&segaic16_spriteram_1) + AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE_MEMBER(segas1x_state, m_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(&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(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(0x198000, 0x19ffff) AM_READ(segaic16_rotate_control_0_r) AM_RANGE(0x1f0000, 0x1fffff) AM_RAM ADDRESS_MAP_END @@ -979,6 +979,28 @@ 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), +}; + /************************************* * @@ -1024,8 +1046,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_YBOARD_16B("segaspr1") - MCFG_SEGA16SP_ADD_YBOARD("segaspr2") + MCFG_SEGA16SP_ADD("segaspr1", yboard_16b_sega16sp_intf ) + MCFG_SEGA16SP_ADD("segaspr2", yboard_sega16sp_intf) MCFG_PALETTE_LENGTH(8192*3) diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c index b8c675dd51d..51f83fd6326 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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) + AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_paletteram) + AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_paletteram) - AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + 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(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(&segaic16_spriteram_0) + AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_paletteram) + AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_spriteram_0) + AM_RANGE(0x600000, 0x600fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_paletteram) + AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_paletteram) - AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + 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(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(&segaic16_spriteram_0) + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_paletteram) + AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) + AM_RANGE(0x300000, 0x300fff) AM_RAM AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_paletteram) + AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE_MEMBER(segas1x_bootleg_state, m_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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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(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(&segaic16_spriteram_0) - AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(segaic16_paletteram_w) AM_BASE(&segaic16_paletteram) + 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) /* 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(&segaic16_paletteram) - AM_RANGE(0x200000, 0x200fff) AM_RAM AM_BASE(&segaic16_spriteram_0) + 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(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,12 +2135,13 @@ 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 ) @@ -2158,12 +2159,13 @@ 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 ) @@ -2196,12 +2198,13 @@ 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 ) @@ -2220,12 +2223,13 @@ 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 ) @@ -2272,12 +2276,13 @@ 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 ) @@ -2313,12 +2318,13 @@ 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 ) @@ -2332,12 +2338,13 @@ 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 fefc0497aae..c7d6219a723 100644 --- a/src/mame/includes/segas16.h +++ b/src/mame/includes/segas16.h @@ -7,11 +7,14 @@ public: m_interrupt_timer(*this, "int_timer") { } /* memory pointers */ -// 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) + 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; /* misc video */ UINT8 m_road_priority; // segaxbd diff --git a/src/mame/includes/system16.h b/src/mame/includes/system16.h index 40dca40376f..eb49811e26f 100644 --- a/src/mame/includes/system16.h +++ b/src/mame/includes/system16.h @@ -11,6 +11,8 @@ public: UINT16 * m_bg1_tileram; UINT16 * m_textram; UINT16 * m_tileram; + UINT16 * m_spriteram_0; + UINT16 * m_paletteram; UINT16 m_coinctrl; @@ -102,26 +104,26 @@ public: /*----------- defined in video/system16.c -----------*/ -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_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 ); /* video hardware */ -extern WRITE16_HANDLER( sys16_tileram_w ); -extern WRITE16_HANDLER( sys16_textram_w ); +WRITE16_HANDLER( sys16_tileram_w ); +WRITE16_HANDLER( sys16_textram_w ); /* "normal" video hardware */ -extern VIDEO_START( system16 ); -extern SCREEN_UPDATE( system16 ); +VIDEO_START( system16 ); +SCREEN_UPDATE( system16 ); /* system18 video hardware */ -extern VIDEO_START( system18old ); -extern SCREEN_UPDATE( system18old ); +VIDEO_START( system18old ); +SCREEN_UPDATE( system18old ); diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 4cb2111b3ff..708ff673151 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -347,9 +347,10 @@ static void update_memory_mapping(running_machine &machine, struct memory_mapper /* set the bank pointer */ if (readbank != NULL) { - if (rgn->base != NULL) + if (rgn->base != -1) { - memory_configure_bank(machine, readbank, 0, 1, *rgn->base, 0); + void *base = *(void **)((UINT8 *)machine.driver_data() + rgn->base); + memory_configure_bank(machine, readbank, 0, 1, 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 279748988fe..1e4a9ea41ed 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 */ - UINT16 ** base; /* pointer to memory base */ + int base; /* offset 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 3a150b6905c..44747c77158 100644 --- a/src/mame/video/sega16sp.c +++ b/src/mame/video/sega16sp.c @@ -2,12 +2,6 @@ #include "segaic16.h" -UINT16 *segaic16_spriteram_0; -UINT16 *segaic16_spriteram_1; - - - - /***************************************************************************** INLINE FUNCTIONS *****************************************************************************/ @@ -65,7 +59,7 @@ INLINE const sega16sp_interface *get_interface( device_t *device ) { \ /* shadow/hilight mode? */ \ if (color == sega16sp->colorbase + (0x3f << 4)) \ - dest[x] += sega16sp->shadow ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + dest[x] += sega16sp->shadow ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ \ /* regular draw */ \ else \ @@ -76,8 +70,9 @@ INLINE const sega16sp_interface *get_interface( device_t *device ) pri[x] = 0xff; \ } \ -void segaic16_sprites_hangon_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_hangon_draw(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(); @@ -230,7 +225,7 @@ void segaic16_sprites_hangon_draw(running_machine &machine, device_t *device, bi { \ /* shadow/hilight mode? */ \ if (shadow && pix == 0xa) \ - dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ \ /* regular draw */ \ else \ @@ -241,8 +236,9 @@ void segaic16_sprites_hangon_draw(running_machine &machine, device_t *device, bi pri[x] = 0xff; \ } \ -void segaic16_sprites_sharrier_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_sharrier_draw(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(); @@ -401,7 +397,7 @@ void segaic16_sprites_sharrier_draw(running_machine &machine, device_t *device, { \ /* shadow/hilight mode? */ \ if (color == sega16sp->colorbase + (0x3f << 4)) \ - dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ \ /* regular draw */ \ else \ @@ -412,8 +408,9 @@ void segaic16_sprites_sharrier_draw(running_machine &machine, device_t *device, pri[x] = 0xff; \ } \ -void segaic16_sprites_16a_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16a_draw(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); @@ -560,8 +557,8 @@ void segaic16_sprites_16a_draw(running_machine &machine, device_t *device, bitma { \ /* we have to check this for System 18 so that we don't */ \ /* attempt to shadow VDP pixels */ \ - if (dest[x] < segaic16_palette.entries) \ - dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + if (dest[x] < sega16sp->palette_entries) \ + dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ } \ \ /* regular draw */ \ @@ -573,8 +570,9 @@ void segaic16_sprites_16a_draw(running_machine &machine, device_t *device, bitma pri[x] = 0xff; \ } \ -void segaic16_sprites_16b_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_16b_draw(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); @@ -728,7 +726,7 @@ void segaic16_sprites_16b_draw(running_machine &machine, device_t *device, bitma { \ /* shadow/hilight mode? */ \ if (pix == 14) \ - dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ \ /* regular draw */ \ else \ @@ -739,8 +737,9 @@ void segaic16_sprites_16b_draw(running_machine &machine, device_t *device, bitma pri[x] = 0; \ } \ -void segaic16_sprites_yboard_16b_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_yboard_16b_draw(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); @@ -906,7 +905,7 @@ void segaic16_sprites_yboard_16b_draw(running_machine &machine, device_t *device { \ /* shadow/hilight mode? */ \ if (shadow && pix == 0xa) \ - dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ \ /* regular draw */ \ else \ @@ -917,8 +916,9 @@ void segaic16_sprites_yboard_16b_draw(running_machine &machine, device_t *device pri[x] = 0xff; \ } \ -static void segaic16_sprites_xboard_outrun_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect, int type) +static void segaic16_sprites_xboard_outrun_draw(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(running_machine &machine, device } } -void segaic16_sprites_outrun_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_outrun_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - segaic16_sprites_xboard_outrun_draw(machine, device, bitmap, cliprect, SEGAIC16_SPRITES_OUTRUN); + segaic16_sprites_xboard_outrun_draw(device, bitmap, cliprect, SEGAIC16_SPRITES_OUTRUN); } -void segaic16_sprites_xboard_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_xboard_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) { - segaic16_sprites_xboard_outrun_draw(machine, device, bitmap, cliprect, SEGAIC16_SPRITES_XBOARD); + segaic16_sprites_xboard_outrun_draw(device, bitmap, cliprect, SEGAIC16_SPRITES_XBOARD); } @@ -1088,11 +1088,12 @@ void segaic16_sprites_xboard_draw(running_machine &machine, device_t *device, bi if (x >= minx && x <= maxx && ind < 0x1fe) \ dest[x] = ind | colorpri; \ -void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bitmap_t *bitmap, const rectangle *cliprect) +void segaic16_sprites_yboard_draw(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[0].buffer ? segaic16_rotate[0].buffer : segaic16_rotate[0].rotateram; + const UINT16 *rotatebase = segaic16_rotate_base(0); UINT8 visited[0x1000]; sega16sp_state *sega16sp = get_safe_token(device); int next = 0; @@ -1273,7 +1274,7 @@ void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bi { \ /* shadow/hilight mode? */ \ if (color == sega16sp->colorbase + (0x3f << 4)) \ - dest[x] += (segaic16_paletteram[dest[x]] & 0x8000) ? segaic16_palette.entries*2 : segaic16_palette.entries; \ + dest[x] += (sega16sp->paletteram[dest[x]] & 0x8000) ? sega16sp->palette_entries*2 : sega16sp->palette_entries; \ \ /* regular draw */ \ else \ @@ -1382,8 +1383,9 @@ void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bi -void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine &machine, 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) { + 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); @@ -1405,8 +1407,9 @@ void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine &machine, device_t } /* 4 player passing shot is different to this.. */ -void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine &machine, 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) { + 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); @@ -1427,8 +1430,9 @@ void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine &machine, device_ } } -void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine &machine, 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) { + 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); @@ -1455,27 +1459,10 @@ void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine &machine, device * *************************************/ -void segaic16_sprites_draw(device_t *screen, bitmap_t *bitmap, const rectangle *cliprect, int which) +void segaic16_sprites_draw(screen_device *screen, bitmap_t *bitmap, const rectangle *cliprect, device_t *device) { - 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); + sega16sp_state *sega16sp = get_safe_token(device); + (*sega16sp->draw)(device, bitmap, cliprect); } @@ -1486,23 +1473,19 @@ void segaic16_sprites_draw(device_t *screen, bitmap_t *bitmap, const rectangle * * *************************************/ -void segaic16_sprites_set_bank(running_machine &machine, int which, int banknum, int offset) +void segaic16_sprites_set_banks(device_t *device, const UINT8 *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"); + sega16sp_state *sega16sp = get_safe_token(device); + memcpy(sega16sp->bank, bank, sizeof(sega16sp->bank)); +} +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 = machine.primary_screen; + screen_device *screen = device->machine().primary_screen; screen->update_partial(screen->vpos()); sega16sp->bank[banknum] = offset; } @@ -1516,24 +1499,14 @@ void segaic16_sprites_set_bank(running_machine &machine, int which, int banknum, * *************************************/ -void segaic16_sprites_set_flip(running_machine &machine, int which, int flip) +void segaic16_sprites_set_flip(device_t *device, 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 = machine.primary_screen; + screen_device *screen = device->machine().primary_screen; screen->update_partial(screen->vpos()); sega16sp->flip = flip; } @@ -1547,24 +1520,14 @@ void segaic16_sprites_set_flip(running_machine &machine, int which, int flip) * *************************************/ -void segaic16_sprites_set_shadow(running_machine &machine, int which, int shadow) +void segaic16_sprites_set_shadow(device_t *device, 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 = machine.primary_screen; + screen_device *screen = device->machine().primary_screen; screen->update_partial(screen->vpos()); sega16sp->shadow = shadow; } @@ -1582,12 +1545,6 @@ 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; @@ -1610,33 +1567,12 @@ static void segaic16_sprites_buffer(device_t* device) } -WRITE16_HANDLER( segaic16_sprites_draw_0_w ) +WRITE16_DEVICE_HANDLER( segaic16_sprites_draw_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 *****************************************************************************/ @@ -1653,7 +1589,6 @@ 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; @@ -1676,6 +1611,18 @@ 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) @@ -1686,7 +1633,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 ccad73ad8ec..8515dee24a2 100644 --- a/src/mame/video/segahang.c +++ b/src/mame/video/segahang.c @@ -18,27 +18,31 @@ VIDEO_START( hangon ) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x800); + segaic16_palette_init(0x800, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_HANGON, 0x038, 0x7c0, 0x7c0, 0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_HANGON, 0x038, 0x7c0, 0x7c0, 0, state->m_roadram_0); } VIDEO_START( sharrier ) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x800); + segaic16_palette_init(0x800, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_SHARRIER, 0x038, 0x7c0, 0x7c0, 0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_SHARRIER, 0x038, 0x7c0, 0x7c0, 0, state->m_roadram_0); } @@ -82,7 +86,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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c index 493aff16db1..10a93d191a9 100644 --- a/src/mame/video/segaic16.c +++ b/src/mame/video/segaic16.c @@ -376,15 +376,6 @@ 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]; @@ -394,6 +385,9 @@ struct road_info segaic16_road[SEGAIC16_MAX_ROADS]; * *************************************/ +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]; @@ -439,7 +433,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) +void segaic16_palette_init(int entries, UINT16 *paletteram) { 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 }; @@ -449,6 +443,7 @@ void segaic16_palette_init(int entries) /* 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, @@ -478,6 +473,10 @@ void segaic16_palette_init(int entries) } +int segaic16_palette_entries(void) +{ + return segaic16_palette.entries; +} /************************************* * @@ -492,9 +491,9 @@ WRITE16_HANDLER( segaic16_paletteram_w ) struct palette_info *info = &segaic16_palette; /* get the new value */ - newval = segaic16_paletteram[offset]; + newval = info->paletteram[offset]; COMBINE_DATA(&newval); - segaic16_paletteram[offset] = newval; + info->paletteram[offset] = newval; /* byte 0 byte 1 */ /* sBGR BBBB GGGG RRRR */ @@ -1113,7 +1112,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) +void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks, UINT16 *textram, UINT16 *tileram) { struct tilemap_info *info = &bg_tilemap[which]; tile_get_info_func get_text_info; @@ -1129,13 +1128,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: @@ -1352,19 +1351,21 @@ void segaic16_tilemap_set_colscroll(running_machine &machine, int which, int ena WRITE16_HANDLER( segaic16_tileram_0_w ) { - COMBINE_DATA(&segaic16_tileram_0[offset]); - tilemap_mark_tile_dirty(bg_tilemap[0].tilemaps[offset / (64*32)], offset % (64*32)); + struct tilemap_info *info = &bg_tilemap[0]; + COMBINE_DATA(&info->tileram[offset]); + tilemap_mark_tile_dirty(info->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(&segaic16_textram_0[offset]); - tilemap_mark_tile_dirty(bg_tilemap[0].textmap, offset); + COMBINE_DATA(&info->textram[offset]); + tilemap_mark_tile_dirty(info->textmap, offset); } @@ -1874,7 +1875,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) +void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs, UINT16 *roadram) { struct road_info *info = &segaic16_road[which]; @@ -1886,12 +1887,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: @@ -1903,6 +1904,7 @@ 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; @@ -1982,7 +1984,7 @@ WRITE16_HANDLER( segaic16_road_control_0_w ) * *************************************/ -void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase) +void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase, UINT16 *rotateram) { struct rotate_info *info = &segaic16_rotate[which]; @@ -1991,12 +1993,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: @@ -2085,6 +2087,11 @@ 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 2200d9edef0..df3e1b4ac24 100644 --- a/src/mame/video/segaic16.h +++ b/src/mame/video/segaic16.h @@ -8,19 +8,13 @@ /* 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); +void segaic16_palette_init(int entries, UINT16 *paletteram); +int segaic16_palette_entries(void); WRITE16_HANDLER( segaic16_paletteram_w ); /* tilemap systems */ @@ -35,7 +29,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); +void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks, UINT16 *textram, UINT16 *tileram); 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); @@ -47,17 +41,15 @@ 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(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 ); +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 ); /* road systems */ #define SEGAIC16_MAX_ROADS 1 @@ -70,7 +62,7 @@ WRITE16_HANDLER( segaic16_sprites_draw_1_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); +void segaic16_road_init(running_machine &machine, int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs, UINT16 *roadram); 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 ); @@ -80,8 +72,9 @@ 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); +void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase, UINT16 *rotateram); 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 ); /************************************* @@ -145,6 +138,7 @@ 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 @@ -161,12 +155,13 @@ 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)(running_machine &machine, device_t* device, bitmap_t *bitmap, const rectangle *cliprect); + void (*draw)(device_t* device, bitmap_t *bitmap, const rectangle *cliprect); int buffer; /* should ram be buffered? */ + int paletteram_offset; + int spriteram_offset; }; @@ -176,14 +171,15 @@ 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)(running_machine &machine, device_t* device, bitmap_t *bitmap, const rectangle *cliprect); + void (*draw)(device_t *device, bitmap_t *bitmap, const rectangle *cliprect); + INT32 palette_entries; + UINT16 * paletteram; UINT16 * spriteram; /* pointer to spriteram pointer */ UINT16 * buffer; /* buffered spriteram for those that use it */ @@ -195,140 +191,18 @@ struct _sega16sp_state DECLARE_LEGACY_DEVICE(SEGA16SP, sega16sp); -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 -}; - - +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); #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 31212d9b510..bd099abec5b 100644 --- a/src/mame/video/segaorun.c +++ b/src/mame/video/segaorun.c @@ -18,27 +18,31 @@ VIDEO_START( shangon ) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x1000); + segaic16_palette_init(0x1000, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0, state->m_roadram_0); } VIDEO_START( outrun ) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x1000); + segaic16_palette_init(0x1000, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0, state->m_roadram_0); } @@ -75,7 +79,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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } @@ -111,6 +115,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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } diff --git a/src/mame/video/segas16a.c b/src/mame/video/segas16a.c index ad86b37eb8c..c87cdaf4c64 100644 --- a/src/mame/video/segas16a.c +++ b/src/mame/video/segas16a.c @@ -18,11 +18,13 @@ VIDEO_START( system16a ) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x800); + segaic16_palette_init(0x800, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1, state->m_textram_0, state->m_tileram_0); } @@ -62,6 +64,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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } diff --git a/src/mame/video/segas16b.c b/src/mame/video/segas16b.c index 404f5c9a83f..f3e6b9fba9b 100644 --- a/src/mame/video/segas16b.c +++ b/src/mame/video/segas16b.c @@ -18,11 +18,13 @@ static void video_start_common(running_machine &machine, int type) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x800); + segaic16_palette_init(0x800, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, type, 0x000, 0, 2); + segaic16_tilemap_init(machine, 0, type, 0x000, 0, 2, state->m_textram_0, state->m_tileram_0); } @@ -74,6 +76,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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index b881753a7ad..1774caff71a 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); + segaic16_palette_init(0x800, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8, state->m_textram_0, state->m_tileram_0); /* 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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); #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 1248290b19c..fed15d614ca 100644 --- a/src/mame/video/segaxbd.c +++ b/src/mame/video/segaxbd.c @@ -17,14 +17,16 @@ VIDEO_START( xboard ) { + segas1x_state *state = machine.driver_data(); + /* compute palette info */ - segaic16_palette_init(0x2000); + segaic16_palette_init(0x2000, state->m_paletteram); /* initialize the tile/text layers */ - segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2); + segaic16_tilemap_init(machine, 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2, state->m_textram_0, state->m_tileram_0); /* initialize the road */ - segaic16_road_init(machine, 0, SEGAIC16_ROAD_XBOARD, 0x1700, 0x1720, 0x1780, -166); + segaic16_road_init(machine, 0, SEGAIC16_ROAD_XBOARD, 0x1700, 0x1720, 0x1780, -166, state->m_roadram_0); } @@ -70,6 +72,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, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c index bcea3bba4f1..e32d8c58876 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); + segaic16_palette_init(0x2000, state->m_paletteram); /* 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); + segaic16_rotate_init(machine, 0, SEGAIC16_ROTATE_YBOARD, 0x000, state->m_rotateram_0); 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, 1); + segaic16_sprites_draw(screen, state->m_tmp_bitmap, &yboard_clip, screen->machine().device("segaspr2")); /* apply rotation */ segaic16_rotate_draw(screen->machine(), 0, bitmap, cliprect, state->m_tmp_bitmap); /* draw the 16B sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } diff --git a/src/mame/video/system16.c b/src/mame/video/system16.c index 3f77431ff0f..fc8aa220a4b 100644 --- a/src/mame/video/system16.c +++ b/src/mame/video/system16.c @@ -33,23 +33,11 @@ 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"); - 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]); - - } - + segaic16_sprites_set_banks(spr, (state->m_spritebank_type == 1) ? default_banklist : alternate_banklist); } @@ -434,10 +422,8 @@ VIDEO_START( system16 ) state->m_system18 = 0; } - segaic16_palette_init(0x800); + segaic16_palette_init(0x800, state->m_paletteram); setup_system16_bootleg_spritebanking(machine); - - } VIDEO_START( system18old ) @@ -606,8 +592,7 @@ 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); - + segaic16_palette_init(0x800, state->m_paletteram); } VIDEO_START( s16a_bootleg_wb3bl ) @@ -681,7 +666,7 @@ SCREEN_UPDATE( s16a_bootleg ) } /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } @@ -722,7 +707,7 @@ SCREEN_UPDATE( s16a_bootleg_passht4b ) } /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } @@ -771,7 +756,7 @@ SCREEN_UPDATE( system16 ) //draw_sprites(screen->machine(), bitmap, cliprect,0); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; } @@ -805,7 +790,7 @@ SCREEN_UPDATE( system18old ) tilemap_draw(bitmap, cliprect, state->m_text_layer, 0, 0xf); /* draw the sprites */ - segaic16_sprites_draw(screen, bitmap, cliprect, 0); + segaic16_sprites_draw(screen, bitmap, cliprect, screen->machine().device("segaspr1")); return 0; }