From e1d27aa167e887e46515de119b60ab95310bd014 Mon Sep 17 00:00:00 2001 From: "Howard M. Harte" Date: Sat, 5 Nov 2022 19:46:53 -0700 Subject: [PATCH] AltairZ80: i86: Fix bug in AAD instruction. --- AltairZ80/i86_ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AltairZ80/i86_ops.c b/AltairZ80/i86_ops.c index c7a1f4e2..de2b8fab 100644 --- a/AltairZ80/i86_ops.c +++ b/AltairZ80/i86_ops.c @@ -4121,7 +4121,7 @@ static void i86op_opcD3_word_RM_CL(PC_ENV *m) /* opcode=0xd4*/ static void i86op_aam(PC_ENV *m) { uint8 a; - a = fetch_byte_imm(m); /* this is a stupid encoding. */ + a = fetch_byte_imm(m); if (a != 10) sim_printf("CPU: " ADDRESS_FORMAT " Error decoding AAM: Expected 0x0a but got 0x%2x.\n", m->Sp_regs.IP.I16_reg.x_reg, a); /* note the type change here --- returning AL and AH in AX. */ @@ -4132,6 +4132,10 @@ static void i86op_aam(PC_ENV *m) /* opcode=0xd5*/ static void i86op_aad(PC_ENV *m) { + uint8 a; + a = fetch_byte_imm(m); + if (a != 10) + sim_printf("CPU: " ADDRESS_FORMAT " Error decoding AAD: Expected 0x0a but got 0x%2x.\n", m->Sp_regs.IP.I16_reg.x_reg, a); m->R_AX = aad_word(m,m->R_AX); DECODE_CLEAR_SEGOVR(m); }