home *** CD-ROM | disk | FTP | other *** search
- 1 rem (c) 1987 uptime magazine
- 2 rem (c) 1987 softdisk publishing inc.
- 3 :
- 4 rem author: noel nyman
- 5 :
- 10 print chr$(142)chr$(8): clr: goto100
- 15 :
- 20 *****************************************
- 25 * ram based database *
- 30 * by noel nyman *
- 35 * *
- 40 * the data for this database are all *
- 45 * held in data statements, which are *
- 50 * moved into array variables for fast *
- 55 * searching and display. new records *
- 60 * are added using the "dynamic screen" *
- 65 * technique. the added data are saved *
- 70 * with the program if the "q" option *
- 75 * is selected at the main menu. *
- 80 *****************************************
- 85 :
- 100 rem --- initialize variables ---
- 110 :
- 120 poke 1023, peek(646): rem store text color
- 130 :
- 140 rem --- don't change the next two line numbers! ---
- 150 z= 4
- 160 dd= 2240
- 170 :
- 180 poke 646, peek(1023): rem get the text color back
- 190 dim n$(z), a$(z), c$(z), p$(z), pt(z)
- 200 :
- 210 for x=1 to z
- 220 : read n$(x), a$(x), c$(x), p$(x)
- 230 next
- 240 :
- 250 rem --- clear pointer array, main menu ---
- 260 :
- 270 for x=1 to z
- 280 : pt(x)=0: rem points to records selected during match searches
- 290 next
- 300 :
- 305 print "[147] dynamic database "
- 310 print"do you want to---
- 320 [153]"1) print by record number
- 330 print"2) search by name
- 340 [153]"3) search by address
- 350 print"4) search by phone
- 360 [153]"5) add a name
- 370 print"6) quit
- 380 [153]"f8) return to uptime
- 385 print "--published by softdisk publishing inc--";
- 390 :
- 400 rem --- get menu selection ---
- 410 :
- 420 get x$: if x$="" goto420
- 430 if x$="[140]" goto2100
- 440 x=val(x$)
- 450 if x<1 or x>6 goto420
- 460 :
- 470 on x goto510,670,870,980,1420,1090
- 480 :
- 490 rem --- search by record number ---
- 500 :
- 510 print"[147]enter record number to search for:"
- 520 gosub1360
- 530 x=val(n$)
- 540 if x<1 or x>z then print "record number not in use": gosub1300: goto270
- 550 gosub590: gosub1300: goto270
- 560 :
- 570 rem --- print record ---
- 580 :
- 590 print: print n$(x)
- 600 print a$(x)
- 610 print c$(x)
- 620 print p$(x)
- 630 return
- 640 :
- 650 rem --- search by name ---
- 660 :
- 670 print"[147]enter name to search for:"
- 680 gosub1360
- 690 w=0
- 700 for x=1 to z
- 710 : if left$(n$(x),len(n$))=n$ then w=1: pt(x)=x
- 720 next
- 730 :
- 740 rem --- locate matched records ---
- 750 :
- 760 if w=0 then print "no match found": gosub1300: goto270
- 770 :
- 780 w=0
- 790 for y=1 to z
- 800 : if pt(y)>0 then x=pt(y): gosub590: w=w+1
- 810 : if w=4 then w=0: gosub1300: print"[147]";
- 820 next
- 830 gosub1300: goto270
- 840 :
- 850 rem --- search by address ---
- 860 :
- 870 print"[147]enter address to search for:"
- 880 gosub1360
- 890 w=0
- 900 for x=1 to z
- 910 : if left$(a$(x),len(n$))=n$ then w=1: pt(x)=x
- 920 next
- 930 :
- 940 goto760
- 950 :
- 960 rem --- search by phone ---
- 970 :
- 980 print"[147]enter phone to search for:"
- 990 gosub1360
- 1000 w=0
- 1010 for x=1 to z
- 1020 : if left$(p$(x),len(n$))=n$ then w=1: pt(x)=x
- 1030 next
- 1040 :
- 1050 goto760
- 1060 :
- 1070 rem --- save program to disk ---
- 1080 :
- 1090 print "[147]place program disk in drive--"
- 1100 gosub1300
- 1110 gosub2000: rem check for uptime disk
- 1120 if a=0 goto1240
- 1130 if a<>62 then print "[147]disk error"a;a$;t;s: gosub1300: goto270
- 1140 open15,8,15,"s0:database.old": rem scratch old version
- 1150 print#15,"r0:database.old=database": rem make current version old version
- 1160 close15
- 1170 :
- 1180 save "database",8
- 1190 :
- 1200 print chr$(9): goto 2100
- 1210 :
- 1220 rem --- uptime disk in drive ---
- 1230 :
- 1240 print"[147] *** do not use uptime disk ***
- 1250 [153]" *** insert a blank formatted disk ***
- 1260 gosub1300: goto270
- 1270 :
- 1280 rem --- press any key prompt ---
- 1290 :
- 1300 print" --- press any key to continue ---"
- 1310 get x$: if x$="" goto1310
- 1320 return
- 1330 :
- 1340 rem --- input without "?" ---
- 1350 :
- 1360 open 9,0: input#9,n$: close 9
- 1370 print "[147]";
- 1380 return
- 1390 :
- 1400 rem --- new record ---
- 1410 :
- 1420 open 9,0
- 1430 print "[147]enter new name:"
- 1440 input#9,nn$
- 1450 print: print "enter new address:"
- 1460 input#9,aa$
- 1470 print: print "enter new city/state/zip:"
- 1480 input#9,cc$
- 1490 print: print "enter new phone:"
- 1500 input#9,pp$
- 1510 close9
- 1520 z=z+1: dd=dd + 10
- 1530 x=peek(53281) and 15
- 1540 :
- 1550 print "[147] saving new data"
- 1560 :
- 1570 rem to make the dynamic screen technique invisible to the user, we change
- 1580 rem the text color to screen background color. we need to save the text
- 1590 rem color so we can change back when we re-run the program. a program
- 1600 rem variable won't do, because they are all reset with the "run" command.
- 1610 rem so, we poke it to location 1023 which is just beyond the screen memory
- 1620 rem line #180 in the main program gets it back.st beyond the screen memory
- 1630 rem so you can see the process, we've used a "rem" in line #1670.
- 1640 rem when you've seen how it works, remove the word "rem" and the dynamic
- 1650 rem screen will be invisible.
- 1660 :
- 1670 print "";: rem poke 1023,peek(646): poke 646,x
- 1680 :
- 1690 rem next we print a new line #150 on the screen. when the program is re-run
- 1700 rem the variable "z" will be set to the new number of records.
- 1710 :
- 1720 print "150 z=";z
- 1730 :
- 1740 rem next we print a new line #160, which holds the line number of the
- 1750 rem new data statement.
- 1760 :
- 1770 print "160 dd="; dd
- 1780 :
- 1790 rem now the new data statement
- 1800 :
- 1810 print dd;"data ";nn$;",";aa$;",";cc$;",";pp$
- 1820 :
- 1830 rem last, the command that re-runs the program starting at line #150
- 1840 :
- 1850 print "run 150": print ""
- 1860 :
- 1870 rem now we poke four "return's" into the keyboard buffer
- 1880 :
- 1890 poke 631,13: poke 632,13: poke 633, 13: poke 634, 13
- 1900 :
- 1910 rem and poke 4 to the index counter for the 4 "return" codes in the buffer
- 1920 :
- 1930 poke 198,4
- 1940 :
- 1950 rem the four returns add the lines and re-run the program just as if the
- 1960 rem user had typed the commands in direct mode.
- 1970 :
- 1980 end
- 1990 :
- 2000 rem --- check for uptime disk ---
- 2010 :
- 2020 close15: open15,8,15
- 2030 open2,8,2,"0:uptime,p,r"
- 2040 input#15,a,a$,t,s
- 2050 close2:close15
- 2060 return
- 2070 :
- 2080 rem --- return to uptime ---
- 2090 :
- 2100 poke 186,8
- 2110 sys (8*4096)+4
- 2120 :
- 2200 data uptime,po box 30008,shreveport la 71130-0008,318 221-5134
- 2220 data noel nyman,po box 58587,seattle wa 98188,
- 2230 data commodore,1200 wilson drive,west chester pa 19380,
- 2240 data compuserve,5000 arlington centre blvd,columbus oh 43220, 800 848-8990
-