×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

qbasic and modem

qbasic and modem

qbasic and modem

(OP)
can i write a game using qbasic and pressed phone keys with
dial up connection?

RE: qbasic and modem

I've refered many people to a program called Basterm at www.qbasic.com  ;
I am betting that you could easily modify that to do what you want

RE: qbasic and modem

LOL...

Are you wanting to use a land line for a game controller???

Never thought about doing that before

(I wonder if Direct X could recognize it as a game controller )

Good Luck!

Have Fun, Be Young... Code BASIC
-Josh

http://cubee.topcities.com

PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.

RE: qbasic and modem

DECLARE SUB opencom ()     'opens com port for communication
DECLARE FUNCTION menu% ()  'displays menu and accepts&returns input
DECLARE SUB waitforcall () 'waits for a call and connects when modem rings
DECLARE SUB callbbs ()     'calls a place and connects
DECLARE SUB setmodemoption ()  'sets modem option and saves it to a file
DECLARE SUB endprog ()     'ends the program
DECLARE SUB connect ()     'connects and handles output/input to/from modem


CONST HALT = 27    
CLS
COLOR 6
DO   
  item% = menu%    
  SELECT CASE item%      
    CASE 1: waitforcall
    CASE 2: callbbs
    CASE 3: setmodemoption
    CASE 4: endprog
  END SELECT
LOOP UNTIL item% = 4     
SYSTEM                   

SUB callbbs
  COLOR 3
  INPUT "Number to call: ", number$
  opencom  
  PRINT #1, "ATDT" + number$  
  PRINT "Calling " + number$ + "...."
  connect
END SUB

SUB connect
  echo% = 0                   
  PRINT "Start Typing when modems connect... Press <Esc> for options or to quit:"
  PRINT
  OPEN "CON" FOR OUTPUT AS #3
  DO
  
    ch$ = INKEY$             
    IF ch$ = CHR$(HALT) THEN  'if ESC pressed
      PRINT "====== OPTIONS ======="
      PRINT "1. Local echo on/off  "
      PRINT "2. Send HALT character (<ESC> by default)"
      PRINT "3. Close port         "
      PRINT "4. Return to terminal "
      SELECT CASE INPUT$(1)   
        CASE "1":
          echo% = echo% XOR 1            
between 0 and 1
          PRINT "Local echo toggled. Returning to terminal...."
        CASE "2":
          PRINT #1, CHR$(HALT)                    PRINT "HALT character sent. Returning to terminal...."
        CASE "3": EXIT DO                
closes port
        CASE "4":                        
 pressing 4, but does X
        CASE ELSE:
          PRINT "Invalid option! Returning to terminal...."
      END SELECT
    ELSEIF ch$ <> "" THEN PRINT #1, ch$;
    END IF
    IF echo% = 1 THEN        
      PRINT #3, ch$;        
ANSI.SYS, if avail
    END IF
      IF LOC(1) <> 0 THEN
      inchar$ = INPUT$(1, #1)
    ELSE
      inchar$ = ""
    END IF
    PRINT #3, inchar$;    
  LOOP
  CLOSE #1   'close the file once done
  CLOSE #3   'close the screen of ANSI support
END SUB

SUB endprog
  COLOR 7
  PRINT "Ending Program."
END SUB

FUNCTION menu%
  DO   
    COLOR 5
    PRINT "==== BASTerm Menu ===="
    PRINT " 1. Wait for a call  "
    PRINT " 2. Call somewhere    "
    PRINT " 3. Set Modem options "
    PRINT " 4. End Program       "
    PRINT "     Choose One: ";      
    LOCATE , , 1: ch$ = INPUT$(1)  
    PRINT : PRINT   'go to the next line then skip a line
  LOOP UNTIL VAL(ch$) >= 1 AND VAL(ch$) <= 4
  menu% = VAL(ch$)  'returns the typed option to the function's caller
END FUNCTION

SUB opencom
  PRINT "Retrieving COM port data.  Please hold."  
  OPEN "BASTerm.CFG" FOR INPUT AS #2    
  INPUT #2, comport$
  CLOSE #2   
  OPEN comport$ + ",N,8,1,RB2048,TB2048" FOR RANDOM AS #1
END SUB

SUB setmodemoption
  COLOR 2
  INPUT "COM Port Number (1 or 2): ", portno$
  INPUT "Modem Speed (300, 1200, 2400, etc): ", speed$
  PRINT "Are The Settings Right? ";
  ch$ = INPUT$(1)
  IF ch$ = "Y" OR ch$ = "y" THEN   
    PRINT "Yes"   
    comport$ = "COM" + portno$ + ":" + speed$
    OPEN "BASTerm.CFG" FOR OUTPUT AS #2  
    PRINT #2, comport$   'store data
    CLOSE #2    'close file
    PRINT "Settings saved."
  ELSE   
    PRINT "No"  'print No... something fancy here....
    PRINT "Disregarding New Settings...."
  END IF
  PRINT
END SUB

SUB waitforcall
  COLOR 3
  opencom      
  PRINT #1, "ATS0=1"   
  connect      
END SUB


This is the terminal program I told you about.  In the connect SUB you should add your code for what you want to happen when certain characters come through.

I will be posting the whole of basterm.bas in the FAQ section for future quick-reference

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close