Announcement

Collapse
No announcement yet.

Hi there, got a question on TSR's

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

  • Hi there, got a question on TSR's

    I could probably find this in the book, but its at home, and I'm not. (Pretty Sad, really... I must remember not to take my laptop on vacation again). Anyway, here is the question... Every time I try to use SHELL in a program that includes POPUP, I get an error. Am I correct in assuming that I cannot do this?

    ------------------
    Jonathan Simpson
    Jonathan Simpson

  • #2
    Shouldn't be a problem. What's the error?

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3
      May be out of memory?

      After TSR is loaded, then a program starts up, the last program started will use all available DOS memory, leaving no room for a COMMAND.COM launched by SHELL.

      SETMEM can leave some freespace for SHELLed programs, but I've never thought a TSR should ever SHELL anything.

      (Didn't/Doesn't someone offer a product for PB/DOS TSRs to roll them out to disk and free memory for this kind of thing?)

      MCM
      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        I'd guess that you refer to UltraShell from www.infoms.com -- I've never used it on a TSR though, but it should work just fine to free and restore conventional memory for the SHELL operation.


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

        Comment


        • #5
          I get an Illegal Function call, on the line containing shell. If I remove the line for popup sleep, it works fine, but it will not work as long as that line is there.
          I have used setmem to free up memory, but it has not helped. Any ideas guys? The program is only 6 lines, because I ran into this almost as soon as I started.

          ------------------
          Jonathan Simpson
          Jonathan Simpson

          Comment


          • #6
            I still think it's memory.

            Page 250 of PB/DOS manual says
            SHELL loads a second copy of the DOS commmand processor (COMMAND.COM by default) while retaining your PowerBASIC program in memory...
            I can't find what error number occurs if SHELL is unable to load the command processor, but 'Illegal Function Call' does not seem unreasonable.

            If you are trying to "popup to add a SHELL capability" over a program not of your own making, I think you are at the mercy of that program, which has no reason NOT to grab all 'currently available' memory...meaning you can't do this.

            Maybe there is a way to reserve memory when the TSR is loaded so that programs which load <U>after</U> the TSR grab less memory.(??).

            (Sheesh, I know I'm windowfied now. I used to know this PB-DOS/TSR stuff cold. Now I have to dig out the manuals).

            MCM


            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              5 more days until I get back to my books. I guess I shouldn't complain about time off, but...
              I'll try using setmem to free up and/or reserve some memory, and let you guys all know if that helps.


              ------------------
              Jonathan Simpson
              Jonathan Simpson

              Comment


              • #8
                Oh, about adding a shell to a program not my own... Yes, more or less, that is what I am trying to do. BUT (isn't there always a but?) I know that the program in question leaves sufficent space for what I need.
                The other program is a cash register program written in Quickbasic 7.1. I talk with the
                developer on a daily basis. In any event, the program fails to work if activated even from within one of my own programs.

                ------------------
                Jonathan Simpson
                Jonathan Simpson

                Comment


                • #9
                  Ok, after even more experimenting, with still the same error,
                  I am starting to think it's not possible. Every memory setting I've tried changes nothing.
                  Is there anything else I can try that might work? Anything at all?
                  Thanks Everybody
                  Jonathan Simpson.

                  ------------------
                  Jonathan Simpson
                  Jonathan Simpson

                  Comment


                  • #10
                    Ok, first question: Does your TSR code work to launch programs <U>other than</U> the cash register app? In my tests, I was not able to SHELL to anything from a TSR, so I'm not sure the operation is supported.

                    I'll put an RFI into R&D...

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

                    Comment


                    • #11
                      Nope. I can't shell to anything, even command line, if popup sleep appears in the program. I searched the forum for previous posts on this topic and found nothing terribly useful, other than one suggesting watching the memory allocation.
                      Thanks for the help
                      Jonathan Simpson

                      ------------------
                      Jonathan Simpson
                      Jonathan Simpson

                      Comment


                      • #12
                        I know that the program in question leaves sufficent space for what I need.
                        How do you know that? That is not the default MS-DOS program behavior. Default behavior is to take all available regular memory, even if it will never be used.

                        I'd take a good look at Mr Edmonds' results.. unable to SHELL anything from a TSR. You may be seeking the impossible.


                        MCM
                        Michael Mattias
                        Tal Systems Inc. (retired)
                        Racine WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Have just tried to insert a line with SHELL in the example file ASCIITSR.BAS:

                          $DIM NONE
                          $COMPILE EXE ' this tells PB to make a standalone EXE
                          $LIB IPRINT OFF ' allow graphic characters to print
                          $OPTION CNTLBREAK OFF ' not wise in a tsr

                          x& = SETMEM(-700000) ' release unused memory

                          POPUP KEY CHR$(8,30,247) ' ALT A is the hot key

                          POPUP MULTIPLEX &HC000, 254 ' reg AX and DX get this pattern as an ID
                          REG 1, &HC000 : REG 4, 254 ' set pattern to check for already installed
                          CALL INTERRUPT &H2F ' do the multiplex interrrupt
                          IF REG(1)<>&HC000 AND REG(4)<>254 THEN END 'we were already installed

                          SwapFile$ = LEFT$(CURDIR$,2)+"\ASCTSR.SWP"
                          ' -------------------------------------------------
                          SHELL "pb.exe"
                          ' -------------------------------------------------
                          PRINT "ASCII chart available as ALT-A"
                          REG 1, &HC001 : REG 4, 252 ' Alter AX,DX to show we were here
                          POPUP SLEEP USING EMS, SwapFile$ ' before going to sleep

                          etc.

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

                          and it works perfect!
                          Can it be because you are using the complete path?

                          Compiled and run from the Commandline in NT4.




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

                          Comment


                          • #14
                            No, it's because the program has not popped down when your test SHELL statement is executed.

                            R&D have now confirmed that it is just not possible to SHELL from a TSR app once it has popped down as DOS simply stomps on the attempt.

                            Sorry!

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

                            Comment


                            • #15
                              Ok... so the next question... is there anyway to get around this, in any form.
                              Can, for example, whatever memory, settings, registers, or other things be released, without ending the program.
                              Say, making a popup program not be a popup after it has popped up.
                              I think I should just give up

                              ------------------
                              Jonathan Simpson
                              Jonathan Simpson

                              Comment


                              • #16
                                Not once it's popped down, or R&D would have built it into PowerBASIC already. Sorry!

                                What do you need to use a TSR anyway? If it's simply to launch a till/cashdraw app, then why not run it as a separate Windowed DOS app than can be selected with ALT+TAB or a short-cut key, or some other manner?

                                IOW, it seems to me that the approach to your problem needs to be reconsidered slightly...

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

                                Comment


                                • #17
                                  Or, can the TSR do whatever it needs to do <U>without</U> calling a SHELL?

                                  That is, if the TSR is there to provide some service to the running application, like, say, a file copy, you could have the TSR do the file copy using OPEN/CLOSE/READ/WRITE.

                                  (We see here lots of postings where what is being done by a SHELL can be done with BASIC functions).

                                  MCM
                                  Michael Mattias
                                  Tal Systems Inc. (retired)
                                  Racine WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment


                                  • #18
                                    Originally posted by Jonathan Simpson:
                                    Ok... so the next question... is there anyway to get around this, in any form.
                                    Can, for example, whatever memory, settings, registers, or other things be released, without ending the program.
                                    Say, making a popup program not be a popup after it has popped up.
                                    I think I should just give up

                                    This may sound risky (because it is) but have you tried trapping
                                    the error and ignoring it?

                                    Like so:

                                    ON ERROR RESUME NEXT
                                    SHELL

                                    It's not a good solution but it has been known to work

                                    Buck



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

                                    Comment


                                    • #19
                                      The TSR is providing a service to the POS program. It is supposed
                                      to call a Third program, which provides a customer notes interface
                                      The other program is written in VBDOS. I would much rather move the
                                      VBDOS app entirely to powerbasic, but I don't think that would
                                      be terribly easy to do. Any suggestions?

                                      ------------------
                                      Jonathan Simpson
                                      Jonathan Simpson

                                      Comment


                                      • #20
                                        does it really need to be implemented as a tsr? iow, would it be possible for the "service" to be provided to the pos app by getting the pos app to launch/shell it directly, rather than using a tsr?

                                        if the pc running windows? if so, then it might be easier to write a separate windows app that intercepts a given hotkey (like you are probably using to run the tsr) and then runs the pds app. code for most of this can be found in the source code forum at http://www.powerbasic.com/support/pb...ad.php?t=22653

                                        ------------------
                                        lance
                                        powerbasic support
                                        mailto:[email protected][email protected]</a>
                                        Lance
                                        mailto:[email protected]

                                        Comment

                                        Working...
                                        X