Skip to content

Commit 61ab1c2

Browse files
committed
nec/pc8401a.cpp: rework irq to be a free running timer
1 parent 835415a commit 61ab1c2

File tree

1 file changed

+23
-30
lines changed

1 file changed

+23
-30
lines changed

src/mame/nec/pc8401a.cpp

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,27 @@
77
88
TODO:
99
10-
- Need a media device to be in any way useful
11-
(throws E27 directory full if attempting to create a new file thru WS -> D -> new file name)
12-
- keyboard interrupt
10+
- keyboard key modifiers (f6-f10 presumably needs holding shift like PC-8001);
11+
\- Option testing beyond f5;
12+
\- Cannot do anything useful with filer (usage: "filer <filename>"), needs F6;
1313
- RTC TP pulse
14-
- clock does not advance in menu (timer irq?)
1514
- some unclear bits in the banking scheme;
1615
- mirror e800-ffff to 6800-7fff (why? -AS)
1716
- How PC-8508A really banks?
1817
- soft power on/off
18+
- idle sleep timer off by a bunch of seconds (option -> power to test);
1919
- NVRAM
2020
- 8251 USART
2121
- 8255 ports
22-
- Merge keyboard with pc8001 / pc8801 / pc88va (same keys, running on a MCU like VA)
2322
- PC-8431A FDC is same family as PC-80S31K, basically the 3.5" version of it.
2423
Likely none of the available BIOSes fits here.
2524
25+
Notes:
26+
- Need to format internal RAM before using WS, "format -> F1 -> y"
27+
2628
- peripherals
2729
* PC-8431A Dual Floppy Drive
28-
* PC-8441A CRT / Disk Interface (MC6845, monochrome)
30+
* PC-8441A CRT / Disk Interface (MC6845, monochrome & color variants)
2931
* PC-8461A 1200 Baud Modem
3032
* PC-8407A 128KB RAM Expansion
3133
* PC-8508A ROM/RAM Cartridge
@@ -138,7 +140,7 @@ class pc8401a_state : public driver_device
138140

139141
void bankdev0_map(address_map &map);
140142

141-
// TODO: these two should really be inside ram_device instead
143+
// TODO: temp, should really be a NVRAM device
142144
template <unsigned StartBase> uint8_t ram_r(address_space &space, offs_t offset)
143145
{
144146
const offs_t memory_offset = StartBase + offset;
@@ -180,33 +182,27 @@ void pc8401a_state::pc8500_lcdc(address_map &map)
180182

181183
void pc8401a_state::scan_keyboard()
182184
{
183-
if (!m_key_irq_enable)
184-
return;
185-
int strobe = 0;
186-
187185
/* scan keyboard */
186+
// TODO: is this just a generic key pressed shortcut rather than being MCU based?
188187
for (int row = 0; row < 10; row++)
189188
{
190189
uint8_t data = m_io_y[row]->read();
191190

192191
if (data != 0xff)
193192
{
194-
strobe = 1;
195-
m_key_latch = data;
193+
//strobe = 1;
194+
m_key_latch |= 1;
196195
}
197196
}
198197

199-
if (!m_key_strobe && strobe)
200-
{
201-
m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xef); // Z80 - RST 28h
202-
}
203-
204-
if (strobe) m_key_strobe = strobe;
198+
m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xef); // Z80 - RST 28h
199+
m_key_strobe = 1;
205200
}
206201

207202
TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_state::keyboard_tick)
208203
{
209-
scan_keyboard();
204+
if (m_key_irq_enable)
205+
scan_keyboard();
210206
}
211207

212208
/*
@@ -215,8 +211,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_state::keyboard_tick)
215211
* 0 key pressed
216212
* 1
217213
* 2
218-
* 3
219-
* 4 must be 1 or CPU goes to HALT (power switch status?)
214+
* 3 <unknown>, disables all keys if on
215+
* 4 must be 1 or CPU goes to HALT (power status)
220216
* 5
221217
* 6
222218
* 7
@@ -405,14 +401,14 @@ void pc8401a_state::pc8500_io(address_map &map)
405401
// map(0x80, 0x80) modem status, set to 0xff to boot
406402
// map(0x8b, 0x8b)
407403
// map(0x90, 0x93)
408-
// map(0x98, 0x98).w(m_crtc, FUNC(mc6845_device::address_w));
409-
// map(0x99, 0x99).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
404+
// map(0x98, 0x98).w(m_crtc, FUNC(mc6845_device::address_w));
405+
// map(0x99, 0x99).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
410406
map(0x98, 0x99).noprw();
411407
// map(0xa0, 0xa1)
412408
map(0xb0, 0xb3).w(FUNC(pc8401a_state::io_rom_addr_w));
413409
map(0xb3, 0xb3).r(FUNC(pc8401a_state::io_rom_data_r));
414410
// map(0xc8, 0xc8)
415-
// map(0xfc, 0xff).rw(I8255A_TAG, FUNC(i8255_device::read), FUNC(i8255_device::write));
411+
// map(0xfc, 0xff).rw(I8255A_TAG, FUNC(i8255_device::read), FUNC(i8255_device::write));
416412
map(0xfc, 0xff).noprw();
417413
}
418414

@@ -548,7 +544,8 @@ void pc8401a_state::pc8500(machine_config &config)
548544
m_maincpu->set_addrmap(AS_PROGRAM, &pc8401a_state::pc8401a_mem);
549545
m_maincpu->set_addrmap(AS_IO, &pc8401a_state::pc8500_io);
550546

551-
TIMER(config, "keyboard").configure_periodic(FUNC(pc8401a_state::keyboard_tick), attotime::from_hz(44));
547+
// unknown frequency, roughly fits idle sleep mode
548+
TIMER(config, "keyboard").configure_periodic(FUNC(pc8401a_state::keyboard_tick), attotime::from_hz(60));
552549

553550
UPD1990A(config, m_rtc);
554551

@@ -590,10 +587,6 @@ ROM_START( pc8500 )
590587
ROM_REGION( 0x20000, IPL_TAG, ROMREGION_ERASEFF )
591588
ROM_LOAD( "pc8500.bin", 0x0000, 0x10000, CRC(c2749ef0) SHA1(f766afce9fda9ec84ed5b39ebec334806798afb3) )
592589

593-
// TODO: identify this
594-
ROM_REGION( 0x1000, "mcu", 0)
595-
ROM_LOAD( "kbd.rom", 0x0000, 0x1000, NO_DUMP )
596-
597590
//ROM_REGION( 0x1000, "chargen", 0 )
598591
//ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP )
599592
ROM_END

0 commit comments

Comments
 (0)