Compiling And Running Turbo Pascal In The Browser

When a friend of [Lawrence Kesteloot] found a stack of 3.5″ floppy disks, they found that it contained Turbo Pascal code which the two of them had worked on back in the Summer of 1989. Amidst reminiscing about the High School days and watching movies on VHS, [Lawrence] sought a way to bring these graphical applications once more back to life. Not finding an easy way to compile Turbo Pascal code on Mac even back in 2013 when he started the project, he ended up writing a Turbo Pascal compiler in JavaScript, as any reasonable person would do in this situation.

SPIDER.PAS in its full glory. (Credit: Lawrence Kesteloot)
SPIDER.PAS in its full glory. (Credit: Lawrence Kesteloot)

As noted by [Lawrence], the compiler doesn’t implement the full Turbo Pascal 5.5 language, but only the subset that was required to compile and run these applications which they had found on the floppy disks. These include ROSE.PAS and SPIDER.PAS along with three others, and can also be found in the GitHub repository. As can be seen in the online version of the compiler, it captures the feel of programming Pascal in 1989 on the command line.

Naturally, the software situation has changed somewhat over the last decade. We’ve recently seen some promising multi-platform Pascal compilers, and of course you could even run Turbo Pascal in DOSBox or similar. That might make this project seem irrelevant, but being able to write and run Pascal applications in more ways and on more platforms is never a bad thing.

15 thoughts on “Compiling And Running Turbo Pascal In The Browser

  1. Neat! But JavaScript…. Yikes.

    I use Free Pascal and Lazarus on my Linux machines now for Pascal. It’s available on Windows too for those that are still on that platform. But Borland Pascal came out while I was in college, and used just about every version through the Delphi versions and when bought out by Inprise… Few years ago now…

    1. Not sure what other way than JavaScript and the dom as a target could get your old code onto every modern computer or device in one fell swoop. Targeting web assembly is the new way you’d do this but JavaScript does fine.

    2. Borland renamed themselves to Inprise, because it is a total clever move to kill a well known brand name and start up fresh. This move was soooo smart, that some year later (!) they changed their name back to Borland.

      Some more years after that, the now totally defunct company was eaten by something bigger.

      IMHO the Borland products were great stuff. Like “we could rule the world today”. One of their greatest concepts was to make it an easy entry: low prices or even free tools (like MS does with VS CE today). Let the customer grow and then ask for enterprise grade money. They had peak technology tools for Windows GUI development but missed the “big database train” and staggered around with old, outdated stuff like “paradox”.

      And of course they lost Anders Hejlsberg. He is a genius language developer. I personally think Borland never recovered from that loss.

    3. “Windows too for those that are still on that platform.”
      So the vast majority of everybody then? Including developers who use Linux based systems in their a daily basis.
      The supercilious attitude of some developers who think that anyone who doesn’t exclusively use their preferred Linux as lesser in their technical development is hilariously hypocritical.

  2. From Wikipedia:

    “Scott MacGregor of Microsoft said that Bill Gates “couldn’t understand why our stuff was so slow” compared to Turbo Pascal. “He would bring in poor Greg Whitten [programming director of Microsoft languages] and yell at him for half an hour” because their company was unable to defeat Kahn’s small startup.”

    1. And BG was absolutely right. The guy worked on Microsoft BASIC interpreters. You will see every optimization in the assembly programmer’s book looking at BASIC ROM disassemblies.

  3. “As can be seen in the online version of the compiler, it captures the feel of programming Pascal in 1989 on the command line.”

    Yup, that’s about right.
    If I had been picky, I would argue that about the time we already had PC-/MS-DOS 4 with DOS Shell or DR DOS 5 (released May 1990 w/ ViewMax, GEM v3 based) and modern programming IDEs (IDEs with compiler and interpreter and on-line help).

    Windows /386 also had been around, technically, it double functioned as an EMS memory manager to owners of then-new 386 PCs.

    Turbo Pascal 5.5 and QuickBasic 4.5, Turbo C had been around already, too.
    VGA card clones were sold since feb. 1988, too, afaik.

    The PC platform was very colorful and comfortable to use, given the right hardware. Some had an AdLib music card, even or an Roland MT-32.

    Of course, the average PC user didn’t have the newest technology at home, maybe. That’s understandable.

    In 1989, many poorer users still had an Turbo XT, Hercules or CGA graphics and a 5,25″ 360k floppy drive without a fixed disk.
    As if it was 1986/87, so to say.

    On such dinosaurs, MS-DOS 3.2, GW-BASIC and Turbo Pascal 3 could be found, still.
    Or also Turbo Pascal 4, Graphix Toolbox etc.

    Anyway, I don’t mean to complain.
    I merely want to give an impression about different hardware configurations.

    The Turbo Pascal 3 shown in the article was a classic, an evergreen, so to say.

    It had been popular among Z80 CP/M users and allowed easy porting between DOS and CP/M world.

    Turbo Pascal 6 of 1990 even had a compatibility option for Turbo Pascal 3 (sub directory)..

  4. Turbo Pascal for the Mac was pretty much the first low-cost Mac-resident compliers(most others required a run-time app, or were Apple’s (at that time) pricey dev environment.

    Unfortunately, support was brief. They didn’t keep up with OS version enhancements, and I was told they stopped selling because “they sold 10,000 copies but 20,000 course we’re in use.”

    My next projects were in Hypercard.

    1. Interesting. That thinking of Borland was a bit shortsighted, though, in my opinion.
      Even if it hadn’t sell in quantity and did cause much income, the Mac version surely was a good advertisement.
      Because generally speaking, programmers/developers like the idea that their favorite programming language is available to multiple platforms.
      That way, they can port applications over, if it’s being requested by a customer.
      Profits are no substitute to commonsense.

  5. “Not finding an easy way to compile Turbo Pascal code on Mac even back in 2013 when he started the project”

    DosBox didn’t run on Mac in 2013?

    Sounds to me like he just wanted an excuse to make this project. Which is a good thing, no excuse necessary.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.