From a7cc9d5a537daf86a5dd0df037819aa562553a55 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sat, 21 Aug 2021 11:19:16 -0700 Subject: [PATCH] Tweak comments --- Asm65/OpDef.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Asm65/OpDef.cs b/Asm65/OpDef.cs index 4a2cfd8..21d6843 100644 --- a/Asm65/OpDef.cs +++ b/Asm65/OpDef.cs @@ -326,12 +326,11 @@ namespace Asm65 { /// /// Flag update delegate, used for code flow analysis. /// - /// Previous flags value. + /// Current flags, to be modified by delegate. For conditional + /// branches, this value will be used when the branch is not taken. /// Immediate mode value, if any. Value may be 0-255 /// for an 8-bit operand, or 0-65535 for a 16-bit operand, or -1 if this is /// not an immediate-mode instruction. - /// New flags value. For conditional branches, this is - /// the value to use when the branch is not taken. /// For conditional branches, this is the updated /// value when the branch is taken. private delegate StatusFlags FlagUpdater(StatusFlags flags, int immVal, @@ -997,6 +996,10 @@ namespace Asm65 { BaseMemEffect = MemoryEffect.None, StatusFlagUpdater = delegate (StatusFlags flags, int immVal, ref StatusFlags condBranchTakenFlags) { + // It's potentially useful to update Z here and in BPL. For example, if the + // branch succeeds, it's likely that whatever set N=1 also set Z=0. However, + // you can set Z independently with TRB/TSB and BIT #imm (and of course PHA/PLP). + // These things are rare, but its best to stick with what we know must be true. condBranchTakenFlags.N = 1; flags.N = 0; return flags;