home *** CD-ROM | disk | FTP | other *** search
- opt l+,o+,ow-
- *
- * library.s version 8.1 - © Copyright 1990 Jaba Development
- *
- * Author : Jan van den Baard
- * Assembler : Devpac version 2.14
- *
- incdir 'sys:devpac_inc/'
- include 'exec/types.i'
- include 'exec/initializers.i'
- include 'exec/alerts.i'
- include 'exec/io.i'
- include 'exec/libraries.i'
- include 'exec/resident.i'
- include 'exec/strings.i'
- include 'exec/exec_lib.i'
- include 'libraries/dos.i'
- include 'libraries/dos_lib.i'
- include 'mymacros.i'
-
- STRUCTURE ToolBase,LIB_SIZE
- APTR tb_SysBase
- APTR tb_DOSBase
- APTR tb_IntuitionBase
- APTR tb_GfxBase
- ULONG tb_SegList
- LABEL tb_SIZEOF
-
- VERSION EQU 8
- REVISION EQU 1
-
- xref CreatePort
- xref DeletePort
- xref CreateExtIO
- xref DeleteExtIO
- xref CreateStdIO
- xref DeleteStdIO
- xref CreateTimeDelay
- xref DoTimeDelay
- xref DeleteTimeDelay
-
- xref QuickSort
- xref SwapMem
-
- xref TestBits
- xref SelectGadget
- xref DeSelectGadget
- xref MutualExclude
- xref MutualInclude
- xref EraseGadget
- xref GadgetOn
- xref GadgetOff
- xref SelectTest
- xref ShadowGadget
- xref OnGList
- xref OffGList
- xref SelectGList
- xref DeSelectGList
- xref ShadowGList
- xref EraseGList
-
- xref InitMemoryChain
- xref AllocItem
- xref FreeItem
- xref FreeMemoryChain
-
- xref Format
- xref WriteFormat
- xref MatchPattern
- xref Isolate
- xref BstrToCstr
- xref GetDate
-
- xref OpenDir
- xref GetEntry
- xref CloseDir
- xref FreeDir
- xref IoErrToStr
-
- xref AllocFreq
- xref FreeFreq
- xref FileRequest
-
- xref FormatText
-
- xdef _DOSBase
- xdef _IntuitionBase
- xdef _GfxBase
-
- SECTION "LIB_SKELL",CODE
-
- lea dosname(pc),a1
- cldat d0
- move.l (_SysBase).w,a6
- libcall OpenLibrary
- tst.l d0
- beq.s nolib
- move.l d0,a6
- libcall Output
- move.l d0,d1
- move.l #idString,d2
- move.l idSize,d3
- libcall Write
- move.l a6,a1
- move.l (_SysBase).w,a6
- libcall CloseLibrary
- nolib: moveq #RETURN_FAIL,d0
- rts
-
- ROMTag:
- dc.w RTC_MATCHWORD
- dc.l ROMTag
- dc.l EndCode
- dc.b RTF_AUTOINIT
- dc.b VERSION
- dc.b NT_LIBRARY
- dc.b 0
- dc.l libraryName
- dc.l idString
- dc.l Init
- EndCode:
- dc.w 0
-
- libraryName:
- dc.b 'tool.library',0
- even
- idString:
- dc.b CR,LF,' tool.library 8.1 (20-Jan-1991) © Copyright 1990-91 Jaba Development.',CR,LF
- dc.b ' Written with the Devpac Assembler version 2.14 by Jan van den Baard.',CR,LF,CR,LF,0
- idEnd: even
- idSize: dc.l (idEnd-idString-1)
- dosname:
- dc.b 'dos.library',0
- even
- intname:
- dc.b 'intuition.library',0
- even
- graname:
- dc.b 'graphics.library',0
- even
- Init:
- dc.l tb_SIZEOF
- dc.l funcTable
- dc.l dataTable
- dc.l InitLib
-
- funcTable:
- dc.l OpenLib
- dc.l CloseLib
- dc.l ExpungeLib
- dc.l ExtFuncLib
-
- dc.l CreatePort
- dc.l DeletePort
- dc.l CreateExtIO
- dc.l DeleteExtIO
- dc.l CreateStdIO
- dc.l DeleteStdIO
- dc.l CreateTimeDelay
- dc.l DoTimeDelay
- dc.l DeleteTimeDelay
-
- dc.l QuickSort
- dc.l SwapMem
-
- dc.l TestBits
- dc.l SelectGadget
- dc.l DeSelectGadget
- dc.l MutualExclude
- dc.l MutualInclude
- dc.l EraseGadget
- dc.l GadgetOn
- dc.l GadgetOff
- dc.l SelectTest
- dc.l ShadowGadget
- dc.l OnGList
- dc.l OffGList
- dc.l SelectGList
- dc.l DeSelectGList
- dc.l ShadowGList
- dc.l EraseGList
-
- dc.l InitMemoryChain
- dc.l AllocItem
- dc.l FreeItem
- dc.l FreeMemoryChain
-
- dc.l Format
- dc.l WriteFormat
- dc.l MatchPattern
- dc.l Isolate
- dc.l BstrToCstr
- dc.l GetDate
-
- dc.l OpenDir
- dc.l GetEntry
- dc.l CloseDir
- dc.l FreeDir
- dc.l IoErrToStr
-
- dc.l AllocFreq
- dc.l FreeFreq
- dc.l FileRequest
-
- dc.l FormatText
-
- dc.l -1
-
- dataTable:
- INITBYTE LH_TYPE,NT_LIBRARY
- INITLONG LN_NAME,libraryName
- INITBYTE LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
- INITWORD LIB_VERSION,VERSION
- INITWORD LIB_REVISION,REVISION
- INITLONG LIB_IDSTRING,idString
- dc.l 0
-
- InitLib
- move.l a5,-(sp)
- movea.l d0,a5
- move.l a0,tb_SegList(a5)
- move.l a6,tb_SysBase(a5)
- lea dosname(pc),a1
- cldat d0
- libcall OpenLibrary
- move.l d0,_DOSBase
- move.l d0,tb_DOSBase(a5)
- beq.s NoDOS
- lea intname(pc),a1
- cldat d0
- libcall OpenLibrary
- move.l d0,_IntuitionBase
- move.l d0,tb_IntuitionBase(a5)
- beq.s NoINT
- lea graname(pc),a1
- cldat d0
- libcall OpenLibrary
- move.l d0,_GfxBase
- move.l d0,tb_GfxBase(a5)
- beq.s NoGFX
- move.l a5,d0
- bra.s Done
- NoDOS: ALERT AG_OpenLib!AN_DOSLib
- bra.s Error
- NoINT: move.l tb_DOSBase(a5),a1
- libcall CloseLibrary
- ALERT AG_OpenLib!AN_Intuition
- bra.s Error
- NoGFX: move.l tb_DOSBase(a5),a1
- libcall CloseLibrary
- move.l tb_IntuitionBase(a5),a1
- libcall CloseLibrary
- ALERT AG_OpenLib!AN_GraphicsLib
- Error: cldat d0
- Done: movea.l (sp)+,a5
- rts
-
- OpenLib:
- inc.w LIB_OPENCNT(a6)
- bclr #LIBB_DELEXP,LIB_FLAGS(a6)
- move.l a6,d0
- rts
-
- CloseLib:
- cldat d0
- dec.w LIB_OPENCNT(a6)
- bne.s ret
- btst #LIBB_DELEXP,LIB_FLAGS(a6)
- beq.s ret
- bsr.s ExpungeLib
- ret: rts
-
- ExpungeLib:
- movem.l d2/a5/a6,-(sp)
- tst.w LIB_OPENCNT(a6)
- beq.s NDLex
- bset #LIBB_DELEXP,LIB_FLAGS(a6)
- cldat d0
- bra.s DLex
- NDLex: move.l a6,a5
- move.l tb_SysBase(a5),a6
- movea.l tb_DOSBase(a5),a1
- libcall CloseLibrary
- movea.l tb_IntuitionBase(a5),a1
- libcall CloseLibrary
- movea.l tb_GfxBase(a5),a1
- libcall CloseLibrary
- move.l a5,a1
- libcall Remove
- move.l tb_SegList(a5),d2
- movea.l a5,a1
- cldat d0
- move.w LIB_NEGSIZE(a5),d0
- suba.l d0,a1
- add.w LIB_POSSIZE(a5),d0
- libcall FreeMem
- move.l d2,d0
- DLex: movem.l (sp)+,d2/a5/a6
- rts
-
- ExtFuncLib:
- cldat d0
- rts
-
- _DOSBase: dc.l 0
- _IntuitionBase: dc.l 0
- _GfxBase: dc.l 0
-
- end
-
-