Author Topic: System stalls on string detection  (Read 16442 times)

Offline mik3ca

  • Jr. Member
  • *
  • Posts: 30
System stalls on string detection
« on: February 02, 2021, 01:04:18 AM »
For the life of me I can't figure out why this code crashes in one particular circumstance and not other cases.

For the one case where it does crash, the only way out is to shut the computer off and turn it back on for a full reboot. the target computer is a Dell Wyse with 800Mhz processor running MS-DOS.

In all startup cases on the said computer, these modules are preloaded in addition to the standard DOS 6.22 environment:

HIMEM memory manager,
FETPKT (packet driver for network card),
NTCPDRV (trumpet sockets driver).

MEM utility reports this information:

Free Conventional memory: 509 KB
Free Extended memory: about 66 MB (despite the system having way more)

Here are the steps I took to reproduce the crash:

1. Unload NTCPDRV
2. Access FTPSRV.EXE (ftp server included in mTCP suite for DOS)
3. Exit to DOS
4. Loaded my homemade driver that works well in nearly every test
5. Checked memory again: (475K free)
6. Loaded my Qbasic program

Once I execute the program in Qbasic, it stalls while trying to execute the code below instead of setting BX to FA11h and returning.

Code: [Select]
    mov AL,[CS:BP+runint+1] ;get previously stored interrupt number (which is 61h)
    mov AH,35h ;ES:BX=int handler
    push ES
    push SI
    int 21h
    mov SI,BX
    xor BX,BX
    nexttp:
      mov ECX,[ES:BX+SI]
      cmp ECX,'TCP_'
      jne tcpni
mov ECX,[ES:BX+SI+4]
cmp ECX,'DRVR'
jne tcpni
  xor BX,BX
  jmp extis
      tcpni:
      inc BX
      cmp BX,0h
    jne nexttp
      mov BX,0FA11h ;FA11 = TCP int not found
    extis:
    pop SI
    pop ES

The crash also happens if I execute these steps instead:

1. Unload NTCPDRV
2. Loaded my homemade driver that works well in nearly every test
3. Loaded my Qbasic program

However, I have no issue if I keep the network driver loaded. (skip step 1).

The reason why I have to unload the network driver before starting the FTP server program is because it is not compatible with the driver.

But the particular code I've shown is meant to detect if the driver is installed or not then exit.
What could I be doing wrong in my assembly code?