************************************************************************ * * FLam exec library skeleton * * created: neil $ * modified: jmf 04-mar-88 assemble with MCC macro assembler * ************************************************************************ ******* Included Files ************************************************* SECTION section include "exec/types.i" include "exec/nodes.i" include "exec/lists.i" include "exec/libraries.i" include "exec/alerts.i" include "exec/initializers.i" include "exec/resident.i" include "libraries/dos.i" include "i_asmsupp.i" include "i_flamlib.i" ******* Exported ******************************************************* XDEF Init XDEF Open XDEF Close XDEF Expunge XDEF Null XDEF FLamName ******* Imported ******************************************************* XREF _AbsExecBase XREF _fl_Plus XREF _fl_Minus XLIB OpenLibrary XLIB CloseLibrary XLIB Alert XLIB FreeMem XLIB Remove ************************************************************************ * * Standard Program Entry Point * ************************************************************************ Start: CLEAR d0 rts FLAMPRI EQU 0 initDDescrip: DC.W RTC_MATCHWORD DC.L initDDescrip DC.L EndCode DC.B RTF_AUTOINIT DC.B VERSION DC.B NT_LIBRARY DC.B FLAMPRI DC.L FLamName DC.L idString DC.L Init FLamName: FLAMLIBNAME VERSION: EQU 1 REVISION: EQU 0 idString: dc.b 'flam.library 1.0 (01 Mar 1988)',13,10,0 dosName: DOSNAME ds.w 0 Init: DC.L FLamLib_Sizeof DC.L funcTable DC.L dataTable DC.L initRoutine funcTable: DC.L Open DC.L Close DC.L Expunge DC.L Null DC.L _fl_Plus DC.L _fl_Minus DC.L -1 dataTable: INITBYTE LH_TYPE,NT_LIBRARY INITLONG LN_NAME,FLamName INITBYTE LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED INITWORD LIB_VERSION,VERSION INITWORD LIB_REVISION,REVISION INITLONG LIB_IDSTRING,idString DC.L 0 initRoutine: move.l a5,-(sp) move.l d0,a5 move.l a6,ml_SysLib(a5) move.l a0,ml_SegList(a5) lea dosName(pc),a1 CLEAR d0 CALLSYS OpenLibrary move.l d0,ml_DosLib(a5) bne.s 1$ ALERT AG_OpenLib!AO_DOSLib 1$: move.l a5,d0 move.l (sp)+,a5 rts Open: addq.w #1,LIB_OPENCNT(a6) bclr #LIBB_DELEXP,ml_Flags(a6) move.l a6,d0 rts Close: CLEAR d0 subq.w #1,LIB_OPENCNT(a6) bne.s 1$ btst #LIBB_DELEXP,ml_Flags(a6) beq.s 1$ bsr Expunge 1$: rts Expunge: movem.l d2/a5/a6,-(sp) move.l a6,a5 move.l ml_SysLib(a5),a6 tst.w LIB_OPENCNT(a5) beq 1$ bset #LIBB_DELEXP,ml_Flags(a5) CLEAR d0 bra.s Expunge_End 1$: move.l ml_SegList(a5),d2 move.l a5,a0 CALLSYS Remove move.l ml_DosLib(a5),a1 CALLSYS CloseLibrary ;----------------------------------------------- ; !!! ATTENTION !!! BUG RKM vol 2 Appendix K !!! ; !!! Skeleton Device & Skeleton Library !!! ; !!! in this routine : !!! ; !!! move.l LIB_NEGSIZE(a5),d0 !!! ; !!! add.l LIB_POSSIZE(a5),d0 !!! CLEAR d0 move.l a5,a1 move.w LIB_NEGSIZE(a5),d0 sub.l d0,a1 add.w LIB_POSSIZE(a5),d0 CALLSYS FreeMem move.l d2,d0 Expunge_End: movem.l (sp)+,d2/a5/a6 rts Null: CLEAR d0 rts EndCode: END