home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 026-050 / apd035 / archivepal.bak / archivepal.amosSourceCode
AMOS Source Code  |  1978-08-29  |  11KB  |  493 lines

  1. SET
  2. Procedure SET
  3.    Break Off 
  4.    Led On 
  5.    Hide On 
  6.    Screen Open 0,640,248,2,Hires
  7.    Curs Off 
  8.    Flash Off 
  9.    Close Editor 
  10.    FRONT_END
  11. End Proc
  12. Procedure KEYTEST
  13.    1 X$=Inkey$
  14.    If Key State(95)=True Then HELP
  15.    If Key State(69)=True Then INFO
  16.    If X$="a" Then APPE
  17.    If X$="A" Then APPE
  18.    If X$="C" Then CHANGE
  19.    If X$="c" Then CHANGE
  20.    If X$="D" Then Cls : DI
  21.    If X$="d" Then Cls : DI
  22.    If X$="q" Then QUIT
  23.    If X$="Q" Then QUIT
  24.    If X$="e" Then TIDE
  25.    If X$="E" Then TIDE
  26.    If X$="K" Then KIL
  27.    If X$="k" Then KIL
  28.    If X$="v" Then WEIVC
  29.    If X$="V" Then WEIVC
  30.    If X$="" Then Goto 1
  31.    Goto 1
  32. End Proc
  33. Procedure WEIVC
  34.    16 Cls 
  35.    Centre "File view options."
  36.    Print 
  37.    Print 
  38.    Print "Press one of the following keys"
  39.    Print 
  40.    Print "A to view all the records in a file"
  41.    Print "B to view selected records"
  42.    Print "C to view individal records"
  43.    Print "<HELP> for a full explanation"
  44.    Print "<SPACE> to return to main menu"
  45.    14 X$=Inkey$
  46.    X$=Upper$(X$)
  47.    If X$="A" Then WEIV
  48.    If X$="B" Then WEIVS
  49.    If X$="C" Then WEIVI
  50.    If X$=" " Then FRONT_END
  51.    If Key State(95)=True Then WEIVH
  52.    Goto 14
  53. End Proc
  54. Procedure WEIVH
  55.    Cls 
  56.    Bell 
  57.    Centre "View help"
  58.    Print 
  59.    Print 
  60.    Print " This part of Archivist allows you to see what you have put into your files."
  61.    Print "You can view any part of any file by selecting the correct option at the."
  62.    Print "menu.  The options are:"
  63.    Print 
  64.    Print " Pressing `a' will let you view the whole file"
  65.    Print " Pressing `b' will let you view a small, self-defined number of records e.g.10"
  66.    Print " Pressing `c' will let you view one individual record out of a file"
  67.    Print 
  68.    Print "I hope It's all straight forward."
  69.    Print 
  70.    Centre "Press any key to return to view menu."
  71.    Print 
  72.    For N=0 To 100
  73.    Next N
  74.    Wait Key 
  75.    WEIVC
  76. End Proc
  77. Procedure WEIVS
  78.    Cls 
  79.    On Error Proc VIWE
  80.    Print "Small number of records"
  81.    Print 
  82.    15 Input "Which file ";F$
  83.    If F$="" Then Goto 15
  84.    Open In 1,F$+".NUM"
  85.    Input #1,A
  86.    Close 1
  87.    Print A;" records in file"
  88.    Print 
  89.    Input "How many records ";M
  90.    Print 
  91.    18 Input "Starting at which record ";R
  92.    R$=Str$(R)
  93.    If R$="" Then Goto 18
  94.    For N=R To R+M
  95.       N$=Str$(N)
  96.       Open In 1,F$+N$
  97.       Input #1,A$
  98.       Print "Record number";N;" in file ";F$;" is ";A$
  99.       Close 1
  100.    Next N
  101.    Print 
  102.    Centre "Press any key to return to view menu"
  103.    Print 
  104.    Wait Key 
  105.    Goto 16
  106. End Proc
  107. Procedure WEIVI
  108.    On Error Proc VIWE
  109.    Cls 
  110.    Print "Individual file viewing"
  111.    Print 
  112.    17 Input "Which file to view ";F$
  113.    If F$="" Then Goto 17
  114.    Open In 1,F$+".NUM"
  115.    Input #1,L
  116.    Close 1
  117.    Print "There are";L;" records in file ";F$
  118.    Print 
  119.    19 Input "Which record do you want to view ";N
  120.    N$=Str$(N)
  121.    If N$="" Then Goto 19
  122.    Open In 1,F$+N$
  123.    Input #1,I$
  124.    Close 1
  125.    N=Val(N$)
  126.    Print "Record ";N;" in file ";F$;" is ";I$
  127.    Print 
  128.    Centre "Press any key."
  129.    Print 
  130.    Wait Key 
  131.    Cls 
  132.    Goto 16
  133. End Proc
  134. Procedure WEIV
  135.    On Error Proc VIWE
  136.    Cls 
  137.    3 Print "Enter filename to view."
  138.    Input V$
  139.    If V$="" Then Goto 3
  140.    Open In 2,V$+".NUM"
  141.    Input #2,A
  142.    Close 2
  143.    Print A;" records in file"
  144.    For N=1 To A
  145.       A$=Str$(N)
  146.       Open In 2,V$+A$
  147.       Input #2,N$
  148.       Print "Record number";N;" in file is ";N$
  149.       Close 2
  150.    Next N
  151.    Print "Closing file viewed"
  152.    Print 
  153.    Centre "Press any key to continue."
  154.    Print 
  155.    Wait Key 
  156.    Cls 
  157.    Goto 16
  158. End Proc
  159. Procedure VIWE
  160.    Print 
  161.    Centre "File, or record in file, does not exist"
  162.    Print 
  163.    Centre "Press any key to return to menu"
  164.    Print 
  165.    Print 
  166.    Wait Key 
  167.    FRONT_END
  168. End Proc
  169. Procedure CHANGE
  170.    Cls 
  171.    On Error Proc CHANGEE
  172.    Print "File name to change"
  173.    Input V$
  174.    Open In 2,V$+".NUM"
  175.    Input #2,B
  176.    Close 2
  177.    Print B;" records in file"
  178.    For N=1 To B
  179.       A$=Str$(N)
  180.       Open In 2,V$+A$
  181.       Input #2,N$
  182.       Print "Record number";N;" in file is ";N$
  183.       Close 2
  184.    Next N
  185.    Print "Change which file number"
  186.    Input C
  187.    C$=Str$(C)
  188.    Open In 3,V$+C$
  189.    Input #3,A$
  190.    Close 3
  191.    Print "Current value of record";C;" is:";A$
  192.    Print 
  193.    Print "New value for record";C;" is:"
  194.    Input A$
  195.    Led Off 
  196.    Open Out 4,V$+C$
  197.    Led On 
  198.    Print #4,A$
  199.    Led Off 
  200.    Close 4
  201.    Led On 
  202.    Print "Any more (y/n)"
  203.    7 X$=Inkey$
  204.    If X$="Y" Then CHANGE
  205.    If X$="y" Then CHANGE
  206.    If X$="" Then Goto 7
  207.    FRONT_END
  208. End Proc
  209. Procedure CHANGEE
  210.    Print 
  211.    Print 
  212.    Centre "Can't do that."
  213.    Print 
  214.    Centre "Press any key to return to main menu."
  215.    Wait Key 
  216.    FRONT_END
  217. End Proc
  218. Procedure KIL
  219.    On Error Proc KILE
  220.    Cls 
  221.    Print "Filename of file to delete"
  222.    Input K$
  223.    Open In 1,K$+".NUM"
  224.    Input #1,A
  225.    Close 1
  226.    Print "Kill ";K$;". Sure (y/n)"
  227.    Input Y$
  228.    If Y$="y" Then Goto 5
  229.    If Y$="Y" Then Goto 5
  230.    FRONT_END
  231.    5 For N=1 To A
  232.       Led Off 
  233.       N$=Str$(N)
  234.       Print "Record";N$;" deleted."
  235.       Kill K$+N$
  236.       Led On 
  237.    Next N
  238.    Kill K$+".NUM"
  239.    Print 
  240.    Print 
  241.    Centre "Deletion completed. Press a key to return to main menu."
  242.    Print 
  243.    Wait Key 
  244.    FRONT_END
  245. End Proc
  246. Procedure KILE
  247.    Print 
  248.    Centre "File does not exist on this disk. Press any key to return to main menu."
  249.    Print 
  250.    Wait Key 
  251.    FRONT_END
  252. End Proc
  253. Procedure DI
  254.    On Error Proc DIE
  255.    Print "Which drive? (df0/df1/df2/dh0/dh1/dh2/di0/di1 etc)"
  256.    Input D$
  257.    If Left$(D$,3)<>":" Then D$=D$+":"
  258.    Dir D$
  259.    Print 
  260.    Print 
  261.    Centre "Press any key to continue."
  262.    Print 
  263.    Wait Key 
  264.    FRONT_END
  265. End Proc
  266. Procedure DIE
  267.    Print 
  268.    Centre "Unavailable. Device (or volume) not mounted."
  269.    Print 
  270.    Centre "Press any key to return to main menu."
  271.    Print 
  272.    Wait Key 
  273.    FRONT_END
  274. End Proc
  275. Procedure APPE
  276.    Cls 
  277.    On Error Proc APPEE
  278.    Print "Filename of file to add on to"
  279.    Input F$
  280.    Open In 1,F$+".NUM"
  281.    Input #1,A
  282.    Close 1
  283.    Print "There are";A;" records in file ";F$
  284.    Print "How many more do you want to add on?"
  285.    Input B
  286.    For N=A+1 To A+B
  287.       Led Off 
  288.       N$=Str$(N)
  289.       Print "Value for record number";N;" is"
  290.       Input C$
  291.       Led On 
  292.       Open Out 1,F$+N$
  293.       Print #1,C$
  294.       Close 1
  295.    Next N
  296.    Open Out 1,F$+".NUM"
  297.    Print #1,A+B
  298.    Close 1
  299.    Print 
  300.    Print 
  301.    Centre "Press any key to return to main menu."
  302.    Print 
  303.    Wait Key 
  304.    FRONT_END
  305. End Proc
  306. Procedure APPEE
  307.    Print 
  308.    Print 
  309.    Centre "Can't do that. Sorry"
  310.    Print 
  311.    Print 
  312.    Centre "Press any key to return to menu"
  313.    Print 
  314.    Wait Key 
  315.    FRONT_END
  316. End Proc
  317. Procedure HELP
  318.    Bell 
  319.    Cls 
  320.    Print 
  321.    Print "ELP...HELP...HELP...HELP...HELP...HELP...HELP...HELP...HELP...HELP...HELP...HE"
  322.    Print 
  323.    Print " Pressing `a' will add on to any file"
  324.    Print " Pressing `c' will change any record in any file on disk"
  325.    Print " Pressing `d' will show the directory of the disk in any drive."
  326.    Print " Pressing `e' will edit a record."
  327.    Print " Pressing `k' will delete (KILL) any file you have created."
  328.    Print " Pressing `q' will quit the program."
  329.    Print " Pressing `v' will view any number of records in any file. See view help."
  330.    Print " Pressing <HELP> on the main menu will give you this help screen."
  331.    Print " Pressing <ESC> on the main menu will give you information about this program"
  332.    Print "it's idea, and other irrelevant information"
  333.    Print "There is a demo file on this disk, called DEMO. View it, Add to it or delete it"
  334.    Print "But if you do decide to pass this program on, please re-create the file."
  335.    Print 
  336.    Print 
  337.    Centre "Press any key to continue."
  338.    Wait Key 
  339.    Cls 
  340.    FRONT_END
  341. End Proc
  342. Procedure FRONT_END
  343.    Cls 
  344.    Shared R$,F$,FILEN
  345.    Centre "Archivist"
  346.    Print 
  347.    Centre "---------"
  348.    Print 
  349.    Centre "MAIN MENU"
  350.    Print 
  351.    Print 
  352.    Print "Press one of the following keys:"
  353.    Print "A to add to a file"
  354.    Print "C to change any record"
  355.    Print "D to see the directory of any drive"
  356.    Print "E to edit a record"
  357.    Print "K to delete a file"
  358.    Print "Q to quit"
  359.    Print "V to view records"
  360.    Print "<HELP> to read help"
  361.    Print "<ESC> for info on Archivist"
  362.    Print 
  363.    Print "Chip memory=";Chip Free;" bytes"
  364.    Print "Fast memory=";Fast Free;" bytes"
  365.    KEYTEST
  366. End Proc
  367. Procedure QUIT
  368.    Cls 
  369.    Break On 
  370.    Print "Quit. Sure? (y/n)"
  371.    2 Y$=Inkey$
  372.    If Y$="y" Then 6
  373.    If Y$="Y" Then 6
  374.    If Y$="n" Then FRONT_END
  375.    If Y$="N" Then FRONT_END
  376.    If Y$="" Then Goto 2
  377.    6 Cls 
  378.    Print "Bye"
  379.    Set Rainbow 0,1,64,"(,8,)","",""
  380. End Proc
  381. Procedure INFO
  382.    Bell 
  383.    Cls 
  384.    Print 
  385.    Centre "Archivst V1.0"
  386.    Print 
  387.    Centre "-------------"
  388.    Print 
  389.    Print "  This program is Archivist. Archivist is a simple little data storage program."
  390.    Print "It will store any data that you have as a sequential data file on disk."
  391.    Print "   I had the idea for this when I needed a small program to store some results"
  392.    Print "as part of a maths project I was doing at the time.  I had just bought a copy "
  393.    Print "of AMOS at that time and had two choices. I could buy a database and save time,"
  394.    Print "or use AMOS to store my data and save money. I wasn't rich (and still aren't)"
  395.    Print "so I looked to AMOS to try to find a way of storing the data in such a way that"
  396.    Print "I could get at any record easily.  I looked at this, and when I found a viable"
  397.    Print "program,I decided to release it into the unsuspecting PD market, through"
  398.    Print "Mandarin as perhaps the first utility written in AMOS."
  399.    Print "   People are more than welcome to load this file into their copies of AMOS and"
  400.    Print "and correct it any way they seem fit, but please read the acompianing .DOC file"
  401.    Print 
  402.    Print "P.S. Watch that power light!"
  403.    Print 
  404.    Print "P.P.S. Archivist has a small bug on the chamnge command so just be careful!"
  405.    Print 
  406.    For N=1 To 100
  407.    Next N
  408.    Centre "More-Press any key."
  409.    Print 
  410.    Wait Key 
  411.    Cls 
  412.    Print "This program is Public Domain software.If you have any comments about Archivist"
  413.    Centre "then send them to:"
  414.    Print 
  415.    Print 
  416.    Centre "Steven Harrison"
  417.    Print 
  418.    Centre "62 Vyner Street,"
  419.    Print 
  420.    Centre "Haxby Road,"
  421.    Print 
  422.    Centre "York."
  423.    Print 
  424.    Centre "YORKSHIRE"
  425.    Print 
  426.    Centre "ENGLAND"
  427.    Print 
  428.    Centre "YO3 7HS"
  429.    Print 
  430.    Print 
  431.    Centre "OR"
  432.    Print 
  433.    Print 
  434.    Centre "Steven Harrison"
  435.    Print 
  436.    Centre "Clifton House (5th year)"
  437.    Print 
  438.    Centre "St Peters School"
  439.    Print 
  440.    Centre "Bootham"
  441.    Print 
  442.    Centre "York"
  443.    Print 
  444.    Centre "YORKSHIRE"
  445.    Print 
  446.    Centre "ENGLAND"
  447.    Print 
  448.    Centre "YO3 6AB"
  449.    Print 
  450.    Print 
  451.    Print 
  452.    Centre "Press any key to return to main menu."
  453.    Wait Key 
  454.    FRONT_END
  455. End Proc
  456. Procedure TIDE
  457.    Shared F$,L
  458.    On Error Proc TIDEE
  459.    Cls 
  460.    Print "Filename of file"
  461.    Input F$
  462.    Print "How many records required"
  463.    Input R
  464.    Open Out 2,F$+".NUM"
  465.    Print #2,R
  466.    Close 2
  467.    For N=1 To R
  468.       N$=Str$(N)
  469.       Open Out 1,F$+N$
  470.       Print "Record ";N;" is"; : Input I$
  471.       Print #1,I$
  472.       Close 1
  473.    Next N
  474.    Print 
  475.    Print 
  476.    Centre "Input completed. Press any key to return to main menu."
  477.    Print 
  478.    Print 
  479.    Wait Key 
  480.    FRONT_END
  481. End Proc
  482. Procedure TIDEE
  483.    Print 
  484.    Print 
  485.    Centre "Oops, my fault."
  486.    Print 
  487.    Centre "But I can't help it."
  488.    Print 
  489.    Centre "Press any key to return to main menu"
  490.    Print 
  491.    Wait Key 
  492.    FRONT_END
  493. End Proc