:TITLE[XWSIO2];*Reset & initialization of various Ethernets.
***Could use JRAM to carry out the reset functions.

%Edit by Fiala 10 March 1982: Replace code for old two-task 10 mb boards by
HGM’s new code for one-task 10 mb boards.
Edit by Fiala 3 March 1982: Use With10MB and With3MB conditionals.
Edit by Fiala 8 October 1981: Reformat; use HiA and LoA; bum 14b mi.
Edit by Fiala August 8, 1980 4:02 PM save one mi at SIO
Edit by Jim Frandeen July 16, 1980 1:29 PM: Change all references to AC0 to RTemp1 to free up AC0.
Edit by HGM June 29, 1980 12:14 AM: Add XWire board,
Fix dangling Timer problem by moving TimerTurnoff to Output task startup.
Edit by Johnsson January 27, 1980 4:34 PM: External refs
Edit by Danielson January 25, 1980 2:10 PM: removed RS232 hooks.
Edit by Jim Frandeen January 20, 1980 11:03 AM: cleanup for D0Lang Version 6.
Edit by Johnsson January 18, 1980 12:02 PM: fixed fixed clobber of timers at KillTimer
Edit by Jim Frandeen December 22, 1979 9:52 PM: cleanup for D0Lang Version 5.
Edit by Roy Ogus - June 22, 1979 4:15 PM


Emulator executes this code on the SIO instruction.
SIO control bits initially in T are decoded in pairs.

Bits 16+17 (octal) => 1st 3 mb Ethernet board
Bits 14+15 (octal) => 2nd 3 mb Ethernet board

Each pair of bits above is interpreted as follows:
Bit 17b
If 1, disable output & initialize output TPC.
Bit 16b
If 1, disable input & initialize input TPC.

1000 => reset 1st 10 mb Ethernet
2000 => reset 2nd 10 mb Ethernet
4000 => reset 3rd 10 mb Ethernet
%

SetTask[0];

OnPage[StartIOPage];

*Caller has put control bits in T, complement of control bits in RTemp1.
At[StartIOLoc];
:IF[With3MB]; *****************************************
*1st 3mb Ethernet board (Check bits 16,17):
SI1:
RTemp ← HiA[xoStartLoc,xoTask], Call[SIOXO];
SI2:
RTemp ← HiA[xiStartLoc,xiTask], Call[SIOXI];

*2nd 3mb Ethernet board (Check bits 14+15):
SIO4:
RTemp ← HiA[xoStartLoc,xoTask2], Call[SIOXO];
SIO10:
RTemp ← HiA[xiStartLoc,xiTask2], Call[SIOXI];
:ENDIF; ***********************************************

:IF[With10MB]; ****************************************
RTemp1 ← RSh[RTemp1,5];
*1st 10mb Ethernet board (Check bits 12+13):
SIO1000:
RTemp ← HiA[ENXStartLoc,enxTask], Call[SIOENX];
*2nd 10mb Ethernet board (Check bits 10+11):
SIO2000:
RTemp ← HiA[ENXStartLoc,enxTask2], Call[SIOENX];
*2nd 10mb Ethernet board (Check bits 10+11):
SIO4000:
RTemp ← HiA[ENXStartLoc,enxTask3], Call[SIOENX];
:ENDIF; ***********************************************

SIOTail:
LoadPageExternal[opPage3];
GoToExternal[P7TailLoc];


:IF[With10MB]; *****************************************
SIOENX:
RTemp ← (RTemp) or (LoA[ENXStartLoc]), GoTo[SIONotify];
:ENDIF; ***********************************************
:IF[With3MB]; *****************************************
SIOXO:
RTemp ← (RTemp) or (LoA[xoStartLoc]), GoTo[SIONotify];
SIOXI:
RTemp ← (RTemp) or (LoA[xiStartLoc]), GoTo[SIONotify];
:ENDIF; ***********************************************
SIONotify:
RTemp1 ← RSh[RTemp1,1], Skip[R Odd];
APCTask&APC ← RTemp;
Return;

:END[XWSIO2];