| The purpose of the file is to detect what network related
|  modules are present in a machine, with a view to being able
|  to kill them off, load newer underlying modules, such as
|  MBufManager and Internet, and then to restart enough of
|  the protocol stack to permit the remainder of the boot
|  sequence to complete.
|
| It is assumed that a version of Acorn Access is in use : if
|  no other version is available, use of the Applications
|  Accelerator (AUN/Level 4 Release 3 onwards) is recommended.
| This can be loaded by a !ARMBoot, and then control transfered
|  to an Access based boot system.
|
| Thanks to i-cubed Ltd. for supplying their utility to identify
|  which type of EtherH is in use (EHProdCode).
| Note, however, that this is supplied 'as is' and without warranty
|  or support from either Acorn or i-cubed.
|

Set System$Path_Message System resources not found.
IF "<BootResources$Path>" = "" THEN Set BootResources$Path <Boot$Dir>.Resources.
IF "<System$Path>" = "" THEN IfThere BootResources:!System Then /BootResources:!System

SetEval Inet$$MBuf 3
RMEnsure MBufManager 0.17 SetEval Inet$$MBuf 1
RMEnsure MBufManager 0.00 SetEval Inet$$MBuf 0

| Inet$$MBuf values:
|      3:    >= 0.17
|      2:
|      1:    <  0.17
|      0:    No MBufManager present

|
| Only need to proceed if MBufManager is OoD, since this implies
|  that the rest of the network software is OK to continue.
|
If <Inet$$MBuf> > 1 Then Obey

SetEval Inet$$Internet 3
RMEnsure Internet 5.02 SetEval Inet$$Internet 1
RMEnsure Internet 0.00 SetEval Inet$$Internet 0
If (<Inet$$MBuf> = 1) AND (<Inet$$Internet> > 1) Then SetEval Inet$$Internet 1

SetEval Inet$$AUNMsgs 3
RMEnsure AUNMsgs 0.07 SetEval Inet$$AUNMsgs 1
RMEnsure AUNMsgs 0.00 SetEval Inet$$AUNMsgs 0

SetEval Inet$$NetMsgs 3
RMEnsure NetMsgs 0.00 SetEval Inet$$NetMsgs 0

SetEval Inet$$AccMsgs 3
RMEnsure AccMsgs 0.00 SetEval Inet$$AccMsgs 0

SetEval Inet$$InternetA 3
RMEnsure InternetA 0.00 SetEval Inet$$InternetA 0

SetEval Inet$$Net  3
RMEnsure Net 6.18 SetEval Inet$$Net 1
RMEnsure Net 0.00 SetEval Inet$$Net 0
If (<Inet$$MBuf> = 1) AND (<Inet$$Net> > 1) Then SetEval Inet$$Net 2

SetEval Inet$$ShareFS 3
RMEnsure ShareFS 3.38 SetEval Inet$$ShareFS 1
RMEnsure ShareFS 0.00 SetEval Inet$$ShareFS 0
If (<Inet$$MBuf> = 1) AND (<Inet$$ShareFS> > 1) Then SetEval Inet$$ShareFS 2

SetEval Inet$$Freeway 3
RMEnsure Freeway 0.26 SetEval Inet$$Freeway 1
RMEnsure Freeway 0.00 SetEval Inet$$Freeway 0
If (<Inet$$MBuf> = 1) AND (<Inet$$Freeway> > 1) Then SetEval Inet$$Freeway 2

SetEval Inet$$LanManFS 3
RMEnsure LanManFS 1.82 SetEval Inet$$LanManFS 1
RMEnsure LanManFS 0.00 SetEval Inet$$LanManFS 0
If (<Inet$$MBuf> = 1) AND (<Inet$$LanManFS> > 1) Then SetEval Inet$$LanManFS 2

SetEval Inet$$AppleTalk 3
RMEnsure AppleTalk 0.52 SetEval Inet$$AppleTalk 1
RMEnsure AppleTalk 0.00 SetEval Inet$$AppleTalk 0
If (<Inet$$MBuf> = 1) AND (<Inet$$AppleTalk> > 1) Then SetEval Inet$$AppleTalk 2

SetEval Inet$$Ether3 3
RMEnsure Ether3 4.21 SetEval Inet$$Ether3 1
RMEnsure Ether3 0.00 SetEval Inet$$Ether3 0
If (<Inet$$MBuf> = 1) AND (<Inet$$Ether3> > 1) Then SetEval Inet$$Ether3 2

SetEval Inet$$EtherH 3
RMEnsure EtherH 4.16 SetEval Inet$$EtherH 1
RMEnsure EtherH 0.00 SetEval Inet$$EtherH 0
If (<Inet$$MBuf> = 1) AND (<Inet$$EtherH> > 1) Then SetEval Inet$$EtherH 2

| Inet$$EtherH values:
|      3:    >= 4.16
|      2:    (EtherH vsn >= 4.16) AND old MBufManager present
|      1:    <  4.16
|      0:    No EtherH driver present

If Inet$$EtherH >= 1 Then /Boot:Utils.EHProdCode
If Inet$$EtherH >= 1 Then If "<EtherH$Type>" = 0 Then Error 0 Unableto identify EtherH file type
If Inet$$EtherH >= 1 Then Set Alias$EtherHCopy Copy System:Modules.Network.EtherH<EtherH$Type>  RAM:$.* ~c~v
If Inet$$EtherH >= 1 Then Set Alias$EtherHLoad RMLoad RAM:$.EtherH<EtherH$Type>

SetEval Inet$$EtherB 3
RMEnsure EtherB 4.21 SetEval Inet$$EtherB 1
RMEnsure EtherB 0.00 SetEval Inet$$EtherB 0
If (<Inet$$MBuf> = 1) AND (<Inet$$EtherB> > 1) Then SetEval Inet$$EtherB 2

SetEval Inet$$EtherM 3
RMEnsure EtherM 0.39 SetEval Inet$$EtherM 1
RMEnsure EtherM 0.00 SetEval Inet$$EtherM 0
If (<Inet$$MBuf> = 1) AND (<Inet$$EtherM> > 1) Then SetEval Inet$$EtherM 2

SetEval Inet$$EtherO 3
RMEnsure EtherO 4.03 SetEval Inet$$EtherO 1
RMEnsure EtherO 0.00 SetEval Inet$$EtherO 0
If (<Inet$$MBuf> = 1) AND (<Inet$$EtherO> > 1) Then SetEval Inet$$EtherO 2

SetEval Inet$$EtherI 3
RMEnsure EtherI 1.01 SetEval Inet$$EtherI 1
RMEnsure EtherI 0.00 SetEval Inet$$EtherI 0
If (<Inet$$MBuf> = 1) AND (<Inet$$EtherI> > 1) Then SetEval Inet$$EtherI 2

SetEval Inet$$EtherR 3
RMEnsure EtherR 4.00 SetEval Inet$$EtherR 1
RMEnsure EtherR 0.00 SetEval Inet$$EtherR 0
If (<Inet$$MBuf> = 1) AND (<Inet$$EtherR> > 1) Then SetEval Inet$$EtherR 2

ChangeDynamicArea -RamFsSize 256K

If <Inet$$Internet> <= 1 Then Copy System:Modules.Network.Internet  RAM:$.* ~c~v
If <Inet$$AUNMsgs>  <= 1 Then Copy System:Modules.Network.AUNMsgs   RAM:$.* ~c~v
If <Inet$$MBuf>     <= 1 Then Copy System:Modules.Network.MManager  RAM:$.* ~c~v
If <Inet$$Freeway>   = 1 Then Copy System:Modules.Network.Freeway   RAM:$.* ~c~v
If <Inet$$ShareFS>   = 1 Then Copy System:Modules.Network.ShareFS   RAM:$.* ~c~v
If <Inet$$Net>       = 1 Then Copy System:Modules.Network.Net       RAM:$.* ~c~v
If <Inet$$Ether3>    = 1 Then Copy System:Modules.Network.Ether3-16 RAM:$.* ~c~v
If <Inet$$EtherH>    = 1 Then EtherHCopy
If <Inet$$EtherH>    = 2 Then EtherHCopy
If <Inet$$EtherB>    = 1 Then Copy System:Modules.Network.EtherB    RAM:$.* ~c~v
If <Inet$$EtherM>    = 1 Then Copy System:Modules.Network.EtherM    RAM:$.* ~c~v
If <Inet$$EtherO>    = 1 Then Copy System:Modules.Network.EtherO    RAM:$.* ~c~v
If <Inet$$EtherI>    = 1 Then Copy System:Modules.Network.EtherI    RAM:$.* ~c~v


If <Inet$$Net>       > 0 Then RMKill Net
If <Inet$$InternetA> > 0 Then RMKill InternetA
If <Inet$$Internet>  > 0 Then RMKill Internet
If <Inet$$NetMsgs>   > 0 Then RMKill NetMsgs
If <Inet$$AccMsgs>   > 0 Then RMKill AccMsgs
If <Inet$$ShareFS>   > 0 Then RMKill ShareFS
If <Inet$$Freeway>   > 0 Then RMKill Freeway
If <Inet$$LanManFS>  > 0 Then RMKill LanManFS
If <Inet$$AppleTalk> > 0 Then RMKill AppleTalk
If <Inet$$Ether3>    > 0 Then RMKill Ether3
If <Inet$$EtherH>    > 0 Then RMKill EtherH
If <Inet$$EtherB>    > 0 Then RMKill EtherB
If <Inet$$EtherM>    > 0 Then RMKill EtherM
If <Inet$$EtherO>    > 0 Then RMKill EtherO
If <Inet$$EtherI>    > 0 Then RMKill EtherI

If <Inet$$MBuf>      > 0 Then RMKill MBufManager

If <Inet$$MBuf>      < 3 Then RMLoad RAM:$.MManager
If <Inet$$AUNMsgs>   < 2 Then RMLoad RAM:$.AUNMsgs
If <Inet$$Internet>  < 2 Then RMLoad RAM:$.Internet
If <Inet$$Freeway>   < 2 Then RMLoad RAM:$.Freeway
If <Inet$$ShareFS>   < 2 Then RMLoad RAM:$.ShareFS
If <Inet$$Internet>  = 2 Then RMReinit Internet
If <Inet$$Freeway>   = 2 Then RMReinit Freeway
If <Inet$$ShareFS>   = 2 Then RMReinit ShareFS

If <Inet$$Ether3>    = 1 Then RMLoad RAM:$.Ether3-16
If <Inet$$EtherH>    = 1 Then EtherHLoad
If <Inet$$EtherH>    = 2 Then EtherHLoad
If <Inet$$EtherB>    = 1 Then RMLoad RAM:$.EtherB
If <Inet$$EtherM>    = 1 Then RMLoad RAM:$.EtherM
If <Inet$$EtherO>    = 1 Then RMLoad RAM:$.EtherO
If <Inet$$EtherI>    = 1 Then RMLoad RAM:$.EtherI

If <Inet$$Ether3>    = 2 Then RMReInit Ether3
| If <Inet$$EtherH>    = 2 Then RMReInit EtherH
If <Inet$$EtherB>    = 2 Then RMReInit EtherB
If <Inet$$EtherM>    = 2 Then RMReInit EtherM
If <Inet$$EtherO>    = 2 Then RMReInit EtherO
If <Inet$$EtherI>    = 2 Then RMReInit EtherI

Run Resources:$.Resources.ShareFS.!Boot

|
| Now tidy up
|

Wipe RAM:$.* ~v~cf
RMKill RamFS
ChangeDynamicArea -RamFsSize 0

If Inet$$EtherH >= 1 Then Unset Alias$EtherHCopy 
If Inet$$EtherH >= 1 Then Unset Alias$EtherHLoad 
Unset Inet$$*
