# originally this was the assembler output produced by compiling peekpoke.c... 
#  replaced the normal access via pointer with a
#  special, emulator only instruction to access memory while by-passing the MMU
#  f e d c  b a 9  8  7 6  5 4 3 2 1 0
#  1 1 1 1  1 1 1  D  s s  a a a d d d
# where 
#    D   is direction  0=(An)->Dn  1= Dn->(An)
#    ss  is size 0=byte 01=word 10=long 11=invalid
#    aaa is the address register
#    ddd is the data register
# NOTE - the bit field in the short directive somehow failed.

# this was required since r1v2.8 does NOT support a physical address in SHMGET

# cc dloadv1.c peekpoke.s

        file    "peekpoke.c"
        data    1
        text
        global  peekb
peekb:
        link    %fp,&F%1
        movm.l  &M%1,S%1(%fp)
        mov.l   8(%fp),%a2
	short	0xfe10
#        short   7:-1,1:0,2:0,3:2,3:0
#        mov.b   (%a2),%d2
#        mov.b   %d2,%d0
        ext.w   %d0
        ext.l   %d0
        br      L%12
L%12:
        movm.l  S%1(%fp),&M%1
        unlk    %fp
        rts
        set     S%1,-8
        set     T%1,-8
        set     F%1,-12
        set     M%1,0x0404
        data    1
        text
        global  peekw
peekw:
        link    %fp,&F%2
        movm.l  &M%2,S%2(%fp)
        mov.l   8(%fp),%a2
	short	0xfe50
#        short   7:-1,1:0,2:1,3:2,3:0
#        mov.w   (%a2),%d2
#        mov.w   %d2,%d0
        ext.l   %d0
        br      L%14
L%14:
        movm.l  S%2(%fp),&M%2
        unlk    %fp
        rts
        set     S%2,-8
        set     T%2,-8
        set     F%2,-12
        set     M%2,0x0404
        data    1
        text
        global  peekl
peekl:
        link    %fp,&F%3
        movm.l  &M%3,S%3(%fp)
        mov.l   8(%fp),%a2
	short	0xfe90
#        short   7:-1,1:0,2:2,3:2,3:0
#        mov.l   (%a2),%d2
#        mov.l   %d2,%d0
        br      L%16
L%16:
        movm.l  S%3(%fp),&M%3
        unlk    %fp
        rts
        set     S%3,-8
        set     T%3,-8
        set     F%3,-12
        set     M%3,0x0404
        data    1
        text
        global  pokeb
pokeb:
        link    %fp,&F%4
        movm.l  &M%4,S%4(%fp)
        mov.l   8(%fp),%a2
        mov.b   15(%fp),%d2
	short	0xff12
#        short   7:-1,1:1,2:0,3:2,3:2
#        mov.b   %d2,(%a2)
L%18:
        movm.l  S%4(%fp),&M%4
        unlk    %fp
        rts
        set     S%4,-8
        set     T%4,-8
        set     F%4,-12
        set     M%4,0x0404
        data    1
