Little Big LAN Internal API

NET0

This is a special filename which has many uses. Open it like any other file, do i/o to it like any other file.

Getting the System request interrupt

The Little Big LAN modules must communicate among themselves and with the outside world. A software interrupt is used. That interrupt is switchable to any desired, but the default is INT 14H. LBL can use any software interrupt. To change it use the SYSREQ parameter on the NET00000.SYS line in CONFIG.SYS.

EXAMPLE:

device=c:\lbl\net00000.sys #12 "Node12" sysreq:61h,1234h,D0h,D1h,D2h,D3h,D4h
This sets System request INT to 61H, ID=1234h, commands= D0..D4, node = 12, nodename = "Node 12"

DEFAULT is:
device=c:\lbl\net00000.sys #? "???" sysreq:14h,AB00h,C0h,C1h,C2h,C3h,C4h
It is not likely you will ever have to change anything but the interrupt itself, so it is perfectly legitimate to specify only that:

device=c:\lbl\net00000.sys #12 "Node12" sysreq:61h
This would change the interrupt to INT 61h but all other parameters would stay the same. Internally, these parameters are used as follows:

            INT 14h to communicate
            DX = an ID word of 0AB00H
            AH = C0, or C1, or C2, or C3, or C4

            (all shown as the default)
In order to use the API it is best to ask NET0 what software interrupt is being used. You could assume it's going to be INT 14H but many customers will have to change to a different one. For example, the DOS MODE command does funny things to INT 14H when it loads resident.

To read the interrupt, here is a ASM CODE EXAMPLE:

;........................... network interrupt vars ..........................

netint_vec db 14h

netint_id  dw 0AB00h

           db 5
netint_cmd db 0C0h
           db 0C1h
           db 0C2h
           db 0C3h
           db 0C4h

netint_fix equ $+1

netint:
  int 14h                  ;all local internal calls use this sub
  ret

netintc:
  mov dx,cs:netint_id
  jmp netint


;........................... setup ...........................................

net0name db "NET0",0
net0cmd1 db 1

get_sysreq:
  push cs
  pop ds
  mov dx,offset net0name     ;ds:dx--> device name of NET0
  mov ax,3D02h               ;open for read/write
  int 21h
  jnc get_srq2

get_srq1:
  stc                        ;if device not found, 
  ret                        ;return CY=1

get_srq2:
  mov bx,ax                  ;bx=handle

                             ;can't be in cooked mode !!!
  mov ax,4400h               ;get device info
  int 21h
  test dl,80h                ;is this a char device?
  jz get_srq1                ;yes:   no--> its a disk file
  or dl,20h                  ;binary mode
  xor dh,dh                  ;dos fails if dh<>0
  mov ax,4401h               ;set device info
  int 21h

  push cs
  pop ds
  mov dx,offset net0cmd1     ;command 1
  mov cx,1                   ;1 byte
  mov ah,40h                 ;write to device
  int 21h
  jc get_srq5                ;if error writing-->

  mov cx,9                   ;9 bytes
  push cs
  pop ds
  mov dx,offset netint_vec   ;put values here
  mov ah,3Fh                 ;read
  int 21h
  jc get_srq5                ;if error reading-->

  mov al,cs:netint_vec       ;fix INT XX code
  mov byte ptr cs:netint_fix,al ;this is interrupt to use

get_srq3:
  mov ah,3Eh                 ;close
  int 21h

get_srq4:
  call Trap_sysreq
  clc
  ret

get_srq5:
  mov ah,3Eh                 ;close file
  int 21h
  stc                        ;exit in error
  ret


;........................... Trap_sysreq ................................

                             ;do this only if you need to trap the vector
                             ;in a TSR or device driver.
Trap_sysreq:
  mov ah,35h
  mov al,cs:netint_vec       ;trap sysreq int  (int14)
  int 21h
  mov cs:oldSysreq,bx
  mov cs:oldSysreq+2,es
  mov dx,cs
  mov ds,dx
  mov dx,offset Sysreqint
  mov ah,25h
  mov al,cs:netint_vec
  int 21h
  ret

oldSysreq dw 0,0
;........................... Sysreq ....................................

Sysreq:
  cmp dx,cs:netint_id        ;make sure ID matches
  jne Sysreq_Cont
  cmp ah,cs:netint_cmd+0     ;test command
  je Sysreq_0
  cmp ah,cs:netint_cmd+1
  je Sysreq_1

  ;etc..

Sysreq_Cont:
  jmp dword ptr cs:oldSysreq  ;continue int call to next driver

Sysreq_0:
  ;do something
  jmp Sysreq_Cont

Sysreq_1:
  ;do something
  jmp Sysreq_Cont

Top of Programmer Stuff -or- Main Table of Contents -or- Top of Form