.TITLE DVALOC.MAC 84j03a 03-Oct-84/. .ENABL LC ; Author: N. A. Bourgeois, Jr. ; of ; NAB Software Services, Inc. ; PO Box 20009 ; Albuquerque, NM 87154 ; and ; Sandia National Laboratories ; PO Box 5800 ; Albuquerque, NM 87185 .SBTTL EDIT RECORD 03-Oct-84/. ; 03-Oct-84 Original creation. .PAGE .SBTTL DESCRIPTION 03-Oct-84/. ; This module contains the device allocation and deallocation support ; routines. This module is a part of the FORTRAN callable TSX-Plus ; EMT support routines. ; The IALOC routine allocates a device. ; ; Calling sequence: ; ; CALL IALOC (DVPTR,JBNUM,IERR) ; ; where: DVPTR is the name of a four word array which contains ; the device name in RAD50 in the first word and ; zeros in the others. ; ; JBNUM is undefined or if IERR = 1, the number of the ; job to which the device is already allocated. ; ; IERR is negative or one of the following: ; ; 1 device is already allocated to another ; user. ; 2 invalid device specified. ; 3 device allocation table is full. ; 4 device is currently being used by ; another user. ; The IDALOC routine deallocates a device. ; ; Calling sequence: ; ; CALL IDALOC (DVPTR,JBNUM,IERR) ; ; where: DVPTR is the name of a four word array which contains ; the device name in RAD50 in the first word and ; zeros in the others. ; ; JBNUM is undefined or if IERR = 1, the number of the ; job to which the device is already allocated. ; ; IERR is negative or one of the following: ; ; 1 device is already allocated to another ; user. ; 2 invalid device specified. ; The ICALOC routine checks the allocation status of a device. ; ; Calling sequence: ; ; CALL ICALOC (DVPTR,JBNUM,IERR) ; ; where: DVPTR is the name of a four word array which contains ; the device name in RAD50 in the first word and ; zeros in the others. ; ; JBNUM is undefined or if IERR = 1, the number of the ; job to which the device is already allocated. ; ; IERR is negative or one of the following: ; ; 1 device is already allocated to another ; user. ; 2 invalid device specified. ; 4 device is currently being used by ; another user. .PAGE .SBTTL DIRECTIVES 03-Oct-84/. .IDENT \84j03a\ ;tell linker our version .PSECT TSXLIB,I .GLOBL TSLBID .WORD TSLBID .DSABL GBL .SBTTL ASSIGNMENTS 03-Oct-84/. ERRBYT = 52 ;EMT error code locationn NOERR = -1 ;code for no error condition .PAGE .SBTTL ENTRY POINTS 03-Oct-84/. ; Allocate a device. ; IALOC:: MOV #156 ,R1 ;EMT code CLR R2 ;function code CALL DOIT ;allocate the device RETURN ; Deallocate a device. ; IDALOC::MOV #156 ,R1 ;EMT code MOV #1 ,R2 ;function code CALL DOIT ;deallocate the device RETURN ; Check the allocation status of a device. ; ICALOC::MOV #156 ,R1 ;EMT code MOV #2 ,R2 ;function code CALL DOIT ;check the allocation status RETURN .PAGE .SBTTL SUPPORTING SUBROUTINES 03-Oct-84/. DOIT: MOV 2(R5) ,-(SP) ;pass argument 1 MOV R2 ,-(SP) ;lo byte = function code MOV SP ,R0 ;set up the pointer MOV R1 ,1(R0) ;hi byte = EMT code MOV #NOERR ,R1 ;for no error return EMT 375 ;let TSX do it BCC 1$ ; if no error CLR R1 ; if error, then MOVB @#ERRBYT,R1 ; get the code CMPB #1 ,@#ERRBYT ;allocated to another user? BNE 1$ ; no MOV R0 ,@4(R5) ; yes, so tell who 1$: MOV R1 ,@6(R5) ;return "error" code CMP (SP)+ ,(SP)+ ;adjust the stack pointer RETURN .SBTTL END 03-Oct-84/. .END