Browse Source

Annotate memcpy with performance information

master
Forest Belton 3 years ago
parent
commit
53ff411302
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/util.s

+ 7
- 7
src/util.s View File

@ -8,18 +8,18 @@ wait_for_vblank::
jr nz, wait_for_vblank jr nz, wait_for_vblank
ret ret
; Copy data between two regions
; Copy data between two regions (takes 40*N+12 cycles)
; @param bc Pointer to the destination region ; @param bc Pointer to the destination region
; @param hl Pointer to the source region ; @param hl Pointer to the source region
; @param d Size (in bytes) to copy. Must be >0 ; @param d Size (in bytes) to copy. Must be >0
; @destroy a, b, c, d, h, l ; @destroy a, b, c, d, h, l
memcpy:: 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 ; Fill a memory region with a value
; @param hl Pointer to the destination region ; @param hl Pointer to the destination region

Loading…
Cancel
Save