51 lines
774 B
Z80 Assembly
51 lines
774 B
Z80 Assembly
;*
|
|
;* MEMORY.ASM - Memory Manipulation Code
|
|
;* by GABY. Inspired by Carsten Sorensen & others.
|
|
;*
|
|
;* V1.0 - Original release
|
|
;*
|
|
|
|
;If all of these are already defined, don't do it again.
|
|
|
|
IF !DEF(MEMORY_ASM)
|
|
MEMORY_ASM SET 1
|
|
|
|
SECTION "Memory Code",ROM0
|
|
|
|
mem_Set::
|
|
inc b
|
|
inc c
|
|
jr .skip
|
|
.loop ld [hl+],a
|
|
.skip dec c
|
|
jr nz,.loop
|
|
dec b
|
|
jr nz,.loop
|
|
ret
|
|
|
|
;***************************************************************************
|
|
;*
|
|
;* mem_Copy - "Copy" a memory region
|
|
;*
|
|
;* input:
|
|
;* hl - pSource
|
|
;* de - pDest
|
|
;* bc - bytecount
|
|
;*
|
|
;***************************************************************************
|
|
mem_Copy::
|
|
inc b
|
|
inc c
|
|
jr .skip
|
|
.loop ld a,[hl+]
|
|
ld [de],a
|
|
inc de
|
|
.skip dec c
|
|
jr nz,.loop
|
|
dec b
|
|
jr nz,.loop
|
|
ret
|
|
|
|
ENDC ;MEMORY1_ASM
|
|
|