[ Go to Stephen's Entry Page ]

[ TI Book front page   |   TI Resources Page   |   Lots of TI articles   |   Programs for emulators ]

contact - please use subject="pc99 page" to avoid spam trap!

PERSONAL RECORD KEEPING Basic Calls and Source code

This long page contains a selection of articles by Jan Alexandersson of Sweden published in 1988, on the Personal Record Keeping Module for the TI99/4a Home Computer. The module source was written in BASIC with CALLs to GPL routines - the CALLs are available from your own TI Basic programs when the module is inserted. TI BASIC DISPLAY AT, ACCEPT AT and a simple and quick TI BASIC screen dump and much more.

Here is a description of ALL of the CALLs, the better known alphabetic ones (beginning with CALL A) and CALLs with a single character in the range hex 04 to 0C. Plus the module source code. The GPL routines themselves are not listed.

You can download the TI disks from Jan in PC99 format. There is one disk each for the two modules, PRK and Stats, which includes these notes and source code plus the full program lines in merge format ready to be added to your own program and then edited. Use TIDIR to convert these disks to v9t9 format.
The easy way to enter CALL 0 b  (K) : Jan's PRK disk and also his Stats disk.

Quick links:
Introduction by Jan to alphabetical calls.
CALL A     CALL D         CALL H     CALL L     CALL P     CALL S    

Below for ease of use the calls are identified as >04 to indicate the single character having an ASCII value of 4.
Second introduction by Jan - to the low ASCII calls.
These low value characters are most easily entered into a program by preparing a DV80 text file with an editor such as Funlweb, and then using the TEXTLOADER program to load into the console. Individual lines can be saved in MERGE (DV163) format, and then loaded in to your own program using MERGE. You can also use a "program that writes programs" or other means. Note that while you can write your program using Extended Basic, the CALLs require that the PRK module is inserted, so write your program with TI BASIC limitations in mind.

CALL >04     CALL >05     CALL >06     CALL >07     CALL >08     CALL >09     CALL >0A     CALL >0B     CALL >0C    

The module source code and initialisation (lists the required arrays and dimensions). Note that [ and ] and @ ARE valid variable names.

Introduction

Texas Instruments Personal Record Keeping Module for the TI-99/4A Home Computer

PERSONAL RECORD KEEPING BASIC. by Jan Alexandersson, Sweden

Introduction:
The Personal Record Keeping module has several new CALL-commands:
CALL A = accept
CALL D = display
CALL P = prep
CALL L = load
CALL S = save
CALL H = header
CALL G = getput
All of these have been known before and published in several magazines. You can use CALL A and D to write and read anywhere on the screen. CALL S and L can save and load a data file much faster than a file with OPEN and CLOSE. This is very important for users who only have cassette storgage.

I have supplied below the whole main program of the module in BASIC. The result was a 20 kbyte long program which takes 81 sectors on a disk. This is too long to be used in BASIC but I have divided it into separate programs that can be used in PRK-BASIC.

CALL P

CALL P(NUM_bytes)

This reserves memory for the PRK-data file. The remaining memory is used for BASIC. You must type this in command mode followed by NEW.
If you have a disk drive you may first type CALL FILES(1) and NEW.
The 32 kbyte expansion ram cannot be used as it is unavailable to TI BASIC.
The VDP memory is divided as follows:.
.
VDP-RAM without a disk system:
2k for SCREEN use.
4k for BASIC program use
10k for PRK-data FILE
You should type this:
CALL P(10000)
NEW


VDP-RAM with attached disk drive
2k for SCREEN use
4k for BASIC program use
9k for PRK-FILE
1k for disk buffers
You should ype this:
CALL FILES(1)
NEW
CALL P(9000)
NEW

ALSO READ TIdings 10

CALL L

CALL L(device.[file], return-variable)
Loads the PRK-file to reserved from cassette or disk drive.
return_variable = 0 if unsuccessful, 1 if successful.

Also see article in TI*MES 21

CALL S

CALL S(device[.filename],return_variable)
Saves PRK-file from RAM to CS or DSK. The PRK-file is saved in PROGRAM-format i.e. the file transfer is much faster. For a cassette user a 10 kbyte file can be saved in 2.5 minutes compared with 10 minutes for a normal file with OPEN and CLOSE.

return_variable = 0 if unsuccessful, 1 if successful.

CALL D

CALL D(row,column,width,data....)
This can be used similar to DISPLAY AT SIZE in Extended Basic.
Row = 1 to 24, column=1 to 28, width= 1 to 28.
Please see lengthy article at TI*MES 20

CALL A

CALL A:
CALL A(row,col,width,test,data)
CALL A(row,col,width,test,data,min,max)
CALL A(row,col,width,test,data,item)
Row = 1 to 24, Column=1 to 28; width=1 to 28
Test returns the key pressed to enter the data etc:
1: data exists; 2: data doesn't exist
3: AID key pressed. 4: REDO key pressed. 5:PROCEED key pressed.
6: BEGIN key pressed. 7: BACK key pressed.

This can be used similar to ACCEPT AT SIZE in Extended Basic. You cannot break the program at CALL A so save the program before testing it. You also have a form of VALIDATE to warn if you try to input an incorrect string/numeric.
Please see lengthy article at TI*MES 20

CALL G

CALL G

Writes, reads and erases data. Complex usage!

CALL G(0,page,item,data) format to WRITE data.
CALL G(1,page,item,test,data) format to READ data.
CALL G(2,page,item,data) format for ERASE data..

test variable set to 0 for data exists, 1 for data does not exist.

ALSO READ TIdings 10

CALL H

CALL H(oper,info,field,data)

Writes and reads the file structure.

Note the structure is sequential therefore whilst changing file and item names is easy, trying to change type or width of items can have unintended consequences. See the source code and TI*MES 27 for uses of this CALL.

Oper= 0 to write, 1 to read.

info= 1 to 14 as below.

If info set to 1 to 8, field is 0.
If info set to 9 to 14, then field is 1 to 15 (field number)

Complex set of uses!

List of values for info and what they do:
1 = data filename (max 9 chars); 2=day 0-99; 3=month 0-99;
4=year 0-99; 5=items per page; 6=number of pages;
7=header length in bytes 8=page length in bytes

9=item name (max 9 chars);
10=item type: describes data format:
   1=char 2=int 3=dec 4=scientific
11=edit width
12=decimal places
13=memory for this item in bytes
14=RELative item position.

NOTE that if INFO is 5,6,7,8,13 or 14, the value is automatically calculated by the module. If you really want to use Basic to set up a database, first set up INFO 9 to 12, THEN setup INFO 1-4.

ALSO READ TIdings 10

Also refer to TI*MES 27 for a program that uses these calls to load a PRK data file with BASIC and extract data from it.


LOW VALUE CALLS

Intro - low value CALLs

One surprise was that there are 9 more CALL-commands apart from the 7 mentioned above. The name have very low ASCII codes between 4 and 12 i.e. hex >04 to >0C. You cannot write that from the keyboard but it can be taken from my program or be created with an Extended Basic program that writes a new program in MERGE-format.

[Note: a BASIC program should DIMension certain variable arrays -see the initialisation list at the end. You should stick to the array names given in the list to avoid any problems as the module may refer to them - untested.]

NOTE: In the notes below, the notation used is >04 to denote a single ASCII character having an character value of 4. Do not type in >04 - you need a SINGLE chanarcter with an ASCII of 4.

CALL >04

CALL >04 MEMORY

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

CALL >05

CALL >05 Screen phrases [Phrases displayed on the screen are held in a separate area of memory and are retrieved with this CALL. This allows an easy use of different languages without amending the program and is a technique still common in 2015.]

CALL >05(P) where P is a number between 1 and 107. With this command you can write all screen phrases. Some numbers make complete screen images and others do only a small addition to the existing screen. [Words in all caps represent the phrase, words with lower case are comments about the phrase, numbers in brackets relate to the position on the screen of the phrase]

Value will display Phrase: (this is NOT a program list!)
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 (row 4-24).
64-81 (mathematical transformations) (row 21).
82 ITEM # FOR SELECTION? (row 21,23-24).
83 CHANGE PAGE IF IT MEETS, ALL, ANY .
84 PRESS BACK WHEN FINISHED (row 24).
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

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

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

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

CALL >09 INITIALIZE
CALL >09 is not used in the 20 kbyte long main program but in a short initialization program with pre-scan and DIM. I have not been able to use this in BASIC. The purpose seems to be to allocate memory for the variables used in the main program: when we write our own TI Basic program the interpreter scans our code and does this for us.

CALL >0A

CALL >0A TEXT

[This is very like CALL >05 but retrieves single words]

CALL >0A(NR,TEXT$) gives different text strings to TEXT$ according to NR where NR is between 0 and 21. As an example CALL >0A(1,TEXT$) will make 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

CALL >0B TRANSFORMATION

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

This command needs you to set up the variable @ (char 64) and the arrays 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 don't do this correctly, 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 intended (!) this is not possible because new transformations will erase all previously stored.

CALL >0C

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.

PRK SOURCE

To keep this page at a short length the source program has been placed onto a page of its own at:
PRK Source

The initialisation routines are below - this as as used by the module but your TI Basic program should just DIMension the arrays as indicated. Arrays are numeric: A,B,C,D,E,F,G,H,I and String @$,A$,B$,C$,D$. The variable names listed are as used the in PRK Source. CALL >09 does not seem to function from TI BASIC: its purpose seems to be to set aside memory for the variables and index those locations. When you type in your own TI BASIC program, the interpreter scans your code and does this for you. You still need to DIMension those arrays!

20 CALL >09
30 OPTION BASE 1
40 DIM @$(15),A$(5),B$(15),C$(5),D$(5)
50 E$=F$&G$&H$&I$&J$&K$
60 @=0
70 DIM A(30),B(30),C(15),D(15),E(5),F(5),G(5),H(5),I(15)
80 J=K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+[+\+]+A@+AA+AB+AC+AD+AE
90 AF=AG+AH+AI+AJ+AK+AL+AM

[ TI Book front page |    TI Resources Page |    PC99 Review |    PC99 Programs ]