	.TITLE LATCON
	.IDENT /041789/



;	Version:
;	File:[22,320]LATCON.MAC
;	Author: Peter Stadick 
;	History: 
;
;	Last Edit: 3-MAY-1989 15:13:14 
; 

.REM |

Procedure LATCON(LUN:Integer;
                 EFN:Event_Flag;
		 VAR IOSB:IO_status_block
		);EXTERNAL;

{*USER*
 Pascal-3 Procedure to explicitly connect it as a application port. 

This procedure will perform the following operation.
-Explicitly connect the device to the LAT port.

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. 

IOSB is the IO status block.

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

.PSECT LATCON,RO,I,LCL,REL

	PROC  LATCON
	PARAM LUN, INTEGER
	PARAM EFN, SCALAR
	PARAM ISB, ADDRESS
	SAVE <R0, R1, R2, R3, R4, R5 >
	BEGIN
	MOV SP,R0			;PRESERVE SP
	MOV #IO.ORG,R1			;CONNECTION FUNTION
	MOV ISB(0),R3
	MOVB EFN(0),R2			;EFN PARAM IS A BYTE
	BIC #^C^O377,R2			;MAKE IT UNSIGNED WORD
	BNE 3$
	MOV #IE.IEF,$DSW		;MUST SUPPLY EVENT FLAG
	BR XT
3$:	QIOW$S	R1,LUN(0),R2,,R3,
XT:
	ENDPR
	.END

