home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / nasm20 / nasm20s / preloc.s65 < prev    next >
Encoding:
Text File  |  1993-10-23  |  1.5 KB  |  50 lines

  1.       .include #system
  2.       .include #stddef
  3.       .include #macros
  4. ; ------------------------------
  5. ; Natuerlich!'s handy dandy
  6. ;         RELOCATOR
  7. ; (c)1989/1990 by Natuerlich!
  8. ; All Rights Reserved.
  9. ; not written for speed or
  10. ; beauty
  11. ; -----------------------------
  12. ; change these defines to
  13. ; suit your taste. Must be zero
  14. ; page though
  15. ; -----------------------------
  16. :src     =  $F0               ; -> org prg
  17. :dst     =  $F2               ; -> reloc prg
  18. :mdif    =  $F4               ; org-reloc
  19. :dif     =  :mdif
  20. :mod     =  $F5               ; datatype flag [ KEEP THESE
  21. :siz     =  $F6               ; end of org      TOGETHER  ]
  22. :vre     =  $F8               ; -> reltab
  23. :vim     =  $FA               ; -> immtab
  24. ;
  25. :foo     =  $FC               ; local vars for immediate
  26. :pages   =  $FE               ; relocation
  27. :entries =  $FF
  28. ; ---
  29. p_reloc  POKE  :src+1,>|R_START ; uppercase labels come from the linker
  30.          sta   :foo+1
  31.          
  32.          lda   |MEMLO         ; this is effectively:
  33.          cmp   #1             ; :dst = (|MEMLO & 0xFF00) +
  34.          lda   #0             ;           (|MEMLO & 0xFF ? 0x100 : 0)
  35.          sta   :dst           ; another case when using ML really pays off
  36.          sta   :src
  37.          adc   |MEMLO+1
  38.          sta   :dst+1
  39.          sta   :found+2
  40.  
  41.          DPOKE :vim,|IMMTAB
  42.          lda   #>|R_START+$100 ; Carry is clear 
  43.          sbc   :dst+1          ; 
  44.          sta   :mdif           ; but this apparently
  45.  
  46.          jsr   :do_imms        ; kills a bug lurking
  47.  
  48.          .include #coderel.s65
  49.          .include #immprel.s65
  50.