***************************************************************************
*									  *
* SmartIcon, release 1.0 - An Intuition object iconifier for the Amiga	  *
* Copyright (c) 1988 Gauthier H. Groult                                   *
*									  *
* Written in January 1988 by Gauthier H. Groult 			  *
*			     33, Boulevard Saint Denis, 		  *
*			     92400 Courbevoie				  *
*			     France - Europe				  *
*			     Tel: (16) 1 47 89 09 54                      *
*			     email: mcvax!inria!litp!germinal!groult	  *
*									  *
* This source code is not in public domain, please do not distribute.	  *
* The binary program is shareaware. Read docs files for details.	  *
*									  *
***************************************************************************

* This code contains the routines that are called instead of the normal *
* Rom routines. 							*
* Speacial action is performed either before or after the normal Rom	*
* code									*
*									*
* This code is rather heavy but it works.				*

   include 'include:exec/types.i'

GADGETUP	EQU	$00000040

   xref  _owhook
   xref  _cwhook
   xref  _mihook
   xref  _pmhook
   xdef  _OWentry_point
   xdef  _CWentry_point
   xdef  _MIentry_point
   xdef  _PMentry_point

   STRUCTURE   HK,0
   LONG   HK_SYSFUNC
   LONG   HK_MYFUNC
   LONG   HK_ENTRY
   LONG   HK_LVO

regboys   reg  d1/d2/d3/d5/a0/a1/a2/a3/a4/a5/a6

_OWentry_point: 		       ; entry point for OpenWindow()
   movem.l  regboys,-(sp)
   lea	    _owhook,a3

   move.l   HK_SYSFUNC(a3),a5
   jsr	    (a5)

   move.l   d0,-(sp)
   move.l   HK_MYFUNC(a3),a5
   jsr	    (a5)
   move.l   (sp)+,d0

   movem.l  (sp)+,regboys
   rts

_CWentry_point: 		       ; entry point for CloseWindw()
   movem.l  regboys,-(sp)
   lea	    _cwhook,a3

   move.l   a0,-(sp)
   move.l   HK_MYFUNC(a3),a5
   jsr	    (a5)
   move.l   (sp)+,a0

   move.l   HK_SYSFUNC(a3),a5
   jsr	    (a5)

   movem.l  (sp)+,regboys
   rts

_MIentry_point: 		       ; entry point for ModifyIDCM()
   movem.l  regboys,-(sp)
   lea	    _mihook,a3

   ori.l    #GADGETUP,d0
   move.l   HK_SYSFUNC(a3),a5
   jsr	    (a5)

   movem.l  (sp)+,regboys
   rts

_PMentry_point: 		       ; entry point for PutMsg()
   movem.l  regboys,-(sp)
   lea	    _pmhook,a3

   movem.l  regboys,-(sp)
   move.l   a1,-(sp)
   move.l   a0,-(sp)
   move.l   HK_MYFUNC(a3),a5
   jsr	    (a5)
   move.l   (sp)+,a0
   move.l   (sp)+,a1
   movem.l  (sp)+,regboys

   lea	    _pmhook,a3
   move.l   HK_SYSFUNC(a3),a5
   jsr	    (a5)

   movem.l  (sp)+,regboys
   rts

   end
