// DiExComm.bcpl

get "DiEx.defs"


manifest new = #100

let DisplayComm() be
	[ Active = false
	if WriteEnable then WriteComm()
	ReadComm()
	DisplayParam(SetErrRes, 8, Tab4)
	DisplayParam(SetMaxEC, 8, Tab5)
	]

and WriteComm() be
	[ Active = false
	DisplayParam(WHact, 5, Tab3)
	DisplayParam(WLact, 6, Tab3)
	DisplayParam(WDact, 7, Tab3)
	]

and ReadComm() be
	[ Active = false
	DisplayParam(RHact, 5, Tab4)
	DisplayParam(RLact, 6, Tab4)
	DisplayParam(RDact, 7, Tab4)
	]

and WHact() be
	[ let str = "none"
	let flag = 0
	if NewBoolian("Specify the specific header command for the 'Write' pass (none will skip writing).") then flag = new
	switchon (T>>P.Waction.header) + flag into
		[
		default: T>>P.Waction.header = diskSkip; endcase

		case diskSkip+new: T>>P.Waction.header = diskCheck
		case diskCheck: str = "check"; endcase

		case diskCheck+new: T>>P.Waction.header = diskWrite
		case diskWrite: str = " write"; T>>P.Waction.label = diskWrite
		]
	if flag then WriteComm()
	PrintParam("W header:$S",str) 
	]

and WLact() be
	[ let str = "check"
	let flag = 0
	if NewBoolian("Specify the specific label command for the 'Write' pass.") then flag = new
	switchon (T>>P.Waction.label) + flag into
		[
		default: T>>P.Waction.label = diskCheck; endcase

		case diskCheck+new: T>>P.Waction.label = diskWrite
		case diskWrite: str = "write"; T>>P.Waction.data = diskWrite
		]
	if T>>P.Waction.header eq diskSkip then str = "none"
	if flag then WriteComm()
	PrintParam("W label: $S",str)
	]

and WDact() be
	[ let str = "write"; T>>P.Waction.data = diskWrite
	if T>>P.Waction.header eq diskSkip then str = "none"
	PrintParam("W data: $S",str)
	]

and RHact() be
	[ let str = "none"
	let flag = 0
	if NewBoolian("Specify the specific header command for the 'Read' pass(none will skip reading).") then flag = new
	switchon (T>>P.Raction.header) + flag into
		[
		default: T>>P.Raction.header = diskSkip; endcase

		case diskSkip+new: T>>P.Raction.header = diskCheck
		case diskCheck: str = "check"; endcase

		case diskCheck+new: T>>P.Raction.header = diskRead
		case diskRead: str = " read"
		]
	if flag then ReadComm()
	PrintParam("R header:$S",str)
	]

and RLact() be
	[ let str = "check"
	let flag = 0
	if NewBoolian("Specify the specific label command for the 'Read' pass.") then flag = new
	switchon (T>>P.Raction.label) + flag into
		[
		default: T>>P.Raction.label = diskCheck; endcase

		case diskCheck+new: T>>P.Raction.label = diskRead
		case diskRead: str = "read"
		]
	if T>>P.Raction.header eq diskSkip then str = "none"
	if flag then ReadComm()
	PrintParam("R label: $S",str)
	]

and RDact() be
	[ let str = "check"
	let flag = 0
	if NewBoolian("Specify the specific data command for the 'Read' pass.") then flag = new
	switchon (T>>P.Raction.data) + flag into
		[
		default: T>>P.Raction.data = diskCheck; endcase

		case diskCheck+new: T>>P.Raction.data = diskRead
		case diskRead: str = "read"
		]
	if T>>P.Raction.header eq diskSkip then str = "none"
	PrintParam("R data: $S",str)
	]

and SetErrRes() be
	[ let str = "Do Restore = "
	let HintStr = "Set the number of RETRIES before the heads are Restored."
	let num = NewNumber(HintStr, T>>P.ErrRes, str)
	T>>P.ErrRes = SetBounds(num,0,10)
	PrintParam("$S$D", str, T>>P.ErrRes)
	]

and SetMaxEC() be
	[ let str = "Retries= "
	let HintStr = "Set the maximum number of RETRIES before going to the next sector."
	let num = NewNumber(HintStr, T>>P.maxEC, str)
	T>>P.maxEC = SetBounds(num,0,100)
	PrintParam("$S$D", str, T>>P.maxEC)
	]