From 18723590c5603582cf353d08da1172467862b0f9 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 29 Dec 2018 20:33:22 +0100 Subject: [PATCH] should disable irq when doing bcd math --- prog8lib/c64utils.p8 | 2 ++ prog8lib/prog8lib.p8 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/prog8lib/c64utils.p8 b/prog8lib/c64utils.p8 index 4f5b98d02..8212c2549 100644 --- a/prog8lib/c64utils.p8 +++ b/prog8lib/c64utils.p8 @@ -128,6 +128,7 @@ asmsub uword2bcd (uword value @ AY) -> clobbers(A,X) -> () { %asm {{ sta c64.SCRATCH_ZPB1 sty c64.SCRATCH_ZPREG + sei ; disable interrupts because of bcd math sed ; switch to decimal mode lda #0 ; ensure the result is clear sta word2bcd_bcdbuff+0 @@ -149,6 +150,7 @@ asmsub uword2bcd (uword value @ AY) -> clobbers(A,X) -> () { dex ; and repeat for next bit bne - cld ; back to binary + cli ; enable interrupts again rts }} } diff --git a/prog8lib/prog8lib.p8 b/prog8lib/prog8lib.p8 index b405a879e..45b2aa03d 100644 --- a/prog8lib/prog8lib.p8 +++ b/prog8lib/prog8lib.p8 @@ -258,7 +258,7 @@ pop_float_to_indexed_var .proc copy_float .proc ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers Y. + ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. sta SCRATCH_ZPWORD2 sty SCRATCH_ZPWORD2+1 ldy #0