'===========================================================================
' Subject: IRQ # OF TCP/IP DRIVER PACKET      Date: 05-29-96 (16:15)       
'  Author: Carl Gorringe                      Code: QB, QBasic, PDS        
'  Origin: FidoNet QUIK_BAS Echo            Packet: MODEM.ABC
'===========================================================================
'>I've been working on a program a game that can be played across a modem lin
'>and alot of my freinds seem to like it and have ased that I try to make in
'>work on a IPX network using ethiernet card. The code to make it three playe
'>would be easy to do, but I haven't a clue how to send packets throught a
'>network. Does anyone know any books, liberies, source code, that deals with
'>programs working across networks ?

'Isn't IPX in some ways similar to the TCP/IP Internet protocal?
'Well, I wish I could help with some code to send packets of data, but
'I haven't gotten around to figuring it out yet. What I DO have is some
'code to detect which IRQ number a Packet Driver is loaded on. (A Packet
'Driver is a TSR which helps in sending packets of data over networks.)
'Maybe you can find a use for it!

'-------------------------------
'          TCP1.BAS
'-------------------------------
'  (c) Carl Gorringe 1/14/96
' Released to the PUBLIC DOMAIN

' This is used to detect a PC/TCP Packet Driver

DECLARE FUNCTION TCP.GetIRQ% ()
'------------------------------------------------------------
CLS
Num% = TCP.GetIRQ%

PRINT
PRINT
PRINT "IRQ ="; Num%; " ("; HEX$(Num%); " hex)"

END

FUNCTION TCP.GetIRQ%

' (c) Carl Gorringe 1/14/96 << v1.0 >>
'--------------------------------------
'  Returns the IRQ number that the
'   TCP/IP packet driver resides.
'  Returns 0 if driver not loaded.
'--------------------------------------
'<< Done - Tested OK >>

RetNum% = 0
FOR IRQ% = &H60 TO &H80

   VectorOff% = IRQ% * 4  '<-- Point to IRQ # in Interupt Vector Table

   DEF SEG = 0
      CodeSeg& = PEEK(VectorOff% + 3) * 256& + PEEK(VectorOff% + 2)
      CodeOff& = PEEK(VectorOff% + 1) * 256& + PEEK(VectorOff% + 0)

   DEF SEG = CodeSeg&
      Char1% = PEEK(CodeOff& + 3)
      Char2% = PEEK(CodeOff& + 4)
      Char3% = PEEK(CodeOff& + 5)
      Char4% = PEEK(CodeOff& + 6)
      Char5% = PEEK(CodeOff& + 7)
      Char6% = PEEK(CodeOff& + 8)
      Char7% = PEEK(CodeOff& + 9)
      Char8% = PEEK(CodeOff& + 10)
      Char9% = PEEK(CodeOff& + 11)

   DEF SEG

   ProgID$ = CHR$(Char1%) + CHR$(Char2%) + CHR$(Char3%)
   ProgID$ = ProgID$ + CHR$(Char4%) + CHR$(Char5%) + CHR$(Char6%)
   ProgID$ = ProgID$ + CHR$(Char7%) + CHR$(Char8%)

   'PRINT ProgID$        '*** Test ***

   IF ProgID$ = "PKT DRVR" AND Char9% = 0 THEN
      RetNum% = IRQ%
      EXIT FOR
   END IF

NEXT IRQ%

TCP.GetIRQ% = RetNum%

END FUNCTION
