From 2967866e3d01a6fb6d2458c42fe6b71b8ae860f8 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 23 Aug 2024 17:46:23 +0200 Subject: [PATCH] avoid self-modifying code to be compatible with IRQ handlers --- compiler/res/prog8lib/string.p8 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/res/prog8lib/string.p8 b/compiler/res/prog8lib/string.p8 index 3eead5127..121001ac0 100644 --- a/compiler/res/prog8lib/string.p8 +++ b/compiler/res/prog8lib/string.p8 @@ -134,11 +134,11 @@ _startloop dey ; need to copy the the cx16 virtual registers to zeropage to make this run on C64... sta P8ZP_SCRATCH_W1 sty P8ZP_SCRATCH_W1+1 - stx _comparemod+1 + stx P8ZP_SCRATCH_B1 ldy #0 - lda (P8ZP_SCRATCH_W1),y beq _notfound -_comparemod cmp #0 ; modified + cmp P8ZP_SCRATCH_B1 beq _found iny bne - @@ -155,7 +155,7 @@ _found tya ; Locates the first position of the given character in the string, starting from the right. ; returns Carry set if found + index in A, or Carry clear if not found (and A will be 255, an invalid index). %asm {{ - stx _comparemod+1 + stx P8ZP_SCRATCH_B1 sta _str sty _str+1 jsr string.length @@ -165,7 +165,7 @@ _found tya lda _str+1 sta P8ZP_SCRATCH_W1+1 - lda (P8ZP_SCRATCH_W1),y -_comparemod cmp #0 ; modified + cmp P8ZP_SCRATCH_B1 beq _found dey cpy #255