Categories
Uncategorized

More Multiply

MR SK T:T W D T SK U M1 D SK G2 1:D 2:T S:BB W SS W R:R B:T MU SK U GT U:U R K:W MR GK

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.

I’ve given it a lot of thought and I’m almost sure that all three lengths were measured from the origin. I plunged right in and didn’t stop until I finished. 167 lines in the editor and interpreter. 32 commands in the multiply program. One nice thing is the only check one needs for a zero check is to see if there is a mark at zero. One command. If marked then goto return. I finished about midnight. Today I accidentally saved a blank file on top of my new command file. When I rewrote it it was only 29 commands long. Go figure. The interpreter no longer outputs error messages. It just stops at the offending. I refresh the screen at each command. Since I no longer advance the position in the command file the command cursor blinks each time the screen is refreshed. There were only four error messages. One each for four commands. Walk can try to walk off the screen. The mark cursor will be sitting at the edge of the screen. Mark overflow will occur if put-down tries to add one to a mark of two. Mark underflow will occur if pick-up tries to pick up a mark where there isn’t one. The last one is stack empty when return has an empty stack. This shortened up the interpreter code quite a bit.

Categories
Uncategorized

More Multiply

After a lot of thought I have decided that the a b and c of a*b=c all started at the origin. I reworked the program to work with that in mind. 29 instructions. 167 lines in the editor and interpreter.

MR SK T:T W D T SK U M1 D SK G2 1:D 2:T S:BB W SS W R:R B:T MU SK U GT U:U R K:W MR GK

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

Categories
Uncategorized

Multiply Lengths

' 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.

Categories
Uncategorized

Stacking Food Cans

Continuing disappointment. Cans of vegetables and fruit don’t stack. Today I found some that stacked at Price Chopper. When I was putting them away in the pantry, I dropped some. Usually when I drop some the edges bend so the can opener doesn’t work. This time not a single bent edge. Almost too good to be true. I had only written this down than I discovered a can that had fallen and bent. But only on the side. I think it will still open all right. I forgot to put the flashlight away after using it last night to look at Karen’s computer. I searched to no avail. I slipped and knocked over her crystal light glass. It’s almost never empty. This time it was. Lo and behold the flashlight was behind it. Meant to be. I get much better shaves when I shave every day.

Categories
Uncategorized

Karen’s New Computer

Karen’s new computer wouldn’t shut down properly. It kept restarting. I signed up for McAfee on my laptop. Now Karen’s new computer shuts down properly. It always restarted I coudn’t set my alarm clock. I assumed it was broken. I was going to buy another just like it. Fotunately I couldn’t get Amazon to work either. I remembered how to set the time. I read the instructions and saw how to turn the alarm off. McAfee. Dark web. Dangerous site. I vacuumed our room. I do better when I read before but rather than work on my project.

Categories
Uncategorized

More on using CoCoDskUtil

April 16, 2016
I have discovered that you don’t actually have to close Vcc or all your PC editors in order to avoid errors when you work on a .DSK image file in CoCoDskUtil. You do need to navigate away from the folder in question in CoCoDskUtil, and open a different .DSK file in CoCoDskUtil. If you did it right, you did that when you left CoCoDskUtil last time. Then you need to close the files in the folder in your PC editors, and eject the .DSK file from Vcc. Once you have made your changes to the .DSK image file you need to navigate away from that folder in CoCoDskUtil and load a new .DSK image in CoCoDskUtil. Then you can insert the .DSK image file file you have been working on into Vcc.
back

Categories
Uncategorized

gosub and on i gosub and return

Added gosub and on i gosub a,b,c and return. I had all kinds of trouble until I knocked off and went to sleep for the night. When I woke up the next day it was simple pie. I couldn’t figure out what was so hard the night before.