Brain Phrye

code cooking diy fiction personal photos politics reviews tools 


APC Research Phase

I came across a bunch of code I wrote in high school. So I decided I could see if I could get the programs running again.

I have them running inside of DOSBox but I was wondering if I could get them running natively. And sure enough, there’s a Free Pascal project. It’s targeted at “newer” versions of Turbo Pascal than I used.

Amusingly I already hit an issue with the systems runtime library.

The keyboard unit has a bug if you it from inside tmux. It tries to determine the kind of terminal it’s connected to and it decides to do this via parsing /proc/PID/stat. But unfortunately it does this the wrong way because the second field in /proc/PID/stat can pretty much have any char in it. To parse it correctly you need to parse backwards on the line - and the risk is if kernel developers add fields.

More detail on the code spelunking is on the mailing list but it will be interesting to see how they address it.