summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar cam900 <dbtlrchl@naver.com>2019-03-31 00:46:40 +0900
committerGravatarGravatar R. Belmont <rb6502@users.noreply.github.com>2019-03-30 11:46:40 -0400
commiteee5a80ae0afa1e4b515d196f602bd4937ff2daa (patch) (github)
tree9b341eaf810950c791de822fd5291e5a8d378889
parentca6826c0e4a9d173cdd7f6ebcc55f157e1dd0ec7 (diff)
downloadmame-eee5a80ae0afa1e4b515d196f602bd4937ff2daa.tar.bz2
mame-eee5a80ae0afa1e4b515d196f602bd4937ff2daa.zip
itech32.cpp : Updates (#4726)
* itech32.cpp : Updates Simplify handlers, Reduce unncesessary ACCESSING_BITs, Duplicates, Runtime tag lookups, Fix some namings, Use shorter type values * itech32.cpp : Default mem_mask values
-rw-r--r--src/mame/drivers/itech32.cpp222
-rw-r--r--src/mame/includes/itech32.h175
-rw-r--r--src/mame/video/itech32.cpp187
3 files changed, 252 insertions, 332 deletions
diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp
index 6ae1439c9cc..23b1348ca77 100644
--- a/src/mame/drivers/itech32.cpp
+++ b/src/mame/drivers/itech32.cpp
@@ -403,7 +403,7 @@ WRITE_LINE_MEMBER(itech32_state::generate_int1)
}
-WRITE16_MEMBER(itech32_state::int1_ack_w)
+void itech32_state::int1_ack_w(u16 data)
{
update_interrupts(0, -1, -1);
}
@@ -418,7 +418,7 @@ WRITE16_MEMBER(itech32_state::int1_ack_w)
void itech32_state::machine_start()
{
- membank("soundbank")->configure_entries(0, 256, memregion("soundcpu")->base() + 0x10000, 0x4000);
+ m_soundbank->configure_entries(0, 256, memregion("soundcpu")->base() + 0x10000, 0x4000);
m_irq_base = 0;
save_item(NAME(m_vint_state));
@@ -461,8 +461,8 @@ void drivedge_state::machine_reset()
{
itech32_state::machine_reset();
- m_dsp1->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
- m_dsp2->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+ m_dsp[0]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+ m_dsp[1]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
STOP_TMS_SPINNING(machine(), 0);
STOP_TMS_SPINNING(machine(), 1);
@@ -470,6 +470,19 @@ void drivedge_state::machine_reset()
}
+/*************************************
+ *
+ * Color latches
+ *
+ *************************************/
+
+
+template<unsigned Layer>
+void itech32_state::color_w(u8 data)
+{
+ m_color_latch[Layer] = (data & 0x7f) << 8;
+}
+
/*************************************
*
@@ -486,7 +499,7 @@ CUSTOM_INPUT_MEMBER(itech32_state::special_port_r)
return m_special_result;
}
-READ16_MEMBER(itech32_state::trackball_r)
+u8 itech32_state::trackball_r()
{
int lower = ioport("TRACKX1")->read();
int upper = ioport("TRACKY1")->read();
@@ -494,7 +507,7 @@ READ16_MEMBER(itech32_state::trackball_r)
return (lower & 15) | ((upper & 15) << 4);
}
-READ16_MEMBER(itech32_state::trackball_p2_r)
+u8 itech32_state::trackball_p2_r()
{
int lower = ioport("TRACKX2")->read();
int upper = ioport("TRACKY2")->read();
@@ -503,7 +516,7 @@ READ16_MEMBER(itech32_state::trackball_p2_r)
}
-READ32_MEMBER(itech32_state::trackball32_8bit_r)
+u16 itech32_state::trackball_8bit_r()
{
int lower = ioport("TRACKX1")->read();
int upper = ioport("TRACKY1")->read();
@@ -512,7 +525,7 @@ READ32_MEMBER(itech32_state::trackball32_8bit_r)
}
-READ32_MEMBER(itech32_state::trackball32_4bit_p1_r)
+u32 itech32_state::trackball32_4bit_p1_r()
{
attotime curtime = machine().time();
@@ -548,7 +561,7 @@ READ32_MEMBER(itech32_state::trackball32_4bit_p1_r)
}
-READ32_MEMBER(itech32_state::trackball32_4bit_p2_r)
+u32 itech32_state::trackball32_4bit_p2_r()
{
attotime curtime = machine().time();
@@ -584,24 +597,24 @@ READ32_MEMBER(itech32_state::trackball32_4bit_p2_r)
}
-READ32_MEMBER(itech32_state::trackball32_4bit_combined_r)
+u32 itech32_state::trackball32_4bit_combined_r()
{
- return trackball32_4bit_p1_r(space, offset, mem_mask) |
- (trackball32_4bit_p2_r(space, offset, mem_mask) << 8);
+ return trackball32_4bit_p1_r() |
+ (trackball32_4bit_p2_r() << 8);
}
-READ32_MEMBER(drivedge_state::steering_r)
+u16 drivedge_state::steering_r()
{
int val = m_steer->read() * 2 - 0x100;
if (val < 0) val = 0x100 | (-val);
- return val << 16;
+ return val;
}
-READ32_MEMBER(drivedge_state::gas_r)
+u16 drivedge_state::gas_r()
{
- return m_gas->read() << 16;
+ return m_gas->read();
}
@@ -611,27 +624,27 @@ READ32_MEMBER(drivedge_state::gas_r)
*
*************************************/
-READ16_MEMBER(itech32_state::wcbowl_prot_result_r)
+u16 itech32_state::wcbowl_prot_result_r()
{
return m_main_ram[0x111d/2];
}
-READ32_MEMBER(itech32_state::itech020_prot_result_r)
+u8 itech32_state::itech020_prot_result_r()
{
- uint32_t result = ((uint32_t *)m_main_ram.target())[m_itech020_prot_address >> 2];
+ u32 result = ((u32 *)m_main_ram.target())[m_itech020_prot_address >> 2];
result >>= (~m_itech020_prot_address & 3) * 8;
- return (result & 0xff) << 8;
+ return result & 0xff;
}
-READ32_MEMBER(itech32_state::gt2kp_prot_result_r)
+u32 itech32_state::gt2kp_prot_result_r()
{
return 0x00010000; /* 32 bit value at 680000 to 680003 will return the needed value of 0x01 */
}
-READ32_MEMBER(itech32_state::gtclass_prot_result_r)
+u32 itech32_state::gtclass_prot_result_r()
{
return 0x00008000; /* 32 bit value at 680000 to 680003 will return the needed value of 0x80 */
}
@@ -644,9 +657,9 @@ READ32_MEMBER(itech32_state::gtclass_prot_result_r)
*
*************************************/
-WRITE8_MEMBER(itech32_state::sound_bank_w)
+void itech32_state::sound_bank_w(u8 data)
{
- membank("soundbank")->set_entry(data);
+ m_soundbank->set_entry(data);
}
@@ -665,27 +678,19 @@ TIMER_CALLBACK_MEMBER(itech32_state::delayed_sound_data_w)
}
-WRITE16_MEMBER(itech32_state::sound_data_w)
-{
- if (ACCESSING_BITS_0_7)
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech32_state::delayed_sound_data_w),this), data & 0xff);
-}
-
-
-READ32_MEMBER(itech32_state::sound_data32_r)
+void itech32_state::sound_data_w(u8 data)
{
- return m_sound_return << 16;
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech32_state::delayed_sound_data_w),this), data & 0xff);
}
-WRITE32_MEMBER(itech32_state::sound_data32_w)
+u8 itech32_state::sound_return_r()
{
- if (ACCESSING_BITS_16_23)
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech32_state::delayed_sound_data_w),this), (data >> 16) & 0xff);
+ return m_sound_return;
}
-READ8_MEMBER(itech32_state::sound_data_r)
+u8 itech32_state::sound_data_r()
{
m_soundcpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
m_sound_int_state = 0;
@@ -693,13 +698,13 @@ READ8_MEMBER(itech32_state::sound_data_r)
}
-WRITE8_MEMBER(itech32_state::sound_return_w)
+void itech32_state::sound_return_w(u8 data)
{
m_sound_return = data;
}
-READ8_MEMBER(itech32_state::sound_data_buffer_r)
+u8 itech32_state::sound_data_buffer_r()
{
return 0;
}
@@ -712,7 +717,7 @@ READ8_MEMBER(itech32_state::sound_data_buffer_r)
*
*************************************/
-WRITE8_MEMBER(drivedge_state::portb_out)
+void drivedge_state::portb_out(u8 data)
{
// logerror("PIA port B write = %02x\n", data);
@@ -736,7 +741,7 @@ WRITE_LINE_MEMBER(drivedge_state::turbo_light)
}
-WRITE8_MEMBER(itech32_state::pia_portb_out)
+void itech32_state::pia_portb_out(u8 data)
{
// logerror("PIA port B write = %02x\n", data);
@@ -755,7 +760,7 @@ WRITE8_MEMBER(itech32_state::pia_portb_out)
*
*************************************/
-WRITE8_MEMBER(itech32_state::firq_clear_w)
+void itech32_state::firq_clear_w(u8 data)
{
m_soundcpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE);
}
@@ -770,8 +775,8 @@ WRITE8_MEMBER(itech32_state::firq_clear_w)
WRITE32_MEMBER(drivedge_state::tms_reset_assert_w)
{
- m_dsp1->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
- m_dsp2->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+ m_dsp[0]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
+ m_dsp[1]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
@@ -780,12 +785,12 @@ WRITE32_MEMBER(drivedge_state::tms_reset_clear_w)
/* kludge to prevent crash on first boot */
if ((m_tms1_ram[0] & 0xff000000) == 0)
{
- m_dsp1->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
+ m_dsp[0]->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
STOP_TMS_SPINNING(machine(), 0);
}
if ((m_tms2_ram[0] & 0xff000000) == 0)
{
- m_dsp2->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
+ m_dsp[1]->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
STOP_TMS_SPINNING(machine(), 1);
}
}
@@ -826,32 +831,18 @@ WRITE32_MEMBER(drivedge_state::tms2_trigger_w)
READ32_MEMBER(drivedge_state::tms1_speedup_r)
{
- if (m_tms1_ram[0x382] == 0 && m_dsp1->pc() == 0xee) START_TMS_SPINNING(0);
+ if (m_tms1_ram[0x382] == 0 && m_dsp[0]->pc() == 0xee) START_TMS_SPINNING(0);
return m_tms1_ram[0x382];
}
READ32_MEMBER(drivedge_state::tms2_speedup_r)
{
- if (m_tms2_ram[0x382] == 0 && m_dsp2->pc() == 0x809808) START_TMS_SPINNING(1);
+ if (m_tms2_ram[0x382] == 0 && m_dsp[1]->pc() == 0x809808) START_TMS_SPINNING(1);
return m_tms2_ram[0x382];
}
-
-/*************************************
- *
- * 32-bit shunts
- *
- *************************************/
-
-WRITE32_MEMBER(itech32_state::int1_ack32_w)
-{
- int1_ack_w(space, offset, data, mem_mask);
-}
-
-
-
/*************************************
*
* NVRAM read/write
@@ -863,7 +854,7 @@ void itech32_state::nvram_init(nvram_device &nvram, void *base, size_t length)
// if nvram is the main RAM, don't overwrite exception vectors
int start = (base == m_main_ram) ? 0x80 : 0x00;
for (int i = start; i < length; i++)
- ((uint8_t *)base)[i] = machine().rand();
+ ((u8 *)base)[i] = machine().rand();
}
void drivedge_state::nvram_init(nvram_device &nvram, void *base, size_t length)
@@ -871,7 +862,7 @@ void drivedge_state::nvram_init(nvram_device &nvram, void *base, size_t length)
itech32_state::nvram_init(nvram, base, length);
// due to accessing uninitialized RAM, we need this hack
- ((uint32_t *)m_main_ram.target())[0x2ce4/4] = 0x0000001e;
+ ((u32 *)m_main_ram.target())[0x2ce4/4] = 0x0000001e;
}
/*************************************
@@ -886,13 +877,14 @@ void itech32_state::timekill_map(address_map &map)
map(0x000000, 0x003fff).ram().share("nvram");
map(0x040000, 0x040001).portr("P1");
map(0x048000, 0x048001).portr("P2");
- map(0x050000, 0x050001).portr("SYSTEM").w(FUNC(itech32_state::timekill_intensity_w));
+ map(0x050000, 0x050001).portr("SYSTEM");
+ map(0x050001, 0x050001).w(FUNC(itech32_state::timekill_intensity_w));
map(0x058000, 0x058001).portr("DIPS").w("watchdog", FUNC(watchdog_timer_device::reset16_w));
- map(0x060000, 0x060001).w(FUNC(itech32_state::timekill_colora_w));
- map(0x068000, 0x068001).w(FUNC(itech32_state::timekill_colorbc_w));
+ map(0x060001, 0x060001).w(FUNC(itech32_state::timekill_colora_w));
+ map(0x068001, 0x068001).w(FUNC(itech32_state::timekill_colorbc_w));
map(0x070000, 0x070001).nopw(); /* noisy */
- map(0x078000, 0x078001).w(FUNC(itech32_state::sound_data_w));
- map(0x080000, 0x08007f).rw(FUNC(itech32_state::itech32_video_r), FUNC(itech32_state::itech32_video_w)).share("video");
+ map(0x078001, 0x078001).w(FUNC(itech32_state::sound_data_w));
+ map(0x080000, 0x08007f).rw(FUNC(itech32_state::video_r), FUNC(itech32_state::video_w)).share("video");
map(0x0a0000, 0x0a0001).w(FUNC(itech32_state::int1_ack_w));
map(0x0c0000, 0x0c7fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x100000, 0x17ffff).rom().region("user1", 0).share("main_rom");
@@ -908,13 +900,13 @@ void itech32_state::bloodstm_map(address_map &map)
map(0x180000, 0x180001).portr("P3");
map(0x200000, 0x200001).portr("P4").w("watchdog", FUNC(watchdog_timer_device::reset16_w));
map(0x280000, 0x280001).portr("DIPS");
- map(0x300000, 0x300001).w(FUNC(itech32_state::bloodstm_color1_w));
- map(0x380000, 0x380001).w(FUNC(itech32_state::bloodstm_color2_w));
+ map(0x300001, 0x300001).w(FUNC(itech32_state::color_w<0>));
+ map(0x380001, 0x380001).w(FUNC(itech32_state::color_w<1>));
map(0x400000, 0x400001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
- map(0x480000, 0x480001).w(FUNC(itech32_state::sound_data_w));
+ map(0x480001, 0x480001).w(FUNC(itech32_state::sound_data_w));
map(0x500000, 0x5000ff).rw(FUNC(itech32_state::bloodstm_video_r), FUNC(itech32_state::bloodstm_video_w)).share("video");
map(0x580000, 0x59ffff).ram().w(FUNC(itech32_state::bloodstm_paletteram_w)).share("palette");
- map(0x700000, 0x700001).w(FUNC(itech32_state::bloodstm_plane_w));
+ map(0x700001, 0x700001).w(FUNC(itech32_state::bloodstm_plane_w));
map(0x780000, 0x780001).portr("EXTRA");
map(0x800000, 0x87ffff).mirror(0x780000).rom().region("user1", 0).share("main_rom");
}
@@ -930,7 +922,7 @@ READ32_MEMBER(itech32_state::test1_r)
if (ACCESSING_BITS_16_23 && !m_written[0x100 + offset*4+1]) logerror("%06X:read from uninitialized memory %04X\n", m_maincpu->pc(), 0x100 + offset*4+1);
if (ACCESSING_BITS_8_15 && !m_written[0x100 + offset*4+2]) logerror("%06X:read from uninitialized memory %04X\n", m_maincpu->pc(), 0x100 + offset*4+2);
if (ACCESSING_BITS_0_7 && !m_written[0x100 + offset*4+3]) logerror("%06X:read from uninitialized memory %04X\n", m_maincpu->pc(), 0x100 + offset*4+3);
- return ((uint32_t *)m_main_ram)[0x100/4 + offset];
+ return ((u32 *)m_main_ram)[0x100/4 + offset];
}
WRITE32_MEMBER(itech32_state::test1_w)
@@ -939,7 +931,7 @@ WRITE32_MEMBER(itech32_state::test1_w)
if (ACCESSING_BITS_16_23) m_written[0x100 + offset*4+1] = 1;
if (ACCESSING_BITS_8_15) m_written[0x100 + offset*4+2] = 1;
if (ACCESSING_BITS_0_7) m_written[0x100 + offset*4+3] = 1;
- COMBINE_DATA(&((uint32_t *)m_main_ram)[0x100/4 + offset]);
+ COMBINE_DATA(&((u32 *)m_main_ram)[0x100/4 + offset]);
}
READ32_MEMBER(itech32_state::test2_r)
@@ -948,7 +940,7 @@ READ32_MEMBER(itech32_state::test2_r)
if (ACCESSING_BITS_16_23 && !m_written[0xc00 + offset*4+1]) logerror("%06X:read from uninitialized memory %04X\n", m_maincpu->pc(), 0xc00 + offset*4+1);
if (ACCESSING_BITS_8_15 && !m_written[0xc00 + offset*4+2]) logerror("%06X:read from uninitialized memory %04X\n", m_maincpu->pc(), 0xc00 + offset*4+2);
if (ACCESSING_BITS_0_7 && !m_written[0xc00 + offset*4+3]) logerror("%06X:read from uninitialized memory %04X\n", m_maincpu->pc(), 0xc00 + offset*4+3);
- return ((uint32_t *)m_main_ram)[0xc00/4 + offset];
+ return ((u32 *)m_main_ram)[0xc00/4 + offset];
}
WRITE32_MEMBER(itech32_state::test2_w)
@@ -957,7 +949,7 @@ WRITE32_MEMBER(itech32_state::test2_w)
if (ACCESSING_BITS_16_23) m_written[0xc00 + offset*4+1] = 1;
if (ACCESSING_BITS_8_15) m_written[0xc00 + offset*4+2] = 1;
if (ACCESSING_BITS_0_7) m_written[0xc00 + offset*4+3] = 1;
- COMBINE_DATA(&((uint32_t *)m_main_ram)[0xc00/4 + offset]);
+ COMBINE_DATA(&((u32 *)m_main_ram)[0xc00/4 + offset]);
}
#endif
@@ -970,17 +962,18 @@ map(0x000c00, 0x007fff).mirror(0x40000).rw(FUNC(itech32_state::test2_r), FUNC(it
#endif
map(0x080000, 0x080003).portr("80000");
map(0x082000, 0x082003).portr("82000");
- map(0x084000, 0x084003).rw(FUNC(drivedge_state::sound_data32_r), FUNC(drivedge_state::sound_data32_w));
+ map(0x084001, 0x084001).rw(FUNC(drivedge_state::sound_return_r), FUNC(drivedge_state::sound_data_w));
// AM_RANGE(0x086000, 0x08623f) AM_RAM -- networking -- first 0x40 bytes = our data, next 0x40*8 bytes = their data, r/w on IRQ2
- map(0x088000, 0x088003).r(FUNC(drivedge_state::steering_r));
- map(0x08a000, 0x08a003).r(FUNC(drivedge_state::gas_r)).nopw();
+ map(0x088000, 0x088001).r(FUNC(drivedge_state::steering_r));
+ map(0x08a000, 0x08a001).r(FUNC(drivedge_state::gas_r));
+ map(0x08a000, 0x08a003).nopw();
map(0x08c000, 0x08c003).portr("8c000");
map(0x08e000, 0x08e003).portr("8e000").nopw();
map(0x100000, 0x10000f).w(FUNC(drivedge_state::zbuf_control_w)).share("zctl");
- map(0x180000, 0x180003).w(FUNC(drivedge_state::color0_w));
+ map(0x180001, 0x180001).w(FUNC(drivedge_state::color_w<0>));
map(0x1a0000, 0x1bffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
map(0x1c0000, 0x1c0003).nopw();
- map(0x1e0000, 0x1e0113).rw(FUNC(drivedge_state::itech020_video_r), FUNC(drivedge_state::itech020_video_w)).share("video");
+ map(0x1e0000, 0x1e0113).rw(FUNC(drivedge_state::bloodstm_video_r), FUNC(drivedge_state::bloodstm_video_w)).share("video");
map(0x1e4000, 0x1e4003).w(FUNC(drivedge_state::tms_reset_assert_w));
map(0x1ec000, 0x1ec003).w(FUNC(drivedge_state::tms_reset_clear_w));
map(0x200000, 0x200003).portr("200000");
@@ -1008,23 +1001,24 @@ void drivedge_state::tms2_map(address_map &map)
void itech32_state::itech020_map(address_map &map)
{
map(0x000000, 0x007fff).ram().share("main_ram");
- map(0x080000, 0x080003).portr("P1").w(FUNC(itech32_state::int1_ack32_w));
+ map(0x080000, 0x080003).portr("P1").w(FUNC(itech32_state::int1_ack_w));
map(0x100000, 0x100003).portr("P2");
map(0x180000, 0x180003).portr("P3");
map(0x200000, 0x200003).portr("P4");
map(0x280000, 0x280003).portr("DIPS");
- map(0x300000, 0x300003).w(FUNC(itech32_state::itech020_color1_w));
- map(0x380000, 0x380003).w(FUNC(itech32_state::itech020_color2_w));
+ map(0x300003, 0x300003).w(FUNC(itech32_state::color_w<1>));
+ map(0x380003, 0x380003).w(FUNC(itech32_state::color_w<0>));
map(0x400000, 0x400003).w("watchdog", FUNC(watchdog_timer_device::reset32_w));
- map(0x480000, 0x480003).w(FUNC(itech32_state::sound_data32_w));
- map(0x500000, 0x5000ff).rw(FUNC(itech32_state::itech020_video_r), FUNC(itech32_state::itech020_video_w)).share("video");
+ map(0x480001, 0x480001).w(FUNC(itech32_state::sound_data_w));
+ map(0x500000, 0x5000ff).rw(FUNC(itech32_state::bloodstm_video_r), FUNC(itech32_state::bloodstm_video_w)).share("video");
map(0x578000, 0x57ffff).nopr(); /* touched by protection */
map(0x580000, 0x59ffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
map(0x600000, 0x603fff).ram().share("nvram");
/* ? */ map(0x61ff00, 0x61ffff).nopw(); /* Unknown Writes */
- map(0x680000, 0x680003).r(FUNC(itech32_state::itech020_prot_result_r)).nopw();
+ map(0x680002, 0x680002).r(FUNC(itech32_state::itech020_prot_result_r));
+ map(0x680000, 0x680003).nopw();
/* ! */ map(0x680800, 0x68083f).readonly().nopw(); /* Serial DUART Channel A/B & Top LED sign - To Do! */
- map(0x700000, 0x700003).w(FUNC(itech32_state::itech020_plane_w));
+ map(0x700002, 0x700002).w(FUNC(itech32_state::itech020_plane_w));
map(0x800000, 0xbfffff).rom().region("user1", 0).share("main_rom");
}
@@ -1684,7 +1678,7 @@ void itech32_state::base_devices(machine_config &config)
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
m_screen->set_raw(VIDEO_CLOCK, 508, 0, 384, 262, 0, 240); // most games configure the screen this way
// m_screen->set_raw(VIDEO_CLOCK, 508, 0, 384, 286, 0, 256); // sftm, wcbowl and shufshot configure it this way
- m_screen->set_screen_update(FUNC(itech32_state::screen_update_itech32));
+ m_screen->set_screen_update(FUNC(itech32_state::screen_update));
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(itech32_state::generate_int1));
@@ -1738,11 +1732,11 @@ void drivedge_state::drivedge(machine_config &config)
M68EC020(config, m_maincpu, CPU020_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &drivedge_state::main_map);
- TMS32031(config, m_dsp1, TMS_CLOCK);
- m_dsp1->set_addrmap(AS_PROGRAM, &drivedge_state::tms1_map);
+ TMS32031(config, m_dsp[0], TMS_CLOCK);
+ m_dsp[0]->set_addrmap(AS_PROGRAM, &drivedge_state::tms1_map);
- TMS32031(config, m_dsp2, TMS_CLOCK);
- m_dsp2->set_addrmap(AS_PROGRAM, &drivedge_state::tms2_map);
+ TMS32031(config, m_dsp[1], TMS_CLOCK);
+ m_dsp[1]->set_addrmap(AS_PROGRAM, &drivedge_state::tms2_map);
m_palette->set_format(palette_device::xBGR_888, 32768);
@@ -4454,8 +4448,8 @@ void drivedge_state::driver_init()
m_vram_height = 1024;
m_planes = 1;
- m_dsp1->space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(drivedge_state::tms1_speedup_r),this));
- m_dsp2->space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(drivedge_state::tms2_speedup_r),this));
+ m_dsp[0]->space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(drivedge_state::tms1_speedup_r),this));
+ m_dsp[1]->space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(drivedge_state::tms2_speedup_r),this));
}
@@ -4471,10 +4465,10 @@ void itech32_state::init_wcbowl()
m_vram_height = 1024;
m_planes = 1;
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680001, read16_delegate(FUNC(itech32_state::trackball_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680001, read8smo_delegate(FUNC(itech32_state::trackball_r),this), 0x00ff);
m_maincpu->space(AS_PROGRAM).nop_read(0x578000, 0x57ffff);
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680080, 0x680081, read16_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680080, 0x680081, read16smo_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this));
m_maincpu->space(AS_PROGRAM).nop_write(0x680080, 0x680081);
}
@@ -4491,11 +4485,11 @@ void itech32_state::init_wcbowlj()
m_vram_height = 1024;
m_planes = 1;
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680001, read16_delegate(FUNC(itech32_state::trackball_r),this));
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680040, 0x680041, read16_delegate(FUNC(itech32_state::trackball_p2_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680001, read8smo_delegate(FUNC(itech32_state::trackball_r),this), 0x00ff);
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680040, 0x680041, read8smo_delegate(FUNC(itech32_state::trackball_p2_r),this), 0x00ff);
m_maincpu->space(AS_PROGRAM).nop_read(0x578000, 0x57ffff);
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680080, 0x680081, read16_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680080, 0x680081, read16smo_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this));
m_maincpu->space(AS_PROGRAM).nop_write(0x680080, 0x680081);
}
@@ -4508,8 +4502,8 @@ void itech32_state::init_sftm_common(int prot_addr)
m_itech020_prot_address = prot_addr;
- m_maincpu->space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),this));
- m_maincpu->space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),this));
+ m_maincpu->space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write8smo_delegate(FUNC(itech32_state::color_w<0>),this), 0x000000ff);
+ m_maincpu->space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write8smo_delegate(FUNC(itech32_state::color_w<1>),this), 0x000000ff);
}
@@ -4538,10 +4532,10 @@ void itech32_state::init_shuffle_bowl_common(int prot_addr)
m_itech020_prot_address = prot_addr;
- m_maincpu->space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),this));
- m_maincpu->space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),this));
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this));
+ m_maincpu->space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write8smo_delegate(FUNC(itech32_state::color_w<0>),this), 0x000000ff);
+ m_maincpu->space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write8smo_delegate(FUNC(itech32_state::color_w<1>),this), 0x000000ff);
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32smo_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32smo_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this));
}
@@ -4589,7 +4583,7 @@ void itech32_state::init_gt3d()
Hacked versions of this PCB have been found with GT97
through GTClassic. This is _NOT_ a factory modification
*/
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_8bit_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read16smo_delegate(FUNC(itech32_state::trackball_8bit_r),this), 0x0000ffff);
init_gt_common();
}
@@ -4602,8 +4596,8 @@ void itech32_state::init_aama()
board share the same sound CPU code and sample ROMs.
This board has all versions of GT for it, GT3D through GTClassic
*/
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32smo_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32smo_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this));
init_gt_common();
}
@@ -4627,7 +4621,7 @@ void itech32_state::init_s_ver()
board: GT97 v1.21S, GT98, GT99, GT2K & GT Classic Versions 1.00S
Trackball info is read through 200202 (actually 200203).
*/
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x200200, 0x200203, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x200200, 0x200203, read32smo_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
init_gt_common();
}
@@ -4641,7 +4635,7 @@ void itech32_state::init_gt3dl()
Player 1 trackball read through 200003
Player 2 trackball read through 200002
*/
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_4bit_combined_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32smo_delegate(FUNC(itech32_state::trackball32_4bit_combined_r),this));
init_gt_common();
}
@@ -4649,7 +4643,7 @@ void itech32_state::init_gt3dl()
void itech32_state::init_gt2kp()
{
/* a little extra protection */
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gt2kp_prot_result_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32smo_delegate(FUNC(itech32_state::gt2kp_prot_result_r),this));
init_aama();
/* The protection code is:
@@ -4670,7 +4664,7 @@ Label1 bne.s Label1 ; Infinite loop if result isn't 0x01
void itech32_state::init_gtclasscp()
{
/* a little extra protection */
- m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gtclass_prot_result_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32smo_delegate(FUNC(itech32_state::gtclass_prot_result_r),this));
init_aama();
/* The protection code is:
diff --git a/src/mame/includes/itech32.h b/src/mame/includes/itech32.h
index df6125eee76..92d97047d00 100644
--- a/src/mame/includes/itech32.h
+++ b/src/mame/includes/itech32.h
@@ -42,7 +42,9 @@ public:
m_main_ram(*this, "main_ram", 0),
m_nvram(*this, "nvram", 0),
m_video(*this, "video", 0),
- m_main_rom(*this, "main_rom", 0)
+ m_main_rom(*this, "main_rom", 0),
+ m_grom(*this, "gfx1"),
+ m_soundbank(*this, "soundbank")
{ }
void base_devices(machine_config &config);
@@ -82,21 +84,24 @@ protected:
required_device<ticket_dispenser_device> m_ticket;
optional_device<timekeeper_device> m_timekeeper;
- optional_shared_ptr<uint16_t> m_main_ram;
- optional_shared_ptr<uint16_t> m_nvram;
- optional_shared_ptr<uint16_t> m_video;
- optional_shared_ptr<uint16_t> m_main_rom;
+ optional_shared_ptr<u16> m_main_ram;
+ optional_shared_ptr<u16> m_nvram;
+ optional_shared_ptr<u16> m_video;
+ optional_shared_ptr<u16> m_main_rom;
+
+ required_region_ptr<u8> m_grom;
+ required_memory_bank m_soundbank;
virtual void nvram_init(nvram_device &nvram, void *base, size_t length);
- std::unique_ptr<uint16_t[]> m_videoram;
- uint8_t m_vint_state;
- uint8_t m_xint_state;
- uint8_t m_qint_state;
- uint8_t m_irq_base;
- uint8_t m_sound_data;
- uint8_t m_sound_return;
- uint8_t m_sound_int_state;
+ std::unique_ptr<u16[]> m_videoram;
+ u8 m_vint_state;
+ u8 m_xint_state;
+ u8 m_qint_state;
+ u8 m_irq_base;
+ u8 m_sound_data;
+ u8 m_sound_return;
+ u8 m_sound_int_state;
offs_t m_itech020_prot_address;
int m_special_result;
int m_p1_effx;
@@ -107,67 +112,58 @@ protected:
int m_p2_effy;
int m_p2_lastresult;
attotime m_p2_lasttime;
- uint8_t m_written[0x8000];
- uint16_t m_xfer_xcount;
- uint16_t m_xfer_ycount;
- uint16_t m_xfer_xcur;
- uint16_t m_xfer_ycur;
+ u8 m_written[0x8000];
+ u16 m_xfer_xcount;
+ u16 m_xfer_ycount;
+ u16 m_xfer_xcur;
+ u16 m_xfer_ycur;
rectangle m_clip_rect;
rectangle m_scaled_clip_rect;
rectangle m_clip_save;
emu_timer *m_scanline_timer;
- uint32_t m_grom_bank;
- uint16_t m_color_latch[2];
- uint8_t m_enable_latch[2];
- uint16_t *m_videoplane[2];
+ u32 m_grom_bank;
+ u16 m_color_latch[2];
+ u8 m_enable_latch[2];
+ u16 *m_videoplane[2];
// configuration at init time
- uint8_t m_planes;
- uint16_t m_vram_height;
- uint32_t m_vram_mask;
- uint32_t m_vram_xmask;
- uint32_t m_vram_ymask;
- uint8_t *m_grom_base;
- uint32_t m_grom_size;
- uint32_t m_grom_bank_mask;
-
- DECLARE_WRITE16_MEMBER(int1_ack_w);
- DECLARE_READ16_MEMBER(trackball_r);
- DECLARE_READ16_MEMBER(trackball_p2_r);
- DECLARE_READ32_MEMBER(trackball32_8bit_r);
- DECLARE_READ32_MEMBER(trackball32_4bit_p1_r);
- DECLARE_READ32_MEMBER(trackball32_4bit_p2_r);
- DECLARE_READ32_MEMBER(trackball32_4bit_combined_r);
- DECLARE_READ16_MEMBER(wcbowl_prot_result_r);
- DECLARE_READ32_MEMBER(itech020_prot_result_r);
- DECLARE_READ32_MEMBER(gt2kp_prot_result_r);
- DECLARE_READ32_MEMBER(gtclass_prot_result_r);
- DECLARE_WRITE8_MEMBER(sound_bank_w);
- DECLARE_WRITE16_MEMBER(sound_data_w);
- DECLARE_READ32_MEMBER(sound_data32_r);
- DECLARE_WRITE32_MEMBER(sound_data32_w);
- DECLARE_READ8_MEMBER(sound_data_r);
- DECLARE_WRITE8_MEMBER(sound_return_w);
- DECLARE_READ8_MEMBER(sound_data_buffer_r);
- DECLARE_WRITE8_MEMBER(firq_clear_w);
- DECLARE_WRITE32_MEMBER(int1_ack32_w);
- DECLARE_WRITE16_MEMBER(timekill_colora_w);
- DECLARE_WRITE16_MEMBER(timekill_colorbc_w);
- DECLARE_WRITE16_MEMBER(timekill_intensity_w);
- DECLARE_WRITE16_MEMBER(bloodstm_color1_w);
- DECLARE_WRITE16_MEMBER(bloodstm_color2_w);
- DECLARE_WRITE16_MEMBER(bloodstm_plane_w);
- DECLARE_WRITE32_MEMBER(itech020_color1_w);
- DECLARE_WRITE32_MEMBER(itech020_color2_w);
- DECLARE_WRITE32_MEMBER(itech020_plane_w);
+ u8 m_planes;
+ u16 m_vram_height;
+ u32 m_vram_mask;
+ u32 m_vram_xmask;
+ u32 m_vram_ymask;
+ u32 m_grom_bank_mask;
+
+ void int1_ack_w(u16 data);
+ u8 trackball_r();
+ u8 trackball_p2_r();
+ u16 trackball_8bit_r();
+ u32 trackball32_4bit_p1_r();
+ u32 trackball32_4bit_p2_r();
+ u32 trackball32_4bit_combined_r();
+ u16 wcbowl_prot_result_r();
+ u8 itech020_prot_result_r();
+ u32 gt2kp_prot_result_r();
+ u32 gtclass_prot_result_r();
+ void sound_bank_w(u8 data);
+ void sound_data_w(u8 data);
+ u8 sound_return_r();
+ u8 sound_data_r();
+ void sound_return_w(u8 data);
+ u8 sound_data_buffer_r();
+ void firq_clear_w(u8 data);
+ void timekill_colora_w(u8 data);
+ void timekill_colorbc_w(u8 data);
+ void timekill_intensity_w(u8 data);
+ template<unsigned Layer> void color_w(u8 data);
+ void bloodstm_plane_w(u8 data);
+ void itech020_plane_w(u8 data);
DECLARE_WRITE16_MEMBER(bloodstm_paletteram_w);
- DECLARE_WRITE16_MEMBER(itech32_video_w);
- DECLARE_READ16_MEMBER(itech32_video_r);
- DECLARE_WRITE16_MEMBER(bloodstm_video_w);
- DECLARE_READ16_MEMBER(bloodstm_video_r);
- DECLARE_WRITE32_MEMBER(itech020_video_w);
- DECLARE_READ32_MEMBER(itech020_video_r);
- DECLARE_WRITE8_MEMBER(pia_portb_out);
+ void video_w(offs_t offset, u16 data, u16 mem_mask = u16(~0));
+ u16 video_r(offs_t offset);
+ void bloodstm_video_w(offs_t offset, u16 data, u16 mem_mask = u16(~0));
+ u16 bloodstm_video_r(offs_t offset);
+ void pia_portb_out(u8 data);
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -178,7 +174,7 @@ protected:
void install_timekeeper();
void init_gt_common();
- uint32_t screen_update_itech32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
WRITE_LINE_MEMBER(generate_int1);
TIMER_CALLBACK_MEMBER(delayed_sound_data_w);
TIMER_CALLBACK_MEMBER(scanline_interrupt);
@@ -187,14 +183,14 @@ protected:
inline void enable_clipping();
virtual void logblit(const char *tag);
void update_interrupts(int fast);
- void draw_raw(uint16_t *base, uint16_t color);
+ void draw_raw(u16 *base, u16 color);
virtual void command_blit_raw();
virtual void command_shift_reg();
- inline void draw_rle_fast(uint16_t *base, uint16_t color);
- inline void draw_rle_fast_xflip(uint16_t *base, uint16_t color);
- inline void draw_rle_slow(uint16_t *base, uint16_t color);
- void draw_rle(uint16_t *base, uint16_t color);
- virtual void shiftreg_clear(uint16_t *base, uint16_t *zbase);
+ inline void draw_rle_fast(u16 *base, u16 color);
+ inline void draw_rle_fast_xflip(u16 *base, u16 color);
+ inline void draw_rle_slow(u16 *base, u16 color);
+ void draw_rle(u16 *base, u16 color);
+ virtual void shiftreg_clear(u16 *base, u16 *zbase);
void handle_video_command();
void update_interrupts(int vint, int xint, int qint);
void bloodstm_map(address_map &map);
@@ -209,8 +205,7 @@ class drivedge_state : public itech32_state
public:
drivedge_state(const machine_config &mconfig, device_type type, const char *tag) :
itech32_state(mconfig, type, tag),
- m_dsp1(*this, "dsp1"),
- m_dsp2(*this, "dsp2"),
+ m_dsp(*this, "dsp%u", 1U),
m_zbuf_control(*this, "zctl"),
m_tms1_boot(*this, "tms1_boot"),
m_tms1_ram(*this, "tms1_ram"),
@@ -228,8 +223,8 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_READ32_MEMBER(steering_r);
- DECLARE_READ32_MEMBER(gas_r);
+ u16 steering_r();
+ u16 gas_r();
DECLARE_READ32_MEMBER(tms1_speedup_r);
DECLARE_READ32_MEMBER(tms2_speedup_r);
@@ -240,10 +235,9 @@ protected:
DECLARE_WRITE32_MEMBER(tms1_trigger_w);
DECLARE_WRITE32_MEMBER(tms2_trigger_w);
- DECLARE_WRITE32_MEMBER(color0_w);
- DECLARE_WRITE32_MEMBER(zbuf_control_w);
+ void zbuf_control_w(offs_t offset, u32 data, u32 mem_mask = u32(~0));
- DECLARE_WRITE8_MEMBER(portb_out);
+ void portb_out(u8 data);
DECLARE_WRITE_LINE_MEMBER(turbo_light);
void main_map(address_map &map);
@@ -252,22 +246,21 @@ protected:
virtual void nvram_init(nvram_device &nvram, void *base, size_t length) override;
virtual void logblit(const char *tag) override;
- virtual void shiftreg_clear(uint16_t *base, uint16_t *zbase) override;
+ virtual void shiftreg_clear(u16 *base, u16 *zbase) override;
virtual void command_blit_raw() override;
virtual void command_shift_reg() override;
- void draw_raw(uint16_t *base, uint16_t *zbase, uint16_t color);
-
- required_device<cpu_device> m_dsp1;
- required_device<cpu_device> m_dsp2;
- required_shared_ptr<uint32_t> m_zbuf_control;
- required_shared_ptr<uint32_t> m_tms1_boot;
- required_shared_ptr<uint32_t> m_tms1_ram;
- required_shared_ptr<uint32_t> m_tms2_ram;
+ void draw_raw(u16 *base, u16 *zbase, u16 color);
+
+ required_device_array<cpu_device, 2> m_dsp;
+ required_shared_ptr<u32> m_zbuf_control;
+ required_shared_ptr<u32> m_tms1_boot;
+ required_shared_ptr<u32> m_tms1_ram;
+ required_shared_ptr<u32> m_tms2_ram;
output_finder<4> m_leds;
required_ioport m_steer;
required_ioport m_gas;
- uint8_t m_tms_spinning[2];
+ u8 m_tms_spinning[2];
};
#endif // MAME_INCLUDES_ITECH32_H
diff --git a/src/mame/video/itech32.cpp b/src/mame/video/itech32.cpp
index a86923847d2..e2bb96a7917 100644
--- a/src/mame/video/itech32.cpp
+++ b/src/mame/video/itech32.cpp
@@ -10,6 +10,7 @@
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "includes/itech32.h"
+#include <algorithm>
/*************************************
@@ -168,8 +169,8 @@ void itech32_state::video_start()
int i;
/* allocate memory */
- m_videoram = std::make_unique<uint16_t[]>(VRAM_WIDTH * (m_vram_height + 16) * 2);
- memset(m_videoram.get(), 0xff, VRAM_WIDTH * (m_vram_height + 16) * 2 * 2);
+ m_videoram = std::make_unique<u16[]>(VRAM_WIDTH * (m_vram_height + 16) * 2);
+ std::fill_n(&m_videoram[0], VRAM_WIDTH * (m_vram_height + 16) * 2, 0xff);
/* videoplane[0] is the foreground; videoplane[1] is the background */
m_videoplane[0] = &m_videoram[0 * VRAM_WIDTH * (m_vram_height + 16) + 8 * VRAM_WIDTH];
@@ -185,15 +186,13 @@ void itech32_state::video_start()
m_videoplane[0][i] = m_videoplane[1][i] = 0xff;
/* fetch the GROM base */
- m_grom_base = memregion("gfx1")->base();
- m_grom_size = memregion("gfx1")->bytes();
m_grom_bank = 0;
- m_grom_bank_mask = m_grom_size >> 24;
+ m_grom_bank_mask = m_grom.length() >> 24;
if (m_grom_bank_mask == 2)
m_grom_bank_mask = 3;
/* reset statics */
- memset(m_video, 0, 0x80);
+ std::fill_n(&m_video[0], m_video.bytes() >> 1, 0);
m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(itech32_state::scanline_interrupt),this));
m_enable_latch[0] = 1;
@@ -217,89 +216,40 @@ void itech32_state::video_start()
*
*************************************/
-WRITE16_MEMBER(itech32_state::timekill_colora_w)
+void itech32_state::timekill_colora_w(u8 data)
{
- if (ACCESSING_BITS_0_7)
- {
- m_enable_latch[0] = (~data >> 5) & 1;
- m_enable_latch[1] = (~data >> 7) & 1;
- m_color_latch[0] = (data & 0x0f) << 8;
- }
-}
-
-
-WRITE16_MEMBER(itech32_state::timekill_colorbc_w)
-{
- if (ACCESSING_BITS_0_7)
- m_color_latch[1] = ((data & 0xf0) << 4) | 0x1000;
-}
-
-
-WRITE16_MEMBER(itech32_state::timekill_intensity_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- double intensity = (double)(data & 0xff) / (double)0x60;
- int i;
- for (i = 0; i < 8192; i++)
- m_palette->set_pen_contrast(i, intensity);
- }
-}
-
-
-WRITE16_MEMBER(itech32_state::bloodstm_color1_w)
-{
- if (ACCESSING_BITS_0_7)
- m_color_latch[0] = (data & 0x7f) << 8;
-}
-
-
-WRITE16_MEMBER(itech32_state::bloodstm_color2_w)
-{
- if (ACCESSING_BITS_0_7)
- m_color_latch[1] = (data & 0x7f) << 8;
-}
-
-
-WRITE16_MEMBER(itech32_state::bloodstm_plane_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- m_enable_latch[0] = (~data >> 1) & 1;
- m_enable_latch[1] = (~data >> 2) & 1;
- }
+ m_enable_latch[0] = (~data >> 5) & 1;
+ m_enable_latch[1] = (~data >> 7) & 1;
+ m_color_latch[0] = (data & 0x0f) << 8;
}
-WRITE32_MEMBER(drivedge_state::color0_w)
+void itech32_state::timekill_colorbc_w(u8 data)
{
- if (ACCESSING_BITS_16_23)
- m_color_latch[0] = ((data >> 16) & 0x7f) << 8;
+ m_color_latch[1] = ((data & 0xf0) << 4) | 0x1000;
}
-WRITE32_MEMBER(itech32_state::itech020_color1_w)
+void itech32_state::timekill_intensity_w(u8 data)
{
- if (ACCESSING_BITS_0_7)
- m_color_latch[1] = (data & 0x7f) << 8;
+ double intensity = (double)(data & 0xff) / (double)0x60;
+ for (int i = 0; i < 8192; i++)
+ m_palette->set_pen_contrast(i, intensity);
}
-WRITE32_MEMBER(itech32_state::itech020_color2_w)
+void itech32_state::bloodstm_plane_w(u8 data)
{
- if (ACCESSING_BITS_0_7)
- m_color_latch[0] = (data & 0x7f) << 8;
+ m_enable_latch[0] = (~data >> 1) & 1;
+ m_enable_latch[1] = (~data >> 2) & 1;
}
-WRITE32_MEMBER(itech32_state::itech020_plane_w)
+void itech32_state::itech020_plane_w(u8 data)
{
- if (ACCESSING_BITS_8_15)
- {
- m_enable_latch[0] = (~data >> 9) & 1;
- m_enable_latch[1] = (~data >> 10) & 1;
- m_grom_bank = ((data >> 14) & m_grom_bank_mask) << 24;
- }
+ m_enable_latch[0] = (~data >> 1) & 1;
+ m_enable_latch[1] = (~data >> 2) & 1;
+ m_grom_bank = ((data >> 6) & m_grom_bank_mask) << 24;
}
@@ -432,9 +382,9 @@ TIMER_CALLBACK_MEMBER(itech32_state::scanline_interrupt)
*
*************************************/
-void itech32_state::draw_raw(uint16_t *base, uint16_t color)
+void itech32_state::draw_raw(u16 *base, u16 color)
{
- uint8_t *src = &m_grom_base[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom_size];
+ u8 *src = &m_grom[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom.length()];
int transparent_pen = (VIDEO_TRANSFER_FLAGS & XFERFLAG_TRANSPARENT) ? 0xff : -1;
int width = VIDEO_TRANSFER_WIDTH << 8;
int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT) << 8;
@@ -463,7 +413,7 @@ void itech32_state::draw_raw(uint16_t *base, uint16_t color)
/* loop over Y in src pixels */
for (y = 0; y < height; y += ysrcstep, sy += ydststep)
{
- uint8_t *rowsrc = &src[(y >> 8) * (width >> 8)];
+ u8 *rowsrc = &src[(y >> 8) * (width >> 8)];
/* simpler case: VIDEO_YSTEP_PER_X is zero */
if (VIDEO_YSTEP_PER_X == 0)
@@ -471,7 +421,7 @@ void itech32_state::draw_raw(uint16_t *base, uint16_t color)
/* clip in the Y direction */
if (sy >= m_scaled_clip_rect.min_y && sy < m_scaled_clip_rect.max_y)
{
- uint32_t dstoffs;
+ u32 dstoffs;
/* direction matters here */
sx = startx;
@@ -540,9 +490,9 @@ void itech32_state::draw_raw(uint16_t *base, uint16_t color)
}
-void drivedge_state::draw_raw(uint16_t *base, uint16_t *zbase, uint16_t color)
+void drivedge_state::draw_raw(u16 *base, u16 *zbase, u16 color)
{
- uint8_t *src = &m_grom_base[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom_size];
+ u8 *src = &m_grom[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom.length()];
int transparent_pen = (VIDEO_TRANSFER_FLAGS & XFERFLAG_TRANSPARENT) ? 0xff : -1;
int width = VIDEO_TRANSFER_WIDTH << 8;
int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT) << 8;
@@ -574,7 +524,7 @@ void drivedge_state::draw_raw(uint16_t *base, uint16_t *zbase, uint16_t color)
/* loop over Y in src pixels */
for (y = 0; y < height; y += ysrcstep, sy += ydststep)
{
- uint8_t *rowsrc = src + (srcdelta >> 8);
+ u8 *rowsrc = src + (srcdelta >> 8);
/* in the polygon case, we don't factor in the Y */
if (VIDEO_TRANSFER_FLAGS != 0x5490)
@@ -588,7 +538,7 @@ void drivedge_state::draw_raw(uint16_t *base, uint16_t *zbase, uint16_t color)
/* clip in the Y direction */
if (sy >= m_scaled_clip_rect.min_y && sy < m_scaled_clip_rect.max_y)
{
- uint32_t dstoffs, zbufoffs;
+ u32 dstoffs, zbufoffs;
int32_t z = z0;
/* direction matters here */
@@ -721,7 +671,7 @@ void drivedge_state::draw_raw(uint16_t *base, uint16_t *zbase, uint16_t color)
if (m_scaled_clip_rect.contains(sx, ty))
{
int pixel = rowsrc[x >> 8];
- uint16_t *zbuf = &zbase[compute_safe_address(sx >> 8, ty >> 8)];
+ u16 *zbuf = &zbase[compute_safe_address(sx >> 8, ty >> 8)];
if (pixel != transparent_pen && zmatch == (*zbuf & (0x1f << 11)))
{
base[compute_safe_address(sx >> 8, ty >> 8)] = pixel | color;
@@ -736,7 +686,7 @@ void drivedge_state::draw_raw(uint16_t *base, uint16_t *zbase, uint16_t color)
if (m_scaled_clip_rect.contains(sx, ty))
{
int pixel = rowsrc[x >> 8];
- uint16_t *zbuf = &zbase[compute_safe_address(sx >> 8, ty >> 8)];
+ u16 *zbuf = &zbase[compute_safe_address(sx >> 8, ty >> 8)];
if (pixel != transparent_pen && ((z >> 8) <= (*zbuf & 0x7ff)))
{
base[compute_safe_address(sx >> 8, ty >> 8)] = pixel | color;
@@ -822,9 +772,9 @@ do { \
*
*************************************/
-inline void itech32_state::draw_rle_fast(uint16_t *base, uint16_t color)
+inline void itech32_state::draw_rle_fast(u16 *base, u16 color)
{
- uint8_t *src = &m_grom_base[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom_size];
+ u8 *src = &m_grom[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom.length()];
int transparent_pen = (VIDEO_TRANSFER_FLAGS & XFERFLAG_TRANSPARENT) ? 0xff : -1;
int width = VIDEO_TRANSFER_WIDTH;
int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT);
@@ -849,7 +799,7 @@ inline void itech32_state::draw_rle_fast(uint16_t *base, uint16_t color)
/* loop over Y in src pixels */
for (y = 0; y < height; y++, sy += ydststep)
{
- uint32_t dstoffs;
+ u32 dstoffs;
/* clip in the Y direction */
if (sy < m_scaled_clip_rect.min_y || sy >= m_scaled_clip_rect.max_y)
@@ -899,9 +849,9 @@ inline void itech32_state::draw_rle_fast(uint16_t *base, uint16_t color)
}
-inline void itech32_state::draw_rle_fast_xflip(uint16_t *base, uint16_t color)
+inline void itech32_state::draw_rle_fast_xflip(u16 *base, u16 color)
{
- uint8_t *src = &m_grom_base[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom_size];
+ u8 *src = &m_grom[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom.length()];
int transparent_pen = (VIDEO_TRANSFER_FLAGS & XFERFLAG_TRANSPARENT) ? 0xff : -1;
int width = VIDEO_TRANSFER_WIDTH;
int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT);
@@ -926,7 +876,7 @@ inline void itech32_state::draw_rle_fast_xflip(uint16_t *base, uint16_t color)
/* loop over Y in src pixels */
for (y = 0; y < height; y++, sy += ydststep)
{
- uint32_t dstoffs;
+ u32 dstoffs;
/* clip in the Y direction */
if (sy < m_scaled_clip_rect.min_y || sy >= m_scaled_clip_rect.max_y)
@@ -983,9 +933,9 @@ inline void itech32_state::draw_rle_fast_xflip(uint16_t *base, uint16_t color)
*
*************************************/
-inline void itech32_state::draw_rle_slow(uint16_t *base, uint16_t color)
+inline void itech32_state::draw_rle_slow(u16 *base, u16 color)
{
- uint8_t *src = &m_grom_base[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom_size];
+ u8 *src = &m_grom[(m_grom_bank | ((VIDEO_TRANSFER_ADDRHI & 0xff) << 16) | VIDEO_TRANSFER_ADDRLO) % m_grom.length()];
int transparent_pen = (VIDEO_TRANSFER_FLAGS & XFERFLAG_TRANSPARENT) ? 0xff : -1;
int width = VIDEO_TRANSFER_WIDTH;
int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT);
@@ -1008,7 +958,7 @@ inline void itech32_state::draw_rle_slow(uint16_t *base, uint16_t color)
/* loop over Y in src pixels */
for (y = 0; y < height; y++, sy += ydststep)
{
- uint32_t dstoffs;
+ u32 dstoffs;
/* clip in the Y direction */
if (sy < m_scaled_clip_rect.min_y || sy >= m_scaled_clip_rect.max_y)
@@ -1061,7 +1011,7 @@ inline void itech32_state::draw_rle_slow(uint16_t *base, uint16_t color)
-void itech32_state::draw_rle(uint16_t *base, uint16_t color)
+void itech32_state::draw_rle(u16 *base, u16 color)
{
/* adjust for (lack of) clipping */
if (!(VIDEO_TRANSFER_FLAGS & XFERFLAG_CLIP))
@@ -1090,7 +1040,7 @@ void itech32_state::draw_rle(uint16_t *base, uint16_t color)
*
*************************************/
-void itech32_state::shiftreg_clear(uint16_t *base, uint16_t *zbase)
+void itech32_state::shiftreg_clear(u16 *base, u16 *zbase)
{
const int ydir = (VIDEO_TRANSFER_FLAGS & XFERFLAG_YFLIP) ? -1 : 1;
const int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT);
@@ -1098,7 +1048,7 @@ void itech32_state::shiftreg_clear(uint16_t *base, uint16_t *zbase)
int sy = VIDEO_TRANSFER_Y & 0xfff;
/* first line is the source */
- uint16_t *src = &base[compute_safe_address(sx, sy)];
+ u16 *src = &base[compute_safe_address(sx, sy)];
sy += ydir;
/* loop over height */
@@ -1109,7 +1059,7 @@ void itech32_state::shiftreg_clear(uint16_t *base, uint16_t *zbase)
}
}
-void drivedge_state::shiftreg_clear(uint16_t *base, uint16_t *zbase)
+void drivedge_state::shiftreg_clear(u16 *base, u16 *zbase)
{
int ydir = (VIDEO_TRANSFER_FLAGS & XFERFLAG_YFLIP) ? -1 : 1;
int height = ADJUSTED_HEIGHT(VIDEO_TRANSFER_HEIGHT);
@@ -1117,7 +1067,7 @@ void drivedge_state::shiftreg_clear(uint16_t *base, uint16_t *zbase)
int sy = VIDEO_TRANSFER_Y & 0xfff;
/* first line is the source */
- uint16_t *src = &base[compute_safe_address(sx, sy)];
+ u16 *src = &base[compute_safe_address(sx, sy)];
sy += ydir;
/* loop over height */
@@ -1126,8 +1076,8 @@ void drivedge_state::shiftreg_clear(uint16_t *base, uint16_t *zbase)
memcpy(&base[compute_safe_address(sx, sy)], src, 512*2);
if (zbase)
{
- uint16_t zval = ((m_zbuf_control[2] >> 8) & 0x7ff) | ((m_zbuf_control[2] & 0x1f) << 11);
- uint16_t *dst = &zbase[compute_safe_address(sx, sy)];
+ u16 zval = ((m_zbuf_control[2] >> 8) & 0x7ff) | ((m_zbuf_control[2] & 0x1f) << 11);
+ u16 *dst = &zbase[compute_safe_address(sx, sy)];
int x;
for (x = 0; x < 512; x++)
*dst++ = zval;
@@ -1246,7 +1196,7 @@ void drivedge_state::command_shift_reg()
*
*************************************/
-WRITE16_MEMBER(itech32_state::itech32_video_w)
+void itech32_state::video_w(offs_t offset, u16 data, u16 mem_mask)
{
rectangle visarea;
@@ -1349,7 +1299,7 @@ WRITE16_MEMBER(itech32_state::itech32_video_w)
}
-READ16_MEMBER(itech32_state::itech32_video_r)
+u16 itech32_state::video_r(offs_t offset)
{
if (offset == 0)
{
@@ -1371,67 +1321,50 @@ READ16_MEMBER(itech32_state::itech32_video_r)
*
*************************************/
-WRITE16_MEMBER(itech32_state::bloodstm_video_w)
+void itech32_state::bloodstm_video_w(offs_t offset, u16 data, u16 mem_mask)
{
- itech32_video_w(space, offset / 2, data, mem_mask);
+ video_w(offset / 2, data, mem_mask);
}
-READ16_MEMBER(itech32_state::bloodstm_video_r)
+u16 itech32_state::bloodstm_video_r(offs_t offset)
{
- return itech32_video_r(space, offset / 2, mem_mask);
+ return video_r(offset / 2);
}
-WRITE32_MEMBER(itech32_state::itech020_video_w)
-{
- if (ACCESSING_BITS_16_31)
- itech32_video_w(space, offset, data >> 16, mem_mask >> 16);
- else
- itech32_video_w(space, offset, data, mem_mask);
-}
-
-
-WRITE32_MEMBER(drivedge_state::zbuf_control_w)
+void drivedge_state::zbuf_control_w(offs_t offset, u32 data, u32 mem_mask)
{
COMBINE_DATA(&m_zbuf_control[offset]);
}
-READ32_MEMBER(itech32_state::itech020_video_r)
-{
- int result = itech32_video_r(space, offset, mem_mask);
- return (result << 16) | result;
-}
-
-
-
/*************************************
*
* Main refresh
*
*************************************/
-uint32_t itech32_state::screen_update_itech32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 itech32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int y;
/* loop over height */
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- uint16_t *src1 = &m_videoplane[0][compute_safe_address(VIDEO_DISPLAY_XORIGIN1, VIDEO_DISPLAY_YORIGIN1 + y)];
+ u16 *src1 = &m_videoplane[0][compute_safe_address(VIDEO_DISPLAY_XORIGIN1, VIDEO_DISPLAY_YORIGIN1 + y)];
/* handle multi-plane case */
if (m_planes > 1)
{
- uint16_t *src2 = &m_videoplane[1][compute_safe_address(VIDEO_DISPLAY_XORIGIN2 + VIDEO_DISPLAY_XSCROLL2, VIDEO_DISPLAY_YORIGIN2 + VIDEO_DISPLAY_YSCROLL2 + y)];
- uint16_t scanline[384];
+ u16 *src2 = &m_videoplane[1][compute_safe_address(VIDEO_DISPLAY_XORIGIN2 + VIDEO_DISPLAY_XSCROLL2, VIDEO_DISPLAY_YORIGIN2 + VIDEO_DISPLAY_YSCROLL2 + y)];
+ u16 scanline[384];
int x;
/* blend the pixels in the scanline; color xxFF is transparent */
for (x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- uint16_t pixel = src1[x];
+ u16 pixel = src1[x];
if ((pixel & 0xff) == 0xff)
pixel = src2[x];
scanline[x] = pixel;