From fecd8ad9e2c17ec74c8737d819dc24cc05dd1baa Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 24 Nov 2018 17:15:01 +0900 Subject: [PATCH] segas32.cpp : Cleanup duplicates, ACCESSING_BITs, naming (#3823) --- src/mame/drivers/segas32.cpp | 165 +++++++++++--- src/mame/includes/segas32.h | 35 +-- src/mame/video/segas32.cpp | 416 +++++++++-------------------------- 3 files changed, 245 insertions(+), 371 deletions(-) diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp index d7caf8d6252..52e3c3d2630 100644 --- a/src/mame/drivers/segas32.cpp +++ b/src/mame/drivers/segas32.cpp @@ -566,9 +566,9 @@ segas32_state::segas32_state(const machine_config &mconfig, device_type type, co : device_t(mconfig, type, tag, owner, clock) , m_z80_shared_ram(*this,"z80_shared_ram") , m_system32_workram(*this,"workram") - , m_system32_videoram(*this,"videoram", 0) - , m_system32_spriteram(*this,"spriteram", 0) - , m_system32_paletteram(*this,"paletteram.%u", 0, uint8_t(0)) + , m_videoram(*this,"videoram", 0) + , m_spriteram(*this,"spriteram", 0) + , m_paletteram(*this,"paletteram.%u", 0, uint8_t(0)) , m_maincpu(*this, "maincpu") , m_soundcpu(*this, "soundcpu") , m_multipcm(*this, "sega") @@ -868,20 +868,13 @@ WRITE8_MEMBER(segas32_state::tilebank_external_w) m_system32_tilebank_external = data; } - -WRITE_LINE_MEMBER(segas32_state::display_enable_0_w) +template +WRITE_LINE_MEMBER(segas32_state::display_enable_w) { - m_system32_displayenable[0] = state; + m_system32_displayenable[Which] = state; } -WRITE_LINE_MEMBER(segas32_state::display_enable_1_w) -{ - m_system32_displayenable[1] = state; -} - - - /************************************* * * Random number generator @@ -899,7 +892,6 @@ READ16_MEMBER(segas32_state::random_number_r) } - /************************************* * * Sound communications @@ -918,7 +910,6 @@ WRITE8_MEMBER(segas32_state::shared_ram_w) } - /************************************* * * Sound interrupt controller @@ -995,7 +986,6 @@ WRITE_LINE_MEMBER(segas32_state::ym3438_irq_handler) } - /************************************* * * Sound banking @@ -1030,7 +1020,6 @@ WRITE8_MEMBER(segas32_state::scross_bank_w) } - /************************************* * * Sound hack (not protection) @@ -1049,6 +1038,122 @@ WRITE8_MEMBER(segas32_state::sound_dummy_w) } +/************************************* + * + * Common palette handling + * + *************************************/ + +inline uint16_t segas32_state::xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(uint16_t value) +{ + int r = (value >> 0) & 0x1f; + int g = (value >> 5) & 0x1f; + int b = (value >> 10) & 0x1f; + value = (value & 0x8000) | ((b & 0x01) << 14) | ((g & 0x01) << 13) | ((r & 0x01) << 12); + value |= ((b & 0x1e) << 7) | ((g & 0x1e) << 3) | ((r & 0x1e) >> 1); + return value; +} + + +inline uint16_t segas32_state::xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(uint16_t value) +{ + int r = ((value >> 12) & 0x01) | ((value << 1) & 0x1e); + int g = ((value >> 13) & 0x01) | ((value >> 3) & 0x1e); + int b = ((value >> 14) & 0x01) | ((value >> 7) & 0x1e); + return (value & 0x8000) | (b << 10) | (g << 5) | (r << 0); +} + + +inline void segas32_state::update_color(int offset, uint16_t data) +{ + /* note that since we use this RAM directly, we don't technically need */ + /* to call palette_set_color() at all; however, it does give us that */ + /* nice display when you hit F4, which is useful for debugging */ + + /* set the color */ + m_palette->set_pen_color(offset, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); +} + + +/************************************* + * + * Palette RAM access + * + *************************************/ + +template +READ16_MEMBER(segas32_state::paletteram_r) +{ + int convert; + + /* the lower half of palette RAM is formatted xBBBBBGGGGGRRRRR */ + /* the upper half of palette RAM is formatted xBGRBBBBGGGGRRRR */ + /* we store everything if the first format, and convert accesses to the other format */ + /* on the fly */ + convert = (offset & 0x4000); + offset &= 0x3fff; + + if (!convert) + return m_paletteram[Which][offset]; + else + return xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(m_paletteram[Which][offset]); +} + +template +WRITE16_MEMBER(segas32_state::paletteram_w) +{ + uint16_t value; + int convert; + + /* the lower half of palette RAM is formatted xBBBBBGGGGGRRRRR */ + /* the upper half of palette RAM is formatted xBGRBBBBGGGGRRRR */ + /* we store everything if the first format, and convert accesses to the other format */ + /* on the fly */ + convert = (offset & 0x4000); + offset &= 0x3fff; + + /* read, modify, and write the new value, updating the palette */ + value = m_paletteram[Which][offset]; + if (convert) value = xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(value); + COMBINE_DATA(&value); + if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); + m_paletteram[Which][offset] = value; + update_color(0x4000*Which + offset, value); + + /* if blending is enabled, writes go to both halves of palette RAM */ + if (m_mixer_control[Which][0x4e/2] & 0x0880) + { + offset ^= 0x2000; + + /* read, modify, and write the new value, updating the palette */ + value = m_paletteram[Which][offset]; + if (convert) value = xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(value); + COMBINE_DATA(&value); + if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); + m_paletteram[Which][offset] = value; + update_color(0x4000*Which + offset, value); + } +} + + +/************************************* + * + * Mixer control registers + * + *************************************/ + +template +READ16_MEMBER(segas32_state::mixer_r) +{ + return m_mixer_control[Which][offset]; +} + +template +WRITE16_MEMBER(segas32_state::mixer_w) +{ + COMBINE_DATA(&m_mixer_control[Which][offset]); +} + /************************************* * @@ -1061,11 +1166,11 @@ void segas32_state::system32_map(address_map &map) map.unmap_value_high(); map(0x000000, 0x1fffff).rom(); map(0x200000, 0x20ffff).mirror(0x0f0000).ram().share("workram"); - map(0x300000, 0x31ffff).mirror(0x0e0000).rw(FUNC(segas32_state::system32_videoram_r), FUNC(segas32_state::system32_videoram_w)).share("videoram"); - map(0x400000, 0x41ffff).mirror(0x0e0000).rw(FUNC(segas32_state::system32_spriteram_r), FUNC(segas32_state::system32_spriteram_w)).share("spriteram"); + map(0x300000, 0x31ffff).mirror(0x0e0000).rw(FUNC(segas32_state::videoram_r), FUNC(segas32_state::videoram_w)).share("videoram"); + map(0x400000, 0x41ffff).mirror(0x0e0000).rw(FUNC(segas32_state::spriteram_r), FUNC(segas32_state::spriteram_w)).share("spriteram"); map(0x500000, 0x50000f).mirror(0x0ffff0).rw(FUNC(segas32_state::sprite_control_r), FUNC(segas32_state::sprite_control_w)).umask16(0x00ff); - map(0x600000, 0x60ffff).mirror(0x0e0000).rw(FUNC(segas32_state::system32_paletteram_r), FUNC(segas32_state::system32_paletteram_w)).share("paletteram.0"); - map(0x610000, 0x61007f).mirror(0x0eff80).rw(FUNC(segas32_state::system32_mixer_r), FUNC(segas32_state::system32_mixer_w)); + map(0x600000, 0x60ffff).mirror(0x0e0000).rw(FUNC(segas32_state::paletteram_r<0>), FUNC(segas32_state::paletteram_w<0>)).share("paletteram.0"); + map(0x610000, 0x61007f).mirror(0x0eff80).rw(FUNC(segas32_state::mixer_r<0>), FUNC(segas32_state::mixer_w<0>)); map(0x700000, 0x701fff).mirror(0x0fe000).rw(FUNC(segas32_state::shared_ram_r), FUNC(segas32_state::shared_ram_w)); map(0x800000, 0x800fff).rw("s32comm", FUNC(s32comm_device::share_r), FUNC(s32comm_device::share_w)).umask16(0x00ff); map(0x801000, 0x801000).rw("s32comm", FUNC(s32comm_device::cn_r), FUNC(s32comm_device::cn_w)); @@ -1084,13 +1189,13 @@ void segas32_state::multi32_map(address_map &map) map.global_mask(0xffffff); map(0x000000, 0x1fffff).rom(); map(0x200000, 0x21ffff).mirror(0x0e0000).ram(); - map(0x300000, 0x31ffff).mirror(0x0e0000).rw(FUNC(segas32_state::system32_videoram_r), FUNC(segas32_state::system32_videoram_w)).share("videoram"); - map(0x400000, 0x41ffff).mirror(0x0e0000).rw(FUNC(segas32_state::multi32_spriteram_r), FUNC(segas32_state::multi32_spriteram_w)).share("spriteram"); + map(0x300000, 0x31ffff).mirror(0x0e0000).rw(FUNC(segas32_state::videoram_r), FUNC(segas32_state::videoram_w)).share("videoram"); + map(0x400000, 0x41ffff).mirror(0x0e0000).rw(FUNC(segas32_state::spriteram_r), FUNC(segas32_state::spriteram_w)).share("spriteram"); map(0x500000, 0x50000f).mirror(0x0ffff0).rw(FUNC(segas32_state::sprite_control_r), FUNC(segas32_state::sprite_control_w)).umask32(0x00ff00ff); - map(0x600000, 0x60ffff).mirror(0x060000).rw(FUNC(segas32_state::multi32_paletteram_0_r), FUNC(segas32_state::multi32_paletteram_0_w)).share("paletteram.0"); - map(0x610000, 0x61007f).mirror(0x06ff80).w(FUNC(segas32_state::multi32_mixer_0_w)); - map(0x680000, 0x68ffff).mirror(0x060000).rw(FUNC(segas32_state::multi32_paletteram_1_r), FUNC(segas32_state::multi32_paletteram_1_w)).share("paletteram.1"); - map(0x690000, 0x69007f).mirror(0x06ff80).w(FUNC(segas32_state::multi32_mixer_1_w)); + map(0x600000, 0x60ffff).mirror(0x060000).rw(FUNC(segas32_state::paletteram_r<0>), FUNC(segas32_state::paletteram_w<0>)).share("paletteram.0"); + map(0x610000, 0x61007f).mirror(0x06ff80).w(FUNC(segas32_state::mixer_w<0>)); + map(0x680000, 0x68ffff).mirror(0x060000).rw(FUNC(segas32_state::paletteram_r<1>), FUNC(segas32_state::paletteram_w<1>)).share("paletteram.1"); + map(0x690000, 0x69007f).mirror(0x06ff80).w(FUNC(segas32_state::mixer_w<1>)); map(0x700000, 0x701fff).mirror(0x0fe000).rw(FUNC(segas32_state::shared_ram_r), FUNC(segas32_state::shared_ram_w)); map(0x800000, 0x800fff).rw("s32comm", FUNC(s32comm_device::share_r), FUNC(s32comm_device::share_w)).umask32(0x00ff00ff); map(0x801000, 0x801000).rw("s32comm", FUNC(s32comm_device::cn_r), FUNC(s32comm_device::cn_w)); @@ -2224,7 +2329,7 @@ MACHINE_CONFIG_START(segas32_state::device_add_mconfig) io_chip.in_pf_callback().set_ioport("SERVICE34_A"); io_chip.out_pg_callback().set(FUNC(segas32_state::sw2_output_0_w)); io_chip.out_ph_callback().set(FUNC(segas32_state::tilebank_external_w)); - io_chip.out_cnt1_callback().set(FUNC(segas32_state::display_enable_0_w)); + io_chip.out_cnt1_callback().set(FUNC(segas32_state::display_enable_w<0>)); io_chip.out_cnt2_callback().set_inputline(m_soundcpu, INPUT_LINE_RESET).invert(); EEPROM_93C46_16BIT(config, "eeprom"); @@ -2534,7 +2639,7 @@ MACHINE_CONFIG_START(sega_multi32_state::device_add_mconfig) io_chip_0.in_pf_callback().set_ioport("SERVICE34_A"); io_chip_0.out_pg_callback().set(FUNC(segas32_state::sw2_output_0_w)); io_chip_0.out_ph_callback().set(FUNC(segas32_state::tilebank_external_w)); - io_chip_0.out_cnt1_callback().set(FUNC(segas32_state::display_enable_0_w)); + io_chip_0.out_cnt1_callback().set(FUNC(segas32_state::display_enable_w<0>)); io_chip_0.out_cnt2_callback().set_inputline(m_soundcpu, INPUT_LINE_RESET).invert(); sega_315_5296_device &io_chip_1(SEGA_315_5296(config, "io_chip_1", 0)); // unknown clock @@ -2548,7 +2653,7 @@ MACHINE_CONFIG_START(sega_multi32_state::device_add_mconfig) io_chip_1.out_ph_callback().set("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(7); io_chip_1.out_ph_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(5); io_chip_1.out_ph_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(6); - io_chip_1.out_cnt1_callback().set(FUNC(segas32_state::display_enable_1_w)); + io_chip_1.out_cnt1_callback().set(FUNC(segas32_state::display_enable_w<1>)); EEPROM_93C46_16BIT(config, "eeprom"); diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index b16854d4855..3381a55ef55 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -62,8 +62,7 @@ public: DECLARE_WRITE8_MEMBER(misc_output_1_w); DECLARE_WRITE8_MEMBER(sw2_output_0_w); DECLARE_WRITE8_MEMBER(sw2_output_1_w); - DECLARE_WRITE_LINE_MEMBER(display_enable_0_w); - DECLARE_WRITE_LINE_MEMBER(display_enable_1_w); + template DECLARE_WRITE_LINE_MEMBER(display_enable_w); DECLARE_WRITE8_MEMBER(tilebank_external_w); protected: @@ -102,24 +101,16 @@ protected: DECLARE_WRITE16_MEMBER(jleague_protection_w); DECLARE_READ16_MEMBER(arescue_dsp_r); DECLARE_WRITE16_MEMBER(arescue_dsp_w); - DECLARE_READ16_MEMBER(system32_paletteram_r); - DECLARE_WRITE16_MEMBER(system32_paletteram_w); - DECLARE_READ32_MEMBER(multi32_paletteram_0_r); - DECLARE_WRITE32_MEMBER(multi32_paletteram_0_w); - DECLARE_READ32_MEMBER(multi32_paletteram_1_r); - DECLARE_WRITE32_MEMBER(multi32_paletteram_1_w); - DECLARE_READ16_MEMBER(system32_videoram_r); - DECLARE_WRITE16_MEMBER(system32_videoram_w); + template DECLARE_READ16_MEMBER(paletteram_r); + template DECLARE_WRITE16_MEMBER(paletteram_w); + DECLARE_READ16_MEMBER(videoram_r); + DECLARE_WRITE16_MEMBER(videoram_w); DECLARE_READ8_MEMBER(sprite_control_r); DECLARE_WRITE8_MEMBER(sprite_control_w); - DECLARE_READ16_MEMBER(system32_spriteram_r); - DECLARE_WRITE16_MEMBER(system32_spriteram_w); - DECLARE_READ32_MEMBER(multi32_spriteram_r); - DECLARE_WRITE32_MEMBER(multi32_spriteram_w); - DECLARE_READ16_MEMBER(system32_mixer_r); - DECLARE_WRITE16_MEMBER(system32_mixer_w); - DECLARE_WRITE32_MEMBER(multi32_mixer_0_w); - DECLARE_WRITE32_MEMBER(multi32_mixer_1_w); + DECLARE_READ16_MEMBER(spriteram_r); + DECLARE_WRITE16_MEMBER(spriteram_w); + template DECLARE_READ16_MEMBER(mixer_r); + template DECLARE_WRITE16_MEMBER(mixer_w); DECLARE_READ8_MEMBER(int_control_r); DECLARE_WRITE8_MEMBER(int_control_w); @@ -147,8 +138,6 @@ protected: inline uint16_t xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(uint16_t value); inline uint16_t xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(uint16_t value); inline void update_color(int offset, uint16_t data); - inline uint16_t common_paletteram_r(address_space &space, int which, offs_t offset); - void common_paletteram_w(address_space &space, int which, offs_t offset, uint16_t data, uint16_t mem_mask); tilemap_t *find_cache_entry(int page, int bank); inline void get_tilemaps(int bgnum, tilemap_t **tilemaps); uint8_t update_tilemaps(screen_device &screen, const rectangle &cliprect); @@ -218,9 +207,9 @@ protected: required_shared_ptr m_z80_shared_ram; optional_shared_ptr m_system32_workram; - required_shared_ptr m_system32_videoram; - required_shared_ptr m_system32_spriteram; - optional_shared_ptr_array m_system32_paletteram; + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + optional_shared_ptr_array m_paletteram; required_device m_maincpu; required_device m_soundcpu; diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp index 9242f9656cc..7f72964d58a 100644 --- a/src/mame/video/segas32.cpp +++ b/src/mame/video/segas32.cpp @@ -147,7 +147,7 @@ #include "emu.h" #include "includes/segas32.h" - +#include /************************************* * @@ -162,7 +162,6 @@ #define LOG_SPRITES 0 - /************************************* * * Constants @@ -184,17 +183,6 @@ #define TILEMAP_CACHE_SIZE 32 - -/************************************* - * - * Helper macros - * - *************************************/ - -#define SWAP_HALVES(x) NATIVE_ENDIAN_VALUE_LE_BE(x, ((x) >> 16) | ((x) << 16)) - - - /************************************* * * Type definitions @@ -239,6 +227,7 @@ void segas32_state::common_start(int multi32) m_cache_head = entry; } + /* allocate the bitmaps (a few extra for multi32) */ for (tmap = 0; tmap < 9 + 2 * multi32; tmap++) { @@ -250,20 +239,15 @@ void segas32_state::common_start(int multi32) m_solid_0000 = make_unique_clear(512); m_solid_ffff = make_unique_clear(512); - memset(m_system32_videoram, 0x00, 0x20000); + memset(m_videoram, 0x00, 0x20000); /* initialize videoram */ - m_system32_videoram[0x1ff00/2] = 0x8000; + m_videoram[0x1ff00/2] = 0x8000; memset(m_mixer_control, 0xff, sizeof(m_mixer_control[0][0]) * 0x80 ); - - - } - - /************************************* * * Sprite management @@ -303,165 +287,21 @@ void segas32_state::system32_set_vblank(int state) } - -/************************************* - * - * Common palette handling - * - *************************************/ - -inline uint16_t segas32_state::xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(uint16_t value) -{ - int r = (value >> 0) & 0x1f; - int g = (value >> 5) & 0x1f; - int b = (value >> 10) & 0x1f; - value = (value & 0x8000) | ((b & 0x01) << 14) | ((g & 0x01) << 13) | ((r & 0x01) << 12); - value |= ((b & 0x1e) << 7) | ((g & 0x1e) << 3) | ((r & 0x1e) >> 1); - return value; -} - - -inline uint16_t segas32_state::xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(uint16_t value) -{ - int r = ((value >> 12) & 0x01) | ((value << 1) & 0x1e); - int g = ((value >> 13) & 0x01) | ((value >> 3) & 0x1e); - int b = ((value >> 14) & 0x01) | ((value >> 7) & 0x1e); - return (value & 0x8000) | (b << 10) | (g << 5) | (r << 0); -} - - -inline void segas32_state::update_color(int offset, uint16_t data) -{ - /* note that since we use this RAM directly, we don't technically need */ - /* to call palette_set_color() at all; however, it does give us that */ - /* nice display when you hit F4, which is useful for debugging */ - - /* set the color */ - m_palette->set_pen_color(offset, pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); -} - - -inline uint16_t segas32_state::common_paletteram_r(address_space &space, int which, offs_t offset) -{ - int convert; - - /* the lower half of palette RAM is formatted xBBBBBGGGGGRRRRR */ - /* the upper half of palette RAM is formatted xBGRBBBBGGGGRRRR */ - /* we store everything if the first format, and convert accesses to the other format */ - /* on the fly */ - convert = (offset & 0x4000); - offset &= 0x3fff; - - if (!convert) - return m_system32_paletteram[which][offset]; - else - return xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(m_system32_paletteram[which][offset]); -} - - -void segas32_state::common_paletteram_w(address_space &space, int which, offs_t offset, uint16_t data, uint16_t mem_mask) -{ - uint16_t value; - int convert; - - /* the lower half of palette RAM is formatted xBBBBBGGGGGRRRRR */ - /* the upper half of palette RAM is formatted xBGRBBBBGGGGRRRR */ - /* we store everything if the first format, and convert accesses to the other format */ - /* on the fly */ - convert = (offset & 0x4000); - offset &= 0x3fff; - - /* read, modify, and write the new value, updating the palette */ - value = m_system32_paletteram[which][offset]; - if (convert) value = xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(value); - COMBINE_DATA(&value); - if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); - m_system32_paletteram[which][offset] = value; - update_color(0x4000*which + offset, value); - - /* if blending is enabled, writes go to both halves of palette RAM */ - if (m_mixer_control[which][0x4e/2] & 0x0880) - { - offset ^= 0x2000; - - /* read, modify, and write the new value, updating the palette */ - value = m_system32_paletteram[which][offset]; - if (convert) value = xBBBBBGGGGGRRRRR_to_xBGRBBBBGGGGRRRR(value); - COMBINE_DATA(&value); - if (convert) value = xBGRBBBBGGGGRRRR_to_xBBBBBGGGGGRRRRR(value); - m_system32_paletteram[which][offset] = value; - update_color(0x4000*which + offset, value); - } -} - - - -/************************************* - * - * Palette RAM access - * - *************************************/ - -READ16_MEMBER(segas32_state::system32_paletteram_r) -{ - return common_paletteram_r(space, 0, offset); -} - - -WRITE16_MEMBER(segas32_state::system32_paletteram_w) -{ - common_paletteram_w(space, 0, offset, data, mem_mask); -} - - -READ32_MEMBER(segas32_state::multi32_paletteram_0_r) -{ - return common_paletteram_r(space, 0, (offset<<1)|0) | - (common_paletteram_r(space, 0, (offset<<1)|1) << 16); -} - - -WRITE32_MEMBER(segas32_state::multi32_paletteram_0_w) -{ - if (ACCESSING_BITS_0_15) - common_paletteram_w(space, 0, (offset<<1)|0, data, mem_mask); - if (ACCESSING_BITS_16_31) - common_paletteram_w(space, 0, (offset<<1)|1, data >> 16, mem_mask >> 16); -} - - -READ32_MEMBER(segas32_state::multi32_paletteram_1_r) -{ - return common_paletteram_r(space, 1, (offset<<1)|0) | - (common_paletteram_r(space, 1, (offset<<1)|1) << 16); -} - - -WRITE32_MEMBER(segas32_state::multi32_paletteram_1_w) -{ - if (ACCESSING_BITS_0_15) - common_paletteram_w(space, 1, (offset<<1)|0, data, mem_mask); - if (ACCESSING_BITS_16_31) - common_paletteram_w(space, 1, (offset<<1)|1, data >> 16, mem_mask >> 16); -} - - - /************************************* * * Video RAM access * *************************************/ -READ16_MEMBER(segas32_state::system32_videoram_r) +READ16_MEMBER(segas32_state::videoram_r) { - return m_system32_videoram[offset]; + return m_videoram[offset]; } -WRITE16_MEMBER(segas32_state::system32_videoram_w) +WRITE16_MEMBER(segas32_state::videoram_w) { - COMBINE_DATA(&m_system32_videoram[offset]); + COMBINE_DATA(&m_videoram[offset]); /* if we are not in the control area, just update any affected tilemaps */ if (offset < 0x1ff00/2) @@ -478,7 +318,6 @@ WRITE16_MEMBER(segas32_state::system32_videoram_w) } - /************************************* * * Sprite control registers @@ -549,85 +388,29 @@ WRITE8_MEMBER(segas32_state::sprite_control_w) } - /************************************* * * Sprite RAM access * *************************************/ -READ16_MEMBER(segas32_state::system32_spriteram_r) +READ16_MEMBER(segas32_state::spriteram_r) { - return m_system32_spriteram[offset]; + return m_spriteram[offset]; } -WRITE16_MEMBER(segas32_state::system32_spriteram_w) +WRITE16_MEMBER(segas32_state::spriteram_w) { - COMBINE_DATA(&m_system32_spriteram[offset]); + COMBINE_DATA(&m_spriteram[offset]); m_spriteram_32bit[offset>>1] = - ((m_system32_spriteram[offset | 1] >> 8 ) & 0x000000ff) | - ((m_system32_spriteram[offset | 1] << 8 ) & 0x0000ff00) | - ((m_system32_spriteram[offset & ~1] << 8 ) & 0x00ff0000) | - ((m_system32_spriteram[offset & ~1] << 24) & 0xff000000); + ((m_spriteram[offset | 1] >> 8 ) & 0x000000ff) | + ((m_spriteram[offset | 1] << 8 ) & 0x0000ff00) | + ((m_spriteram[offset & ~1] << 8 ) & 0x00ff0000) | + ((m_spriteram[offset & ~1] << 24) & 0xff000000); } -READ32_MEMBER(segas32_state::multi32_spriteram_r) -{ - return m_system32_spriteram[(offset<<1)|0] | - (m_system32_spriteram[(offset<<1)|1] << 16); -} - - -WRITE32_MEMBER(segas32_state::multi32_spriteram_w) -{ - data = SWAP_HALVES(data); - mem_mask = SWAP_HALVES(mem_mask); - COMBINE_DATA((uint32_t *)&m_system32_spriteram[offset<<1]); - m_spriteram_32bit[offset>>1] = - ((m_system32_spriteram[offset | 1] >> 8 ) & 0x000000ff) | - ((m_system32_spriteram[offset | 1] << 8 ) & 0x0000ff00) | - ((m_system32_spriteram[offset & ~1] << 8 ) & 0x00ff0000) | - ((m_system32_spriteram[offset & ~1] << 24) & 0xff000000); -} - - - -/************************************* - * - * Mixer control registers - * - *************************************/ - -READ16_MEMBER(segas32_state::system32_mixer_r) -{ - return m_mixer_control[0][offset]; -} - -WRITE16_MEMBER(segas32_state::system32_mixer_w) -{ - COMBINE_DATA(&m_mixer_control[0][offset]); -} - - -WRITE32_MEMBER(segas32_state::multi32_mixer_0_w) -{ - data = SWAP_HALVES(data); - mem_mask = SWAP_HALVES(mem_mask); - COMBINE_DATA((uint32_t *)&m_mixer_control[0][offset<<1]); -} - - -WRITE32_MEMBER(segas32_state::multi32_mixer_1_w) -{ - data = SWAP_HALVES(data); - mem_mask = SWAP_HALVES(mem_mask); - COMBINE_DATA((uint32_t *)&m_mixer_control[1][offset<<1]); -} - - - /************************************* * * Tilemap cache @@ -676,7 +459,6 @@ tilemap_t *segas32_state::find_cache_entry(int page, int bank) } - /************************************* * * Tilemap callback @@ -686,12 +468,11 @@ tilemap_t *segas32_state::find_cache_entry(int page, int bank) TILE_GET_INFO_MEMBER(segas32_state::get_tile_info) { struct segas32_state::cache_entry *entry = (struct segas32_state::cache_entry *)tilemap.user_data(); - uint16_t data = m_system32_videoram[((entry->page & 0x7f) << 9) | tile_index]; + uint16_t data = m_videoram[((entry->page & 0x7f) << 9) | tile_index]; SET_TILE_INFO_MEMBER(0, (entry->bank << 13) | (data & 0x1fff), (data >> 4) & 0x1ff, (data >> 14) & 3); } - /************************************* * * Clipping extents computation @@ -700,7 +481,7 @@ TILE_GET_INFO_MEMBER(segas32_state::get_tile_info) int segas32_state::compute_clipping_extents(screen_device &screen, int enable, int clipout, int clipmask, const rectangle &cliprect, struct extents_list *list) { - int flip = (m_system32_videoram[0x1ff00/2] >> 9) & 1; + int flip = (m_videoram[0x1ff00/2] >> 9) & 1; rectangle tempclip; rectangle clips[5]; int sorted[5]; @@ -727,19 +508,19 @@ int segas32_state::compute_clipping_extents(screen_device &screen, int enable, i { if (!flip) { - clips[i].min_x = m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff; - clips[i].min_y = m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff; - clips[i].max_x = (m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; - clips[i].max_y = (m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; + clips[i].min_x = m_videoram[0x1ff60/2 + i * 4] & 0x1ff; + clips[i].min_y = m_videoram[0x1ff62/2 + i * 4] & 0x0ff; + clips[i].max_x = (m_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; + clips[i].max_y = (m_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; } else { const rectangle &visarea = screen.visible_area(); - clips[i].max_x = (visarea.max_x + 1) - (m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff); - clips[i].max_y = (visarea.max_y + 1) - (m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff); - clips[i].min_x = (visarea.max_x + 1) - ((m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); - clips[i].min_y = (visarea.max_y + 1) - ((m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); + clips[i].max_x = (visarea.max_x + 1) - (m_videoram[0x1ff60/2 + i * 4] & 0x1ff); + clips[i].max_y = (visarea.max_y + 1) - (m_videoram[0x1ff62/2 + i * 4] & 0x0ff); + clips[i].min_x = (visarea.max_x + 1) - ((m_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); + clips[i].min_y = (visarea.max_y + 1) - ((m_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); } clips[i] &= tempclip; sorted[i] = i; @@ -803,19 +584,19 @@ int segas32_state::compute_clipping_extents(screen_device &screen, int enable, i void segas32_state::compute_tilemap_flips(int bgnum, int &flipx, int &flipy) { /* determine if we're flipped */ - int global_flip = (m_system32_videoram[0x1ff00 / 2] >> 9)&1; + int global_flip = (m_videoram[0x1ff00 / 2] >> 9)&1; flipx = global_flip; flipy = global_flip; - int layer_flip = (m_system32_videoram[0x1ff00 / 2] >> bgnum) & 1; + int layer_flip = (m_videoram[0x1ff00 / 2] >> bgnum) & 1; flipy ^= layer_flip; flipx ^= layer_flip; // this bit is set on Air Rescue (screen 2) title screen, during the Air Rescue introduction demo, and in f1en when you win a single player race // it seems to prohibit (at least) the per-tilemap y flipping (maybe global y can override it) - if ((m_system32_videoram[0x1ff00 / 2] >> 8) & 1) flipy = 0; + if ((m_videoram[0x1ff00 / 2] >> 8) & 1) flipy = 0; } /************************************* @@ -832,16 +613,16 @@ inline void segas32_state::get_tilemaps(int bgnum, tilemap_t **tilemaps) if (m_is_multi32) tilebank = (m_system32_tilebank_external >> (2*bgnum)) & 3; else - tilebank = ((m_system32_tilebank_external & 1) << 1) | ((m_system32_videoram[0x1ff00/2] & 0x400) >> 10); + tilebank = ((m_system32_tilebank_external & 1) << 1) | ((m_videoram[0x1ff00/2] & 0x400) >> 10); /* find the cache entries */ - page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 0) & 0x7f; + page = (m_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 0) & 0x7f; tilemaps[0] = find_cache_entry(page, tilebank); - page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 8) & 0x7f; + page = (m_videoram[0x1ff40/2 + 2 * bgnum + 0] >> 8) & 0x7f; tilemaps[1] = find_cache_entry(page, tilebank); - page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 0) & 0x7f; + page = (m_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 0) & 0x7f; tilemaps[2] = find_cache_entry(page, tilebank); - page = (m_system32_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 8) & 0x7f; + page = (m_videoram[0x1ff40/2 + 2 * bgnum + 1] >> 8) & 0x7f; tilemaps[3] = find_cache_entry(page, tilebank); } @@ -863,7 +644,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st /* configure the layer */ opaque = 0; -//opaque = (m_system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; +//opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_Z) && bgnum == 0) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1; int flipx, flipy; @@ -872,15 +653,15 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st compute_tilemap_flips(bgnum, flipx, flipy); /* determine the clipping */ - clipenable = (m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_system32_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_system32_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* extract the X/Y step values (these are in destination space!) */ - dstxstep = m_system32_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; - if (m_system32_videoram[0x1ff00/2] & 0x4000) - dstystep = m_system32_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; + dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + if (m_videoram[0x1ff00/2] & 0x4000) + dstystep = m_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; else dstystep = dstxstep; @@ -895,14 +676,14 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st srcystep = (0x200 << 20) / dstystep; /* start with the fractional scroll offsets, in source coordinates */ - srcx_start = (m_system32_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; - srcx_start += (m_system32_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; - srcy = (m_system32_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; - srcy += (m_system32_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; + srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; + srcx_start += (m_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; + srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; + srcy += (m_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; /* then account for the destination center coordinates */ - srcx_start -= ((int16_t)(m_system32_videoram[0x1ff30/2 + 2 * bgnum] << 6) >> 6) * srcxstep; - srcy -= ((int16_t)(m_system32_videoram[0x1ff32/2 + 2 * bgnum] << 7) >> 7) * srcystep; + srcx_start -= ((int16_t)(m_videoram[0x1ff30/2 + 2 * bgnum] << 6) >> 6) * srcxstep; + srcy -= ((int16_t)(m_videoram[0x1ff32/2 + 2 * bgnum] << 7) >> 7) * srcystep; /* finally, account for destination top,left coordinates */ srcx_start += cliprect.min_x * srcxstep; @@ -992,13 +773,12 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st #if 0 if (dstxstep != 0x200 || dstystep != 0x200) popmessage("Zoom=%03X,%03X Cent=%03X,%03X", dstxstep, dstystep, - m_system32_videoram[0x1ff30/2 + 2 * bgnum], - m_system32_videoram[0x1ff32/2 + 2 * bgnum]); + m_videoram[0x1ff30/2 + 2 * bgnum], + m_videoram[0x1ff32/2 + 2 * bgnum]); #endif } - /************************************* * * Rowscroll/select tilemaps (NBG2/3) @@ -1024,7 +804,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, struct segas /* configure the layer */ opaque = 0; -//opaque = (m_system32_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; +//opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_C) && bgnum == 2) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_V) && bgnum == 3) opaque = 1; @@ -1035,23 +815,23 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, struct segas /* determine the clipping */ - clipenable = (m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_system32_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_system32_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine if row scroll and/or row select is enabled */ - rowscroll = (m_system32_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; - rowselect = (m_system32_videoram[0x1ff04/2] >> bgnum) & 1; - if ((m_system32_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) + rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; + rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; + if ((m_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) rowscroll = rowselect = 0; /* get a pointer to the table */ - table = &m_system32_videoram[(m_system32_videoram[0x1ff04/2] >> 10) * 0x400]; + table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; /* start with screen-wide X and Y scrolls */ - xscroll = (m_system32_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_system32_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); - yscroll = (m_system32_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); + xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); + yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); /* render the tilemap into its bitmap */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) @@ -1145,7 +925,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, struct segas #if 0 if (rowscroll || rowselect) popmessage("Scroll=%d Select=%d Table@%06X", - rowscroll, rowselect, (m_system32_videoram[0x1ff04/2] >> 10) * 0x800); + rowscroll, rowselect, (m_videoram[0x1ff04/2] >> 10) * 0x800); #endif } @@ -1168,11 +948,11 @@ void segas32_state::update_tilemap_text(screen_device &screen, struct segas32_st int flip; /* determine if we're flipped */ - flip = (m_system32_videoram[0x1ff00/2] >> 9) & 1; + flip = (m_videoram[0x1ff00/2] >> 9) & 1; /* determine the base of the tilemap and graphics data */ - tilebase = &m_system32_videoram[((m_system32_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; - gfxbase = &m_system32_videoram[(m_system32_videoram[0x1ff5c/2] & 7) * 0x2000]; + tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; + gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; /* compute start/end tile numbers */ startx = cliprect.min_x / 8; @@ -1327,18 +1107,18 @@ void segas32_state::update_bitmap(screen_device &screen, struct segas32_state::l int bpp; /* configure the layer */ - bpp = (m_system32_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; + bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; /* determine the clipping */ - clipenable = (m_system32_videoram[0x1ff02/2] >> 15) & 1; - clipout = (m_system32_videoram[0x1ff02/2] >> 10) & 1; + clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; + clipout = (m_videoram[0x1ff02/2] >> 10) & 1; clips = 0x10; clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine x/y scroll */ - xscroll = m_system32_videoram[0x1ff88/2] & 0x1ff; - yscroll = m_system32_videoram[0x1ff8a/2] & 0x1ff; - color = (m_system32_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); + xscroll = m_videoram[0x1ff88/2] & 0x1ff; + yscroll = m_videoram[0x1ff8a/2] & 0x1ff; + color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); /* loop over target rows */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) @@ -1361,7 +1141,7 @@ void segas32_state::update_bitmap(screen_device &screen, struct segas32_state::l /* 8bpp mode case */ if (bpp == 8) { - uint8_t *src = (uint8_t *)&m_system32_videoram[512/2 * ((y + yscroll) & 0xff)]; + uint8_t *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; for (x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; @@ -1375,7 +1155,7 @@ void segas32_state::update_bitmap(screen_device &screen, struct segas32_state::l /* 4bpp mode case */ else { - uint16_t *src = &m_system32_videoram[512/4 * ((y + yscroll) & 0x1ff)]; + uint16_t *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; for (x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; @@ -1430,10 +1210,10 @@ void segas32_state::update_background(struct segas32_state::layer_info *layer, c int color; /* determine the color */ - if (m_system32_videoram[0x1ff5e/2] & 0x8000) - color = (m_system32_videoram[0x1ff5e/2] & 0x1fff) + y; + if (m_videoram[0x1ff5e/2] & 0x8000) + color = (m_videoram[0x1ff5e/2] & 0x1fff) + y; else - color = m_system32_videoram[0x1ff5e/2] & 0x1e00; + color = m_videoram[0x1ff5e/2] & 0x1e00; /* if the color doesn't match, fill */ if (dst[cliprect.min_x] != color) @@ -1445,12 +1225,12 @@ void segas32_state::update_background(struct segas32_state::layer_info *layer, c uint8_t segas32_state::update_tilemaps(screen_device &screen, const rectangle &cliprect) { - int enable0 = !(m_system32_videoram[0x1ff02/2] & 0x0001) && !(m_system32_videoram[0x1ff8e/2] & 0x0002); - int enable1 = !(m_system32_videoram[0x1ff02/2] & 0x0002) && !(m_system32_videoram[0x1ff8e/2] & 0x0004); - int enable2 = !(m_system32_videoram[0x1ff02/2] & 0x0004) && !(m_system32_videoram[0x1ff8e/2] & 0x0008) && !(m_system32_videoram[0x1ff00/2] & 0x1000); - int enable3 = !(m_system32_videoram[0x1ff02/2] & 0x0008) && !(m_system32_videoram[0x1ff8e/2] & 0x0010) && !(m_system32_videoram[0x1ff00/2] & 0x2000); - int enablet = !(m_system32_videoram[0x1ff02/2] & 0x0010) && !(m_system32_videoram[0x1ff8e/2] & 0x0001); - int enableb = !(m_system32_videoram[0x1ff02/2] & 0x0020) && !(m_system32_videoram[0x1ff8e/2] & 0x0020); + int enable0 = !(m_videoram[0x1ff02/2] & 0x0001) && !(m_videoram[0x1ff8e/2] & 0x0002); + int enable1 = !(m_videoram[0x1ff02/2] & 0x0002) && !(m_videoram[0x1ff8e/2] & 0x0004); + int enable2 = !(m_videoram[0x1ff02/2] & 0x0004) && !(m_videoram[0x1ff8e/2] & 0x0008) && !(m_videoram[0x1ff00/2] & 0x1000); + int enable3 = !(m_videoram[0x1ff02/2] & 0x0008) && !(m_videoram[0x1ff8e/2] & 0x0010) && !(m_videoram[0x1ff00/2] & 0x2000); + int enablet = !(m_videoram[0x1ff02/2] & 0x0010) && !(m_videoram[0x1ff8e/2] & 0x0001); + int enableb = !(m_videoram[0x1ff02/2] & 0x0020) && !(m_videoram[0x1ff8e/2] & 0x0020); /* update any tilemaps */ if (enable0) @@ -1662,7 +1442,7 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r /* create the local palette for the indirect case */ if (indirect) { - uint16_t *src = indlocal ? &data[8] : &m_system32_spriteram[8 * (data[7] & 0x1fff)]; + uint16_t *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; for (x = 0; x < 16; x++) indtable[x] = (src[x] & (bpp8 ? 0xfff0 : 0xffff)) | ((m_sprite_control_latched[0x0a/2] & 1) ? 0x8000 : 0x0000); } @@ -1833,7 +1613,7 @@ void segas32_state::sprite_render_list() while (numentries++ < 0x20000/16) { /* top two bits are a command */ - sprite = &m_system32_spriteram[8 * (spritenum & 0x1fff)]; + sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; switch (sprite[0] >> 14) { /* command 0 = draw sprite */ @@ -2177,7 +1957,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* adjust the first pixel */ - firstpix = m_system32_paletteram[which][(first->palbase + ((firstpix >> first->mixshift) & 0xfff0) + (firstpix & 0x0f)) & 0x3fff]; + firstpix = m_paletteram[which][(first->palbase + ((firstpix >> first->mixshift) & 0xfff0) + (firstpix & 0x0f)) & 0x3fff]; /* compute R, G, B */ rgbdelta = &rgboffs[first->coloroffs][0]; @@ -2224,7 +2004,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c (laynum != MIXER_LAYER_SPRITES || (first->sprblendmask & (1 << sprgroup)))) { /* adjust the second pixel */ - secondpix = m_system32_paletteram[which][(second->palbase + ((secondpix >> second->mixshift) & 0xfff0) + (secondpix & 0x0f)) & 0x3fff]; + secondpix = m_paletteram[which][(second->palbase + ((secondpix >> second->mixshift) & 0xfff0) + (secondpix & 0x0f)) & 0x3fff]; /* compute first RGB */ r *= 7 - blendfactor; @@ -2291,7 +2071,7 @@ void segas32_state::print_mixer_data(int which) if (++m_print_count > 60 * 5) { osd_printf_debug("\n"); - osd_printf_debug("OP: %04X\n", m_system32_videoram[0x1ff8e/2]); + osd_printf_debug("OP: %04X\n", m_videoram[0x1ff8e/2]); osd_printf_debug("SC: %04X %04X %04X %04X - %04X %04X %04X %04X\n", m_sprite_control_latched[0x00], m_sprite_control_latched[0x01], @@ -2361,7 +2141,7 @@ uint32_t segas32_state::screen_update_system32(screen_device &screen, bitmap_rgb uint8_t enablemask; /* update the visible area */ - if (m_system32_videoram[0x1ff00/2] & 0x8000) + if (m_videoram[0x1ff00/2] & 0x8000) screen.set_visible_area(0, 52*8-1, 0, 28*8-1); else screen.set_visible_area(0, 40*8-1, 0, 28*8-1); @@ -2482,9 +2262,9 @@ uint32_t segas32_state::screen_update_system32(screen_device &screen, bitmap_rgb // if (showclip != -1) for (showclip = 0; showclip < 4; showclip++) { - int flip = (m_system32_videoram[0x1ff00/2] >> 9) & 1; - int clips = (m_system32_videoram[0x1ff06/2] >> (4 * showclip)) & 0x0f; - if (((m_system32_videoram[0x1ff02/2] >> (11 + showclip)) & 1) && clips) + int flip = (m_videoram[0x1ff00/2] >> 9) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * showclip)) & 0x0f; + if (((m_videoram[0x1ff02/2] >> (11 + showclip)) & 1) && clips) { int i, x, y; for (i = 0; i < 4; i++) @@ -2496,17 +2276,17 @@ for (showclip = 0; showclip < 4; showclip++) pen_t white = get_white_pen(screen.machine()); if (!flip) { - rect.min_x = m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff; - rect.min_y = m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff; - rect.max_x = (m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; - rect.max_y = (m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; + rect.min_x = m_videoram[0x1ff60/2 + i * 4] & 0x1ff; + rect.min_y = m_videoram[0x1ff62/2 + i * 4] & 0x0ff; + rect.max_x = (m_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1; + rect.max_y = (m_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1; } else { - rect.max_x = (visarea.max_x + 1) - (m_system32_videoram[0x1ff60/2 + i * 4] & 0x1ff); - rect.max_y = (visarea.max_y + 1) - (m_system32_videoram[0x1ff62/2 + i * 4] & 0x0ff); - rect.min_x = (visarea.max_x + 1) - ((m_system32_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); - rect.min_y = (visarea.max_y + 1) - ((m_system32_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); + rect.max_x = (visarea.max_x + 1) - (m_videoram[0x1ff60/2 + i * 4] & 0x1ff); + rect.max_y = (visarea.max_y + 1) - (m_videoram[0x1ff62/2 + i * 4] & 0x0ff); + rect.min_x = (visarea.max_x + 1) - ((m_videoram[0x1ff64/2 + i * 4] & 0x1ff) + 1); + rect.min_y = (visarea.max_y + 1) - ((m_videoram[0x1ff66/2 + i * 4] & 0x0ff) + 1); } sect_rect(&rect, &screen.visible_area()); @@ -2539,7 +2319,7 @@ uint32_t segas32_state::multi32_update(screen_device &screen, bitmap_rgb32 &bitm uint8_t enablemask; /* update the visible area */ - if (m_system32_videoram[0x1ff00/2] & 0x8000) + if (m_videoram[0x1ff00/2] & 0x8000) screen.set_visible_area(0, 52*8-1, 0, 28*8-1); else screen.set_visible_area(0, 40*8-1, 0, 28*8-1);