summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Robbbert <Robbbert@users.noreply.github.com>2017-09-16 03:12:47 +1000
committerGravatarGravatar Robbbert <Robbbert@users.noreply.github.com>2017-09-16 03:12:47 +1000
commit64bab1ae6e51024c39815e090bfa61502a570cea (patch) (github)
treecaa00f9a7b39948b43e8c64641f6738a887d18e4
parentee7472ae05b4ea261dbfb7258db933503ee1ab23 (diff)
downloadmame-64bab1ae6e51024c39815e090bfa61502a570cea.tar.bz2
mame-64bab1ae6e51024c39815e090bfa61502a570cea.zip
(nw) jade : added z80sio
-rw-r--r--src/mame/drivers/jade.cpp72
1 files changed, 31 insertions, 41 deletions
diff --git a/src/mame/drivers/jade.cpp b/src/mame/drivers/jade.cpp
index 4cf9240d770..e59d2e2ffa4 100644
--- a/src/mame/drivers/jade.cpp
+++ b/src/mame/drivers/jade.cpp
@@ -15,73 +15,56 @@
#include "emu.h"
#include "cpu/z80/z80.h"
-#include "machine/i8251.h"
-#include "machine/terminal.h"
+#include "machine/z80sio.h"
+#include "machine/clock.h"
+#include "bus/rs232/rs232.h"
-#define TERMINAL_TAG "terminal"
class jade_state : public driver_device
{
public:
jade_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_terminal(*this, TERMINAL_TAG),
- m_uart(*this, "uart")
- {
- }
-
- void kbd_put(u8 data);
- DECLARE_READ8_MEMBER(keyin_r);
- DECLARE_READ8_MEMBER(status_r);
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_sio(*this, "sio")
+ { }
+
+ DECLARE_WRITE_LINE_MEMBER(clock_tick);
+
private:
- uint8_t m_term_data;
virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
- required_device<generic_terminal_device> m_terminal;
- required_device<i8251_device> m_uart;
+ required_device<z80sio_device> m_sio;
};
static ADDRESS_MAP_START(jade_mem, AS_PROGRAM, 8, jade_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x07ff) AM_ROM AM_REGION("roms", 0)
- AM_RANGE(0xe000, 0xffff) AM_RAM
+ AM_RANGE(0x0800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START(jade_io, AS_IO, 8, jade_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- //AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w)
- //AM_RANGE(0x32, 0x32) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
- AM_RANGE(0x30, 0x30) AM_READ(keyin_r) AM_DEVWRITE(TERMINAL_TAG, generic_terminal_device, write)
- AM_RANGE(0x32, 0x32) AM_READ(status_r)
+ AM_RANGE(0x28, 0x28) // writes 45, 0D at start
+ AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("sio", z80sio_device, cd_ba_r, cd_ba_w)
+ AM_RANGE(0x43, 0x43) AM_READNOP // writes 01, 80 then continually reads
ADDRESS_MAP_END
/* Input ports */
static INPUT_PORTS_START( jade )
INPUT_PORTS_END
-READ8_MEMBER( jade_state::keyin_r )
-{
- uint8_t ret = m_term_data;
- m_term_data = 0;
- return (ret) ? ret : 0x13;
-}
-
-READ8_MEMBER( jade_state::status_r )
-{
- return (m_term_data) ? 5 : 4;
-}
-
-void jade_state::kbd_put(u8 data)
+// source of baud frequency is unknown, so we invent a clock
+WRITE_LINE_MEMBER( jade_state::clock_tick )
{
- m_term_data = data;
+ m_sio->txca_w(state);
+ m_sio->rxca_w(state);
}
void jade_state::machine_reset()
{
- m_term_data = 0;
}
static MACHINE_CONFIG_START( jade )
@@ -90,12 +73,19 @@ static MACHINE_CONFIG_START( jade )
MCFG_CPU_PROGRAM_MAP(jade_mem)
MCFG_CPU_IO_MAP(jade_io)
- /* video hardware */
- MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0)
- MCFG_GENERIC_TERMINAL_KEYBOARD_CB(PUT(jade_state, kbd_put))
+ MCFG_DEVICE_ADD("siot_clock", CLOCK, 153600)
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(jade_state, clock_tick))
/* Devices */
- MCFG_DEVICE_ADD("uart", I8251, 0)
+ MCFG_Z80SIO_ADD("sio", XTAL_4MHz, 0, 0, 0, 0)
+ //MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // interrupts not programmed by default
+ MCFG_Z80SIO_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd))
+ MCFG_Z80SIO_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
+ MCFG_Z80SIO_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts))
+
+ MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal")
+ MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sio", z80sio_device, rxa_w))
+ MCFG_RS232_CTS_HANDLER(DEVWRITELINE("sio", z80sio_device, ctsa_w))
MACHINE_CONFIG_END
/* ROM definition */
@@ -107,4 +97,4 @@ ROM_END
/* Driver */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 19??, jade, 0, 0, jade, jade, jade_state, 0, "Jade", "JGZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW )
+COMP( 1983, jade, 0, 0, jade, jade, jade_state, 0, "Jade", "JGZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW )