From 199bbed5ee02547f41167805bd86401884dc2050 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 5 Sep 2022 02:00:29 +0600 Subject: [PATCH] NEC CLR1 instructions (#8) Wraps up the fixed bitfield manipulation instructions --- src/cpu/808x.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/cpu/808x.c b/src/cpu/808x.c index 6602e244a..f192bf085 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -1805,6 +1805,25 @@ execx86(int cycs) handled = 1; break; } + case 0x12: /* CLR1 r8/m8, CL*/ + case 0x13: /* CLR1 r16/m16, CL*/ + case 0x1a: /* CLR1 r8/m8, imm3 */ + case 0x1b: /* CLR1 r16/m16, imm4 */ + { + bits = 8 << (opcode & 0x1); + do_mod_rm(); + wait(3, 0); + { + uint8_t bit = (opcode & 0x8) ? (pfq_fetchb()) : (CL); + bit &= ((1 << (3 + (opcode & 0x1))) - 1); + read_ea(0, bits); + + if (bits == 8) seteab((cpu_data & 0xFF) & ~(1 << bit)); + else seteaw((cpu_data & 0xFFFF) & ~(1 << bit)); + } + handled = 1; + break; + } default: { opcode = orig_opcode; break;