diff --git a/src/test/kc/tmp-zp-problem.c b/src/test/kc/tmp-zp-problem.c index 88d121a68..8d4e54741 100644 --- a/src/test/kc/tmp-zp-problem.c +++ b/src/test/kc/tmp-zp-problem.c @@ -11,8 +11,10 @@ void main() { for(;;) { for(char i=0;i<10;i++) for(char j=0;j<10;j++) { + // i and j are put into X/Y. The A=X+Y fragment uses $ff as temporary storage. char k = i+j; if(k>0x80) { + // Problem: This will occasionally trigger due to the IRQ interfering with the value in $ff! VICII->BORDER_COLOR++; } } @@ -25,6 +27,7 @@ __mem char * volatile ptr = (char*)0xff00; // The Interrupt Handler __interrupt(rom_sys_c64) void irq() { *BG_COLOR = WHITE; + // ptr has to be moved to ZP for indirection. The fragment uses $fe-f as temporary storage. (*ptr)++; *BG_COLOR = BLACK; } \ No newline at end of file diff --git a/src/test/ref/tmp-zp-problem.asm b/src/test/ref/tmp-zp-problem.asm index b77443db2..3e5f9dfab 100644 --- a/src/test/ref/tmp-zp-problem.asm +++ b/src/test/ref/tmp-zp-problem.asm @@ -74,6 +74,7 @@ main: { jmp __b1 __b3: // char k = i+j + // i and j are put into X/Y. The A=X+Y fragment uses $ff as temporary storage. txa sty.z $ff clc diff --git a/src/test/ref/tmp-zp-problem.log b/src/test/ref/tmp-zp-problem.log index 9d656c280..cf804d559 100644 --- a/src/test/ref/tmp-zp-problem.log +++ b/src/test/ref/tmp-zp-problem.log @@ -412,6 +412,7 @@ main: { // main::@3 __b3: // [13] main::k#0 = main::i#2 + main::j#2 -- vbuaa=vbuxx_plus_vbuyy + // i and j are put into X/Y. The A=X+Y fragment uses $ff as temporary storage. txa sty.z $ff clc @@ -601,6 +602,7 @@ main: { __b3: // char k = i+j // [13] main::k#0 = main::i#2 + main::j#2 -- vbuaa=vbuxx_plus_vbuyy + // i and j are put into X/Y. The A=X+Y fragment uses $ff as temporary storage. txa sty.z $ff clc