;
; group r, test 1
;
; cmpb.le.8 a,u16(dp),e8
; cmpb.le.8 a,u8(sp),d8
; cmpb.le.8 a,u8(b),d8
; cmpb.le.8 a,i8
; cmpb.le.8 a,0
; cmpb.le.8 a,b
;

m4_include(..\tmacros.h)

INIT_TEST(s,0x02)

; declare symbols here
SYM(hop)
SYM(d1)
SYM(d2)
SYM(d3)
SYM(next0)
SYM(next1)
SYM(next2)
SYM(next3)
SYM(next4)
SYM(next5)
SYM(next6)
SYM(next7)
SYM(next8)
SYM(next9)
SYM(next10)
SYM(next11)
SYM(next12)
SYM(fail0)
SYM(fail1)
SYM(fail2)
SYM(fail3)
SYM(fail4)
SYM(fail5)

    br	hop

d1:
    defb    0xff
    defb    0xff
    defb    -2
d2:
    defb    0x00
    defb    0x44
    defb    -128
d3:
    defb    0x0f
    defb    0x70
    defb    0x0e

hop:
; Begin test here

SUBTEST(1)
;   cmpb.le.8  a,u16(dp),d8
    ld.16   a,d1
    lea	    a,-555(a)
    copy    dp,a
    ld.8    a,555(dp)
    cmpb.le.8	a,555+1(dp),next0
    FAIL
next0:
    cmpb.le.8	a,555+2(dp),fail0
    br	next2
fail0:
    FAIL
next2:

SUBTEST(2)
;   cmpb.le.8	a,u8(sp),d8
    ld.16   a,d2
    lea	a,-44(a)
    copy    sp,a
    ld.8    a,44(sp)
    cmpb.le.8	a,44+1(sp),next3
    FAIL
next3:
    cmpb.le.8	a,44+2(sp),fail1
    br	next4
fail1:
    FAIL
next4:
    ld.16   a,0x7000
    copy    sp,a

SUBTEST(3)
;   cmpb.le.8	a,u8(b),d8
    ld.16   b,d3
    lea	    b,-200(b)
    ld.8    a,200(b)
    cmpb.le.8	a,200+1(b),next5
    FAIL
next5:
    cmpb.le.8	a,200+2(b),fail2
    br	next6
fail2:
    FAIL
next6:

SUBTEST(4)
;   cmpb.le.8	a,i8,d8
    ld.8    a,-127
    cmpb.le.8	a,-127,next7
    FAIL
next7:
    cmpb.le.8	a,-128,fail3
    br	next8
fail3:
    FAIL
next8:

SUBTEST(5)
;   cmpb.le.8	a,0,d8
    ld.8    a,0
    cmpb.le.8	a,0xf,next9
    FAIL
next9:
    cmpb.le.8	a,-128,fail4
    br	next10
fail4:
    FAIL
next10:

SUBTEST(6)
;   cmpb.le.8	a,b,d8
    ld.8    a,-12
    ld.8    b,12
    cmpb.le.8	a,b,next11
    FAIL
next11:
    ld.8    b,-112
    cmpb.le.8	a,b,fail5
    br	next12
fail5:
    FAIL
next12:





;   Finally, when done branch to pass
    END_TEST
