;
; group e, test 3
;
; memcopy
;

m4_include(..\tmacros.h)

INIT_TEST(e,0x02)

; Hop over data declarations

; declare symbols here
SYM(hop0)
SYM(source)
SYM(target)
SYM(next0)
SYM(next1)
SYM(next2)
SYM(next3)
SYM(next4)
SYM(next5)

br  hop0

source:
	defb	0xff
	defb	0x01
	defb	0x02
	defb	0x03
	defb	0x04
	defb	0xee
target:
	defb	0x44
	defb	0x45
	defb	0x46
	defb	0x47
	defb	0x48
	defb	0x49

hop0:

; Begin test here

SUBTEST(1)

;   Copy 0 bytes, from source+1 to target+1
    ld.16   a,target+1
    ld.16   b,source+1
    ld.16   c,0
    memcopy

;   Now, test to make sure we didn't step on anything

    ld.16   b,target
    ld.8    a,0(b)
    cmpb.eq.8	a,0x44,next0
    FAIL
next0:
    ld.8    a,1(b)
    cmpb.eq.8	a,0x45,next1
    FAIL
next1:
    ld.8    a,2(b)
    cmpb.eq.8	a,0x46,next2
    FAIL
next2:
    ld.8    a,3(b)
    cmpb.eq.8	a,0x47,next3
    FAIL
next3:
    ld.8    a,4(b)
    cmpb.eq.8	a,0x48,next4
    FAIL
next4:
    ld.8    a,5(b)
    cmpb.eq.8	a,0x49,next5
    FAIL
next5:

;   Finally, when done branch to pass
    END_TEST
