ht1130: system clock is stopped when halted so don't enter the icount loop

This commit is contained in:
hap 2023-12-26 20:12:39 +01:00
parent 6222175a22
commit 2857d5251c

View File

@ -4,11 +4,12 @@
/* /*
TODO: TODO:
Interrupts (not used by brke23p2) - Interrupts (not used by brke23p2)
Sound (needs internal frequency ROM data?) - Sound (needs internal frequency ROM data?)
IO wake-up from HALT etc. - IO wake-up from HALT etc.
1 machine cycle (eg. a 1 byte opcode) takes 4 system clock cycles (from OSC pins). - 1 machine cycle (eg. a 1 byte opcode) takes 4 system clock cycles (from OSC pins).
The timer rate can be configured with a mask option (system clock / 2^n), n=0-13 (except 6 for some reason). So, timer rate can be faster or slower than machine cycle rate. - The timer rate can be configured with a mask option (system clock / 2^n), n=0-13 (except 6 for some reason).
So, timer rate can be faster or slower than machine cycle rate.
*/ */
@ -441,7 +442,7 @@ void ht1130_device::do_op()
return; return;
} }
case 0b00011111: // OR [R1R0],A : Logically OR data memory with accumulator case 0b00011111: // OR [R1R0],A : Logical OR data memory with accumulator
{ {
const u8 data = getr1r0_data(); const u8 data = getr1r0_data();
const u8 acc = getacc(); const u8 acc = getacc();
@ -1015,6 +1016,8 @@ void ht1130_device::do_op()
if (operand == 0b00111110) // this is a 'NOP' must HALT always be followed by NOP to work? if (operand == 0b00111110) // this is a 'NOP' must HALT always be followed by NOP to work?
{ {
m_inhalt = 1; m_inhalt = 1;
if (m_icount > 0)
m_icount = 0;
} }
else else
{ {
@ -1033,18 +1036,17 @@ void ht1130_device::do_op()
void ht1130_device::execute_run() void ht1130_device::execute_run()
{ {
if (m_inhalt)
{
m_icount = 0;
return;
}
while (m_icount > 0) while (m_icount > 0)
{ {
debugger_instruction_hook(m_pc); debugger_instruction_hook(m_pc);
if (!m_inhalt) do_op();
{
do_op();
}
else
{
m_icount--;
}
if (m_timer & 0x100) if (m_timer & 0x100)
{ {