home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / nasm20b / libinc / demo / install.s65 < prev    next >
Text File  |  1993-01-19  |  3KB  |  131 lines

  1.       .include #stddef
  2.       .include #system
  3.       .include #cio
  4.       .include #os
  5.       .include #handler.h65
  6.             
  7.       .zext    _tmp1      
  8.       .zext    _tmp2
  9.       .zext    _tmp3
  10.             
  11.  
  12. install:
  13.       bput     0,:header,:headerend-:header
  14.       getc     0
  15.       sta      theirid
  16.       print    0
  17.       
  18.       lda      #$60           ; an RTS
  19. :loop
  20.       cmp      $E500,y
  21. :osmsb   =     *-1      
  22.       beq      :found
  23.       iny
  24.       bne      :loop
  25.       inc      :osmsb
  26.       bne      :loop
  27.       
  28.       print    0,"Your ROMS are fucked up"
  29.       rts
  30.  
  31. :fault
  32.       print    0,"Target handler not found"
  33.       rts
  34.       
  35. :found
  36.       tya
  37.       bne      :ok2
  38.       dec      :osmsb
  39. :ok2      
  40.       dey
  41.       sty      osrts
  42.       move     :osmsb,osrts+1
  43.       
  44.       lda      theirid
  45.       jsr      fhatabs
  46.       bcc      :fault
  47.       bne      :fault
  48.       iny
  49.       lda      HATABS,y
  50.       sta      _tmp1
  51.       lda      HATABS+1,y
  52.       sta      _tmp1+1
  53.       dpoke_y  HATABS,ourtab
  54.       
  55.       ldy      #0
  56.       dpoke    _tmp3,theirtab
  57.       lda      #<theirtab
  58.       cmp      #$F4
  59.       bcc      :ok
  60.  
  61.       .macro   fix
  62.          lda   #>%1
  63.          ldx   #<%1
  64.          jsr   :fixup
  65.       .endm
  66.       
  67.       fix      fix1
  68.       fix      fix2
  69.       fix      fix3
  70.       fix      fix4
  71.       fix      fix5
  72.       fix      fix6
  73.       fix      _tmp3
  74.       
  75. :ok
  76.       ldx      #6
  77.       clc
  78. :copy
  79.       lda      (_tmp1),y
  80.       adc      #1
  81.       sta      (_tmp3),y
  82.       iny
  83.       lda      (_tmp1),y
  84.       adc      #0
  85.       sta      (_tmp3),y
  86.       iny
  87.       dex
  88.       bne      :copy
  89.       
  90.       lda      (_tmp1),y
  91.       sta      (_tmp3),y
  92.       iny
  93.       lda      (_tmp1),y
  94.       sta      (_tmp3),y
  95.       iny
  96.       lda      (_tmp1),y
  97.       sta      (_tmp3),y
  98.  
  99.       dpoke    MEMLO,install
  100.       print    0,"Snooper successfully installed"
  101.       rts
  102.       
  103.  
  104. :fixup
  105.       stx      _tmp2
  106.       sta      _tmp2+1
  107.       lda      (_tmp2),y
  108.       clc
  109.       adc      #15
  110.       sta      (_tmp2),y
  111.       iny
  112.       lda      (_tmp2),y
  113.       adc      #0
  114.       sta      (_tmp2),y
  115.       dey
  116.       rts
  117.             
  118. theirid:
  119.       .byte    'D
  120.       
  121.       
  122. :header
  123.       .byte    "The HANDLER snooper by Natuerlich!",155
  124.       .byte    "developed with NASM! 1991 for NASTY",155
  125.       .byte    "Displays some info during CIO calls",155,155
  126.       .byte    "OPTION - to single step",155
  127.       .byte    "START  - to run",155
  128.       .byte    "RESET  - to deinstall",155,155
  129.       .byte    "CIO device ID to snoop ? > "
  130. :headerend      
  131.