// Sys.Bk
// OsMain.Bj
// last index used = 226, 155 available

// File names given in parentheses -- all contained in <alos>newos.dm
// && flags things that are changed when making Os.Bk
// && next line changed to "0" to indicate lower relocation base

// in system storage area
external [
	sysFont
	dsp		
	sysZone	

// levCompat (compat.bcpl, osstatics.asm) -- accessed only via INITALTOIO

// levMain (osmain.bcpl, osutils.bcpl)
	CallSubsys	
	Wss		
	Ws		
	Wl		
	Wns		
	Wos		
	Wo		
	GetFixed	
	FreeFixed	
	FixedLeft	
	SetEndCode	
	Junta		

// levDisplay (dstream.bcpl, dhanx.asm)
	CreateDisplayStream	
	CharWidth		
	ResetLine		
	FontHeight		
	ShowDisplayStream	
	GetFont		
	SetFont		
	GetBitPos		
	SetBitPos		
	GetLmarg		
	SetLmarg		
	GetRmarg		
	SetRmarg		
	GetLinePos		
	SetLinePos		
	InvertLine		
	Scroll			
	EraseBits		

// levKeyboard (keyboard.bcpl, kbhan.asm)
	keys			
	lvCursorLink		
	SetKeyboardProc	

// levDirectory (dirs.bcpl)
	FindFdEntry		
	MakeNewFdEntry	
	DeleteFdEntry	
	SetWorkingDir	
	StripVersion		
	AppendVersion	
	OpenFile		
	HelpOpenFile			//For aliasing OpenFile
	OpenFileFromFp	
	DeleteFile		
	HelpDeleteFile		//For aliasing OpenFile
	WriteDiskDescriptor	
	ReadDiskDescriptor	

// levStreams (streams.bcpl, streamsml.asm)
	InitializeFstream	
	SetupFstream		
	CurrentPos		
	SetEof			
	ItemSize		
	Dirty			
	SetDirty		

	CreateDiskStream	
	ReadLeaderPage	
	WriteLeaderPage	
	CleanupDiskStream	
	WriteBlock		
	ReadBlock		
	TruncateDiskStream	
	PositionPage		
	PositionPtr		
	JumpToFa		
	GetCurrentFa		
	GetCompleteFa	
	KsBufferAddress	
	KsSetBufferAddress	
	FilePos		
	SetFilePos		
	FileLength		
	LnPageSize		
	KsGetDisk		
	ReleaseKs		
	KsHintLastPageFa	

	Closes			
	Gets			
	Puts			
	Resets			
	Putbacks		
	Errors			
	Endofs			
	Stateofs		
	Noop			
	TruePredicate		
	FalsePredicate	

//       (log.bcpl)
	MakeLogEntry	
	LogOpen		
	LogClose		

// levAlloc (alloc.bcpl)
	InitializeZone		
	HelpInitializeZone	// for HelpAlloc
	AddToZone		
	HelpAddToZone	// for HelpAlloc
	Allocate		
	Free			
	CheckZone		
	HelpCheckZone	

// levBFSwrite (readtimer.asm)
	SetDayTime		
	Timer			
	DayTime		

//	(level6.asm)
	sysDisk		
	diskKd			
//	(bfswrite.bcpl)
	WriteDiskPages	
	AssignDiskPage	
	ReleaseDiskPage		
	CreateDiskFile		
	DeleteDiskPages		

//lev BFSbase (bfsbase.bcpl)
	VirtualDiskDA		
	RealDiskDA		
	BfsInitializeCbStorage
	BfsDoDiskCommand	
	BfsMakeFpFromLabel
	BfsGetCb		
	ActOnDiskPages	

//	(dvec.bcpl)
	Dvec			
	DefaultArgs		

//	(bfsml.asm)
	MoveBlock		
	Zero			
	SetBlock		
	Usc			
	DoubleAdd		
	oneBits		
	freePageFid		
	freePageFp		
	FrameSize		
	MyFrame		
	CallersFrame		
	FramesCaller		
	CallFrame		
	GotoFrame		
	CoCall			
	CoReturn		
	ReturnTo		
	GotoLabel		
	RetryCall		
	ReturnFrom		
	DisableInterrupts	
	EnableInterrupts	
	StartIO			
	Idle		
	lvIdle	

//	(calls.asm)
	Call0	
	Call1	
	Call2	
	Call3	
	Call4	
	Call5	
	Call6	
	Call7	
	Call8	
	Call9	
// levStatics
	lvSysErr		
	lvSysZone		

//OsTop.Bj -- used to position Top statics
// && flags things that are changed when making Os.Bk for users.
// && next number gets changed to #100000 to identify top things.

//levBcpl (bautil.asm)

// levFilePointers (level012.asm)
	EnumerateFp		//Relocation base
	fpSysDir		
	fpSysBoot		
	fpDiskDescriptor	
	fpSysLog		
	fpSysTs		
	fpUserCm		
	fpComCm		
	fpRemCm		
	fpExecutive		
	fpSysFont		
	fpWorkingDir		
	nameWorkingDir	

// levBuffer (level012.asm)
	OsBuffer		

// levBasic (level012.asm, swatml.asm)
	EventVector		
	UserName		
	UserPassword		
	OsFinish		
	OsFinishCode		
	OsVersion		
	OsVersionCompatible
	OsFinishSafeAdr	
	SerialNumber		
	lvUserFinishProc	
	SysErr			
	CounterJunta		
	CallSwat		
	lvAbortFlag		
	lvSwatContextProc	
	OutLd			
	InLd			
	BootFrom		
	DiskIOSetup		
	DiskIOTransfer	
	UpdateTimer		
	lvParitySweepCount	
	LastLdCB		
	juntaTable		
	AltoVersion		
	ErrorLogAddress	
	lvParityPhantomEnable
	ClockSecond
 ]

structure str:
 [ n	byte
   ch↑1,255	byte
 ]

structure 
 [ lh	byte
   rh	byte
 ]

// KS types
manifest [
	ksTypeReadOnly=1
	ksTypeWriteOnly=2
	ksTypeReadWrite=3
	]

manifest [
	charItem=1
	wordItem=2
	]