RetroChallenge 2017/04 Day 2 Post 3 STATS Program in Kyan Pascal

Along with going through the Dorsett Tapes for Statistics I am creating a statistics program in Kyan Pascal for Atari 400/800.  Like all good programs of old it needs to have a “mainframy” looking title screen and main menu.  The program will be called STATS and below is my quickly put together opening screen.  Below I will give a brief description of the code to produce it, which involves calling some library routines with the include compiler directive, which is a great feature of this programming language.  To learn more about Kyan Pascal you can listen to my review on the Antic Podcast  or you can access through iTunes.  While you should listen to the whole podcast, the review is near the end.  Also my blog is also helpful.


I intend for a short running demo to show what STATS can do, along with the program menu and ability to quit from the start up screen.  So lets take a look at the code.  As we do it’s worthwhile to note that Kyan Pascal also program chaining and I intend to use the feature to build our the STATS program to allow the data, calculations and graphs and plots to be built up individually and to pass data via the chaining.

The source file is STATS.P, and here is the top portion of the program.


Focusing on the code in the red box, we see the comment at the top of the file enclosed in (* *).  The source file name is listed STATS.P and a brief descrtiption of what this file is.  Next the Program statement to start the program and program name “STATS;”

One variable “CH” is declared as a character, and will be used to capture the menu selection when that code is added.  Then two library source files are included with the #I directive.  “CONIO.P” is a library of console IO procedures I will build up as I go through this project, and at this time has two procedures, “CLS” to clear the screen and “GOTOXY” to position the cursor on the screen for printing.  I wrote the CLS code, the GOTOXY code is borrowed from one of the added features disks, and was renamed from the POSITION procedure which you can see is in assembly code. Here’s what they look like :



Moving down in the STATS.P code, down to the bottom where then main BEGIN END. block resides. We see a call to a procedure SPLASH, a READ statement, and a call to CLS in CONIO.P to clear the screen.  SPLASH is the procedure that draws the screen, STATS logo and menu.


Here is the code for the SPLASH procedure.  Starts with some comments and the declaration with the PROCEDURE statement, In the image below.  That is followed by three set color statements.  The SETCOLOR procedure is in the include file SETCOLOR.I we mentioned above.  The calls are of the form SETOLOR(register, color, hue);  In text mode (aka graphics 0 ) register 4 sets the boarder color and hue, in this case 0,0 for black and darkest hue.  Register 2 sets the background color and hue, 12 is green and 0 again is dark hue.  Register 1, only sets the hue for the printed characters, 14 is for the brightest hue.  For now these are hard coded in, perhaps time permitting I will add a menu to allow the user to change the colors.



Next comes a call to clear the screen with CLS, then calls to GOTOXY to position the cursor and begin to  print text to the screen, along with the logo.


Finally the menu at the bottom of the screen is displayed and control returns to the main program block, and the READ(CH); is executed.  Once a character and return are typed the screen clears and program ends.


So the project is off to a good start, some additional utilities will need to be built, such as convert a real number to integer, reading data from text file and convert to numeric data.  Also data structure will need to be addressed and then finally some stats calculations and graphs and plots coded.

Stay tuned.











Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s