home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / PAPTool / PAPPatch.a < prev    next >
Encoding:
Text File  |  1992-11-29  |  1.4 KB  |  65 lines  |  [TEXT/MPS ]

  1. ;    installation, removal, and utility routines for PAPTool patches.
  2. ;    ©1992 Conrad Carlen & Manuel Veloso. All rights reserved.
  3.  
  4.         CASE OBJ
  5.         STRING ASIS 
  6.  
  7.         include 'Traps.a'
  8.         include 'ToolEqu.a'
  9.         include 'SysEqu.a'
  10.  
  11.         
  12. theFilter    PROC    EXPORT
  13.             EXPORT    Remove
  14.             EXPORT    Install
  15.             EXPORT    myGetA5
  16.             movem.l    d0/a0/a1, -(sp)
  17.             lea        theCodePtr, a0
  18.             move.l    (a0), a0
  19.             jsr        (a0)
  20.             movem.l    (SP)+, d0/a0/a1
  21.             move.l    nextCodePtr, -(sp)
  22.             rts
  23.             dc.b    $80 + $9, 'theFilter'; macsbug symbol.
  24.             
  25. theCodePtr    ds.l    1
  26.  
  27. ; prototype: void Remove(void)
  28.  
  29.  
  30. Remove        lea        nextCodePtr, a0            ; prep
  31.             move.l    (a0), jGNEFilter        ; change it back
  32.             rts
  33.             dc.b    $80 + $6, 'Remove'        ; macsbug symbol.
  34. nextCodePtr    ds.l    1
  35.         
  36. ; prototype: void Install(FunctionPtr theProc, long a5)
  37. ; FunctionPtr: void (*theProc)()
  38.  
  39. Install
  40.         lea        theCodePtr, a0
  41.         move.l    4(a7), (a0)                ; move the patch address into position
  42.         lea        nextCodePtr, a0            ; prep the next patch
  43.         move.l    (JGNEFilter), (a0)        ; ok, got the old patchola
  44.         
  45.         lea        theA5, a0                ; prep the a5
  46.         move.l    8(a7), (a0)                ; saved the a5
  47.         lea        theFilter, a0            ; prep our filter routine
  48.         move.l    a0, d0
  49.         _StripAddress
  50.         move.l    d0, JGNEFilter            ; allll riiiight
  51.         
  52.         rts
  53.         dc.b    $80 + $7, 'Install'        ; macsbug symbol.
  54. theA5    ds.l    1
  55.  
  56. ; prototype: long myGetA5(void)
  57.  
  58. myGetA5        
  59.             lea        theA5, a0
  60.             move.l    (a0), d0
  61.             rts
  62.             dc.b    $80 + $7, 'myGetA5'    ; macsbug symbol.
  63.             ENDP
  64.         END
  65.