From 98af13fdfbcff54f50c8a452e880afda851c4589 Mon Sep 17 00:00:00 2001 From: FrederickDietz <141902673+FrederickDietz@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:12:00 -0400 Subject: [PATCH] Update print.s fixed the CLC error. --- print.s | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/print.s b/print.s index 52ce919..b19d120 100644 --- a/print.s +++ b/print.s @@ -37,24 +37,17 @@ PRINT2: .endif beq L29F5 cmp #',' -; Pre-KIM had no CLC. KIM added the CLC -; here. Post-KIM moved the CLC up... -; (makes no sense on KIM, liveness = 0) -.if .def(CONFIG_11A) && (!.def(CONFIG_2)) - clc -.endif +; Instead of relying on a prior CLC here (which might be clobbered by +; JSRs called before the arithmetic), ensure CLC is performed immediately +; before the ADC that depends on it. beq L29DE - cmp #$3B - beq L2A0D - jsr FRMEVL - bit VALTYP - bmi PRSTRING - jsr FOUT - jsr STRLIT + .ifndef CONFIG_NO_CR ldy #$00 lda (FAC_LAST-1),y - clc + ; Explicitly clear carry right before ADC that uses POSX. + ; This makes the code robust even if called routines have modified flags. + clc ; <<-- move/ensure CLC here adc POSX .ifdef KBD cmp #$28