Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to get TSR in QBASIC?

NT




Comments

  • curious_goofcurious_goof wichitaMember Posts: 1

    Hi
    this is my first time here, so please don't laugh at some my questions.
    I have written a TIME CLOCK program in QBASIC, for my job. The present point of sale program that we use uses DOS for support. It also has a multi-fuction feature that lets me call my TIME CLOCK, but I can't get OUT.

  • forbidden64forbidden64 California, USAMember Posts: 4

    Hey, not sure if anyone ever answered this...In all basic languages, and in some manner or other, there is the idea of chaining and overlays. They go back to the old days when computers didn't have enough memory to run an entire program at once. The idea being that you switch over to another basic memory location/load another program into memory. In QBASIC the command is just that, "CHAIN". You can chain to another program, and then END once you have completed a task.

    I wrote a quick little program to demonstrate this. An interesting thing to note...I tried declaring a variable in the chained program to pass to the main program, and it didn't pass in reverse...so apparently COMMON variables must be declared in the main program before chaining. In your case I don't think it matters. The common statement allows you to declare variables that are passed between two separate programs.
    Program CALL_EX.bas

    'call_ex.bas program to demonstrate passing values between programs as well
    ' as chaining and returning between programs.
    COMMON x 'declare common variable which will be defined in prg.bas
    IF x=5 THEN
    GOTO already
    END IF

    PRINT "testing the output before chaining...":SLEEP 5
    IF INKEY$="q"THEN END 'in case your ctrl-brk doesn't work press q to quit
    CHAIN "prg.bas"
    END

    already:
    print " now returning to call_ex and print common variable x"
    print "x ="; x; END

    ====================================
    'Program prg.bas defines variable x, and then chains back to CALL_EX.

    x=5
    PRINT "Program successfully chained to prg.bas...now returning to main."
    CHAIN "call_ex.bas"

  • forbidden64forbidden64 California, USAMember Posts: 4

    The program in question by the way doesn't have to be anything in particular to basic. You can chain to any DOS program. ex: CHAIN "command.com"
    CHAIN "MEM.COM"
    CHAIN "DOOM1.EXE"

Sign In or Register to comment.