;******************************* INCLUDE HEADER *****************************;
;*                                                                          *;
;* INCLUDE FILE: SysGenUVA.Mdf                    VII030B M07  === 032289 *;
;*                                                                          *;
;* MACHINE: B20         LANGUAGE: ASSEMBLER  OS: BTOS II                    *;
;*                                                                          *;
;* DESCRIPTION: Include file for SysGen.Mdf to define Unisys specific       *;
;*              data and publics.                                           *;
;*                                                                          *;
;*                                                                          *;
;* HISTORY:                                                                 *;
;*                                                                          *;
;* MMDDYY VVVVMM PROGRAMMER    DESCRIPTION OF CHANGE (Most recent first)*;
;*                                                                          *;
;* 032289 II030B07 A. Kohirkar Backed out the previous change.          *;
;* 082688 II021A06 A. Kohirkar Changed nTmp to prevent allocation of    *;
;*                                 ExUCBs for remote users.                 *;
;*                                 (Mike McCrary for OLYMPIA)               *;
;* 060187 II010C05 M. Evans    Added check for ctosp to the declaration *;
;*                                 rgfSys which is not needed on PM machines*;
;* 050687 II010B04 M. Evans    Changed name back to SysGenUVA.Mdf, it's *;
;*                                 a long story...                          *;
;* 043087 II010A03 M. Evans    Changed name to rmSysGenUVA.Mdf          *;
;* 122986 080F02 M. Evans      Added wLocalUser for quick ident. of OS  *;
;*                                 user numbers and forced word alignment of*;
;*                                 word arrays in the user number scheme for*;
;*                                 quicker searches.                        *;
;* 092486 080C01 M. Evans      Created this file by removing code I had *;
;*                                 prevoiusly added directly to SysGen.Mdf in;
;*                                 BTOS 8.0.B and later support for Allocat*;
;*                                 User Numbers.                            *;
;*                                                                          *;
;* TITLE:  BTOS SYSTEM SOFTWARE                                             *;
;*                                                                          *;
;*                        PROPRIETARY PROGRAM MATERIAL                      *;
;*                                                                          *;
;* THIS MATERIAL IS PROPRIETARY TO UNISYS CORPORATION AND IS NOT TO BE      *;
;* REPRODUCED, USED OR DISCLOSED EXCEPT IN ACCORDANCE WITH PROGRAM LICENSE  *;
;* OR UPON WRITTEN AUTHORIZATION OF THE PATENT DIVISION OF UNISYS           *;
;* CORPORATION, DETROIT, MICHIGAN 48232, USA.                               *;
;*                                                                          *;
;*                                                                          *;
;* COPYRIGHT (C) 1980 CONVERGENT TECHNOLOGIES, INC. ALL RIGHTS RESERVED     *;
;* COPYRIGHT (C) 1989 UNISYS CORPORATION                                    *;
;* **************************************************************************;
;*                                                                          *;
;* UNISYS BELIEVES THAT THE SOFTWARE FURNISHED HEREWITH IS ACCURATE AND     *;
;* RELIABLE, AND MUCH CARE HAS BEEN TAKEN IN ITS PREPARATION.  HOWEVER,     *;
;* NO RESPONSIBILITY, FINANCIAL OR OTHERWISE, CAN BE ACCEPTED FOR ANY       *;
;* CONSEQUENCES ARISING OUT OF THE USE OF THIS MATERIAL, INCLUDING LOSS OF  *;
;* PROFIT, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES, THERE ARE NO        *;
;* WARRANTIES WHICH EXTEND BEYOND THE PROGRAM SPECIFICATION.                *;
;*                                                                          *;
;* THE CUSTOMER SHOULD EXERCISE CARE TO ASSURE THAT USE OF THE SOFTWARE     *;
;* WILL BE IN FULL COMPLIANCE WITH LAWS, RULES AND REGULATIONS OF THE       *;
;* JURISDICTIONS WITH RESPECT TO WHICH IT IS USED.                          *;
;*                                                                          *;
;*                                                                          *;
;*************************** END OF MODULE HEADER ***************************;

IF(NOT(*isdef(ctosp))) THEN (
'*************************************************************************'
'**** The Macro IF statement in  this block is not commented out. *******'
'*** This gaudy display is to catch your attention, fOld master should ***'
'**** probably go away in BTOS II, it is for b21 and b22 support ONLY ****'
'*************************************************************************'
'*'									'*'
'*'	;   pre 9.0 masters dont understand new XID msgs		'*'
'*'	PUBLIC fOldMaster						'*'
'*'	IF (not(*Isdef(fOldMaster))) THEN (Define(fOldMaster)(0))FI	'*'
'*'	fOldMaster DB fOldMaster					'*'
'*'									'*'
'*************************************************************************'
)FI

;;;;;;;;;;;;;;;;;;;;;; User Number Block Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;

FALSE          EQU 0

PUBLIC rgwUNOwner, nUNBlocks, rgbUNCount, bUNBlkSHR, wLocalUser, ExUCBLast
IF (fMulpar NE 0) THEN (
	IF(NOT(*isdef(ctosp))) THEN (PUBLIC rgfSys)FI
)FI

IF (*isdef(sUNBlocks)) THEN (
	SET(sBlk, sUNBlocks)
) ELSE (
	SET(sBlk, 8)
)FI
IF (not(*isdef(nUNMax))) THEN (
	SET(nUNMax, 0FFH)
)FI
SET(nTmp, nNetUsers+nUserNum)  		  ; Pad net users out to
SET(nPad, EVAL(((((nTmp1)sBlk)+1)*sBlk)nTmp)); next avialible Block
SET(nNetUsers,nNetUsers+nPad)  		      ; of sBlk user numbers.

SET(nUNforOS, EVAL( (nTmp+nPad)  sBlk))  	; Calculate  of blocks used
  						; by the OS.

IF (not(*Isdef(nUNBlocks))) THEN (  		; If nUnBlocks is undefined,
Define(nUNBlocks)(EVAL(nUNforOs+10))  	; set it for 10 free blocks.
	IF (EVAL(nUNBlocks*sBlk) GT nUNMax) THEN (
	SET(nUNBlocks, EVAL(nUNMaxsBlk))   ; If 10 free is to many then
	)FI  					; set to the maximum allowed.
)FI

; If more than nUNMax user numbers are defined then cause assembler to trip.
; The Default is 0FFH for future XE compatibility, don't laugh  I mean it.

;IF(nUNBlocks GT EVAL(nUNMaxsBlk)) THEN (
;******************************************************************
;   ERROR: TO MANY USER NUMBER BLOCKS DEFINED, MAXIMUM IS EVAL(nUNMaxsBlk)
;******************************************************************
;)FI

; Calculate  to Shift Right for index into rgwUNOwner array
SET(iTmp,0)
SET(nPad,sBlk)
REPEAT(sBlk)(
	SET(iTmp,EVAL(iTMp+1))
	SET(nPad,EVAL(nPad2))
	IF(nPad EQ 1) THEN (EXIT)FI
)

bUNBlkSHR DB iTmp

rgbUNCount DB nUNBlocks DUP(0)

IF(fMulpar NE 0) THEN (
	IF(NOT(*isdef(ctosp))) THEN (
		rgfSys DB nUNBlocks DUP(FALSE)
	)FI
)FI

SET(nTmp,(OFFSET $))		; If OFFSET is odd then force it even to speed
SET(nTmp,nTmp((nTmp2)*2))	; up memory access
IF (nTmp NE 0) THEN (
	DB	0		; Filler byte to force even addres
	)FI

ExUCBLast DW EVAL(nUNBlocks*sBlk)1 ; This is the last usable ExUCB.
nUNBlocks DW nUNBlocks

wLocalUser LABEL WORD		; First block is owned by the OS by definition
rgwUNOwner LABEL WORD		; Build array of user number block owners
				; (OS is only current owner).
SET(nTmp, 0)

REPEAT(nUNBlocks)
	(IF(nUNforOS GT nTmp)THEN(
		IF (fMulPar NE 0) THEN (
		DW  0H	; Preallocated OS user number
		) ELSE (
		DW  2H	; Safe number that won't be deallocated by termpros.
		)FI
	)ELSE(
	DW  0FFFFH	; Unallocated block of user numbers
	)FI
	SET(nTmp, nTmp+1)
)

;;;;;;;;;;;;;;;;;;;;;; End User Number Block Definitions ;;;;;;;;;;;;;;;;;;;;;
      *;
;* REPRODUCED, USED OR DISCLOSED EXCEPT IN ACCORDANCE WITH PROGRAM LICENSE  *;
;* OR UPON WRITTEN AUTHORIZATION OF THE PATENT DIVISION OF UNISYS     