Monday, July 4, 2016

Do you remember this wonderful offering from Radio Shack?


This was a microcomputer trainer put out by Radio Shack. It was an excellent introduction to machine level programming. I had one of these as a kid and loved it. I would spend endless hours writing simple programs and was amazed when they ran properly. It taught me a lot about programming and spurred on a life long love of electronics and computers.

I saw one offered on eBay and decided to purchase it. It worked great and I had fun walking down memory lane doing some basic programs. I put it away and it has sat for a couple of years before I saw it sitting the closet. It got me thinking. It would be nice if this were available to more people so they could enjoy entering the world of low-level language programming. And it would be a great tool for teachers.

Being a huge Arduino fan, I thought I would take a weekend and crank out an implementation that would be easily accessible to everyone.

I only use an Arduino Uno and an LED / 7 Segment Display board purchased at Banggood.

http://www.banggood.com/TM1638-Chip-Key-Display-Module-8-Bits-Digital-LED-Tube-For-AVR-Arduino-p-928931.html

The only other component is an optional speaker for sound.


The hookup is as follows:

Display Pin           Arduino Pin
     DIO                         8
     CLK                        9
     STB                        10

And put the speaker between ground and pin 3 of the Arduino.

The Sketch is posted on the page accessed by the tab at the top of the blog.

The switches on the display board work as follows:

S1: Reset. This button stops execution and returns the program counter to 0.

S2: Incerment. This button stores the current value in the current memory position, increments to the
next memory location and displays it's contents.

S3: Run. Runs the program from the current program counter. Remember to Reset before Run if you want to run from the beginning.

S4: Memeory Access. Press this to display the contents of the memory storage area. Hitting Increment will save the current Value to the Memory location, increment the memory pointer to the next location and display it's contents.

S5: Program Save. Dumps the entire program memory to serial port. You can then save the program from there.

S6: Load Program. Displays a 'd' signifying that it is waiting for serial input. When the program is sent serially, it is loaded into program memory. The last program location is displayed. Reset and Run from there.

S7: Value-. Subtract 1 from the currently displayed value.

S8: Value+. Add 1 to the currently displayed value.

The original manual can be downloaded from here: Thanks Andrew Benoit.
http://www.polylith.com/~brendan/ClassicComputers/Tandy/image/MCT_28_260.pdf

There are a couple of things that are different betwen the original and my implementation:
1) Because the key pad only has 8 buttons and the original has 20, I have changed the way you input data into memory. Here is the rundown:

Normal program entry:
1. Reset. This returns the Program Counter to location 0.
2. Use Value+ and Value- to input the desired value for that program location.
3. Us Increment to load that data and advance to the next location.
4. When you have completed entry, press Reset and then Run to run.

2) I decided to make the job of program entry easier. Button S6 enables a serial downloader. If you press this button, a 'd' will show up on the display. Paste your code into the Arduino's Serial Monitor and press send. The program will load into the program memory. Here are some programs from the manual:

NO 12: Display HEX numbers in ascending order
80120F0429120F13F0C2F02

NO 20: Electronic Dice - stops when key is released
81120F0429AF0097F02

NO 50: Use of CY
A05E4A16F0DBF513AE4AF854EDF1A

NO 51: Turn on Binary LEDs from right to left
85A0E1ECB1D7F04F0F

NO 56: Turn on Binary LEDs one at a time in both directions
852A080E112EC2E291B1D6F07E112EC2E29FBFD0F19F07

NO 71: Use of CAL DEM+ and CAL ENDS
A15B54BADFF0280A44A35B322EFBDD1F14E7A45AF4A55AE4A651EDF36

NO 72: Use of CAL DEM-
80AA4B1D0F04A65AB2A75AC4BD5B322EE5DBF32C0F3F242F18C1F468E1E8F3C29F4F2EE7F48

3) I did not add anything to slow the program speed. Some of the examples will run too fast to see the output.

4) Since there are only 8 buttons, if you need to input data into your program during run time, you have two options. 1) use the normal KA command if you only need numbers 0 to 7. If you want to allow all hex numbers, call command E3 (it is not used in the original computer). This will halt program running to get input from the user. In put is done the same way as program entry. Use the Value+ and Value - to set the number you want and then press S2 to enter that value.

5) I did not add the TONE library to the program so I just have 2 different sounds to program. All the other Sound functions just play the same sound. If you want, update the sketch with the TONE library and write the code to support them.

That's it. Download the sketch, hook up your Arduino, download the original manual, and get to programming!! I hope you enjoy this fun weekend project.