danirod 11 hours ago

Hi, author of Jacqueline here. I read HN almost daily so it caught me off guard to see my stuff here.

It's been a long time since I did this (2019). It was a prototype just to see if a standard PC boot loader could hand-off into something that's not C (or Rust). And yes you can, as long as the programming language has a way to control how symbol names are exported, and then to link the object code with the rest of the boot loader.

You won't have a runtime unless you implement one, so for most languages there is no stdlib, no exception handling, no garbage collector... But it is fun anyway. As I said, this was a prototype and once it could say Hello World I considered it complete.

Happy to see it here though, and I'll be happy to answer any questions about what I remember, or what is like to write code in Pascal, or OS development or i386 in general.

sedatk 11 hours ago

I remember writing my own bootloader for my DOS-successor OS project with its own FS when I was 17. Never got around other than running a primitive kernel that just displayed text on the screen though. Fun times! https://gist.github.com/ssg/546634

nn3 11 hours ago

Thats the pascal kernel in all its glory. Its just a bare metal hello world

KernelMain(); [public name 'kernelMain']; begin consoleClearDisplay(); consoleSetAttributes(White, Black); consolePutString('Hello world'); end;

deaddodo 10 hours ago

> Even while Pascal wasn't written with low-level programming in mind

If that’s true, then neither was C, Algol, etc. When those languages were conceived, “low-level” programming was just “programming” and “high-level programming” was the exception. Mostly because the hardware ecosystem was far more fragmented and an OS wasn’t guaranteed.

To that effect, all of those languages give you the “features” necessary to “low-level” program, namely: raw pointers and ability to compile for freestanding environments.

  • mycall 2 hours ago

    I remember embedding assembly inside my Turbo Pascal procedures and functions, using asm/end blocks. It worked quite well. External assembly module object linking was an option too.

james_marks 12 hours ago

Love it

> Jacqueline is an experimental bootloader written in Pascal (Free Pascal dialect) written for the i386 architecture, just because

pjmlp 11 hours ago

Remember kids, there were a few 1980's OSes that made use of Pascal.

Nice to see yet another experiment that isn't always C or C++.

  • kjs3 2 hours ago

    I used Apollo Aegis (later Domain), Three Rivers PERQ and CDC NOS, all written in some variant of Pascal.

  • jll29 10 hours ago

    Mac OS 9 was written in Pascal, and so was the Berkeley P-System, a portable Pascal development environment from the 1970s, featuring a virtual machine that influenced the later JVM. Apple's Lisa OS was also implemented in Pascal.

    • dboreham 7 hours ago

      UCSD p-System perhaps?

phendrenad2 12 hours ago

i386 is a great target for toy OSs. There's no risk of getting a bit megalomaniacal and thinking your OS could ever be anything more than a toy. Also, it's more challenging than RISC-V, ARM, and even x86-64, so it feels like more of an accomplishment if you actually make it to userland and back without catastrophic failures.

  • andai 12 hours ago

    "doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386" -Linux Torvalds, 1991

jacquesm 11 hours ago

Finally an OS I can really get behind.

HeavyStorm 11 hours ago

Pascal? The author must hate himself.

  • jacquesm 11 hours ago

    How come? Pascal is a perfectly good language, it wouldn't be my first choice for anything but compared to quite a few other languages from that era it got lots of things right.

    • jll29 10 hours ago

      There have always been fanboy "camps" feuding each other, from "What's the best programming language?" to the never-ending "What's the best text editor?".

      Brian Kernighan tried to port his famous software tools (the code to go with the likewise famous book) to Pascal and failed, which led to a write-up, in which he identified 9 shortcomings of Pascal that C doesn't have. https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pas...

      But needless to say, there exist also many strenghs of Pascal over C, which he does not address. I find his claim that Pascal is only a toy language in which serious software can be written unprofessional and empirically untrue: for over a decade, PC software development in Pascal was thriving thanks to TurboPascal. Now admittedly that is not standard ISO Pascal, but at the same time, it is a well-known fact that it existed, and that it fixed some of the criticisms of Kernighan's paper, so it is regrettable he still elected to use such strongly negative language regardless. (And for the record, his paper was written 1981, when Pascal's successor Modula-2 was already available.)

      I like C and Pascal, each in their own way, but Pascal is arguably much more readable, and perhaps it is fair to say many Pascal programmers were comfortable in the language and would not have bothered to learn/struggle with C.

      • stonogo 9 hours ago

        I find the claim that bwk 'failed' suspect, since I have a copy of "Software Tools in Pascal" on my shelf right now.

        Almost the entirety of his criticisms were accurate in 1981 and addressed even five years later, and many of them say more about his assumptions than they do about Pascal. For instance, the implicit assumption that arrays must be the natural way to deal with strings rings hollow; some years later, "I wish it were as easy to deal with strings in C as it is in Pascal" would be a common refrain.

        I think bwk is one of the best people in the industry, both technically and personally, but I feel this essay is an artifact of its time more than a lasting commentary on Pascal as a whole.