From 53ff411302fc5a909dc40489998a02f1aebe28f6 Mon Sep 17 00:00:00 2001 From: Forest Belton <65484+forestbelton@users.noreply.github.com> Date: Fri, 9 Jul 2021 05:22:32 -0400 Subject: [PATCH] Annotate memcpy with performance information --- src/util.s | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util.s b/src/util.s index ee4e838..af0f0c9 100644 --- a/src/util.s +++ b/src/util.s @@ -8,18 +8,18 @@ wait_for_vblank:: jr nz, wait_for_vblank ret -; Copy data between two regions +; Copy data between two regions (takes 40*N+12 cycles) ; @param bc Pointer to the destination region ; @param hl Pointer to the source region ; @param d Size (in bytes) to copy. Must be >0 ; @destroy a, b, c, d, h, l memcpy:: - ld a, [hli] - ld [bc], a - inc bc - dec d - jr nz, memcpy - ret + ld a, [hli] ; 8 + ld [bc], a ; 8 + inc bc ; 8 + dec d ; 4 + jr nz, memcpy ; 12/8 + ret ; 16 ; Fill a memory region with a value ; @param hl Pointer to the destination region