et3400: Add "Segment Test" input

This commit is contained in:
AJR 2017-11-27 13:12:29 -05:00
parent aa0433f88c
commit 83fb614378

View File

@ -25,6 +25,7 @@ ETA-3400 Memory I/O Accessory
#include "emu.h"
#include "cpu/m6800/m6800.h"
#include "machine/74259.h"
#include "machine/6821pia.h"
#include "bus/rs232/rs232.h"
#include "imagedev/cassette.h"
@ -41,20 +42,24 @@ public:
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_pia(*this, "pia")
, m_displatch(*this, "displatch%u", 1)
, m_rs232(*this, "rs232")
, m_cass(*this, "cassette")
{ }
DECLARE_READ8_MEMBER(keypad_r);
DECLARE_WRITE8_MEMBER(display_w);
template<int digit> DECLARE_WRITE8_MEMBER(led_w);
DECLARE_READ8_MEMBER(pia_ar);
DECLARE_WRITE8_MEMBER(pia_aw);
DECLARE_READ8_MEMBER(pia_br);
DECLARE_WRITE8_MEMBER(pia_bw);
DECLARE_WRITE_LINE_MEMBER(reset_key_w);
DECLARE_WRITE_LINE_MEMBER(segment_test_w);
private:
required_device<cpu_device> m_maincpu;
required_device<pia6821_device> m_pia;
required_device_array<ls259_device, 6> m_displatch;
required_device<rs232_port_device> m_rs232;
required_device<cassette_image_device> m_cass;
};
@ -77,18 +82,17 @@ READ8_MEMBER( et3400_state::keypad_r )
WRITE8_MEMBER(et3400_state::display_w)
{
/* This computer sets each segment, one at a time. */
static const uint8_t segments[8]={0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x80};
// A6-A4 decoded by IC22 (74LS42); D0 inverted by one gate of IC21 (74S00)
uint8_t digit = (offset >> 4) & 7;
uint8_t segment = segments[offset & 7];
uint8_t segdata = output().get_digit_value(digit);
if (data & 1)
segdata |= segment;
else
segdata &= ~segment;
if (digit >= 1 && digit <= 6)
m_displatch[digit - 1]->write_bit(offset & 7, !BIT(data, 0));
}
template<int digit>
WRITE8_MEMBER(et3400_state::led_w)
{
/* This computer sets each segment, one at a time. */
uint8_t segdata = BITSWAP8(~data, 7, 0, 1, 2, 3, 4, 5, 6);
output().set_digit_value(digit, segdata);
}
@ -133,6 +137,16 @@ WRITE_LINE_MEMBER(et3400_state::reset_key_w)
{
// delivered through MC6875 (or 74LS241 on ET-3400A)
m_maincpu->set_input_line(INPUT_LINE_RESET, state ? CLEAR_LINE : ASSERT_LINE);
// PIA also uses reset line
if (!state)
m_pia->reset();
}
WRITE_LINE_MEMBER(et3400_state::segment_test_w)
{
for (int d = 0; d < 6; d++)
m_displatch[d]->clear_w(state);
}
/* Input ports */
@ -172,8 +186,11 @@ static INPUT_PORTS_START( et3400 )
PORT_DIPSETTING( 0x04, "4800" )
PORT_DIPSETTING( 0x02, "9600" )
PORT_START("RESET") // RESET is directly below 2, but electrically separate from key matrix
PORT_START("RESET") // RESET is directly next to 0, but electrically separate from key matrix
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_STOP) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, et3400_state, reset_key_w)
PORT_START("TEST") // No input mechanism for "Segment Test" defined other than shorting pins together
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Segment Test") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, et3400_state, segment_test_w)
INPUT_PORTS_END
@ -203,6 +220,19 @@ static MACHINE_CONFIG_START( et3400 )
MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal")
MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal)
MCFG_DEVICE_ADD("displatch1", LS259, 0) // IC28
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(et3400_state, led_w<1>))
MCFG_DEVICE_ADD("displatch2", LS259, 0) // IC27
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(et3400_state, led_w<2>))
MCFG_DEVICE_ADD("displatch3", LS259, 0) // IC26
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(et3400_state, led_w<3>))
MCFG_DEVICE_ADD("displatch4", LS259, 0) // IC25
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(et3400_state, led_w<4>))
MCFG_DEVICE_ADD("displatch5", LS259, 0) // IC24
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(et3400_state, led_w<5>))
MCFG_DEVICE_ADD("displatch6", LS259, 0) // IC23
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(et3400_state, led_w<6>))
MCFG_CASSETTE_ADD("cassette")
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -222,4 +252,4 @@ ROM_END
/* Driver */
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
COMP( 1976, et3400, 0, 0, et3400, et3400, et3400_state, 0, "Heath Inc", "Heathkit ET-3400", 0 )
COMP( 1976, et3400, 0, 0, et3400, et3400, et3400_state, 0, "Heath Company", "Heathkit Model ET-3400 Microprocessor Trainer", 0 )