home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 6
/
AACD06.ISO
/
AACD
/
Utilities
/
Resources
/
ProNET
/
src
/
include
/
devio.s
< prev
next >
Wrap
Text File
|
1996-06-07
|
1KB
|
96 lines
;: > devio.s
;:
;: Routines for opening and communicating with devices
;: You should only call these routines::
;:
;: GetIORequest - Call with Size of IOReq in d0
;: FreeIORequest - Call with *IOReq in a0 !
include "p:include/devio_ports.s"
*
* CreateIOReq
*
* a0 *ReplyPort
* d0 Size
*
* RETURNS d0 *IORequest or NULL
*
CreateIOReq movem.l d3/a3,-(sp)
move.l d0,d3
move.l a0,a3
move.l #MEMF_CLEAR^MEMF_PUBLIC,d1
LIBCALL AllocMem
move.l d0,a0
tst.l d0
beq.s .ende
move.l a3,14(a0)
move.w d3,18(a0)
.ende movem.l (sp)+,d3/a3
rts
*
* DeleteIOReq
*
* a0 *IORequest
*
DeleteIOReq moveq #0,d0
move.w 18(a0),d0
move.l a0,a1
LIBCALL FreeMem
rts
*
* GetIORequest
*
* d0 Size of IORequest
*
* RETURNS d0 *IORequest or NULL
*
GetIORequest movem.l d2-d6/a2-a6,-(sp)
move.l 4.w,a6
move.l d0,d2
bsr CreatePort
move.l d0,a0
tst.l d0
beq.s .ende
move.l a0,a3
move.l d2,d0
bsr.s CreateIOReq
tst.l d0
beq.s ferr1
.ende movem.l (sp)+,d2-d6/a2-a6
rts
*
* FreeIORequest
*
* a0 *IORequest
*
FreeIORequest movem.l d2-d6/a2-a6,-(sp)
move.l 4.w,a6
move.l a0,a3
move.l a3,a0
move.l 14(a0),a3
bsr.s DeleteIOReq
ferr1 move.l a3,a0
bsr DeletePort
dioferr movem.l (sp)+,d2-d6/a2-a6
moveq #0,d0
rts