Free Pascal Compiler for the X68000

Started by Chain-Q, January 01, 2024, 07:01:34 AM

Previous topic - Next topic

Chain-Q

Hi there,

it's my first post here. Just registered, since this forum seems to be the go-to place for all things X68000, at least in English. I hope I'm not violating any sort moderation rules.

So after acquiring an X68000 Expert HD from a friend earlier in 2023, I decided to look into its programming the last couple of months. Since I'm the maintainer of the Free Pascal Compiler on anything Motorola 68k, I quickly decided I want to program this thing in Pascal, so I decided to add a (cross-compiler only for now) Human68k target into Free Pascal. It uses vasm as the assembler and vlink as the linker backend from the VBCC toolchain. We now have a Free Pascal Wiki page about the port here, and all the relevant Human68k-specific code is available here and here.

I documented my journey on Mastodon (with pictures!). After getting the first assembly Hello, World! running, I decided to go directly for the compiler port, so I taught the compiler how to generate Human 68k specific DOS calls, then got a Pascal Hello, World! running relatively quickly. Then after some more work, I had basic console input working. And along with that, memory allocation, and file I/O as well. Not long after, I added parameter handling. I kept working, but I added relatively large amounts of code for various parts of the library, that has been untested so far. We'll see how it goes. Along the way, I also found several issues (here and here) in Lydux's GCC port, but I was too lazy to make a PR or something. I'm not even sure that particular port is still maintained at all. I hope someone else will tell me here.

As my X68000 is not operational - needs a 240V PSU conversion, also a keyboard/mouse adapter, so I used RetroApp and Run68Mac for testing. This later one I also forked to add some fixes/patches that served my use case better. I will try to get the hardware running and also test on it, of course. That's always a lot more fun than emulators. Even if doing the initial work with emulators is so much faster.

Anyway, I just wanted to post about it here. Maybe someone finds it interesting. Feedback/questions are welcomed. I will keep fiddling with it, and I'll keep the port up-to-date with changes in Free Pascal going forward. I might also do some other software for the X68000 thanks to this. But we'll see.

Happy New Year (2024) everyone!
Free Pascal Compiler for m68k - an Amiga fan outside his comfort zone

FedericoTech

Hi there, precisely I did a pull request on Lydux with fixes. I don't think he is going to approve it though as it is not longer maintain.
You can use my version though, at https://github.com/FedericoTech/newlib-1.19.0-human68k

I also have done many examples of things at https://github.com/FedericoTech/X68KTutorials

You may want to have a look at my blog, especially to this article where I talk about things I found of the OS https://federicotech.wordpress.com/2023/12/16/x68000-programming-chapter-trs-programs/

I hope you find it useful

Chain-Q

Hey, I just noticed your reply here, thanks! Yes, I've already found your stuff just by googling for information, while I was working on X68000 things. I will then do a PR against your version, as I just checked, and some of the issues still seem to be in there. Free Pascal itself is self-hosted, so it doesn't need GCC or a libc, but it's still good for everyone if these issues are corrected.

If you allow me, I will also port some of your example programs to Pascal. I will keep a reference/credit to your original, of course.

I'm very busy these days with other things, but I'll get there!
Free Pascal Compiler for m68k - an Amiga fan outside his comfort zone

FedericoTech

#3
yes please, feel free