mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
(nw) output finder for amico2k,babbage,barata,bob85,c80,minicom
This commit is contained in:
parent
a074296288
commit
69c3279d6a
@ -40,8 +40,10 @@ class amico2k_state : public driver_device
|
||||
{
|
||||
public:
|
||||
amico2k_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag) ,
|
||||
m_maincpu(*this, "maincpu") { }
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
{ }
|
||||
|
||||
void machine_start() override;
|
||||
|
||||
@ -50,15 +52,16 @@ public:
|
||||
DECLARE_READ8_MEMBER( ppi_pb_r );
|
||||
DECLARE_WRITE8_MEMBER( ppi_pb_w );
|
||||
|
||||
int m_ls145_p;
|
||||
uint8_t m_segment;
|
||||
|
||||
// timers
|
||||
emu_timer *m_led_refresh_timer;
|
||||
TIMER_CALLBACK_MEMBER(led_refresh);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
void amico2k(machine_config &config);
|
||||
void amico2k_mem(address_map &map);
|
||||
private:
|
||||
int m_ls145_p;
|
||||
uint8_t m_segment;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
output_finder<6> m_digits;
|
||||
};
|
||||
|
||||
|
||||
@ -109,7 +112,7 @@ TIMER_CALLBACK_MEMBER(amico2k_state::led_refresh)
|
||||
{
|
||||
if (m_ls145_p > 3)
|
||||
{
|
||||
output().set_digit_value(m_ls145_p - 4, m_segment);
|
||||
m_digits[m_ls145_p - 4] = m_segment;
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,6 +205,7 @@ WRITE8_MEMBER( amico2k_state::ppi_pb_w )
|
||||
|
||||
void amico2k_state::machine_start()
|
||||
{
|
||||
m_digits.resolve();
|
||||
m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amico2k_state::led_refresh),this));
|
||||
|
||||
// state saving
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
, m_pio_2(*this, "z80pio_2")
|
||||
, m_ctc(*this, "z80ctc")
|
||||
, m_keyboard(*this, "X%u", 0)
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
{ }
|
||||
|
||||
void babbage(machine_config &config);
|
||||
@ -63,11 +64,13 @@ private:
|
||||
uint8_t m_key;
|
||||
uint8_t m_prev_key;
|
||||
bool m_step;
|
||||
virtual void machine_start() override { m_digits.resolve(); }
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<z80pio_device> m_pio_1;
|
||||
required_device<z80pio_device> m_pio_2;
|
||||
required_device<z80ctc_device> m_ctc;
|
||||
required_ioport_array<4> m_keyboard;
|
||||
output_finder<33> m_digits;
|
||||
};
|
||||
|
||||
|
||||
@ -179,7 +182,7 @@ WRITE8_MEMBER( babbage_state::pio2_b_w )
|
||||
}
|
||||
else
|
||||
{
|
||||
output().set_digit_value(data, m_segment);
|
||||
m_digits[data] = m_segment;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,18 +47,22 @@ class barata_state : public driver_device
|
||||
{
|
||||
public:
|
||||
barata_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu") { }
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
{ }
|
||||
|
||||
DECLARE_WRITE8_MEMBER(fpga_w);
|
||||
DECLARE_WRITE8_MEMBER(port0_w);
|
||||
DECLARE_WRITE8_MEMBER(port2_w);
|
||||
DECLARE_READ8_MEMBER(port2_r);
|
||||
void fpga_send(unsigned char cmd);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
void barata(machine_config &config);
|
||||
private:
|
||||
unsigned char row_selection;
|
||||
void fpga_send(unsigned char cmd);
|
||||
virtual void machine_start() override { m_digits.resolve(); }
|
||||
required_device<cpu_device> m_maincpu;
|
||||
output_finder<4> m_digits;
|
||||
};
|
||||
|
||||
/************************
|
||||
@ -185,7 +189,8 @@ void barata_state::fpga_send(unsigned char cmd)
|
||||
bool state, erase_all;
|
||||
char lamp_index;
|
||||
if (mode == FPGA_LAMP){
|
||||
switch (byte){
|
||||
switch (byte)
|
||||
{
|
||||
case 1:
|
||||
lamp_data = cmd;
|
||||
break;
|
||||
@ -195,12 +200,15 @@ void barata_state::fpga_send(unsigned char cmd)
|
||||
erase_all = BIT(lamp_data,4);
|
||||
lamp_index = lamp_data & 0x0F;
|
||||
|
||||
if (erase_all){
|
||||
if (erase_all)
|
||||
{
|
||||
// logerror("LED: ERASE ALL\n");
|
||||
for (int i=0; i<16; i++){
|
||||
output().set_led_value(i, 1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
output().set_led_value(lamp_index, state ? 0 : 1);
|
||||
}
|
||||
default:
|
||||
@ -228,12 +236,15 @@ void barata_state::fpga_send(unsigned char cmd)
|
||||
case 3:
|
||||
counter_data = (counter_data << 3) | cmd;
|
||||
|
||||
if (counter_state){
|
||||
output().set_digit_value(2*counter_bank, 0);
|
||||
output().set_digit_value(2*counter_bank+1, 0);
|
||||
} else {
|
||||
output().set_digit_value(2*counter_bank, dec_7seg(counter_data/10));
|
||||
output().set_digit_value(2*counter_bank+1, dec_7seg(counter_data%10));
|
||||
if (counter_state)
|
||||
{
|
||||
m_digits[2*counter_bank] = 0;
|
||||
m_digits[2*counter_bank+1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_digits[2*counter_bank] = dec_7seg(counter_data/10);
|
||||
m_digits[2*counter_bank+1] = dec_7seg(counter_data%10);
|
||||
}
|
||||
default:
|
||||
mode = FPGA_WAITING_FOR_NEW_CMD;
|
||||
|
@ -31,30 +31,34 @@ class bob85_state : public driver_device
|
||||
{
|
||||
public:
|
||||
bob85_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_cass(*this, "cassette"),
|
||||
m_line0(*this, "LINE0"),
|
||||
m_line1(*this, "LINE1"),
|
||||
m_line2(*this, "LINE2") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cassette_image_device> m_cass;
|
||||
DECLARE_READ8_MEMBER(bob85_keyboard_r);
|
||||
DECLARE_WRITE8_MEMBER(bob85_7seg_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(sod_w);
|
||||
DECLARE_READ_LINE_MEMBER(sid_r);
|
||||
uint8_t m_prev_key;
|
||||
uint8_t m_count_key;
|
||||
virtual void machine_reset() override;
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_cass(*this, "cassette")
|
||||
, m_line0(*this, "LINE0")
|
||||
, m_line1(*this, "LINE1")
|
||||
, m_line2(*this, "LINE2")
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
{ }
|
||||
|
||||
void bob85(machine_config &config);
|
||||
void bob85_io(address_map &map);
|
||||
void bob85_mem(address_map &map);
|
||||
protected:
|
||||
DECLARE_READ8_MEMBER(bob85_keyboard_r);
|
||||
DECLARE_WRITE8_MEMBER(bob85_7seg_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(sod_w);
|
||||
DECLARE_READ_LINE_MEMBER(sid_r);
|
||||
|
||||
private:
|
||||
uint8_t m_prev_key;
|
||||
uint8_t m_count_key;
|
||||
virtual void machine_reset() override;
|
||||
virtual void machine_start() override { m_digits.resolve(); }
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cassette_image_device> m_cass;
|
||||
required_ioport m_line0;
|
||||
required_ioport m_line1;
|
||||
required_ioport m_line2;
|
||||
output_finder<6> m_digits;
|
||||
};
|
||||
|
||||
|
||||
@ -140,7 +144,7 @@ READ8_MEMBER(bob85_state::bob85_keyboard_r)
|
||||
|
||||
WRITE8_MEMBER(bob85_state::bob85_7seg_w)
|
||||
{
|
||||
output().set_digit_value(offset, bitswap<8>( data,3,2,1,0,7,6,5,4 ));
|
||||
m_digits[offset] = bitswap<8>( data,3,2,1,0,7,6,5,4 );
|
||||
}
|
||||
|
||||
void bob85_state::bob85_mem(address_map &map)
|
||||
|
@ -209,7 +209,7 @@ WRITE8_MEMBER( c80_state::pio1_pb_w )
|
||||
|
||||
if (!m_pio1_a5)
|
||||
{
|
||||
output().set_digit_value(m_digit, data);
|
||||
m_digits[m_digit] = data;
|
||||
}
|
||||
|
||||
m_keylatch = data;
|
||||
@ -244,6 +244,7 @@ static const z80_daisy_config c80_daisy_chain[] =
|
||||
|
||||
void c80_state::machine_start()
|
||||
{
|
||||
m_digits.resolve();
|
||||
/* register for state saving */
|
||||
save_item(NAME(m_keylatch));
|
||||
save_item(NAME(m_digit));
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
minicom_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
{ }
|
||||
|
||||
DECLARE_WRITE8_MEMBER(i87c52_p0_w);
|
||||
@ -67,10 +68,12 @@ private:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
output_finder<20> m_digits;
|
||||
};
|
||||
|
||||
void minicom_state::machine_start()
|
||||
{
|
||||
m_digits.resolve();
|
||||
// zerofill
|
||||
memset(m_p, 0, 4);
|
||||
m_digit_index = 0;
|
||||
@ -88,7 +91,7 @@ void minicom_state::machine_reset()
|
||||
m_display_data = 0;
|
||||
|
||||
for (int i=0; i<20; i++)
|
||||
output().set_digit_value(i, 0);
|
||||
m_digits[i] = 0;
|
||||
}
|
||||
|
||||
READ8_MEMBER(minicom_state::i87c52_p1_r)
|
||||
@ -203,7 +206,7 @@ WRITE8_MEMBER(minicom_state::i87c52_p3_w)
|
||||
|
||||
if (BIT(changed,4) || BIT(changed,5))
|
||||
{
|
||||
output().set_digit_value(m_digit_index, bitswap<16>(m_display_data, 9, 1, 3, 11, 12, 4, 2, 10, 14, 6, 7, 5, 0, 15, 13, 8) & 0x3FFF);
|
||||
m_digits[m_digit_index] = bitswap<16>(m_display_data, 9, 1, 3, 11, 12, 4, 2, 10, 14, 6, 7, 5, 0, 15, 13, 8) & 0x3FFF;
|
||||
}
|
||||
m_p[3] = data;
|
||||
}
|
||||
|
@ -19,13 +19,14 @@ class c80_state : public driver_device
|
||||
{
|
||||
public:
|
||||
c80_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, Z80_TAG),
|
||||
m_pio1(*this, Z80PIO1_TAG),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_row0(*this, "ROW0"),
|
||||
m_row1(*this, "ROW1"),
|
||||
m_row2(*this, "ROW2")
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, Z80_TAG)
|
||||
, m_pio1(*this, Z80PIO1_TAG)
|
||||
, m_cassette(*this, "cassette")
|
||||
, m_row0(*this, "ROW0")
|
||||
, m_row1(*this, "ROW1")
|
||||
, m_row2(*this, "ROW2")
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
@ -34,6 +35,7 @@ public:
|
||||
required_ioport m_row0;
|
||||
required_ioport m_row1;
|
||||
required_ioport m_row2;
|
||||
output_finder<9> m_digits;
|
||||
|
||||
virtual void machine_start() override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user