summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2019-04-02 14:56:22 -0400
committer GitHub <noreply@github.com>2019-04-02 14:56:22 -0400
commite4d0a3c20f9438f01005ddd25b7c794d11d4ea2f (patch)
treeaf5cda9af4a5d09530d6ce91c610fa0e20db3a94
parent631059e094cc7176cb00947bebf7d42a9a999379 (diff)
parent09a1ca3e33138a4f508bae57de108f894959728b (diff)
Merge pull request #4840 from cam900/raiden2_args
raiden2.cpp, r2dx_v33.cpp : Updates
-rw-r--r--src/mame/drivers/r2dx_v33.cpp196
-rw-r--r--src/mame/drivers/raiden2.cpp107
-rw-r--r--src/mame/includes/raiden2.h106
-rw-r--r--src/mame/video/raiden2.cpp89
4 files changed, 256 insertions, 242 deletions
diff --git a/src/mame/drivers/r2dx_v33.cpp b/src/mame/drivers/r2dx_v33.cpp
index 5e3edf03489..1e27f46dc40 100644
--- a/src/mame/drivers/r2dx_v33.cpp
+++ b/src/mame/drivers/r2dx_v33.cpp
@@ -99,32 +99,32 @@ public:
private:
- DECLARE_WRITE16_MEMBER(angle_w);
- DECLARE_WRITE16_MEMBER(dx_w);
- DECLARE_WRITE16_MEMBER(dy_w);
- DECLARE_WRITE16_MEMBER(sdistl_w);
- DECLARE_WRITE16_MEMBER(sdisth_w);
- DECLARE_READ16_MEMBER(angle_r);
- DECLARE_READ16_MEMBER(dist_r);
- DECLARE_READ16_MEMBER(sin_r);
- DECLARE_READ16_MEMBER(cos_r);
-
- DECLARE_WRITE8_MEMBER(tile_bank_w);
- DECLARE_READ16_MEMBER(rdx_v33_unknown_r);
- DECLARE_WRITE16_MEMBER(mcu_xval_w);
- DECLARE_WRITE16_MEMBER(mcu_yval_w);
- DECLARE_WRITE16_MEMBER(mcu_table_w);
- DECLARE_WRITE16_MEMBER(mcu_table2_w);
- DECLARE_WRITE16_MEMBER(mcu_prog_w);
- DECLARE_WRITE16_MEMBER(mcu_prog_w2);
- DECLARE_WRITE16_MEMBER(mcu_prog_offs_w);
- DECLARE_WRITE16_MEMBER(rdx_v33_eeprom_w);
- DECLARE_WRITE16_MEMBER(zerotm2k_eeprom_w);
- DECLARE_WRITE16_MEMBER(r2dx_rom_bank_w);
-
- DECLARE_WRITE16_MEMBER(tilemapdma_w);
- DECLARE_WRITE16_MEMBER(paldma_w);
- DECLARE_READ16_MEMBER(r2dx_debug_r);
+ void angle_w(offs_t offset, u16 data, u16 mem_mask);
+ void dx_w(offs_t offset, u16 data, u16 mem_mask);
+ void dy_w(offs_t offset, u16 data, u16 mem_mask);
+ void sdistl_w(offs_t offset, u16 data, u16 mem_mask);
+ void sdisth_w(offs_t offset, u16 data, u16 mem_mask);
+ u16 angle_r();
+ u16 dist_r();
+ u16 sin_r();
+ u16 cos_r();
+
+ void tile_bank_w(u8 data);
+ u16 rdx_v33_unknown_r();
+ void mcu_xval_w(u16 data);
+ void mcu_yval_w(u16 data);
+ void mcu_table_w(offs_t offset, u16 data);
+ void mcu_table2_w(offs_t offset, u16 data);
+ void mcu_prog_w(u16 data);
+ void mcu_prog_w2(u16 data);
+ void mcu_prog_offs_w(u16 data);
+ void rdx_v33_eeprom_w(u8 data);
+ void zerotm2k_eeprom_w(u16 data);
+ void r2dx_rom_bank_w(u16 data);
+
+ void tilemapdma_w(address_space &space, u16 data);
+ void paldma_w(address_space &space, u16 data);
+ u16 r2dx_debug_r();
DECLARE_MACHINE_RESET(r2dx_v33);
DECLARE_MACHINE_RESET(nzeroteam);
@@ -142,15 +142,15 @@ private:
int m_r2dxbank;
int m_r2dxgameselect;
- uint16_t m_dx, m_dy, m_angle;
- uint32_t m_sdist;
- uint16_t m_mcu_prog[0x800];
+ u16 m_dx, m_dy, m_angle;
+ u32 m_sdist;
+ u16 m_mcu_prog[0x800];
int m_mcu_prog_offs;
- uint16_t m_mcu_xval, m_mcu_yval;
- uint16_t m_mcu_data[9];
+ u16 m_mcu_xval, m_mcu_yval;
+ u16 m_mcu_data[9];
optional_device<eeprom_serial_93cxx_device> m_eeprom;
- required_region_ptr<uint8_t> m_math;
+ required_region_ptr<u8> m_math;
optional_memory_bank m_okibank;
};
@@ -172,23 +172,26 @@ void r2dx_v33_state::machine_start()
save_item(NAME(m_mcu_data));
}
-WRITE8_MEMBER(r2dx_v33_state::tile_bank_w)
+void r2dx_v33_state::tile_bank_w(u8 data)
{
int new_bank;
new_bank = ((data & 0x10)>>4);
- if(new_bank != m_bg_bank) {
+ if (new_bank != m_bg_bank)
+ {
m_bg_bank = new_bank;
m_background_layer->mark_all_dirty();
}
new_bank = 2 + ((data & 0x20)>>5);
- if(new_bank != m_mid_bank) {
+ if (new_bank != m_mid_bank)
+ {
m_mid_bank = new_bank;
m_midground_layer->mark_all_dirty();
}
new_bank = 4 | (data & 3);
- if(new_bank != m_fg_bank) {
+ if (new_bank != m_fg_bank)
+ {
m_fg_bank = new_bank;
m_foreground_layer->mark_all_dirty();
}
@@ -200,43 +203,35 @@ void r2dx_v33_state::r2dx_setbanking()
m_mainbank[1]->set_entry(m_r2dxgameselect);
}
-WRITE16_MEMBER(r2dx_v33_state::rdx_v33_eeprom_w)
+void r2dx_v33_state::rdx_v33_eeprom_w(u8 data)
{
- if (ACCESSING_BITS_0_7)
- {
- m_eeprom->clk_write((data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
- m_eeprom->di_write((data & 0x20) >> 5);
- m_eeprom->cs_write((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
+ m_eeprom->clk_write((data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
+ m_eeprom->di_write((data & 0x20) >> 5);
+ m_eeprom->cs_write((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
- // 0x40 - coin counter 1?
- // 0x80 - coin counter 2?
+ // 0x40 - coin counter 1?
+ // 0x80 - coin counter 2?
- // 0x04 is active in Raiden DX mode, it could be part of the rom bank (which half of the rom to use) or the FG tile bank (or both?)
- // the bit gets set if it reads RAIDENDX from the EEPROM
- m_r2dxgameselect = (data & 0x04) >> 2;
+ // 0x04 is active in Raiden DX mode, it could be part of the rom bank (which half of the rom to use) or the FG tile bank (or both?)
+ // the bit gets set if it reads RAIDENDX from the EEPROM
+ m_r2dxgameselect = (data & 0x04) >> 2;
- m_tx_bank = m_r2dxgameselect;
- m_text_layer->mark_all_dirty();
+ m_tx_bank = m_r2dxgameselect;
+ m_text_layer->mark_all_dirty();
- r2dx_setbanking();
-
- m_okibank->set_entry(data&3);
+ r2dx_setbanking();
- }
- else
- {
- logerror("eeprom_w MSB used %04x",data);
- }
+ m_okibank->set_entry(data&3);
}
/* new zero team uses the copd3 protection... and uploads a 0x400 byte table, probably the mcu code, encrypted */
-WRITE16_MEMBER(r2dx_v33_state::mcu_prog_w)
+void r2dx_v33_state::mcu_prog_w(u16 data)
{
m_mcu_prog[m_mcu_prog_offs*2] = data;
}
-WRITE16_MEMBER(r2dx_v33_state::mcu_prog_w2)
+void r2dx_v33_state::mcu_prog_w2(u16 data)
{
m_mcu_prog[m_mcu_prog_offs*2+1] = data;
@@ -257,25 +252,25 @@ WRITE16_MEMBER(r2dx_v33_state::mcu_prog_w2)
#endif
}
-WRITE16_MEMBER(r2dx_v33_state::mcu_prog_offs_w)
+void r2dx_v33_state::mcu_prog_offs_w(u16 data)
{
m_mcu_prog_offs = data;
}
-READ16_MEMBER(r2dx_v33_state::rdx_v33_unknown_r)
+u16 r2dx_v33_state::rdx_v33_unknown_r()
{
return machine().rand();
}
/* something sent to the MCU for X/Y global screen calculating ... */
-WRITE16_MEMBER(r2dx_v33_state::mcu_xval_w)
+void r2dx_v33_state::mcu_xval_w(u16 data)
{
m_mcu_xval = data;
//popmessage("%04x %04x",m_mcu_xval,m_mcu_yval);
}
-WRITE16_MEMBER(r2dx_v33_state::mcu_yval_w)
+void r2dx_v33_state::mcu_yval_w(u16 data)
{
m_mcu_yval = data;
//popmessage("%04x %04x",m_mcu_xval,m_mcu_yval);
@@ -283,103 +278,103 @@ WRITE16_MEMBER(r2dx_v33_state::mcu_yval_w)
/* 0x400-0x407 seems some DMA hook-up, 0x420-0x427 looks like some x/y sprite calculation routine */
-WRITE16_MEMBER(r2dx_v33_state::mcu_table_w)
+void r2dx_v33_state::mcu_table_w(offs_t offset, u16 data)
{
m_mcu_data[offset] = data;
//popmessage("%04x %04x %04x %04x | %04x %04x %04x %04x",m_mcu_data[0/2],m_mcu_data[2/2],m_mcu_data[4/2],m_mcu_data[6/2],m_mcu_data[8/2],m_mcu_data[0xa/2],m_mcu_data[0xc/2],m_mcu_data[0xe/2]);
}
-WRITE16_MEMBER(r2dx_v33_state::mcu_table2_w)
+void r2dx_v33_state::mcu_table2_w(offs_t offset, u16 data)
{
-// printf("mcu_table2_w %04x %04x\n", data, mem_mask);
+// printf("mcu_table2_w %04x\n", data);
m_mcu_data[offset+4] = data;
//popmessage("%04x %04x %04x %04x | %04x %04x %04x %04x",m_mcu_data[0/2],m_mcu_data[2/2],m_mcu_data[4/2],m_mcu_data[6/2],m_mcu_data[8/2],m_mcu_data[0xa/2],m_mcu_data[0xc/2],m_mcu_data[0xe/2]);
}
-WRITE16_MEMBER(r2dx_v33_state::r2dx_rom_bank_w)
+void r2dx_v33_state::r2dx_rom_bank_w(u16 data)
{
- //printf("rom bank %04x %04x\n", data, mem_mask);
+ //printf("rom bank %04x\n", data);
m_r2dxbank = data & 0xf;
r2dx_setbanking();
}
-WRITE16_MEMBER(r2dx_v33_state::angle_w)
+void r2dx_v33_state::angle_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_angle);
}
-WRITE16_MEMBER(r2dx_v33_state::dx_w)
+void r2dx_v33_state::dx_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_dx);
}
-WRITE16_MEMBER(r2dx_v33_state::dy_w)
+void r2dx_v33_state::dy_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_dy);
}
-READ16_MEMBER(r2dx_v33_state::angle_r)
+u16 r2dx_v33_state::angle_r()
{
return m_math[((m_dy & 0xff) << 8) | (m_dx & 0xff)];
}
-READ16_MEMBER(r2dx_v33_state::dist_r)
+u16 r2dx_v33_state::dist_r()
{
return sqrt(double(m_sdist));
}
-READ16_MEMBER(r2dx_v33_state::sin_r)
+u16 r2dx_v33_state::sin_r()
{
int off = 65536 + (m_angle & 0xff)*4;
return (m_math[off+0]) | (m_math[off+1] << 8);
}
-READ16_MEMBER(r2dx_v33_state::cos_r)
+u16 r2dx_v33_state::cos_r()
{
int off = 65536 + (m_angle & 0xff)*4;
return (m_math[off+2]) | (m_math[off+3] << 8);
}
-WRITE16_MEMBER(r2dx_v33_state::sdistl_w)
+void r2dx_v33_state::sdistl_w(offs_t offset, u16 data, u16 mem_mask)
{
- m_sdist = (m_sdist & (0xffff0000 | uint16_t(~mem_mask))) | (data & mem_mask);
+ m_sdist = (m_sdist & (0xffff0000 | u16(~mem_mask))) | (data & mem_mask);
}
-WRITE16_MEMBER(r2dx_v33_state::sdisth_w)
+void r2dx_v33_state::sdisth_w(offs_t offset, u16 data, u16 mem_mask)
{
- m_sdist = (m_sdist & (0x0000ffff | (uint16_t(~mem_mask)) << 16)) | ((data & mem_mask) << 16);
+ m_sdist = (m_sdist & (0x0000ffff | (u16(~mem_mask)) << 16)) | ((data & mem_mask) << 16);
}
// these DMA operations seem to use hardcoded addresses on this hardware
-WRITE16_MEMBER(r2dx_v33_state::tilemapdma_w)
+void r2dx_v33_state::tilemapdma_w(address_space &space, u16 data)
{
int src = 0xd000;
for (int i = 0; i < 0x2800 / 2; i++)
{
- uint16_t tileval = space.read_word(src);
+ u16 tileval = space.read_word(src);
src += 2;
m_videoram_private_w(space, i, tileval, 0xffff);
}
}
-WRITE16_MEMBER(r2dx_v33_state::paldma_w)
+void r2dx_v33_state::paldma_w(address_space &space, u16 data)
{
int src = 0x1f000;
for (int i = 0; i < 0x1000 / 2; i++)
{
- uint16_t palval = space.read_word(src);
+ u16 palval = space.read_word(src);
src += 2;
m_palette->write16(i, palval);
}
}
-READ16_MEMBER(r2dx_v33_state::r2dx_debug_r)
+u16 r2dx_v33_state::r2dx_debug_r()
{
// read once on startup, needed for player collisions to work
return 0xffff;
@@ -407,14 +402,14 @@ void r2dx_v33_state::rdx_v33_map(address_map &map)
map(0x00436, 0x00437).r(FUNC(r2dx_v33_state::cos_r));
map(0x00600, 0x0063f).rw("crtc", FUNC(seibu_crtc_device::read), FUNC(seibu_crtc_device::write));
- //AM_RANGE(0x00640, 0x006bf) AM_DEVREADWRITE("obj", seibu_encrypted_sprite_device, read, write)
+ //map(0x00640, 0x006bf).rw("obj", FUNC(seibu_encrypted_sprite_device::read), FUNC(seibu_encrypted_sprite_device::write));
map(0x0068e, 0x0068f).nopw(); // sprite buffering
map(0x006b0, 0x006b1).w(FUNC(r2dx_v33_state::mcu_prog_w)); // could be encryption key uploads just like raiden2.cpp ?
map(0x006b2, 0x006b3).w(FUNC(r2dx_v33_state::mcu_prog_w2));
-// AM_RANGE(0x006b4, 0x006b5) AM_WRITENOP
-// AM_RANGE(0x006b6, 0x006b7) AM_WRITENOP
+// map(0x006b4, 0x006b5).nopw();
+// map(0x006b6, 0x006b7).nopw();
map(0x006bc, 0x006bd).w(FUNC(r2dx_v33_state::mcu_prog_offs_w));
-// AM_RANGE(0x006be, 0x006bf) AM_WRITENOP
+// map(0x006be, 0x006bf).nopw();
// sprite protection not 100% verified as the same
map(0x006c0, 0x006c1).rw(FUNC(r2dx_v33_state::sprite_prot_off_r), FUNC(r2dx_v33_state::sprite_prot_off_w));
@@ -426,7 +421,7 @@ void r2dx_v33_state::rdx_v33_map(address_map &map)
map(0x006dc, 0x006dd).rw(FUNC(r2dx_v33_state::sprite_prot_maxx_r), FUNC(r2dx_v33_state::sprite_prot_maxx_w));
map(0x006de, 0x006df).w(FUNC(r2dx_v33_state::sprite_prot_src_w));
- map(0x00700, 0x00701).w(FUNC(r2dx_v33_state::rdx_v33_eeprom_w));
+ map(0x00700, 0x00700).w(FUNC(r2dx_v33_state::rdx_v33_eeprom_w));
map(0x00740, 0x00741).r(FUNC(r2dx_v33_state::r2dx_debug_r));
map(0x00744, 0x00745).portr("INPUT");
map(0x0074c, 0x0074d).portr("SYSTEM");
@@ -439,13 +434,13 @@ void r2dx_v33_state::rdx_v33_map(address_map &map)
map(0x0c000, 0x0c7ff).ram().share("spriteram");
map(0x0c800, 0x0cfff).ram();
- map(0x0d000, 0x0d7ff).ram(); //_WRITE(background_w) AM_SHARE("back_data")
- map(0x0d800, 0x0dfff).ram(); //_WRITE(foreground_w) AM_SHARE("fore_data")
- map(0x0e000, 0x0e7ff).ram(); //_WRITE(midground_w) AM_SHARE("mid_data")
- map(0x0e800, 0x0f7ff).ram(); //_WRITE(text_w) AM_SHARE("text_data")
+ map(0x0d000, 0x0d7ff).ram(); //.w(FUNC(r2dx_v33_state::background_w)).share("back_data");
+ map(0x0d800, 0x0dfff).ram(); //.w(FUNC(r2dx_v33_state::foreground_w).share("fore_data");
+ map(0x0e000, 0x0e7ff).ram(); //.w(FUNC(r2dx_v33_state::midground_w).share("mid_data");
+ map(0x0e800, 0x0f7ff).ram(); //.w(FUNC(r2dx_v33_state::text_w).share("text_data");
map(0x0f800, 0x0ffff).ram(); /* Stack area */
map(0x10000, 0x1efff).ram();
- map(0x1f000, 0x1ffff).ram(); //_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
+ map(0x1f000, 0x1ffff).ram(); //.w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x20000, 0x2ffff).bankr("mainbank1").nopw();
map(0x30000, 0xfffff).bankr("mainbank2").nopw();
@@ -459,7 +454,7 @@ void r2dx_v33_state::nzeroteam_base_map(address_map &map)
map(0x00400, 0x00401).w(FUNC(r2dx_v33_state::tilemapdma_w)); // tilemaps to private buffer
map(0x00402, 0x00403).w(FUNC(r2dx_v33_state::paldma_w)); // palettes to private buffer
// 0x404 is bank on r2dx, this doesn't need it
- // AM_RANGE(0x00406, 0x00406) AM_WRITE(tile_bank_w) // not the same?
+ // map(0x00406, 0x00406).w(FUNC(r2dx_v33_state::tile_bank_w)); // not the same?
map(0x00406, 0x00407).noprw(); // always 6022, supposed to be the tile bank but ignores the actual value???
@@ -485,7 +480,7 @@ void r2dx_v33_state::nzeroteam_base_map(address_map &map)
// map(0x006d8, 0x006d9).w(FUNC(r2dx_v33_state::bbbbll_w)); // scroll?
// map(0x006dc, 0x006dd).r(FUNC(r2dx_v33_state::nzerotea_unknown_r));
// map(0x006de, 0x006df).w(FUNC(r2dx_v33_state::mcu_unkaa_w)); // mcu command related?
-// map(0x00700, 0x00701).w(FUNC(r2dx_v33_state::rdx_v33_eeprom_w));
+// map(0x00700, 0x00700).w(FUNC(r2dx_v33_state::rdx_v33_eeprom_w));
// map(0x00762, 0x00763).r(FUNC(r2dx_v33_state::nzerotea_unknown_r));
@@ -517,9 +512,9 @@ void r2dx_v33_state::nzerotea_map(address_map &map)
map(0x0074c, 0x0074d).portr("SYSTEM");
}
-WRITE16_MEMBER(r2dx_v33_state::zerotm2k_eeprom_w)
+void r2dx_v33_state::zerotm2k_eeprom_w(u16 data)
{
-// printf("zerotm2k_eeprom_w %04x %04x\n", data, mem_mask);
+// printf("zerotm2k_eeprom_w %04x\n", data);
m_eeprom->clk_write((data & 0x02) ? ASSERT_LINE : CLEAR_LINE);
m_eeprom->di_write((data & 0x04) >> 2);
@@ -853,10 +848,10 @@ void r2dx_v33_state::init_zerotm2k()
// no sprite encryption(!)
// BG tile rom has 2 lines swapped
- uint8_t *src = memregion("gfx2")->base()+0x100000;
+ u8 *src = memregion("gfx2")->base()+0x100000;
const int len = 0x080000;
- std::vector<uint8_t> buffer(len);
+ std::vector<u8> buffer(len);
for (int i = 0; i < len; i ++)
buffer[i] = src[bitswap<32>(i,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,5,6,4,3,2,1,0)];
memcpy(src, &buffer[0], len);
@@ -965,7 +960,6 @@ ROM_START( r2dx_v33_r2 )
ROM_LOAD32_WORD( "obj1.724", 0x000000, 0x400000, CRC(7d218985) SHA1(777241a533defcbea3d7e735f309478d260bad52) )
ROM_LOAD32_WORD( "obj2.725", 0x000002, 0x400000, CRC(891b24d6) SHA1(74f89b47b1ba6b84ddd96d1fae92fddad0ace342) )
-
ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples */
ROM_LOAD( "pcm.099", 0x00000, 0x100000, CRC(97ca2907) SHA1(bfe8189300cf72089d0beaeab8b1a0a1a4f0a5b6) )
diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp
index 6701e868533..1b6a0ed49fc 100644
--- a/src/mame/drivers/raiden2.cpp
+++ b/src/mame/drivers/raiden2.cpp
@@ -220,21 +220,21 @@ void raiden2_state::machine_start()
}
/*
-uint16_t raiden2_state::rps()
+u16 raiden2_state::rps()
{
return m_maincpu->state_int(NEC_CS);
}
-uint16_t raiden2_state::rpc()
+u16 raiden2_state::rpc()
{
return m_maincpu->state_int(NEC_IP);
}
*/
-void raiden2_state::combine32(uint32_t *val, int offset, uint16_t data, uint16_t mem_mask)
+void raiden2_state::combine32(u32 *val, offs_t offset, u16 data, u16 mem_mask)
{
- uint16_t *dest = (uint16_t *)val + BYTE_XOR_LE(offset);
+ u16 *dest = (u16 *)val + BYTE_XOR_LE(offset);
COMBINE_DATA(dest);
}
@@ -265,73 +265,80 @@ void raiden2_state::sprcpt_init()
}
-WRITE16_MEMBER(raiden2_state::sprcpt_adr_w)
+void raiden2_state::sprcpt_adr_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(&m_sprcpt_adr, offset, data, mem_mask);
}
-WRITE16_MEMBER(raiden2_state::sprcpt_data_1_w)
+void raiden2_state::sprcpt_data_1_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(m_sprcpt_data_1+m_sprcpt_adr, offset, data, mem_mask);
}
-WRITE16_MEMBER(raiden2_state::sprcpt_data_2_w)
+void raiden2_state::sprcpt_data_2_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(m_sprcpt_data_2+m_sprcpt_adr, offset, data, mem_mask);
}
-WRITE16_MEMBER(raiden2_state::sprcpt_data_3_w)
+void raiden2_state::sprcpt_data_3_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(m_sprcpt_data_3+m_sprcpt_idx, offset, data, mem_mask);
- if(offset == 1) {
+ if (offset == 1)
+ {
m_sprcpt_idx ++;
- if(m_sprcpt_idx == 6)
+ if (m_sprcpt_idx == 6)
m_sprcpt_idx = 0;
}
}
-WRITE16_MEMBER(raiden2_state::sprcpt_data_4_w)
+void raiden2_state::sprcpt_data_4_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(m_sprcpt_data_4+m_sprcpt_idx, offset, data, mem_mask);
- if(offset == 1) {
+ if (offset == 1)
+ {
m_sprcpt_idx ++;
- if(m_sprcpt_idx == 4)
+ if (m_sprcpt_idx == 4)
m_sprcpt_idx = 0;
}
}
-WRITE16_MEMBER(raiden2_state::sprcpt_val_1_w)
+void raiden2_state::sprcpt_val_1_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(m_sprcpt_val+0, offset, data, mem_mask);
}
-WRITE16_MEMBER(raiden2_state::sprcpt_val_2_w)
+void raiden2_state::sprcpt_val_2_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(m_sprcpt_val+1, offset, data, mem_mask);
}
-WRITE16_MEMBER(raiden2_state::sprcpt_flags_1_w)
+void raiden2_state::sprcpt_flags_1_w(offs_t offset, u16 data, u16 mem_mask)
{
combine32(&m_sprcpt_flags1, offset, data, mem_mask);
- if(offset == 1) {
+ if (offset == 1)
+ {
// bit 31: 1 = allow write on sprcpt data
- if(!(m_sprcpt_flags1 & 0x80000000U)) {
+ if (!(m_sprcpt_flags1 & 0x80000000U))
+ {
// Upload finished
- if(1) {
+ if (1)
+ {
int i;
logerror("sprcpt_val 1: %08x\n", m_sprcpt_val[0]);
logerror("sprcpt_val 2: %08x\n", m_sprcpt_val[1]);
logerror("sprcpt_data 1:\n");
- for(i=0; i<0x100; i++) {
+ for (i=0; i<0x100; i++)
+ {
logerror(" %08x", m_sprcpt_data_1[i]);
- if(!((i+1) & 7))
+ if (!((i+1) & 7))
logerror("\n");
}
logerror("sprcpt_data 2:\n");
- for(i=0; i<0x40; i++) {
+ for (i=0; i<0x40; i++)
+ {
logerror(" %08x", m_sprcpt_data_2[i]);
- if(!((i+1) & 7))
+ if (!((i+1) & 7))
logerror("\n");
}
}
@@ -339,11 +346,13 @@ WRITE16_MEMBER(raiden2_state::sprcpt_flags_1_w)
}
}
-WRITE16_MEMBER(raiden2_state::sprcpt_flags_2_w)
+void raiden2_state::sprcpt_flags_2_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_sprcpt_flags2);
- if(offset == 0) {
- if(m_sprcpt_flags2 & 0x8000) {
+ if (offset == 0)
+ {
+ if (m_sprcpt_flags2 & 0x8000)
+ {
// Reset decryption -> redo it
}
}
@@ -401,7 +410,7 @@ MACHINE_RESET_MEMBER(raiden2_state,xsedae)
sprcpt_init();
}
-WRITE8_MEMBER(raiden2_state::raiden2_bank_w)
+void raiden2_state::raiden2_bank_w(u8 data)
{
int bb = (~data >> 7) & 1;
logerror("select bank %d %04x\n", (data >> 7) & 1, data);
@@ -411,48 +420,48 @@ WRITE8_MEMBER(raiden2_state::raiden2_bank_w)
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_x_w)
+void raiden2_state::sprite_prot_x_w(u16 data)
{
m_sprite_prot_x = data;
//popmessage("%04x %04x",m_sprite_prot_x,m_sprite_prot_y);
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_y_w)
+void raiden2_state::sprite_prot_y_w(u16 data)
{
m_sprite_prot_y = data;
//popmessage("%04x %04x",m_sprite_prot_x,m_sprite_prot_y);
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_src_seg_w)
+void raiden2_state::sprite_prot_src_seg_w(u16 data)
{
m_sprite_prot_src_addr[0] = data;
}
-READ16_MEMBER(raiden2_state::sprite_prot_src_seg_r)
+u16 raiden2_state::sprite_prot_src_seg_r()
{
return m_sprite_prot_src_addr[0];
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_src_w)
+void raiden2_state::sprite_prot_src_w(address_space &space, u16 data)
{
m_sprite_prot_src_addr[1] = data;
- uint32_t src = (m_sprite_prot_src_addr[0]<<4)+m_sprite_prot_src_addr[1];
+ u32 src = (m_sprite_prot_src_addr[0]<<4)+m_sprite_prot_src_addr[1];
int x = int16_t((space.read_dword(src+0x08) >> 16) - (m_sprite_prot_x));
int y = int16_t((space.read_dword(src+0x04) >> 16) - (m_sprite_prot_y));
- uint16_t head1 = space.read_word(src+m_cop_spr_off);
- uint16_t head2 = space.read_word(src+m_cop_spr_off+2);
+ u16 head1 = space.read_word(src+m_cop_spr_off);
+ u16 head2 = space.read_word(src+m_cop_spr_off+2);
int w = (((head1 >> 8 ) & 7) + 1) << 4;
int h = (((head1 >> 12) & 7) + 1) << 4;
- uint16_t flag = x-w/2 > -w && x-w/2 < m_cop_spr_maxx+w && y-h/2 > -h && y-h/2 < 256+h ? 1 : 0;
+ u16 flag = x-w/2 > -w && x-w/2 < m_cop_spr_maxx+w && y-h/2 > -h && y-h/2 < 256+h ? 1 : 0;
flag = (space.read_word(src) & 0xfffe) | flag;
space.write_word(src, flag);
- if(flag & 1)
+ if (flag & 1)
{
space.write_word(m_dst1, head1);
space.write_word(m_dst1+2, head2);
@@ -465,32 +474,32 @@ WRITE16_MEMBER(raiden2_state::sprite_prot_src_w)
//machine().debug_break();
}
-READ16_MEMBER(raiden2_state::sprite_prot_dst1_r)
+u16 raiden2_state::sprite_prot_dst1_r()
{
return m_dst1;
}
-READ16_MEMBER(raiden2_state::sprite_prot_maxx_r)
+u16 raiden2_state::sprite_prot_maxx_r()
{
return m_cop_spr_maxx;
}
-READ16_MEMBER(raiden2_state::sprite_prot_off_r)
+u16 raiden2_state::sprite_prot_off_r()
{
return m_cop_spr_off;
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_dst1_w)
+void raiden2_state::sprite_prot_dst1_w(u16 data)
{
m_dst1 = data;
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_maxx_w)
+void raiden2_state::sprite_prot_maxx_w(u16 data)
{
m_cop_spr_maxx = data;
}
-WRITE16_MEMBER(raiden2_state::sprite_prot_off_w)
+void raiden2_state::sprite_prot_off_w(u16 data)
{
m_cop_spr_off = data;
}
@@ -2804,7 +2813,7 @@ ROM_START( xsedae )
ROM_LOAD( "9.u105.4a", 0x00000, 0x40000, CRC(a7a0c5f9) SHA1(7882681ac152642aa4f859071f195842068b214b) )
ROM_END
-const uint16_t raiden2_state::raiden_blended_colors[] = {
+const u16 raiden2_state::raiden_blended_colors[] = {
// bridge tunnel entrance shadow
0x380,
@@ -2852,11 +2861,11 @@ const uint16_t raiden2_state::raiden_blended_colors[] = {
0xffff,
};
-void raiden2_state::init_blending(const uint16_t *table)
+void raiden2_state::init_blending(const u16 *table)
{
- for(auto & elem : m_blend_active)
+ for (auto & elem : m_blend_active)
elem = false;
- while(*table != 0xffff)
+ while (*table != 0xffff)
m_blend_active[*table++] = true;
}
@@ -2880,7 +2889,7 @@ void raiden2_state::init_raidendx()
raiden2_decrypt_sprites(machine());
}
-const uint16_t raiden2_state::xsedae_blended_colors[] = {
+const u16 raiden2_state::xsedae_blended_colors[] = {
0xffff,
};
@@ -2892,7 +2901,7 @@ void raiden2_state::init_xsedae()
/* doesn't have banking */
}
-const uint16_t raiden2_state::zeroteam_blended_colors[] = {
+const u16 raiden2_state::zeroteam_blended_colors[] = {
// Player selection
0x37e,
// Boss spear shadow
diff --git a/src/mame/includes/raiden2.h b/src/mame/includes/raiden2.h
index 7791a240606..eb196ab0815 100644
--- a/src/mame/includes/raiden2.h
+++ b/src/mame/includes/raiden2.h
@@ -57,12 +57,12 @@ public:
void init_raiden2();
protected:
- std::unique_ptr<uint16_t[]> m_back_data;
- std::unique_ptr<uint16_t[]> m_fore_data;
- std::unique_ptr<uint16_t[]> m_mid_data;
- std::unique_ptr<uint16_t[]> m_text_data; // private buffers, allocated in init
- std::unique_ptr<uint16_t[]> m_palette_data;
- required_shared_ptr<uint16_t> m_spriteram;
+ std::unique_ptr<u16[]> m_back_data;
+ std::unique_ptr<u16[]> m_fore_data;
+ std::unique_ptr<u16[]> m_mid_data;
+ std::unique_ptr<u16[]> m_text_data; // private buffers, allocated in init
+ std::unique_ptr<u16[]> m_palette_data;
+ required_shared_ptr<u16> m_spriteram;
required_device<cpu_device> m_maincpu;
optional_device<seibu_sound_device> m_seibu_sound;
required_device<gfxdecode_device> m_gfxdecode;
@@ -71,47 +71,47 @@ protected:
optional_memory_bank_array<2> m_mainbank;
optional_device<raiden2cop_device> m_raiden2cop;
- DECLARE_WRITE16_MEMBER(sprite_prot_x_w);
- DECLARE_WRITE16_MEMBER(sprite_prot_y_w);
- DECLARE_WRITE16_MEMBER(sprite_prot_src_seg_w);
- DECLARE_WRITE16_MEMBER(sprite_prot_src_w);
- DECLARE_READ16_MEMBER(sprite_prot_src_seg_r);
- DECLARE_READ16_MEMBER(sprite_prot_dst1_r);
- DECLARE_READ16_MEMBER(sprite_prot_maxx_r);
- DECLARE_READ16_MEMBER(sprite_prot_off_r);
- DECLARE_WRITE16_MEMBER(sprite_prot_dst1_w);
- DECLARE_WRITE16_MEMBER(sprite_prot_maxx_w);
- DECLARE_WRITE16_MEMBER(sprite_prot_off_w);
-
- uint16_t m_sprite_prot_x,m_sprite_prot_y,m_dst1,m_cop_spr_maxx,m_cop_spr_off;
- uint16_t m_sprite_prot_src_addr[2];
+ void sprite_prot_x_w(u16 data);
+ void sprite_prot_y_w(u16 data);
+ void sprite_prot_src_seg_w(u16 data);
+ void sprite_prot_src_w(address_space &space, u16 data);
+ u16 sprite_prot_src_seg_r();
+ u16 sprite_prot_dst1_r();
+ u16 sprite_prot_maxx_r();
+ u16 sprite_prot_off_r();
+ void sprite_prot_dst1_w(u16 data);
+ void sprite_prot_maxx_w(u16 data);
+ void sprite_prot_off_w(u16 data);
+
+ u16 m_sprite_prot_x,m_sprite_prot_y,m_dst1,m_cop_spr_maxx,m_cop_spr_off;
+ u16 m_sprite_prot_src_addr[2];
INTERRUPT_GEN_MEMBER(interrupt);
void common_save_state();
virtual void video_start() override;
- DECLARE_WRITE16_MEMBER(tilemap_enable_w);
- DECLARE_WRITE16_MEMBER(tile_scroll_w);
- DECLARE_WRITE16_MEMBER(background_w);
- DECLARE_WRITE16_MEMBER(foreground_w);
- DECLARE_WRITE16_MEMBER(midground_w);
- DECLARE_WRITE16_MEMBER(text_w);
+ void tilemap_enable_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void tile_scroll_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void background_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void foreground_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void midground_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void text_w(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_WRITE16_MEMBER(m_videoram_private_w);
void bank_reset(int bgbank, int fgbank, int midbank, int txbank);
- static uint16_t const raiden_blended_colors[];
- static uint16_t const xsedae_blended_colors[];
- static uint16_t const zeroteam_blended_colors[];
+ static u16 const raiden_blended_colors[];
+ static u16 const xsedae_blended_colors[];
+ static u16 const zeroteam_blended_colors[];
bool m_blend_active[0x800]; // cfg
tilemap_t *m_background_layer,*m_midground_layer,*m_foreground_layer,*m_text_layer;
int m_bg_bank, m_fg_bank, m_mid_bank, m_tx_bank;
- uint16_t m_tilemap_enable;
+ u16 m_tilemap_enable;
- uint16_t m_scrollvals[6];
+ u16 m_scrollvals[6];
void draw_sprites(const rectangle &cliprect);
@@ -122,42 +122,42 @@ protected:
TILE_GET_INFO_MEMBER(get_mid_tile_info);
TILE_GET_INFO_MEMBER(get_fore_tile_info);
TILE_GET_INFO_MEMBER(get_text_tile_info);
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void blend_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind16 &source, int layer);
void tilemap_draw_and_blend(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tilemap);
- void init_blending(const uint16_t *table);
+ void init_blending(const u16 *table);
bitmap_ind16 m_tile_bitmap, m_sprite_bitmap;
void zeroteam_sound_map(address_map &map);
private:
- DECLARE_WRITE8_MEMBER(raiden2_bank_w);
- DECLARE_WRITE8_MEMBER(tile_bank_01_w);
- DECLARE_READ16_MEMBER(cop_tile_bank_2_r);
- DECLARE_WRITE16_MEMBER(cop_tile_bank_2_w);
- DECLARE_WRITE16_MEMBER(raidendx_cop_bank_2_w);
+ void raiden2_bank_w(u8 data);
+ void tile_bank_01_w(u8 data);
+ u16 cop_tile_bank_2_r();
+ void cop_tile_bank_2_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void raidendx_cop_bank_2_w(offs_t offset, u16 data, u16 mem_mask = ~0);
uint8_t m_prg_bank;
- uint16_t m_cop_bank;
+ u16 m_cop_bank;
- DECLARE_WRITE16_MEMBER(sprcpt_val_1_w);
- DECLARE_WRITE16_MEMBER(sprcpt_val_2_w);
- DECLARE_WRITE16_MEMBER(sprcpt_data_1_w);
- DECLARE_WRITE16_MEMBER(sprcpt_data_2_w);
- DECLARE_WRITE16_MEMBER(sprcpt_data_3_w);
- DECLARE_WRITE16_MEMBER(sprcpt_data_4_w);
- DECLARE_WRITE16_MEMBER(sprcpt_adr_w);
- DECLARE_WRITE16_MEMBER(sprcpt_flags_1_w);
- DECLARE_WRITE16_MEMBER(sprcpt_flags_2_w);
+ void sprcpt_val_1_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_val_2_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_data_1_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_data_2_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_data_3_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_data_4_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_adr_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_flags_1_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+ void sprcpt_flags_2_w(offs_t offset, u16 data, u16 mem_mask = ~0);
- uint32_t m_sprcpt_adr, m_sprcpt_idx;
+ u32 m_sprcpt_adr, m_sprcpt_idx;
- uint32_t m_sprcpt_val[2], m_sprcpt_flags1;
- uint16_t m_sprcpt_flags2;
- uint32_t m_sprcpt_data_1[0x100], m_sprcpt_data_2[0x40], m_sprcpt_data_3[6], m_sprcpt_data_4[4];
+ u32 m_sprcpt_val[2], m_sprcpt_flags1;
+ u16 m_sprcpt_flags2;
+ u32 m_sprcpt_data_1[0x100], m_sprcpt_data_2[0x40], m_sprcpt_data_3[6], m_sprcpt_data_4[4];
virtual void machine_start() override;
DECLARE_MACHINE_RESET(raiden2);
@@ -165,7 +165,7 @@ private:
DECLARE_MACHINE_RESET(xsedae);
DECLARE_MACHINE_RESET(raidendx);
- void combine32(uint32_t *val, int offset, uint16_t data, uint16_t mem_mask);
+ void combine32(u32 *val, offs_t offset, u16 data, u16 mem_mask);
void sprcpt_init();
void raiden2_cop_mem(address_map &map);
void raiden2_mem(address_map &map);
diff --git a/src/mame/video/raiden2.cpp b/src/mame/video/raiden2.cpp
index 5679c15a296..6c795891891 100644
--- a/src/mame/video/raiden2.cpp
+++ b/src/mame/video/raiden2.cpp
@@ -18,29 +18,29 @@ WRITE16_MEMBER(raiden2_state::m_videoram_private_w)
if (offset < 0x800 / 2)
{
- background_w(space, offset, data, 0xffff);
+ background_w(offset, data, 0xffff);
}
else if (offset < 0x1000 /2)
{
offset -= 0x800 / 2;
- foreground_w(space, offset, data, 0xffff);
+ foreground_w(offset, data, 0xffff);
}
else if (offset < 0x1800/2)
{
offset -= 0x1000 / 2;
- midground_w(space, offset, data, 0xffff);
+ midground_w(offset, data, 0xffff);
}
else if (offset < 0x2800/2)
{
offset -= 0x1800 / 2;
- text_w(space, offset, data, 0xffff);
+ text_w(offset, data, 0xffff);
}
}
void raiden2_state::draw_sprites(const rectangle &cliprect)
{
- uint16_t *source = m_spriteram + (0x1000/2)-4;
+ u16 *source = m_spriteram + (0x1000/2)-4;
m_sprite_bitmap.fill(0xf, cliprect);
gfx_element *gfx = m_gfxdecode->gfx(2);
@@ -52,7 +52,8 @@ void raiden2_state::draw_sprites(const rectangle &cliprect)
06 yyyy yyyy yyyy yyyy y = ypos
*/
- while( source >= m_spriteram ){
+ while (source >= m_spriteram)
+ {
int tile_number = source[1];
int sx = source[2];
int sy = source[3];
@@ -149,39 +150,40 @@ void raiden2_state::draw_sprites(const rectangle &cliprect)
}
-WRITE16_MEMBER(raiden2_state::background_w)
+void raiden2_state::background_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_back_data[offset]);
m_background_layer->mark_tile_dirty(offset);
}
-WRITE16_MEMBER(raiden2_state::midground_w)
+void raiden2_state::midground_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_mid_data[offset]);
m_midground_layer->mark_tile_dirty(offset);
}
-WRITE16_MEMBER(raiden2_state::foreground_w)
+void raiden2_state::foreground_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_fore_data[offset]);
m_foreground_layer->mark_tile_dirty(offset);
}
-WRITE16_MEMBER(raiden2_state::text_w)
+void raiden2_state::text_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_text_data[offset]);
m_text_layer->mark_tile_dirty(offset);
}
-WRITE16_MEMBER(raiden2_state::tilemap_enable_w)
+void raiden2_state::tilemap_enable_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_tilemap_enable);
}
-WRITE16_MEMBER(raiden2_state::tile_scroll_w)
+void raiden2_state::tile_scroll_w(offs_t offset, u16 data, u16 mem_mask)
{
tilemap_t *tm = nullptr;
- switch(offset/2) {
+ switch (offset/2)
+ {
case 0: tm = m_background_layer; break;
case 1: tm = m_midground_layer; break;
case 2: tm = m_foreground_layer; break;
@@ -191,52 +193,57 @@ WRITE16_MEMBER(raiden2_state::tile_scroll_w)
COMBINE_DATA(&m_scrollvals[offset]);
data = m_scrollvals[offset];
- if(offset & 1)
+ if (offset & 1)
tm->set_scrolly(0, data);
else
tm->set_scrollx(0, data);
}
-WRITE8_MEMBER(raiden2_state::tile_bank_01_w)
+void raiden2_state::tile_bank_01_w(u8 data)
{
int new_bank;
new_bank = 0 | ((data & 1)<<1);
- if(new_bank != m_bg_bank) {
+ if (new_bank != m_bg_bank)
+ {
m_bg_bank = new_bank;
m_background_layer->mark_all_dirty();
}
new_bank = 1 | (data & 2);
- if(new_bank != m_mid_bank) {
+ if (new_bank != m_mid_bank)
+ {
m_mid_bank = new_bank;
m_midground_layer->mark_all_dirty();
}
}
-READ16_MEMBER(raiden2_state::cop_tile_bank_2_r)
+u16 raiden2_state::cop_tile_bank_2_r()
{
return m_cop_bank;
}
-WRITE16_MEMBER(raiden2_state::cop_tile_bank_2_w)
+void raiden2_state::cop_tile_bank_2_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_cop_bank);
- if(ACCESSING_BITS_8_15) {
+ if (ACCESSING_BITS_8_15)
+ {
int new_bank = 4 | (data >> 14);
- if(new_bank != m_fg_bank) {
+ if (new_bank != m_fg_bank)
+ {
m_fg_bank = new_bank;
m_foreground_layer->mark_all_dirty();
}
}
}
-WRITE16_MEMBER(raiden2_state::raidendx_cop_bank_2_w)
+void raiden2_state::raidendx_cop_bank_2_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_cop_bank);
int new_bank = 4 | ((m_cop_bank >> 4) & 3);
- if(new_bank != m_fg_bank) {
+ if (new_bank != m_fg_bank)
+ {
m_fg_bank = new_bank;
m_foreground_layer->mark_all_dirty();
}
@@ -293,12 +300,12 @@ void raiden2_state::video_start()
m_screen->register_screen_bitmap(m_tile_bitmap);
m_screen->register_screen_bitmap(m_sprite_bitmap);
- m_back_data = make_unique_clear<uint16_t[]>(0x800/2);
- m_fore_data = make_unique_clear<uint16_t[]>(0x800/2);
- m_mid_data = make_unique_clear<uint16_t[]>(0x800/2);
- m_text_data = make_unique_clear<uint16_t[]>(0x1000/2);
- m_palette_data = make_unique_clear<uint16_t[]>(0x1000/2);
- m_palette->basemem().set(m_palette_data.get(), 0x1000/2 * sizeof(uint16_t), 16, ENDIANNESS_LITTLE, 2);
+ m_back_data = make_unique_clear<u16[]>(0x800/2);
+ m_fore_data = make_unique_clear<u16[]>(0x800/2);
+ m_mid_data = make_unique_clear<u16[]>(0x800/2);
+ m_text_data = make_unique_clear<u16[]>(0x1000/2);
+ m_palette_data = make_unique_clear<u16[]>(0x1000/2);
+ m_palette->basemem().set(m_palette_data.get(), 0x1000/2 * sizeof(u16), 16, ENDIANNESS_LITTLE, 2);
save_pointer(NAME(m_back_data), 0x800/2);
save_pointer(NAME(m_fore_data), 0x800/2);
@@ -314,20 +321,23 @@ void raiden2_state::video_start()
void raiden2_state::blend_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind16 &source, int layer)
{
- if(layer == -1)
+ if (layer == -1)
return;
const pen_t *pens = &m_palette->pen(0);
layer <<= 14;
- for(int y = cliprect.min_y; y <= cliprect.max_y; y++) {
- const uint16_t *src = &source.pix16(y, cliprect.min_x);
- uint32_t *dst = &bitmap.pix32(y, cliprect.min_x);
- for(int x = cliprect.min_x; x <= cliprect.max_x; x++) {
- uint16_t val = *src++;
- if((val & 0xc000) == layer && (val & 0x000f) != 0x000f) {
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ {
+ const u16 *src = &source.pix16(y, cliprect.min_x);
+ u32 *dst = &bitmap.pix32(y, cliprect.min_x);
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ {
+ u16 val = *src++;
+ if ((val & 0xc000) == layer && (val & 0x000f) != 0x000f)
+ {
val &= 0x07ff;
- if(m_blend_active[val])
+ if (m_blend_active[val])
*dst = alpha_blend_r32(*dst, pens[val], 0x7f);
else
*dst = pens[val];
@@ -343,10 +353,11 @@ void raiden2_state::tilemap_draw_and_blend(screen_device &screen, bitmap_rgb32 &
blend_layer(bitmap, cliprect, m_tile_bitmap, 0);
}
-uint32_t raiden2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+u32 raiden2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->black_pen(), cliprect);
- if (!(m_tilemap_enable & 16)) {
+ if (!(m_tilemap_enable & 16))
+ {
draw_sprites(cliprect);
blend_layer(bitmap, cliprect, m_sprite_bitmap, m_cur_spri[0]);