| !Boot file for IIDual Version 4.01 (03 Mar 2004)
| ================================================


Set Alias$RMIfThere SetEval Test$Eval 1|MRMEnsure %%1 0 SetEval Test$Eval 0|MIf Test$Eval THEN %%0 %%1|MUnset Test$Eval


| Set IIDual$Dir <Obey$Dir>
If "<IIDual$Dir>" = "" Then Set IIDual$Dir <Obey$Dir>


RMEnsure UtilityModule 3.10 Error The IIDual moduke requires RISC OS 3.10 or later

RMEnsure UtilityModule 5.00 RMEnsure CallASWI 0.03 RMLoad System:Modules.CallASWI
RMEnsure UtilityModule 5.00 RMEnsure CallASWI 0.03 Error The IIDual moduke requires CallASWI 0.03 or later

RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator
RMEnsure FPEmulator 4.03 Error The IIDual moduke requires FPEmulator 4.03 or later

RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib
RMEnsure SharedCLibrary 5.34 Error The IIDual moduke requires SharedCLibrary 5.34 or later


| Determine Computer Type
| =======================
| ARM2, ARM3 or RiscPC (ARM6 or ARM7)

Set Computer$Type RiscPC
RMEnsure UtilityModule 3.20 Set Computer$Type ARM3
If "<Computer$Type>" = "ARM3" Then RMEnsure ARM3Support 0.00 Set Computer$Type ARM2


| Kill IIRS423 Module
| ===================
| If present RMKill the original IIRS423 module before

RMIfThere RMKill IIRS423


| Load IIDual Module
| ==================
| RMLoad the new IIDual module

RMEnsure IIDual 4.01 RMLoad <Obey$Dir>.Modules.IIDual
RMEnsure IIDual 4.01 Error  You need IIDual 4.01 or later

BASIC -quit <IIDual$Dir>.BASIC.SetNoPorts

| Select Baud Rate Set
| ====================
| (not usually necessary to change this value)
| Default - 4. Only change the set to 2 if a baud rate of 230400 is required.
| There are 6 baud rate sets. Set 4 provides the same range of baud rates 
| (from 50 to 115200) as the Risc PC and A7000 computers. 
| IMPORTANT NOTE - the baud rate set selected is common to both ports of 
| each expansion card.

| Syntax IIDual_BaudRateSet <port> <set (0 - 5)>

| The following command selects for ports 1 AND 2 the baud rate set 4.

If <IIDual$NoPorts> > 1 Then IIDual_BaudRateSet 1 4



| Select Baud Rate
| ================
| (usually set subsequently by application software)
| Default - read from CMOS memory as one of 9600, 19200, 57600 or 115200. 
| For the default baud rate set 4 the following baud rates are available:-
| 9600, 75, 150, 300, 1200, 2400, 4800, 9600, 19200, 50, 110, 134.5, 600
| 1800, 3600, 7200, 38400, 57600, 115200.

| Syntax IIDual_Baud <port> <index (0 - 28) or baud rate (50 - 230400)>

| The following command selects for port 1 the receive and transmit baud 
| rate as 19200.

If <IIDual$NoPorts> > 1 Then IIDual_Baud 1 19200

| The following command selects for port 2 the receive and transmit baud 
| rate as 19200.

If <IIDual$NoPorts> > 2 Then IIDual_Baud 2 19200


| Select Data Format
| ==================
| (usually set subsequently by application software)
| Default - read from CMOS memory as one of 4, 5, 6 or 7
| as detailed below.
| The following data formats are available:- 
|
| <n> Word Length   Parity   Stop
|        bits                bits
|  0     7           even     2
|  1     7           odd      2
|  2     7           even     1
|  3     7           odd      1
|  4     8           none     2
|  5     8           none     1
|  6     8           even     1
|  7     8           odd      1
|  8     7           none     2
|  9     7           none     1

| Syntax IIDual_Data <port> <data format (0 - 9)>

| The following commands selects for port 1 a data format
| of 8 bits, no parity, 1 stop bits
 
If <IIDual$NoPorts> > 1 Then IIDual_Data 1 5

| The following commands selects for port 2 a data format
| of 8 bits, no parity, 1 stop bits
 
If <IIDual$NoPorts> > 2 Then IIDual_Data 2 5



| Set Input Buffer Size
| =====================
| (set this value)
| Default - 1024 bytes

| Syntax IIDual_InBuf <port> <size (bytes))>

| If it is uncommented
| The following command sets for port 0 the input buffer size to 16 Kbyte.
| 16 Kbyte is normally satisfactory for Internet access.

| If <IIDual$NoPorts> > 0 Then IIDual_InBuf 0 16384

| The following command sets for port 1 the input buffer size to 16 Kbyte.
| 16 Kbyte is normally satisfactory for Internet access.

If <IIDual$NoPorts> > 1 Then IIDual_InBuf 1 16384

| The following command sets for port 2 the input buffer size to 16 Kbyte.
| 16 Kbyte is normally satisfactory for Internet access.

If <IIDual$NoPorts> > 2 Then IIDual_InBuf 2 16384



| Set Output Buffer Size 
| ======================
| (set this value)
| Default - 1024 byte

| Syntax IIDual_OutBuf <port> <size (bytes)>

| If it is uncommented
| The following command sets for port 0 the output buffer size to 16 Kbyte.
| 16 Kbyte is normally satisfactory for Internet access.

| If <IIDual$NoPorts> > 0 Then IIDual_OutBuf 0 16384

| The following command sets for port 1 the output buffer size to 16 Kbyte.
| 16 Kbyte is normally satisfactory for Internet access.

If <IIDual$NoPorts> > 1 Then IIDual_OutBuf 1 16384

| The following command sets for port 2 the output buffer size to 16 Kbyte.
| 16 Kbyte is normally satisfactory for Internet access.

If <IIDual$NoPorts> > 2 Then IIDual_OutBuf 2 16384



| Set Input Buffer Minimum Space
| ==============================
| (not usually necessary to change this value)
| Default - 32 bytes.
| If hardware handshaking is in operation the default value of 32 bytes
| is normally satisfactory. If software (Xon/Xoff) handshaking is in
| operation then it may be necessary to increase the value to 128 bytes.

| Syntax IIDual_InBufMinSpace <port> <space (bytes)>

| If it is uncommented
| The following commands sets for port 0 the input buffer minimum space 
| to 32 bytes.

| If <IIDual$NoPorts> > 0 Then IIDual_InBufMinSpace 0 32

| The following commands sets for port 1 the input buffer minimum space 
| to 32 bytes.

If <IIDual$NoPorts> > 1 Then IIDual_InBufMinSpace 1 32

| The following commands sets for port 2 the input buffer minimum space 
| to 32 bytes.

If <IIDual$NoPorts> > 2 Then IIDual_InBufMinSpace 2 32



| Set Input Buffer Hysteresis
| ===========================
| (not usually necessary to change this value)
| Default - 32 bytes.
| The input buffer hysteresis is the difference between the input buffer
| minimum space (at which input is halted) and the input buffer space at
| which input is resumed.
 
| Syntax IIDual_InBufHysteresis <port> <space (bytes)>

| The following command sets for port 1 the input buffer hysteresis
| to 64 bytes.

If <IIDual$NoPorts> > 1 Then IIDual_InBufHysteresis 1 64

| The following command sets for port 2 the input buffer hysteresis
| to 64 bytes.

If <IIDual$NoPorts> > 2 Then IIDual_InBufHysteresis 2 64



| Select Handshaking Method
| =========================
| (usually set subsequently by application software)
| Default - 1 (hardware handshake).
| The following handshaking methods are available:-
|
|  0     None
|  1     Hardware handshaking using DSR, CTS and RTS (default)
|  2     Software (Xon/Xoff) handshaking (ignoring DSR and CTS)
|  3     Both hardware and software (Xon/Xoff) handshaking
|        using DSR and CTS
|  Acorn Cable Wiring
|  4     None
|  5     Hardware handshaking using DSR (ignoring CTS) and RTS
|  6     Software (Xon/Xoff) handshaking (ignoring DSR and CTS)
|  7     Both hardware and software (Xon/Xoff) handshaking
|        using DSR (ignoring CTS)
|  PC Cable Wiring
|  8     None
|  9     Hardware handshaking using CTS (ignoring DSR) and RTS
| 10     Software (Xon/Xoff) handshaking (ignoring DSR and CTS)
| 11     Both hardware and software (Xon/Xoff) handshaking
|        using CTS (ignoring DSR)

| Syntax IIDual_HandShake <port> <method (0 - 11 hardware = 1 Xon/Xoff = 2)>

| The following command selects for port 1 Hardware handshaking using DSR
| and CTS 

If <IIDual$NoPorts> > 1 Then IIDual_HandShake 1 9

| The following command selects for port 1 Hardware handshaking using DSR
| and CTS

If <IIDual$NoPorts> > 2 Then IIDual_HandShake 2 9



| Set Private Input Buffer Entries at which Input is Halted
| =========================================================  
| (This value is set automatically for the Computer in use)
| Default - 4 bytes.
| As bytes are received the interrupt routine inserts them in a private
| buffer. Later the interrupt routine removes them from the private buffer
| and inserts them into the main input buffer. If bytes are received at a
| greater rate than they can be inserted in the main input buffer input is
| halted at the set number of entries. Input is resumed when the private
| input buffer is empty.
| The recommended values are as follows:-
|
| Computer                Value
| ARM2                      4
| ARM3                      8
| RiscPC (ARM6 OR ARM7)    12

| Syntax IIDual_Options <port> 11 <private input buffer entries
| at which RTS is set (bytes)>

| The following command sets for port 1 the private input buffer entries
| at which input is halted (option 11)

If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "ARM2"   Then IIDual_Options 1 11  4
If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "ARM3"   Then IIDual_Options 1 11  8
If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "RiscPC" Then IIDual_Options 1 11 12

| The following command sets for port 2 the private input buffer entries
| at which input is halted (option 11)

If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "ARM2"   Then IIDual_Options 2 11  4
If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "ARM3"   Then IIDual_Options 2 11  8
If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "RiscPC" Then IIDual_Options 2 11 12


| Set Maxiumum Number of Bytes to be Output per Transmit Interrupt  
| ================================================================
| (This value is set automatically for the Computer in use)
| Default - 8 bytes (maximum).
| When a transmit interrupt occurs the interrupt routine checks to
| determine whether output is halted and, if it is not, fills the transmit
| FIFO of the UART up to the set maximum. These bytes are then transmitted
| by the UART which does not determine whether output has been halted. If
| transmitted bytes are lost the set maximum should be reduced (minimum 1).

| Computer                Value
| ARM2                      2
| ARM3                      4
| RiscPC (ARM6 OR ARM7)     6

| Syntax IIDual_Options <port> 13 <maximum number of bytes to be output
| per transmit interrupt (1 - 8)>

| The following command sets for port 1 the maximum number of bytes to be
| output per transmit interrupt (option 13).

If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "ARM2"   Then IIDual_Options 1 13  2
If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "ARM3"   Then IIDual_Options 1 13  4
If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "RiscPC" Then IIDual_Options 1 13  6

| The following command sets for port 2 the maximum number of bytes to be
| output per transmit interrupt (option 13) to 8 bytes.

If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "ARM2"   Then IIDual_Options 2 13  2
If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "ARM3"   Then IIDual_Options 2 13  4
If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "RiscPC" Then IIDual_Options 2 13  6



| Set Buffer Insert/Remove Mode
| =============================
| (This value is set automatically for the Computer in use)
| Default - 0 indirect routine ie insV, remV and cnpV used

| Mode        Description

| 0           RISC OS indirect routines ie insV, remV and cnpV used
|             (the same way as the device driver for the internal port)
| 1           RISC OS direct buffer manager service routines used
|             (for faster operation on ARM6 and ARM7 computers
|             only possible with RISC OS 3.5 or later) 
| 2           IIDual module direct routines used
|             (not RISC OS DeviceFS device driver compatible
|             for faster operationon ARM2 and ARM3 computers)

| Syntax IIDual_Options <port> 9 <buffer insert/remove mode (0 - 2)>

| The following command sets for port 1 the buffer insert/remove mode
| (option 9) to 0 RISC OS indirect routines ie insV, remV and cnpV used.

If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "ARM2"   Then IIDual_Options 1 9 2
If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "ARM3"   Then IIDual_Options 1 9 2
If <IIDual$NoPorts> > 1 Then If "<Computer$Type>" = "RiscPC" Then IIDual_Options 1 9 2

| The following command sets for port 2 the buffer insert/remove mode
| (option 9) to 0 RISC OS indirect routines ie insV, remV and cnpV used.

If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "ARM2"   Then IIDual_Options 2 9 2
If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "ARM3"   Then IIDual_Options 2 9 2
If <IIDual$NoPorts> > 2 Then If "<Computer$Type>" = "RiscPC" Then IIDual_Options 2 9 2

Unset IIDual$NoPorts
Unset Computer$Type
Unset Alias$RMIfThere
