home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
HAM
/
BPQ407A.ZIP
/
BPQHOST.DOC
< prev
next >
Wrap
Text File
|
1992-09-05
|
10KB
|
386 lines
G8BPQ Host Mode
From Version 4.00, a new application interface to the switch is provided.
This replaces the existing interfaces (TNC2, PK Host and KISS). New
software should if possible use the new interface - interface routines
supporting the old modes, and WA8DED Host mode, will be provided as TSRs
to support existing application software.
The interface is normally called using INT 7Fh. From version 4.03 the interrupt
number may be changed - The value is specified in BPQCFG.TXT as INTERRUPT=nnn,
where nnn is in decimal. The function required is in AH, and the stream in AL.
The system supports 64 streams, or sessions, numbered from 1 - 64.
Changes in Version 4.05.
1. Additional option on funtion 6 - allows connects using BBS Call, even
if APPLMASK is not set (say to prevent connects).
2. Additional info returned by function 8.
3. Format of frame returned by function 11 added to documentation.
4. Function 15 added. Simplifies access to timing info.
5. Broadcast option added. If function 2 is called with AL=0, the
data will be sent as a UI frame to all ports which have an UNPROTO
address set.
6. Function 12 added to update Beacon text.
Commands supported are:
Note that in all cases where a string is returned, ES:DI must point to
a buffer supplied by the user, and the switch will copy the data to
this buffer. The code does NOT return pointers to its own data.
AH = 1 Set application mask to value in DL.
Set application flags to value in CL.
If top bit of CL is set, monitored frames will be available.
Use function 11 to receive them.
AH = 2 Send frame in ES:SI (length CX)
AH = 3 Receive frame into buffer at ES:DI, length of frame returned
in CX. BX returns the number of outstanding frames still to
be received (ie. after this one) or zero if no more frames
(ie. this is last one).
Note that CX is NOT an input param - the supplied buffer
must be big enough to receive a full AX.25 frame, including
up to 8 digi callsigns. 340 should be enough.
AH = 4 Get stream status. Returns:
CX = 0 if stream disconnected or CX = 1 if stream connected
DX = 0 if no change of state, or DX = 1 if
the connected/disconnected state has changed.
AH = 5 ACK stream status change. Must be called to allow another
status change to be reported.
AH = 6 Session control.
CX = 0 Connect to Node. Session uses BBS callsign if bottom
bit of DL=1, otherwise uses Node Call .
CX = 1 Connect to Node. Session uses BBS Call if APPLMASK=1,
otherwise Node Call.
CX = 2 Disconnect
CX = 3 Return user to node
AH = 7 Get buffer counts for stream. Returns:
BX = number of frames queued for receive
CX = number of un-acked frames to be sent
DX = number of buffers left in node
AH = 8 Port control/information. Called with a stream number
in AL returns:
ES:DI = CALLSIGN (10 bytes space padded)
The following are now supported (4.05 onwards)
AL = Radio port on which channel is connected (if level 2)
AH = Session Type (If Connected). Session type bits are:
L2LINK EQU 1
SESSION EQU 10B
UPLINK EQU 100B
DOWNLINK EQU 1000B
BPQHOST EQU 100000B
BX = L2 paclen for the session
CX = Maxframe. Taken from PORT maxframe if L2 session,
Switch maxframe if L4.
DX = L4 window size (if L4 circuit, or zero)
AH = 10 RAW (KISS) transmit frame. Data pointed to by ES:SI, of
length CX, is transmitted as a HDLC frame on the radio
port (not stream) in AL.
AH = 11 Get Trace (RAW Data) Frame into ES:DI, Length to CX. Data
is as received off air (ie with calls in AX.25 format, etc)
See note on CX under function 3.
The returned buffer includes a 5 byte header:
Bytes 0-1 - Internal control info (ignore)
Byte 2 - Port number. Top bit set if transmitted frame.
Bytes 3-4 - Frame length (including this header)
AH = 12 Update Switch Info. This will be used for a number of
operations. At the moment the only one implemented is to
update the Beacon Text field.
DX = Function Number.
DX = 1 Update Beacon Text.
ES:SI Data to send in Beacons
CX Length of Data
AH = 15 Get time marker in AX. Value is number of timer interrupts
since switch was loaded, modulo 65536. Timer interrupts
normally occur at approx 18.2 per second.
The following additions have been proposed. Similar functions may
be provided, but not necessarily in this format.
AH = 0 Get node/switch version number and description. On return
AH = major version number and AL = minor version number,
and user's buffer pointed to by ES:SI is set to the text
string normally output by the USERS command. CX is set to the
length of the text string.
AH = 9 Fetch node/application callsign & alias or application names
AL = application
BL = 0 to get Callsign, 1 to get Application Name
number:
0 = node
1 = BBS
2 = HOST
3 = SYSOP etc. etc.
Returns string with alias & callsign or application name in
user's buffer pointed to by ES:SI length CX. For example:
"WORCS:G8TIC" or "TICPMS:G8TIC-10".
PACLEN.
Frames are transmitted as received from the application, so the application
is responsible for the transmitted PACLEN. Function 8 will return the
recommended value for the current session. I think the value is always OK,
but I suggest you treat a value of zero as 'undefined', and use your own
default. The value may change during a session, if for instance, you connect
to the switch, and then out on a port with a different PACLEN. Also at
some time in the future I hope to adjust PACLEN to suit conditions on the
channel. So I recommend that the value is re-read from time to time during
a session.
The following sample of code shows how to find the Interrupt Number to use
to call the switch, and check that the switch is loaded.
NOTBPQERROR DB 'Switch not found$'
VERSERROR DB 'Version not compatible with Node Software$'
G8BPQ DB 'G8BPQ'
BADCONFIGMSG DB 'Configuration file read error',0DH,0AH,'$'
CONFIGFILENAME DB 'BPQCFG.BIN',0
NOCONFIGMSG DB 'Configuration file BPQCFG.BIN not found',0DH,0AH,'$'
;
; BPQCFG FIRST 128 BYTES
;
CONFIGTABLE LABEL BYTE
;
; CONFIGURATION DATA STRUCTURE
;
; DEFINES LAYOUT OF CONFIG RECORD PRODUCED BY CONFIGURATION PROG
;
; LAYOUT MUST MATCH THAT IN CONFIG.C SOURCE
;
C_NODECALL DB 10 DUP (0) ; OFFSET = 0
C_NODEALIAS DB 10 DUP (0) ; OFFSET = 10
C_BBSCALL DB 10 DUP (0) ; OFFSET = 20
C_BBSALIAS DB 10 DUP (0) ; OFFSET = 30
;
C_OBSINIT DW 0 ; OFFSET = 40
C_OBSMIN DW 0 ; OFFSET = 42
C_NODESINTERVAL DW 0 ; OFFSET = 44
C_L3TIMETOLIVE DW 0 ; OFFSET = 46
C_L4RETRIES DW 0 ; OFFSET = 48
C_L4TIMEOUT DW 0 ; OFFSET = 50
C_BUFFERS DW 0 ; OFFSET = 52
C_PACLEN DW 0 ; OFFSET = 54
C_TRANSDELAY DW 0 ; OFFSET = 56
C_T3 DW 0 ; OFFSET = 58
DW 0 ; OFFSET = 60
DW 0 ; OFFSET = 62
C_IDLETIME DW 0 ; OFFSET = 64
C_EMSFLAG DB 0 ; OFFSET = 66
DB 0
C_BBS DB 0 ; OFFSET = 68
C_NODE DB 0 ; OFFSET = 69
C_HOSTINTERRUPT DB 0 ; OFFSET = 70
C_DESQVIEW DB 0 ; OFFSET = 71
C_MAXLINKS DW 0 ; OFFSET = 72
C_MAXDESTS DW 0
C_MAXNEIGHBOURS DW 0
C_MAXCIRCUITS DW 0 ; 78
C_TNCPORTLISTO DB 16 DUP (0) ; OFFSET = 80
C_IDINTERVAL DW 0 ; 96
C_XXXXXXXX DW 0 ; 98 ; SPARE (WAS DIGIFLAG)
C_MINQUAL DW 0 ; 100
C_HIDENODES DB 0 ; 102
C_L4DELAY DW 0 ; 103
C_L4WINDOW DW 0 ; 105
C_BTINTERVAL DW 0 ; 106
X_UNPROTO DB 9 DUP (0) ; 108 ; NOW SPARE
C_BBSQUAL DW 0 ; 117
DB (CONFIGTABLE+128-$) DUP (0)
CONFIGHANDLE DW 0
NODE:
INT 7FH
RET
INIT:
;
; GET NODE INTERRUPT NUMBER FROM CONFIG FILE
;
MOV DX,OFFSET CONFIGFILENAME
MOV AH,3DH
MOV AL,0 ; READ ONLY
INT 21H ; OPEN IT
JC NOCONFIGFILE
MOV CONFIGHANDLE,AX
MOV BX,AX
MOV DX,OFFSET CONFIGTABLE
MOV CX,128
MOV AH,3FH
INT 21H ; READ
CMP AX,CX
JNE SHORTCONFIG
JMP SHORT PROCESSCONFIG
NOCONFIGFILE:
MOV DX,OFFSET NOCONFIGMSG
JMP SHORT CONFIGERR
SHORTCONFIG:
MOV DX,OFFSET BADCONFIGMSG
CONFIGERR:
MOV AH,9
INT 21H
MOV AX,4C01H
INT 21H ; EXIT
PROCESSCONFIG:
MOV BX,CONFIGHANDLE
MOV AH,3EH
INT 21H ; CLOSE IT
MOV AL,C_HOSTINTERRUPT ; INTERRUPT
MOV BYTE PTR NODE+1,AL ; PATCH NODE CALL INSTRUCTION
;
; GET NODE VERSION
;
PUSH DS
MOV AH,0
ADD AX,AX ; VECTORS ARE 4 BYTES LONG
ADD AX,AX
MOV SI,AX
XOR AX,AX
MOV DS,AX
LDS SI,DS:[SI] ; GET POINTER TO HOST SUPPORT CODE
SUB SI,7
MOV DI,OFFSET G8BPQ
MOV CX,5
REP CMPSB ; MAKE SURE SWITCH IS LOADED
JE SWITCHOK
POP DS
MOV DX,OFFSET NOTBPQERROR
MOV AH,9
INT 21H
JMP SHORT EXIT
SWITCHOK:
CMP BYTE PTR DS:[SI],MAJORVERSION
JNE BADVERSION
CMP BYTE PTR DS:1[SI],MINORVERSION
JE VERSIONOK
BADVERSION:
POP DS
MOV DX,OFFSET VERSERROR
MOV AH,9
INT 21H
EXIT:
MOV AX,4C00H
INT 21H
BADPORTVAL:
MOV AH,9
MOV DX,OFFSET ERRORMSG
INT 21H
RET
VERSIONOK:
POP DS
;
..........
The release disk also contains a demonstration terminal program, TERM4,
written by G8IMB (in PASCAL) to demonstate the use of the new interface from
a high level language. Note, however, that it was written for version 4.02,
and therefore only works with the Host Mode interrupt configred at 7Fh
John Wiseman, G8BPQ @ GB7BAD
20/12/91
Revised 5/9/92