home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d150 / execlib.lha / ExecLib / libskel.asm < prev    next >
Assembly Source File  |  1987-06-15  |  4KB  |  205 lines

  1.  
  2. ************************************************************************
  3. *
  4. *       FLam exec library skeleton
  5. *       
  6. *       created:  neil $
  7. *       modified: jmf    04-mar-88   assemble with MCC macro assembler
  8. *
  9. ************************************************************************
  10.  
  11.  
  12. ******* Included Files *************************************************
  13.  
  14.         SECTION section
  15.  
  16.         include "exec/types.i"
  17.         include "exec/nodes.i"
  18.         include "exec/lists.i"
  19.         include "exec/libraries.i"
  20.         include "exec/alerts.i"
  21.         include "exec/initializers.i"
  22.         include "exec/resident.i"
  23.         include "libraries/dos.i"
  24.  
  25.         include "i_asmsupp.i"
  26.         include "i_flamlib.i"
  27.  
  28.  
  29. ******* Exported *******************************************************
  30.  
  31.         XDEF    Init
  32.         XDEF    Open
  33.         XDEF    Close
  34.         XDEF    Expunge
  35.         XDEF    Null
  36.  
  37.         XDEF    FLamName
  38.  
  39.  
  40. ******* Imported *******************************************************
  41.  
  42.         XREF    _AbsExecBase
  43.  
  44.         XREF    _fl_Plus
  45.         XREF    _fl_Minus
  46.  
  47.         XLIB    OpenLibrary
  48.         XLIB    CloseLibrary
  49.         XLIB    Alert
  50.         XLIB    FreeMem
  51.         XLIB    Remove
  52.  
  53.  
  54. ************************************************************************
  55. *
  56. *       Standard Program Entry Point
  57. *
  58. ************************************************************************
  59.  
  60.  
  61. Start:
  62.         CLEAR   d0
  63.         rts
  64.  
  65.  
  66. FLAMPRI EQU     0
  67.  
  68. initDDescrip:
  69.         DC.W    RTC_MATCHWORD
  70.         DC.L    initDDescrip
  71.         DC.L    EndCode
  72.         DC.B    RTF_AUTOINIT
  73.         DC.B    VERSION
  74.         DC.B    NT_LIBRARY
  75.         DC.B    FLAMPRI
  76.         DC.L    FLamName
  77.         DC.L    idString
  78.         DC.L    Init
  79.  
  80. FLamName:       FLAMLIBNAME
  81. VERSION:        EQU     1
  82. REVISION:       EQU     0
  83. idString:       dc.b    'flam.library 1.0 (01 Mar 1988)',13,10,0
  84. dosName:        DOSNAME
  85.  
  86.         ds.w    0
  87.  
  88.  
  89. Init:
  90.         DC.L    FLamLib_Sizeof
  91.         DC.L    funcTable
  92.         DC.L    dataTable
  93.         DC.L    initRoutine
  94.  
  95. funcTable:
  96.         DC.L    Open
  97.         DC.L    Close
  98.         DC.L    Expunge
  99.         DC.L    Null
  100.  
  101.         DC.L    _fl_Plus
  102.         DC.L    _fl_Minus
  103.  
  104.         DC.L    -1
  105.  
  106. dataTable:
  107.         INITBYTE        LH_TYPE,NT_LIBRARY
  108.         INITLONG        LN_NAME,FLamName
  109.         INITBYTE        LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
  110.         INITWORD        LIB_VERSION,VERSION
  111.         INITWORD        LIB_REVISION,REVISION
  112.         INITLONG        LIB_IDSTRING,idString
  113.         DC.L    0
  114.  
  115. initRoutine:
  116.         move.l  a5,-(sp)
  117.         move.l  d0,a5
  118.  
  119.         move.l  a6,ml_SysLib(a5)
  120.         move.l  a0,ml_SegList(a5)
  121.         lea     dosName(pc),a1
  122.         CLEAR   d0
  123.         CALLSYS OpenLibrary
  124.  
  125.         move.l  d0,ml_DosLib(a5)
  126.         bne.s   1$
  127.         ALERT   AG_OpenLib!AO_DOSLib
  128.  
  129. 1$:
  130.         move.l  a5,d0
  131.         move.l  (sp)+,a5
  132.         rts
  133.  
  134.  
  135.  
  136.  
  137. Open:
  138.         addq.w  #1,LIB_OPENCNT(a6)
  139.         bclr    #LIBB_DELEXP,ml_Flags(a6)
  140.         move.l  a6,d0
  141.         rts
  142.  
  143.  
  144. Close:
  145.         CLEAR   d0
  146.         subq.w  #1,LIB_OPENCNT(a6)
  147.         bne.s   1$
  148.  
  149.         btst    #LIBB_DELEXP,ml_Flags(a6)
  150.         beq.s   1$
  151.  
  152.         bsr     Expunge
  153. 1$:
  154.         rts
  155.  
  156.  
  157. Expunge:
  158.         movem.l d2/a5/a6,-(sp)
  159.         move.l  a6,a5
  160.         move.l  ml_SysLib(a5),a6
  161.  
  162.         tst.w   LIB_OPENCNT(a5)
  163.         beq     1$
  164.  
  165.         bset    #LIBB_DELEXP,ml_Flags(a5)
  166.         CLEAR   d0
  167.         bra.s   Expunge_End
  168.  
  169. 1$:
  170.         move.l  ml_SegList(a5),d2
  171.         move.l  a5,a0
  172.         CALLSYS Remove
  173.  
  174.         move.l  ml_DosLib(a5),a1
  175.         CALLSYS CloseLibrary
  176.  
  177.         ;-----------------------------------------------
  178.         ; !!! ATTENTION !!! BUG RKM vol 2 Appendix K !!!
  179.         ; !!!   Skeleton Device & Skeleton Library   !!!
  180.         ; !!!            in this routine :           !!!
  181.         ; !!! move.l   LIB_NEGSIZE(a5),d0            !!!
  182.         ; !!! add.l    LIB_POSSIZE(a5),d0            !!!
  183.  
  184.         CLEAR   d0
  185.         move.l  a5,a1
  186.         move.w  LIB_NEGSIZE(a5),d0
  187.         sub.l   d0,a1
  188.         add.w   LIB_POSSIZE(a5),d0
  189.         CALLSYS FreeMem
  190.  
  191.         move.l  d2,d0
  192.  
  193. Expunge_End:
  194.         movem.l (sp)+,d2/a5/a6
  195.         rts
  196.  
  197.  
  198. Null:
  199.         CLEAR   d0
  200.         rts
  201.  
  202. EndCode:
  203.  
  204.         END
  205.