With large language models being all the rage, I found this tweet (x?) on twitter (x?), from Alex Cheema, discussing Andrej Karpathy’s port of a LLM, to C llma2.c, and then converting it to build with Borland C v5 as llma98.c .
Well naturally I had to take that source code, and make it more C89 happy!
I found this magical sed recipe over on stack overflow:
sed -e 'sX// *\(.*[^ ]\) *$X/* */X' < oldfile > newfile
Thanks Preston Crow!
So, with some really minor hacking, and my port of GCC 1.40 to OS/2, I was shockingly up and running in no time! I should add again that I do kind of enjoy the much older GCC since it was capable of being built with ‘vendor’ tools, in this case the December 1991 Windows NT pre-release C compiler.
I didn’t bother ‘fixing’ the timing code, as honestly it doesn’t matter, running this on my PS/2 Model 60 with the SLC50 upgrade card is incredibly slow.
At best it’s about a word every two minutes, getting this far was over 3 hours of runtime.
I have a feeling much like MP3, where the ideas are significantly older than when they found mainstream success, there is a lesson here to the impatient ones, that just because something doesn’t work today, or seem incredibly unwieldy, it doesn’t mean decades later it’ll be incredibly popular.
For anyone wondering, I also built one that uses the TNT extender, and it seems to require 4MB of RAM. Absolute beast of a 32bit machine for 1987, but here we are.
So yeah, Happy 2025!