* F$LDAXY entry point
FLDAXY   ldx   R$X,u          Get offset within block (S/B $0000-$1FFF)
         ldy   R$Y,u          Get ptr to DAT block entry
         bsr   L0AC8          Go get byte
         sta   R$A,u          Save in caller's A reg.
         rts   

* Entry: X=offset ($0000-$1fff) to get from block pointed to by Y (DAT entry
* format)
L0AC8    lda   1,y            Get MMU block # to get data from
         clrb                 Clear carry/setup for STB
         pshs  cc             Preserve interrupt status/settings
         orcc  #IntMasks      shut IRQ's off
         sta   >$FFA0         Map block into $0000-$1FFF
         brn    L0AC8
         lda   ,x             Get byte
         stb   >$FFA0         Map block 0 into $0000-$1FFF
         fdb   $21ED          LBRN ???
         puls  pc,cc          Get interrupt status/(or turn on) & return

* Get 1st byte of LDDDXY - also used by many other routines
* Increments X on exit; adjusts X for within 8K block & Y (DAT img ptr)
LDAXY    lda   1,y            Get MMU block #
         pshs  b,cc
         clrb
         orcc  #IntMasks      Shut off interrupts
         sta   >$FFA0         Map in MMU block into slot 0
         lda   ,x+            Get byte
          stb   >$FFA0
*         clr   >$FFA0         Map in MMU block #0 into slot 0
*         andcc #^IntMasks
         puls  b,cc
         bra   AdjBlk0

L0AEA    leax  >-DAT.BlSz,x      Bump offset ptr to start of block again
         leay  2,y            Bump source MMU block up to next on in DAT Image
AdjBlk0  cmpx  #DAT.BlSz      Going to wrap out of our block?
         bhs   L0AEA          Yes, go adjust
         rts                  No, return

* F$LDDDXY entry point
FLDDDXY  ldd   R$D,u          Get offset to offset within DAT Image
         leau  R$X,u          Point U to Offset
         pulu  x,y            Y=Offset within DAT Image, X=DAT Image ptr
         bsr   L0B02          Go get 2 bytes
         std   -(R$X+3),u     Save into caller's X
         clrb                 No error & return
         rts   
* Get 2 bytes for LDDDXY (also called by other routines)
* Should simply map in 2 blocks, and do a LDD (don't have to worry about wrap)
L0B02    pshs  u,y,x          Preserve regs
         IFNE  H6309
         addr  d,x            Point X to X+D
         ELSE
         leax  d,x
         ENDC
         bsr   AdjBlk0        Wrap address around for 1 block
         ldu   <D.SysDAT      Get sys DAT Image ptr
*         lda   1,u            Get MMU block #0
         clra             system block 0 =0 always
         ldb   3,u            Get MMU block #1
         tfr   d,u        make U=blocks to re-map in once done
         lda   1,y            Get MMU block #0
         ldb   3,y            Get MMU block #1
         pshs  cc             Preserve int. status
         orcc  #IntMasks      shut off int.
         std   >$FFA0         Map in both blocks
         ldd   ,x             Get 2 bytes
         stu   >$FFA0         Map original blocks in
*         tfr   y,w            Restore W
         puls  pc,u,y,x,cc    Restore regs & return
