mirror of
https://github.com/holub/mame
synced 2025-05-01 12:16:56 +03:00
dorachan : better protection [iq_132] ; & (nw) cleanup
This commit is contained in:
parent
97f93a8711
commit
f12164ca34
@ -8,6 +8,13 @@ Similar to Beam Invader
|
|||||||
Todo:
|
Todo:
|
||||||
- discrete sound
|
- discrete sound
|
||||||
- dips (if any) - bits 5,6,7 of input port 0 ?
|
- dips (if any) - bits 5,6,7 of input port 0 ?
|
||||||
|
|
||||||
|
Gameplay: run over dots in lower half while avoiding monsters and trees. This draws
|
||||||
|
back the red curtain blocking access to top part of the screen. Go through and new dots
|
||||||
|
below are worth more points.
|
||||||
|
|
||||||
|
It appears that unused bits in port 03 are to operate the discrete sound channels.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
@ -19,14 +26,31 @@ class dorachan_state : public driver_device
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
dorachan_state(const machine_config &mconfig, device_type type, const char *tag)
|
dorachan_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag)
|
||||||
m_maincpu(*this, "maincpu"),
|
, m_maincpu(*this, "maincpu")
|
||||||
m_screen(*this, "screen"),
|
, m_screen(*this, "screen")
|
||||||
m_palette(*this, "palette"),
|
, m_palette(*this, "palette")
|
||||||
m_videoram(*this, "videoram"),
|
, m_videoram(*this, "videoram")
|
||||||
m_colors(*this, "colors")
|
, m_colors(*this, "colors")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
DECLARE_WRITE8_MEMBER(control_w);
|
||||||
|
DECLARE_WRITE8_MEMBER(protection_w);
|
||||||
|
DECLARE_READ8_MEMBER(protection_r);
|
||||||
|
DECLARE_READ8_MEMBER(v128_r);
|
||||||
|
uint32_t screen_update_dorachan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
|
void dorachan(machine_config &config);
|
||||||
|
void dorachan_io_map(address_map &map);
|
||||||
|
void dorachan_map(address_map &map);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// internal state
|
||||||
|
uint8_t m_flip_screen;
|
||||||
|
uint16_t m_prot_value;
|
||||||
|
|
||||||
|
virtual void machine_start() override;
|
||||||
|
virtual void machine_reset() override;
|
||||||
|
|
||||||
// devices, memory pointers
|
// devices, memory pointers
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
@ -34,20 +58,6 @@ public:
|
|||||||
|
|
||||||
required_shared_ptr<uint8_t> m_videoram;
|
required_shared_ptr<uint8_t> m_videoram;
|
||||||
required_region_ptr<uint8_t> m_colors;
|
required_region_ptr<uint8_t> m_colors;
|
||||||
|
|
||||||
// internal state
|
|
||||||
uint8_t m_flip_screen;
|
|
||||||
|
|
||||||
DECLARE_WRITE8_MEMBER(control_w);
|
|
||||||
DECLARE_READ8_MEMBER(protection_r);
|
|
||||||
DECLARE_READ8_MEMBER(v128_r);
|
|
||||||
uint32_t screen_update_dorachan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
|
||||||
|
|
||||||
virtual void machine_start() override;
|
|
||||||
virtual void machine_reset() override;
|
|
||||||
void dorachan(machine_config &config);
|
|
||||||
void dorachan_io_map(address_map &map);
|
|
||||||
void dorachan_map(address_map &map);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -79,11 +89,8 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg
|
|||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
uint8_t color = (data & 0x01) ? fore_color : 0;
|
uint8_t color = BIT(data, i) ? fore_color : 0;
|
||||||
bitmap.pix32(y, x) = m_palette->pen_color(color);
|
bitmap.pix32(y, x++) = m_palette->pen_color(color);
|
||||||
|
|
||||||
data = data >> 1;
|
|
||||||
x = x + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,35 +105,45 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
READ8_MEMBER(dorachan_state::protection_r)
|
WRITE8_MEMBER(dorachan_state::protection_w)
|
||||||
{
|
{
|
||||||
uint8_t ret = 0;
|
// e0 seems like some sort of control byte?
|
||||||
|
// ignore f3 writes, written after every command?
|
||||||
switch (m_maincpu->pcbase())
|
if (data != 0xf3)
|
||||||
{
|
{
|
||||||
case 0x70ce: ret = 0xf2; break;
|
m_prot_value <<= 8;
|
||||||
case 0x72a2: ret = 0xd5; break;
|
m_prot_value |= data;
|
||||||
case 0x72b5: ret = 0xcb; break;
|
}
|
||||||
|
|
||||||
default:
|
|
||||||
osd_printf_debug("unhandled $2400 read @ %x\n", m_maincpu->pcbase());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
READ8_MEMBER(dorachan_state::protection_r)
|
||||||
|
{
|
||||||
|
switch (m_prot_value)
|
||||||
|
{
|
||||||
|
case 0xfbf7:
|
||||||
|
return 0xf2;
|
||||||
|
|
||||||
|
case 0xf9f7:
|
||||||
|
return 0xd5;
|
||||||
|
|
||||||
|
case 0xf7f4:
|
||||||
|
return 0xcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
READ8_MEMBER(dorachan_state::v128_r)
|
READ8_MEMBER(dorachan_state::v128_r)
|
||||||
{
|
{
|
||||||
// to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped
|
// to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped
|
||||||
return 0xfe | ((m_screen->vpos() >> 7 & 1) ^ m_flip_screen);
|
return 0xfe | (BIT(m_screen->vpos(), 7) ^ m_flip_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(dorachan_state::control_w)
|
WRITE8_MEMBER(dorachan_state::control_w)
|
||||||
{
|
{
|
||||||
// d6: flip screen
|
// d6: flip screen
|
||||||
// other: ?
|
// other: ?
|
||||||
m_flip_screen = data >> 6 & 1;
|
m_flip_screen = BIT(data, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +164,7 @@ void dorachan_state::dorachan_io_map(address_map &map)
|
|||||||
{
|
{
|
||||||
map.global_mask(0xff);
|
map.global_mask(0xff);
|
||||||
map(0x01, 0x01).nopw();
|
map(0x01, 0x01).nopw();
|
||||||
map(0x02, 0x02).nopw();
|
map(0x02, 0x02).w(this, FUNC(dorachan_state::protection_w));
|
||||||
map(0x03, 0x03).w(this, FUNC(dorachan_state::control_w));
|
map(0x03, 0x03).w(this, FUNC(dorachan_state::control_w));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,11 +215,13 @@ INPUT_PORTS_END
|
|||||||
void dorachan_state::machine_start()
|
void dorachan_state::machine_start()
|
||||||
{
|
{
|
||||||
save_item(NAME(m_flip_screen));
|
save_item(NAME(m_flip_screen));
|
||||||
|
save_item(NAME(m_prot_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dorachan_state::machine_reset()
|
void dorachan_state::machine_reset()
|
||||||
{
|
{
|
||||||
m_flip_screen = 0;
|
m_flip_screen = 0;
|
||||||
|
m_prot_value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MACHINE_CONFIG_START(dorachan_state::dorachan)
|
MACHINE_CONFIG_START(dorachan_state::dorachan)
|
||||||
|
Loading…
Reference in New Issue
Block a user