home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1993 / USERJN93.MSA / DEVPAC2_NOTRACE.S < prev    next >
Text File  |  1993-04-20  |  1KB  |  42 lines

  1.  
  2. *    A TSR (terminate-and-stay-resident) demo program that also has
  3. *    the useful feature of pointing the default trace exception vector
  4. *    to an RTE, as described in the MonST Chapter.
  5. *
  6. *    This demo shows how to write a Terminate and Stay resident
  7. *    program. It does *not* try to be super-smart whereby the code
  8. *    is copied to the basepage to save memory, to preserve clarity.
  9.  
  10. start    bra.s    real_start
  11.  
  12. TSR_start
  13. *-------    here starts the code to be TSRed
  14.     bclr    #7,(sp)            works on 68000/10/20/30!
  15.     rte
  16. *-------    here ends the code to be TSRed
  17.     even
  18. keep_length    equ    *-start
  19.  
  20. real_start
  21. * print a message via GEMDOS - this should be before the vector patching
  22. * in case Ctrl-C is pressed during the printing
  23.     pea    hellotx(pc)
  24.     move.w    #9,-(sp)
  25.     trap    #1
  26.     addq.l    #6,sp
  27. *-------    any initialisation for the TSR goes here
  28.     move.l    #TSR_start,-(sp)
  29.     move.w    #9,-(sp)        Trace vector number
  30.     move.w    #5,-(sp)        setexc
  31.     trap    #13
  32.     addq.l    #8,sp            lose old one
  33.  
  34. *-------    end initialisation
  35.  
  36.     clr.w    -(sp)
  37.     move.l    #$100+keep_length,-(sp)        $100 for basepage
  38.     move.w    #$31,-(sp)    p_termres
  39.     trap    #1        that's the end
  40.  
  41. hellotx    dc.b    'NOTRACE installed ',189,' HiSoft 1988',13,10,0
  42.