should disable irq when doing bcd math

This commit is contained in:
Irmen de Jong 2018-12-29 20:33:22 +01:00
parent 575bc7aa9a
commit 18723590c5
2 changed files with 3 additions and 1 deletions

View File

@ -128,6 +128,7 @@ asmsub uword2bcd (uword value @ AY) -> clobbers(A,X) -> () {
%asm {{ %asm {{
sta c64.SCRATCH_ZPB1 sta c64.SCRATCH_ZPB1
sty c64.SCRATCH_ZPREG sty c64.SCRATCH_ZPREG
sei ; disable interrupts because of bcd math
sed ; switch to decimal mode sed ; switch to decimal mode
lda #0 ; ensure the result is clear lda #0 ; ensure the result is clear
sta word2bcd_bcdbuff+0 sta word2bcd_bcdbuff+0
@ -149,6 +150,7 @@ asmsub uword2bcd (uword value @ AY) -> clobbers(A,X) -> () {
dex ; and repeat for next bit dex ; and repeat for next bit
bne - bne -
cld ; back to binary cld ; back to binary
cli ; enable interrupts again
rts rts
}} }}
} }

View File

@ -258,7 +258,7 @@ pop_float_to_indexed_var .proc
copy_float .proc copy_float .proc
; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, ; -- 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 sta SCRATCH_ZPWORD2
sty SCRATCH_ZPWORD2+1 sty SCRATCH_ZPWORD2+1
ldy #0 ldy #0