//**************************************************************************************
//*** ECLutvfc7.TST
//*** Rev.H                                                May 29.1979
//*** Rev.F                                                February16.1979
//*** Rev.B										August 4.1978        
//*** V. Vysin                                             
//**************************************************************************************

//**************************************************************************************
//To include the following definition files in the compilation
get "tester.d"
get "ECLutvfc.d"

//**************************************************************************************
//{ODataM: Odata.00, Odata.01, Odata.02, Odata.03, Odata.04, Odata.05, Odata.06, Odata.07}
//{ODataL:  Odata.08, Odata.09, Odata.10, Odata.11, Odata.12, Odata.13, Odata.14, Odata.15}
//{OData0: Odata.00, Odata.01, Odata.02, Odata.03}
//{OData1: Odata.04, Odata.05, Odata.06, Odata.07}
//{OData2: Odata.08, Odata.09, Odata.10, Odata.11}
//{OData3: Odata.12, Odata.13, Odata.14, Odata.15}
//{IAddr: Iaddr.0, Iaddr.1, Iaddr.2, Iaddr.3, Iaddr.5, Iaddr.6, Iaddr.7}

let Test71() be
[
   Start()
   Switch()
   NClk(1)  
   let pat1 = table [ #1; #2; #4; #10 ]
   let pat2 = table [ #16; #15; #13; #7 ]
   let chan =0   ;//the ECL-ONLY test clip should be in location b-2

   S3: for j=0 to 3 do
   [
      OddLine()            // to write into Even buffer
      {ODataM}=#100  ;     // starting write address
      ClkStart()
      ClkIAR()
      {ODataM} = #000 ;      // blocks counting 
      ClkStart()
      {OData0}= pat1!j
      {OData1}= pat1!j
      {OData2}= pat1!j
      {OData3}= pat1!j
      WriteAll()
// this writes byte 0 into terminal 0, byte 1 into terminal 3 ...
//Reading it back now
      Switch()
      NClko(#140);  //this flips into EvenLine to read Even buffer
      // #140 to keep PBlank=0 and both bckgds=1      
      Compare("MyTask",{MyTask},1," ",1,j) 
      {ODataM} = #200
      ClkStart()
      NClk(1)              // Nclks now will only reload
      NClk(1)            //loads <0> into first level reg(u36,35,33,32)
      if chan ls 2 do
      [
         NClk(1)              // to load u40..addtl clk for ch 0 & 1
      ]
      let sel1 = table [ 1; 0; 1; 0 ]
      let sel2 = table [ 1; 1; 0; 0 ]  
 //  sel2 is msb
// because inverted value selects, the table is inverted to take the lsb of T reg first
      // we shall now examine all four bits in channel chan
     let v1 = pat1!j
     let v2 = pat2!j
     for g=0 to 3 do
      [
         let h=10*j+g
         {Iaddr.6}= sel2!g
         {Iaddr.7}= sel1!g
         {IValid'} =0
         EClock()         // sets IMeF
         Compare( " IOAttn'",{IOAttn'},v2&#1,"", 3,h)
         {IValid'}=1
         EClock()       //resets IMeF
         v2 = v2 rshift 1
      ]
   ]      
      if chan eq 0 do
      [ 
         [
            DisplayString("*nTest of the terminal T0 revealed that the said terminal ")
            DisplayString("*n is in a fine shape.  ")
            DisplayString("*n Move the test clip to position c-2")
            DisplayString("*n  Press any key on the keyboard to  continue the test,- Thank you.")
            while Endofs(keys) do[]
            Breakpoint(9)
         ]
         Delay(1)
         chan = 1
         goto S3
        // lets go to the next channel now
      ]
      if chan eq 1 do
      [ 
         [
            DisplayString("*nTest of the terminal T1 revealed that the said terminal ")
            DisplayString("*n,is in a fine shape")
            DisplayString("*n move the marked test clip to position        g-2 ?")
            DisplayString("*n Press any key on the keyboard for continuation? - Thank you.")
            while Endofs(keys) do[]
            Breakpoint(9)
         ]
         Delay(1)
         chan = 2
         goto S3
      ]
      if chan eq 2 do
      [ 
         [
            DisplayString("*nTest of the terminal T2 revealed that the said terminal ")
            DisplayString("*n is in a fine shape. Would you now please")
            DisplayString("*n move the test clip to position h-2 ?")  
            DisplayString("*n press any key on my keyboard for continuation? - Thank you.")
            while Endofs(keys) do[]
            Breakpoint(9)
         ]
         Delay(1)
         chan = 3
         goto S3
      ]
      if chan eq 3 do
      [ 
         [
            DisplayString("*nTerminal T3 is allright")
            DisplayString("*nMove the marked test clip to position     f-2   ")
            DisplayString("*nAfter  having done so,would you now press any key on the keyboard for continuation? - Thank you.")
            while Endofs(keys) do[]
            Breakpoint(9)
         ]
         Delay(1)
      ]
      Stop()
]