summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2017-09-30 22:14:22 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2017-09-30 22:14:22 +1000
commit07305c9604325fa935fea9626e4e2a351c64a0eb (patch)
tree903ab89d8bb0c96aaa148380612af95a5de92e92
parent093bebb5198a323b33e1b14011507cc9f42cd91e (diff)
(nw) cleanups (pulsarlb, selz80, babbage)
-rw-r--r--src/mame/drivers/babbage.cpp55
-rw-r--r--src/mame/drivers/pulsar.cpp53
-rw-r--r--src/mame/drivers/selz80.cpp93
3 files changed, 115 insertions, 86 deletions
diff --git a/src/mame/drivers/babbage.cpp b/src/mame/drivers/babbage.cpp
index 0a95392ff13..8f1295d9b7d 100644
--- a/src/mame/drivers/babbage.cpp
+++ b/src/mame/drivers/babbage.cpp
@@ -35,52 +35,38 @@ class babbage_state : public driver_device
{
public:
babbage_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_pio_1(*this, "z80pio_1"),
- m_pio_2(*this, "z80pio_2"),
- m_ctc(*this, "z80ctc")
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_pio_1(*this, "z80pio_1")
+ , m_pio_2(*this, "z80pio_2")
+ , m_ctc(*this, "z80ctc")
+ , m_keyboard(*this, "X%u", 0)
+ { }
- 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;
DECLARE_READ8_MEMBER(pio2_a_r);
DECLARE_WRITE8_MEMBER(pio1_b_w);
DECLARE_WRITE8_MEMBER(pio2_b_w);
DECLARE_WRITE_LINE_MEMBER(ctc_z0_w);
DECLARE_WRITE_LINE_MEMBER(ctc_z1_w);
DECLARE_WRITE_LINE_MEMBER(ctc_z2_w);
+ TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
+
+private:
uint8_t m_segment;
uint8_t m_key;
uint8_t m_prev_key;
bool m_step;
- virtual void machine_reset() override;
- virtual void machine_start() override;
- TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
+ 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;
};
/***************************************************************************
- Machine
-
-***************************************************************************/
-
-void babbage_state::machine_start()
-{
-}
-
-void babbage_state::machine_reset()
-{
-}
-
-
-
-/***************************************************************************
-
Address Map
***************************************************************************/
@@ -195,16 +181,13 @@ static const z80_daisy_config babbage_daisy_chain[] =
TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback)
{
- uint8_t i, j, inp;
- char kbdrow[6];
- uint8_t data = 0xff;
+ u8 inp, data = 0xff;
- for (i = 0; i < 4; i++)
+ for (u8 i = 0; i < 4; i++)
{
- sprintf(kbdrow,"X%X",i);
- inp = ioport(kbdrow)->read();
+ inp = m_keyboard[i]->read();
- for (j = 0; j < 5; j++)
+ for (u8 j = 0; j < 5; j++)
if (BIT(inp, j))
data = (j << 2) | i;
}
diff --git a/src/mame/drivers/pulsar.cpp b/src/mame/drivers/pulsar.cpp
index 4aa69e07b8b..c65bc3b09fb 100644
--- a/src/mame/drivers/pulsar.cpp
+++ b/src/mame/drivers/pulsar.cpp
@@ -49,24 +49,20 @@ X - Test off-board memory banks
class pulsar_state : public driver_device
{
public:
- pulsar_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_dart(*this, "z80dart"),
- m_brg(*this, "brg"),
- m_fdc (*this, "fdc"),
- m_floppy0(*this, "fdc:0"),
- m_floppy1(*this, "fdc:1"),
- m_rtc(*this, "rtc")
- {
- }
+ pulsar_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_brg(*this, "brg")
+ , m_fdc (*this, "fdc")
+ , m_floppy0(*this, "fdc:0")
+ , m_floppy1(*this, "fdc:1")
+ , m_rtc(*this, "rtc")
+ { }
DECLARE_DRIVER_INIT(pulsar);
DECLARE_MACHINE_RESET(pulsar);
TIMER_CALLBACK_MEMBER(pulsar_reset);
DECLARE_WRITE8_MEMBER(baud_w);
- DECLARE_WRITE_LINE_MEMBER(fr_w);
- DECLARE_WRITE_LINE_MEMBER(ft_w);
DECLARE_WRITE8_MEMBER(ppi_pa_w);
DECLARE_WRITE8_MEMBER(ppi_pb_w);
DECLARE_WRITE8_MEMBER(ppi_pc_w);
@@ -75,7 +71,6 @@ public:
private:
floppy_image_device *m_floppy;
required_device<cpu_device> m_maincpu;
- required_device<z80dart_device> m_dart;
required_device<com8116_device> m_brg;
required_device<fd1797_device> m_fdc;
required_device<floppy_connector> m_floppy0;
@@ -93,25 +88,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START(pulsar_io, AS_IO, 8, pulsar_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x0c) AM_DEVREADWRITE("z80dart", z80dart_device, ba_cd_r, ba_cd_w)
+ AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x0c) AM_DEVREADWRITE("dart", z80dart_device, ba_cd_r, ba_cd_w)
AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_DEVREADWRITE("fdc", fd1797_device, read, write)
AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi", i8255_device, read, write)
AM_RANGE(0xf0, 0xff) AM_WRITE(baud_w)
ADDRESS_MAP_END
-// Schematic has the labels for FT and FR the wrong way around,
-// the pin numbers are correct.
-WRITE_LINE_MEMBER( pulsar_state::fr_w )
-{
- m_dart->rxca_w(state);
- m_dart->txca_w(state);
-}
-
-WRITE_LINE_MEMBER( pulsar_state::ft_w )
-{
- m_dart->rxcb_w(state);
- m_dart->txcb_w(state);
-}
WRITE8_MEMBER( pulsar_state::baud_w )
{
@@ -127,7 +109,7 @@ TIMER_CALLBACK_MEMBER( pulsar_state::pulsar_reset)
static const z80_daisy_config daisy_chain_intf[] =
{
- { "z80dart" },
+ { "dart" },
{ nullptr }
};
@@ -240,20 +222,23 @@ static MACHINE_CONFIG_START( pulsar )
MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz)
- MCFG_DEVICE_ADD("z80dart", Z80DART, XTAL_4MHz)
+ MCFG_DEVICE_ADD("dart", Z80DART, XTAL_4MHz)
MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd))
MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts))
MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal")
- MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w))
- MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80dart", z80dart_device, ctsa_w))
+ MCFG_RS232_RXD_HANDLER(DEVWRITELINE("dart", z80dart_device, rxa_w))
+ MCFG_RS232_CTS_HANDLER(DEVWRITELINE("dart", z80dart_device, ctsa_w))
MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal)
MCFG_DEVICE_ADD("brg", COM8116, XTAL_5_0688MHz)
- MCFG_COM8116_FR_HANDLER(WRITELINE(pulsar_state, fr_w))
- MCFG_COM8116_FT_HANDLER(WRITELINE(pulsar_state, ft_w))
+ // Schematic has the labels for FT and FR the wrong way around, but the pin numbers are correct.
+ MCFG_COM8116_FR_HANDLER(DEVWRITELINE("dart", z80dart_device, txca_w))
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("dart", z80dart_device, rxca_w))
+ MCFG_COM8116_FT_HANDLER(DEVWRITELINE("dart", z80dart_device, txcb_w))
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("dart", z80dart_device, rxcb_w))
MCFG_FD1797_ADD("fdc", XTAL_4MHz / 2)
MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525hd", floppy_image_device::default_floppy_formats)
diff --git a/src/mame/drivers/selz80.cpp b/src/mame/drivers/selz80.cpp
index ffff71824d8..2016a75db8e 100644
--- a/src/mame/drivers/selz80.cpp
+++ b/src/mame/drivers/selz80.cpp
@@ -14,23 +14,27 @@ Test sequence: Press -, enter an address, press = to show contents, press
ToDo:
- Artwork
-- Various missing LEDs and switches
- Keys are a guess, need to be confirmed.
- Needs to be tested by a subject-matter expert.
+- i8255 to be added (address is unknown)
+- "Tape-Interface" to be added (has its own LED)
+- "Binary" area to be added - has 8 slide switches and a LED for each
+- Halt LED
+- "User Display" to be added - has 6 digits and a 74C917 chip
+- 3 large sockets labelled "E C B - BUS"
- Unknown I/O:
'maincpu' (00F2): unmapped i/o memory write to 000C = 00 & FF
'maincpu' (00F8): unmapped i/o memory write to 0010 = FF & FF
-'maincpu' (0122): unmapped i/o memory write to 0019 = 91 & FF
-'maincpu' (0122): unmapped i/o memory write to 0019 = 40 & FF
-'maincpu' (0122): unmapped i/o memory write to 0019 = CE & FF
-'maincpu' (0122): unmapped i/o memory write to 0019 = 17 & FF
****************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
+#include "machine/i8251.h"
#include "machine/i8279.h"
+#include "bus/rs232/rs232.h"
+#include "machine/clock.h"
#include "selz80.lh"
@@ -38,18 +42,26 @@ class selz80_state : public driver_device
{
public:
selz80_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_p_ram(*this, "ram")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_p_ram(*this, "ram")
+ , m_keyboard(*this, "X%u", 0)
+ , m_clock(*this, "uart_clock")
{ }
DECLARE_WRITE8_MEMBER(scanlines_w);
DECLARE_WRITE8_MEMBER(digit_w);
DECLARE_READ8_MEMBER(kbd_r);
DECLARE_MACHINE_RESET(dagz80);
+ DECLARE_MACHINE_RESET(selz80);
+
+private:
uint8_t m_digit;
+ void setup_baud();
required_device<cpu_device> m_maincpu;
optional_shared_ptr<uint8_t> m_p_ram;
+ required_ioport_array<4> m_keyboard;
+ required_device<clock_device> m_clock;
};
static ADDRESS_MAP_START(dagz80_mem, AS_PROGRAM, 8, selz80_state)
@@ -61,7 +73,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START(selz80_mem, AS_PROGRAM, 8, selz80_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x0fff) AM_ROM
- AM_RANGE(0x1000, 0x1fff) AM_RAM
+ AM_RANGE(0x1000, 0x27ff) AM_RAM // all 3 RAM sockets filled
+ // AM_RANGE(0x3000, 0x37ff) AM_ROM // empty socket for ROM
AM_RANGE(0xa000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -69,6 +82,8 @@ static ADDRESS_MAP_START(selz80_io, AS_IO, 8, selz80_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("i8279", i8279_device, read, write)
+ AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w)
+ AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
ADDRESS_MAP_END
/* Input ports */
@@ -118,11 +133,45 @@ RG EN SA SD 0(AF) 1(BC) 2(DE) 3(HL)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EN") PORT_CODE(KEYCODE_K)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RG") PORT_CODE(KEYCODE_L)
+
+ PORT_START("BJ") // baud jumper
+ /* not connected to cpu, each pair of pins is connected directly to the output
+ of a 4020 counter dividing the ???? clock to feed the 8251. You use a jumper
+ (like the kind on the back of a IDE hard drive) to choose the speed. */
+ PORT_DIPNAME( 0x0F, 0x00, "Baud Rate" )
+ PORT_DIPSETTING( 0x00, "9600" )
+ PORT_DIPSETTING( 0x01, "4800" )
+ PORT_DIPSETTING( 0x02, "2400" )
+ PORT_DIPSETTING( 0x03, "1200" )
+ PORT_DIPSETTING( 0x04, "600" )
+ PORT_DIPSETTING( 0x05, "300" )
+ PORT_DIPSETTING( 0x06, "150" )
+ PORT_DIPSETTING( 0x07, "75" )
+ PORT_DIPSETTING( 0x08, "38" ) // 37.5
+ PORT_DIPSETTING( 0x09, "18" ) // 17.75
+ PORT_DIPSETTING( 0x0A, "9" ) // 8.875
INPUT_PORTS_END
+void selz80_state::setup_baud()
+{
+ // setup baud rate for uart
+ u8 baudsw = ioport("BJ")->read() & 15;
+ if (baudsw)
+ {
+ u32 speed = (9600*16) >> baudsw;
+ m_clock->set_unscaled_clock(speed);
+ }
+}
+
+MACHINE_RESET_MEMBER(selz80_state, selz80)
+{
+ setup_baud();
+}
+
MACHINE_RESET_MEMBER(selz80_state, dagz80)
{
+ setup_baud();
uint8_t* rom = memregion("user1")->base();
uint16_t size = memregion("user1")->bytes();
memcpy(m_p_ram, rom, size);
@@ -144,25 +193,37 @@ READ8_MEMBER( selz80_state::kbd_r )
uint8_t data = 0xff;
if (m_digit < 4)
- {
- char kbdrow[6];
- sprintf(kbdrow,"X%X",m_digit);
- data = ioport(kbdrow)->read();
- }
+ data = m_keyboard[m_digit]->read();
+
return data;
}
static MACHINE_CONFIG_START( selz80 )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz)
+ MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) // it's actually a 5MHz XTAL with a NEC uPD780C-1 cpu
MCFG_CPU_PROGRAM_MAP(selz80_mem)
MCFG_CPU_IO_MAP(selz80_io)
+ MCFG_MACHINE_RESET_OVERRIDE(selz80_state, selz80 )
/* video hardware */
MCFG_DEFAULT_LAYOUT(layout_selz80)
/* Devices */
- MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider
+ MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600)
+ MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("uart", i8251_device, write_txc))
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart", i8251_device, write_rxc))
+
+ MCFG_DEVICE_ADD("uart", I8251, 0)
+ MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd))
+ MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
+ MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
+
+ MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, nullptr)
+ MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart", i8251_device, write_rxd))
+ MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart", i8251_device, write_dsr))
+ MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart", i8251_device, write_cts))
+
+ MCFG_DEVICE_ADD("i8279", I8279, 5000000 / 2) // based on divider
MCFG_I8279_OUT_SL_CB(WRITE8(selz80_state, scanlines_w)) // scan SL lines
MCFG_I8279_OUT_DISP_CB(WRITE8(selz80_state, digit_w)) // display A&B
MCFG_I8279_IN_RL_CB(READ8(selz80_state, kbd_r)) // kbd RL lines