summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/decwritr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/decwritr.cpp')
-rw-r--r--src/mame/drivers/decwritr.cpp82
1 files changed, 45 insertions, 37 deletions
diff --git a/src/mame/drivers/decwritr.cpp b/src/mame/drivers/decwritr.cpp
index 081e3639ec8..1e15426f8be 100644
--- a/src/mame/drivers/decwritr.cpp
+++ b/src/mame/drivers/decwritr.cpp
@@ -12,6 +12,7 @@
#include "emu.h"
#include "cpu/i8085/i8085.h"
+#include "machine/74259.h"
#include "machine/er1400.h"
#include "machine/i8251.h"
#include "sound/beep.h"
@@ -35,14 +36,14 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_speaker(*this, "beeper"),
- m_uart(*this, "i8251"),
- m_nvm(*this, "nvm")
+ m_usart(*this, "usart"),
+ m_nvm(*this, "nvm"),
+ m_ledlatch(*this, "ledlatch")
{
}
- required_device<cpu_device> m_maincpu;
- required_device<beep_device> m_speaker;
- required_device<i8251_device> m_uart;
- required_device<er1400_device> m_nvm;
+
+ void la120(machine_config &config);
+private:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
bitmap.fill(rgb_t::black(), cliprect);
@@ -54,14 +55,20 @@ public:
DECLARE_WRITE8_MEMBER(la120_NVR_w);
DECLARE_READ8_MEMBER(la120_DC305_r);
DECLARE_WRITE8_MEMBER(la120_DC305_w);
- void la120(machine_config &config);
+
void la120_io(address_map &map);
void la120_mem(address_map &map);
-private:
+
virtual void machine_start() override;
//virtual void machine_reset();
+
+ required_device<cpu_device> m_maincpu;
+ required_device<beep_device> m_speaker;
+ required_device<i8251_device> m_usart;
+ required_device<er1400_device> m_nvm;
+ required_device<ls259_device> m_ledlatch;
+
ioport_port* m_col_array[16];
- uint8_t m_led_array;
uint8_t m_led_7seg_counter;
uint8_t m_led_7seg[4];
};
@@ -100,8 +107,7 @@ WRITE8_MEMBER( decwriter_state::la120_LED_w )
{
if (LED_VERBOSE)
logerror("Updated LED status array: LED #%d is now %d\n", ((offset&0xe)>>1), (offset&1));
- m_led_array &= ((1<<((offset&0xe)>>1))^0xFF); // mask out the old bit
- m_led_array |= ((offset&1)<<((offset&0xe)>>1)); // OR in the new bit
+ m_ledlatch->write_bit((~offset & 0xe) >> 1, !BIT(offset, 0));
m_led_7seg_counter = 0;
}
else // we're updating the 7segment display
@@ -117,14 +123,14 @@ WRITE8_MEMBER( decwriter_state::la120_LED_w )
}
popmessage("LEDs: %c %c %c %c : %s %s %s %s %s %s %s %s\n",
m_led_7seg[3]+0x30, m_led_7seg[2]+0x30, m_led_7seg[1]+0x30, m_led_7seg[0]+0x30,
- (m_led_array&0x80)?"ON LINE":"-------",
- (m_led_array&0x40)?"LOCAL":"-----",
- (m_led_array&0x20)?"ALT CHR SET":"-----------",
- (m_led_array&0x10)?"<LED4>":"-----",
- (m_led_array&0x8)?"CTS":"---",
- (m_led_array&0x4)?"DSR":"---",
- (m_led_array&0x2)?"SET-UP":"------",
- (m_led_array&0x1)?"PAPER OUT":"---------" );
+ (!m_ledlatch->q0_r())?"ON LINE":"-------",
+ (!m_ledlatch->q1_r())?"LOCAL":"-----",
+ (!m_ledlatch->q2_r())?"ALT CHR SET":"-----------",
+ (!m_ledlatch->q3_r())?"<LED4>":"-----",
+ (!m_ledlatch->q4_r())?"CTS":"---",
+ (!m_ledlatch->q5_r())?"DSR":"---",
+ (!m_ledlatch->q6_r())?"SET-UP":"------",
+ (!m_ledlatch->q7_r())?"PAPER OUT":"---------" );
}
/* control lines:
@@ -249,8 +255,8 @@ void decwriter_state::la120_mem(address_map &map)
void decwriter_state::la120_io(address_map &map)
{
map.unmap_value_high();
- map(0x00, 0x00).mirror(0x7C).rw(m_uart, FUNC(i8251_device::data_r), FUNC(i8251_device::data_w)); // 8251 Data
- map(0x01, 0x01).mirror(0x7C).rw(m_uart, FUNC(i8251_device::status_r), FUNC(i8251_device::control_w)); // 8251 Status/Control
+ map(0x00, 0x00).mirror(0x7C).rw(m_usart, FUNC(i8251_device::data_r), FUNC(i8251_device::data_w)); // 8251 Data
+ map(0x01, 0x01).mirror(0x7C).rw(m_usart, FUNC(i8251_device::status_r), FUNC(i8251_device::control_w)); // 8251 Status/Control
//map(0x02, 0x02).mirror(0x7D); // other io ports, serial loopback etc, see table 4-9 in TM
// 0x80-0xff are reserved for expansion (i.e. unused, open bus)
map.global_mask(0xff);
@@ -382,15 +388,6 @@ INPUT_PORTS_END
void decwriter_state::machine_start()
{
-#if 0
- output().set_value("online_led",1);
- output().set_value("local_led", 0);
- output().set_value("noscroll_led",1);
- output().set_value("basic_led", 1);
- output().set_value("hardcopy_led", 1);
- output().set_value("l1_led", 1);
- output().set_value("l2_led", 1);
-#endif
char kbdcol[8];
// look up all 16 tags 'the slow way' but only once on reset
for (int i = 0; i < 16; i++)
@@ -398,7 +395,6 @@ void decwriter_state::machine_start()
sprintf(kbdcol,"COL%X", i);
m_col_array[i] = ioport(kbdcol);
}
- m_led_array = 0;
m_led_7seg_counter = 0;
m_led_7seg[0] = m_led_7seg[1] = m_led_7seg[2] = m_led_7seg[3] = 0xF;
}
@@ -415,7 +411,7 @@ void decwriter_state::machine_reset()
MACHINE_CONFIG_START(decwriter_state::la120)
- MCFG_DEVICE_ADD("maincpu",I8080, XTAL(18'000'000) / 9) // 18Mhz xtal on schematics, using an i8224 clock divider/reset sanitizer IC
+ MCFG_DEVICE_ADD("maincpu", I8080A, XTAL(18'000'000) / 9) // 18Mhz xtal on schematics, using an i8224 clock divider/reset sanitizer IC
MCFG_DEVICE_PROGRAM_MAP(la120_mem)
MCFG_DEVICE_IO_MAP(la120_io)
@@ -427,6 +423,18 @@ MACHINE_CONFIG_START(decwriter_state::la120)
MCFG_SCREEN_VISIBLE_AREA(0,639, 0,479)
MCFG_SCREEN_REFRESH_RATE(30)
+ //MCFG_DEVICE_ADD("prtlsi", DC305, XTAL(18'000'000) / 9)
+
+ MCFG_DEVICE_ADD("ledlatch", LS259, 0) // E2 on keyboard
+ MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // ON LINE
+ MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT // LOCAL
+ MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led3")) MCFG_DEVCB_INVERT // ALT CHAR SET
+ MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led4")) MCFG_DEVCB_INVERT
+ MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led5")) MCFG_DEVCB_INVERT // CTS
+ MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led6")) MCFG_DEVCB_INVERT // DSR
+ MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led7")) MCFG_DEVCB_INVERT // SETUP
+ MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led8")) MCFG_DEVCB_INVERT // PAPER OUT
+
//MCFG_DEFAULT_LAYOUT( layout_la120 )
/* audio hardware */
@@ -435,19 +443,19 @@ MACHINE_CONFIG_START(decwriter_state::la120)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
/* i8251 */
- MCFG_DEVICE_ADD("i8251", I8251, 0)
+ MCFG_DEVICE_ADD("usart", I8251, XTAL(18'000'000) / 9)
/*
MCFG_I8251_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd))
MCFG_I8251_DTR_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_dtr))
MCFG_I8251_RTS_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_rts))
MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, nullptr)
- MCFG_RS232_RXD_HANDLER(WRITELINE("i8251", i8251_device, write_rxd))
- MCFG_RS232_DSR_HANDLER(WRITELINE("i8251", i8251_device, write_dsr))
+ MCFG_RS232_RXD_HANDLER(WRITELINE("usart", i8251_device, write_rxd))
+ MCFG_RS232_DSR_HANDLER(WRITELINE("usart", i8251_device, write_dsr))
MCFG_DEVICE_ADD(COM5016T_TAG, COM8116, XTAL(5'068'800))
- MCFG_COM8116_FR_HANDLER(WRITELINE("i8251", i8251_device, write_rxc))
- MCFG_COM8116_FT_HANDLER(WRITELINE("i8251", i8251_device, write_txc))
+ MCFG_COM8116_FR_HANDLER(WRITELINE("usart", i8251_device, write_rxc))
+ MCFG_COM8116_FT_HANDLER(WRITELINE("usart", i8251_device, write_txc))
*/
MCFG_DEVICE_ADD("nvm", ER1400, 0)