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
Assembler CoCo Editor

New Direction

I’ve been working on making coco2 basic the best it could be. Now I plan to work on a 6809 editor assembler loader to use with the coco2 enhancer. I plan to use the enhancer I have as a start on the new system. It uses a linked list for the editor with both the crunched and uncrunched lines in the individual items in the linked list. I plan to crunch the assembly source as I edit it. Both systems will use the same storage area for the their linked lists. I’ve made the keyboard routine a lot simpler. I need to incorporate a garbage collection routine in the keyboard routine.

Categories
CoCo KARL

KARL

About a month ago I started working on KARL again using just vcc. I used a KARL interpreter. A simple program would be ‘W W’, ‘ B E’, ‘ G W, ‘E E’. The first letter in a line was the label. The second letter was W-Walk, B-if Blocked then goto, G-Goto, and E-End. The third letter was the target. This little KARL program would send the ‘>’ moving across the screen to the edge. It worked, but it was awkward and a little slow. I also had always be writing programs to test the command characters. I did use the system to write a KARL program to multiply two lengths together which worked. A week ago I started using basic routines for initialize, walk, turn, put down, pick up, and fix initial values. Walk, turn, put down, and pick up update B for blocked and M for marked. The user program looks something like 5000 gosub 5020, 5010 goto 100, 5020 gosub walk, 5030 if E then stop, 5050 goto 5020. That makes the ‘>’ run across the screen, stop at the edge and display the message ‘off screen’ ‘stop at 5030’. Adding 5040 if B then return makes the ‘>’ run across the screen, stop at the edge, and make a graceful exit back to the KARL command line. In addition to Q-Quit, S-Save, R-Run, W-Walk, T-Turn, D-put Down, and U-pick Up, there is C-Clear the robot line and F-Fix the initial values. At first I used Line-input to get the values to act on in the KARL command line. I had to always be pressing <enter>. I changed it to Inkey$. All at once I was cooking. When I wrote the multiply two lengths with this system, it was really fast.

Categories
CoCo Editor

Robert Gault

I wanted to use Robert Gault’s COLORZAP-93 which I had bought, lost, bought again, and lost again. In the process of getting to buy it again I found it again. I decided that I would tell him all about it. At the end I mentioned this blog. I realized that I hadn’t been keeping it up to date at all. Well, Oct 11, 2022. About five months. Not as bad as I thought. Any way, I’ve put the user’s file in the regular basic’s space. There is Find to find a label, Var to find a name, Save to save a file and Load to load a file. Then, I wrote my world famous, haha, EARL program in the user’s file. It had its own editor and interpreter to run its program and save and load save and load its little program. I tried it out by running the original add and multiply lengths like my hero’s KARL back in the coco2 days of yore. Finally I did a digit multiply. It starts with __3_7, you can put any digits there. It ends in this case with __3_7_21. Quite a trick. Right? lol. Well I’ve done about as much with this system of programs as I want to. So, it’s off to new fields to conquer.

Categories
CoCo Editor

30 Significant Chars

On another note I’m back to working on my project. Instead of making every character in every variable significant I’m just going to just keep the first 30 significant. Why you might ask. It makes the symbol table significantly smaller. I’m already using three k for the lower memory and three k for the higher memory which is going to share it’s eight k memory space with the symbol table. Using zero terminators and byte count bytes makes it two bytes overhead for each variable. I can use the same byte for the byte count and the variable terminator. With short variables that adds up. I’ve got the debug version of the screen showing the first 32 bytes of the symbol table.

Categories
CoCo Editor

on expr go sub

The underlying code for my coco editor is done. The last piece was on expr go sub label list. It gave me fits. I kept dumping the stack and making on 2 go sub label list the same as on 1 go sub label which is handled by the basic rom. The trick was the top two words on the stack. I figured they were just there for the error control. Well, they are. The on 1 go to label and on 1 go sub label both had the same two words on the top of the stack. When I put them on the top of the stack for on expr go to label list and on expr go sub label list, my problems went away. I put an on expr go to label list into my sample program and it worked just fine. A word about my sample program. I call it EARL. Easy Assembler Robot Language. That just happens to be my name. Back when the coco 2 was great stuff and programs were saved on cassette tapes a professor out in California wrote a program he called KARL. He showed how one could add two distances to each other. He offered to send a copy of his whole program to anyone who showed how to multiply two distances together before the next issue of Rainbow magazine, bigger than Life or Look, devoted to the coco, came out. I caught fire. I wrote my first Earl program and developed my multiply program. I typed it up and sent it in. On of his students typed it into a coco. He made a couple of typos and it didn’t work. I fired off a letter explaining how I had written my Earl program to develop my multiply routine. I put them on a cassette tape and sent it in. The tape had a bad spot on it and it wouldn’t load. He replied to me that he didn’t believe anyone could develop the programs that fast. I should have copied it onto a new tape and sent it in. I kept trying to make it better. I wanted to make it print itself out onto a printer. I never got it good enough. It’s always festered in my mind. I’ve developed my coco editor similar to the program I had back then. Then I had only single letter labels, opcodes, and addresses. Now I have two letter labels and addresses. That way I don’t need line numbers. In my last attempt I had labels and variables with all their characters significant. But I didn’t have on expr go to and go sub label list. Now I’m going to put them together and have the whole enchilada.

Categories
CoCo Editor

Numeric Labels

If a label starts with a number the coco interpreter doesn’t throw an unknown label error like it does if it starts with a letter. When I made all characters significant before I didn’t address this issue. They could have said go to 1 and they would have been surprised by the results. I keep the number of screen lines for the logical file line in the number field, so there is probably a line with a 1 in the number field. It’s good that it has shown up here, so I can fix it properly. I’ve just come up with the ultimate solution. The coco screen has reverse digits available. I should check it, but I think that the basic interpreter will catch it. The process works. There’s a hook before the user enters a line. If I change the ‘0-‘9 to $60-$69 they show up as inverse ‘@-‘I in the normal basic listing. When the basic interpreter comes across them it sees them as zero and throws an unknown line exception. Of course I call it unknown label. There’s a hook for before a file line is put on the screen. So, I can change them to inverse ‘0-‘9 when I put them on the screen.

Categories
CoCo Editor

MSGOUT

I’ve almost always had a message out routine. It started out as just a bare bones routine. Echoed characters till it found a zero. Just recently I started adding features to it. The first big one I made was making ] be the terminator. The advantage is that you can put the terminator in the character string and not have to add another line for the terminating zero. On the coco the ] character is shift-down-arrow. It never shows up in a basic program. I had replaced the zero with a [. Not good it broke the old code. Easily fixed. I made the zero be another terminator. Then I added ] as a carriage return terminator. On the coco it is shift-right-arrow. It also never shows up in a basic program. And now at last I made the ] just a carriage return. I don’t think that I’ll get much better than that.