Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // license:BSD-3-Clause
- // copyright-holders:LuigiThirty
- #include "emu.h"
- #include "cpu/z80/z80.h"
- #include "machine/z80sio.h"
- #include "machine/clock.h"
- #include "bus/rs232/rs232.h"
- #include "video/tms9928a.h"
- #define Z80SIO_TAG "z80sio"
- #define RS232_A_TAG "rs232a"
- #define TMS9918A_TAG "tms9918a"
- class rc2014_state: public driver_device
- {
- public:
- rc2014_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag)
- , m_maincpu(*this, "maincpu")
- , m_z80sio(*this, Z80SIO_TAG)
- , m_rs232(*this, RS232_A_TAG)
- { }
- void rc2014(machine_config &config);
- void init_rc2014();
- private:
- virtual void machine_start() override;
- void io_map(address_map &map);
- void mem_map(address_map &map);
- required_device<cpu_device> m_maincpu;
- required_device<z80sio_device> m_z80sio;
- required_device<rs232_port_device> m_rs232;
- };
- void rc2014_state::machine_start()
- {
- };
- void rc2014_state::mem_map(address_map &map)
- {
- map.unmap_value_high();
- map(0x0000, 0x1fff).rom();
- map(0x8000, 0xffff).ram();
- }
- void rc2014_state::io_map(address_map &map)
- {
- /* I/O devices... */
- map.unmap_value_high();
- map.global_mask(0xff);
- map(0x80, 0x83).rw(Z80SIO_TAG, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w));
- // map(0x98, 0x99).rw(TMS9918A_TAG, FUNC(tms9918a_device::read), FUNC(tms9918a_device::write));
- }
- void rc2014_state::rc2014(machine_config &config)
- {
- /* basic machine hardware */
- Z80(config, m_maincpu, 7.3728_MHz_XTAL / 2);
- m_maincpu->set_addrmap(AS_PROGRAM, &rc2014_state::mem_map);
- m_maincpu->set_addrmap(AS_IO, &rc2014_state::io_map);
- Z80SIO(config, m_z80sio, 7.3728_MHz_XTAL / 2);
- m_z80sio->set_cputag(m_maincpu);
- m_z80sio->out_txda_callback().set(m_rs232, FUNC(rs232_port_device::write_txd));
- m_z80sio->out_rtsa_callback().set(m_rs232, FUNC(rs232_port_device::write_rts));
- clock_device &uart_clock(CLOCK(config, "uart_clock", 7.3728_MHz_XTAL / 2));
- uart_clock.signal_handler().set(m_z80sio, FUNC(z80sio_device::txca_w));
- uart_clock.signal_handler().append(m_z80sio, FUNC(z80sio_device::rxca_w));
- rs232_port_device &rs232a(RS232_PORT(config, RS232_A_TAG, default_rs232_devices, "terminal"));
- rs232a.rxd_handler().set(m_z80sio, FUNC(z80sio_device::rxa_w));
- rs232a.cts_handler().set(m_z80sio, FUNC(z80sio_device::ctsa_w));
- // tms9918a_device &vdp(TMS9918A(config, TMS9918A_TAG, XTAL(10'738'635)));
- // vdp.set_screen("screen");
- // vdp.set_vram_size(0x4000);
- // // vdp.int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
- // SCREEN(config, "screen", SCREEN_TYPE_RASTER);
- }
- void rc2014_state::init_rc2014()
- {
- }
- INPUT_PORTS_START( rc2014 )
- INPUT_PORTS_END
- /* ROM definition */
- ROM_START( rc2014 )
- ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
- ROM_LOAD( "rc2014.bin", 0x0000, 0x2000, CRC(dd5b9cd9) SHA1(97c176fcb63674f0592851b7858cb706886b5857))
- ROM_END
- /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
- COMP( 2014, rc2014, 0, 0, rc2014, rc2014, rc2014_state, init_rc2014, "RFC2795 Ltd", "RC2014", MACHINE_NO_SOUND_HW)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement