Shortly after I've written this program it already outlived its usefulness. I wanted to know how the 8255 was connected to the keyboard matrix. This rather important knowledge was not covered in the original user's manual, therefore I had to find it out by myself. A perfect job for my first experiment.
The picture above shows the actual connections of the keyboard matrix. The horizontal rows are the inputs to Port A of the 8255, the vertical columns are the outputs from Port C of the 8255.
The program makes all columns low in turn, starting at b0, and checks to see if one of the inputs goes low because of it.
If the program does find one of the inputs to be low that means that there is a key down in the column which is at low level at that moment.
Thus the program is now able to tell us what column and what row is low.
Simply pressing all the matrix keys in turn will teach us all the matrix connections, which enabled me to draw the little diagram above.
Running the program is simply a matter of downloading and unzipping the package.
Now you have the choice of entering the program by hand, which might be educational.
The size of the program is small enough to enter by hand.
You may use the listing file or the HEX file to copy the data from.
But if you are lazy or in a hurry you may also use the mp3 file which is included in the package. The "filename" of this program is 0001H (after all it's our first experiment). Type TAPE RD, 1, and GO and then start playing the mp3 file. You may have to experiment a little first in order to get the volume right. Remember that the MPF-1 is a little hard of hearing.
Once the program is in the memory you can simply start it by typing: ADDR, 1, 8, 0, 0 and GO. The display should now show S B P . Pressing any key will show the column and row number of that particular key (for instance pressing the DATA key will display S B P 2 5). The first digit indicates the row number (the input bit number), the second digit indicates the column number (the output bit number).
Remember that the 4 keys of the left column are not implemented in the keyboard matrix. The program keeps running in an endless loop and can only be stopped by pressing the RESET key.
Here you can download the file keymap.zip, which contains the source listing, the actual plain hex file, a list file and an mp3 file of the program.