git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/libc/targets/sm83/hiramcpy.s

      1 	.include	"global.s"
      2 
      3 	.area	_HOME
      4 
      5 _hiramcpy::
      6 	LDA	HL,2(SP)	; Skip return address and registers
      7 	LD	E,(HL)		; E = dst
      8 	LDA	HL,5(SP)
      9 	LD	A,(HL-)
     10 	LD	D, A		; D = n
     11 	LD	A,(HL-)		; HL = src
     12 	LD	L,(HL)
     13 	LD	H,A
     14 
     15 	;; Copy memory zone to HIRAM
     16 	;; 
     17 	;; Entry conditions
     18 	;;   E = destination
     19 	;;   D = length
     20 	;;   HL = source
     21 	;; 
     22 	;; Preserves: BC
     23 .hiramcpy::
     24 	LD	A,E
     25 	LD	E,C
     26 	LD	C,A
     27 1$:
     28 	LD	A,(HL+)
     29 	LDH	(C),A
     30 	INC	C
     31 	DEC	D
     32 	JR	NZ,1$
     33 	LD	C,E
     34 	RET

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.