Skip to content

Commit

Permalink
[CDP1802] Fix error reporting on 2nd operand
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Feb 29, 2024
1 parent 5cdb258 commit 2a4553a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/asm_cdp1802.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ Error AsmCdp1802::encodeImpl(StrScanner &scan, Insn &_insn) const {
return _insn.getError();

emitOperand(insn, insn.mode1(), insn.op1);
if (insn.mode2() == M_ADDR)
if (insn.mode2() == M_ADDR) {
insn.setErrorIf(insn.op2);
insn.emitUint16(insn.op2.val16);
}
return _insn.setError(insn);
}

Expand Down
5 changes: 5 additions & 0 deletions test/test_asm_cdp1802.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,11 @@ static void test_undef() {

AERUS(0x1234, "LBR UNDEF", "UNDEF", 0xC0, 0x00, 0x00);

if (cdp1804()) {
ERUS("RLDI 4, UNDEF", "UNDEF", 0x68, 0xC4, 0x00, 0x00);
ERUS("SCAL 4, UNDEF", "UNDEF", 0x68, 0x84, 0x00, 0x00);
}

TEST("OPTION SMART-BRANCH, ON");
AERUS(0x1234, "BR UNDEF", "UNDEF", 0xC0, 0x00, 0x00);
AERUS(0x1234, "LBR UNDEF", "UNDEF", 0xC0, 0x00, 0x00);
Expand Down

0 comments on commit 2a4553a

Please sign in to comment.