3 ms·
I'm glad to see that others remember this fondly as well. The Pascal to C translation was a bit gruelling. I'd like to say that I'd written a fancy transpiler
by loadzero 6y ago
I'm glad to see that others remember this fondly as well.
The Pascal to C translation was a bit gruelling. I'd like to say that I'd written a fancy transpiler for it, but it came down to a 20 line ruby script, some vim macros and a ton of elbow grease.
I added the functions to emulate the Turbo Pascal library as I went. This was a bit more fun, because I got to play around with implementing line drawing, circle drawing and flood filling, and really low level stuff like that.
The final stages, adding in threading to handle emulating the keyboard buffer, framebuffer and PC speaker was also a lot of fun.
I plan to cover at least some of these things in part two.
- fiddlerwoaroof 6y agoWhy not use something like freepascal with SDL bindings?
- loadzero 6y agoWith these restoration projects, I am usually looking to maximise code portability and minimise dependencies, which for me means C. Sticking with Pascal would have been more authentic to the original source code, but I think that would have been more painful for me to deal with, and come with a lot of unknown unknowns. I would likely also have been sacrificing my ability to port it onto the web and other interesting targets.
- pjmlp 6y agoFreePascal WebAssembly is almost fully there and FPC already has plenty of supported targets, basically almost any CPU that matters. However it is your project, your decisions.
- fiddlerwoaroof 6y agoYeah, that makes sense, I mentioned freepascal specifically because it has pretty broad platform support (and can generate LLVM bitcode). But, maybe the cost of translating to C is worth it.