I was going to rush onward and work on ‘on expr go to label list.’ I was sure that I had the stack pointer figured out. I had fudged and got it to sort of work. I decided that I’d better get it right before I went on. I wrote a debug tool which used a parameter list after the debug call. That way it made only the minimum effect on the stack pointer. I’m having a great time and when I do get around to ‘on expr go to label list’ it won’t occasionally break for no apparent reason. I hope.
I have temporarily abandoned all characters in names significant. Labels are just normal names. One letter followed by a letter or digit. I’m working on program execution. Basic skips over initial names followed by a colon. Go to is replaced by to to. Any time basic expects a go and finds a to, it throws a syntax error. I catch the error and process the go to label. If there is a space between the characters of the label, the first character is not alpha, there is no label, or there is no line starting with that label followed by a colon I change the “sn error” to “ul error” and return to the error processing routine. Next I tackle on 0 go to label list.
First I made crunch work. I had an inc-pair routine that kept track of the current name pair at all times. It was complicated but direct. Of course it was easy to write the pair when it came time. Unfortunately when searching the symbol table, inc-pair was called each time that one went to the next symbol in the table. I changed it so that inc-pair just incremented the lsb until it reached zero then it started the lsb over again and incremented the msb. When the msb reached zero it printed a warning that there were only 35 name pairs left. Now when traversing the symbol table it usually only did one increment for each symbol looked at. Every 36th symbol it was only a little worse. The routine to write the name pair was less complicated than the original inc-pair routine and it only ran once for each name looked up. My other improvement was to add a byte count to each symbol table entry. Then when you first knew that the symbol didn’t match, two instructions, load b and add b to x, moved to the next symbol in the table. I’m satisfied that I won’t be able to make it much better. Another advantage is it was easier to check the code. A symbol could only be shorter or longer than the entry in the table. My code was defective but it was easy to fix. The lsb is A-Z, 0-9. By changing the starting values I was easily able to check the difficult changes. Z to 0 and then back 9 to A. I left the values in the code so I can use them in uncrunch which is next.
Basic needs line numbers. Urbane uses the two bytes that basic uses for its line numbers for a zero byte and a screen lines in a file line count. The zero byte lets me look backwards in the file to the beginning of the previous line. The screen lines in the file line lets me see how far up in the screen I’m going. When I exit urbane I will renumber the file. When I enter urbane I’ll replace the line number bytes with my zero byte of nine for the screen lines in a file line. The maximum count is eight, so I’ll know I need to find the real count the first time I look at a line. I’ll store the count so I won’t have to do it again. Oh yeah. I discovered that Vcc has a break key. It’s <home>. Now I exit urbane when I press <home> and I delete the current line when I press shift-down-arrow. I used to use a shift-down-arrow to exit from the urbane editor. Letting the user edit the file in basic has the problem that he can edit the end of file line with disastrous results. He can also edit the symbol table which could be useful if he knew what he was doing. Changing a name in the symbol table would change it everywhere in the file. I need to give it more thought. Oh yeah. At my son’s suggestion I quit putting a phantom asterisk at the top of the file and I let the user see the end command and colon in addition to the asterisk at the end of file line. I think what I’m going to work on now is letting the user move up one screen line at a time instead of moving up one file line at a time and moving to the start of that line. I’m going to make it like the editor I use when developing urbane.
I am so happy. My son suggested that I should have the urbane editor screen and the coco basic listing look the same. I had been feeling good because I was working hard to make the urbane screen look almost alike. Just added a quote mark to the empty line or string of quote marks in the urbane editor before I put it in the coco basic file. Before that I had treated blank lines and single quote lines as special cases. Terrible. When I saw that putting everything in loops so I could handle blank lines and any string of just quote marks simplified the code I was happy. My first try after my son’s suggestion was to change blank lines to a quote mark before I let the user leave a line. That really simplified the code. Happier. My next improvement was to check when the user started to edit a line to see if it was just a quote mark. If so I would empty the buffer. The quote mark was already on the screen. Since it was no longer in the buffer, when the user pressed a key it would go right onto the start of the line where the phantom quote was. There was a bug. While I was trying to duplicate the error, I discovered that I had a blank line in the urbane editor screen. I figured that I should have a line with a quote mark. I returned to coco basic. The line listed and ran properly. I figured out what had happened. I had put a line in the urbane editor of just a space. No surprise that the urbane editor screen showed a blank line. The great surprise was that it solved the coco basic list function’s bug of repeating the last not blank line when it encountered a blank line. Apparently a space was all it needed. And of course one can’t see a space if it’s all by itself. Even better the program ran properly. I found that the end and shift-end in Vcc acted like a space in the urbane editor. If I can figure out how that works I may have the last key I need for delete-line-function. When I’m in coco basic on Vcc the end and shift-end act as break keys. That’s ascii 3. How that changed to a space I need to find out.
I’ve spent about a week working on my urbane project to get it to show empty lines in the editor. Coco Basic’s list command has a flaw. If there are blank lines in the file it repeats the last non blank line. If my user enters an empty line in the urbane editor I replace it with a quote mark in the basic file. That’s the comment signifier. So the program lists with quote marks and runs fine. My son suggested that I should let my user enter a quote mark by itself if he wants to. So I replace his quote mark with a pair in the basic file. My editor shows the user his single quote mark where he put it. My editor passes normal comment lines right through. The last problem I had was when I uncrunched a line from the basic file it showed the extra quote if any. I changed the line buffer and the line length count, but the extra quote mark was already on the screen. I fixed it with a kludge. I knew where the quote mark was on the screen so I poked the screen memory with the appropriate value to make it a space. Four instructions and it was fixed. What a kludge.
I couldn’t wait to try it out. I carefully replaced all the stores with subroutine calls and cleaned it up a little. When I first tried it afterwards it didn’t work. I opened the editor and started looking around in the file. Then I noticed the save icon was red. I had forgotten to save the file before assembling and loading it. I saved it, assembled it and loaded it. Lo and behold it worked with no further changes. Now I’ll never be able to get to sleep. Oh well. It was worth it.
I’m working on my immediate version of urbane which runs on the coco2. With only a few changes it will run on the coco3 I hope. I was getting all kinds of weird results when I tried to open a new line at the end of the file. I remembered that I had done a complete rewrite of the uncrunch routine. Turns out I didn’t get the improvement that I had hoped for. I still needed to use a 256 byte buffer. I had these strange results, too. I went back to this uncrunch routine that I had rewritten. I spent a lot of time making it clean. One minor overlook, I pushed one more register than I pulled. When I fixed that it ran perfectly. I had to hold on tight to keep myself from charging ahead and attacking more features. I’m going to put out next weeks pills and balance our checkbook which I was supposed to do last weekend and maybe read in my kindle. Hopefully I’ll be relaxed enough then to go to sleep easily. I just thought of how I can get the results I wanted to with the new uncrunch routine. The coco2 and the coco3 when running in 32 column video mode let one read and write directly to the video memory. It will be a little harder, but I’ll be able to use less memory which might be an issue. I can hardly wait for tomorrow to come so I can try it out.
When the user loads or saves a file he is prompted with the last name loaded or saved successfully. F now loads a find screen of lines with labels. Shift-up does a page-up. Shift-down does a page-down. Up-arrow does a line-up. Down-arrow does a line-down. Enter returns to the editor at the selected label. I now plan to use the system to improve my EARL (Easy Assembler Robot Language) program which has a greater-than or less-than symbol moving back and forth on a line and increasing and decreasing numbers occasionally. The goal is to add or multiply distances on the line. A one is placed at each distance. When done the character stops at the added distance.
When I had trouble calling the kbd routine in my crunch program I solved the problem by inserting the kbd routine from my version 002 system into the version 001c that I’m working on now. I wanted to check to be sure it worked all right. I discovered that when I backed up the entire floppy image to the hard drive after inserting the new files, the cursor blinked just once each time I hit a key. I noticed that if I reset the system and then ran the program again I had the blinking cursor that I had worked so hard to get in version 002. I tried making a batch file to copy each file I was using, so I could find out which file was causing the problem. It worked just fine. I never did find out what was causing the single blink. Who cares. If I only copy the files I use it’s faster than backing up the whole floppy image. Now when I update my files and insert them into the floppy image I just run my batch file and I’m in business. I think that I’ll go back to just copying the files that I’ve changed. Maybe run the batch file once in a while. I’m just working on two file right now: ed2 and crunch. I have a name file. If when I run ed2 the name file isn’t there I tell the user to run line 3 to initialize that file to temp.txt and initialize temp.txt to be print “sam”. The load routine loads the name in the name file into to top of ed2. The load routine adds $40 to the length of the name and stores it just before the name The top line is just a long comment. My edit function copies that name into a later spot in the line. Then backspace works on this new name. If there are no characters in the line it ignores the backspace. If there are 12 characters in it already the edit routine ignores the new character. When the user presses the carriage return the edit routine returns the new name in the same descriptor as it was called with. Next comes saving the new name in the name file.