Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. // license:BSD-3-Clause
  2. // copyright-holders:LuigiThirty
  3.  
  4. #include "emu.h"
  5.  
  6. #include "cpu/z80/z80.h"
  7. #include "machine/z80sio.h"
  8. #include "machine/clock.h"
  9.  
  10. #include "bus/rs232/rs232.h"
  11. #include "video/tms9928a.h"
  12.  
  13. #define Z80SIO_TAG "z80sio"
  14. #define RS232_A_TAG "rs232a"
  15. #define TMS9918A_TAG "tms9918a"
  16.  
  17. class rc2014_state: public driver_device
  18. {
  19. public:
  20. rc2014_state(const machine_config &mconfig, device_type type, const char *tag)
  21. : driver_device(mconfig, type, tag)
  22. , m_maincpu(*this, "maincpu")
  23. , m_z80sio(*this, Z80SIO_TAG)
  24. , m_rs232(*this, RS232_A_TAG)
  25. { }
  26.  
  27. void rc2014(machine_config &config);
  28.  
  29. void init_rc2014();
  30.  
  31. private:
  32.  
  33. virtual void machine_start() override;
  34.  
  35. void io_map(address_map &map);
  36. void mem_map(address_map &map);
  37.  
  38. required_device<cpu_device> m_maincpu;
  39. required_device<z80sio_device> m_z80sio;
  40. required_device<rs232_port_device> m_rs232;
  41. };
  42.  
  43. void rc2014_state::machine_start()
  44. {
  45.  
  46. };
  47.  
  48. void rc2014_state::mem_map(address_map &map)
  49. {
  50. map.unmap_value_high();
  51. map(0x0000, 0x1fff).rom();
  52. map(0x8000, 0xffff).ram();
  53. }
  54.  
  55. void rc2014_state::io_map(address_map &map)
  56. {
  57. /* I/O devices... */
  58. map.unmap_value_high();
  59. map.global_mask(0xff);
  60. map(0x80, 0x83).rw(Z80SIO_TAG, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w));
  61. // map(0x98, 0x99).rw(TMS9918A_TAG, FUNC(tms9918a_device::read), FUNC(tms9918a_device::write));
  62. }
  63.  
  64. void rc2014_state::rc2014(machine_config &config)
  65. {
  66. /* basic machine hardware */
  67. Z80(config, m_maincpu, 7.3728_MHz_XTAL / 2);
  68. m_maincpu->set_addrmap(AS_PROGRAM, &rc2014_state::mem_map);
  69. m_maincpu->set_addrmap(AS_IO, &rc2014_state::io_map);
  70.  
  71. Z80SIO(config, m_z80sio, 7.3728_MHz_XTAL / 2);
  72. m_z80sio->set_cputag(m_maincpu);
  73. m_z80sio->out_txda_callback().set(m_rs232, FUNC(rs232_port_device::write_txd));
  74. m_z80sio->out_rtsa_callback().set(m_rs232, FUNC(rs232_port_device::write_rts));
  75.  
  76. clock_device &uart_clock(CLOCK(config, "uart_clock", 7.3728_MHz_XTAL / 2));
  77. uart_clock.signal_handler().set(m_z80sio, FUNC(z80sio_device::txca_w));
  78. uart_clock.signal_handler().append(m_z80sio, FUNC(z80sio_device::rxca_w));
  79.  
  80. rs232_port_device &rs232a(RS232_PORT(config, RS232_A_TAG, default_rs232_devices, "terminal"));
  81. rs232a.rxd_handler().set(m_z80sio, FUNC(z80sio_device::rxa_w));
  82. rs232a.cts_handler().set(m_z80sio, FUNC(z80sio_device::ctsa_w));
  83.  
  84. // tms9918a_device &vdp(TMS9918A(config, TMS9918A_TAG, XTAL(10'738'635)));
  85. // vdp.set_screen("screen");
  86. // vdp.set_vram_size(0x4000);
  87. // // vdp.int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
  88. // SCREEN(config, "screen", SCREEN_TYPE_RASTER);
  89. }
  90.  
  91. void rc2014_state::init_rc2014()
  92. {
  93.  
  94. }
  95.  
  96. INPUT_PORTS_START( rc2014 )
  97.  
  98. INPUT_PORTS_END
  99.  
  100. /* ROM definition */
  101. ROM_START( rc2014 )
  102. ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
  103. ROM_LOAD( "rc2014.bin", 0x0000, 0x2000, CRC(dd5b9cd9) SHA1(97c176fcb63674f0592851b7858cb706886b5857))
  104. ROM_END
  105.  
  106. /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
  107. 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