	.TITLE QIOWAL
	.IDENT /110486/



;	Version:
;	File:[22,320]QIOWAL.MAC
;	Author: Peter Stadick (Third Author)
;	History: 20-Nov-83 -- convert to Pascal-3
;                13-Feb-85 -- Randy Baldwin
;                             fix iosb address pass in call,
;                             change DETACH function to DETCH to
;                             remove conflict with PASCALS DETACH
;                             function call.
;		 04-Nov-86 -- Derived from Jim Bostwick 
;			      (from Pascal-1 by Frank Stevens)
;                             Peter Stadick converted to write pass all.
;	Last Edit: 24-MAY-1987 17:35:35 
; 

.REM |

Procedure QIOWAL(LUN:Integer; 
		EFN:Event_flag;
		Stadd:Address; 
		Size:Integer
		);EXTERNAL;

{*USER*
 Pascal-3 Procedure to execute QIO WAL function.

This procedure will use Executive Queue I/O Request and Wait (QIOW$C) Call.  

LUN is the logical unit number to be assigned to the appropriate device.  

EFN is the event flag to be set when the I/O is completed. f0 may 
not be specified. 

STADD is the starting address of the buffer to be read or written.  
Use LOOPHOLE(Address,Ref(string)) to produce this parameter.

SIZE is the size of the buffer referenced by STADD.

Directive status is available in $DSW on return.

} 
|

;
; Assemble with PASMAC.MAC as prefix file.
;
; Thanks to Frank S. for the idea and the Pascal-1 version, which I 
; brazenly plagiarized. Same here - P. Stadick.
;

         .MCALL  QIOW$S
	
	PROC QIOWAL
	PARAM LUN, INTEGER
	PARAM EFN, SCALAR
	PARAM STADD, ADDRESS
	PARAM SIZE, INTEGER
	SAVE <R0, R1, R2, R3, R4 >
	BEGIN
	MOV SP,R0			;PRESERVE SP
        MOV #IO.WAL,R1			;WAL FUNCTION CODE IN R1
	MOVB EFN(0),R2			;EFN PARAM IS A BYTE, MUST CLEAN IT UP
	BIC #^C^O377,R2			;MAKE IT AN UNSIGNED WORD
  	BNE 3$				
	MOV #IE.IEF, $DSW		;MUST SUPPLY EVENT FLAG
	BR XT				;BRANCH IF ERROR
3$:     QIOW$S  R1,LUN(0),R2,,,,<STADD(0),SIZE(0),#0>
XT:
	ENDPR
	.END

