home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware 1 2 the Maxx
/
sw_1.zip
/
sw_1
/
LAN
/
PCRTE223.ZIP
/
compile.doc
< prev
next >
Wrap
Text File
|
1992-01-17
|
14KB
|
265 lines
Compiling New PCroute code
The PCroute distribution comes with a compiled PCROUTE.EXE file that is
configured for two Ethernet (WD8003E) interfaces. If you want a different
interface configuration (say three ethernets, or an ethernet and a localtalk)
you will need to make some small changes to the source code and recompile
it. This document describes how to do this.
WHAT YOU WILL NEED.
The original source code was written using TURBO ASSEMBLER 1.0. I have
made no attempt to check if the code will assemble with other assemblers,
but you are welcome to try. Here I will assume that you have the TASM and
TLINK utilities that come with TURBO ASSEMBLER. In addition, the
compilation needs a FULL 640K of memory in order to compile. Thus you
need a PC with at least this much memory and you will probably have to
remove any TSR programs so that TURBO ASSEMBLER has as much space as possible.
CONFIGURING PCroute.
In order to change the interface configuration of PCroute it is only
necessary to change one file, DECLARE.INC. This file contains a description
of each card in the router and it is this description that needs to be changed.
------------------------------------------------------------------------------
Western Digital Ethernet Cards: for every WD card there are lines like
; this is a wd8013EBT entry
WDE_DECLARE %cur_dl, 280H, 0D000H, 0,0,64,1 ;;<name>, <I/O>, <seg>, <off>
; ; this is a wd8003EBT entry
; WDE_DECLARE %cur_dl, 280H, 0D000H, 0,0,128,0 ;;<name>, <I/O>, <seg>, <off>
; ; this is a wd8003E entry
; WDE_DECLARE %cur_dl, 280H, 0D000H, 0,0,32,0 ;;<name>, <I/O>, <seg>, <off>
; ; this is a starlan entry
; WD_DECLARE %cur_dl, 2A0H, 0D000H, 0,10,16 ;;<name>, <I/O>, <seg>, <off>
IF_DECLARE %cur_dl, %cur_dl, WDE ;; <if name>, <real if>, <prefix>
ETH_DECLARE %cur_dl, %cur_dl, %cur_dl ;; <eth name>, <if>, <task>
ARP_DECLARE %cur_dl, %cur_dl ;; <arp name>, <ether>
DL_IP_DECLARE %cur_dl, %cur_dl, ARP ;; <dlip name>, <real dlip> <prefix>
cur_dl = cur_dl + 1
This particular declaration is for a WD8013 card. The first
line declares that this card will be called 'cur_dl' and that
the card has its I/O address set to 280H, and its shared memory
address to D000:0000 (seg:offset). The fifth parameter (0) is a
flag that indicates that we DON'T want promiscuous mode (where
the card returns every packet off the network. The 6th parameter
tells how many 256byte pages of shared memory the card has, and the
final number is a flag that indicates if the card is a 16 bit card.
The next two WDE_DECLARES are commented out. These correspond to
the correct parameters for a WD8003EBT and WD8003E card. Simply
comment out the first declaration and comment in the correct one
to change the type of card PCroute will expect.
Note that for starlan cards a significant change was made. Since
starlan cards are much slower than ethernet, starlan cards allocate
much of their memory to a write queue (instead of the input queue).
These changes are significant enough that different code is used
(not just different parameters). That is why WD_DECLARE (instead
of WDE_DECLARE) is called. The first four parameters to WD_DECLARE
are the same as WDE_DECLARE and the last two should probably always
be 10 and 16 (see WD8003.INC for details). The bottom line, however
is the same if you want to compile for a starlan card, simply comment
in this declaration.
The rest of the declarations describe how this card is interacts
with the rest to PCroute software.
In particular
1) IF_DECLARE declares that the WDE card is an ethernet card
2) ETH_DECLARE declares that this IF will use ethernet addressing
(as opposed to say 802.3 addressing)
3) ARP_DECLARE declares that the ARP protocol is to be used to
map ethernet addresses to IP addresses
4) DL_IP declares that the card is to be used by a an IP code
By and large these details are only of concern to a PCrouter programmer.
The only thing you need to know for configuration is that if you
are not using WD cards at all, all of these lines need to be
commented out.
In addition to choosing the type of card, the first two parameters
determine the I/O address and shared memory segment for the card.
These numbers are arbitrary, but they must not conflict with any
other hardware. The example declarations in DECLARE.INC use values
that I have found to work well. You may have to change them however,
if you have unusual hardware.
-------------------------------------------------------------------------
Packet Driver: For every card using the packet driver there is an entry
PKT_DECLARE %cur_dl, 60H, 01 ;; <name>, <Int Num> <Class (Eth=1)>
IF_DECLARE %cur_dl, %cur_dl, PKT ;; <if name>, <real if>, <prefix>
ETH_DECLARE %cur_dl, %cur_dl, %cur_dl ;; <eth name>, <if>, <task>
ARP_DECLARE %cur_dl, %cur_dl ;; <arp name>, <ether>
DL_IP_DECLARE %cur_dl, %cur_dl, ARP ;; <dlip name>, <real dlip> <prefix>
cur_dl = cur_dl + 1
Like the WD case, only the first line in 'interesting'. It simply
declares that it is an IF interface called 'cur_dl', that it should
communicate with the packet driver through software interrupt 60H,
and that the card has packet driver class 1.
Really only the second parameter is interesting. When you load a
packet driver you also specify which software interrupt it will use.
This number should be the same as the one declared to PCroute here.
If you are using multiple cards using packet drivers, simply load
the packet drivers at different software interrupts (60H, 61H, ...)
and have several declarations like the one above (differing only
in the second arg of the PKT_DECLARE line).
-------------------------------------------------------------------------
Localtalk: For every localtalk entry there lines of the form
ATP_DECLARE %cur_dl, 60H, %cur_dl, 10, 2000H;; <name> <int> <task> <wqueue>
DL_IP_DECLARE %cur_dl, %cur_dl, ATP ;; <dlip name>, <real dlip> <prefix>
cur_dl = cur_dl + 1
The ATP_DECLARE declares that this card will be called 'cur_dl' and
that it can access the Appletalk software driver that comes with
the card though interrupt 60H. (this is the correct number for Apple's
version of the localtalk driver). The next parameter is the task
number needed by ATP and should ALWAYS be %cur_dl. The next two
parameters is the number of entries in the write queue (in this case 10)
and the total space to allocate to the write queue (in this case 2000H
bytes). These are tunable, but in general should not be changed.
Also, if the line 'include atalk.inc' has been commented out, you
should comment it back in and comment out code for some other interface
you are not using (wd8003.inc for starlan, slip.inc for slip)
At present, only ONE such localtalk entry is allowed. The reason is
the appletalk driver that comes with the card can only support one
card. It should be possible to install two cards (with different
I/O addresses), and install two drivers at different interrupts and
thus allow two localtalk cards. I have tried this quickly to see
if it worked, and was unsuccessful, so for now, we only support one
localtalk card. (:-(
-------------------------------------------------------------------------
Slip: For every Slip entry there are lines of the form
I8250_DECLARE %cur_dl, SLIP, %cur_dl, IBM_COM1_PORT, IBM_COM1_IRQ, 0
tmp = cur_dl*100 ;; generate temp names
BUFF_DECLARE %(tmp+1), 3200 ;; the read buffer
QUEUE_DECLARE %(tmp+2), 5, %(size qif_entry) ;; the read queue
BUFF_DECLARE %(tmp+3), 10240 ;; the write buffer
QUEUE_DECLARE %(tmp+4), 16, %(size qif_entry) ;; the write queue
SLIP_DECLARE %cur_dl,%cur_dl,%(tmp+1),%(tmp+2),%(tmp+3),%(tmp+4)
Q_IF_DECLARE %cur_dl,%(tmp+1),%(tmp+2),%(tmp+3),%(tmp+4),SLIP,%cur_dl
IF_DECLARE %cur_dl, %cur_dl, Q
PP_DECLARE %cur_dl, %cur_dl, %cur_dl
DL_IP_DECLARE %cur_dl, %cur_dl, PP ;; <dlip name>, <real dlip> <prefix>
cur_dl = cur_dl + 1
This declaration looks pretty daunting. Luckily, only the first
line is of interest to us, and on that line only the 5th-7th
parameters are interesting. These parameters are the I/O address
of the COM port, the IRQ interrupt line for the port, and a flag
that will turn on CTS-RTS hardware flow control. As you can
see from this example, the I/O port and IRQ number for the 'standard'
ports COM1 and COM2 have been given symbolic names. Note that
COM3 and COM4 do NOT have a standard IRQ, so no symbolic names were
given for these.
Note that you should make sure that no other hardware conflicts
with the IRQs used by the com ports. In particular, WD cards have
use a default IRQ of 3, which is the same as that used by COM2.
Even though we don't use the WD interrupts, the fact that they are set
on the card will cause a conflict. In addition every COM port
needs its own IRQ line. Thus to use more that 2 serial ports you
must have COM cards that allow you to set to IRQs other than 4
and 3 (the IRQs for com1 and com2).
If you are following my good advice and are using a card with
a 16550AF chip in it for your COM board, you follow the same
instructions as above. The I8250 code automatically determines
that it is a 16550 and turns on the FIFOs.
On a IBM XT, IRQ 2,3,4,(and 5 if you don't have a hard drive controller)
are usually available.
On a IBM AT, IRQ 3,4,5,10,11,12,(and 13 if you don't have a coprocessor)
are usually available.
Note that you CAN set all the WD cards to the SAME irq so you don't
waist more than one. You may also be able to simply leave the IRQ
jumper off completely. This may disable the IRQ lines so that they
will not conflict with anything. I have not tried this, however,
so I simply don't know for sure that it will work.
=============================================================================
The basic procedure now is to edit DECLARE.INC to make sure that it has
all the proper declarations for the cards you want to use. I have made
this easy by including declarations for many common card configurations
and commenting out all but the ones pertaining to the two ethernet card
router. So under almost all situations all you need to do is uncomment
the proper declarations.
Due to limitations in turbo assembler, the amount of actual code given
to the assembler must be kept to a minimum. To achieve this, at the top
of DECLARE.INC are a bunch of 'include' statements and any code that
is not necessary is excluded by simply commenting out the proper line.
Now, if you have changed, configurations, it is possible that you will
also have comment in some include stmts and comment out others. Basically
you should comment out all files that have 'hardware like' names of
hardware you are not using. Which ones are necessary should and which
ones are not should be obvious.
If you comment out too much, the compilation will abort saying that
something is undefined. If you leave in too much, you are likely to
get a 'macro expansion size exceeded' or 'out of string space' message.
Once you have edited DECLARE.INC, the rest is easy. Simply type
tasm /ks170 *.asm
tlink pcroute ip rip log dlog ether atalk wd8003 wde8003 pp packet
ip_dl1 ip_dl2 ip_dl3 ip_dl4 ip_dl5 ip_dl6
(that is link all the object files create with the tasm command, the
file link.bat should contain this command and will save you some typing)
This will create a pcroute.exe file. You can then copy this file
to where config.exe lives and configure the router by following the
in instructions in the installation document.
The most common problem with the assembly procedure is the error message
'out of string space' or 'maximum macro expansion size exceeded'. These
error messages occur when TURBO ASSEMBLER runs out of memory. Be sure
you have a full 640K of memory and no TSR programs running if you get
this message. If this does not fix the problem, and you modified DECLARE.INC
it is possible that you are compiling a configuration that is simply too
large for TURBO ASSEMBLER to handle.
=============================================================================
Debugging:
For those of you that are modifying the code and wish to print out
debugging statements this is possible. The file DEBUG.INC contains
routines for doing just that. The main routines are PRINT, PRINT_REG
and DUMP_in_SI_CX. PRINT simply prints a string. PRINT_REG prints
a string and the contents of any 16 bit register (in hex). DUMP_in_SI_CX
prints CX memory locations starting at SI using the named segment
register. All of these routines modify NO registers so they can be
used anywhere (except between a cmp and its jump instr).
Here is an example of how these macro look when they are called
print <Starting program>
print_reg <SI = >, SI
print_reg <CX = >, CX
print <Dumping at SI for CX bytes>
dump_in_SI_CX DS