//D1i1.bcpl--Define screen areas, allocate storage, and initialize print
//  control stuff.  Code here is executed only on Midas/I and the storage
//  allocated is preserved in Midas.RunProg and Midas.Dtach.
//	9 May 1983

get "mcommon.d"
manifest [ get "d1regmem.d" ]
manifest [
	VAtablen = (#40000/BlockSize)+1	//Maximum size for 16K IMX
	AAtablen = (#40000/BlockSize)+1
]

external [
// MINIT1
	SaveStatics; NewMPDispBlock; GetZStorage

// D1TABLES
	@MEMLEN

// D1VM
	VAtab; AAtab

// Defined here
	InitMPInterface
	@ScreenHeight; @ScreenWidth; @LDRMEM
]

static [
	@ScreenHeight = MaxLineN+11	//No. screen lines
	@ScreenWidth = 76		//No. chars/line
	@LDRMEM
]


//"InitMPInterface" allocates storage for vectors and the LDR memory and
//initializes screen areas.  Args to NewMPDispBlock are line number,
//left character (0 to ScreenWidth-1), identifying character for use in
//command files, width in characters
let InitMPInterface() be
[	for I = 0 to MaxLineN-1 do	//60*30 = 3410B words
	[ NewMPDispBlock(I,0,$A,16)
	  NewMPDispBlock(I,18,$B,21)
	  NewMPDispBlock(I,41,$C,34)
	]
//Initialize VM stuff--here so that VM is cleared on RunProg
	VAtab = GetZStorage(VAtablen)
	AAtab = GetZStorage(AAtablen)
//#600 words
	LDRMEM = GetZStorage(LDRlen lshift 2)
	SaveStatics(lv LDRMEM)
]