Personal record keeping

From Ninerpedia
(Redirected from Enhanced Basic)
Jump to navigation Jump to search

The Personal Record Keeping (PRK) module enables you to store up to about 10k of data, and provides various handling and output facilities to help you manipulate your records.

A printer is useful but not essential. If you have a printer, greater flexibility of display, as well as additional functions, are provided with the Personal Report Generator module, which requires data prepared with the Personal Record Keeping module.

The PRK sorting routines are slow.

Data is saved in memory image ('program') format, and thus uses less tape (or disk) space, is faster to save and load, and the verify option is available for tape files.

You will not be able to catalog a collection of six thousand records, but small collections can be catalogued with the module . The number of items depends on how many characters you wish to use to describe each item.

It is possible to use the PRK module as a simple diary system, or as a very simple spreadsheet, as it is possible to perform mathematical operations on the data you place in your module.

Source

The module is written in BASIC, Klaus Lukaschek has published the source code. The BASIC code makes CALLS to GPL routines, which can also be used in TI Basic programs when the module is inserted.

The BASIC source code for both the Personal Record Keeping Module and the Statistics module (which was also written in BASIC) had been previously made available by Swedish user Jan Alexandersson, in January 1988.

Enhanced Basic

The Personal Record Keeping and the Statistics modules both extend the range of commands available in TI BASIC. This was not publicised. The term Enhanced Basic was given by Peter Brooks who published a great deal on the extra CALLs.

These extra commands are the only way in which a user can save data in PROGRAM format - used by most TI Modules. Program format permits tape verification, and uses a lot less space on your tape or disk.

A formal TI publication referring to the seven "alphabetic" calls has been released by TI and details on their usage is below.

CALLs to subprograms with names called ASCII HEX 04 to 0C were used in the PRK module (eg CALL >04(X) ) in addition to the alphabetic calls eg CALL A.

Listing or entering low ASCII values was difficult as it is not easy to enter, print or view for example CHR$(9) - however TI Writer was able to perfectly list the code on screen when LISTed to disk in DV80 format. Programs that write programs could be used to insert the low values in your own code.

The PRK and Statistics modules used the higher value CALLs identically, but the lower value calls differed. At the end of this article the coverage of the lower value calls is for PRK only.

With either module inserted, select TI BASIC. You may now use the following commands:

Screen Display CALL D

CALL D(R,C,L,V)

Where R and C are the row and column the word is to start at.
L is the length of screen to be blanked from position
R,C and also sets the maximum length of the display
V is a value or string or variable to be displayed.

If V is longer than L, the display will be curtailed.
R,C and L may be numbers or numeric variables.

Try:
CALL D(10,4,5,1/3)        

Input of data by user CALL A

CALL A(R,C,L,F,A,MN,MX)

R,C and L are as with CALL D, but in CALL A, L sets the
maximum length of the input.
F   MUST   be a NUMERIC VARIABLE. It takes a value of 1 if
ENTER is pressed, and other values if some control keys are used
eg BEGIN:6  REDO:4  AID:3  BACK:7  CLEAR:2
A is the numeric or string VARIABLE to be filled with the
input.
MN and MX are optional when using a numeric variable, and set
the minimum and maximum acceptable values: any input outside
these values is rejected.
      

NB: The CLEAR key is used to clear the input field. It WILL NOT break into the program! Use CALL A with a little care if you think you may need to BREAK the program!

For 99/4 keyboard mapping for the function keys see TI99/4 and 4a differences

Partition Memory CALL P

CALL P(N) - Partition

This CALL is required if we wish to interact in Basic with a PRK data file loaded into memory. It is not required if you just want to use CALL A or CALL D.

We have to reserve memory to place the PRK data into - it was saved as a memory block and must be loaded as a memory block. Using CALL P splits the memory so that the PRK data can reside safely on its own, and the remainder of memory can be used as normal for our Basic program.

In order to prepare or partition the RAM memory space in two sections the statement CALL P(N) has to be entered in the immediate mode as a first action after the TI BASIC READY prompt from the computer and must be followed by NEW.

Here for convenience we shall use MEM1 (normal RAM) and MEM2 (PRK file memory).

CALL P(N) use as N a number (constant) (an integer between -4 and 13821) which points to the spot in the RAM stack where OLD will start loading a BASIC program instead of what otherwise would have been the starting address reserved for OLD.


The memory space below this point is the thus created MEM2 and consists of N bytes to be used for PRK data.

normal memory:          PARTITIONED MEMORY:
 +-------------+        +----------------+  
 |              |        |                  | 
 |     usual    |        |  MEM1 (basic)   | 
 |     RAM      |        |  16000-N         | 
 |              |        |   bytes          | 
 |    16000     |  -N-  |-----------------| 
 |    bytes     |        | MEM2 (prk data) |     
 |              |        |  N bytes        | 
 +-------------+        +----------------+ 

If you need a large MEM2 (e.g. because a large PRK file has to be loaded) then N must he in the higher range. This obviously at the same time restricts the size of MEM1 for your Basic program.

If on the other hand you have a large TI Basic program or need to load a lot of "normal" data, but still you want to interact with a PRK file as well, then you are best off with a large MEM1 and a small MEM2 when in the CALL P(N) statement you assign a low value to N.

MEM1 is cleared and loaded with programs and data in the usual way with NEW, OLD, SAVE, INPUT and PRINT without affecting MEM2 in any way. PRK data are loaded in MEM2 with the statement:

CALL L("CS1",C) 
(or CALL L("DSK1.FILE",C))

resulting in the usual cassette prompts which will now read data previously generated by the PRK module in its normal mode.

An error message: ERROR DETECTED IN DATA may mean that MEM2 is not large enough to contain the PRK data and a new CALL P(N) with a higher N must be entered (and followed by NEW). The quickest and surest way to remove the previous CALL P is to switch the console off and on again.

Save Memory Image CALL S

CALL S("CS1",C)

C is a control variable that gets a value 0 if loading or saving has been successful. When an error has been detected the value of C in not equal to 0.

Instead of "CS1" also "DSK1.FILE" or "RS232" may be used for similar interaction with these devices.

Load Memory Image CALL L

CALL L("CS1",C)

C is a control variable that gets a value 0 if loading or saving has been successful.

When an error has been detected the value of C in not equal to 0.

Instead of "CS1" also "DSK1.file" or "RS232" may be used for similar interaction with these devices.

Define Data Header CALL H

It is easiest to amend the data header with the module, but here is the technical data for you. To change a file structure the Personal Report Generator module may be easier.

CALL H affects the header, i.e. those choices that the PRK does not permit you to alter, once you have okayed the file structure.

Changing the names of FILES and ITEMS is a cinch.

Changing the type or width if ITEMS is also easy, but the results are usually not the ones aimed for, because all data are written sequentially.


The syntax and parameters of CALL H are:

 Read mode: CALL H(1,INFO,ITEM,VALUE) 
 Write mode: CALL H(0,INFO,ITEM,VALUE) 
INFO Stands for 
   1 File name (maximum of 9 characters) 
   2 Day of the month 
   3 Month 
   4 Year 
   5 * Number of items per page 
   6 * Number of pages 
   7 * Length of header in bytes 
   8 * Length of each page in bytes 
   9 Item name (maximum of 9 characters) 
  10 Type of item (1 = char; 2 = integers; 3 = decimals; 4 = scientific) 
  11 Width of item 
  12 Number of decimal places 
  13 * Amount of memory required for this item in bytes 
  14 * Position of item in page 
* = this value is automatically calculated and placed by PRK mode 

The ITEM value is of no importance for those INFO values between 0 and 9

Setting up the header (i.e. file structure) is easiest in the module mode (Let's begin- create a file), but if you insist on doing this from TI Basic start with INFO 9 to 12 before going on to INFO 1-4.

Data field handling CALL G

Getput - there are several formats depending upon what you wish to do with CALL G.

The CALL G ( G for getput) statement has a write mode and a read mode.

In the write mode it enables the user to change PRK data, which might also have been changed using the normal procedures of the PRK module (change a page and mathematical transformations). VALUE may be a numeric or a string variable.

Write mode: CALL G (0,PAGE,ITEM,VALUE)


Read mode: CALL G(1,PAGE,ITEM,MIS,VALUE) 

MIS in read mode is a control variable: if data found then MIS=0. When no data found MIS=1.

If a string variable is used for VALUE (e.g. VALUE$) and the ITEM type was chosen as "characters", then strings can be handled.

CALL G(2,PAGE,ITEM,VALUE) writes "nothing" (=missing data) in the assigned place. The value or VALUE has no meaning.

Lower Value ASCII Calls

CALLs to subprograms with names called ASCII HEX 04 to 0C were used in the PRK module (eg CALL >04(X) ) in addition to the alphabetic calls eg CALL A.

The information below was provided by Swedish user Jan Alexandersson in 1988

CALL >04 is used to manage MEMORY

CALL >04(Z) where Z=max number of possible items

CALL >05 is for screen display

This is the workhorse routine of the module and is used for many purposes. ALL CAPITALS indicate the text that the CALL will display

CALL >05(P) where P is a number between 1 and 107. With this command You can write all screen displays. Some numbers make complete images and others do only a small addition to the present screen.

IMAGE DESCRIPTION.
1 DEFINE FILE.
2 LET'S BEGIN (defines also the arrows).
3 PRINT PAGES OR REPORT (yellow frame).
4 (QUIT)
5 PRINT PAGES OR REPORT (magenta frame).
6 CREATE A FILE.
7 DEFINE PAGE ITEMS.
8 ITEM TYPE (row 11-24).
9 MAX # OF DIGITS (row 14-24).
10 INCLUDE DECIMAL POINTS (row 14-24).
11 ERROR -SELECTED FILE EMPTY.
12 DECIMAL PLACES (row 14-24).
13 MAX # CHARACTERS (row 14-24).
14 LOAD A FILE.
15 ERROR -DATA FILE EMPTY.
16 FILE NAME (row 17-24).
17 FILE LOADED.
18 ERROR CANNOT ACCESS THE DEVICE..
19 ERROR INCORRECT DATA LOADED..
20 MAIN INDEX.
21 FILE STRUCTURE.
22 DISPLAY PAGE (green).
23 FORWARD, BACKWARD, PRINT, BACK (row 21-24).
24 ANALYZE PAGES.
25 ANALYSIS INDEX.
26 DISPLAY PAGE (yellow).
27 RE-ORDER PAGES.
28 ASCENDING ORDER, DESCENDING ORDER (row 22-23).
29 SORTING -PLEASE STAND BY (row 23-24).
30 DEFINE SELECTION CRITERIA.
31 LOW VALUE? (row 23-24).
32 HIGH VALUE? (row 23-24).
33 ANALYZE PAGE PASSING, ALL, ANY.
34 ADD PAGE.
35 CHANGE PAGES.
36 CHANGE A PAGE.
37 TRANSFORMATIONS INDEX 1.
38 MATH TRANSFORMATIONS.
39 WHICH ITEM IS A? (row 23-24).
40 IS B A CONSTANT (Y OR N)? (row 23-24).
41 WHICH ITEM IS B? (row 23-24).
42 VALUE OF B? (row 23-24).
43 IS C A CONSTANT (Y OR N)? (row 23-24).
44 WHICH ITEM IS C? (row 23-24).
45 VALUE OF C? (row 23-24).
46 CORRECT (Y OR N)? (row 24).
47 PRESS BACK TO STOP PRINTING, ENTER TO CONTINUE.
48 UPDATING -PLEASE STAND BY.
49 (erase row 6-20, col 16-30).
50 DELETE A PAGE.
51 ARE YOU SURE (Y OR N)?! (row 22).
52 PRINT FORMAT INDEX.
53 PRINT SELECTED ITEMS.
54 SAVE DATA.
55 TRANSFORMATIONS INDEX 2.
56 TRANSFORMATIONS INDEX 3.
57 LABEL TYPE.
58 ARE YOU THROUGH?.
59 LINEAR FIT X ITEM?.
60 Y ITEM? (row 22).
61 ITEM STATISTICS WHICH ITEM?.
62 SEARCH FOR A PAGE.
63 PAGE, FORWARD, BACKWARD,PRINT, BACK 
64-81 (mathematical transformations .
82 ITEM # FOR SELECTION? 
83 CHANGE PAGE IF IT MEETS, ALL, ANY .
84 PRESS BACK WHEN FINISHED .
85 PRESS ENTER TO CONTINUE (row 24).
86 WHICH ITEM DO YOU WHISH TO CHANGE? (row 23-24).
87 FILE STRUCTURE.
88 AID, PROC'D, PROC'D, BACK (row 21-24).
89 (erase row 3-24).
90 ITEM STATISTICS.
91 LINEAR FIT Y=A*X+B.
92 CHARACTER ITEM UNACCEPTABLE (row 24).
93 PRINTING DEVICE NAME? (row 12).
94 CHARACTER WIDTH OF THE PRINTING DEVICE? (row 16-17).
95 PRINTING HOLD DOWN ANY KEY TO STOP.
96 WHAT IS THE TITLE FOR THIS PRINTOUT? (row 20-21).
97 INSUFFICIENT DATA.
98 PRINTING DEVICE.
99 ASCENDING ORDER SORTING -PLEASE STAND BY (row 22-24).
100 DESCENDING ORDER SORTING -PLEASE STAND BY(row 22-24).
101 PRESS P TO PRINT SCREEN (row 22-24).
102 PRESS PROC'D, BACK (row 23-24).
103 PRESS PROC'D, ENTER, BACK (row 22-24).
104 ANALYZING PLEASE STAND BY.
105 (erase row 21-23).
106 PAGES AVAILABLE: (row 22-24).
107 NO PAGES LEFT.

CALL >06 DELETE

CALL >06(I) where I is the item that shall be erased. All items with higher number will also be renumbered..

CALL >07 SWAP

CALL >07(ITEMA,ITEMB,MAXITEM) is used when sorting where ITEMA and ITEMB changes place. I am not sure if the third number shall be max item or max item plus one because both seems to work. A lower value than max item will write the same item in two places..

CALL >08 PRINTER

CALL >08(PRINTER$,TEST) investigates if the printer exists. TEST=0 on unsuccessful try to open the printer and TEST=1 on successful try to open the printer i.e. printer with definitions according to PRINTER$ exists. This is only a test so you must open the printer later with a normal OPEN statement..

CALL >09

I have not been able to use this in BASIC..

CALL >0A TEXT

CALL >0A(NR,TEXT$) gives different text strings to TEXT$ according to NR the value of NR between 0 and 21. As an example CALL >0A(1,TEXT$) give TEXT$="CHAR"..

NR TEXT$.
0 PAGE #.
1 CHAR.
2 INT.
3 DEC.
4 SCI.
5 INDEX.
6 0 = PAGE #.
7 FILE:.
8 DATE:.
9 TITLE:.
10 ABS.
11 LOG10.
12 LOGE.
13 EXP.
14 ATAN.
15 TAN.
16 SIN.
17 COS.
18 INT.
19 SGN.
20 PI.
21 RND.

CALL >0B TRANSFORMATION

CALL >0B(T) is used for mathematical transformations where T is 0,1 or 2

This command need the variables @(CHAR 64), A(30), B(30), C(15) and D(15) in the BASIC program.

@=number of transformations. A() and B() is used for storing of transformations when they are read or written. T=0 for write and T=1 for read..

If You read with T=1 then the value of the variables does not matter. After read the variables A() and B() will contain the transformations and @=the number of transformations..

If You write with T=0 it is important that A(), B() and @ have the right values before the transformation. If You make this wrong then the file may crash if You try mathematical transformations within the module. T=2 writes A() and B() but not @ so I cannot see any use of that..

A(), B() and @ will be stored in the data file so all values will follow a SAVE and LOAD of the file. These variables can only write values 0-99 to the data file. If You never use mathematical transformations this is a way so store 61 different numbers between 0 and 99..

This command gives you a possibility to erase all transformations and also to add transformations. If You use the module as TI have thought this is not possible because new transformations will erase all previously stored.

CALL >0C SCREENDUMP

CALL >0C(ROWS,PRINTER$,TEST) writes the number of ROWS to a printer where ROWS=1-24. The number of rows is counted from the top of the screen but only 28 characters width will be printed so col 1-2 and 31-32 will not be printed. TEST=0 when the print was unsuccessful and TEST=1 on successful print..

Transferring PRK data to a Display Variable disk file for TI Writer

This BASIC program requires a Personal Record Keeping module and a disk drive with disk controller.

Console set up:

Insert PRK module and then select TI BASIC (Stats module may also be used)
FIRST: Is disk drive connected? Set buffer location with CALL FILES(1) then NEW -
THEN: type CALL P(10900) then type NEW
Console memory is now set up

RESTRICTIONS:

The disk system and this program use up memory.

It may be necessary to delete some records from the PRK file to be transferred if the PRK file fully utilises system memory.


99 REM Load the PRK file
100 CALL L("DSK1.PRKFILE",Y)
102 REM is file loaded?
110 IF Y=0 THEN 320
111 REM NOW open output file
112 REM NB: do not open output file until after Call L !
120 OPEN #1:“DSK1.TIH_FILE“,DISPLAY,VARIABLE 80
121 REM How many fields in each record?
130 CALL H(1,5,0,F)
140 PRINT "FIELDS":F
141 REM How many records (pages)?
150 CALL H(1,6,0,R)
160 PRINT "RECORDS":R
161 REM Now loop: through each record:
170 FOR J=1 T0 R
171 REM and through each field in turn
180 FOR T=1 TO F
181 REM Is the field a number or a string?
190 CALL H(1,10,T,TP)
200 IF TP=1 THEN 240
201 REM for numeric data:
202 REM get the data in record J,. field T
210 CALL B(1,J,T,Z,RD)
211 REM and print it to disk
220 PRINT #1:RD 
230 GOTO 270
231 REM for string variable data:
240 CALL G(1,J,T,Z,RD$)
250 PRINT J;T;RD$
260 PRINT #1:RD$
270 NEXT T
271 REM insert spacing as required
280 PRINT #1:" "::: 
290 NEXT J
300 CLOSE #1
310 END
320 PRINT "NOT LOADED“

If required, string and numeric data can be concatenated to the preferred format before printing to disk. Read each required field, concatenate, and print.

Each print to disk should be considered as one TI Writer line:

Use of pending outputs is to be avoided, as is the use of a semi colon print divider, due to the complex requirements of DISPLAY format.