1 // license:BSD-3-Clause
2 // copyright-holders:AJR
3 /*******************************************************************************
4 
5     Skeleton driver for IKT-5A terminal.
6 
7 *******************************************************************************/
8 
9 #include "emu.h"
10 //#include "bus/pc_kbd/keyboards.h"
11 //#include "bus/pc_kbd/pc_kbdc.h"
12 //#include "bus/rs232/rs232.h"
13 #include "cpu/mcs51/mcs51.h"
14 #include "machine/eepromser.h"
15 #include "screen.h"
16 
17 class ikt5a_state : public driver_device
18 {
19 public:
ikt5a_state(const machine_config & mconfig,device_type type,const char * tag)20 	ikt5a_state(const machine_config &mconfig, device_type type, const char *tag)
21 		: driver_device(mconfig, type, tag)
22 		, m_maincpu(*this, "maincpu")
23 		, m_eeprom(*this, "eeprom")
24 		, m_chargen(*this, "chargen")
25 	{
26 	}
27 
28 	void ikt5a(machine_config &config);
29 
30 private:
31 	u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
32 
33 	void eeprom_w(u8 data);
34 	u8 p1_r();
35 	void p1_w(u8 data);
36 	u8 p3_r();
37 
38 	void prog_map(address_map &map);
39 	void ext_map(address_map &map);
40 
41 	required_device<mcs51_cpu_device> m_maincpu;
42 	required_device<eeprom_serial_93cxx_device> m_eeprom;
43 	required_region_ptr<u8> m_chargen;
44 };
45 
screen_update(screen_device & screen,bitmap_rgb32 & bitmap,const rectangle & cliprect)46 u32 ikt5a_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
47 {
48 	return 0;
49 }
50 
eeprom_w(u8 data)51 void ikt5a_state::eeprom_w(u8 data)
52 {
53 	m_eeprom->cs_write(BIT(data, 6));
54 	m_eeprom->di_write(BIT(data, 3));
55 	m_eeprom->clk_write(BIT(data, 1));
56 }
57 
p1_r()58 u8 ikt5a_state::p1_r()
59 {
60 	return 0xff;
61 }
62 
p1_w(u8 data)63 void ikt5a_state::p1_w(u8 data)
64 {
65 }
66 
p3_r()67 u8 ikt5a_state::p3_r()
68 {
69 	return 0xdf | (m_eeprom->do_read() << 5);
70 }
71 
prog_map(address_map & map)72 void ikt5a_state::prog_map(address_map &map)
73 {
74 	map(0x0000, 0x3fff).rom().region("maincpu", 0);
75 }
76 
ext_map(address_map & map)77 void ikt5a_state::ext_map(address_map &map)
78 {
79 	map(0x6400, 0x6400).mirror(0xff).w(FUNC(ikt5a_state::eeprom_w));
80 	map(0x8000, 0x9fff).ram();
81 }
82 
ikt5a(machine_config & config)83 void ikt5a_state::ikt5a(machine_config &config)
84 {
85 	I80C51(config, m_maincpu, 15_MHz_XTAL / 2); // PCB 80C51BH-2 (clock uncertain)
86 	m_maincpu->set_addrmap(AS_PROGRAM, &ikt5a_state::prog_map);
87 	m_maincpu->set_addrmap(AS_IO, &ikt5a_state::ext_map);
88 	m_maincpu->port_in_cb<1>().set(FUNC(ikt5a_state::p1_r));
89 	m_maincpu->port_out_cb<1>().set(FUNC(ikt5a_state::p1_w));
90 	m_maincpu->port_in_cb<3>().set(FUNC(ikt5a_state::p3_r));
91 
92 	EEPROM_93C06_16BIT(config, m_eeprom); // ST M9306B6
93 
94 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
95 	screen.set_raw(15_MHz_XTAL, 800, 0, 640, 375, 0, 350); // timings guessed
96 	screen.set_screen_update(FUNC(ikt5a_state::screen_update));
97 	screen.screen_vblank().set_inputline(m_maincpu, MCS51_INT0_LINE);
98 }
99 
100 static INPUT_PORTS_START(ikt5a)
101 INPUT_PORTS_END
102 
103 ROM_START(ikt5a) // 80C51 (+xtal 15.000) // 8k ram // RGB external, uses XT keyboard
104 	ROM_REGION(0x4000, "maincpu", 0)
105 	ROM_LOAD("ver_ih.bin",   0x0000, 0x4000, CRC(5a15b4e8) SHA1(cc0336892279b730f1596f31e129c5a898ecdc8f))
106 
107 	ROM_REGION(0x2000, "chargen", 0)
108 	ROM_LOAD("g26.bin",      0x0000, 0x2000, CRC(657668be) SHA1(212a9eb1fb9b9c16f3cc606c6befbd913ddfa395))
109 ROM_END
110 
111 COMP(1993, ikt5a, 0, 0, ikt5a, ikt5a, ikt5a_state, empty_init, "Creator / Fura Elektronik", "IKT-5A", MACHINE_IS_SKELETON)
112