home *** CD-ROM | disk | FTP | other *** search
/ Between Heaven & Hell 2 / BetweenHeavenHell.cdr / 100 / 31 / timecalc.doc < prev    next >
Text File  |  1983-03-01  |  15KB  |  328 lines

  1.                     DOCUMENTATION FOR TIMECALC.BAS
  2.  
  3.             Copyright 1983 Ny Michael Csontos
  4.                       3228 Livonia Center Road
  5.                       Lima, New York 14485
  6.  
  7.  
  8.         INTRODUCTION
  9.  
  10.     This program was written as a means of gaining experience working
  11. with the IBM Color/Graphics Adapter display buffer in the alphanumeric mode.
  12. Therefor the Color/Graphics Adapter must be present for it to run.
  13.  
  14.     The program is a calculator for time units in which each entry and
  15. result appears at fixed screen locations. Data is entered and read directly
  16. to and from the screen buffer thus making data handling similar to that in a
  17. pocket calculator. All calculations are made in double precision to accomodate
  18. the range of a millisecond to a century.
  19.  
  20.         PROGRAM OPERATION
  21.  
  22.     THE DESCRIPTION SCREEN
  23.  
  24.     When the program is run you will first be presented with a screen
  25. of general information. It will tell you, among other things, that you can 
  26. program the function keys in BASIC in the direct mode before running the
  27. program. You may then press <Esc> to return to BASIC to do this or any other 
  28. key to continue.
  29.  
  30.     <Esc> will end the program any time an input is requested. Since you
  31. may use the printer for some functions, the end routine tries to reset the
  32. printer for compressed print. If there is no printer present, the program 
  33. will just end. However if the printer is present but off-line, you will get
  34. the DOS printer time-out delay before the BASIC prompt appears on the screen.
  35.  
  36.     If you return to BASIC to program a function key, the procedure is
  37. as follows: Without a line number, just type
  38.  
  39.         KEY n, "d...d"       <Enter>
  40.  
  41. where n is the number of the function key and d...d is the number you want
  42. to enter on the screen whenever you press the key. If you do not program the
  43. keys they will retain whatever functions they had for the BASIC editor.
  44.  
  45.     If you use this program often and want to skip the introductory screen,
  46. list lines 10300 and 15300. They should be:
  47.  
  48. 10300 'GOTO 11600'------------------temporary skip description screen------
  49.  
  50.             and
  51.  
  52. 15300 'GOTO 15900'------------------temporary skip to data screen----------
  53.  
  54. If they are not, the program has been renumbered by someone and the GOTO's are
  55. wrong. You would have to find new line numbers for the GOTO's. If the lines
  56. are correct, just delete the first of the two "'"'s in each one to go straight
  57. to the data screen from RUN.
  58.  
  59.     THE DATA SCREEN
  60.  
  61.     The upper part of the data screen provides fields to enter time, 
  62. function, or a constant for multiplication or division. You address a field
  63. by moving the "<" symbol with the cursor control keys. Numbers are entered
  64. from the right-hand end of the field as on most calculators. The backspace
  65. and delete keys remove characters one at a time. The exception to this is the
  66. function line, where the function is selected by pressing the space bar.
  67.  
  68.     In order to allow the use of the numeric keypad for number entry, the
  69. cursor functions are duplicated with the function keys. <Alt>+<F7> is cursor
  70. left, <Alt>+<F8> is cursor right, <Alt>+<F6> is cursor up, <Alt>+<F10> is
  71. cursor down, and <Alt>+<F9> is Delete. Of course <shift> plus the numeric
  72. keypad key in numeric mode will also give the cursor function.
  73.  
  74.     The entries are not limited to the number of digits indicated by the
  75. size of the fields on the initial data screen. Up to ten characters may be
  76. entered into any field. The field will expand to the appropriate size.
  77. Entries may be any decimal number of ten characters or less. 1234567890 or 
  78. 12345.6789 or .000012345 are ok in any field. Double precision calculations
  79. carry about 15 decimal digits, however the last three are subject to round-
  80. off error. Use caution in interpreting the results if you mix years and
  81. milliseconds in the same calculation.
  82.  
  83.     To start a calculation, press <enter>. The information visible on the
  84. screen is read and processed and the result is presented in the result section
  85. of the screen.
  86.  
  87.     RESULTS
  88.  
  89.     Processed data is presented in several ways. First in fields  similar 
  90. to the entry format. Then as whole numbers of weeks, dys, hours, or minutes
  91. with the rest of the units broken down. Finally as decimal fractions of years,
  92. weeks, days, hours, minutes, or seconds.  
  93.  
  94.     All of the data is rounded to single precision except the seconds
  95. displayed in the lower right-hand corner. This is left double precision
  96. to be compared with the seconds listed in the lower right-hand corner. Any
  97. difference in the two indicates that round-off error has been significant. The 
  98. results should be accurate to within two decimal places of where the two
  99. seconds results differ.
  100.  
  101.     The calculations are made by performing the function selected on each
  102. unit individually, then converting all of the units to seconds, then 
  103. recalculating all of the units from the resulting seconds. This minimises
  104. the round-off error which would result from sobtacting seconds from years.
  105.  
  106.     If no function has been selected and there is data on the first entry
  107. line, the program breaks down the entry into units as when the breakdown 
  108. function is selected. If you try to make a subtraction that would result in
  109. a negative time you are prompted to use a function key that reverses the
  110. entries.
  111.  
  112.     LENGTH OF YEAR
  113.  
  114.     This program assumes a 365 day year. It is not possible t
  115. consistantly take leap years into account since a time span of three days
  116. may include a February 29 while another of 4 years, 11.9 months may not. Thus
  117. when you are entering times involving years, keep the 365 day year in  ind
  118. and add the appropriate number of days in needed.
  119.  
  120.     An exception to this is the date calculation (see <Ctrl>+<F7> below).
  121. This function will automaticly insert an extra day for every four years in
  122. the YEARS units of the result. It also will take February 29ths into account
  123. when incrementing the date by days and weeks.  If you are using the date
  124. calculation as more than an estimate, then do some careful checking of the
  125. result of <Ctrl>+<F7> or <Ctrl>+<F8>.
  126.  
  127.     THE FUNCTION KEYS
  128.  
  129.     As mentioned above you may program the straight <F1> to <F10> keys
  130. to enter constants. However most of the <Alt>, <shift>, and <Ctrl> function
  131. key functions are also used by this program.
  132.  
  133.         <Alt>+<F1>  LIST KEYS
  134.  
  135.     This key will scroll through all of the function key functions on
  136. line 25 of the screen. A prompt to use this key is displayed on line 25 after
  137. each calculation. Since the message for this key is the same as the prompt
  138. it may appear that nothing happens until second press of <F1>.
  139.  
  140.         <Alt>+<F2> CLEAR FIELD
  141.  
  142.     The field at the "<" location is erased. This may be faster than
  143. holding down the <Del> or backspace keys. It has no effect on the function
  144. selection field.
  145.  
  146.         <Alt>+<F3> RESULT TO INPUT 1
  147.  
  148.     The results of the last calculation as they appear on the second line
  149. of the result section of the screen will be transfered to the first of the 
  150. entry lines of the screen. They may then be used for additional calculations.
  151.  
  152.         <Alt>+<F4> CLEAR LINE
  153.  
  154.     Erases the entire contents of the line containing the "<" pointer.
  155. This clears it for the entry of new data. It does not clear the function line.
  156.  
  157.         <Alt>+<F5> RESULT TO INPUT 3
  158.  
  159.       The same as <Alt>+<F3> above except that the result goes to the last
  160. data entry line.  This transfer is made even if the line is invisible because
  161. multiply, divide, or breakdown have been selected. The transfered data will
  162. be available when "+" or "-" are selected.
  163.  
  164.         <Alt>+<F6> through <Alt>+<F10> CURSOR CONTROL
  165.  
  166.     These allow the use of the numeric keypad for data entry. See the 
  167. Data Screen section above.
  168.  
  169.         <shift>+<F1> AND <shift>+<F2> SAVE DATA 1
  170.  
  171.     These keys allow you to keep the entire first data line in memory for
  172. repeated use. <shift>+<F1> stores the data and <shift>+<F2> retreives it.
  173.  
  174.         <shift>+<F3> and <shift>+<F4> SAVE CONSTANT
  175.  
  176.     Same as for <shift>+<F1> and <shift>+<F2> above but for the constant
  177. used for multiplication or division. This function operates even if the line
  178. is invisible because you have selected "*", "/", or breakdown.
  179.  
  180.         <shift>+<F5> and <shift>+<F6> SAVE DATA 3
  181.  
  182.     These store and retreive respectively the data on the last time data
  183. entry line. They also work even if the line is not displayed. All save 
  184. functions use different memory locations so may be used independantly.
  185.  
  186.         <shift>+<F7> and <Shift>+<F8> SAVE RESULT
  187.  
  188.     The result line is stored and retreived respectively by these keys. 
  189. The result may then be transfered to either of the entry fields for further
  190. calculations.
  191.  
  192.         <shift>+<F9> PRINT CALCULATION REPORT
  193.  
  194.     The printer will print a dump of all of the double precision results
  195. of the last calculation. This may be useful to interpret rounding errors or
  196. to make full use of the precision available.  The numbers are in the form
  197. 0.nnnnnnnnnnnnnnnD±ee. The decimal point must be moved the number of places
  198. and in the direction indicated by the sign ("±") to the right of the D.
  199.  
  200.     The first section of the report lists the input as entered and the
  201. result. The second section lists individual units of years to seconds as
  202. decimal fractions. Each number is the total value of the result. The third
  203. section lists the largest whole units of the result for each of the units.
  204. This is like an INT function for time units.
  205.  
  206.     An EPSON MX-80 printer is assumed and its control characters are used.
  207. If no printer is present this function will be inactive. If a printer is 
  208. present but off line, there will be a delay equal to the DOS printer error 
  209. time-out before the program will continue. An error message will be flashed
  210. briefly on screen line 25.
  211.  
  212.  
  213.         <shift>+<F10> PRINTER LOG
  214.  
  215.     This key is a toggle function; i.e., the first time it is pressed
  216. it turns the function on, the next time it turns it off. When on, it makes
  217. the printer print a line for each calculation listing the input data and 
  218. result in a compact form in compressed print. It can substitute for a pencil
  219. and notebook. 
  220.  
  221.     If there is no printer it will flash an error message, but if the
  222. printer is off-line, there will be the time-out delay.
  223.  
  224.         <Ctrl>+<F1> EXCHANGE INPUT
  225.  
  226.     There are several times when it is necessary to exchange the input
  227. data, as when subtraction would produce negative time or when this program
  228. is used as a timer. <Ctrl>+<F1> acomplishes this.
  229.  
  230.         <Ctrl>+<F2> PRINT FUNCTION KEY TABLE
  231.  
  232.     The printer will print a list of all of the function key functions
  233. on an 8½" x 11" page. The list barely fits so align the paper carefully. 
  234. Double spacing was used to allow for notes and underlining.
  235.  
  236.         <Ctrl>+<F3> and <Ctrl>+<F4> ENTER CURRENT TIME
  237.  
  238.     This function will read the BASIC [TIME$] function and enter the hours,
  239. minutes, and seconds data from it on the first and the last time input data
  240. lines respectively. Of course this only will be correct if TIME in DOS was 
  241. initialized when the computer was turned on or the direct command:
  242.  
  243.         TIME$="hh:mm:ss"
  244.  
  245. was entered before this program was run.
  246.  
  247.     The program keeps updating the time until <enter> is pressed. If a
  248. function is selected that requires time to execute, the display will not be
  249. updated until the function ends but then will be current. The resolution of
  250. the time information is slightly less than one second since the updating
  251. routine takes about 3/4 second to execute.
  252.  
  253.     This time entry function allows the program to be used as a stopwatch.
  254. Set the function for subtraction. Press <Ctrl>+<F4> to display the current
  255. time on the last data line. Start timing by pressing <Ctrl>+<F3>. End timing
  256. by pressing <enter>. The elapsed time (±1 sec.) will be displayed in the
  257. result section.
  258.  
  259.         <Ctrl>+<F5> and <Ctrl>+<F6> ENTER DATE
  260.  
  261.     These keys use the BASIC [DATE$] function to enter the number of days
  262. from the start of the year to the current date into the days data field of the
  263. first and last data lines respectively. This may be useful if the program
  264. is used for scheduling or planning purposes.
  265.  
  266.     Of course the DATE function in DOS must have been initialized for
  267. the date entered to be correct.
  268.  
  269.         <Ctrl>+<F7> and <Ctrl>+<F8> CONVERT RESULT TO DATE
  270.  
  271.     These functions add the result to the start of the current year or to
  272. the current date and calculate a new date from this.  The date is displayed
  273. on the last line of the result part of the screen display.  The DOS [DATE]
  274. must be properly set for this calculation to be correct.
  275.  
  276.     The date calculation attempts to take leap years into account. Weeks
  277. and days in the result are converted into days and the BASIC [DATE$] function
  278. is used to increment the date the required number of days. The number of
  279. years is added to the year of the date and the number of leap-years in that
  280. time span is added to the days count.  Nevertheless since time span 
  281. calculations (based on 365 day years) may not have been consistant with 
  282. this method, dates should be considered estimates only.
  283.  
  284.         <Ctrl>+<F9> and <Ctrl>+<F10> are unassigned
  285.  
  286.  
  287.  
  288.         MISCELLANEOUS
  289.  
  290.     This program uses a considerable amount of memory for storing strings
  291. of characters. Although it was developed on a 64k system, if you use all of
  292. the special functions, especially the save functions, you may run out of
  293. string space in a 64K memory especially if you use additions to DOS like the
  294. key redefinition program "FK". If this happens, either load a minimal version
  295. of DOS or use the function keys sparingly.
  296.  
  297.     No specific application was planned for this program. Timing record
  298. selections, calculating timings for tape recordings, planning production
  299. schedules, or figuring out how many minutes till you retire are some
  300. suggestions. The author does not guarantee the accuracy of the results. In
  301. writing this program he came to appreciate why Dr. Who has so much trouble
  302. landing when he expects to.
  303.  
  304.  
  305.  
  306.                      ---***---
  307.  
  308.  
  309.     The program TIMECALC.BAS and the file TIMECALC.DOC are
  310.     made freely available for non-exclusive distribution
  311.     to members of the Picture City Personal Computer
  312.     Programing Club and through software exchange with
  313.     other users' groups as long as the author and (PC)^3
  314.     are fully credited.
  315.  
  316.  
  317.  
  318.         This disk copy was originally provided by "The Public Library",
  319.         the software library of the Houston Area League of PC Users.
  320.         Disks in the Public Libray are updated monthly.  Check with us
  321.         for the latest versions of all programs.
  322.  
  323.         Programs are available from the Public Library at $2 per disk
  324.         on user-provided disks.  To get a listing of the disks in the
  325.         Public Library, send a self-addressed, stamped envelope to
  326.  
  327.              Nelson Ford,  P.O.Box 61565,  Houston, TX 77208.
  328.