From a69937d8dde7afa5fef1287bd2927b811fa0331e Mon Sep 17 00:00:00 2001 From: Karol Stasiak <karol.m.stasiak@gmail.com> Date: Wed, 25 Sep 2019 01:16:15 +0200 Subject: [PATCH] 8080: Faster strzcpy --- include/string_fastpointers.mfk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/string_fastpointers.mfk b/include/string_fastpointers.mfk index 00dc4cea..032a3dd6 100644 --- a/include/string_fastpointers.mfk +++ b/include/string_fastpointers.mfk @@ -26,6 +26,19 @@ sbyte strzcmp(pointer str1, pointer str2) { } } +#if CPUFEATURE_Z80 || CPUFEATURE_8080 +void strzcopy(pointer dest, pointer src) { + asm { + ? LD HL,(src) + ? LD DE,(dest) + ___strzcopy_loop: + LD A,(HL) + LD (DE),A + ? CP nullchar + ? JP NZ, ___strzcopy_loop + } +} +#else void strzcopy(pointer dest, pointer src) { byte c do { @@ -35,3 +48,4 @@ void strzcopy(pointer dest, pointer src) { dest += 1 } while c != nullchar } +#endif