November 25, 2016 11:28
Further Debugging RC2014 and First Programs
Debugging RC2014 and running BASIC examples
Previously I wrote about Assembling & Debugging RC2014 and I didn’t have much luck. After trying numerous things I was still unable to get the system working. Since publishing this post I found out that the chips from the RAM and ROM chips were swapped. So I put these chips in the right boards and unfortunately still didn’t have much luck getting the RC2014 to work.
A friend of a colleague, Kevin, knew I’d been having a little trouble getting my RC2014 modules working, and kindly agreed to send me their completed RC2014, along with an FTDI cable. When I received this working RC2014, the first thing I did was test this using Minicom. When I pressed the reset button I was greeted by what is shown in the first time use section of the Full Monty Assembly Guide and was able to run a simple program to get the computer to print “RC2014 is great”.
Following this I visually compared my boards against the boards from the working RC2014 and it was here that I noticed a couple of differences. After a quick visual comparison I noticed that the silkscreen of the RAM and ROM boards appeared to be swapped, so RAM was labelled ROM and ROM was labelled RAM. I then found out that the silkscreen on the RAM PCB was just misleading and the ROM PCB does actually say ROM on it, but the holes for the pins obscure most of the O (this is why I thought it was an A).
In my previous post about RC2014 Spencer pointed out that the RAM and ROM chips were swapped so I had assumed the “RC2014” basic sticker had been placed on the wrong chip, however, it’s now clear to me that the chips ended up in the wrong boards because of the confusion with the silkscreen marking on the PCBs.
To try and further debug my set of modules what I next decided to do was swap one of my modules for a working module from the RC2014 that Kevin had assembled (which I knew was working). I did this one at a time to see if I could narrow it down to an individual module.
After working my way through the Clock, CPU, ROM and RAM, when I finally got to the Serial I/O board I noticed that when I opened Minicom I was suddenly able to write a BASIC program on my RC2014, when using the Serial I/O board from Kevin’s. It was at this point that I realised there was a problem with my Serial I/O board.
I spoke to Spencer about this and he said that his suspicion would be with the MC86B50/MC63B50 ACIA rather than the PCB, as this is the only component which is not brand new, but reclaimed from retired machines in Poland. Although testing is carried out on random chips it is possible that a faulty one may have slipped through. To be sure this was the case I confirmed this by assembling a new Serial I/O module and using this, it worked as expected. I next swapped the chips from the new serial I/O module to the old module, when the chips were swapped the old module worked and I was able to use this to run the BASIC “RC2014 is great” program. Knowing this it then confirmed that the problem was with the MC86B50/MC63B50 ACIA and not the PCB.
Using the new Serial I/O I wanted to try get this working with my FTDI cable instead of Kevin’s. His only had four cables Running to and from FTDI, these were from the GND, VCC, RX and TX pins on the FTDI header on the board. As I knew this worked I decided to connect the same pins and leave out CTS as this isn’t required. When I connected my FTDI cable I was having a few issues: when the reset button was pressed I didn’t see the “SBC by Grant Searle. Cold or Warm Boot?" message, but instead saw a sequence of random characters each time the reset button was activated. Initially I believed I could have connected TX and RX the wrong way, so decided to swap these, however when I did this I still received a random sequence of characters on the screen.
I knew that this must be a problem with the FTDI cable, as when I was using the one Kevin sent with his computer this worked fine. I swapped the FTDI cable out for a new one and following this I was able to run a BASIC example in Minicom.
Since I had a working RC2014 I thought it would be extremely useful to do some reading on BASIC, so I could have a go at programming the retro computer. I came across a really good BASIC manual for the elementary algebraic language designed for use with the Dartmouth Time Share System , published by Dartmouth College in 1964.
I got about half way through the document before deciding I’d like to have a go at programming something on my own using BASIC. What I wanted to do – seeing as though the document detailed many algebraic examples – is incorporate BASIC with things that I have done in my HND over the past two years. Here I decided to use BASIC to help me convert between polar and Cartesian form.
Using the polar form, the calculations below show how the real and imaginary parts of the rectangular form can be achieved using a calculator.
POLAR FORM: 5 A 36.87°
REAL COMPONENT CALCULATION: (5)(cos 36.87°) = 4
IMAGINARY COMPONENT CALCULATION: (5)(sin 36.87°) = 3
CARTESIAN FORM: 4 + j3
When BASIC loaded I began by entering the above equations directly into the program, however when I ran this I didn’t get the results I expected to see.
After looking more at the Dartmouth college BASIC document mentioned earlier, I soon realised that any number you use Cos, Sin or Tan with needs to be in radians, and I had been entering this in degrees. So what I did at this stage was include a conversion for the integers in degrees to radians at the beginning.
Unfortunately, despite adding a degree to radians conversion at the very beginning I still wasn’t seeing the results which I expected. I soon realised that this was because even though I had completed the calculations they were still in radians and once again needed to be converted back into degrees. I added the conversion calculation prior to printing the Cartesian form and when I ran the program the Cartesian was exactly what I expected to see.
As well as learning how to use algebra in BASIC I wanted to learn other features. One cool thing I learned is that if you type:
10 PRINT “HELLO”
20 PRINT “IT’S A NICE DAY TODAY”
30 PRINT “I LIKE PRINTING IN BASIC”
and you realise between line 20 and 30 you missed a line, the missing line can be inserted with any line number 21-29 e.g.
25 PRINT “HOW ARE YOU”
Another example would be if you typed a line and realised it wasn’t what you were supposed to write. As you can’t use cursor keys to move back and correct this line, it can simply be retyped with the same line number as the mistaken line, later on in the program and it will override the original e.g.
30 PRINT “PRINTING IN BASIC IS FUN!”
To execute the above program we need to type ‘run’ on the next line and press enter.
Regardless of the order which the lines of code are typed in, because of the line number at the beginning BASIC will order these numerically before executing the program.
Since I’ve managed to get my RC2014 module finally working, next time I want to have a got at connecting it up with the Keyboard module and also look at connecting it to a screen!
Trainee Electronics Engineer for AB Open. Love to try new things and build interesting projects!