BBS Programing/HELP!

 BBS: Inland Empire Archive
Date: 06-29-92 (18:05)             Number: 1722
From: ERIC FORD                    Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: BBS Programing/HELP!           Conf: (2) Quik_Bas
Hey, I was interested in making my own BBS program.  I saw this in BASIC, and
wanted to try it.  I believe it only works upto 1200 baud, can someone make
this upto 2400?  Also, how would I go about up/down loading?
Here it is:

460 REM   On method is to access the serial ports directly for input,
470 REM output, and detecting carrier or the status of other parts of
480 REM the modem itself. Basically (hah) we start by turning on the
490 REM DTR lead (see your modem manual for whatever correct switches must
500 REM be set) with the statement OUT 1020,1 next send the ATZ code
510 REM (let's assume you have a hayes compatible) through a routine
520 REM which is listed below. After that, some other modem commands
530 REM may be necessary, in particular, ATE0Q1 or ATS2=255S0=1 (see
540 REM your manual for the exact meaning of these) Then wait for the
550 REM modem to ring and send the ATA command. The modem status
560 REM register's seventh bit, the ring indicator bit, can be examined.
570 REM This short peice of code works:

580 REM WHILE(INP(1022)AND 64)=0:WEND:A$="ATA":GOSUB 1000

590 REM The last step is to wait for a carrier, the following code works:

600 REM WHILE(INP(1022)<128:WEND It is a good idea to time how long
610 REM each loop is being thrashed through and to disconnect before
620 REM thirty seconds has elapsed (then hang up the modem with
630 REM OUT 1020,0 -- this can also be done at any time while your
640 REM program is running and the carrier is present)

650 REM   Now that you have a carrier and the program is interacting
660 REM with a user, take a look at the example program below, with it's
670 REM sparse remarks and notice the modem input and output routines,
680 REM in fact the whole program, is working without ever opening
690 REM the communications port.

700 REM   This document was typed in by an anonymous hacker. The
710 REM program was written by a large team of programmers on their
720 REM lunch break.

721 REM *** Begin program ***
722 REM
723 DEF FNTI! = VAL(MID$(TIME$, 1, 2)) * 3600 +
VAL(MID$(TIME$, 4, 2)) * 60 + V

725 REM Turn on the DTR lead
730 OUT 1020, 1

731 REM Initialize the modem and wait two seconds for the OK response
733 A$ = "ATZ": GOSUB 8740: SOUND 32767, 36

734 REM Instruct the modem to answer the phone after one ring
736 A$ = "ATQ1ES2=255S0=1": GOSUB 8740

737 REM Wait for the phone to ring
738 WHILE (INP(1022) AND 64) = 0: WEND

739 REM Modem answers phone. Wait for carrier or timeout
741 T2! = FNTI!: WHILE (INP(1022) < 128): GOSUB 8730: WEND:
QQ = 1: OUT 1019, 3

742 REM Initialize the baud variables

743 REM ** Find out if it's 300,1200 and No parity or Even parity

744 '      Look at the buffer until a character is entered
745          WHILE (INP(1021) AND 1) = 0: WEND
750          A = 0: WHILE A = 0: A = INP(1016): WEND: SWAP Q, QQ

751 '      If it is ascii 13 then it found even parity
752          IF A = 13 THEN 200

753 '      If it is ascii 141 then it is a return with an extra bit,
754 '      then set the register to reflect this
755          IF A = 141 THEN OUT 1019, 26: GOTO 200

758 '      Store the line status register value
759          R1 = INP(1019)

760 '      Set the divisor latch so the I/O buffer becomes the baud generator
761          OUT 1019, R1 OR 128: IF Q THEN OUT 1016, 128:
OUT 1017, 1 ELSE OUT

762 '      Recode the baud. The baud is alternated until CR is found.
763          IF Q THEN OUT 1016, 128: OUT 1017, 1 ELSE OUT 1016, 96: OUT 1017,

764 '      Restore the I/O buffer by resetting the divisor latch
770          OUT 1019, R1: OUT 1019, 3: GOSUB 8730: GOSUB 8730: GOTO 750

771 '      Set parity to none, check for carrier loss, and timeout
772          OUT 1019, 3: GOSUB 8730: GOSUB 8730: GOTO 745

780 REM ** At this stage it has found the correct baud and parity..
790 A$ = "Welcome to beta site X": GOSUB 1010
800 A$ = "Enter your name:": GOSUB 2001: STOP

--- WM v2.02/91-0128
 * Origin: Electronic Dreams BBS - Jackson, MS - 601/372-6998 (1:3632/1)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET