gb-tarot/CopyRange.inc

58 lines
786 B
PHP

CopyRange:
CopyRangeUnsafe:
; hl is source
; de is destination
; bc is length to copy
ld a, b
or a, c
ret z
.loop
ld a, [hl+]
ld [de], a
inc de
dec bc
ld a, b
or a, c ; check if bc is zero
jp nz, .loop
ret
CopyRangeBy8s:
CopyRangeUnsafeBy8s:
; hl is source
; de is destination
; bc is 1/8 of length to copy!!!
; so like this will copy 8*bc bytes!
ld a, b
or a, c
ret z
.loop
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
ld a, [hl+]
ld [de], a
inc de
dec bc
ld a, b
or a, c ; check if bc is zero
jp nz, .loop
ret