And an Altair diversion

Back to the future with an Altair!

Retro computing is one of those things that I dabble in. I’d like to do it more, but there’s this thing with time that I don’t have a lot of. But during one of my breaks this last year, I was able to put together one of the AltairDuino Altair replica kits. It’s cool because of all the effort that went into building it and the fact, that I have a dedicated Altair sitting next to me on my desk. One of the semi-recent updates to the emulation code allowed me to run Z80 CP/M (as opposed to the real 8080 stuff). Lots of fun code can be run this way including Turbo Pascal and such.

But – I wanted to know how fast this was. The canonical test of the time was/is the Sieve in basic.

I took the code I had laying around from my experiments with my Atari 800 and modified it to run in the more limited space of the simulated CP/M environment. The change was to put a % next to the flags variable. In MBASIC that marks it as an 8 bit integer. Without that, the program runs out of space. Here’s the code:

10 DIM FLAG%(8191)
20 COUNT = 0
30 FOR I = 1 TO 8191
40 FLAG%(I)=1
50 NEXT I
60 FOR I = 0 TO 8190
70 IF FLAG%(I+1)=0 THEN GOTO 150
80 PRIME = I+I+3
90 K=I+PRIME
100 IF K > 8190 THEN GOTO 140
110 FLAG%(K+1)=0
120 K=K+PRIME
130 GOTO 100
140 COUNT = COUNT + 1
150 NEXT I
160 PRINT COUNT

And here’s the time stamped output of the run:

[2019-12-24 13:59:10] run
[2019-12-24 14:06:09]  1899
[2019-12-24 14:06:09] Ok

How’d I get the timestamps you ask? Well a bit of background on that. The Altair didn’t come with a "console". You used a serial port to connect it to some sort of terminal. What I’ve done is used a USB to serial cable that connects my iMac to the Altair. I then used minicom which I install via homebrew. One of the options of minicom is to timestamp all the output lines in the serial connection.

Anyways. My little emulation thing ran the sieve in just under 7 minutes. Comparable to a time appropriate machine. Cool.

You must be logged in to post a comment.