Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/devices/cpu/upd7810/upd7810.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,12 @@ void upd7801_device::write_pc(uint8_t data)
m_pc_out_cb(data);
}

void upd7810_device::write_smh(uint8_t data)
{
if (!BIT(SMH, 2) && BIT(data, 2)) IRR |= INTFST;
SMH = data;
}

void upd7810_device::upd7810_take_irq()
{
uint16_t vector = 0;
Expand Down
1 change: 1 addition & 0 deletions src/devices/cpu/upd7810/upd7810.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class upd7810_device : public cpu_device
virtual void configure_ops();
virtual uint8_t read_pc();
virtual void write_pc(uint8_t data);
void write_smh(uint8_t data);

static const struct opcode_s s_op48[256];
static const struct opcode_s s_op4C[256];
Expand Down
29 changes: 16 additions & 13 deletions src/devices/cpu/upd7810/upd7810_opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ void upd7810_device::MOV_ANM_A()
/* 4d c9: 0100 1101 1100 1001 */
void upd7810_device::MOV_SMH_A()
{
SMH = A;
write_smh(A);
}

/* 4d ca: 0100 1101 1100 1010 */
Expand Down Expand Up @@ -4093,7 +4093,10 @@ void upd7810_device::MVI_ANM_xx()
/* 64 81: 0110 0100 1000 0001 xxxx xxxx */
void upd7810_device::MVI_SMH_xx()
{
RDOPARG( SMH );
uint8_t imm;

RDOPARG( imm );
write_smh(imm);
}

/* 64 83: 0110 0100 1000 0011 xxxx xxxx */
Expand Down Expand Up @@ -4125,7 +4128,7 @@ void upd7810_device::ANI_SMH_xx()
uint8_t imm;

RDOPARG( imm );
SMH &= imm;
write_smh(SMH & imm);
SET_Z(SMH);
}

Expand Down Expand Up @@ -4169,7 +4172,7 @@ void upd7810_device::XRI_SMH_xx()
uint8_t imm;

RDOPARG( imm );
SMH ^= imm;
write_smh(SMH ^ imm);
SET_Z(SMH);
}

Expand Down Expand Up @@ -4213,7 +4216,7 @@ void upd7810_device::ORI_SMH_xx()
uint8_t imm;

RDOPARG( imm );
SMH |= imm;
write_smh(SMH | imm);
SET_Z(SMH);
}

Expand Down Expand Up @@ -4263,7 +4266,7 @@ void upd7810_device::ADINC_SMH_xx()
tmp = SMH + imm;

ZHC_ADD( tmp, SMH, 0 );
SMH = tmp;
write_smh(tmp);
SKIP_NC;
}

Expand Down Expand Up @@ -4371,7 +4374,7 @@ void upd7810_device::SUINB_SMH_xx()
RDOPARG( imm );
tmp = SMH - imm;
ZHC_SUB( tmp, SMH, 0 );
SMH = tmp;
write_smh(tmp);
SKIP_NC;
}

Expand Down Expand Up @@ -4469,7 +4472,7 @@ void upd7810_device::ADI_SMH_xx()
tmp = SMH + imm;

ZHC_ADD( tmp, SMH, 0 );
SMH = tmp;
write_smh(tmp);
}

/* 64 c3: 0110 0100 1100 0011 xxxx xxxx */
Expand Down Expand Up @@ -4562,7 +4565,7 @@ void upd7810_device::ACI_SMH_xx()
tmp = SMH + imm + (PSW & CY);

ZHC_ADD( tmp, SMH, (PSW & CY) );
SMH = tmp;
write_smh(tmp);
}

/* 64 d3: 0110 0100 1101 0011 xxxx xxxx */
Expand Down Expand Up @@ -4653,7 +4656,7 @@ void upd7810_device::SUI_SMH_xx()
RDOPARG( imm );
tmp = SMH - imm;
ZHC_SUB( tmp, SMH, 0 );
SMH = tmp;
write_smh(tmp);
}

/* 64 e3: 0110 0100 1110 0011 xxxx xxxx */
Expand Down Expand Up @@ -4746,7 +4749,7 @@ void upd7810_device::SBI_SMH_xx()
RDOPARG( imm );
tmp = SMH - imm - (PSW & CY);
ZHC_SUB( tmp, SMH, (PSW & CY) );
SMH = tmp;
write_smh(tmp);
}

/* 64 f3: 0110 0100 1111 0011 xxxx xxxx */
Expand Down Expand Up @@ -8746,7 +8749,7 @@ void upd7810_device::SETB()
MKL |= (1 << bit);
break;
case 0x19: /* SMH */
SMH |= (1 << bit);
write_smh(SMH | (1 << bit));
break;
case 0x1b: /* EOM */
EOM |= (1 << bit);
Expand Down Expand Up @@ -8796,7 +8799,7 @@ void upd7810_device::CLR()
MKL &= ~(1 << bit);
break;
case 0x19: /* SMH */
SMH &= ~(1 << bit);
write_smh(SMH & ~(1 << bit));
break;
case 0x1b: /* EOM */
EOM &= ~(1 << bit);
Expand Down
Loading
Loading