home *** CD-ROM | disk | FTP | other *** search
- opt l+
-
- VERSION equ 1
- REVISION equ 2
-
- LIBNAME macro
- dc.b "Negative.efx"
- endm
-
- TODAY macro
- dc.b "(3/5/96)"
- endm
-
- COPYRIGHT macro
- dc.b "Copyright © Almathera 1994-5. All Rights Reserved"
- endm
-
- ASTRING macro
- LIBNAME
- dc.b " Version \<VERSION>.\<REVISION>.",10,10
- COPYRIGHT
- dc.b 10,10
- dc.b "A simple effect to invert the whole image. Written by Jolyon Ralph",0
- endm
-
-
- *************************************************************************
- ** **
- ** End of user-editable stuff... **
- ** **
- *************************************************************************
-
-
-
- VSTRING macro
- dc.b "$VER "
- LIBNAME
- dc.b " \<VERSION>.\<REVISION> "
- TODAY
- dc.b 10
- COPYRIGHT
- dc.b 0
- endm
-
- SECTION code
-
- machine mc68020
-
- incdir "include:"
- include "exec/funcdef.i"
- include "exec/types.i"
- INCLUDE "exec/initializers.i"
- INCLUDE "exec/libraries.i"
- INCLUDE "exec/lists.i"
- include "exec/memory.i"
- INCLUDE "exec/alerts.i"
- INCLUDE "exec/resident.i"
- INCLUDE "libraries/dos.i"
-
- include "exec/exec_lib.i"
-
- include "photogenics/pgs_lib.i"
- include "photogenics/efxbase.i"
- include "photogenics/gio.i"
-
- XDEF InitTable
- XDEF Open
- XDEF Close
- XDEF Expunge
- XDEF Null
- XDEF LibName
- XDEF _main
-
- XREF _EfxInfo
- XREF _EfxPreRender
- XREF _EfxRender
- XREF _EfxPrefs
-
- _main:
- Start:
- moveq #-1,d0
- rts
-
- MYPRI EQU 0
-
- RomTag:
- ;STRUCTURE RT,0
- DC.W RTC_MATCHWORD ; UWORD RT_MATCHWORD
- DC.L RomTag ; APTR RT_MATCHTAG
- DC.L EndCode ; APTR RT_ENDSKIP
- DC.B RTF_AUTOINIT ; UBYTE RT_FLAGS
- DC.B VERSION ; UBYTE RT_VERSION
- DC.B NT_LIBRARY ; UBYTE RT_TYPE
- DC.B MYPRI ; BYTE RT_PRI
- DC.L LibName ; APTR RT_NAME
- DC.L IDString ; APTR RT_IDSTRING
- DC.L InitTable ; APTR RT_INIT table for InitResident()
-
- ; this is the name that the library will have
- LibName: LIBNAME
- dc.b 0
- IDString: VSTRING
-
-
- ; force alignment
-
- cnop 0,4
-
-
- ; The romtag specified that we were "RTF_AUTOINIT". This means that the RT_INIT
- ; structure member points to one of these tables below. If the AUTOINIT bit was not
- ; set then RT_INIT would point to a routine to run.
-
- InitTable:
- DC.L EfxBase_SIZEOF ; size of library base data space
- DC.L funcTable ; pointer to function initializers
- DC.L dataTable ; pointer to data initializers
- DC.L initRoutine ; routine to run
-
-
- funcTable:
-
- ;------ standard system routines
- dc.l Open
- dc.l Close
- dc.l Expunge
- dc.l Null
-
- ;------ my libraries definitions
- dc.l _EfxInfo
- dc.l _EfxPreRender
- dc.l _EfxRender
- dc.l _EfxPrefs
- dc.l _EfxAbout
-
- ;------ function table end marker
- dc.l -1
-
-
- ; The data table initializes static data structures. The format is specified in
- ; exec/InitStruct routine's manual pages. The INITBYTE/INITWORD/INITLONG routines are
- ; in the file "exec/initializers.i". The first argument is the offset from the library
- ; base for this byte/word/long. The second argument is the value to put in that cell.
- ; The table is null terminated.
- ; NOTE - LN_TYPE below is a correction - old example had LH_TYPE.
-
- dataTable:
- INITBYTE LN_TYPE,NT_LIBRARY
- INITLONG LN_NAME,LibName
- INITBYTE LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
- INITWORD LIB_VERSION,VERSION
- INITWORD LIB_REVISION,REVISION
- INITLONG LIB_IDSTRING,IDString
- DC.L 0
-
- ; This routine gets called after the library has been allocated. The library pointer is
- ; in D0. The segment list is in A0. If it returns non-zero then the library will be
- ; linked into the library list.
-
- initRoutine:
-
- ;------ get the library pointer into a convenient A register
- move.l a5,-(sp)
- move.l d0,a5
-
- ;------ save a pointer to exec
- move.l a6,efxb_SysLib(a5)
-
- ;------ save a pointer to our loaded code
- move.l a0,efxb_SegList(a5)
-
- ;------ now build the static data that we need
- ;
- ; put your initialization here...
- ;
-
- move.l a5,d0
- move.l (sp)+,a5
- rts
-
- ;------------------------------------------------------------------------------------------
- ; here begins the system interface commands. When the user calls OpenLibrary/CloseLibrary/
- ; RemoveLibrary, this eventually gets translated into a call to the following routines
- ; (Open/Close/Expunge). Exec has already put our library pointer in A6 for us. Exec has
- ; turned off task switching while in these routines (via Forbid/Permit), so we should not
- ; take too long in them.
- ;------------------------------------------------------------------------------------------
-
- ; Open returns the library pointer in d0 if the open was successful. If the open failed
- ; then null is returned. It might fail if we allocated memory on each open, or if only
- ; open application could have the library open at a time...
-
- Open: ; ( libptr:a6, version:d0 )
-
- ;------ mark us as having another opener
- addq.w #1,LIB_OPENCNT(a6)
-
- ;------ prevent delayed expunges
- bclr #LIBB_DELEXP,efxb_Flags(a6)
-
- move.l a6,d0
- rts
-
- ; There are two different things that might be returned from the Close routine. If the
- ; library is no longer open and there is a delayed expunge then Close should return the
- ; segment list (as given to Init). Otherwise close should return NULL.
-
- Close: ; ( libptr:a6 )
-
- ;------ set the return value
- moveq #0,d0
-
- ;------ mark us as having one fewer openers
- subq.w #1,LIB_OPENCNT(a6)
-
- ;------ see if there is anyone left with us open
- bne.s 1$
-
- ;------ see if we have a delayed expunge pending
- btst #LIBB_DELEXP,efxb_Flags(a6)
- beq.s 1$
-
- ;------ do the expunge
- bsr Expunge
- 1$:
- rts
-
- ; There are two different things that might be returned from the Expunge routine. If
- ; the library is no longer open then Expunge should return the segment list (as given
- ; to Init). Otherwise Expunge should set the delayed expunge flag and return NULL.
- ;
- ; One other important note: because Expunge is called from the memory allocator, it may
- ; NEVER Wait() or otherwise take long time to complete.
-
- Expunge: ; ( libptr: a6 )
-
- movem.l d2/a5/a6,-(sp)
- move.l a6,a5
- move.l efxb_SysLib(a5),a6
-
- ;------ see if anyone has us open
- tst.w LIB_OPENCNT(a5)
- beq 1$
-
- ;------ it is still open. set the delayed expunge flag
- bset #LIBB_DELEXP,efxb_Flags(a5)
- moveq #0,d0
- bra.s Expunge_End
-
- 1$:
- ;------ go ahead and get rid of us. Store our seglist in d2
- move.l efxb_SegList(a5),d2
-
- ;------ unlink from library list
- move.l a5,a1
- jsr _LVORemove(a6)
-
- ;------ free our memory
- moveq #0,d0
- move.l a5,a1
- move.w LIB_NEGSIZE(a5),d0
-
- sub.l d0,a1
- add.w LIB_POSSIZE(a5),d0
-
- jsr _LVOFreeMem(a6)
-
- ;------ set up our return value
- move.l d2,d0
-
- Expunge_End:
- movem.l (sp)+,d2/a5/a6
- rts
-
- Null:
- moveq #0,d0
- rts
- EndCode:
-
-
- wintitle:
- dc.b "About "
- LIBNAME
- dc.b 0
-
- textmsg:
- ASTRING
- dc.b 0
- button:
- dc.b "OK",0
-
- cnop 0,4
-
- *******************************************************************
- *******************************************************************
- *******************************************************************
- *** ***
- *** Main code functions for library follow here... ***
- *** ***
- *******************************************************************
- *******************************************************************
- *******************************************************************
-
-
- _EfxAbout
- movem.l a6/a2,-(sp)
- move.l gio_PgsBase(a0),a6
- lea wintitle(pc),a0
- lea textmsg(pc),a1
- lea button(pc),a2
- jsr _LVOOneButtonReq(a6)
- movem.l (sp)+,a6/a2
- rts
-
-