;
; group o, test 1
;
; call, return, enter 8, enter 16
;

m4_include(..\tmacros.h)

INIT_TEST(o,0x01)

; declare symbols here
SYM(hop)
SYM(next0)
SYM(next1)
SYM(next2)
SYM(next3)
SYM(next4)
SYM(next4a)
SYM(next5)
SYM(next6)
SYM(next7)
SYM(next8)

; Begin test here
    br	hop

next0:
    ld.16   a,0x4321
    pop	pc


next3:
    copy    a,sp
    cmpb.eq.16  a,0x7000-2,next4a
    FAIL
next4a:
    enter   4
    copy    a,sp
    cmpb.eq.16	a,0x7000-((4)+4),next4
    FAIL
next4:
    pop	sp
    pop	pc

next5:
    enter   500 
    copy    a,sp
    cmpb.eq.16	a,0x7000-((500)+4),next6
    FAIL
next6:
    pop	sp
    pop	pc

hop:

SUBTEST(1)
;   call	disp16

    ld.16   a,0x1234
    call    next0
    cmpb.eq.16	a,0x4321,next1
    FAIL
next1:


SUBTEST(2)
;   call    a
    ld.16   a,next0
    call    a
    cmpb.eq.16	a,0x4321,next2
    FAIL
next2:

SUBTEST(3)
;   enter 8
    call    next3
    copy    a,sp
    cmpb.eq.16	a,0x7000,next7
    FAIL
next7:

;   enter 16
    call    next5
    copy    a,sp
    cmpb.eq.16	a,0x7000,next8
    FAIL
next8:


    
;   Finally, when done branch to pass
    END_TEST
