' W 12 R T D SKIP
STWDTSG MWSWR TSSUBG TSSR WMG
K K2 T 1 KK DW KK RK
0....5...10...15...20...25...30.
..1..1........................
>.............................
a*b=c. a=distance from origin to first. b=distance from first to second. c=distance from second to cursor.
W=WALK. T=TURN. E=END. G=GOTO. S=GOSUB. R=RETURN. U=PICK UP. D=PUT DOWN. B=IF BLOCKED THEN GOTO LETTER. M=IF MARKED THEN GOTO LETTER. LETTERS=LINE NUMBERS
.
The first line is made up of haystack letters. The second line is made up of the above abbreviations. The third line is made up of needle letters. The fourth is a scale line. The fifth is the line of marks. The sixth is the line where the cursor is. For example: the first column says GOSUB K. K can be found near the end of the row of haystack letters. It says K: WALK. Walk moves the cursor to the right one space. The next says IF MARKED THEN GOTO R. If the mark line letter at the cursor column is not equal to “.” then the next column says go back to letter R in the first line. It can be found near the middle of the first row of haystack letters. It’s column just says R:R for RETURN. So control passes back to just after the gosub in the first column which is the second column. If the mark line letter at the cursor column is equal to “.” the the next column is executed. It says go back to the K in the haystack letters where we just were. So we see that we skipped over the empty spaces in the mark line to the first mark. I’m really proud of the look of that subroutine. The S,I,and P are dummy labels. The only label that is actually used is the K. The label line at that routine says SKIP. Subroutine calls to that routine are S,K. Short for SKIP. lol.
So, now we’re back at the second column. We start out going right. The cursor character is ‘>’. The T in the second column stands for turn. Now we are going left. The cursor character is ‘<‘. Now the walk moves the cursor left one space. The D for down changes the ‘.’ in the mark line at the cursor to a ‘1’. Please note we left the original two marks alone. Applause, please. We turn so now we are going right again. We skip to the first mark. The next bit is a little tricky. We jump into the middle of the routine, walk, then call the routine. Where we check if we’ve gotten to next mark. In which case we leave. Notice that walked one space for each subroutine call. When we start returning we’ll walk one space then return to the next return address. When we leave the routine, we turn. Now we are going left again. We skip the first mark. Then skip to the count mark. We pick it up. If we are at the origin the ‘if blocked then goto’ instruction will exit to the last bit. We turn. We skip the first mark. We skip to the second mark. Then, we start picking up all those bread crumbs that we left along the way and end up with the cursor at a+b+c where a*b=c.
You may rightfully ask, “So what?” Back in the heyday of the CoCo2, Radio Shack’s Tandy Color Computer, this professor out in California wrote an article for one of the mammoth magazines dedicated to those computers showing how to add two lengths together. He had this gigantic program that moved the cursor around the screen, picked up markers, and put then down, as well as a lot of other fancy stuff. He said that he would give a copy of that program to anyone who sent in a listing of the commands that would multiply two lengths together. There was a month to do it in. I wrote an interpreter for my original program like this so I could check if my commands would actually multiply two lengths. They eventually did. I sent in a listing of the commands. He had his students type in the listings to check them out. The student who did mine made a couple of typos. I sent a message to him and told him that I had written a program to check if my commands worked and that they did. He didn’t believe me. I sent him a cassette tape with my program and listing on it. The tape had a flaw, so it wouldn’t load my program. Instead of just turning around and sending him another copy of the tape, I messed around for a long time making it a little better. Eventually I stopped. I keep coming back to it, though. The interpreter for this version is just 87 lines long. The program is just 24 commands long. I cheated a little bit though. The original version was designed for cassette tape. It had an editor, save, and load for the program. I couldn’t stand waiting around for the interpreter to load each time that I made a change in the program. The program saved and loaded the program relatively quickly. I guess that now I will add that editor to the interpreter program. Something else to do to make it realistic.