From ee7c4ec51f60e9a6d376d885df1a32a167f1b005 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 23 Apr 2026 19:20:14 -1000 Subject: [PATCH] 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. --- swtp6800/common/m6800.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swtp6800/common/m6800.c b/swtp6800/common/m6800.c index 26bf7dc7..b3de2480 100644 --- a/swtp6800/common/m6800.c +++ b/swtp6800/common/m6800.c @@ -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;