nfg.forums

NFG Forums => SIG X68000 => Topic started by: Chain-Q on January 01, 2024, 07:01:34 AM

Title: Free Pascal Compiler for the X68000
Post by: Chain-Q on January 01, 2024, 07:01:34 AM
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 (http://sun.hasenbraten.de/vasm/) and vlink as the linker (http://sun.hasenbraten.de/vlink/) backend from the VBCC toolchain. We now have a Free Pascal Wiki page about the port here (https://wiki.freepascal.org/Human_68k), and all the relevant Human68k-specific code is available here (https://gitlab.com/freepascal.org/fpc/source/-/tree/main/rtl/human68k?ref_type=heads) and here (https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/h68units?ref_type=heads).

I documented my journey on Mastodon (with pictures!). After getting the first assembly Hello, World! running (https://mastodon.social/@chainq/111453556522651178), 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 (https://mastodon.social/@chainq/111499392378436287) relatively quickly. Then after some more work, I had basic console input working (https://mastodon.social/@chainq/111516679218716316). 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 (https://mastodon.social/@chainq/111461500478055714) and here (https://mastodon.social/@chainq/111560576170367565)) 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 (https://github.com/chainq/run68mac) 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!
Title: Re: Free Pascal Compiler for the X68000
Post by: FedericoTech on April 14, 2024, 09:58:57 AM
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 (https://federicotech.wordpress.com/2023/12/16/x68000-programming-chapter-trs-programs/)

I also have done many examples of things at https://github.com/FedericoTech/X68KTutorials (https://federicotech.wordpress.com/2023/12/16/x68000-programming-chapter-trs-programs/)

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/ (https://federicotech.wordpress.com/2023/12/16/x68000-programming-chapter-trs-programs/)

I hope you find it useful