RetroChallenge Day 7 – Post 5 Documenting formulas, Sample STATS Code

Moving on from the Dorsett tapes on Statistics to coding the STATS program in Pascal on the emulated Atari 400/800 I am starting with documenting stats formulas in a text file with the ED editor that comes with Kayan Pascal.  Now I will need to take some liberties with typing them in as there are limited characters to do so.  Then perhaps this file can be tied into the program as some help.

This post will include the formulas for Mean, Standard Deviation, Variation, Skewness and Kurtosis, (peaked-ness of a distribution).  Along with some quick and dirty Pascal code to implement as a sample/demo.

Show below is the first two screens of the documentation:


Here is the output of the demo code, which will be presented in this and following posts.


which is calculated from the following sample data, which is a daily measurement of my body weight for a week.  (as an aside I have lost 157 pounds over the past year and I will be using data I have collected during that time as sample data for this program)

Here is the hard coded assignment of the data, in future coding the data will be read from a text file and converted to real numbers)

stat01-2 data

The data is stored in an ARRAY of Real – called SD[], SD[0] – holds the sample size and SD[1] to SD[7] holds the data in time ordered fashion.

I will later provide a full listing of the source code, in the mean time here are the code snipets for calculating the sum of the data and then then mean, along with displaying it to the screen.  The GOTOXY(X,Y) is in the include file CONIO.P and REALTOSTR() function converts a real number from scientific notation to a decimal string format, for easier viewing.  To calculate the sum a for loop from one to n=7 is used and each element of the array is added to the running total, also an array SA[] is a copied from SD[] and will be used later to have a sorted copy for finding the minimum, maximum, median and to be used in the Anderson-Darling normality test.

Then from the sum the mean (xbar) is calculated by dividing the sum by n (7 in this case) and all are printed to the screen, using the GOTOXY and REALTOSTR calls.

stat01-3 - sumstat01-4 mean

The next post will pick up with sorting the array, calculation of Standard Deviation, Variance, Skewness and Kurtosis.






RetroChallenge Days 3-6 – Post 4 Dorsett Stats Tapes 4 to 16

Over the course of the last few days I view the majority of the Dorsett Statistics Tapes.  Each is 10-15 minutes in length and the topics covered included Graphical analysis, Distributions, Hypothesis testing.  The topics are covered from a high level with some minimal discussion of formulas, and testing, however some topics are not covered, such a p-values and testing for goodness of fit for distributions.  The statistics program I am developing in Kayan Pascal on the Atari 800 will have the Anderson Darling test for normality (fit to normal distribution) and some level of p-values on hypothesis testing.  I did find one issue with the Dortsett tapes – the file for ST10.wav was the same content as ST9.wav, not a big issue and I’m sure when Kevin Savetz digitized all of the Dorsett tapes it was quite an exercise in converting and cataloging and zipping.  I continue to be curious as to how there are multiple colors on the text screen?  My understanding of Graphics mode 0 is two colors (well really 1 1/2) color and hue for background and text, I will check on text windows in graphics mode 0, which might be how this is being done.

This will be the last post specific to the tapes and I’ll be moving on to the coding of the STATS program.  Here are a few images from the tapes:

Tape 5 : Probality


Tape 6 : Probability Continued



Tape 7 : Probability Distributions


Tape 14 : Hypothesis Testing


Tape 15 : Hypothesis testing continued


Test 16 : Statistics Review


This weekend I will pick up with Pascal coding of the STATS program!!!


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.










RetroChallenge 2017/04 Day 2 – Post 2 Dorsett Tape #2 – Graphs

Dorsett Educational Systems – Statistics Tape 2 covers graphs for data in frequency tables.  Frequency histograms, frequency polygons, cumulative frequency histograms and cumulative frequency polygons are reviewed.  In my modern use of statistics for process improvements we typically use histograms with a normal distribution superimposed on top.  This tape two run time was about 11 minutes a bit shorter than tape one.  Histograms will likely be coded into my version of statistics program.  Shown below are a set of screen shots from the lesson.  It is interesting to note that it is all done in text mode.

Next up :

Starting the statistics program in Kyan Pascal, and Tape 3 – Measures of central tendency.

Retrochallenge 04/2017 – Day 1 – Dorsett Tapes Post 1

Retro Challenge Day 1

A brief intro I guess would make sense, I’m Tom Raidna (@TRaidnaComputes on twitter)
and this is my fourth run in the RetroChallenge. For my first project I wrote a baseball game for Timex Sinclair 2068 / Spectrum, for the second run I wrote a Visual Basic IDE for the CC65 C compiler for Commodore 64, 128, Apple II, Atari 400/800 and Oric Atmos, the third run was to set up a Commodore128 and do some programming.  The first two projects were recognized by the judges, the third was a DNF, did not finish, sometimes life……

My background is in Math and Science education, and after teaching for 4 years I went back to school for Computer Science earned another BS degree, and then 20 years later, I went back to school again for a graduate certificate in Applied Statistics to support my work in Lean Six Sigma (process improvement methodology) , thus the combination of programming, Dorsett Stats learning for this RetroChallenge.
So onto the project:

To document this project I will post separately for the review of the Dorsett Tapes and for the STATS program that will be written in Kyan PASCAL for Atari 400/800.  This will be the first post for the Dorsett Tapes course in statistics.

In order to set up to use the Atari, Altirra Emulator, Dorsett Educational System Tapes for Statistics, I downloaded the wav files in a zip file from

And one also need to have the Education System Master Cartridge (Thanks Keven Savetz for the guidance here or I’d still be trying to figure out to use the wave fiels)

The cartridge can be found here :

Once downloaded to both the master cartridge and individual cassette wave files need to be loaded in the emulator (just like putting the cartridge in the Atari 800 and then cassette in the tape drive).

Starting with File / Attach Cartridge…

and then select the Education Master Cartridge

tape0 attach cart

tape0 educational system master cartridge






Next the cassette (.wav file) can be loaded by selected File / Cassette / Load from the Altirra menus and selecting the cassette .wave file, st1.wav in the picture for the first tape in the course.

tape0 load cassette

tape0 load cassette 2

Now by resetting the emulated computer with Shift / F5 the system will boot to the Education Master startup and the screen below will be seen:

tap1 start screen

To access the Tape control to press plan use File  / Cassette / Tape Control and then press the > play button.  Then use the F2 Key (Start) to start the lesson.

While this seems like it might be a lot to just get started, written out, it’s really quite simple.  Now one can navigate the lessons.  In general the lesson flow is there is a voice over on screens of material.  To advance to the next screen a key press is needed, or there may be a knowledge check and correct answer to a multiple choice.

Tape 1 – Frequency Distributions

For each tape I’ll post a brief outline of the topics covered and a couple of screen shots, and I will make a YouTube video of part of one lesson as an example.

Tape 1 Topics

tape1 title

  1. Observations
  2. Population vs Sample
  3. Finite vs Infinite populations
  4. Random vs Biased Samples
  5. Continuous and Discrete data types
  6. Frequency distributions (Tables)
  7. Class frequency
  8. Class boundaries, lower and upper, class intervals, Interval width
  9. Frequency and cumulative frequency

Sample Screens:

This lesson gave an good introduction to stats and the concepts listed in the outline.  The one thing that caught my eye, is the multiple colors on the text screen, I’ll be interested into looking into how this was done (time permitting), as I thought only one color, hue combination was allowed in text mode.  (There may be some text windowing being used).  Frequency Histogram are planned for the STATS program.

Next posts will cover the introduction to the STATS program and Tape 2.


RetroChallenge 04/2017 – Entry

I’ve just submitted my entry for the April 2017 Retrochallenge and my entry is outlined below:

Using Altirra the Atari 400/800 emulator complete the following :


a. complete the Dorsett Education program (cassette s/w with voice) on Statistics – 16 cassette files downloaded from and document at
The files are wav format created from the cassettes as pictured below from the download.

b. Write a statistics program in Kyan Pascal on Atari 800 (emulator) which will compute
descriptive stats, Anderson-darling test for normality, one and two sample T-Tests, one and two proportion tests etc.

c. create videos on creating the statistics program, as there does not appear to be any for Kyan Pascal on Atari

d. blog on the process at, update the blog on creating programs

Looking forward to my fourth Retrochallenge Campaign!!!


Retro GUI IDE and WeeGUI – Objects #3

In the last post the label and numberbox (spinner) control was added for how many numbers the user wanted to play.  We start this post with the addition of two more number boxes, one for number of games to play (1-999) and one that we will use in this session to select which numbers the user wants to play. Here’s what the updated screen looks like :


The default number of games to play is 10, and the starting point for selecting a number is 40, the middle of the keno board.  In review here is what the number box code looks like for the two new ones, labels in the first picture and the set up code for the numbboxes:



From the highlighted code block above then number of games numberbox value will be in variable VI, and we can see it set to the default value of 10 in line 60107.  Similarly VK =40 in line 60110 will be used for the selction of a number to play. Also the callback routine line numbers are 1800,1900  and 20000, 21000 for the games to play and selected numbers.  The code at 18000 is show below with min of 1 being tested in line 18000 and max of 999 tested in line 19000, for the number of games to play.


Moving on to selecting number to play, this will require a bit of user code to be written in the scratch pad.  First a button will be added to be used to select the number from the previously added number box.  To add the button let’s take a look at the RGI interface. A button object is added ast 22, 20 with width 5 and the caption “Add”.


The updated progam screen :


This is view number 12 for this program (and the 13th total since the count starts at 0).  So there are only 3 left for use.  The purpose of this button is to a. store off the number selected buy the user for checking later for a “hit” when the game is played, and also to mark on the board with ** the numbers the player has selected.  This will be accomplished it the callback subroutine for the Add button.  Looking the the automatically generated code we see the callback line number is 22000. We also know that RGI puts in a rem statement at 22000 and a return at 22999.


In the next post the callback funtion code store and mark the board will be added.