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

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

***NOTE: Bad arguments could smash tasks not associated with the Ethernet.
%

SetTask[0];

OnPage[StartIOPage];

*Caller has put control bits in T, complement of control bits in RTemp1.
:IF[With3MB]; *****************************************
*1st 3mb Ethernet board (Check bits 16,17):
SI1:
RTemp ← HiA[xoStartLoc,xoTask], Call[SIOXO], At[StartIOLoc];
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];
RTemp1 ← RSh[RTemp1,5];
:ELSE; ************************************************
RTemp1 ← RSh[RTemp1,11], At[StartIOLoc];
:ENDIF; ***********************************************

:IF[With10MB]; ****************************************
*1st 10mb Ethernet board (Check bit 6):
SIO1000:
RTemp ← HiA[ENXStartLoc,enxTask], Call[SIOENX];
*2nd 10mb Ethernet board (Check bit 5):
SIO2000:
RTemp ← HiA[ENXStartLoc,enxTask2], Call[SIOENX];
*2nd 10mb Ethernet board (Check bit 4):
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];