// Sys.Bk -- Link between OS and User programs
// Last modified: December 15, 1977  7:57 PM

// OsMain.Bj
// Last index used: 230, none available

// File names given in parentheses -- all contained in
// <AltoSource>Os.dm

// && flags things that are changed when making Sys.Bk
// && next line changed to "0" to indicate lower relocation base
	0

// in system storage area
	sysFont			1	V
	dsp			2	V
	sysZone			221	V

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

// levMain (osmain.bcpl, osutils.bcpl)
	CallSubsys		0	P	//Relocation base
	Wss			3	P
	Ws			4	P
	Wl			5	P
	Wns			6	P
	Wos			7	P
	Wo			10	P
	GetFixed		11	P
	FreeFixed		12	P
	FixedLeft		13	P
	SetEndCode		14	P
	Junta			15	P

// levDisplay (dstream.bcpl, dhanx.asm)
	CreateDisplayStream	23	P
	CharWidth		24	P
	ResetLine		25	P
	FontHeight		26	P
	ShowDisplayStream	27	P
	GetFont			30	P
	SetFont			31	P
	GetBitPos		32	P
	SetBitPos		33	P
	GetLmarg		34	P
	SetLmarg		35	P
	GetRmarg		36	P
	SetRmarg		37	P
	GetLinePos		40	P
	SetLinePos		41	P
	InvertLine		42	P
	Scroll			43	P
	EraseBits		44	P

// levKeyboard (keyboard.bcpl, kbhan.asm)
	keys			45	V
	lvCursorLink		46	V
	SetKeyboardProc		47	P

// levDirectory (dirs.bcpl)
	FindFdEntry		50	P
	MakeNewFdEntry		51	P
	DeleteFdEntry		52	P
	SetWorkingDir		53	P
	StripVersion		54	P
	AppendVersion		55	P
	OpenFile		56	P
	HelpOpenFile		56	P  //For aliasing
	OpenFileFromFp		57	P
	DeleteFile		60	P
	HelpDeleteFile		60	P  //For aliasing
	WriteDiskDescriptor	61	P
	ReadDiskDescriptor	226	P
	ParseFileName		155	P

// levStreams (FastStreamsB.bcpl, FastStreamsA.asm)
	InitializeFstream	62	P
	SetupFstream		63	P
	CurrentPos		64	P
	SetEof			65	P
	ItemSize		66	P
	Dirty			67	P
	SetDirty		70	P

//	(DiskStreams.bcpl)
	CreateDiskStream	71	P
	ReadLeaderPage		72	P
	WriteLeaderPage		73	P
	CleanupDiskStream	75	P
	WriteBlock		76	P
	ReadBlock		77	P
	TruncateDiskStream	100	P
	PositionPage		101	P
	PositionPtr		102	P
	JumpToFa		103	P
	GetCurrentFa		104	P
	GetCompleteFa		105	P
	KsBufferAddress		106	P
	KsSetBufferAddress	107	P
	FilePos			110	P
	SetFilePos		111	P
	FileLength		112	P
	LnPageSize		152	P
	KsGetDisk		153	P
	ReleaseKs		147	P
	KsHintLastPageFa	154	P

	Closes			113	P	//actually Call2
	Gets			114	P	//actually Call3
	Puts			115	P	//actually Call4
	Resets			116	P	//actually Call5
	Putbacks		117	P	//actually Call6
	Errors			120	P	//actually Call7
	Endofs			121	P	//actually Call8
	Stateofs		122	P	//actually Call9

//	(log.bcpl)
	MakeLogEntry		74	P	//dummy - deimplemented
	LogOpen			223	P	//dummy - deimplemented
	LogClose		224	P	//dummy - deimplemented

// levAlloc (alloc.bcpl)
	InitializeZone		16	P
	HelpInitializeZone	16	P	//for HelpAlloc
	AddToZone		17	P
	HelpAddToZone		17	P	//for HelpAlloc
	Allocate		20	P	//actually Call0
	Free			21	P	//actually Call1
	CheckZone		22	P
	HelpCheckZone		22	P	//for HelpAlloc

// levBFSwrite (readtimer.asm)
	SetDayTime		140	P	//this will disappear soon
	Timer			141	P
	DayTime			142	P	//this will disappear soon
	SetCalendar		227	P
	ReadCalendar		230	P

//	(level6.asm)
	sysDisk			143	V
	diskKd			144	V

//	(bfswrite.bcpl)
	WriteDiskPages		162	P	//actually Call1
	AssignDiskPage		163	P	//actually Call4
	ReleaseDiskPage		164	P	//actually Call5
	CreateDiskFile		165	P	//actually Call2
	DeleteDiskPages		166	P	//actually Call3

//lev BFSbase (bfsbase.bcpl)
	VirtualDiskDA		167	P	//actually Call6
	RealDiskDA		170	P	//actually Call7
	BfsInitializeCbStorage	145	P
	BfsDoDiskCommand	146	P
	BfsMakeFpFromLabel	156	P
	BfsGetCb		150	P
	ActOnDiskPages		161	P	//actually Call0

//	(dvec.bcpl)
	Dvec			171	P
	DefaultArgs		172	P

//	(bfsml.asm)
	MoveBlock		173	P
	Zero			174	P
	SetBlock		175	P
	Usc			176	P
	DoubleAdd		177	P
	oneBits			200	P
	freePageFid		201	P
	freePageFp		202	P
	FrameSize		203	P
	MyFrame			204	P
	CallersFrame		205	P
	FramesCaller		206	P
	CallFrame		207	P
	GotoFrame		210	P
	CoCall			211	P
	CoReturn		212	P
	ReturnTo		213	P
	GotoLabel		214	P
	RetryCall		215	P
	ReturnFrom		216	P
	DisableInterrupts	217	P
	EnableInterrupts	220	P
	StartIO			225	P
	Idle			157	P
	lvIdle			160	V
	Noop			123	P  //moved from StreamsMl
	TruePredicate		124	P  //moved from StreamsMl
	FalsePredicate		125	P  //moved from StreamsMl

//	(calls.asm)
	Call0			126	P
	Call1			127	P
	Call2			130	P
	Call3			131	P
	Call4			132	P
	Call5			133	P
	Call6			134	P
	Call7			135	P
	Call8			136	P
	Call9			137	P

// levStatics
	lvSysErr		151	V
	lvSysZone		222	V

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

// levBcpl (bautil.asm)

// levFilePointers (level012.asm)
	EnumerateFp		0	P	//Relocation base
	fpSysDir		1	V
	fpSysBoot		2	V
	fpDiskDescriptor	3	V
	fpSysLog		4	V
	fpSysTs			5	V
	fpUserCm		6	V
	fpComCm			7	V
	fpRemCm			10	V
	fpExecutive		11	V
	fpSysFont		12	V
	fpWorkingDir		13	V
	nameWorkingDir		14	V

// levBuffer (level012.asm)
	OsBuffer		15	V

// levBasic (level012.asm, swatml.asm)
	EventVector		16	V
	UserName		17	V
	UserPassword		20	V
	OsFinish		21	P
	OsFinishCode		22	V
	OsVersion		23	V
	OsVersionCompatible	24	V
	OsFinishSafeAdr		25	V
	SerialNumber		26	V
	lvUserFinishProc	27	V
	SysErr			30	P
	CounterJunta		31	P
	CallSwat		32	P
	lvAbortFlag		33	V
	lvSwatContextProc	34	V
	OutLd			35	P
	InLd			36	P
	BootFrom		37	P
	DiskIOSetup		40	P
	DiskIOTransfer		41	P
	UpdateTimer		42	P
	lvParitySweepCount	43	V
	LastLdCB		44	V
	juntaTable		45	V
	AltoVersion		46	V
	ErrorLogAddress		47	V
	lvParityPhantomEnable	50	V
	ClockSecond		51	V