// rn2.sr
// Carol Hankins
// April 6, 1976

get "rn1.df"
get "bravo1.df"
get "st.df"

//incoming procedures
external
	[
	RbFromRlRi
	RdFromRlRbRi
	stsize
	sbwsize
	errhlta
	DirtyBp
	getvp
	move
	lockbp
	]

//incoming statics
external
	[
	vbp
	]

//outgoing procedures
external
	[
	SetRegionW
	]

//outgoing statics
//local statics


let SetRegionW(rlw,ri,sb) be
[

let tcch,trb,tpw,vpa,tbp = nil,nil,nil,nil,nil
let trd = vec lrd

tcch = stsize(sb)
trb = RbFromRlRi(rlw,ri)
RdFromRlRbRi(trd,rlw,trb,ri)

if tcch gr trd>>RD.dfcmax then sb >> SB.cch = trd>>RD.dfcmax-2	//  errhlta(72)
(trb+trb>>RX.brgdfc) ! ri = sb >> SB.cch
DirtyBp(vbp)

vpa<<VPA.fn = rlw>>RL.fn
vpa<<VPA.fp = (trd>>RD.fc)<<PCD.p
tpw = getvp(vpa)
move(sb,tpw+( ((trd>>RD.fc)<<PCD.rc) rshift 1),sbwsize(sb) )
DirtyBp(vbp)

]