Announcement

Collapse
No announcement yet.

Why Does This Code Stop Receiving Chars (COMM)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why Does This Code Stop Receiving Chars (COMM)?

    The following code WORKS (it is in a PBU) in that it correctly
    notifies the parent EXE if the user has dropped carrier, so the
    EXE (a BBS door) can exit gracefully. However, if I use this
    code, then the PB/DOS 3.5 program stops inputting characters from
    the user's end. The serial port is opened with PB's builtin
    OPEN "COM..." command. I tested it by calling my own BBS with one
    of my phone lines, while the BBS node used the other one. The terminal
    program I used was Telix for Windows 1.15d (licensed). If I use
    PB's sample code that ships with PB/DOS 3.5, in re the Carrier function
    contained in COMMUNIT.BAS, then it does work. (had to do minor
    additions to the PB code so the function returned 0 if there IS
    a valid carrier detect - MY function tells the parent EXE if the
    carrier is DROPPED). Does PB's code work because it directly accesses
    the modem status register, rather than using INT 14H, as mine does?
    In other words, is my code causing a conflict because it uses INT 14H,
    and PB's builtin comm functionality also uses it?

    OK, 'nuff said. My code follows. I will not spell out the two
    $INCLUDE lines - the two included files contain NOTHING but
    the appropriate registers' PUSH / POP (save/restore registers):

    Code:
    $COMPILE UNIT
    '
    DEFINT I
    '
    FUNCTION DroppedCarrier%(A%) PUBLIC
        I = A% - 1 'my calling code uses actual commport numbers,
                    'whereas the INT uses commport# - 1
        $INCLUDE "push.bas"
        REG %AX, &H0300
        REG %DX, I
        CALL INTERRUPT &H14
        I1 = REG(%AX)
        $INCLUDE "pop.bas"
        SHIFT RIGHT I1, 7
        I1 = (I1 AND 1)
        FUNCTION = (I1 = 0)
    END FUNCTION
    Any help gratefully received.

    ADDED: further testing has shown that it is NOT an issue with the
    PB comm subsystem. It is apparently directly tied to this particular
    service of INT 14H. This service's sole purpose is to retrieve the
    serial port's status. Maybe the way it is implemented causes it to
    "hang" if the port is active (i.e., the modem is online with another
    modem)?

    ------------------


    [This message has been edited by Clay Clear (edited November 07, 2002).]

  • #2
    There is no need to PUSH and POP the registers when you are using BASIC code, but as a comparison, try using an full inline-assembler version of the code:
    Code:
    $COMPILE UNIT
    defint a-z
    '
    FUNCTION DroppedCarrier%(BYVAL A%) PUBLIC
      local i%
      i% = A% - 1 'my calling code uses actual commport numbers,
      'whereas the INT uses commport# - 1
      !push ds
      !mov ax, &H0300
      !mov dx, i%
      !int &H14
      !mov i%, ax
      !pop ds
      FUNCTION = (i% AND &B010000000) = 0
    END FUNCTION
    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Oh, what OS are you testing this on?

      It is not clear what that !INT &H14 handler is actually doing behind the scenes, so you might do better to examine the modem status register directly anyway.

      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Lance,

        Win98SE.

        Your version of the code produced the same results. I think it
        might be simply that that service is poorly designed, at least in
        my flavor of OS.

        I have NO problem with using PB's method, but with the current
        debate going on about the copyright issue, I decided to try use
        my own code to totally avoid any issues, misunderstandings, etc.
        in that area. My knowledge of direct memory access in not developed
        enough to use PB's METHOD, but with totally my own code.

        So, will simply return to directly using PB's sample code, and
        include the perquisite copyright notices in my public software
        releases.

        Thanks for your help.


        ------------------

        Comment


        • #5
          Are you using hardware or softwrae flow control?


          ------------------
          There are no atheists in a fox hole or the morning of a math test.
          If my flag offends you, I'll help you pack.

          Comment


          • #6
            Mel,

            I never use anything EXCEPT hardware flow.


            ------------------

            Comment


            • #7
              Originally posted by Clay Clear:
              So, will simply return to directly using PB's sample code, and
              include the perquisite copyright notices in my public software
              releases.
              I can't understand the fuss to be honest: The copyright notice only needs to appear in your source code, not in the compiled app.


              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Originally posted by Lance Edmonds:

                I can't understand the fuss to be honest: The copyright notice only needs to appear in your source code, not in the compiled app.
                Uh Lance, what does this have to do with COMM communications?


                ------------------
                There are no atheists in a fox hole or the morning of a math test.
                If my flag offends you, I'll help you pack.

                Comment


                • #9
                  Mel, you'd be best to ask Clay since it was the reason he was avoiding using the example code supplied by PowerBASIC.

                  ------------------
                  Lance
                  PowerBASIC Support
                  mailto:[email protected][email protected]</A>
                  Lance
                  mailto:[email protected]

                  Comment

                  Working...
                  X