From 72dfb0bda352fdfdb2de6fe039db5afcea0561f1 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 8 Feb 2022 20:01:33 +0100 Subject: [PATCH] fix: undefined sys.memcopy when initializing array on cx16 --- compiler/res/prog8lib/c128/syslib.p8 | 1 + compiler/res/prog8lib/c64/syslib.p8 | 1 + compiler/res/prog8lib/cx16/syslib.p8 | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/res/prog8lib/c128/syslib.p8 b/compiler/res/prog8lib/c128/syslib.p8 index 892c13d24..41265747f 100644 --- a/compiler/res/prog8lib/c128/syslib.p8 +++ b/compiler/res/prog8lib/c128/syslib.p8 @@ -555,6 +555,7 @@ sys { } asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { + ; note: can't be inlined because is called from asm as well %asm {{ ldx cx16.r0 stx P8ZP_SCRATCH_W1 ; source in ZP diff --git a/compiler/res/prog8lib/c64/syslib.p8 b/compiler/res/prog8lib/c64/syslib.p8 index 6b7e39ea5..abe614cb0 100644 --- a/compiler/res/prog8lib/c64/syslib.p8 +++ b/compiler/res/prog8lib/c64/syslib.p8 @@ -520,6 +520,7 @@ sys { } asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { + ; note: can't be inlined because is called from asm as well %asm {{ ldx cx16.r0 stx P8ZP_SCRATCH_W1 ; source in ZP diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 443ac50c4..f30da824b 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -821,11 +821,12 @@ sys { }} } - inline asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { + asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { + ; note: can't be inlined because is called from asm as well %asm {{ sta cx16.r2 sty cx16.r2+1 - jsr cx16.memory_copy + jmp cx16.memory_copy }} }