1 // license:GPL-2.0+
2 // copyright-holders:Peter Trauner
3 #include "emu.h"
4 #include "cpu/sc61860/sc61860.h"
5 
6 #include "includes/pocketc.h"
7 #include "includes/pc1251.h"
8 
9 /* C-CE while reset, program will not be destroyed! */
10 
out_b_w(uint8_t data)11 void pc1251_state::out_b_w(uint8_t data)
12 {
13 	m_outb = data;
14 }
15 
out_c_w(uint8_t data)16 void pc1251_state::out_c_w(uint8_t data)
17 {
18 }
19 
in_a_r()20 uint8_t pc1251_state::in_a_r()
21 {
22 	int data = m_outa;
23 
24 	if (BIT(m_outb, 0))
25 	{
26 		data |= m_keys[0]->read();
27 
28 		/* At Power Up we fake a 'CL' pressure */
29 		if (m_power)
30 			data |= 0x02;       // problem with the deg lcd
31 	}
32 
33 	if (BIT(m_outb, 1))
34 		data |= m_keys[1]->read();
35 
36 	if (BIT(m_outb, 2))
37 		data |= m_keys[2]->read();
38 
39 	for (int bit = 0, key = 3; bit < 7; bit++, key++)
40 		if (BIT(m_outa, bit))
41 			data |= m_keys[key]->read();
42 
43 	return data;
44 }
45 
in_b_r()46 uint8_t pc1251_state::in_b_r()
47 {
48 	int data = m_outb;
49 
50 	if (BIT(m_outb, 3))
51 		data |= m_mode->read() & 0x07;
52 
53 	return data;
54 }
55 
READ_LINE_MEMBER(pc1251_state::reset_r)56 READ_LINE_MEMBER(pc1251_state::reset_r)
57 {
58 	return BIT(m_extra->read(), 1);
59 }
60 
machine_start()61 void pc1251_state::machine_start()
62 {
63 	pocketc_state::machine_start();
64 
65 	m_ram_nvram->set_base(memregion("maincpu")->base() + 0x8000, 0x4800);
66 
67 	uint8_t *gfx = memregion("gfx1")->base();
68 	for (int i = 0; i < 128; i++)
69 		gfx[i] = i;
70 }
71 
machine_start()72 void pc1260_state::machine_start()
73 {
74 	pocketc_state::machine_start();
75 
76 	m_ram_nvram->set_base(memregion("maincpu")->base() + 0x4000, 0x2800);
77 
78 	uint8_t *gfx = memregion("gfx1")->base();
79 	for (int i = 0; i < 128; i++)
80 		gfx[i] = i;
81 }
82