cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

hiramcpy.s (444B)


      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
     271$:
     28	LD	A,(HL+)
     29	LDH	(C),A
     30	INC	C
     31	DEC	D
     32	JR	NZ,1$
     33	LD	C,E
     34	RET