From 23c3deba37675f0892a1a3aa3df45f31eaa80036 Mon Sep 17 00:00:00 2001 From: Osso Date: Fri, 19 Dec 2014 18:53:11 +0100 Subject: [PATCH] Added missing save state support to segaic16_video_device. Fixes quartet2 save state problem (nw) Some almost exclusively cosmetic changes to the device, while at it (nw) --- src/mame/drivers/segahang.c | 20 ++-- src/mame/drivers/segaorun.c | 12 +-- src/mame/drivers/segas16a.c | 26 ++--- src/mame/drivers/segas16b.c | 26 ++--- src/mame/drivers/segas18.c | 22 ++-- src/mame/drivers/segaxbd.c | 10 +- src/mame/drivers/segaybd.c | 7 +- src/mame/includes/segaorun.h | 4 +- src/mame/includes/segas16b.h | 4 +- src/mame/includes/segas18.h | 4 +- src/mame/video/segahang.c | 16 +-- src/mame/video/segaic16.c | 191 ++++++++++++++++++----------------- src/mame/video/segaic16.h | 65 ++++++------ src/mame/video/segaorun.c | 30 +++--- src/mame/video/segas16a.c | 20 ++-- src/mame/video/segas16b.c | 20 ++-- src/mame/video/segas18.c | 20 ++-- src/mame/video/segaxbd.c | 16 +-- src/mame/video/segaybd.c | 8 +- 19 files changed, 251 insertions(+), 270 deletions(-) diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c index 5600f4b7350..b89cc0823a4 100644 --- a/src/mame/drivers/segahang.c +++ b/src/mame/drivers/segahang.c @@ -59,14 +59,14 @@ WRITE8_MEMBER( segahang_state::video_lamps_w ) // // bit 7: screen flip - m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x80); + m_segaic16vid->tilemap_set_flip(0, data & 0x80); m_sprites->set_flip(data & 0x80); // bit 6: shadow/highlight control m_shadow = ~data & 0x40; // bit 4: enable display - m_segaic16vid->segaic16_set_display_enable(data & 0x10); + m_segaic16vid->set_display_enable(data & 0x10); // bits 2 & 3: control the lamps set_led_status(machine(), 1, data & 0x08); @@ -102,8 +102,8 @@ WRITE8_MEMBER( segahang_state::tilemap_sound_w ) m_soundcpu->set_input_line(INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); // bits 1 & 2: tilemap origin - m_segaic16vid->segaic16_tilemap_set_colscroll(0, ~data & 0x04); - m_segaic16vid->segaic16_tilemap_set_rowscroll(0, ~data & 0x02); + m_segaic16vid->tilemap_set_colscroll(0, ~data & 0x04); + m_segaic16vid->tilemap_set_rowscroll(0, ~data & 0x02); // bit 0: sound mute machine().sound().system_enable(data & 0x01); @@ -350,7 +350,7 @@ INTERRUPT_GEN_MEMBER( segahang_state::i8751_main_cpu_vblank ) void segahang_state::machine_reset() { // reset misc components - m_segaic16vid->segaic16_tilemap_reset(*m_screen); + m_segaic16vid->tilemap_reset(*m_screen); // queue up a timer to either boost interleave or disable the MCU synchronize(TID_INIT_I8751); @@ -413,8 +413,8 @@ static ADDRESS_MAP_START( hangon_map, AS_PROGRAM, 16, segahang_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x20c000, 0x20ffff) AM_RAM AM_SHARE("workram") - AM_RANGE(0x400000, 0x403fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_tileram_0_r, segaic16_tileram_0_w) AM_SHARE("textram") - AM_RANGE(0x410000, 0x410fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_textram_0_r, segaic16_textram_0_w) AM_SHARE("tileram") + AM_RANGE(0x400000, 0x403fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") + AM_RANGE(0x410000, 0x410fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") AM_RANGE(0x600000, 0x6007ff) AM_RAM AM_SHARE("sprites") AM_RANGE(0xa00000, 0xa00fff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") AM_RANGE(0xc00000, 0xc3ffff) AM_ROM AM_REGION("subcpu", 0) @@ -427,8 +427,8 @@ static ADDRESS_MAP_START( sharrier_map, AS_PROGRAM, 16, segahang_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x040000, 0x043fff) AM_RAM AM_SHARE("workram") - AM_RANGE(0x100000, 0x107fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_tileram_0_r, segaic16_tileram_0_w) AM_SHARE("textram") - AM_RANGE(0x108000, 0x108fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_textram_0_r, segaic16_textram_0_w) AM_SHARE("tileram") + AM_RANGE(0x100000, 0x107fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") + AM_RANGE(0x108000, 0x108fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") AM_RANGE(0x110000, 0x110fff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x124000, 0x127fff) AM_RAM AM_SHARE("subram") AM_RANGE(0x130000, 0x130fff) AM_RAM AM_SHARE("sprites") @@ -1746,8 +1746,6 @@ ROM_END DRIVER_INIT_MEMBER(segahang_state,generic) { // point globals to allocated memory regions - m_segaic16vid->segaic16_tileram_0 = reinterpret_cast(memshare("tileram")->ptr()); - m_segaic16vid->segaic16_textram_0 = reinterpret_cast(memshare("textram")->ptr()); m_segaic16road->segaic16_roadram_0 = reinterpret_cast(memshare("roadram")->ptr()); // save states diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index 66ef3440974..d5ebe6cec9c 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -349,7 +349,7 @@ WRITE8_MEMBER( segaorun_state::video_control_w ) // D1: (CONT) - affects sprite hardware // D0: Sound section reset (1= normal operation, 0= reset) - m_segaic16vid->segaic16_set_display_enable(data & 0x20); + m_segaic16vid->set_display_enable(data & 0x20); m_adc_select = (data >> 2) & 7; m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); } @@ -459,8 +459,8 @@ void segaorun_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 in break; case 1: - mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segaorun_state::sega_tileram_0_w), this)); - mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segaorun_state::sega_textram_0_w), this)); + mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segaorun_state::tileram_w), this)); + mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segaorun_state::textram_w), this)); break; case 0: @@ -568,7 +568,7 @@ void segaorun_state::machine_reset() // reset misc components if (m_custom_map != NULL) m_mapper->configure_explicit(m_custom_map); - m_segaic16vid->segaic16_tilemap_reset(*m_screen); + m_segaic16vid->tilemap_reset(*m_screen); // hook the RESET line, which resets CPU #1 m_maincpu->set_reset_callback(write_line_delegate(FUNC(segaorun_state::m68k_reset_callback),this)); @@ -814,7 +814,7 @@ WRITE16_MEMBER( segaorun_state::shangon_custom_io_w ) // D2: Start lamp // other bits: ? m_adc_select = data >> 6 & 3; - m_segaic16vid->segaic16_set_display_enable(data >> 5 & 1); + m_segaic16vid->set_display_enable(data >> 5 & 1); output_set_value("Vibration_motor", data >> 3 & 1); output_set_value("Start_lamp", data >> 2 & 1); } @@ -2369,8 +2369,6 @@ DRIVER_INIT_MEMBER(segaorun_state,generic) m_nvram->set_base(m_workram, m_workram.bytes()); // point globals to allocated memory regions - m_segaic16vid->segaic16_tileram_0 = reinterpret_cast(memshare("tileram")->ptr()); - m_segaic16vid->segaic16_textram_0 = reinterpret_cast(memshare("textram")->ptr()); m_segaic16road->segaic16_roadram_0 = reinterpret_cast(memshare("roadram")->ptr()); // save state diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c index 4aad087b703..2001e28b832 100644 --- a/src/mame/drivers/segas16a.c +++ b/src/mame/drivers/segas16a.c @@ -187,7 +187,7 @@ WRITE8_MEMBER( segas16a_state::misc_control_w ) m_video_control = data; // bit 7: screen flip - m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x80); + m_segaic16vid->tilemap_set_flip(0, data & 0x80); m_sprites->set_flip(data & 0x80); // bit 6: set 8751 interrupt line @@ -195,7 +195,7 @@ WRITE8_MEMBER( segas16a_state::misc_control_w ) m_mcu->set_input_line(MCS51_INT1_LINE, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE); // bit 4: enable display - m_segaic16vid->segaic16_set_display_enable(data & 0x10); + m_segaic16vid->set_display_enable(data & 0x10); // bits 0 & 1: update coin counters coin_counter_w(machine(), 1, data & 0x02); @@ -224,8 +224,8 @@ WRITE8_MEMBER( segas16a_state::tilemap_sound_w ) // 1= sound is enabled // m_soundcpu->set_input_line(INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); - m_segaic16vid->segaic16_tilemap_set_colscroll(0, ~data & 0x04); - m_segaic16vid->segaic16_tilemap_set_rowscroll(0, ~data & 0x02); + m_segaic16vid->tilemap_set_colscroll(0, ~data & 0x04); + m_segaic16vid->tilemap_set_rowscroll(0, ~data & 0x02); } @@ -455,7 +455,7 @@ WRITE8_MEMBER( segas16a_state::mcu_control_w ) // enable/disable the display if (data & 0x40) - m_segaic16vid->segaic16_set_display_enable(1); + m_segaic16vid->set_display_enable(1); // apply an extra boost if the main CPU is just waking up if ((m_mcu_control ^ data) & 0x40) @@ -715,12 +715,12 @@ void segas16a_state::quartet_i8751_sim() // X scroll values address_space &space = m_maincpu->space(AS_PROGRAM); - m_segaic16vid->segaic16_textram_0_w(space, 0xff8/2, m_workram[0x0d14/2], 0xffff); - m_segaic16vid->segaic16_textram_0_w(space, 0xffa/2, m_workram[0x0d18/2], 0xffff); + m_segaic16vid->textram_w(space, 0xff8/2, m_workram[0x0d14/2], 0xffff); + m_segaic16vid->textram_w(space, 0xffa/2, m_workram[0x0d18/2], 0xffff); // page values - m_segaic16vid->segaic16_textram_0_w(space, 0xe9e/2, m_workram[0x0d1c/2], 0xffff); - m_segaic16vid->segaic16_textram_0_w(space, 0xe9c/2, m_workram[0x0d1e/2], 0xffff); + m_segaic16vid->textram_w(space, 0xe9e/2, m_workram[0x0d1c/2], 0xffff); + m_segaic16vid->textram_w(space, 0xe9c/2, m_workram[0x0d1e/2], 0xffff); } @@ -952,8 +952,8 @@ void segas16a_state::sjryuko_lamp_changed_w(UINT8 changed, UINT8 newval) static ADDRESS_MAP_START( system16a_map, AS_PROGRAM, 16, segas16a_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x380000) AM_ROM - AM_RANGE(0x400000, 0x407fff) AM_MIRROR(0xb88000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_tileram_0_r, segaic16_tileram_0_w) AM_SHARE("textram") - AM_RANGE(0x410000, 0x410fff) AM_MIRROR(0xb8f000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_textram_0_r, segaic16_textram_0_w) AM_SHARE("tileram") + AM_RANGE(0x400000, 0x407fff) AM_MIRROR(0xb88000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") + AM_RANGE(0x410000, 0x410fff) AM_MIRROR(0xb8f000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") AM_RANGE(0x440000, 0x4407ff) AM_MIRROR(0x3bf800) AM_RAM AM_SHARE("sprites") AM_RANGE(0x840000, 0x840fff) AM_MIRROR(0x3bf000) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") AM_RANGE(0xc40000, 0xc43fff) AM_MIRROR(0x39c000) AM_READWRITE(misc_io_r, misc_io_w) @@ -3454,10 +3454,6 @@ DRIVER_INIT_MEMBER(segas16a_state,generic) m_custom_io_r = read16_delegate(FUNC(segas16a_state::standard_io_r), this); m_custom_io_w = write16_delegate(FUNC(segas16a_state::standard_io_w), this); - // point globals to allocated memory regions - m_segaic16vid->segaic16_tileram_0 = reinterpret_cast(memshare("tileram")->ptr()); - m_segaic16vid->segaic16_textram_0 = reinterpret_cast(memshare("textram")->ptr()); - // save state save_item(NAME(m_video_control)); save_item(NAME(m_mcu_control)); diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index 782ad296284..02cfed52071 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -912,8 +912,8 @@ void segas16b_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 in break; case 5: // 64k of tileram + 4k of textram - mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas16b_state::sega_tileram_0_w), this)); - mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas16b_state::sega_textram_0_w), this)); + mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas16b_state::tileram_w), this)); + mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas16b_state::textram_w), this)); break; case 4: // 2k of spriteram @@ -1003,7 +1003,7 @@ void segas16b_state::mapper_sound_w(UINT8 data) WRITE16_MEMBER( segas16b_state::rom_5704_bank_w ) { if (ACCESSING_BITS_0_7) - m_segaic16vid->segaic16_tilemap_set_bank(0, offset & 1, data & 7); + m_segaic16vid->tilemap_set_bank(0, offset & 1, data & 7); } @@ -1051,7 +1051,7 @@ WRITE16_MEMBER( segas16b_state::rom_5797_bank_math_w ) case 0x2000/2: if (ACCESSING_BITS_0_7) - m_segaic16vid->segaic16_tilemap_set_bank(0, offset & 1, data & 7); + m_segaic16vid->tilemap_set_bank(0, offset & 1, data & 7); break; } } @@ -1124,10 +1124,10 @@ WRITE16_MEMBER( segas16b_state::standard_io_w ) // D1 : (Output to coin counter 2?) // D0 : Output to coin counter 1 // - m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x40); + m_segaic16vid->tilemap_set_flip(0, data & 0x40); m_sprites->set_flip(data & 0x40); if (!m_disable_screen_blanking) - m_segaic16vid->segaic16_set_display_enable(data & 0x20); + m_segaic16vid->set_display_enable(data & 0x20); set_led_status(machine(), 1, data & 0x08); set_led_status(machine(), 0, data & 0x04); coin_counter_w(machine(), 1, data & 0x02); @@ -1288,7 +1288,7 @@ void segas16b_state::machine_reset() synchronize(TID_INIT_I8751); // reset tilemap state - m_segaic16vid->segaic16_tilemap_reset(*m_screen); + m_segaic16vid->tilemap_reset(*m_screen); // configure sprite banks static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; @@ -6625,10 +6625,6 @@ void segas16b_state::init_generic(segas16b_rom_board rom_board) m_custom_io_r = read16_delegate(FUNC(segas16b_state::standard_io_r), this); m_custom_io_w = write16_delegate(FUNC(segas16b_state::standard_io_w), this); - // point globals to allocated memory regions - m_segaic16vid->segaic16_tileram_0 = reinterpret_cast(memshare("tileram")->ptr()); - m_segaic16vid->segaic16_textram_0 = reinterpret_cast(memshare("textram")->ptr()); - // save state save_item(NAME(m_atomicp_sound_count)); save_item(NAME(m_hwc_input_value)); @@ -6654,7 +6650,7 @@ DRIVER_INIT_MEMBER(segas16b_state,generic_korean) // configure special behaviors for the Korean boards m_disable_screen_blanking = true; m_atomicp_sound_divisor = 1; - m_segaic16vid->segaic16_display_enable = 1; + m_segaic16vid->m_display_enable = 1; // allocate a sound timer emu_timer *timer = timer_alloc(TID_ATOMICP_SOUND_IRQ); @@ -7221,8 +7217,8 @@ static ADDRESS_MAP_START( isgsm_map, AS_PROGRAM, 16, isgsm_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROMBANK(ISGSM_MAIN_BANK) AM_REGION("bios", 0) // 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_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_tileram_0_r, segaic16_tileram_0_w) AM_SHARE("textram") - AM_RANGE(0x410000, 0x410fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_textram_0_r, segaic16_textram_0_w) AM_SHARE("tileram") + AM_RANGE(0x400000, 0x40ffff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") + AM_RANGE(0x410000, 0x410fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") AM_RANGE(0x440000, 0x4407ff) AM_RAM AM_SHARE("sprites") AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") AM_RANGE(0xc40000, 0xc43fff) AM_READWRITE(standard_io_r, standard_io_w) @@ -7358,7 +7354,7 @@ INPUT_PORTS_END void isgsm_state::machine_reset() { - m_segaic16vid->segaic16_tilemap_reset(*m_screen); + m_segaic16vid->tilemap_reset(*m_screen); // configure sprite banks for (int i = 0; i < 16; i++) diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 9fa5195bd3f..afd68a1d736 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -57,8 +57,8 @@ void segas18_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 ind break; case 5: - mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas18_state::sega_tileram_0_w), this)); - mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas18_state::sega_textram_0_w), this)); + mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas18_state::tileram_w), this)); + mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas18_state::textram_w), this)); break; case 4: @@ -141,10 +141,6 @@ void segas18_state::init_generic(segas18_rom_board rom_board) // configure the NVRAM to point to our workram m_nvram->set_base(m_workram, m_workram.bytes()); - // point globals to allocated memory regions - m_segaic16vid->segaic16_tileram_0 = reinterpret_cast(memshare("tileram")->ptr()); - m_segaic16vid->segaic16_textram_0 = reinterpret_cast(memshare("textram")->ptr()); - // configure VDP m_vdp->set_use_cram(1); m_vdp->set_vdp_pal(FALSE); @@ -181,7 +177,7 @@ void segas18_state::device_timer(emu_timer &timer, device_timer_id id, int param void segas18_state::machine_reset() { - m_segaic16vid->segaic16_tilemap_reset(*m_screen); + m_segaic16vid->tilemap_reset(*m_screen); m_vdp->device_reset_old(); @@ -202,7 +198,7 @@ WRITE8_MEMBER( segas18_state::misc_outputs_w ) { // miscellaneous output set_grayscale(~data & 0x40); - m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20); + m_segaic16vid->tilemap_set_flip(0, data & 0x20); m_sprites->set_flip(data & 0x20); // These are correct according to cgfm's docs, but mwalker and ddcrew both // enable the lockout and never turn it off @@ -284,8 +280,8 @@ WRITE8_MEMBER( segas18_state::rom_5874_bank_w ) { for (int i = 0; i < 4; i++) { - m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i); - m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i); + m_segaic16vid->tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i); + m_segaic16vid->tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i); } } } @@ -305,7 +301,7 @@ WRITE16_MEMBER( segas18_state::rom_5987_bank_w ) int maxbanks = m_gfxdecode->gfx(0)->elements() / 1024; if (data >= maxbanks) data %= maxbanks; - m_segaic16vid->segaic16_tilemap_set_bank(0, offset, data); + m_segaic16vid->tilemap_set_bank(0, offset, data); } // sprite banking @@ -335,7 +331,7 @@ WRITE16_MEMBER( segas18_state::rom_837_7525_bank_w ) if (data & 0x80) data += 0x20; data &= 0x3f; - m_segaic16vid->segaic16_tilemap_set_bank(0, offset, data); + m_segaic16vid->tilemap_set_bank(0, offset, data); } // sprite banking @@ -1217,7 +1213,7 @@ static MACHINE_CONFIG_START( system18, segas18_state ) MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE")) MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW")) MCFG_315_5296_OUT_PORTH_CB(WRITE8(segas18_state, rom_5874_bank_w)) - MCFG_315_5296_OUT_CNT1_CB(DEVWRITELINE("segaic16vid", segaic16_video_device, segaic16_set_display_enable)) + MCFG_315_5296_OUT_CNT1_CB(DEVWRITELINE("segaic16vid", segaic16_video_device, set_display_enable)) MCFG_315_5296_OUT_CNT2_CB(WRITELINE(segas18_state, set_vdp_enable)) MCFG_DEVICE_ADD("gen_vdp", SEGA315_5313, 0) diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c index f0c82d85b09..39aacf89ee2 100644 --- a/src/mame/drivers/segaxbd.c +++ b/src/mame/drivers/segaxbd.c @@ -449,7 +449,7 @@ WRITE16_MEMBER( segaxbd_state::iochip_0_w ) if (((oldval ^ data) & 0x40) && !(data & 0x40)) machine().watchdog_reset(); - m_segaic16vid->segaic16_set_display_enable(data & 0x20); + m_segaic16vid->set_display_enable(data & 0x20); m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); if (m_soundcpu2 != NULL) @@ -640,7 +640,7 @@ READ8_MEMBER( segaxbd_state::sound_data_r ) void segaxbd_state::machine_reset() { - m_segaic16vid->segaic16_tilemap_reset(*m_screen); + m_segaic16vid->tilemap_reset(*m_screen); // hook the RESET line, which resets CPU #1 m_maincpu->set_reset_callback(write_line_delegate(FUNC(segaxbd_state::m68k_reset_callback),this)); @@ -876,8 +876,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, segaxbd_state ) 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_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_tileram_0_r, segaic16_tileram_0_w) AM_SHARE("textram") - AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_textram_0_r, segaic16_textram_0_w) AM_SHARE("tileram") + AM_RANGE(0x0c0000, 0x0cffff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") + AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") AM_RANGE(0x0e0000, 0x0e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_main", sega_315_5248_multiplier_device, read, write) AM_RANGE(0x0e4000, 0x0e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_main", sega_315_5249_divider_device, read, write) AM_RANGE(0x0e8000, 0x0e801f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("cmptimer_main", sega_315_5250_compare_timer_device, read, write) @@ -3209,8 +3209,6 @@ DRIVER_INIT_MEMBER(segaxbd_state,generic) m_iochip_custom_io_w[0][3] = iowrite_delegate(FUNC(segaxbd_state::generic_iochip0_lamps_w), this); // point globals to allocated memory regions - m_segaic16vid->segaic16_tileram_0 = reinterpret_cast(memshare("tileram")->ptr()); - m_segaic16vid->segaic16_textram_0 = reinterpret_cast(memshare("textram")->ptr()); m_segaic16road->segaic16_roadram_0 = reinterpret_cast(memshare("roadram")->ptr()); // save state diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c index facb919bdba..e406b0a10ba 100644 --- a/src/mame/drivers/segaybd.c +++ b/src/mame/drivers/segaybd.c @@ -207,7 +207,7 @@ WRITE16_MEMBER( segaybd_state::io_chip_w ) // D2 = YRES // D1-D0 = ADC0-1 // - m_segaic16vid->segaic16_set_display_enable(data & 0x80); + m_segaic16vid->set_display_enable(data & 0x80); if (((old ^ data) & 0x20) && !(data & 0x20)) machine().watchdog_reset(); m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); @@ -741,7 +741,7 @@ static ADDRESS_MAP_START( suby_map, AS_PROGRAM, 16, segaybd_state ) AM_RANGE(0x180000, 0x1807ff) AM_MIRROR(0x007800) AM_RAM AM_SHARE("rotateram") AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_SHARE("bsprites") AM_RANGE(0x190000, 0x193fff) AM_MIRROR(0x004000) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") - AM_RANGE(0x198000, 0x19ffff) AM_DEVREAD("segaic16vid", segaic16_video_device, segaic16_rotate_control_0_r) + AM_RANGE(0x198000, 0x19ffff) AM_DEVREAD("segaic16vid", segaic16_video_device, rotate_control_r) AM_RANGE(0x1f0000, 0x1fffff) AM_RAM ADDRESS_MAP_END @@ -2529,9 +2529,6 @@ DRIVER_INIT_MEMBER(segaybd_state,generic) // allocate a scanline timer m_scanline_timer = timer_alloc(TID_IRQ2_GEN); - // point globals to allocated memory regions - m_segaic16vid->segaic16_rotateram_0 = reinterpret_cast(memshare("rotateram")->ptr()); - // save state save_item(NAME(m_pdrift_bank)); save_item(NAME(m_analog_data)); diff --git a/src/mame/includes/segaorun.h b/src/mame/includes/segaorun.h index ff574c2b333..603faccae0b 100644 --- a/src/mame/includes/segaorun.h +++ b/src/mame/includes/segaorun.h @@ -80,8 +80,8 @@ public: UINT32 screen_update_outrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_shangon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space,offset,data,mem_mask); }; - DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space,offset,data,mem_mask); }; + DECLARE_WRITE16_MEMBER( tileram_w ) { m_segaic16vid->tileram_w(space,offset,data,mem_mask); }; + DECLARE_WRITE16_MEMBER( textram_w ) { m_segaic16vid->textram_w(space,offset,data,mem_mask); }; DECLARE_READ16_MEMBER( sega_road_control_0_r ) { return m_segaic16road->segaic16_road_control_0_r(space,offset,mem_mask); }; DECLARE_WRITE16_MEMBER( sega_road_control_0_w ) { m_segaic16road->segaic16_road_control_0_w(space,offset,data,mem_mask); }; diff --git a/src/mame/includes/segas16b.h b/src/mame/includes/segas16b.h index 6ba37aba47c..c3df7a7fe44 100644 --- a/src/mame/includes/segas16b.h +++ b/src/mame/includes/segas16b.h @@ -114,8 +114,8 @@ public: // video updates UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space,offset,data,mem_mask); }; - DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space,offset,data,mem_mask); }; + DECLARE_WRITE16_MEMBER( tileram_w ) { m_segaic16vid->tileram_w(space,offset,data,mem_mask); }; + DECLARE_WRITE16_MEMBER( textram_w ) { m_segaic16vid->textram_w(space,offset,data,mem_mask); }; protected: // internal types diff --git a/src/mame/includes/segas18.h b/src/mame/includes/segas18.h index 84b2cf134d7..ea934e6adcf 100644 --- a/src/mame/includes/segas18.h +++ b/src/mame/includes/segas18.h @@ -91,8 +91,8 @@ public: DECLARE_READ16_MEMBER( genesis_vdp_r ) { return m_vdp->vdp_r(space, offset, mem_mask); } DECLARE_WRITE16_MEMBER( genesis_vdp_w ) { m_vdp->vdp_w(space, offset, data, mem_mask); } - DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space, offset, data, mem_mask); } - DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space, offset, data, mem_mask); } + DECLARE_WRITE16_MEMBER( tileram_w ) { m_segaic16vid->tileram_w(space, offset, data, mem_mask); } + DECLARE_WRITE16_MEMBER( textram_w ) { m_segaic16vid->textram_w(space, offset, data, mem_mask); } DECLARE_WRITE_LINE_MEMBER(set_grayscale); DECLARE_WRITE_LINE_MEMBER(set_vdp_enable); diff --git a/src/mame/video/segahang.c b/src/mame/video/segahang.c index f5728c9ce47..9c8f8def887 100644 --- a/src/mame/video/segahang.c +++ b/src/mame/video/segahang.c @@ -18,7 +18,7 @@ void segahang_state::video_start() { // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2); + m_segaic16vid->tilemap_init( 0, SEGAIC16_TILEMAP_HANGON, 0x000, 0, 2); // initialize the road m_segaic16road->segaic16_road_init(machine(), 0, m_sharrier_video ? SEGAIC16_ROAD_SHARRIER : SEGAIC16_ROAD_HANGON, 0x038, 0x7c0, 0x7c0, 0); @@ -32,7 +32,7 @@ void segahang_state::video_start() UINT32 segahang_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -48,12 +48,12 @@ UINT32 segahang_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); // draw background - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); // draw the high priority road m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); @@ -61,8 +61,8 @@ UINT32 segahang_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap // text layer // note that we inflate the priority of the text layer to prevent sprites // from drawing over the high scores - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x08); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x08); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); diff --git a/src/mame/video/segaic16.c b/src/mame/video/segaic16.c index 387c2ca8476..94d16641193 100644 --- a/src/mame/video/segaic16.c +++ b/src/mame/video/segaic16.c @@ -336,13 +336,13 @@ Quick review of the system16 hardware: and clipping capabilities, and advanced hot-spot positioning. The mixer chip adds totally dynamic priorities, alpha-blending of the tilemaps, per-component color control, and some other funnies we - have not been able to decypher. + have not been able to decipher. ST-V (also know as Titan or the Saturn console): The ultimate 2D system. Even more advanced tilemaps, with 6-dof roz support, alpha up to the wazoo and other niceties, known as - the vdp2. Ths sprite engine, vdp1, allows for any 4-point - streching of the sprites, actually giving polygonal 3D + the vdp2. The sprite engine, vdp1, allows for any 4-point + stretching of the sprites, actually giving polygonal 3D capabilities. Interestingly, the mixer capabilities took a hit, with no real per-sprite mixer priority, which could be considered annoying for a 2D system. It still allowed some beauties like @@ -374,8 +374,14 @@ const device_type SEGAIC16VID = &device_creator; segaic16_video_device::segaic16_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, SEGAIC16VID, "Sega 16-bit Video", tag, owner, clock, "segaic16_video", __FILE__), device_video_interface(mconfig, *this), + m_display_enable(0), + m_tileram(*this, ":tileram"), + m_textram(*this, ":textram"), + m_rotateram(*this, ":rotateram"), m_gfxdecode(*this) { + memset(m_rotate, 0, sizeof(m_rotate)); + memset(m_bg_tilemap, 0, sizeof(m_bg_tilemap)); } //------------------------------------------------- @@ -389,12 +395,9 @@ void segaic16_video_device::static_set_gfxdecode_tag(device_t &device, const cha } -void segaic16_video_device::device_config_complete() -{ -} - void segaic16_video_device::device_start() { + save_item(NAME(m_display_enable)); } void segaic16_video_device::device_reset() @@ -402,27 +405,19 @@ void segaic16_video_device::device_reset() } - - - - - - - - /************************************* * * Misc functions * *************************************/ -void segaic16_video_device::segaic16_set_display_enable(int enable) +void segaic16_video_device::set_display_enable(int enable) { enable = (enable != 0); - if (segaic16_display_enable != enable) + if (m_display_enable != enable) { m_screen->update_partial(m_screen->vpos()); - segaic16_display_enable = enable; + m_display_enable = enable; } } @@ -435,7 +430,7 @@ void segaic16_video_device::segaic16_set_display_enable(int enable) * *************************************/ -void segaic16_draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority) +void draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority) { int leftmin = -1, leftmax = -1, rightmin = -1, rightmax = -1; int topmin = -1, topmax = -1, bottommin = -1, bottommax = -1; @@ -637,7 +632,7 @@ void segaic16_draw_virtual_tilemap(screen_device &screen, struct tilemap_info *i * *******************************************************************************************/ -TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_tile_info ) +TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16a_tile_info ) { const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); UINT16 data = info->rambase[tile_index]; @@ -649,7 +644,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_tile_info ) } -TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_text_info ) +TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16a_text_info ) { const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); UINT16 data = info->rambase[tile_index]; @@ -661,7 +656,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_text_info ) } -void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) +void tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) { UINT16 *textram = info->textram; @@ -712,7 +707,7 @@ void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info /* draw the chunk */ effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; effyscroll = effyscroll & 0x1ff; - segaic16_draw_virtual_tilemap(screen, info, bitmap, rowcolclip, pages, effxscroll, effyscroll, flags, priority); + draw_virtual_tilemap(screen, info, bitmap, rowcolclip, pages, effxscroll, effyscroll, flags, priority); } } } @@ -741,7 +736,7 @@ void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info /* draw the chunk */ effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; effyscroll = effyscroll & 0x1ff; - segaic16_draw_virtual_tilemap(screen, info, bitmap, colclip, pages, effxscroll, effyscroll, flags, priority); + draw_virtual_tilemap(screen, info, bitmap, colclip, pages, effxscroll, effyscroll, flags, priority); } } else if (info->rowscroll) @@ -770,7 +765,7 @@ void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info /* draw the chunk */ effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; effyscroll = effyscroll & 0x1ff; - segaic16_draw_virtual_tilemap(screen, info, bitmap, rowclip, pages, effxscroll, effyscroll, flags, priority); + draw_virtual_tilemap(screen, info, bitmap, rowclip, pages, effxscroll, effyscroll, flags, priority); } } else @@ -780,7 +775,7 @@ void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info xscroll += 17; xscroll = (0xc8 - xscroll + info->xoffs) & 0x3ff; yscroll = yscroll & 0x1ff; - segaic16_draw_virtual_tilemap(screen, info, bitmap, cliprect, pages, xscroll, yscroll, flags, priority); + draw_virtual_tilemap(screen, info, bitmap, cliprect, pages, xscroll, yscroll, flags, priority); } } @@ -849,7 +844,7 @@ void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info * *******************************************************************************************/ -TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_tile_info ) +TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_tile_info ) { const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); UINT16 data = info->rambase[tile_index]; @@ -863,7 +858,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_tile_info ) } -TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_text_info ) +TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_text_info ) { const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); UINT16 data = info->rambase[tile_index]; @@ -876,7 +871,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_text_info ) } -TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_tile_info ) +TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_alt_tile_info ) { const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); UINT16 data = info->rambase[tile_index]; @@ -890,7 +885,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_tile_info } -TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_text_info ) +TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_alt_text_info ) { const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); UINT16 data = info->rambase[tile_index]; @@ -903,7 +898,7 @@ TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_text_info } -void segaic16_tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) +void tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) { UINT16 *textram = info->textram; UINT16 xscroll, yscroll, pages; @@ -955,7 +950,7 @@ void segaic16_tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info /* draw the chunk */ effxscroll = (0xc0 - effxscroll + info->xoffs) & 0x3ff; effyscroll = effyscroll & 0x1ff; - segaic16_draw_virtual_tilemap(screen, info, bitmap, rowcolclip, effpages, effxscroll, effyscroll, flags, priority); + draw_virtual_tilemap(screen, info, bitmap, rowcolclip, effpages, effxscroll, effyscroll, flags, priority); } } } @@ -991,15 +986,15 @@ void segaic16_tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info /* draw the chunk */ effxscroll = (0xc0 - effxscroll + info->xoffs) & 0x3ff; effyscroll = effyscroll & 0x1ff; - segaic16_draw_virtual_tilemap(screen, info, bitmap, rowclip, effpages, effxscroll, effyscroll, flags, priority); + draw_virtual_tilemap(screen, info, bitmap, rowclip, effpages, effxscroll, effyscroll, flags, priority); } } } -TIMER_CALLBACK_MEMBER( segaic16_video_device::segaic16_tilemap_16b_latch_values ) +TIMER_CALLBACK_MEMBER( segaic16_video_device::tilemap_16b_latch_values ) { - struct tilemap_info *info = &bg_tilemap[param]; + struct tilemap_info *info = &m_bg_tilemap[param]; UINT16 *textram = info->textram; int i; @@ -1016,7 +1011,7 @@ TIMER_CALLBACK_MEMBER( segaic16_video_device::segaic16_tilemap_16b_latch_values } -void segaic16_tilemap_16b_reset(screen_device &screen, struct tilemap_info *info) +void tilemap_16b_reset(screen_device &screen, struct tilemap_info *info) { /* set a timer to latch values on scanline 261 */ info->latch_timer->adjust(screen.time_until_pos(261), info->index); @@ -1030,9 +1025,9 @@ void segaic16_tilemap_16b_reset(screen_device &screen, struct tilemap_info *info * *************************************/ -void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks) +void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks) { - struct tilemap_info *info = &bg_tilemap[which]; + struct tilemap_info *info = &m_bg_tilemap[which]; tilemap_get_info_delegate get_text_info; tilemap_get_info_delegate get_tile_info; int pagenum; @@ -1051,59 +1046,59 @@ void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int switch (which) { case 0: - info->textram = segaic16_textram_0; - info->tileram = segaic16_tileram_0; + info->textram = m_textram; + info->tileram = m_tileram; break; default: - fatalerror("Invalid tilemap index specified in segaic16_tilemap_init\n"); + fatalerror("Invalid tilemap index specified in tilemap_init\n"); } /* determine the parameters of the tilemaps */ switch (type) { case SEGAIC16_TILEMAP_HANGON: - get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_text_info),this); - get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_tile_info),this); + get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_text_info),this); + get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_tile_info),this); info->numpages = 4; - info->draw_layer = segaic16_tilemap_16a_draw_layer; + info->draw_layer = tilemap_16a_draw_layer; info->reset = NULL; info->latch_timer = NULL; break; case SEGAIC16_TILEMAP_16A: - get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_text_info),this); - get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_tile_info),this); + get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_text_info),this); + get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_tile_info),this); info->numpages = 8; - info->draw_layer = segaic16_tilemap_16a_draw_layer; + info->draw_layer = tilemap_16a_draw_layer; info->reset = NULL; info->latch_timer = NULL; break; case SEGAIC16_TILEMAP_16B: - get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_text_info),this); - get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_tile_info),this); + get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_text_info),this); + get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_tile_info),this); info->numpages = 16; - info->draw_layer = segaic16_tilemap_16b_draw_layer; - info->reset = segaic16_tilemap_16b_reset; - info->latch_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_latch_values),this) ); + info->draw_layer = tilemap_16b_draw_layer; + info->reset = tilemap_16b_reset; + info->latch_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::tilemap_16b_latch_values),this) ); break; case SEGAIC16_TILEMAP_16B_ALT: - get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_alt_text_info),this); - get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_alt_tile_info),this); + get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_alt_text_info),this); + get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_alt_tile_info),this); info->numpages = 16; - info->draw_layer = segaic16_tilemap_16b_draw_layer; - info->reset = segaic16_tilemap_16b_reset; - info->latch_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_latch_values),this) ); + info->draw_layer = tilemap_16b_draw_layer; + info->reset = tilemap_16b_reset; + info->latch_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::tilemap_16b_latch_values),this) ); break; default: - fatalerror("Invalid tilemap type specified in segaic16_tilemap_init\n"); + fatalerror("Invalid tilemap type specified in tilemap_init\n"); } /* create the tilemap for the text layer */ - info->textmap = &machine.tilemap().create(m_gfxdecode, get_text_info, TILEMAP_SCAN_ROWS, 8,8, 64,28); + info->textmap = &machine().tilemap().create(m_gfxdecode, get_text_info, TILEMAP_SCAN_ROWS, 8,8, 64,28); /* configure it */ info->textmap_info.rambase = info->textram; @@ -1119,7 +1114,7 @@ void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int for (pagenum = 0; pagenum < info->numpages; pagenum++) { /* each page is 64x32 */ - info->tilemaps[pagenum] = &machine.tilemap().create(m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); + info->tilemaps[pagenum] = &machine().tilemap().create(m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); /* configure the tilemap */ info->tmap_info[pagenum].rambase = info->tileram + pagenum * 64*32; @@ -1131,6 +1126,14 @@ void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int info->tilemaps[pagenum]->set_scrolldx(0, 22); info->tilemaps[pagenum]->set_scrolldy(0, 38); } + + save_item(NAME(info->flip), which); + save_item(NAME(info->rowscroll), which); + save_item(NAME(info->colscroll), which); + save_item(NAME(info->bank), which); + save_item(NAME(info->latched_xscroll), which); + save_item(NAME(info->latched_yscroll), which); + save_item(NAME(info->latched_pageselect), which); } @@ -1141,9 +1144,9 @@ void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int * *************************************/ -void segaic16_video_device::segaic16_tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark) +void segaic16_video_device::tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark) { - struct tilemap_info *info = &bg_tilemap[which]; + struct tilemap_info *info = &m_bg_tilemap[which]; /* text layer is a special common case */ if (map == SEGAIC16_TILEMAP_TEXT) @@ -1162,9 +1165,9 @@ void segaic16_video_device::segaic16_tilemap_draw(screen_device &screen, bitmap_ * *************************************/ -void segaic16_video_device::segaic16_tilemap_reset(screen_device &screen) +void segaic16_video_device::tilemap_reset(screen_device &screen) { - struct tilemap_info *info = &bg_tilemap[0]; + struct tilemap_info *info = &m_bg_tilemap[0]; if (info->reset) (*info->reset)(screen, info); @@ -1178,9 +1181,9 @@ void segaic16_video_device::segaic16_tilemap_reset(screen_device &screen) * *************************************/ -void segaic16_video_device::segaic16_tilemap_set_bank(int which, int banknum, int offset) +void segaic16_video_device::tilemap_set_bank(int which, int banknum, int offset) { - struct tilemap_info *info = &bg_tilemap[which]; + struct tilemap_info *info = &m_bg_tilemap[which]; if (info->bank[banknum] != offset) { @@ -1198,9 +1201,9 @@ void segaic16_video_device::segaic16_tilemap_set_bank(int which, int banknum, in * *************************************/ -void segaic16_video_device::segaic16_tilemap_set_flip(int which, int flip) +void segaic16_video_device::tilemap_set_flip(int which, int flip) { - struct tilemap_info *info = &bg_tilemap[which]; + struct tilemap_info *info = &m_bg_tilemap[which]; int pagenum; flip = (flip != 0); @@ -1222,9 +1225,9 @@ void segaic16_video_device::segaic16_tilemap_set_flip(int which, int flip) * *************************************/ -void segaic16_video_device::segaic16_tilemap_set_rowscroll(int which, int enable) +void segaic16_video_device::tilemap_set_rowscroll(int which, int enable) { - struct tilemap_info *info = &bg_tilemap[which]; + struct tilemap_info *info = &m_bg_tilemap[which]; enable = (enable != 0); if (info->rowscroll != enable) @@ -1242,9 +1245,9 @@ void segaic16_video_device::segaic16_tilemap_set_rowscroll(int which, int enable * *************************************/ -void segaic16_video_device::segaic16_tilemap_set_colscroll(int which, int enable) +void segaic16_video_device::tilemap_set_colscroll(int which, int enable) { - struct tilemap_info *info = &bg_tilemap[which]; + struct tilemap_info *info = &m_bg_tilemap[which]; enable = (enable != 0); if (info->colscroll != enable) @@ -1262,33 +1265,33 @@ void segaic16_video_device::segaic16_tilemap_set_colscroll(int which, int enable * *************************************/ -READ16_MEMBER( segaic16_video_device::segaic16_tileram_0_r ) +READ16_MEMBER( segaic16_video_device::tileram_r ) { - return segaic16_tileram_0[offset]; + return m_tileram[offset]; } -WRITE16_MEMBER( segaic16_video_device::segaic16_tileram_0_w ) +WRITE16_MEMBER( segaic16_video_device::tileram_w ) { - COMBINE_DATA(&segaic16_tileram_0[offset]); - bg_tilemap[0].tilemaps[offset / (64*32)]->mark_tile_dirty(offset % (64*32)); + COMBINE_DATA(&m_tileram[offset]); + m_bg_tilemap[0].tilemaps[offset / (64*32)]->mark_tile_dirty(offset % (64*32)); } -READ16_MEMBER( segaic16_video_device::segaic16_textram_0_r ) +READ16_MEMBER( segaic16_video_device::textram_r ) { - return segaic16_textram_0[offset]; + return m_textram[offset]; } -WRITE16_MEMBER( segaic16_video_device::segaic16_textram_0_w ) +WRITE16_MEMBER( segaic16_video_device::textram_w ) { /* certain ranges need immediate updates */ if (offset >= 0xe80/2) m_screen->update_partial(m_screen->vpos()); - COMBINE_DATA(&segaic16_textram_0[offset]); - bg_tilemap[0].textmap->mark_tile_dirty(offset); + COMBINE_DATA(&m_textram[offset]); + m_bg_tilemap[0].textmap->mark_tile_dirty(offset); } @@ -1303,9 +1306,9 @@ WRITE16_MEMBER( segaic16_video_device::segaic16_textram_0_w ) * *************************************/ -void segaic16_video_device::segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase) +void segaic16_video_device::rotate_init(int which, int type, int colorbase) { - struct rotate_info *info = &segaic16_rotate[which]; + struct rotate_info *info = &m_rotate[which]; /* reset the tilemap info */ memset(info, 0, sizeof(*info)); @@ -1317,11 +1320,11 @@ void segaic16_video_device::segaic16_rotate_init(running_machine &machine, int w switch (which) { case 0: - info->rotateram = segaic16_rotateram_0; + info->rotateram = m_rotateram; break; default: - fatalerror("Invalid rotate index specified in segaic16_rotate_init\n"); + fatalerror("Invalid rotate index specified in rotate_init\n"); } /* determine the parameters of the rotate */ @@ -1332,14 +1335,14 @@ void segaic16_video_device::segaic16_rotate_init(running_machine &machine, int w break; default: - fatalerror("Invalid rotate system specified in segaic16_rotate_init\n"); + fatalerror("Invalid rotate system specified in rotate_init\n"); } /* allocate a buffer for swapping */ - info->buffer = auto_alloc_array(machine, UINT16, info->ramsize/2); + info->buffer = auto_alloc_array(machine(), UINT16, info->ramsize/2); - state_save_register_item(machine, "segaic16_rot", NULL, which, info->colorbase); - state_save_register_item_pointer(machine, "segaic16_rot", NULL, which, ((UINT8 *) info->buffer), info->ramsize); + save_item(NAME(info->colorbase), which); + save_pointer(NAME((UINT8 *) info->buffer), info->ramsize, which); } @@ -1350,9 +1353,9 @@ void segaic16_video_device::segaic16_rotate_init(running_machine &machine, int w * *************************************/ -void segaic16_video_device::segaic16_rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap) +void segaic16_video_device::rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap) { - struct rotate_info *info = &segaic16_rotate[which]; + struct rotate_info *info = &m_rotate[which]; INT32 currx = (info->buffer[0x3f0] << 16) | info->buffer[0x3f1]; INT32 curry = (info->buffer[0x3f2] << 16) | info->buffer[0x3f3]; INT32 dyy = (info->buffer[0x3f4] << 16) | info->buffer[0x3f5]; @@ -1413,9 +1416,9 @@ void segaic16_video_device::segaic16_rotate_draw(int which, bitmap_ind16 &bitmap * *************************************/ -READ16_MEMBER( segaic16_video_device::segaic16_rotate_control_0_r ) +READ16_MEMBER( segaic16_video_device::rotate_control_r ) { - struct rotate_info *info = &segaic16_rotate[0]; + struct rotate_info *info = &m_rotate[0]; if (info->buffer) { diff --git a/src/mame/video/segaic16.h b/src/mame/video/segaic16.h index df99e73a048..a21741ca3f0 100644 --- a/src/mame/video/segaic16.h +++ b/src/mame/video/segaic16.h @@ -99,51 +99,50 @@ public: // static configuration static void static_set_gfxdecode_tag(device_t &device, const char *tag); - UINT8 segaic16_display_enable; - UINT16 *segaic16_tileram_0; - UINT16 *segaic16_textram_0; - UINT16 *segaic16_rotateram_0; + UINT8 m_display_enable; + optional_shared_ptr m_tileram; + optional_shared_ptr m_textram; + optional_shared_ptr m_rotateram; - void segaic16_tilemap_set_colscroll(int which, int enable); - void segaic16_tilemap_set_rowscroll(int which, int enable); - void segaic16_tilemap_set_flip(int which, int flip); - void segaic16_tilemap_set_bank(int which, int banknum, int offset); - void segaic16_tilemap_reset(screen_device &screen); - void segaic16_tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark); -// void segaic16_tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); -// void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); -// void segaic16_draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority); -// void segaic16_tilemap_16b_reset(screen_device &screen, struct tilemap_info *info); + void tilemap_set_colscroll(int which, int enable); + void tilemap_set_rowscroll(int which, int enable); + void tilemap_set_flip(int which, int flip); + void tilemap_set_bank(int which, int banknum, int offset); + void tilemap_reset(screen_device &screen); + void tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark); +// void tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); +// void tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); +// void draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority); +// void tilemap_16b_reset(screen_device &screen, struct tilemap_info *info); - TIMER_CALLBACK_MEMBER( segaic16_tilemap_16b_latch_values ); + TIMER_CALLBACK_MEMBER( tilemap_16b_latch_values ); - struct rotate_info segaic16_rotate[SEGAIC16_MAX_ROTATE]; - struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS]; + struct rotate_info m_rotate[SEGAIC16_MAX_ROTATE]; + struct tilemap_info m_bg_tilemap[SEGAIC16_MAX_TILEMAPS]; - void segaic16_set_display_enable(int enable); - void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks); - void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase); + void set_display_enable(int enable); + void tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks); + void rotate_init(int which, int type, int colorbase); - DECLARE_READ16_MEMBER( segaic16_tileram_0_r ); - DECLARE_READ16_MEMBER( segaic16_textram_0_r ); - DECLARE_WRITE16_MEMBER( segaic16_tileram_0_w ); - DECLARE_WRITE16_MEMBER( segaic16_textram_0_w ); + DECLARE_READ16_MEMBER( tileram_r ); + DECLARE_READ16_MEMBER( textram_r ); + DECLARE_WRITE16_MEMBER( tileram_w ); + DECLARE_WRITE16_MEMBER( textram_w ); - void segaic16_rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap); + void rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap); - DECLARE_READ16_MEMBER( segaic16_rotate_control_0_r ); + DECLARE_READ16_MEMBER( rotate_control_r ); - TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_tile_info ); - TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_text_info ); - TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_alt_tile_info ); - TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_alt_text_info ); + TILE_GET_INFO_MEMBER( tilemap_16b_tile_info ); + TILE_GET_INFO_MEMBER( tilemap_16b_text_info ); + TILE_GET_INFO_MEMBER( tilemap_16b_alt_tile_info ); + TILE_GET_INFO_MEMBER( tilemap_16b_alt_text_info ); - TILE_GET_INFO_MEMBER( segaic16_tilemap_16a_tile_info ); - TILE_GET_INFO_MEMBER( segaic16_tilemap_16a_text_info ); + TILE_GET_INFO_MEMBER( tilemap_16a_tile_info ); + TILE_GET_INFO_MEMBER( tilemap_16a_text_info ); protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); diff --git a/src/mame/video/segaorun.c b/src/mame/video/segaorun.c index 2faea0f5293..79f72426cb5 100644 --- a/src/mame/video/segaorun.c +++ b/src/mame/video/segaorun.c @@ -20,7 +20,7 @@ void segaorun_state::video_start() if (m_shangon_video) { // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); + m_segaic16vid->tilemap_init(0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); // initialize the road m_segaic16road->segaic16_road_init(machine(), 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0); @@ -28,7 +28,7 @@ void segaorun_state::video_start() else { // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); + m_segaic16vid->tilemap_init(0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); // initialize the road m_segaic16road->segaic16_road_init(machine(), 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0); @@ -53,12 +53,12 @@ UINT32 segaorun_state::screen_update_shangon(screen_device &screen, bitmap_ind16 m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); // draw background - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); // draw the high priority road m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); @@ -66,8 +66,8 @@ UINT32 segaorun_state::screen_update_shangon(screen_device &screen, bitmap_ind16 // text layer // note that we inflate the priority of the text layer to prevent sprites // from drawing over the high scores - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x08); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x08); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); @@ -106,7 +106,7 @@ UINT32 segaorun_state::screen_update_shangon(screen_device &screen, bitmap_ind16 UINT32 segaorun_state::screen_update_outrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -122,19 +122,19 @@ UINT32 segaorun_state::screen_update_outrun(screen_device &screen, bitmap_ind16 m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); // draw background - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); // draw the high priority road m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); // text layer - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); + m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); diff --git a/src/mame/video/segas16a.c b/src/mame/video/segas16a.c index 755b69af3bf..adf2e089e76 100644 --- a/src/mame/video/segas16a.c +++ b/src/mame/video/segas16a.c @@ -18,7 +18,7 @@ void segas16a_state::video_start() { // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1); + m_segaic16vid->tilemap_init( 0, SEGAIC16_TILEMAP_16A, 0x000, 0, 1); } @@ -29,7 +29,7 @@ void segas16a_state::video_start() UINT32 segas16a_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -42,21 +42,21 @@ UINT32 segas16a_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap screen.priority().fill(0, cliprect); // draw background opaquely first, not setting any priorities - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); // draw background again, just to set the priorities on non-transparent pixels bitmap_ind16 dummy_bitmap; - m_segaic16vid->segaic16_tilemap_draw(screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw( screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw( screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); // text layer - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); diff --git a/src/mame/video/segas16b.c b/src/mame/video/segas16b.c index e336f0df694..f6010f0b8b7 100644 --- a/src/mame/video/segas16b.c +++ b/src/mame/video/segas16b.c @@ -18,7 +18,7 @@ void segas16b_state::video_start() { // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, m_tilemap_type, 0x000, 0, 2); + m_segaic16vid->tilemap_init( 0, m_tilemap_type, 0x000, 0, 2); } @@ -29,7 +29,7 @@ void segas16b_state::video_start() UINT32 segas16b_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -42,21 +42,21 @@ UINT32 segas16b_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap screen.priority().fill(0, cliprect); // draw background opaquely first, not setting any priorities - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); // draw background again, just to set the priorities on non-transparent pixels bitmap_ind16 dummy_bitmap; - m_segaic16vid->segaic16_tilemap_draw(screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw( screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw( screen, dummy_bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); // text layer - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index 92b0f1daca8..15953461c61 100644 --- a/src/mame/video/segas18.c +++ b/src/mame/video/segas18.c @@ -34,7 +34,7 @@ void segas18_state::video_start() m_vdp_mixing = 0; // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); + m_segaic16vid->tilemap_init( 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); save_item(NAME(m_grayscale_enable)); save_item(NAME(m_vdp_enable)); @@ -187,7 +187,7 @@ UINT32 segas18_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, #endif // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -200,23 +200,23 @@ UINT32 segas18_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, screen.priority().fill(0, cliprect); // draw background opaquely first, not setting any priorities - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); if (m_vdp_enable && vdplayer == 0) draw_vdp(screen, bitmap, cliprect, vdppri); // draw background again to draw non-transparent pixels over the VDP and set the priority - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); if (m_vdp_enable && vdplayer == 1) draw_vdp(screen, bitmap, cliprect, vdppri); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); if (m_vdp_enable && vdplayer == 2) draw_vdp(screen, bitmap, cliprect, vdppri); // text layer - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); if (m_vdp_enable && vdplayer == 3) draw_vdp(screen, bitmap, cliprect, vdppri); // mix in sprites diff --git a/src/mame/video/segaxbd.c b/src/mame/video/segaxbd.c index ba9aead0c78..f529efc0781 100644 --- a/src/mame/video/segaxbd.c +++ b/src/mame/video/segaxbd.c @@ -17,7 +17,7 @@ void segaxbd_state::video_start() { // initialize the tile/text layers - m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2); + m_segaic16vid->tilemap_init( 0, SEGAIC16_TILEMAP_16B, 0x1c00, 0, 2); // initialize the road m_segaic16road->segaic16_road_init(machine(), 0, SEGAIC16_ROAD_XBOARD, 0x1700, 0x1720, 0x1780, -166); @@ -32,7 +32,7 @@ void segaxbd_state::video_start() UINT32 segaxbd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -50,20 +50,20 @@ UINT32 segaxbd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); // draw background - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); // draw foreground - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); // draw the high priority road if (m_road_priority == 1) m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); // text layer - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); - m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); + m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c index cf3eeeeb020..e26390982d4 100644 --- a/src/mame/video/segaybd.c +++ b/src/mame/video/segaybd.c @@ -17,8 +17,8 @@ void segaybd_state::video_start() { // initialize the rotation layer - m_segaic16vid->segaic16_rotate_init(machine(), 0, SEGAIC16_ROTATE_YBOARD, 0x000); - m_ysprites->set_rotate_ptr(m_segaic16vid->segaic16_rotate); + m_segaic16vid->rotate_init(0, SEGAIC16_ROTATE_YBOARD, 0x000); + m_ysprites->set_rotate_ptr(m_segaic16vid->m_rotate); } @@ -30,7 +30,7 @@ void segaybd_state::video_start() UINT32 segaybd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // if no drawing is happening, fill with black and get out - if (!m_segaic16vid->segaic16_display_enable) + if (!m_segaic16vid->m_display_enable) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; @@ -43,7 +43,7 @@ UINT32 segaybd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, m_bsprites->draw_async(cliprect); // apply rotation - m_segaic16vid->segaic16_rotate_draw(0, bitmap, cliprect, screen.priority(), m_ysprites->bitmap()); + m_segaic16vid->rotate_draw(0, bitmap, cliprect, screen.priority(), m_ysprites->bitmap()); // mix in 16B sprites bitmap_ind16 &sprites = m_bsprites->bitmap();