home *** CD-ROM | disk | FTP | other *** search
- ; * ************************************************************************ *
- ; * 'ECS.svdriver' V1.8 *
- ; * ************************************************************************ *
- ; * (c) 1993-94 by Andreas Ralph Kleinert. All rights reserved. *
- ; * This code can be used to create the 'ECS.svdriver'. *
- ; * THIS IS NOT ALLOWED WITHOUT SPECIAL PERMISSION BY THE AUTHOR !!! *
- ; * ************************************************************************ *
- ; * Address : Andreas R. Kleinert *
- ; * Grube Hohe Grethe 23 *
- ; * D-57074 Siegen *
- ; * Germany *
- ; * ************************************************************************ *
-
- ; * ************************************************************************ *
- ; * Module : SD_AsmPart.a *
- ; * Version : V1.8 *
- ; * Last updated : 11.6.1994 *
- ; * Includes : V40-Includes *
- ; * Compiler : SAS/C V6.51 (ASM) *
- ; * Compiler-Options : (smakefile) *
- ; * ************************************************************************ *
-
- INCLUDE "exec/types.i"
- INCLUDE "exec/execbase.i"
- INCLUDE "exec/initializers.i"
- INCLUDE "exec/libraries.i"
- INCLUDE "exec/resident.i"
-
- VERSION EQU 1
- REVISION EQU 8
-
- XREF _LinkerDB
-
- XREF _LVOOpenLibrary
- XREF _LVOCloseLibrary
- XREF _LVORemove
- XREF _LVOFreeMem
-
- XREF _SVLI_InitSVDList ; library-internal initialization function
-
- XREF _SVD_AllocHandle
- XREF _SVD_FreeHandle
- XREF _SVD_CloseDisplay
- XREF _SVD_FreeResources
- XREF _SVD_SetGfxBuffer
- XREF _SVD_DisplayGfxBuffer
- XREF _SVD_SetScreenType
- XREF _SVD_SetWindowFlags
- XREF _SVD_SetWindowIDCMP
- XREF _SVD_GetScreenAddress
- XREF _SVD_GetWindowAddress
-
- STRUCTURE SVDriverBase,0
- STRUCT svb_LibNode,LIB_SIZE
- ULONG svb_SVDriver
-
- ULONG svb_Reserved,32
-
- ULONG svb_SegList
- ULONG svb_SysBase
- ULONG svb_DOSBase
- ULONG svb_IntuitionBase
- ULONG svb_GfxBase
- ULONG svb_SVSupportBase
- LABEL svb_SIZEOF
-
- SECTION svb_lib,CODE
- ;-------------- `Notausgang` ------------------------------------------------
- Start: moveq #0,d0
- rts
- ;-------------- Resident-Struktur -------------------------------------------
-
-
- ROMTag:
- dc.w RTC_MATCHWORD
- dc.l ROMTag ; ptr to itself
- dc.l EndResident ; ptr to end of Resident-Structure
- dc.b RTF_AUTOINIT ; Initialisierungsart
- dc.b VERSION ; Version
- dc.b NT_LIBRARY ; Node-Typ
- dc.b REVISION ; Prioritaet
- dc.l SVLibName ; Name
- dc.l SVLibID ; LibIDString
- dc.l InitTab ; ptr to InitTab
-
- SVLibName: dc.b 'ECS.svdriver',0
- SVLibID: dc.b 'ECS 1.8 (11.6.94)',13,10,0
- AKCopyright: dc.b '(c) 1994 by Andreas R. Kleinert',0
- DosName: dc.b 'dos.library',0
- IntuitionName: dc.b 'intuition.library',0
- GfxName: dc.b 'graphics.library',0
- SVSupportName: dc.b 'superviewsupport.library',0
- ds.w 0
-
- EndResident:
-
-
- ;-------------- Funktionstabellen fuer InitStruct u.a. ----------------------
- InitTab:
- dc.l svb_SIZEOF ; LibBase-Size
- dc.l FuncTab ; Function-Table begin
- dc.l DataTab ; Data-Table begin
- dc.l InitLib ; ptr to InitLib
- FuncTab:
- dc.l OpenLib ; internal functions
- dc.l CloseLib
- dc.l ExpungeLib
- dc.l ExtFuncLib
-
- dc.l _SVD_AllocHandle
- dc.l _SVD_FreeHandle
- dc.l _SVD_CloseDisplay
- dc.l _SVD_FreeResources
- dc.l _SVD_SetGfxBuffer
- dc.l _SVD_DisplayGfxBuffer
- dc.l _SVD_SetScreenType
- dc.l _SVD_SetWindowFlags
- dc.l _SVD_SetWindowIDCMP
- dc.l _SVD_GetScreenAddress
- dc.l _SVD_GetWindowAddress
-
- dc.l -1
- DataTab:
- INITBYTE LN_TYPE,NT_LIBRARY
- INITLONG LN_NAME,SVLibName
- INITBYTE LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
- INITWORD LIB_VERSION,VERSION
- INITWORD LIB_REVISION,REVISION
- INITLONG LIB_IDSTRING,SVLibID
- dc.l 0
-
- ;-------------- InitLib (Initialisieren der Library) ---------------------------
- ; A0 : &SegList
- ; A6 : &SysBase
- ; D0 : &SVLibrary
-
- InitLib:
- movem.l a4-a5,-(sp) ; a4 und a5 auf Stack retten
-
- lea _LinkerDB,a4 ; _LinkerDB -> A4
- move.l d0,a5 ; &SVLibrary -> A5
-
- move.l a6,_SysBase(a4) ; &SysBase retten
-
- move.l a6,svb_SysBase(a5) ; &SysBase -> SVLibrary.svb_SysBase
- move.l a0,svb_SegList(a5) ; &SegList -> SVLibrary.svb_SegList
-
- lea DosName,a1
- move.l #37,d0
- LINKLIB _LVOOpenLibrary,_SysBase
- move.l d0,_DOSBase
- move.l d0,svb_DOSBase(a5) ; save it !
-
- lea IntuitionName,a1
- move.l #37,d0
- LINKLIB _LVOOpenLibrary,_SysBase
- move.l d0,_IntuitionBase
- move.l d0,svb_IntuitionBase(a5) ; save it !
-
- lea GfxName,a1
- move.l #37,d0
- LINKLIB _LVOOpenLibrary,_SysBase
- move.l d0,_GfxBase
- move.l d0,svb_GfxBase(a5) ; save it !
-
- lea SVSupportName,a1
- move.l #1,d0
- LINKLIB _LVOOpenLibrary,_SysBase
- move.l d0,_SVSupportBase
- move.l d0,svb_SVSupportBase(a5) ; save it !
-
- tst.l _DOSBase
- beq InitLib_Fail
- tst.l _IntuitionBase
- beq InitLib_Fail
- tst.l _GfxBase
- beq InitLib_Fail
- tst.l _SVSupportBase
- beq InitLib_Fail
-
- move.l a5,_SVDriverBase ; save Base Address for internal use
-
- jsr _SVLI_InitSVDList
-
- move.l a5,d0 ; return &SVDriverBase
-
- jmp InitLib_RTS
-
- InitLib_Fail:
-
- moveq #0,d0 ; NULL !
-
- InitLib_RTS:
-
- movem.l (sp)+,a4-a5
- rts
-
-
- ;-------------- OpenLib (Oeffnen der Library) ----------------------------------
- OpenLib:
- addq.w #1,LIB_OPENCNT(a6) ; LIB_OPENCNT ++
- bclr #LIBB_DELEXP,LIB_FLAGS(a6) ; clear LIBF_DELEXP
- move.l a6,d0 ; return &SVDriverBase
-
- rts
-
- ;-------------- CloseLib (Schliessen der Library) ------------------------------
- CloseLib:
- moveq #0,d0
- subq.w #1,LIB_OPENCNT(a6) ; LIB_OPENCNT --
- bne.s EndCloseLib ; wenn nicht null, Abbruch
- btst #LIBB_DELEXP,LIB_FLAGS(a6) ; Test auf LIBF_DELEXP
- beq.s EndCloseLib ; wenn Null, Abbruch
- bsr.s ExpungeLib ; wenn gesetzt, ExpungeLib
- EndCloseLib:
- rts
-
- ;-------------- ExpungeLib (Entfernen der Library) ----------------------------
- ExpungeLib:
- movem.l d2/a5/a6,-(sp)
-
- move.l a6,a5 ; &SVLibrary retten
- move.l _SysBase,a6 ; ExecBase to A6
- tst.w LIB_OPENCNT(a5) ; test LIB_OPENCNT
- beq.s NoOpenLib ; ...
- bset #LIBB_DELEXP,LIB_FLAGS(a5) ; set LIBF_DELEXP flag
- moveq #0,d0 ; Ptr auf Segmentliste
- jmp ExpungeLibEnd ;
- NoOpenLib:
- move.l svb_SegList(a5),d2 ; SegList retten
-
- move.l a5,a1 ; &SVLibrary nach A1 (Par.)
- LINKLIB _LVORemove,_SysBase ; Library-Node entfernen
-
- move.l _DOSBase,a1
- LINKLIB _LVOCloseLibrary,_SysBase
-
- move.l _IntuitionBase,a1
- LINKLIB _LVOCloseLibrary,_SysBase
-
- move.l _GfxBase,a1
- LINKLIB _LVOCloseLibrary,_SysBase
-
- move.l _SVSupportBase,a1
- LINKLIB _LVOCloseLibrary,_SysBase
-
- moveq #0,d0 ; D0 loeschen
- move.l a5,a1 ; &SVLibrary nach A1 (Par.)
- move.w LIB_NEGSIZE(a5),d0 ; Groesse der
- sub.l d0,a1 ; Library
- add.w LIB_POSSIZE(a5),d0 ; ermitteln !!!
-
- LINKLIB _LVOFreeMem,_SysBase ; Speicher freigeben
- move.l d2,d0 ; &SegList zurueckgeben
- ExpungeLibEnd:
- movem.l (sp)+,d2/a5/a6
- rts
-
- ;-------------- ExtFuncLib (bis einschl. OS V2.04 unbenutzt) ---------------
- ExtFuncLib:
-
- moveq #0,d0 ; Ist nie falsch ........ - oder ?
- rts
-
- ;-------------- Eigene Funktionen ------------------------------------------
-
- SECTION __MERGED,BSS
-
- _SVDriverBase: ds.l 1
- _SysBase: ds.l 1
- _DOSBase: ds.l 1
- _IntuitionBase: ds.l 1
- _GfxBase: ds.l 1
- _SVSupportBase: ds.l 1
-
- _XCEXIT: ds.l 1 ; dummy-values to get the compiler's libs work :
- __XCEXIT: ds.l 1
- _ONBREAK: ds.l 1
- __ONBREAK: ds.l 1
- __base: ds.l 1
- ___base: ds.l 1
- _ProgramName: ds.l 1
- __ProgramName: ds.l 1
- _StackPtr: ds.l 1
- __StackPtr: ds.l 1
- _oserr: ds.l 1
- __oserr: ds.l 1
- _OSERR: ds.l 1
- __OSERR: ds.l 1
-
- XDEF _SVDriverBase
- XDEF _SysBase
- XDEF _DOSBase
- XDEF _IntuitionBase
- XDEF _GfxBase
- XDEF _SVSupportBase
-
- XDEF _XCEXIT
- XDEF __XCEXIT
- XDEF _ONBREAK
- XDEF __ONBREAK
- XDEF __base
- XDEF ___base
- XDEF _ProgramName
- XDEF __ProgramName
- XDEF _StackPtr
- XDEF __StackPtr
- XDEF _oserr
- XDEF __oserr
- XDEF _OSERR
- XDEF __OSERR
- END
-