Chapter 8: Bootstrapping, or Baby Steps
After delivering the Saturday morning edition, I lined the inside of the box with sheet metal and installed the fan and the power supply, mounted the mainboard horizontally on offsets, grounded the board to the Faraday cage made by the sheet metal, mounted the keyboard, and tested that it still worked when everything was assembled.
Then, while I worked on designing the dynamic RAM circuitry and the ROM circuitry, Giselle played with the computer, using Tiny BASIC and asking me how to do things as she experimented.
Departing drastically from the example refresh circuit in the Micro Chroma 68's manual, I decided to borrow the video display generator's scan for the refresh strobe.
You may be thinking that the video scan works on the wrong part of the address for refresh. If so, you're right. Dynamic RAM refresh strobes have to count through the row addresses several hundred times per second. The VDG's lower address lines continuously count, completing their count tens of times per second as necessary for refresh, but if you attach the address lines in the usual way, the lines that count end up being column addresses, not row addresses.
That means only two pages in text mode, and not many more in graphics mode, get refreshed. And all the pages that don't get refreshed forget their data.
However, contrary to ROM, RAM doesn't really care about the order it is addressed in. Where you write the data is where it reads back from, and if the address lines don't change between write and read, the readback succeeds without any notice that the lines don't match the labels.
Well, many dynamic RAMs have row burst mode for speed, and if you use row burst access, the row must be an actual row. Otherwise, you'd be burst accessing with gaps, which is generally not useful. Row burst wouldn't allow what I did at all. But the Micro Chroma 68 would definitely not need row burst mode. Adding cache RAM and seeing how far beyond 2 Megahertz I could overclock it was not part of the plan.
(Row burst mode might well be used for high-resolution video, but the TVs of those days were not particularly high-resolution.)
So, if I swapped the usual rank of row and column, I could borrow the low order address scan count for refresh strobe, by addressing the dRAM rows instead of the columns with the VDG low address lines. Doing this, the row refresh would be completed within the required timing of once every ten or so milliseconds.
I was a little worried that changing VDG modes would cause problems, but it looked like the switch would occur quickly enough for the RAMs I was using, even if the VDG stopped to start over again almost at the end of a frame. So I decided to wire it up and see if it would work.
Using the VDG had the additional advantage that the refresh would be occurring in the same phase of the memory clock as video refresh, opposite from and not interfering with CPU accesses.
I added a whole 6821 PIA for an extra bit of output to switch between the lower 32K and the upper 32K. That was a waste of a PIA, but I thought I could use the extra bits elsewhere, and I quickly found use for them.
With a bit of additional logic, I was able to decode the selected 32K bank starting just above static RAM, at addresses $2000 to $9FFF, giving 40K of contiguous addressable RAM.
I quickly had enough of a circuit design put together to walk to Radio Shack and pick up perfboards, a bunch of headers and sockets for them, some 74LS series bus buffer latches, and some other parts, and start wiring the dRAM refresh circuit up on one of the perfboards, using point-to-point soldering on the low-profile socket pins. I wasn't able to finish wiring the board before bedtime.
*****
At church on Sunday, Br. Burns gave me the name and contact information of the manager at the local IBM office, Margaret Bight, and told me she would be expecting to hear from me. I invited him to come take a look at the Micro Chroma 68, and he brought his family over to visit after church meetings.
"Not sure what to say. It looks like a very capable toy. Games, maybe?" was his impression.
Hard to argue with.
I spent, as was becoming customary, Sunday evening at a young adult home evening activity, where we had a gospel-oriented discussion and played Uno after.
*****
Monday evening, I finished wiring up the dynamic RAM and wrote some code for testing it. It worked for both banks of 32 kilobytes, keeping memory contents even when switching between VDG modes.
However, when I tried using one bank as a high-speed substitute for mass storage, I discovered that switching banks to write each byte would corrupt the bank switched out. It wouldn't be a problem to buffer the data in the static RAM, but I didn't see why it should be losing the data when switching for every byte.
While I analyzed the schematic, Giselle tried out the newly added RAM, quite happy at being able to type in and run some of the larger BASIC programs she had found in a book at the library.
I couldn't find the problem by just analysis.
*****
Tuesday, I dropped by Dr. Brown's office to ask if I could borrow a scope again to analyze the problem. He said I could.
That evening, after homework and before scriptures, I looked more carefully at the 6844 direct memory access controller. I wanted to see if there were some way to squeeze it into the Micro Chroma 68, to reduce the I/O burden on the CPU if I added a floppy disk controller. It was clear I'd have to perform an extensive bit of surgery on the Micro Chroma 68's printed circuit board in order to hook it in.
So I set that idea aside and started working out the EPROM programmer from the EPROM application notes. Realizing I needed more than the 5 volts that the simple power supplies Denny and I had built provided, I dug through the spec sheets and application notes that Denny had given me and looked at a switched mode power supply controller's application notes, trying to get an idea of what it would take to get one working.
Wednesday, with Dr. Brown and the classes observing, I determined that the 6821 was drawing more power than I was giving it when I switched the banks that fast, which took power away from the dRAMs. Adding decoupling capacitors on the memory board, and running an additional power and ground pair of wires to the RAM board solved the problem.
(The real me was satisfied with 32K of RAM that he was not thinking he would ever fully use, and never put a scope on the problem. He seems to have preferred to spend his time on painfully slow progress reading Tera he, and on daydreaming -- about CPUs, memory, peripherals, and code -- over generating actual code and hardware.
Daydreaming.
Speaking of which, the timing on getting the real world Giselle involved with computers was much later, and involved a different CPU. And didn't get as good traction.
So it might have been power problems, or it might have been timing, or I may have gotten the strobe and the bank switch line tangled up somehow. Until I can un-mothball the old Micro Chroma 68 I built up in the real world, I have no way of knowing.)
At the library, I made a copy of the dRAM circuit diagram for Denny, with notes on the power requirements and the necessity of the decoupling capacitors.
When I got home, I called the IBM office, and the receptionist set me up with an appointment for the next week, instructing me to prepare something written about what I would like to accomplish during the internship. She didn't give me any clues about what kind of goals might be appropriate, said that was part of what they would be judging my application on.
With the RAM circuit settled, I added ROM sockets to the same perfboard, using more of the 6821's output bits and some logic to select the ROM socket to enable. Since the EPROMs I had were 4K, I wired the sockets to be addressed as 4K EPROMs.
While I was at it, I moved the BASIC ROM to the memory board so that it would be close to the circuitry I was using to switch ROMs in and out.
I considered combining four exclusive-or gates on A14, A13, A12, and A11, with four bits of parallel port, to allow switching between the two banks of RAM 2 kilobytes at a time. It wouldn't allow moving the 2 KB segments around in the memory map like the 6829 would, but it would give me more flexibility in using what was there.
Ultimately, I decided I didn't know what I would be using it for, and adding the XOR gates to the addressing would be simple enough to do later, if I wanted.
*****
On Thursday, after I delivered the papers, Mom and I were in the kitchen together. I was waiting for some toast to pop up, cutting a slice of cheese, for a snack to fuel my work on the EPROM burner design. Mom was working on Dad's and her income tax records on the kitchen table.
Giselle snuck in through the living room, with a suspicious expression on her face and a squarish load in a plain brown paper grocery sack under her arm, and went straight to her room. She returned to the living room, sans load, and announced that she was not, under any circumstances, to be disturbed, then returned to her room and shut the door.
"What do you think is in the box in the bag?"
"Looks about the right size to be a Color Computer," I guessed, semi-randomly.
Mom nodded and went back to her bookkeeping.
Twenty minutes later, I was back in my room sketching out a tentative design and writing out a parts list, when Giselle came in looking frustrated.
"I need your help. But you have to promise not to tell Mom and Dad."
"Sure. I'm sure you'll tell them yourself anyway, and I'm sure whatever it is can wait until you do. But, just so you know, Mom and I already guessed it looked about the right size for a Color Computer."
"Well!" She stood, arms akimbo, angrily staring at me.
"It was just a guess. Giselle, we know you're not going to do anything bad, so you can take your time, and if we guessed right just pretend we didn't. Okay?"
She turned without answering and left. From the hall, she called. "Are you coming?"
"Coming."
Spread out on her bed were a Color Computer with only 4 KB RAM, manuals, a program pack cartridge, and a 64 K RAM upgrade kit. "It was on sale," she explained.
"You want me to install the RAM upgrade."
"I want you to make sure I turn it on right."
"Okay."
"Then install the upgrade."
I hid my grin and obliged, fetching my tools and my TV from my room. After letting her check that it turned on okay, I carefully removed the "NO USER SERVICEABLE PARTS INSIDE!" sticker over the middle screw in the base, without tearing it, and opened the case up. I may not have been a Tandy service technician, but I sure wasn't just an ordinary user.
Pretty soon we had the 64 K RAMs swapped in, the circuit board modified as necessary, and BASIC showing its welcome message once again on my TV screen. Giselle checked how much RAM she had:
PRINT MEM"That's not 64 K!"
24871
"True. But that's what half of 64 K looks like after BASIC reserves the RAM it needs and the display RAM. The top half of the RAM shadows the ROMs and ports. To use the full 64 K, you'll need to copy the BASIC ROM into RAM, or you'll need to use OS-9. And you'll still be unable to access something like 8K of it, I think."
"OS-9 needs floppy disks."
"Yes, it does."
"So what do I do? I don't have any more savings I dare spend."
"Good question. But you can always use the RAM you do have for whatever you were going to do with it."
"I bought a word processing cart."
"Sounds good."
"I want to run a business typing. How do I print?"
"I don't know much about business, but you need a printer, and your own TV for display, too. I think it's time to consult with Mom and Dad."
She looked at me with a thoughtful face.
"Okay."
She went in to get Mom.
I watched for a few minutes while she and Mom used my TV and cassette recorder to get familiar with the new computer and word processing cart.
Her word processing cart used the Color Computer's highest density graphics to produce true lower case letters on the screen, and to make preview modes available, where you couldn't see the actual text, but you could see how the text would spread across the page.
Mom asked questions as Giselle tried things, and Giselle let Mom take her turn. Shortly, Giselle had the basics of the word processing cart mastered, and had typed in and saved some sample documents. I went back to my room to work some more on the power requirements of the EPROM burner. Shortly, Dad came home, and came into my room.
"Hi, son."
"Hey, Dad. What's up?"
"I need your help. Wheres our Mommy?"
"She and Giselle are ... in her bedroom discussing some things."
Dad ducked out of my room, and in a moment I heard him start chuckling quietly in the hallway. Then he came back in my room. "Looks like one of my questions is settled. Can you come give me a hand?"
"Give me a minute to complete my notes and I can."
"What're working on?"
"Need a different power supply than what Denny and I built, different voltages for all the stuff I want to hook up."
"Will you need it for a printer?"
"Depends on what kind of port the printer has. Are you thinking of buying a printer?"
"There was a, I think you called it a dot matrix printer on sale at Radio Shack."
"Oh."
I finished the line I was drawing and went with Dad to the living room.
"Three hundred on sale." Dad frowned. "If it won't work, I can take it back today."
I looked at the box and saw that it was one of the printers that had both a standard parallel interface and a serial interface specifically designed for the Color Computer and several other of Radio Shack's small computers.
"This will definitely work with Giselle's new tools."
"Well, that's good to know."
"I'll need to wire up a port for it, to use it with the Micro Chroma 68, but it should work okay with that, too."
"Then we'll keep it."
"If you think the family finances are up to it."
Three hundred dollars in 1981 was about twice what I brought in on a good month with the newspapers, or about what I make at a good job in electronics repair. It was more than Dad and Mom's monthly payments for the house loan, but that was because they took the loan out in the mid-1960s. A new house loan at the time would start about three hundred, as I recall.
"We'll be okay."
"I upgraded Giselle's computer to 64 K, but she still needs a TV monitor and cassette recorder of her own before she can start using it for real."
"Ah. Yes. I should talk to your mother. He left my room and called through Giselle's open door. "Max? Can I have a word with you?"
Giselle started and turned around, and, leaning so I could see through the hallway, I could see the guilty look on her face.
I could see the muscles in the back of Dad's jaw pulled up in a grin. "Hi, Zed."
"Uh, hi, Dad?" She swallowed.
"Nice day for new tools, isn't it?"
"Uhh ..."
"What do you need, Ted? Giselle and I were exploring her word processor program."
"Won't take long." Dad nodded toward the living room with his head.
"Just a minute, Giselle."
I went back into my room, to allow Mom and Dad to consult in private. I didn't have time to remember what I was doing before Dad called me into Giselle's room to help hook the printer up.
Giselle's test documents printed nicely, and we were all pleased.
"But I understand you need a TV monitor and a cassette recorder of your own."
"Well, ... yeah. I do."
"If I bought them, would you mind sharing? Letting me work on my class handouts and tests when you aren't busy?"
Giselle's face lit up. "I could do that!"
So we went back to Radio Shack and picked out a TV and cassette recorder, checking the demo units to see that they worked well with the demo Color Computer.
Back home again, I called Denny.
"Now what?"
"Got the dynamic RAM working pretty cheap."
"Oh, yeah?"
"Used the VDG for the refresh counter."
"Heh. Send me the diagram?"
"Yeah. Tomorrow. I'm looking at the EPROM burner and other I/O, and we need power at more than just 5 volts. So I'm looking at building a switcher."
"Are you sure you want to do that? Why not just do a voltage doubler?"
"Voltage doubler, switch mode, similar stuff happening, .... Hadn't thought of that. Would be a bit less of a reach than a new power supply."
"Well, yeah. That's the point. Get this built so you can use it to help build your real computer."
I thought for a moment more. "I guess I'll look at it. So, what I'm really calling for, I'm thinking your surplus store is going to be the best place to get the EPROM eraser and a raw disk drive."
"You're wanting to come down for the three-day weekend ...?"
"Was thinking next week or the week after, actually."
"Why not jump on it now? Worried about tomorrow being the 13th?"
I ignored his joke. "Giselle has bought herself a Color Computer, and Dad and Mom have bought a TV monitor and cassette recorder for her and a printer for the family, and they're all going to be wanting help this weekend."
"She's what? No, no, she's supposed to wait until we've built our super-duper computers and use them!"
"Heh."
"Well, ..., okay, tell her I forgive her. This time. And to have fun with it."
"So, ..."
"So next week will be better for me than the week after. Date?"
"Date."
(As noted previously, this whole episode did not happen at all in the real world. I don't know if Giselle would have taken to the Color Computer as readily as this, if it had. Giselle got her first computer -- of a different type -- while I was on my six-year break from BYU, and Dad and Mom got their first computer after Chika and I moved to Japan. I also got my first printer during that six-year break. And left it behind for Giselle when we left.)
*****
Over Friday, Saturday, and Monday, I got voltage doubler circuits working for RS-232C and the EPROM, and I wired the fast cassette interface, a parallel printer port, and a couple of serial ports on one perfboard. The parallel and serial ports worked fine for the printer, with a cable adapter for the serial port. The fast cassette interface also seemed to work fine, but I wanted to take it in for tuning the next week.
I used the Micro Chroma 68's text editor and text processor to write up a résumé and a proposal for the internship, focusing on my experience in electronics to that point, my progress on the Micro Chroma 68, my interest in using Japanese on computers, and on my interest in how things were done at IBM, saved them on both slow cassette and fast, and printed it all out on the new printer. It was visibly dot matrix, but still quite legible.
And Dad and Giselle took turns on her computer, Dad getting some class handouts worked up, Giselle putting samples together for showing potential clients.
*****
I somehow made time to go to the Valentine's Day dance on Saturday and play softball with the church young adult group on Monday.
Neil's little sister, Niki, with encouragement from her brother by mail and promises of help from me and Br. Orange, was handling the sound for the dance. Br. Orange and I spelled her at the turntable so she could go dance, and she enjoyed it and decided she could start doing the sound regularly.
Of course, I danced three or four with her. You know, five years' age difference seems like a lot when you're twenty-one or sixteen.
There was a young woman named Brandy there who had come to earn college money working in the oilfield support for a year. She claimed a few dances with me and spent some time hanging out around the turntable when I was on it. Very interesting person, very strong personality. You had to have your wits ready when talking with her. But she was friendly and her looks were agreeable.
She came to play softball on Monday, too, and when she hit a homer with two on in the eleventh inning and our side won, I cheered with a "That's my woman!"
She politely but firmly informed me she was not my woman when she came in to home plate, and I filed that particular cheer away as one not to use without considering how the woman I was cheering might perceive my interests.
Maybe "That's our woman!" would have been better, but I somehow doubted it.
*****
"That's a computer?" Mike's face showed his doubt.
I had brought the Micro Chroma 68 to Tuesday's BASIC class, to pass off the previous week's assignment of an amortization table, and most of the students were gathered around where I had set it up before class started. It was showing the TVBUG monitor ROM prompt on the screen.
"No, it's a wooden box with a computer inside it," Pat rolled her eyes and shook her head. "Of course it's a computer."
I chuckled. "It's a work in progress, but, yeah, it does have a microcomputer in there."
"No operating system?" she asked.
"Not yet, not unless you can call a debugging monitor an operating system."
Don looked puzzled. "What's an operating system?"
Prof. Bright cleared his throat behind us. He had come in to get a look at the Micro Chroma 68.
Prof. Crane chuckled. "Don, do I need to put that question on the final?"
"No! Wait. Is it the thing where we log in on the Univac and then give it the command to run BASIC?"
"By me, I think he's got it," George intoned in a British accent cobbed from Monty Python or Dr. Who.
Prof. Bright nodded. "Very good, Don." He turned to me. "That's the boot ROM giving you some kind of prompt, right, Joe?" He was clearly prompting.
"Yeah. It's a debugging monitor, so it accepts debugger commands. I have Tiny BASIC in a ROM, there," I lifted the cover and pointed at the ROM, visible on the memory board. "So I can just give it the command to jump into the ROM at the right place, and it will boot BASIC." I demonstrated, as I had for my family, and the Tiny BASIC prompt came up. "Although, really, considering the amount of ROM in the thing, it's hard to call this little guy's startup process bootstrapping."
Prof. Crane tilted his head. "Why would you say that?"
"The monitor, tape interface, and the BASIC interpreter are all already resident in ROM, not read into RAM from tape or disk or some persistent storage device. There's no sense of the computer 'raising itself by its own bootstraps to a usable state'. All it is does is initialize some variables so code that's already there can run."
Prof. Bright nodded. "But initializing the variables is something it does for itself, right?"
"Well, I guess I can give you that."
"So," Prof. Crane asked, "can you fix it so it goes from the monitor to BASIC without typing that monitor command in?"
I had to think for a moment. "I don't recall seeing code where the monitor checks for a other ROMs to execute, but I couldn't swear it's not there. If not, it would take some hardware changes. There are a couple of diagrams, I think, for circuits to change the reset vector."
"Doesn't the reset process do some bootstrapping inside the CPU itself?"
"I'm sure it does, but Motorola hides that pretty well. It's a black box." I thought for a minute. "I am planning on getting floppy disks and purchasing or writing an operating system for this computer. When I do, I'll have to write drivers for the floppy disks, at least. Initializing the drivers before reading the OS from the floppy will make starting it up a bootstrap process."
"Something like this?" Prof. Bright draw a state transition diagram on the whiteboard:
reset -> monitor (operator call)-> driver init (automatic boot)-> OSI nodded in agreement. "Something like that."
"So," Pat asked, "What OS are you thinking of? CPM? Unix? Unix is cool. It has pipes."
"Pipes sound cool. What do they do?"
"You can hook the output of one program into the input of another."
The conversation stopped for maybe a full half a minute while everyone looked for someone with clues.
"It sounds useful, but I'm not seeing how it would work," Don dared say it.
"Like when a compiler outputs an assembly language file, you don't have to store it in an actual file, just pipe the compiler output to the assembler."
"Oh-kay, if you say so." I shrugged. "I don't really know much about CPM or Unix, but I haven't seen either available for the 6800. I've been looking around, and it looks like the best suspect is an operating system called Flex."
"I've been using both at work. Unix comes with source code, and lots of people are implementing CPM from the specifications and documentation."
"Source code? What's the CPU?"
"The computers are PDP-11s, but the source code is in C."
I looked at Pat expectantly.
She didn't add anything.
"See what?"
"C language. The programming language, 'C'."
The words I heard were "See language. The programming language, see?" But the intonation was not "see" as an imperative, but as a name. I had to process that.
"It's not in PDP-whatever assembly language? The name of the language is 'See'?"
"Right. 'C'. But some of it is in PDP-11 assembler."
More questions came to mind. "What is the PDP-11's CPU?"
"Uhm, PDP-11?"
The professors were listening to the exchange in amusement, but Prof. Bright took pity on me about the processor. "PDP-11 is a mini. I understand the 6800 register model and assembler are modeled after the PDP series somewhat."
"So a PDP series minicomputer processor." I nodded. And most of the operating system is written in a high level language called 'See'."
Prof. Crane took further pity on me and wrote the letter 'C' on the whiteboard. "'C', see?"
I chuckled at the joke. "Now I see."
Pat nodded and some of the other students laughed nervously.
"Ah, time to start today's lesson. Past time, even. Let's get our textbooks out." Prof. Crane asked if there were any questions, then started us discussing roots of equations in preparation for the Newton-Raphson project.
After class, he checked my program and the output. "You know, it would be easier to grade this if I had a printout of the source to look over after you take the computer home."
"Ah. Yeah. We bought a printer." I dug the two-page printout out of my backpack and handed it to him.
"Oh. Great. Thanks."
"So that's the famous sixty-eight thousand, huh?" Mike lifted his nose at my computer. "Doesn't seem too impressive to me."
Mike was among the several students who were still hanging around, interested in the computer and how I was using it.
"Well, it's not designed to be impressive, and it isn't the sixty-eight thousand. It's the sixty-eight hundred."
"What's the difference?"
"The 68000 is a sixteen-bit CPU with lots of 32 bit registers and addressing. This 6800 is an eight-bit CPU with just a few eight bit accumulators, one sixteen bit index, and sixteen bit addresses."
"Hmm? So? What's the difference? I'm unimpressed."
"Ignore him. He doesn't understand a bit." Pat was also waiting around, very interested in the computer.
Mike snorted, not sure exactly how he had been insulted.
"This is intended to be a small computer." I tilted my head. "It's for learning in small bytes at a time."
Pat and a couple of other students snickered. Prof. Crane groaned. Mike looked at me like he was waiting for the follow-through punch, but I was leaving bad enough alone.
"So," Pat asked, "are you going to put C on it?"
"I haven't seen any advertisements for a C compiler for this. Pascal, yes. C, no."
"Oh." She seemed disappointed. "I guess you're not interested in writing a compiler yourself?"
"I've seen those railroad track syntax diagrams for Pascal, but I haven't even seen a programmers manual for this C language. And I guess I need something fairly easy to start on, to bootstrap my understanding of how to write such things."
Prof. Bright had just come back in, and was listening. "Do you think you might like to write a compiler?"
I thought about that. "Sure. Maybe. But it has to be something that doesn't require tools I don't have."
He and Prof. Crane exchanged glances.
"What would you suggest, Rusty?"
"Languages built on list processing can be easier to bootstrap when you don't have tools. LISP has a bit of a steep learning curve. Snobol was fun, but I have no idea how to get information on it any more. Forth is a bit easier, and there's the fig -- the Forth Interest Group -- giving information out for the cost of copying it."
"Ah, Forth. That's stacks and RPN. You were saying you like Hewlett Packard calculators, weren't you, Joe?"
I had said such a thing, and my interest was piqued.
On the way home, I dropped by the library to see if I could find information on Forth or the Forth Interest Group, and again I found an ad, this one in Dr. Dobb's Journal, from Mountain View Press. Again I took a copy of the ad home with me.
At home, I delivered the newspapers first, because Mountain View Press was in California and I could call after six o'clock local time and get cheaper phone rates. I got the information I needed from the call, and wrote out an order and a check for hardcopy of the 6800 model source code and the installation manual, and for a copy of the source code on cassette tape in Kansas City format. I did not want to spend time typing the source in by hand.
(The real me only got the hard copy, had to hand-assemble a lot of code, and type in machine code by hand. Learned a bit by osmosis in doing so, but it was not efficient use of time.)
That done, I spent a couple of hours disassembling the assembler's object code and exploring it for ideas. Also played with the timer. Out of curiosity, I worked out the distance light could travel in the shortest tick of the timer clock, four CPU cycles. If my memory serves me, it was something on the order of the length of a football field.
(Checking the math now, either the length was three football fields or the timer could count on the crystal clock and it was around three quarters of a football field. My memory doesn't give me enough information to say which, without the manuals.)
Chapter 9: Interviewing IBM
[Backed up at https://joel-rees-economics.blogspot.com/2020/02/bk-33209-bootstrapping-or-baby-steps.html.]
No comments:
Post a Comment