home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
private
/
varapps.zip
/
AREA230.ZIP
/
AREA.BAS
next >
Wrap
BASIC Source File
|
1989-12-20
|
18KB
|
381 lines
'area-code display program
DEFINT I-O
CONST true = -1: false = NOT true
author$ = "Owen Carlson 7609 Dublin Drive, Manassas VA 22110"
note$ = "Corrections received will be incorporated in next update"
version$ = "AREA 2.30"
restorerow = CSRLIN
restorecolumn = POS(x)
numcodes = 143
stlin = 6
leftcol = 30
mode = 0: page0 = 0: page1 = 1
toplin$ = "╒════════════════════════════════════════╕" 'top box line
botlin$ = "╘════════════════════════════════════════╛" 'bottom line
xlin$ = "├────────────────────────────────────────┤" 'split line
midline$ = "│ │" 'text line
'
DEF SEG = &H40 'go play with DOS
invid = PEEK(&H49)
IF invid < 2 THEN
PRINT "AREA does not support"
PRINT "40-column displays."
END
END IF
IF invid > 3 THEN
PRINT "AREA does not support GRAPHICS modes"
END
END IF
IF invid = 2 THEN ividmode = 0 'black/white
IF invid = 3 THEN ividmode = 1 'color
iegapgalines = PEEK(&H84) 'for future testing and use
'
'v2.30 philosophy has changed to handle only 80-column displays
'and to handle mono by PRINTing vice the screen-swap & locate-and-
'print window method as is done for color.
'If this causes any problems, please inform me.
'
c$ = COMMAND$ 'get command line & strip any leading spaces
c$ = UCASE$(c$) 'make all letters upper-case
Strip: IF LEFT$(c$, 1) = " " THEN c$ = RIGHT$(c$, LEN(c$) - 1): GOTO Strip
GOSUB Shiftscrn 'move page0 to page1, prepare window
cval = VAL(c$) 'get value of input command field
middigit$ = MID$(c$, 2, 1)
flag = false 'set flag false prior to use
state = false 'ditto
areacode = false 'ditto
IF LEN(c$) = 2 THEN state = true 'any 2-char field = state/prov
IF LEN(c$) = 3 THEN areacode = true 'any 3-char field = area code
IF NOT state AND NOT areacode THEN
GOSUB Prsyntax 'bad syntax, so print syntax
GOTO Depart 'screen and depart
END IF
IF areacode AND (cval < 201 OR cval > 919) THEN
GOSUB Prnoarea 'bad area code, say so and
GOTO Depart 'depart
END IF
IF areacode AND (middigit$ < "0" OR middigit$ > "1") THEN
GOSUB Prnoarea 'bad area code number (middle digit
GOTO Depart 'not a one or a zero), print syntax and
END IF 'depart
IF areacode THEN 'look thru
FOR i = 1 TO numcodes 'data for match
READ a$ 'on single area
IF LEFT$(a$, 3) = c$ THEN 'code.
flag = true 'Set flag and
GOSUB Prareacode 'print the match and
EXIT FOR 'leave loop when found
END IF
NEXT i
IF flag THEN GOTO Depart
IF NOT flag THEN 'if flag not set, no match
GOSUB Prnoarea 'was found, say that no such
GOTO Depart 'code exists and depart.
END IF
END IF
IF state THEN 'listing all the area codes in a
stateflag = false 'state/province
FOR i = 1 TO numcodes 'look thru all codes
READ a$
ac$ = LEFT$(a$, 3)
st$ = MID$(a$, 4, 2)
state$ = MID$(a$, 6, 19)
region$ = MID$(a$, 25, 37)
IF MID$(a$, 4, 2) = c$ THEN 'looking for a match on state
IF NOT stateflag THEN 'if first match,
GOSUB PrTopLine 'start the window print
txtout$ = state$
GOSUB PrMidLine 'print state/province
stateflag = true 'and set flag
END IF
IF stateflag THEN 'print the data for the code
txtout$ = ac$ + " " + region$ 'matches found, including 1st
GOSUB PrMidLine
END IF
END IF
NEXT i 'loop
IF stateflag THEN 'print the bottom lines of
GOSUB PrSplitLine
GOSUB PrBotLines 'the window
GOSUB Waitescape 'hang on the ESC key
END IF 'then drop thru to END
END IF
IF NOT stateflag THEN
GOSUB PrNoState 'if no state was found, say so
GOSUB Waitescape 'hang on ESC
END IF
GOSUB Shiftback 'shift back to the original
END 'screen and terminate
'
Depart: GOSUB Waitescape 'hang on ESC key
DP2: GOSUB Shiftback 'another way out
END
'
Shiftback:
IF ividmode = 0 THEN RETURN 'can't shift in MDA B&W
SCREEN mode, ividmode, page0, page0 'shift screen back to
LOCATE restorerow, restorecolumn 'where called from
RETURN
'
Shiftscrn:
IF ividmode = 0 THEN RETURN 'only one page for MDA B&W
PCOPY page0, page1 'block copy
SCREEN mode, ividmode, page1, page1 'set video & active page to 1
COLOR 0, 7 'set color for window and
RETURN 'return
PrNoState: 'state not found window
GOSUB PrTopLine
txtout$ = c$
GOSUB PrMidLine
txtout$ = ""
GOSUB PrMidLine
txtout$ = "State/Province not recognized."
GOSUB PrMidLine
GOSUB PrSplitLine
GOSUB PrBotLines
RETURN
Prsyntax: 'syntax window
GOSUB PrTopLine
txtout$ = "Correct Syntax is:"
GOSUB PrMidLine
txtout$ = " `AREA 616'"
GOSUB PrMidLine
txtout$ = " or `AREA MI'"
GOSUB PrMidLine
GOSUB PrSplitLine
GOSUB PrBotLines
RETURN
Prareacode: 'single area-code window
st$ = MID$(a$, 4, 2)
state$ = MID$(a$, 6, 19)
region$ = MID$(a$, 25, 37)
GOSUB Shiftscrn
GOSUB PrTopLine
txtout$ = "Area Code = " + c$
GOSUB PrMidLine
txtout$ = "State/Prov = " + state$
GOSUB PrMidLine
o = LEN(region$)
oo = 40 - o - 1 'num of spaces to right-justify
IF oo > 11 THEN oo = 11 'but don't justify farther
txtout$ = SPACE$(oo) + region$ 'right than under the "="
GOSUB PrMidLine
GOSUB PrSplitLine
GOSUB PrBotLines
RETURN
Prnoarea: 'no area code found window
GOSUB PrTopLine
txtout$ = c$
GOSUB PrMidLine
txtout$ = ""
GOSUB PrMidLine
txtout$ = "Requested AreaCode does not exist."
GOSUB PrMidLine
GOSUB PrSplitLine
GOSUB PrBotLines
RETURN
PrSplitLine:
IF ividmode = 0 THEN
PRINT splitline$
ELSE
currentline = currentline + 1
LOCATE currentline, leftcol
PRINT xlin$
END IF
RETURN
PrMidLine:
q$ = midline$
MID$(q$, 3, 39) = txtout$
IF ividmode = 0 THEN
PRINT q$
ELSE
currentline = currentline + 1
LOCATE currentline, leftcol
PRINT q$
END IF
RETURN
PrTopLine:
currentline = stlin
IF ividmode = 0 THEN
PRINT toplin$
ELSE
LOCATE currentline, leftcol
PRINT toplin$
END IF
RETURN
PrBotLines:
q$ = midline$
MID$(q$, 3, 11) = "ESC to Exit"
MID$(q$, 31, 9) = version$
IF ividmode = 0 THEN
PRINT q$
PRINT botlin$
ELSE
currentline = currentline + 1
LOCATE currentline, leftcol
PRINT q$
currentline = currentline + 1
LOCATE currentline, leftcol
PRINT botlin$
END IF
RETURN
Waitescape: 'return only
WE2: x$ = INKEY$ 'when the ESC
IF x$ = "" THEN GOTO WE2 'key has been
IF x$ <> CHR$(27) THEN GOTO WE2 'pressed
RETURN
Datum: DATA "201NJNew Jersey (Newark/Northern)"
DATA "202DCWashington, DC (all)"
DATA "203CTConnecticut (all)"
DATA "204MBManitoba (all)"
DATA "205ALAlabama (all)"
DATA "206WAWashington (Seattle/Vancouver/Western)"
DATA "207MEMaine (all)"
DATA "208IDIdaho (all)"
DATA "209CACalifornia (Fresno/Modesto/Stockton area)"
DATA "212NYNew York (New York City)"
DATA "213CACalifornia (Los Angeles)"
DATA "214TXTexas (Dallas/Northeastern)"
DATA "215PAPennsylvania (Philadelphia and Suburbs)"
DATA "216OHOhio (Cleveland/Akron/Northeastern)"
DATA "217ILIllinois (Springfield/Middle)"
DATA "218MNMinnesota (Duluth/Moorehead/Northern)"
DATA "219INIndiana (South Bend/FtWayne/Northern)"
DATA "301MDMaryland (all)"
DATA "302DEDelaware (all)"
DATA "303COColorado (Denver/Northern/FarWestern)"
DATA "304WVWest Virginia (all)"
DATA "305FLFlorida (Miami/SouthEastern + Keys)
DATA "306SKSaskatchewan (all)"
DATA "307WYWyoming (all)"
DATA "308NENebraska (North Platte/Western)"
DATA "309ILIllinois (Peoria/Morton & MidWestern)"
DATA "312ILIllinois (Chicago)"
DATA "313MIMichigan (Detroit/Southeastern)"
DATA "314MOMissouri (St.Louis/Eastern)"
DATA "315NYNew York (Syracuse/NorthCentral)"
DATA "316KSKansas (Wichita/Dodge City/Southern)"
DATA "317INIndiana (Indianapolis/Central)"
DATA "318LALouisiana (Shreveport/Western)"
DATA "319IAIowa (Dubuque/Eastern)"
DATA "401RIRhode Island (all)"
DATA "402NENebraska (Omaha/Lincoln/Eastern)"
DATA "403ABAlberta (all + YT + NT north of AB & MB)"
DATA "403YTYukon (all)"
DATA "403NTNorthwest Terr. (N. of AB & MB + all of AB & YT)"
DATA "404GAGeorgia (Atlanta/Northern)"
DATA "405OKOklahoma (Ok.City/all but Northeast)"
DATA "406MTMontana (all)"
DATA "407FLFlorida (Orlando/Melbourne/Eastern)"
DATA "408CACalifornia (San Jose/Monterey/Salinas area)"
DATA "409TXTexas (Galveston/SE less Houston)"
DATA "412PAPennsylvania (Pittsburgh/Southwestern)"
DATA "413MAMassachusetts (Springfield/Western)"
DATA "414WIWisconsin (Milwaukee/Racine/GreenBay/SE)"
DATA "415CACalifornia (San Francisco/Oakland)"
DATA "416ONOntario (Toronto/Niagara Falls region)"
DATA "417MOMissouri (Springfield/SW)"
DATA "418PQQuebec (Northeastern)"
DATA "419OHOhio (Toledo/Northwestern)"
DATA "501ARArkansas (all)"
DATA "502KNKentucky (Louisville/Paducah/Western)"
DATA "503OROregon (all)"
DATA "504LALouisiana (New Orleans/Baton Rouge/Eastern)"
DATA "505NMNew Mexico (all)"
DATA "506NBNew Brunswick (all)"
DATA "507MNMinnesota (Rochester/Albert Lea/Southern)"
DATA "508MAMassachusets (Worcester/CapeCod/Central)"
DATA "509WAWashington (Spokane/Walla Walla/Eastern)"
DATA "512TXTexas (San Antonio/Brownsville/Southern)"
DATA "513OHOhio (Cincinnati/Sprngfld/Southwestern)"
DATA "514PQQuebec (Montreal/Southern)"
DATA "515IAIowa (Des Moines/Central)"
DATA "516NYNew York (all Long Island)"
DATA "517MIMichigan (Lansing/Jackson/Central & N.E.)"
DATA "518NYNew York (Albany/Northeastern)"
DATA "519ONOntario (London/Windsor/Sarnia)"
DATA "601MSMississippi (all)"
DATA "602AZArizona (all)"
DATA "603NHNew Hampshire (all)"
DATA "604BCBritish Columbia (all + NT North of BC)"
DATA "604NTNorthwest Terr. (North of BC)"
DATA "605SDSouth Dakota (all)"
DATA "606KNKentucky (Lexington/Covington/Eastern)"
DATA "607NYNew York (Binghampton/Owego/South Central)"
DATA "608WIWisconsin (Madison/Southwestern)"
DATA "609NJNew Jersey (Trenton/Princeton/Southern)"
DATA "612MNMinnesota (Minneapolis/StPaul/Central)"
DATA "613ONOntario (Ottawa/Eastern)"
DATA "614OHOhio (Columbus/Southeastern)"
DATA "615TNTennessee (Nashville/Central & Eastern)"
DATA "616MIMichigan (Grand Rapids/N&W Lower Peninsula)"
DATA "617MAMassachusetts (Boston & Suburbs)"
DATA "618ILIllinois (Centralia/Cairo/Southern)"
DATA "619CACalifornia (San Diego/Imperial/Eastern Desert)"
DATA "701NDNorth Dakota (all)"
DATA "702NVNevada (all)"
DATA "703VAVirginia (Roanoke/Fairfax/Western/Northern)"
DATA "704NCNorth Carolina (Charlotte/Southwestern)"
DATA "705ONOntario (North Bay/Sault Ste Marie & North)"
DATA "706 Not Used (all)"
DATA "707CACalifornia (Vallejo/Napa/Eureka/North Coastal)"
DATA "708ILIllinois (Chicago's Suburbs)"
DATA "709NFNewfoundland (all + Labrador (LB) + NT N. of LB)"
DATA "709LBLabrador (all + Nwfndlnd (NF) + NT N. of LB)"
DATA "709NTNorthwest Terr. (N. of LB + NF(all) + LB(all))"
DATA "712IAIowa (Council Bluffs/Western)"
DATA "713TXTexas (Houston & Suburbs)"
DATA "714CACalifornia (Anaheim/Orange/Palm Springs)"
DATA "715WIWisconsin (Eau Claire/Wausau/Northern)"
DATA "716NYNew York (Buffalo/Rochester/Western)"
DATA "717PAPennsylvania (Harrisburg/Eastern except Phil'a)"
DATA "718NYNew York (New York City)"
DATA "719COColorado (Pueblo/Alamosa/SCentral/S.E.)"
DATA "801UTUtah (all)"
DATA "802VTVermont (all)"
DATA "803SCSouth Carolina (all)"
DATA "804VAVirginia (Richmond/Norfolk/SE)"
DATA "805CACalifornia (Bakersfield/San Luis Obispo)"
DATA "806TXTexas (Amarillo/Panhandle)"
DATA "807ONOntario (Thunder Bay and North/West)"
DATA "808HIHawaii (all the Islands)"
DATA "809PRPuertoRico/VirgIs (Bermuda/Bahamas/all offshore Is.)"
DATA "812INIndiana (Evansville/Columbus/Southern)"
DATA "813FLFlorida (Tampa/Fort Myers/Southwestern)"
DATA "814PAPennsylvania (Altoona/Erie/Western except S.W.)"
DATA "815ILIllinois (Rockford/Northeast except Chicago)"
DATA "816MOMissouri (Kansas City/Northwestern)"
DATA "817TXTexas (Fort Worth/Temple/NorthCentral)"
DATA "818CACalifornia (Alhambra/Burbank/Pasadena area)"
DATA "819PQQuebec (Northwestern Quebec + NT N. of PQ)"
DATA "819NTNorthwest Terr. (N. of Quebec(PQ) + Northwestrn PQ)"
DATA "901TNTennessee (Memphis/Western)"
DATA "902NSNova Scotia (all + Prince Edward Island (PE) )"
DATA "902PEPrince Edward Is. (all + Nova Scotia (NS) )"
DATA "903 Not Used "
DATA "904FLFlorida (Jacksonville/Pensacola/Northern)"
DATA "905 Not Used (all)"
DATA "906MIMichigan (Upper Peninsula)"
DATA "907AKAlaska (all)"
DATA "908 Not Used "
DATA "909 Not Used "
DATA "912GAGeorgia (Savannah/Southern)"
DATA "913KSKansas (Topeka/KanCity/Northern)"
DATA "914NYNew York (Poughkeepsie/lower Hudson Valley)"
DATA "915TXTexas (El Paso/San Angelo/Western)"
DATA "916CACalifornia (Sacramento/Redding/Northeastern)"
DATA "917 Not Used "
DATA "918OKOklahoma (Tulsa/Northeastern)"
DATA "919NCNorth Carolina (Winston/Salem, Northern & Eastern)"