🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #10320

Routines to allocate low level serial/parallel hardware via resources.

#10320
From: Matt Dillon
Date: Wed, 16 Nov 1988 08:02
75 lines
2194 bytes
	These are excerps from my sup32.lib support library, recently
distributed to comp.sources/binaries.amiga:


rval  = AutoAllocMiscResource(resno, value)

	resno: MR_SERIALPORT, SERIALBITS, PARALLELPORT, or PARALLELBITS
	value:	-1 to allocate, 0 to check.

	This functions allocates or checks the specified resource.  0
	(ZERO) is returned on SUCCESS (allocated or could allocate),

	NON-ZERO is returned if the resource is already allocated by
	somebody else.

(void)= AutoFreeMiscResource(resno)

	Free's a resource you allocated.  YOU MUST OWN THE RESOURCE!

	Neither of these functions require you to open the misc.resource
	resource.


 ;
 ;  EXEC resource support
 ;			       4(sp)  8(sp)
 ;	AutoAllocMiscResource(resno, value)
 ;	    resno:  MR_SERIALPORT, SERIALBITS, PARALLELPORT, PARALLELBITS
 ;	    value:  -1 to allocate, 0 to check
 ;
 ;	    returns 0 on success
 ;
 ;	AutoFreeMiscResource(resno)
 ;			      4(sp)
 ;	    Free a misc resource you allocated
 ;
 ;	No need to open the misc.resource

	    public  _AutoAllocMiscResource
	    public  _AutoFreeMiscResource
	    public  _LVOOpenResource

	    FAR     DATA

_AutoAllocMiscResource:
	    move.l  A6,-(sp)
	    bsr     OpenMiscResource
	    beq     amfail
	    move.l  8(sp),D0
	    move.l  12(sp),A1
	    jsr     -6(A6)
	    bra     amret
amfail	    moveq.l #-1,D0
amret	    move.l  (sp)+,A6
	    rts

_AutoFreeMiscResource:
	    move.l  A6,-(sp)
	    bsr     OpenMiscResource
	    beq     fmret
	    move.l  8(sp),D0
	    jsr     -12(A6)
fmret	    move.l  (sp)+,A6
	    rts

OpenMiscResource:
	    move.l  4,A6
	    lea.l   MiscName,A1
	    jsr     _LVOOpenResource(A6)
	    move.l  D0,A6
	    tst.l   D0
	    rts

MiscName:   dc.b    "misc.resource",0
Technical Details
Message-ID: <8811160802.AA26161@postgres.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!pacbell!ames!pasteur!ucbvax!POSTGRES.BERKELEY.EDU!dillon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!pacbell!ames!pasteur!ucbvax!POSTGRES.BERKELEY.EDU!dillon
From: dillon@POSTGRES.BERKELEY.EDU (Matt Dillon)
Newsgroups: comp.sys.amiga.tech
Subject: Routines to allocate low level serial/parallel hardware via resources.
Message-ID: <8811160802.AA26161@postgres.Berkeley.EDU>
Date: 16 Nov 88 08:02:13 GMT
Sender: usenet@ucbvax.BERKELEY.EDU
Lines: 75