//D1field.bcpl -- machine-dependent part of "Field-loop" action
//	Last edited: 20 November 1979

manifest [ get "d1regmem.d" ]
manifest [ get "d1instrs.d" ]

external [
// MASM
	PutField

// MDATA
	@ShouldBe

// D1ASM
	@XctL16

// D1MEM
	PutMemData; GetMemData

// Defined here
	FieldLoop; SetupFieldTest; ModifyField
]


let SetupFieldTest(FldX) be
[	let Inst,AVec = vec 3,vec 1; AVec!0 = 0
	AVec!1 = NOOP/4; GetMemData(LDRx,Inst,AVec)
	AVec!1 = TSTINS/4; PutMemData(LDRx,Inst,AVec)
]


and ModifyField(Bit1,NBits,Value) be
[	let Inst,AVec = vec 3,vec 1; AVec!0 = 0
	AVec!1 = TSTINS/4; GetMemData(LDRx,Inst,AVec)
	PutField(Bit1,NBits,Inst,Value)
	PutMemData(LDRx,Inst,AVec)
]


//EveryTimeList item for FieldTest
and FieldLoop(FldX) be XctL16(TSTINS,ShouldBe!0)