
	    ;	TAG.ASM
	    ;
	    ;	Library tag


	    section text,code

	    xref    _LibInit
	    xref    _LibOpen
	    xref    _LibClose
	    xref    _LibExpunge
	    xref    _OpenFifo
	    xref    _CloseFifo
	    xref    _ReadFifo
	    xref    _WriteFifo
	    xref    _RequestFifo
	    xref    _BufSizeFifo

	    xdef    _LibId
	    xdef    _LibName

	    xdef    _Vectors
	    xdef    _BitTestSet

	    moveq   #-1,D0
	    rts

InitDesc:   dc.w    $4AFC	;RTC_MATCHWORD
	    dc.l    InitDesc	;Pointer to beginning
	    dc.l    EndCode	;Pointer to end of code
	    dc.b    0		;flags (NO RTF_AUTOINIT)
	    dc.b    38		;version
	    dc.b    9		;NT_LIBRARY
	    dc.b    0		;priority (doesn't matter)
	    dc.l    _LibName	;Name of library
	    dc.l    _LibId	;ID string (note CR-LF at end)
	    dc.l    Init	;Pointer to init routine

_LibName:   dc.b    'fifo.library',0
_LibId:     dc.b    'fifo.library 38.2 (8.5.96)',13,10,0
	    ds.l    0

_Vectors:
	    dc.l    ALibOpen
	    dc.l    ALibClose
	    dc.l    ALibExpunge
	    dc.l    0
	    dc.l    AOpenFifo
	    dc.l    ACloseFifo
	    dc.l    AReadFifo
	    dc.l    AWriteFifo
	    dc.l    ARequestFifo
	    dc.l    ABufSizeFifo
	    dc.l    -1

Init:	    move.l  A0,-(sp)
	    jsr     _LibInit(pc)
	    addq.l  #4,sp
	    rts

ALibOpen
	    move.l  A6,-(sp)
	    move.l  D0,-(sp)
	    jsr     _LibOpen(pc)
	    addq.l  #8,sp
	    rts

ALibClose
	    move.l  A6,-(sp)
	    move.l  D0,-(sp)
	    jsr     _LibClose(pc)
	    addq.l  #8,sp
	    rts

ALibExpunge
	    move.l  A6,-(sp)
	    move.l  D0,-(sp)
	    jsr     _LibExpunge(pc)
	    addq.l  #8,sp
	    rts

	    ;	------------------------ LIBRARY CALLS -----------------
	    ;
	    ;	OpenFifo(name:D0, size:D1, flags:A0)  (size must be a power of 2)
AOpenFifo
	    movem.l D0/D1/A0,-(sp)
	    jsr     _OpenFifo(pc)
	    lea     12(sp),sp
	    rts

	    ;	CloseFifo(fifo:D0, flags:D1)
ACloseFifo
	    move.l  D1,-(sp)
	    move.l  D0,-(sp)
	    jsr     _CloseFifo(pc)
	    addq.l  #8,sp
	    rts

	    ;	ReadFifo(fifo:D0, buf:D1, bytes:A0)
AReadFifo
	    movem.l D0/D1/A0,-(sp)
	    jsr     _ReadFifo(pc)
	    lea     12(sp),sp
	    rts

	    ;	WriteFifo(fifo:D0, buf:D1, bytes:A0)
AWriteFifo
	    movem.l D0/D1/A0,-(sp)
	    jsr     _WriteFifo(pc)
	    lea     12(sp),sp
	    rts

	    ;	RequestFifo(fifo:D0, msg:D1, req:A0)
ARequestFifo
	    movem.l D0/D1/A0,-(sp)
	    jsr     _RequestFifo(pc)
	    lea     12(sp),sp
	    rts

	    ;	BufSizeFifo(fifo:D0)
ABufSizeFifo
	    move.l  D0,-(sp)
	    jsr     _BufSizeFifo(pc)
	    addq.l  #4,sp
	    rts

	    ;	BitTestSet(addr,bitno)
_BitTestSet
	    move.l  4(sp),A0
	    move.w  10(sp),D0
	    bset.b  D0,(A0)
	    sne     D0
	    ext.w   D0
	    rts

EndCode:

	    END
