// MiscSubrs.bcpl - Miscellaneous SUBRs
// Last change November 2, 1981  10:40 PM by Bill van Melle
// Last change July 13, 1981  1:01 AM by Beau Sheil
// Last change April 1, 1981  7:51 PM by Beau Sheil
// Tone change March 17, 1981  6:37 PM by Beau Sheil
// Last change March 16, 1981  12:01 PM by Beau Sheil
// Post Trill change February 26, 1981  11:30 AM by Beau Sheil

	get "LispBcpl.decl"

external [	// subrs defined here
	BACKGROUNDSUBR; CLOCK0; DAYTIME0; SETDAYTIME0; NOOPSUBR
		// obsolete subrs
	SERIALNUMBER; UserName0
		// for testing
	XtraSubr0; XtraSubr1; XtraSubr2; XtraSubr3; XtraSubr4
		// statics used
	@lvNIL; @lvVPtr; @VPtr0; @VPtr1; UserName; EmulatorSpace
		// procedures used
	@XPutBase32; @XGetBase32
	UpdateChain; FlushVM; WRITEDIRTYPAGE; NPAGESBIT
		// OS procedures
	Timer; ReadCalendar; SetCalendar; CallSwat

	]

let BACKGROUNDSUBR() = lvNIL

and CLOCK0(lvBox) = valof	// returns the millisecond clock
   [
   Timer(lvVPtr)
   XPutBase32(lvBox, lvVPtr)
   resultis lvBox
   ]

and DAYTIME0(lvBox) = valof	// returns the time of day clock
   [
   XPutBase32(lvBox, ReadCalendar(lvVPtr))
   resultis lvBox
   ]

and SETDAYTIME0(lvBox) = valof	// sets the time of day clock
   [
   XGetBase32(lvBox)
   SetCalendar(lvVPtr)
   resultis lvBox
   ]

and NOOPSUBR() = lvNIL

and UserName0() = Unimplemented()	// used to return addr of user name

and SERIALNUMBER() = Unimplemented()	// used to return machine net addr

and Unimplemented() = CallSwat("Subr not implemented!")

// The XtraSubrs are the most miscellaneous of all!!

and XtraSubr0() = UpdateChain()

and XtraSubr1() = FlushVM()

and XtraSubr2(lvBox; numargs na) = (na ls 1? lvNIL, SETDAYTIME0(lvBox))

and XtraSubr3(mindirty, evenifvalid) = WRITEDIRTYPAGE(mindirty, evenifvalid)

and XtraSubr4(flg) = NPAGESBIT (flg)