Monthly Archives: March 2025

PLIHK: Machine code

(Cross-posted from my personal blog.)

My other coding experience in my senior Physics lab was in one of the more fun modules: a digital voltmeter. We had a breadboard with a simple processor chip, memory chip, EPROM, etc. along with another chip that was either a digital to analog converter or digital signal processor, I don’t remember which, and a bunch of other components like resistors and capacitors. We had to wire it all together, and then write a program that would connect the capacitor to the voltage we wanted to test, let the capacitor charge, and then let it discharge through a known resistance. While it was discharging the program went into a loop that incremented a counter, and when it reached a low threshold the DSP or D2A chip (whichever it was) would interrupt the processor, and you could use the counter to calculate the voltage knowing the capacitance and resistance. You had to write this program using the machine code for the chip, and then you entered the program by pressing a toggle until the hexadecimal value for the next byte of the program appeared on a two-character display and then pressing a button that stored it in the next memory location. You also had to look up exactly how long each instruction in the loop took to execute so you could convert the counter value into seconds.

I’m not being sarcastic when I say it was fun. Maybe I was meant to go into programming.

PLIHK: APL

(Cross-posted from my personal blog)

I had encounters with programming in another BYU class, my senior Physics lab. This class was billed as “things about labs and such every Physics graduate should know”, but in practice seemed more like “how many ways can we torture Physics students one more time before giving them a degree?” It consisted of a series of modules that were only related in having something to do with Physics and something to do with labs.

Anyway, one of the modules involved writing a series of programs in APL, on a teletypewriter connected to a server computer via modem. So yes, you’d go into the lab, dial the server’s number on a telephone, and then place the handset on the modem attached to the teletypewriter and hope the connection worked.

APL stands for “A Programming Language”, which to be fair is correct as far as it goes. Now, I haven’t had anything to do with it for nearly half a century, so this is how I remember it. It was very mathematically oriented and very concise. It required a special keyboard because most of the operations were specified with mathematical symbols. Some of these symbols were for things like matrix addition and multiplication, so you could write a program that did a lot of calculating in only one or two lines of code. The downside of this concision was poor readability. More than once I wrote a program, got it working, and then the next day looked at it and couldn’t figure out what it was doing or how it did it. I’ve jokingly referred to APL as a “write-only” language. It did have, on the other hand, the idea of a “workspace” where your programs, data, and results were stored.

PLIHK: FORTRAN

I’ve decided to write a series of blog posts in the category “Programming Languages I Have Known” (PLIHK). This is a cross-post from my personal blog. I will understand if you want to bail out now.

My first exposure to a programming language was in elementary school when my father brought home some COBOL manuals for me to read, but since I didn’t have access to a computer to actually write and test programs then I didn’t really learn anything from them. I will make no claims to understanding COBOL.

Instead, my first actual experience writing programs was when I took a Numerical Methods course as an undergraduate. I found out the week before class started I was expected to know FORTRAN, but my brother Erick had taken a class in it and still had his textbook, and the Numerical Methods textbook (which I think I still have somewhere) had many examples, so it really wasn’t hard to pick up enough to do the assignments.

FORTRAN was an amazing accomplishment for its time, and it proved that programming in a level above machine code or assembler was not only possible but desirable. So I’m not going to bad-mouth FORTRAN at all. That being said, an awful lot has been learned about programming language design since then, and the only reasons I can see to use it now are “historical curiosity” or having a large body of existing code needing maintenance that might take more effort to rewrite than is justified.

In case you’re wondering, the main thing I remember from my Numerical Methods class is “floating point numbers are fiddly.”