Governor's Career & Technical Academy Arlington

CSC 205: Computer Organization: Week 14


I don't have the bandwidth (both time and mental capacity) to organize them properly, but the good Mr. Cole's emails are beginning to comprise an entire curriculum for this course. So let me just get them down here, and we can process them further in the years ahead.

Monday December 14th

As we discussed on Friday, your task for Monday, due before you come to class on Tuesday, is to write, assemble, and run the program that Conor showed us on Thursday, and to be prepared to answer questions about it.

Tuesday, December 15th

After you demo your successful running of Conor's 24 bit adder program, we will discuss Kevin's articles below, and the next steps in our study.

Why do we boot computers?

By Kevin Cole

There is a humorous idiom about the way to climb a fence is to pull oneself up by one's own bootstraps.

Some boots as you may have guessed or experienced, have straps designed to help you pull them onto your feet and legs. The joke is that if you could pull them even harder, you could levitate.

When you start a computer, even as old as the Altair, there is a small section of memory that is permanently set -- usually by the manufacturer. It is typically something that owners and users (and programmers) cannot easily change. It is Read Only Memory (ROM). It cannot be written to.

Part of the ROM has a small program that looks for a hard disk, and if it finds a hard disk, it looks in a very specific location on the hard disk. Just as you have already learned with memory, there are numeric addresses that reference specific locations. On the original hard disks, you had several platters (circular plates, like in an old record player) that were coated with a magnetic paint. An electromagnet could magnetize (set to 1) or demagnetize (set to 0) very small areas of the disk, writing to it. Another part of the system could detect the ones and the zeros, thus reading from the disk.

Data was stored in concentric rings on both the top and bottom of each platter. So, just as we have latitude, longitude and altitude, or X, Y and Z to describe a specific in the physical 3D world, so too does a hard disk have 3 dimensions: cylinder, sector and head.

A picture is worth a thousand words so,

Hard disk geometry

But. back to the question: When you first turn the computer on, there is no operating system. There is no concept of what a file, or a filename is, but just as you have seen with machine language, there is the concept of locations referenced by a numeric address and data and machine language instructions at those locations.

The ROM says Look at a specific cylinder, sector and head. There you will find -- I don't know, let's say 200 -- bytes that are machine instructions. Copy those 200 bytes to RAM, putting the first byte at, oh, let's say memory location 500 octal. Finally jump (JMP) to memory location 500 octal.

OK, the ROM has handed off running the computer to the RAM. Well, the program at 500 octal says Look at this other location on the hard disk, and load 3000 bytes into memory location 10000 octal, and jump there. Well, this is now a much bigger program than the original 40-byte program in ROM, or the 200-byte program that it loaded into RAM originally. Bigger, better, stronger, faster... Well maybe not faster. But it is more complex, and able to do more.

Slowly, the computer is building its operating system by having little programs load bigger programs which load bigger programs, every time you start the machine.

Some programmers that considered themselves to be brilliant comedians said that the computer was pulling itself up by its own bootstraps.

This initial ROM program to do this became known as a bootstrap loader and the process eventually just started to be called booting.

Ain't that a kick in the pants?, says one of those programmers [me] who considers himself a brilliant comedian and is sadly mistaken. Get it? Boot? Kick? Never mind.

But, on a related note, why is there a crowd-funding site named kickstarter.com? There's a similar origin: Many motorcycle engines are started by pushing a lever with one's foot, thus kick starting it. (If you kick start something while pulling yourself up by your bootstraps, I think you'll fall flat on your face.)

Some Mostly Accurate Info about CP/M

By Kevin Cole

WARNING for the really smart people: Some of what I say below isn't exactly true. But it gets at the idea. Once you become more comfortable with the broad ideas, you can dig deeper into the specifics (or not).

About that second paragraph in the last message [mentioning CP/M]. The goal here is to learn the stuff we've already been learning, and then take it two steps further:

  1. See an easier (higher level) programming language running on the Altair either in the simulator or on the actual hardware clone that he's trying to get everyone to set up in their home for a few days each.
  2. See a full operating system running on the Altair simulator or the clone.

The common programming language of that time was BASIC the Beginners All-purpose Symbolic Instruction Code. Think of that as a very early Python. It was a programming language designed to teach students how to program, but it became popular for writing and sharing simple games and other applications. You could test out your ideas by typing them directly into the BASIC interpreter, or, you could create a program with an editor and name it something.bas instead of something.py, and run that program.

The operating system for the Altair was called CP/M.

If electrical power is the heart of a computer or a phone and the CPU is the brain of the computer or phone, the operating system is the autonomic nervous system. It can monitor the power consumption and temperature of the the device, and run your programs more slowly to cool down. It keeps track of how much disk space and memory is being used. It keeps track of the current time. It connects you to WiFi. It knows when you've plugged a USB stick into it. If there's a battery, it lets you know when the battery is running low. And, it knows how to start applications. For example, on your phone, the operating system is Android or iOS. It keeps track of the apps you've installed and knows how to launch each one. It keeps track of what files (text, photos, music, program code) you've stored and how you've organized them into folders (another name for directories and subdirectories).

CP/M (Control Program / Monitor) is an ancient, and much dumber operating system that runs on the Altair. It knows how to do some of the stuff above. It knows how to launch simple applications, and knows about files you've created. It knows how to copy, delete and rename files. It knows about folders. Eventually, CP/M was replaced with DOS (Disk Operating System) which is still on every Microsoft Windows computer. DOS can do more, but by most measures, it's still not a powerhouse.

On Linux, or Mac OS X, you know how to start a terminal window, where the only thing you see is a command prompt.

When you type, ssh csdev.gctaa.net or python or vim something.html, you are using a program called a shell to start an application, instead of clicking on an icon on your desktop or in a pull-down menu to start an application.

On old computers like the Altair, there are no icons to click. The shell -- also called a command interpreter (see COMMAND.COM for a discussion of the command interpreter that came with DOS) -- which lets you talk to the operating system with your keyboard, and lets the operating system talk to you with the screen is the everything. The only thing you will see is a command prompt where you can type commands to start applications, or create, copy, rename or delete files. And there are very few applications on those old computers. It's like, when you turn on your computer, there are no icons. No menus. No mouse. The only thing you will ever see is an entire screen that is just one big black rectangle. It looks like:

CP/M Prompt

That's it. That's all you get. You can type commands after the A> to manipulate files and start the BASIC interpreter where you can write programs and run them. But I don't really remember CP/M commands. And I do not know if the version of CP/M that I found can do much. But. No graphics. No pictures. No mouse. No music. Just a keyboard you can type on, and a big black screen that shows alpha-numeric characters.


Notice that what you're seeing in the video is only letters, numbers and spaces, in different colors. The video was a funny accident: I wrote a program to connect an infra-red video camera to a computer and display what the camera was seeing. But when I tested it, I connected to the remote computer using ssh and ran it. Instead of telling me I don't know how to display graphics in a terminal window the program just said OK... I'll do my best... and created an ASCII art video. I thought it was kind of hilarious. The same camera, doing it the right way -- but I never understood where the weird diagonal slash came from -- produced this.

The idea that we are trying to teach you is that if you understand bits and bytes and binary and octal and hex and machine language, you can take a box that only has toggle switches and lights, and connect a cable to to a screen and another cable a keyboard and you can create a full operating system yourself. (You'll probably want a third cable so that you can connect it to a hard disk. Otherwise, all your year-long programming is gone once the power is turned off.)

No one is expecting you to create an operating system. It's a HUGE job. But, if you can leave the class with a feeling of Ohhhh. If someone paid two or three of us for two years, and it was our full-time job, MAYBE, I THINK we just MIGHT be able write an operating system -- maybe not a very good one, but one that does a few of the necessary things that a computer needs to do, like save and delete information in files... or tell the rocket going to Mars when to fire up its engine to slow it down.

P.S. My tests of the BASIC interpreter have gone great. It works as expected. My tests of CP/M? Not so much. That's why I sent the e-mail to everyone saying CP/M is your problem. Or as your instructor says I can now do, I want to get a student to do it.