      .include #system
      .include #stddef
      .include #macros
; ------------------------------
; Natuerlich!'s handy dandy
;         RELOCATOR
; (c)1989/1990 by Natuerlich!
; All Rights Reserved.
; not written for speed or
; beauty
; -----------------------------
; change these defines to
; suit your taste. Must be zero
; page though
; -----------------------------
:src     =  $F0               ; -> org prg
:dst     =  $F2               ; -> reloc prg
:dif     =  $F4               ; org-reloc
:mod     =  $F6               ; datatype flag
:siz     =  $F7               ; end of org
:vre     =  $F9               ; -> reltab
:vim     =  $FB               ; -> immtab
;
:foo     =  $FD              ; local vars for immediate
:lpages  =  $FF              ; relocation
:mpages  =  :vre
:entries =  :mod
; ---
b_reloc  DPOKE :src,|R_START  ; uppercase labels come from the
         sta   :foo+1
         
         DMOVE |MEMLO,:dst
         DPOKE :vim,|IMMTAB
         lda   :src           ; calculate    int   :dif, :src, :dst;
         sec                  ; difference
         sbc   :dst           ; between      :dif = :src - :dst
         sta   :dif           ; STATUS QUO
         lda   :src+1         ; and the
         sbc   :dst+1         ; IDEAL
         sta   :dif+1

         jsr   :do_imms       ; wasted bytes

         .include #coderel.s65
         .include #immbrel.s65
