PiDP8 – still fun after all these days…

I’m still having a blast with my PiDP8, which is a PDP8/I replica that uses a Raspberry Pi (3 in my case) to provide PDP8/I emulation inside a very nice box with replica PDP8/I switches and blinking leds. The PiDP8 was created by Oscar Vermeulen in the  Netherlands and is available from him as a kit. If you are interested, his website is http://obsolescence.wix.com/obsolescence#!pidp-8/cbie

I’ve attached a picture of my finished kit to this post as well.  I’m very happy with the build and with the overall unit. I only had one build problem – There’s a 40-pin header for the Raspberry Pi, and I always solder things in alternate pins/rows to spread the soldering heat evenly about the build. In this case, I managed totally miss one connection. Of course it was the main power connection between Pi and PiDP8, so when I finished, checked & double checked and finally connected it all up and applied power… nothing. After a careful re-scanning under a large magnifier knowing it had to be something really simple, I found the bare connection. Once soldered everything worked perfectly.

As I’ve said in other posts, I’ve been having a blast resurrecting my Engineering graduate studies FORTRAN programs and getting them to run on the PiDP8. I now have over 30 programs running, and all but a couple give results comparable to the same programs’s original output  and my modern 64-bit PC tests. In those cases, it’s due to single-precision floating point rounding errors that cannot be avoided. The originals were double precision, but the PDP8/I FORTRAN IV compiler does not support double precision. Still, I am satisfied with my results, and it was a lot of fun to do.

T800_PiDP8 completed 2016-05-26

PiDP8 (PDP8 replica) and FORTRAN: How suite it is :-)

Sorry for the pun, but I couldn’t resist. (the pun comes from program testing usually being done with a test framework and a “test suite”).

The past few days I have all of my smaller Engineering FORTRAN programs compiled and running on the PiDP8 – my PDP8 replica.  It was time to “work smarter” as they say. The basics of this involve replacing hand-typed commands with batch processes so that dozens of commands are stored in a file and invoked with one short command.

I began by reading all about the OS8 BATCH command and  batch files. I then created some smaller  test batch files to see how things worked, especially program input which usually requires keystrokes such as the following: “EXE RKB0:GAUSS.LD<esc>RKB0:GAUSS.DA/1<esc>” where <esc> means “press the escape key”. Batch files don’t typically allow control characters, so they rely on another mechanism. In the case of OS8, it’s the ‘$’ which tells BATCH that ‘the esc key was pressed’. In the end, the command line

EXE RKB0:GAUSS.LD<esc>RKB0:GAUSS.DA/1<esc>

becomes

.EXE RKB0:GAUSS.LD$

*RKB0:GAUSS.DA/1$

This works perfectly.

With such things resolved, I created two large batch files – one that compiles and loads all of my programs to date, and another which runs the programs. I no longer have to keep load files around as I can recreate them with one command:

SUB CMPALL

and likewise can run all but 3 programs with the command SUB RUNALL. It turns out one set of programs requires too much memory as the DIMENSION statements for some arrays consume 4000 bytes, just under the FORTRAN 4192 bytes allowed. However, this is enough to prevent the programs running under the BATCH system as it requires enough memory to prevent the programs from running (“INSUFFICIENT CORE”).

Still, pretty good stuff.

 

Playing with FORTRAN IV on the PiDP8

I’ve been spending a lot of my research time playing with my PIDP8. This is a replica of the PDP8 (slightly smaller form factor) complete with blinking lights and operational switches, but using a Raspberry Pi as the processing engine. The actual simulation of the PDP8 is handled by Simh, a  remarkable ‘ancient tech’ simulation package.

I’ve been resurrecting all my old Engineering grad school FORTRAN programs and getting them to compile and run on the PiDP8. It’s been a blast!

The PiDP8 runs OS8 as the nominal operating system, and the version of FORTRAN IV available is quite old and a bit quirky. The limits include no double precision, no lower case (at all!), strict adherence to column placement of code and strict 6 character limits on both file names (OS8) and variable names (FORTRAN IV). The quirks come when these limits are violated. Sometimes you get a compile error, sometimes a run-time error, but some times nothing except a hung program. As they say, “the lights are flashing, but no-one’s home”.

Some quick examples. Although there’s no double precision, the compiler accepts “DABS” and “DEXP” library function calls. No error messages anywhere, but the program will just hang waiting for the non-existent library. Using too-long variable names results in compiler error messages that have no apparent meaning until you ‘fine tooth’ the code and realize a variable name is longer than 6.

FORTRAN IV also does not allow free-format read & writes. “read(5,,end=9999,err=9999) x,y,z” is just full of not-allowed stuff. You need a proper format statement for every read & write.

In the end it took quite a while to get all of my programs running; around 35 in total. These include various matrix solvers, mass transfer and heat transfer programs, wellbore programs and flash calculations. As I said, much fun.

There were some differences in output between the original 1980’s runs (on a Honeywell MULTICS system), runs on a modern 64 bit PC running the GNU fortran compiler (f77) and the 12-bit PiDP8. However, with the exception of a couple of programs that I have not had time to scrutinize, all results were well within expected ranges given the differences in word size for single-precision calculations. The two cases that were substantially different were cases where the original program was double-precision on a 32-bit machine and convergence of the iterative solution was difficult, even in the original cases.

Network update

A quick network update today. This is because I was doing some Java development this weekend, and realized this morning that my compile times have improved by an order of magnitude since a few months ago. I wondered why, then realized I had done some network ‘admin’ and that must be the reason.

First, an update on more recent things: since locking down the firewall appliance, things have been stable. No IP reassignment or other problems. I also know to check/change the system time on the OpenBSD box any time I reboot that server (due to incorrect BIOS time).

As for my network speed, it started because I was getting really tired of my SSH sessions being clogged with strange control characters and other weirdness including sudden session drops. When I went to check SSH on other machines including my mac and my other win7 box, there were no issues at all. That meant it was my current win7 machine.

Additionally, anything involving the network on this machine seemed really slow… file copies, compiling (it involves a remote server)… All very slow.

Usually one suspects the antivirus when network stuff is slow, but all machines use the same antivirus, so that was less likely.

Checking google and then stack overflow, one culprit popped up. I have an NVIDEA graphics card on this machine, and I found repeated references to the installed gaming software as causing a lot of network grief. I followed the instructions to disable and/or remove the worst of it, and since then I must admit the network has run better. There are still spurious characters on my SSH sessions, but it’s a lot better. And, as I mentioned earlier, my compile times are much, much faster.

Scary, scary internet

As noted in a recent post, I’ve been having problems with a server (clock) and my firewall/router appliance. The clock issue is now known and should be resolved the next time I want to reboot with a keyboard and monitor attached, but the firewall is still giving problems.

The first manifestation of the problem was the router resetting it’s LAN (internal) IP address to the default value. Even reset, it would continue to operate as the gateway, but DHCP was messed up. Resetting the IP fixed the immediate problem, but it would recur.

Last night I decided to hard reset (power off, wait, power on) the device in hopes of clearing memory, just to be safe. All seemed well, but this morning the device would not display it’s web interface. “Server Reset” is the universal “Don’t look at me” useless browser error message. I did another hard reset and after an hour it the same.

I was able to Telnet (not SSH) into the appliance, and had a look around. It uses “Busybox”, a linux variant as it’s OS. I did some reading on the internet, and discovered, much to my horror, that the FTP port is both unsecured (no password at all) and open to both LAN and WAN sides of the network.

This means that anyone using basic tools like ping could discover my ADSL IP address and then try to telnet into whatever was there. In my case, this would be successful. I think damage would be limited to crashing the device but who knows.

At any rate, I immediately disabled the telnet back door and rebooted the device. Now we wait and see…

One bit of weirdness… SOLVED

I haven’t fixed the time reset problem with my server yet, but at least I now know what is happening. The BIOS time is bad.

Doing my detective work, I searched the internet on ntpd, then checked the system’s logs to see that the time reset happened when the machine rebooted. It became clear that on reboot, the system sets initial time from the BIOS clock, which in turn indicates the BIOS time is WRONG.

Thinking back to the two times the system time was reset recently, I remembered there was a power outage in Feb. The UPS should handle things, but then this week (the other time reset event) I had to change batteries in the UPS as I was getting the “bad battery” light. Of course I powered it off trying to turn off the alarm while I obtained new batteries…

So the problem is now known. Unfortunately, the only way to fix things is to connect a keyboard and monitor to the server and then reboot it and manually fix the BIOS time. That’s not fun, but it will hold until the next machine reboot, which should not be soon given the new UPS batteries.

PDP8 joy – the FORTRAN compiler is working!

I bought this PiDP8 kit, and it arrived two weeks ago. It’s a front panel and box that duplicates the PDP8 front panel complete with blinking lights and switches. It gets it’s OS via SIMH running on a Raspberry Pi.  I have not yet had time to build the kit.

However, an early step in the build instructions directs the user to obtain their Raspberry Pi, install Raspbian and the PIDP8 version of SIMH and then test everything to make sure it’s running properly before trying to plug it into the assembled front panel. There’s another option where you use a custom version of Raspbian that includes the PIDP8 pre-configured to run at boot, but I chose the Raspbian+SIMH route as it’s more flexible.

After getting it all set up, I’ve been having much fun playing with a simulated PDP8 via an SSH console on my PC. What wasn’t fun was the run-time errors I was getting in some simple FORTRAN programs I was testing.

After considerable reading on the internet and downloading and reading through numerous manuals, I found the problem was a missing library – forlib.rl. This is the FORTRAN library that, among other things, has the math subroutines for things like SIN, ALOG, etc. Without forlib.rl, programs simply failed with “USER ERROR LINE XX”.

After confirming the library was indeed absent from the PDP8/SIMH virtual disks loaded when the simulator ran, I went looking on the internet. I found two: ‘disk2.fortran.rk05’ and ‘os8-boot-fort.tu56’. The problem became “what to do with these”?

The PDP8 accepts disk packs, tapes, floppys and paper tape. Files representing these items have different suffixes, so a file RK05 is a disk pack (the RK0 pack, to be precise) and TU56 is a virtual tape.

After much reading, I managed to confirm that forlib.rl was available (on the TU56 file). I was also able to copy it to my default system drive on the PDP8 simulator.

For those interested, the steps are as follows:

ON the PDP8 simulation, <ctrl-e> stops the simulation and puts you into SIMH command mode. So, here is what I did:

Copying FORLIB.RL FROM TAPE TO DISK

<ctrl-e> (in simh)

show dt
set dt disabled
show dt

show td
set td enabled
show td
set td0 locked
att td0 os8-boot-fort.tu56
show td

boot td0

(now on PDP8 – OS on tape)

DIR (dir of tape)

DIR RKA0:

COPY RKA0:FORLIB.RL<FORLIB.RL (no room)

DIR RKA0: /E (this shows all the empty blocks)

SQUISH RKA0: (this consolidates empty blocks)

COPY RKA0:FORLIB.RL<FORLIB.RL (ok)

<ctrl-e> (in simh)

BOOT RK0

(now on PDP8 – OS on disk)

DIR (shows forlib.rl )

COMPILE BENCH1.FT

EXECUTE BENCH1 (works!)

 

This was a lot of fun to figure out, but even more satisfying to have operational. The nice thing about the EXECUTE command is that if forlib.rl is present, it automatically links it in before running the program.

Weirdness. Total weirdness

OK. Weird things happening here.

First, one of my servers that is quite secure is somehow getting the  date changed without me doing anything. Yesterday’s post didn’t appear, and when I checked, it was dated Dec 2015. I checked the system date, and it was indeed Dec 9, 2015. This is the second time this has happened this year. Never before.

It’s a modern operating system, and a fairly recent version. Nothing in the logs, and I’ve not been hacked, so no idea what’s doing the change.

Also yesterday, I could not get on my new Raspberry Pi. It had rebooted and the DHCP address changed from 63 to 62. I went searching for why, and found my main household router/firewall had it’s LAN IP changed totally to a new subnet. However, it was still responding to the correct IP. Eventually I just changed it back to the correct IP, and put a static IP in the DHCP table for my Pi.

Checking settings reveals the device has no external ports, and although there are security warnings about the device, the ‘hacks’ must be done from inside the firewall or with the WAN admin port turned on. Mine is definitely off. So again, just strange.

I’ll keep digging to see if something comes up, but network analysis shows I’m not hacked, so maybe just some bizarre coincidences?

Fun with Electronics

I see that I haven’t posted about some of my toys before. That needs correcting.

Starting with older (recent) toys, I’ve been playing quite a bit with Arduino boards, both for fun and also for my undergraduate robotics course at Athabasca University, COMP444. This course comes with the Sparkfun Software Inventor’s Kit, which contains an Arduino, a perfboard and lots of wires and electronic components to interact with the Arduino. It’s a fun course.

A while ago I bought a better oscilloscope. I had the equivalent of the SEEED micro scope, which is about the size of an iphone. It works, but has several issues related mostly to how little it costs. In an effort to improve my scope (pun!) I bought a Rigol DS1102E from Amazon.ca for a reasonable price (but about 6x the SEEED scope). It’s very nearly a professional scope, and works very well.

So before Christmas I was challenged to make Lissajou figures on the Rigol. You need a signal generator, and I don’t have one. But I do have an Arduino, so hunted about the internet and found a few ‘signal generator with Arduino’ programs. In the end I was able to create a very satisfying Lissajou figure with the Arduino and the Rigol. I even found a program that uses the Arduino to draw a Christmas tree on the scope!

I’ve also always loved older computers. Things like the Heath H8 (my personal ‘want’ from when I was a teen), the IMSAI 8080 and other  older computers. I’ve managed to obtain an Apple Lisa, A 512K Mac, an IBM RS6000, several SUN Solaris Sparc 1 boxes and even an HP 9000 (full rack mount unit). Sadly, I had to give them all away when we moved or else the moving bill would have been even worse!

Lately I’ve been bitten by the bug again. This time I started with a mini version of the Cosmac ELF, called the Membership Card. It’s a fully functional copy of the Elf but sized to fit inside an Altoids tin. It was fun to build and is still fun to run. It currently sits powered up running a 1-D game of Life.

Now I’ve upped the ante. I bought a PDP8 front end that is an almost perfect replica of the front panel of the PDP8, but uses a newer Raspberry Pi as the actual computer. The Pi runs SIMH, which is an almost universal “old time computer simulator”. You can get SIMH configurations for various PDP variants, HP machines and many other older brands. I have yet to build the PDP8 front panel, but soon…

The perfect academic computer?

I’ve been doing some reflecting lately on my computer setups, and have come to the conclusion that I may well have created a perfect university computer, at least for computer science students and academics.

Perhaps not surprisingly, it’s a Mac. One of the things that makes it perfect is that it’s not any particular model or configuration of Mac… just a Mac. Mine is a 2012 17in MacBook Pro, but a Mac mini would work, as would any of the newer macs including the macbook pro and air lines. That’s because it’s finally NOT about the hardware.

Sure, you still need decent hardware, but almost any Mac will now suffice.

No, what’s critical is the operating system. In the case of the Mac, it’s OSX, which is really a variant of FreeBSD, which is a flavor of Unix based of the Berkley strain. What makes OSX very nice is that it’s been tailored ‘out of the box’ to run very well on the  Mac hardware, but it’s still a full-blown Unix. For me, that’s key as I really still am not a big fan of the Linux variants. Linux isn’t BAD, it’s just not… Unix. Most people don’t care, but I’m old enough to have grown up with true Unix and I still prefer it.

The mac and OSX have lots and lots of software that runs well on the box. Most any PC (a.k.a. Windows) software has a Mac variant, or at least most of the good stuff does. I have Adobe software (Lightroom, Photoshop, Premier) that came with both Mac & PC versions, and both run almost identically on either platform. There are perhaps even better native OSX programs for photo/video work as well if you wish. In addition, as a programmer, the XCode support for C++ and IOS programming is excellent, plus it supports source code version control via GIT out of the box. Other languages, such as Java, can be easily installed and work seamlessly. Command-line  tools offers additional support for C++ and other languages if you don’t want the graphical environment.

With open software such as OpenConnect you can connect to any VPN (virtual private network) solution. Loading additional software can be very easy and painless with tools such as Homebrew.

But, that’s not the best part.

The best part is Virtual computer support.  With Oracle’s VM Virtualbox, you can install almost any operating system on the Mac that you desire. This can be a real godsend if you need to use a program only available for a specific operating system, or if you need a specific operating system for some class work.

For example, I’m currently playing with C++. Again, the XCode command-line tools offers excellent C++ support. But I’m working through a text that uses Microsoft’s Community edition of the Windows C++ compiler (Visual C++). It won’t install on a Mac. In fact, it’s designed to run “best” on Windows 10, which is something I don’t want to install on my primary PC.

Enter Virtualbox, and I can easily install the educational edition of Windows 10, followed by the community edition of Visual C++. I’ve tested them and they work perfectly on the Mac under Virtualbox. I also have Virtualbox OS installations of Solaris 10, OpenBSD, Windows XP (for Lego Mindstorms work) and Windows 7. They all work perfectly on the Mac.

So at the present time, it seems that the Mac would be perhaps the perfect academic computer?