Skip to content

Commit 574e71a

Browse files
committed
r65c52: simplify update_irq, add call to update_irq at each place ier or isr changes, add debugger side effects check on reads,
misc: update notes
1 parent c8c9640 commit 574e71a

File tree

5 files changed

+54
-50
lines changed

5 files changed

+54
-50
lines changed

Diff for: src/devices/machine/r65c52.cpp

+48-45
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,24 @@ r65c52_device::r65c52_device(const machine_config &mconfig, const char *tag, dev
5656
}
5757

5858
const int r65c52_device::internal_divider[16] =
59-
{
60-
4608,
61-
2096,
62-
1713,
63-
1536,
64-
768,
65-
384,
66-
192,
67-
128,
68-
96,
69-
64,
70-
48,
71-
32,
72-
24,
73-
12,
74-
6,
75-
1};
59+
{
60+
4608,
61+
2096,
62+
1713,
63+
1536,
64+
768,
65+
384,
66+
192,
67+
128,
68+
96,
69+
64,
70+
48,
71+
32,
72+
24,
73+
12,
74+
6,
75+
1
76+
};
7677

7778
void r65c52_device::device_add_mconfig(machine_config &config)
7879
{
@@ -258,19 +259,8 @@ void r65c52_device::output_dtr(int idx, int dtr)
258259

259260
void r65c52_device::update_irq(int idx)
260261
{
261-
bool irq = false;
262262
LOG("R65C52: %x IER %x ISR %x\n", idx + 1, m_ier[idx], m_isr[idx]);
263-
for (int i = 0; i < 7; i++)
264-
{
265-
int ier_bit = BIT(m_ier[idx],i);
266-
int isr_bit = BIT(m_isr[idx],i);
267-
268-
if ((ier_bit == isr_bit) && (ier_bit ==1))
269-
{
270-
irq = true;
271-
}
272-
}
273-
output_irq(idx, irq);
263+
output_irq(idx, (m_ier[idx] & m_isr[idx] & 0x7f) ? 1 : 0);
274264
}
275265

276266
void r65c52_device::update_divider(int idx)
@@ -310,21 +300,27 @@ void r65c52_device::update_divider(int idx)
310300

311301
u8 r65c52_device::read_rdr(int idx)
312302
{
313-
m_status[idx] &= ~(SR_BRK | SR_FRAMING_ERROR);
314-
m_isr[idx] &= ~(IRQ_PAR | IRQ_FOB | IRQ_RDRF);
315-
m_rdrf[idx] = false;
316-
m_parity_err[idx] = false;
317-
m_overrun[idx] = false;
318-
update_irq(idx);
319-
LOG("R65C52: %x RDR %x \n", idx + 1, m_rdr[idx]);
303+
if (!machine().side_effects_disabled())
304+
{
305+
m_status[idx] &= ~(SR_BRK | SR_FRAMING_ERROR);
306+
m_isr[idx] &= ~(IRQ_PAR | IRQ_FOB | IRQ_RDRF);
307+
m_rdrf[idx] = false;
308+
m_parity_err[idx] = false;
309+
m_overrun[idx] = false;
310+
LOG("R65C52: %x RDR %x \n", idx + 1, m_rdr[idx]);
311+
update_irq(idx);
312+
}
320313
return m_rdr[idx];
321314
}
322315

323316
u8 r65c52_device::read_status(int idx)
324317
{
325-
LOG("R65C52: %x STATUS %x \n", idx + 1, m_status[idx]);
326-
m_dtr[idx] = false;
327-
m_rts[idx] = false;
318+
if (!machine().side_effects_disabled())
319+
{
320+
LOG("R65C52: %x STATUS %x \n", idx + 1, m_status[idx]);
321+
m_dtr[idx] = false;
322+
m_rts[idx] = false;
323+
}
328324
return m_status[idx];
329325
}
330326

@@ -340,14 +336,17 @@ void r65c52_device::write_ier(int idx, u8 data)
340336
}
341337

342338
LOG("R65C52: %x IER %x \n", idx + 1, m_ier[idx]);
339+
update_irq(idx);
343340
}
344341

345342
void r65c52_device::write_tdr(int idx, u8 data)
346343
{
347344
m_tdr[idx] = data;
348345
m_tdre[idx] = false;
349346
m_isr[idx] &= ~IRQ_TDRE;
347+
350348
LOG("R65C52: %x TDR %x \n", idx + 1, m_tdr[idx]);
349+
update_irq(idx);
351350
}
352351

353352
void r65c52_device::write_control(int idx, u8 data)
@@ -416,15 +415,14 @@ void r65c52_device::write_compare(int idx, u8 data)
416415

417416
u8 r65c52_device::read_isr(int idx)
418417
{
418+
u8 isr = m_isr[idx];
419419

420420
if (m_status[idx] & SR_BRK || m_status[idx] & SR_FRAMING_ERROR || m_overrun[idx])
421421
{
422-
m_isr[idx] |= IRQ_FOB;
422+
isr |= IRQ_FOB;
423423
}
424424

425-
u8 isr = m_isr[idx];
426-
427-
if (isr != 0)
425+
if ((isr & 0x7f) != 0)
428426
{
429427
isr |= 0x80;
430428
}
@@ -440,9 +438,14 @@ u8 r65c52_device::read_isr(int idx)
440438
isr &= ~0x80;
441439
}
442440

443-
m_isr[idx] &= ~(IRQ_CTS | IRQ_DCD | IRQ_DSR | IRQ_FOB);
441+
isr &= ~(IRQ_CTS | IRQ_DCD | IRQ_DSR | IRQ_FOB);
444442

445-
LOG("R65C52: %x ISR %x \n", idx + 1, m_isr[idx]);
443+
if (!machine().side_effects_disabled())
444+
{
445+
m_isr[idx] = isr;
446+
LOG("R65C52: %x ISR %x \n", idx + 1, m_isr[idx]);
447+
update_irq(idx);
448+
}
446449

447450
return isr;
448451
}

Diff for: src/mame/excalibur/ivant.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// thanks-to:Sean Riddle
44
/*******************************************************************************
55
6-
Excalibur Ivan The Terrible
6+
Excalibur Ivan The Terrible (model 701E)
77
88
The chess engine is by Ron Nelson, similar to the one in Excalibur Mirage. It
99
has speech, and also sound effects that are reminiscent of Battle Chess.

Diff for: src/mame/hegenerglaser/brikett.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ESB 6000 board interface (via external port):
6969
- TC4081, TC4082, TC4017, 74373, 74374
7070
7171
ESB II/6000 chessboard:
72-
- 64 reed switches (magnet sensors)
72+
- 128 reed switches (magnet sensors, 2 per square)
7373
- 64 leds + power led
7474
7575
ESB 3000 hardware is probably same as ESB 6000.
@@ -317,7 +317,7 @@ void brikett_state::esb6_w(u8 data)
317317

318318
int brikett_state::esb6_r()
319319
{
320-
// EF1: read chessboard sensor
320+
// EF1: read chessboard square
321321
if (m_inputs[5].read_safe(0))
322322
return (m_board->read_file(m_esb_select - 2) & ~m_esb_row) ? 0 : 1;
323323
else

Diff for: src/mame/hegenerglaser/risc.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Mephisto Risc 1MB/II (stylized "risc")
66
77
The chess engine in Mephisto Risc is also compatible with Tasc's The ChessMachine,
8+
it is more or less equivalent to Gideon 3.0 (Risc 1MB) and Gideon 3.1 (Risc II),
89
see ROM defs for details. "Main" CPU is slow, but all the chess calculations are
910
done with the ARM.
1011

Diff for: src/mame/saitek/companion2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If this is not done, NVRAM won't save properly.
1414
TODO:
1515
- if/when MAME supports an exit callback, hook up power-off switch to that
1616
17-
********************************************************************************
17+
================================================================================
1818
1919
Hardware notes:
2020
@@ -50,7 +50,7 @@ is either VCC or GND to distinguish between the two.
5050
5151
The Tandy clones run at a lower clock frequency, 3MHz and 6MHz respectively.
5252
53-
********************************************************************************
53+
================================================================================
5454
5555
CXG Enterprise "S" / Star Chess is on very similar hardware, so it's emulated
5656
in this driver too.

0 commit comments

Comments
 (0)