home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
misc
/
bpq403a
/
bpqhost.doc
< prev
next >
Wrap
Text File
|
1991-03-08
|
7KB
|
316 lines
G8BPQ Host Mode
From Version 4.00, a new application interface to the switch will be provided.
This will replace 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.
;
;
; 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).
;
;
;
; 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 = 1 connect to node
; 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 not supported by the current version,
; but I expect to add them soon.
;
; AX = Radio port on which channel is connected (if level 2)
; BX = L2 paclen for the session
; CX = L2 maxframe for the radio port (if level 2 session)
; 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)
;
;
; 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".
;
;
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/2/91