Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Old Modem Program
#1
Posting an old program from my 2006 backup disk of archived files. I hope someone will find it interesting. 
Code: (Select All)
Cls
Print "Simple Qbasic communications program."
Print "What COM port does your modem use?"
Input ">", port$
baud$ = "9600" '9600 should work fine with most modems. If you have
'an older one use 2400.
'Open up that com port.
Open "COM" + port$ + ":" + baud$ + ",N,8,1,RB2048,TB2048" For Random As #1

Print "OPTIONS:"
Print "1-Dial up to another computer"
Print "2-Wait for a call"
Print "3-Quit"
Do
    a = Val(InKey$)
Loop Until a >= 1 And a <= 3
If a = 3 Then Close: System
If a = 2 Then GoTo waitfor

Print "Number to call?"
Input ">", number$
Print #1, "ATDT" + number$ 'Tell the modem to dial the number.
GoTo chat

waitfor:
Print #1, "ATS0=1" 'Tell modem to connect after 1 ring.

'When a modem connects it returns "CONNECT ####"
'The next hunk of code waits until the modem connects before moving on

a$ = ""
Do
    If Loc(1) Then a$ = a$ + Input$(1, 1) 'if anything in modem add it to a$
Loop Until InStr(a$, "CONNECT") 'Wait until modem have connected.

chat:
'If you where waiting for a call, a lot of ASCII characters will be printed
'on the screen. Don't worry, that's just the computers getting in sync and
'talking. You also will not see what you type.

Cls
Print "You are now ready to chat, press ESC to quit."
Do
    t$ = InKey$
    If Len(t$) Then Print #1, t$ 'if you typed something send it to the modem
    'this will be send by the modem to the other
    'computer
    If Loc(1) Then r$ = Input$(1, 1) 'if the is something to get, get it and save
    'it as r$
    If Len(r$) Then Print r$; 'if r$ <> "" then print it. the ";" means a
    'line is not started
Loop Until t$ = Chr$(27) 'keep doing this until ESC is pressed
Print #1, "ATZ" 'tell the modem to hang up
Close 'close the open com statement
Reply


Messages In This Thread
Old Modem Program - by Abacus - 04-19-2022, 08:59 AM
RE: Old Modem Program - by Keybone - 04-19-2022, 12:15 PM
RE: Old Modem Program - by Abacus - 04-19-2022, 01:12 PM
RE: Old Modem Program - by Keybone - 04-19-2022, 03:56 PM
RE: Old Modem Program - by johnno56 - 04-19-2022, 09:25 PM
RE: Old Modem Program - by Jack - 04-19-2022, 09:34 PM
RE: Old Modem Program - by Keybone - 04-20-2022, 12:23 AM
RE: Old Modem Program - by johnno56 - 04-19-2022, 09:47 PM



Users browsing this thread: 1 Guest(s)