(nw) output finder for sspeedr

This commit is contained in:
Robbbert 2018-04-07 01:42:11 +10:00
parent 53dec1c0af
commit d15bad89f2
2 changed files with 31 additions and 27 deletions

View File

@ -47,30 +47,28 @@ WRITE8_MEMBER(sspeedr_state::sspeedr_int_ack_w)
WRITE8_MEMBER(sspeedr_state::sspeedr_lamp_w)
{
output().set_value("lampGO", (data >> 0) & 1);
output().set_value("lampEP", (data >> 1) & 1);
output().set_value("lampGO", BIT(data, 0));
output().set_value("lampEP", BIT(data, 1));
machine().bookkeeping().coin_counter_w(0, data & 8);
}
/* uses a 7447A, which is equivalent to an LS47/48 */
static const uint8_t ls48_map[16] =
constexpr uint8_t ls48_map[16] =
{ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 };
WRITE8_MEMBER(sspeedr_state::sspeedr_time_w)
{
data = data & 15;
output().set_digit_value(0x18 + offset, ls48_map[data]);
m_digits[24 + offset] = ls48_map[data];
m_led_TIME[offset] = data;
}
WRITE8_MEMBER(sspeedr_state::sspeedr_score_w)
{
char buf[20];
sprintf(buf, "LED%02d", offset);
data = ~data & 15;
output().set_digit_value(offset, ls48_map[data]);
m_digits[offset] = ls48_map[data];
m_led_SCORE[offset] = data;
}

View File

@ -4,23 +4,13 @@ class sspeedr_state : public driver_device
{
public:
sspeedr_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) ,
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_digits(*this, "digit%u", 0U)
{ }
uint8_t m_led_TIME[2];
uint8_t m_led_SCORE[24];
int m_toggle;
unsigned m_driver_horz;
unsigned m_driver_vert;
unsigned m_driver_pic;
unsigned m_drones_horz;
unsigned m_drones_vert[3];
unsigned m_drones_mask;
unsigned m_track_horz;
unsigned m_track_vert[2];
unsigned m_track_ice;
DECLARE_WRITE8_MEMBER(sspeedr_int_ack_w);
DECLARE_WRITE8_MEMBER(sspeedr_lamp_w);
DECLARE_WRITE8_MEMBER(sspeedr_time_w);
@ -38,17 +28,33 @@ public:
DECLARE_WRITE8_MEMBER(sspeedr_track_horz_2_w);
DECLARE_WRITE8_MEMBER(sspeedr_track_vert_w);
DECLARE_WRITE8_MEMBER(sspeedr_track_ice_w);
virtual void video_start() override;
DECLARE_PALETTE_INIT(sspeedr);
uint32_t screen_update_sspeedr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sspeedr);
void sspeedr(machine_config &config);
void sspeedr_io_map(address_map &map);
void sspeedr_map(address_map &map);
private:
uint8_t m_led_TIME[2];
uint8_t m_led_SCORE[24];
int m_toggle;
unsigned m_driver_horz;
unsigned m_driver_vert;
unsigned m_driver_pic;
unsigned m_drones_horz;
unsigned m_drones_vert[3];
unsigned m_drones_mask;
unsigned m_track_horz;
unsigned m_track_vert[2];
unsigned m_track_ice;
virtual void video_start() override;
virtual void machine_start() override { m_digits.resolve(); }
void draw_track(bitmap_ind16 &bitmap);
void draw_drones(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_driver(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
void sspeedr(machine_config &config);
void sspeedr_io_map(address_map &map);
void sspeedr_map(address_map &map);
output_finder<26> m_digits;
};