1
0
mirror of https://github.com/simh/simh.git synced 2026-05-15 17:59:58 +00:00

SWTP6800: Correct flags computation for SBC A

When compiling with `-O -Wall -Werror`, the compiler produced
a diagnostic that `op1` was used uninitialized in these
two locations.

Similar to the implementation of `case 0xC0: /* SUB M imm */`,
save the initial value of the `A` operand in `op1` so that the
flags can be computed correctly.
This commit is contained in:
Jeff Epler
2026-04-23 19:20:14 -10:00
committed by Mark Pizzolato
parent 5981b637b7
commit ee7c4ec51f

View File

@@ -1098,6 +1098,7 @@ t_stat sim_instr (void)
break;
case 0x92: /* SBC A dir */
lo = (get_dir_val() + get_flag(CF)) & BYTEMASK; //RSV - fixed ordering problem
op1 = A;
A = A - lo;
COND_SET_FLAG_C(A);
A &= BYTEMASK;
@@ -1202,6 +1203,7 @@ t_stat sim_instr (void)
break;
case 0xA2: /* SBC A ind */
lo = (get_indir_val() + get_flag(CF)) & BYTEMASK; //RSV - fixed ordering problem
op1 = A;
A = A - lo;
COND_SET_FLAG_C(A);
A &= BYTEMASK;