;
; group u, test 1
;
; set up page table identical to no paging, turn paging on,
; do a few simple ops, turn paging off do a few simple ops.

m4_include(..\tmacros.h)

INIT_TEST(u,0x01)

; declare symbols here
SYM(loop_exit)
SYM(loop_top)
SYM(fail0)
SYM(next0)
SYM(next1)


SUBTEST(1)

;   set up stack
    ld.16   a,0x7000
    copy    sp,a

;   set things up
    call    setup_page_table

;   turn paging on
    call    paging_on

;  Make sure we still have our predefined data at fixed location
    ld.16   b,MEM0x7FFF_16
    ld.16   a,0(b)
    cmpb.eq.16	a,0x7fff,next0
    FAIL
next0:

;   Now, remap the data page at 0x5000 to page 0
    ld.16   b,0x5000
    ld.16   a,0x8000+0x4000
    wdpte   a,(b)

;   OK - see if we can get MEM0x7FFF in new location
    ld.16   b,MEM0x7FFF_16
    lea	    b,0x5000(b)
    ld.16   a,0(b)
    cmpb.eq.16	a,0x7fff,next1
    FAIL
next1:

;   Clean up
    call    paging_off
    call    setup_page_table

;   Finally, when done branch to pass
    END_TEST


