December 13th, 2014

#4488: There is no way for me to see if that's the error I made.

At least, I'm pretty sure there isn't.

See: back in the Stone Age, before Al Gore invented the Internet--1984-ish--I was trying to teach myself the intricacies of 6510 Assembler and (mostly) failing. To do really interesting and useful things on the C-64 you pretty much had to be able to code in assembly language (machine code) because the BASIC interpreter was very, very slow.

A friend of mine wanted to set up the function keys to change the screen and text colors, and I thought that would be a good use of the tutorial I'd just read on programming interrupt routines on the C-64. He wrote the bulk of the code (he was also learning machine code) and I worked on the "shoehorn this into the C-64's normal interrupt routine" part.

The basic process was this: you used a snippet of machine code to change the interrupt vector to point to your routine. You had to use machine code because you had to suspend the interrupt routine while changing the vector, and if the computer ran for more than a few clock cycles without interrupt services it would become unstable and crash; BASIC was right out.

Anyway, load registers with your pointer values, that pointed to the beginning of your code, turn off interrupts, reset the interrupt routine pointer, then turn interrupts back on. It took maybe five or six clock cycles (if that) to do the whole thing, and I basically copied the tutorial's methods for my program, so I know I was doing that part right.

The problem was, no matter what I did, the program simply would not work. Write the code, compile it, load the program (using the ,1 switch after the drive number to force it to load to the address we wanted it at) and then SYS 828 to run it.

Warm restart, blank screen, colors remained the same.

I wrote a machine code program which changed the screen colors as fast as possible, which worked; but when I added code to make it part of the interrupt routine, it bombed to a warm restart screen.

No matter what I did, neither version of the interrupt routine ever, ever worked, and after struggling with it over the course of several days I finally gave up and found something more entertaining to do.

That was thirty-one years ago.

This morning I was lazing around in bed, and started thinking about that program. It hit me then that if I had ended my program with the RTI--ReTurn from Interrupt--opcode, that would have led the computer to crash. Remember, it crashed if the interrupt routines were not run, and they wouldn't run if I'd used RTI instead of transferring interrupt processing to the routines in ROM. But I have trouble believing that I could have been stupid enough to have done that, particularly with the example I had in front of me of a properly-functioning routine.

The source code, handwritten on notebook paper, is long gone; of that I have absolutely no doubt whatsoever. The C-64 disks that once contained the digital files are probably coasters by now thanks to the tendency of magnetic domains to randomize with time.

My travails with machine code programming were what made me begin to suspect that computer programming might not be a good career choice for me. I could write code that did useful things, but every other program I wrote took as much time to debug as it did to write, and some programs did things that did not match my expectations and could not be fixed no matter what I tried. (One was a simple Apple ][ program which was supposed to move simple lines down a screen. It never worked, and I never figured out why.)

When I went to college and learned Pascal and C++, my programming improved considerably, but learning how to program in compiled languages just further convinced me that I'm not cut out for programming. My code worked, it did what was needed, but it was inelegant and bloaty.

Hardware is what I understand, and I understand it well enough that I was able to teach myself how to repair computers and printers, and do it as a professional on-site tech for years.

Still, there's no way for me to tell what mistake I made with that interrupt routine, 'way back in the Cretaceous, and since the C-64 is long obsolete I don't think it really matters. I guess that's how it goes.

#4489: The rest of today

Yesterday, as I said, Mrs. Fungus convinced me that we should have a real tree this year. We used the old stand (from when we used to get real trees back in the 1980s and early 1990s) and put the lights on it.

And that's as far as we got.

Before putting the lights on, we had to let the tree warm up and relax, and while that was going on we went on a cleaning binge. Mrs. Fungus worked on the living room and I worked on the basement. I threw away a lot of junk from downstairs (mostly old boxes that I don't need, but some other things) and made room...which we promptly filled with dining room chairs and some other things.

Look: we don't need six chairs in the dining room. When we use that table at all, it's her and me; the room is cluttered enough and hard to move through.

In 1992 (I think it was 1992) Dad had a fireplace installed, which denies us one wall of the room for placing furniture. The result is that the sofa must be on the east or west side of the room (it's been on the east side since 1992). With the sofa on the east side of the room, the hutch cabinet cannot be on the east wall of the the dining room, because that would require that the dining table be jammed into the south east corner of the dining room. The piano sits on the short south wall of the living room.

The piano is on the order of a century old. It's been sitting there since 1992, and it weighs so much that I think it's warping the house. There's nowhere else in the house we can put it, and even if we could move it I wouldn't want to try. It hangs past the end of the wall, covering the end of the hutch.

Result: there is perhaps two feet of space between table and hutch, and there is nowhere to move anything. We moved three of the chairs downstairs to make the room feel less cluttered, and now it's a lot better than it was.

But of course it all comes at a price: the room I made in the basement was taken up with chairs from the dining room. *sigh*

Doing all that work yesterday--and on five hours of sleep!--left me unable to do anything else useful once the lights were on the tree. We're going to decorate it sometime in the next few days, but at the moment it just has lights on it.

One step at a time, I suppose. *sigh*