1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
// license:BSD-3-Clause
// copyright-holders:hap
// thanks-to:yoyo_chessboard
/******************************************************************************
* fidel_as12.cpp, subdriver of machine/fidelbase.cpp, machine/chessbase.cpp
*******************************************************************************
Fidelity Elegance Chess Challenger (AS12) overview:
- R65C02P4 CPU @ 4MHz
- 3*8KB ROM(TMM2764), 2*2KB RAM(HM6116)
- PCB label 510-1084B01
This is on the SC12B board, with enough modifications to support more leds and
magnetic chess board sensors. See fidel_sc12.cpp for a more technical description.
******************************************************************************/
#include "emu.h"
#include "includes/fidelbase.h"
#include "cpu/m6502/r65c02.h"
#include "sound/volt_reg.h"
#include "speaker.h"
// internal artwork
#include "fidel_as12.lh" // clickable
namespace {
class as12_state : public fidelbase_state
{
public:
as12_state(const machine_config &mconfig, device_type type, const char *tag) :
fidelbase_state(mconfig, type, tag)
{ }
// machine drivers
void as12(machine_config &config);
private:
// address maps
void main_map(address_map &map);
// I/O handlers
void update_display();
DECLARE_WRITE8_MEMBER(control_w);
DECLARE_WRITE8_MEMBER(led_w);
DECLARE_READ8_MEMBER(input_r);
};
/******************************************************************************
Devices, I/O
******************************************************************************/
// TTL/generic
void as12_state::update_display()
{
// 8*8(+1) chessboard leds
display_matrix(8, 9, m_led_data, m_inp_mux);
}
WRITE8_MEMBER(as12_state::control_w)
{
// d0-d3: 74245 P0-P3
// 74245 Q0-Q8: input mux, led select
u16 sel = 1 << (data & 0xf) & 0x3ff;
m_inp_mux = bitswap<9>(sel,5,8,7,6,4,3,1,0,2);
update_display();
// 74245 Q9: speaker out
m_dac->write(BIT(sel, 9));
// d4,d5: printer?
// d6,d7: N/C?
}
WRITE8_MEMBER(as12_state::led_w)
{
// a0-a2,d0: led data via NE591N
m_led_data = (data & 1) << offset;
update_display();
}
READ8_MEMBER(as12_state::input_r)
{
// a0-a2,d7: multiplexed inputs (active low)
u8 inp = bitswap<8>(read_inputs(9),4,3,2,1,0,5,6,7);
return (inp >> offset & 1) ? 0 : 0x80;
}
/******************************************************************************
Address Maps
******************************************************************************/
void as12_state::main_map(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x0fff).ram();
map(0x1800, 0x1807).w(FUNC(as12_state::led_w)).nopr();
map(0x2000, 0x5fff).r(FUNC(as12_state::cartridge_r));
map(0x6000, 0x6000).mirror(0x1fff).w(FUNC(as12_state::control_w));
map(0x8000, 0x9fff).rom();
map(0xa000, 0xa007).mirror(0x1ff8).r(FUNC(as12_state::input_r));
map(0xc000, 0xffff).rom();
}
/******************************************************************************
Input Ports
******************************************************************************/
static INPUT_PORTS_START( as12 )
PORT_INCLUDE( fidel_cpu_div_4 )
PORT_INCLUDE( generic_cb_magnets )
PORT_START("IN.8")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("RV / Pawn")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("DM / Knight")
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("TB / Bishop")
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("LV / Rook")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("PV / Queen")
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("PB / King")
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CL")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("RE")
INPUT_PORTS_END
/******************************************************************************
Machine Drivers
******************************************************************************/
void as12_state::as12(machine_config &config)
{
/* basic machine hardware */
R65C02(config, m_maincpu, 4_MHz_XTAL); // R65C02P4
m_maincpu->set_addrmap(AS_PROGRAM, &as12_state::div_trampoline);
ADDRESS_MAP_BANK(config, m_mainmap).set_map(&as12_state::main_map).set_options(ENDIANNESS_LITTLE, 8, 16);
const attotime irq_period = attotime::from_hz(585); // from 556 timer (22nF, 110K, 1K)
TIMER(config, m_irq_on).configure_periodic(FUNC(as12_state::irq_on<M6502_IRQ_LINE>), irq_period);
m_irq_on->set_start_delay(irq_period - attotime::from_nsec(15250)); // active for 15.25us
TIMER(config, "irq_off").configure_periodic(FUNC(as12_state::irq_off<M6502_IRQ_LINE>), irq_period);
TIMER(config, "display_decay").configure_periodic(FUNC(as12_state::display_decay_tick), attotime::from_msec(1));
config.set_default_layout(layout_fidel_as12);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
VOLTAGE_REGULATOR(config, "vref").add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
/* cartridge */
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "fidel_scc", "bin,dat");
m_cart->set_device_load(device_image_load_delegate(&as12_state::device_image_load_scc_cartridge, this));
SOFTWARE_LIST(config, "cart_list").set_original("fidel_scc");
}
/******************************************************************************
ROM Definitions
******************************************************************************/
ROM_START( feleg ) // model AS12(or 6085)
ROM_REGION( 0x10000, "mainmap", 0 )
ROM_LOAD("feleg.1", 0x8000, 0x2000, CRC(e9df31e8) SHA1(31c52bb8f75580c82093eb950959c1bc294189a8) ) // TMM2764, no label
ROM_LOAD("feleg.2", 0xc000, 0x2000, CRC(bed9c84b) SHA1(c12f39765b054d2ad81f747e698715ad4246806d) ) // "
ROM_LOAD("feleg.3", 0xe000, 0x2000, CRC(b1fb49aa) SHA1(d8c9687dd564f0fa603e6d684effb1d113ac64b4) ) // "
ROM_END
} // anonymous namespace
/******************************************************************************
Drivers
******************************************************************************/
// YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS
CONS( 1985, feleg, 0, 0, as12, as12, as12_state, empty_init, "Fidelity Electronics", "Elegance Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK | MACHINE_IMPERFECT_CONTROLS | MACHINE_IMPERFECT_TIMING )
|