Andrew Que Sites list Photos
Projects Contact
Main

No articles for week of August 04, 2020

Falling back to closest date.

July 14, 2020

A Little Personal Computer History

What really started the personal computer industry? Most people acknowledge Apple making the first personal computer. They did successfully mass market a computer to the general public which is something no one else at the time had done. However, they were not the first to try.

The Altair 8800 was one of the first successful computers available that an individual could buy—technically a personal computer—but it wasn’t a complete system. The system had no interface device (no keyboard or monitor), no storage (disk, cassette, paper tape), no serial interface (comports), and it shipped with only 256 bytes of memory (BASIC required 4K of memory). The Apple I was similar to the Altair as it needed a keyboard and TV, but it did have BASIC in a ROM and could use a cassette for data storage. It wasn’t until the Apple II that all the necessary components of a personal computer (as we now think of one) came together. Both the Apple I and the Altair can be considered proto-PCs. They were not PCs yet, but were getting close.

The Altair was based on the Intel 8080 processor. This processor was the successor of the 8008—Intel’s (and the world’s) first 8-bit microprocessor. Intel had created the very first microprocessor, the 4004, released in March of 1971. However this was a 4-bit processor designed for calculators. It’s small word size doesn’t lend itself well to general purpose computing. The 8008 was released in April of 1972 and is the first 8-bit processor. With the ability to address 16 KB of memory, a call stack, and an instruction set that could do conditional branching, binary logic, addition and subtraction, the 8008 has all the necessary attributes needed to become the processor in a PC. How come it didn’t? Interestingly enough, it was meant to.

A story not many know is how the 8008 came into being. Indeed, I thought the 8008 was the logical successor of the 4004, but that is not the case. Intel didn’t actually design the architecture for the 8008—they just turned it into a chip. Enter the Datapoint 2200 computer terminal—the dumb terminal that wanted to be a PC.

The company was Computer Terminal Corp (CTC). They made one of the first glass TTYs (a teletypewriter with a CRT screen). When there initial design (the Datapoint 3300) was made, there wasn’t such a thing as a microprocessor. A computer’s processor was made of discrete logic chips wired together. A microprocessor uses the same logic gates but does so on a single piece of silicon. When the engineers wanted a more intelligent terminal for the Datapoint 2200, they got together with Intel and Texas Instruments and asked them to produce a microprocessor. As a result both Intel and TI did make a processor. Intel produced the 8008, and TI the TMX 1795. Turns out the TI couldn’t get their chip to work, and the CTC wasn’t interested in using the Intel chip. However, since both chips were intended for the Datapoint 2200, both chips had a very similar design—a design that came from CTC, not Intel. So the first real general purpose processor’s design wasn’t from the company that made the chip. Why didn’t CTC use the Intel 8008? It was too slow. The clock speed was 500 kHz (½ a MHz). Even though the CTC used a 1-bit serial processor made of discrete logic, it was still faster than the 8-bit parallel 8008 because TTL logic gates of the time was so much faster than the pMOS that was used in microprocessor chips.

How does this tie CTC’s terminals with personal computers? The Datapoint 2200 was sold as a terminal to mainframes and minicomputers, but were functional enough to work as a standalone computer. The processor, although build from discrete logic parts, was essentially an 8008 because the 8008 was supposed to be the processor the Datapoint 2200 used. It had mass storage (a cassette, optional 8” floppy and optional hard disk), at least 2K of memory, build in screen and keyboard. Because the Datapoint 2200 was mass-produced it has been argued by some that it was the first personal computer. The company founders would have liked to have made it just that, but didn’t push in that direction to keep investors from freaking out. They might not have had an easy time even if investors liked the idea as the machine’s price started around $5,000 in 1971 (around $32,000 today). By comparison the Apple II in 1977 retailed at $1,298 (around $5,500 today). The Altar 8800, as earlier noted a proto-PC, was far less functional and came between the 2200 and the Apple II.

The legacy of the Datapoint 2200 goes beyond just being the forgotten cousin of the PC. The Intel 8008 inspired it’s successor the 8080 (which we noted was used in the Altar). The 8080 wasn’t binary compatible with the 8008 meaning you couldn’t run code compiled for an 8008 on an 8080, but it had the same basic instruction set and CPU registers. The 8080 went on to become the 8085 (an 8080 with interrupts) and then the 16-bit 8086—the first in the x86 family. This architecture serves as the bases for almost every PC on the market today, and that architecture has its roots in a little known smart terminal called the Datapoint 2200. The Apple II may be the mother of the PC, but the Datapoint is the grandmother.

One last lasing effect of the Datapoint 2200, and one that effects me to this day: little-endian. The Datapoint 2200 had a serial processor and needed to start with the lowest bit of the lowest byte first in order to do mathematical carry operations. As a result, words were encoded in little-endian. Despite the 8008 being a parallel processor, Intel used little-endian word ordering and continues to use it to this day. All programmers I know hate it, but at least I now know why.

July 13, 2020

TW2002 Trade Scripting

   I finished my script capable of finding port pairs and trading between them.  The script has a couple parts.  First, it generates a map of the player's known universe.  Using this, it queries every known sector to see if there is a port and what their capacity is at.  Then it checks to see which ports are next to one another.  With this information, the script then checks to see if the port pairs capacity is above some threshold.  If so, it travels to the pair and begins trading until a minimum stock level is reached.
   To improve the script it single-steps while travelling.  Any unseen sectors are scanned.  This helps expand the known universe.  In the future, this will also help in finding sectors with danger and avoiding them.
Steve and Elmwood Stickman

Steve and Elmwood Stickman

   I had this idea a couple months ago.  We have a part of the tree trunk in the front yard, and a bunch of old wood from a front step that was taken down.  I thought a stick figure would be fun.  It is a bit larger than I had planned, but I will trim it down at some point.  I shall call him Elmwood Stickman.

July 09, 2020

Bing Ignoring robots.txt and my Workaround

   Microsoft’s search engine Bing has been ignoring my robots.txt file and has slowly been downloading every image of every size from my photo gallery. This is clearly forbidden by my robots text file but are doing so anyway.
   I forbit robots in this directory for a couple reasons.  First, I want people to come to my site if they want to see photos.  Second, I have several sizes available, and bots simply download them all.  That's a waste of bandwidth.
   To fix this, I added the following to my Apache configuration in my domain's virtual host area:
  SetEnvIfNoCase User-Agent .*bot.*      robot
  <Location "/Gallery">
    <RequireAll>
        Require all granted
        Require not env robot
    </RequireAll>
  </Location>
   This prevents Bing and all other bots from having any access to the directory called Gallery by giving them a 403 Access Denied return code.  I knew it worked when I started getting tons of messages in the error log about access being denied.  This only works for bots that identify themselves with bot in the user agent.  It won't stop harvesters that don't properly identify themselves.
   One question I still have: why did Bing ignore my robots.txt?  But then, why does Microsoft do anything?  Because they can.
   The Red-Dragon typically wakes up each morning, does backups, and turns back off.  Sometimes, however, it fails to establish a connect to the network and just sits there.  I was looking for a script that could check to see how long the system was idle, and then shutdown.  While I found some options, the problem I ran into is that using rsync doesn't count as activity.  So instead I simply made a script that turns the computer off after an hour.  Even or worst case backups only take an 45 minutes, so this should be fine.

July 07, 2020

TW2002 Python Script

   Success in writing a Python telnet script that is able to log into TW2002 and prune planets. Lot of trial and error until I discovered the prompts can mess things up.  Python's telnet library takes some getting used to.  You can have it write something to the telnet port and then wait for a prompt.  There are two things to be careful about.  One, the prompt you are waiting for must be the first occurrence.  That means no stringing together a bunch of commands that could produce the same prompt, as the first instance of that prompt found will satisfy the wait.  Second, TW2002 uses ANSI color codes.  So you need to have your prompt text all of the same color, or a regular expression that takes into account the color change. 
   Once I had that straightened out, I was able to write a script that queried all the player's planets, and then pruned them.  In TW2002, each planet has a maximum number of colonists.  Half that maximum is the optimal number for maximum production.  But colonists reproduce and populations rise.  So you need to move people around in order to keep the planets optimal.  Now I have a script that can do this busy work.
   The script is useful but more as something to help learn the telnet library of Python.  My plans are to make a few more scripted actions as a way to have a script gathering information I can use to better understand the trading algorithm.  And for that, I need to be able to automate trading.

My UPS always reports a communications failure shortly after system start which is broadcast to all terminals.

Broadcast message from root@data-dragon (somewhere) (Sat Jun 27 15:55:16 2020):
                                                                               
Warning communications lost with UPS     

After a quick search I found solution. Edit the file /etc/apcupsd/apccontrol and change WALL=wall to WALL=logger. Now instead of broadcasting the message to all terminals, the message will be placed in a log file.

   The other day while compiling PHP on the Web-Pi, I ran it out of memory and nearly locked it up.  Need to be careful using the -j option in make on smaller devices as finite memory is much more apparent.  Still, although the system was at a crawl and not very responsive, it did eventually respond to the crtl-break, stopped the compile, and recovered fully.  That cannot be said of other systems I've run out of memory.