Atari ST C Dev under Windows

News,announcements,programming,fixes,game patches & discussions.

Moderator: troed

User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 10462
Joined: Thu Aug 17, 2017 7:40 pm
Location: Essex
Contact:

Atari ST C Dev under Windows

Post by rubber_jonnie »

I have Pure C setup on my MSTE, and despite not having a full manual, I've kind of figured it out and am able to write, compile and run some silly little progs.

However, I also have Visual Studio 2019 on my laptop and was wondering if anybody had set up a dev environment for the ST using it?

Specifically I was wondering if it was possible to set up the includes that come with Pure C and GODLIB to work under VS, or if not VS Codelite, which is a nice little IDE.

Also, what do you do about cross-compiling?

Due to my impending house move I won't be able to use my physical machines, only emulators, so i was hoping I could set something up to tinker with on my laptop that I could then run on Hatari.

All ideas welcome.
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
User avatar
thorsten.otto
Posts: 148
Joined: Mon Nov 04, 2019 2:20 am

Re: Atari ST C Dev under Windows

Post by thorsten.otto »

That will be hardly possible. The command line tools of Pure-C cannot be executed by the Visual IDE, you can only use them in an emulator, but then you might as well use the Pure-C shell.
Specifically I was wondering if it was possible to set up the includes that come with Pure C and GODLIB to work under VS, or if not VS Codelite, which is a nice little IDE.
Pure-C and GNU-C have different calling conventions, so you cannot directly mix code produced by Pure-C (the libraries) with other code, even if you use the same includes.
Also, what do you do about cross-compiling?
Same as above: since the tools are not executable on other hosts, you cannot use them there. Best you can do is to make your code compilable by both gcc and Pure-C, and do cross-compilation using gcc. Then later you can do your final compilation using Pure-C.
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 10462
Joined: Thu Aug 17, 2017 7:40 pm
Location: Essex
Contact:

Re: Atari ST C Dev under Windows

Post by rubber_jonnie »

@thorsten.otto

Thanks for the advice, I find it very strange that after all these years this isn't possible. I guess it was worth an ask, and I'll just have to try and go with Pure C under Hatari or Steem.
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
mikro
Posts: 474
Joined: Mon Aug 28, 2017 11:22 pm
Location: Kosice, Slovakia
Contact:

Re: Atari ST C Dev under Windows

Post by mikro »

Just to clarify: this doesn't mean you can't code, compile and to some extent even debug your Atari code with Windows/Visual Studio. Just the PureC part must go away.

It's totally possible to setup Visual Studio (or any other editor/IDE) calling your m68k-atari-mint-gcc, catch its error messages etc. What do you do after that it's up to your needs -- you can have a small hardware/tool to upload to real Atari, you can start Hatari/Steem with your new executable, you can copy it to a shared CosmosEx NFS/Samba folder, ...

Many options.

Btw, you can certainly setup GODLIB includes (or whatever includes) and parse them by Visual Studio. You just wouldn't be able to compile/use the supplied GODLIB libraries.
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 10462
Joined: Thu Aug 17, 2017 7:40 pm
Location: Essex
Contact:

Re: Atari ST C Dev under Windows

Post by rubber_jonnie »

mikro wrote: Thu Feb 18, 2021 5:59 pm Just to clarify: this doesn't mean you can't code, compile and to some extent even debug your Atari code with Windows/Visual Studio. Just the PureC part must go away.

It's totally possible to setup Visual Studio (or any other editor/IDE) calling your m68k-atari-mint-gcc, catch its error messages etc. What do you do after that it's up to your needs -- you can have a small hardware/tool to upload to real Atari, you can start Hatari/Steem with your new executable, you can copy it to a shared CosmosEx NFS/Samba folder, ...

Many options.

Btw, you can certainly setup GODLIB includes (or whatever includes) and parse them by Visual Studio. You just wouldn't be able to compile/use the supplied GODLIB libraries.
Ahh this sounds more like what I'm thinking, do you have any pointers to online guides please? I have searched and can't find anything.
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
User avatar
mfro
Posts: 122
Joined: Thu Dec 13, 2018 7:32 am

Re: Atari ST C Dev under Windows

Post by mfro »

Never tried myself, but at least the repository here: https://github.com/ReservoirGods/GODLIB suggests somebody did.

No idea what state that is in, but it appears the configuration is set up to compile GODLIB using VS/gcc in a Windows/CygWin environment.
And remember: Beethoven wrote his first symphony in C.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: Atari ST C Dev under Windows

Post by sandord »

mikro wrote: Thu Feb 18, 2021 5:59 pm Just to clarify: this doesn't mean you can't code, compile and to some extent even debug your Atari code with Windows/Visual Studio. Just the PureC part must go away.

It's totally possible to setup Visual Studio (or any other editor/IDE) calling your m68k-atari-mint-gcc, catch its error messages etc. What do you do after that it's up to your needs -- you can have a small hardware/tool to upload to real Atari, you can start Hatari/Steem with your new executable, you can copy it to a shared CosmosEx NFS/Samba folder, ...

Many options.

Btw, you can certainly setup GODLIB includes (or whatever includes) and parse them by Visual Studio. You just wouldn't be able to compile/use the supplied GODLIB libraries.
Well, this is quite similar to what I'm doing in my current project:

- I code using Visual Studio Code and some extensions enabled to get C color coding/linting/inspection/navigation support and 86K assembly color coding. This works surprisingly well and comfortable! The extensions are "ms-vscode.cpptools" and "prb28.amiga-assembly".
- I'm using GODLIB.
- I build the project in an emulator, using the Resevoir Gods' PUREBOT tool, which in turns uses Pure C. This way you won't have to start the Pure C editor, it works by simply double clicking the .PRJ file.

I'm looking for a way to use cross compilation myself so I'm very interested in further suggestions.

By the way, I noticed that GODLIB is built to be able to produce Windows binaries as well, using DirectX. I don't know in what state that part is though, I never tried it. But for me it's not very interesting because such builds would not allow to catch many possible issues that would only occur on the ST. It would be of more interest if I wanted to do multi-platform distribution.
User avatar
thorsten.otto
Posts: 148
Joined: Mon Nov 04, 2019 2:20 am

Re: Atari ST C Dev under Windows

Post by thorsten.otto »

sandord wrote: Fri Feb 19, 2021 9:11 am
- I build the project in an emulator, using the Resevoir Gods' PUREBOT tool, which in turns uses Pure C.
Funny, did not know that such a tool exists. Looks a bit complicated to me though, and from what i can tell after a brief look, it does not handle path names correctly. and also does not handle nested project files. Interesting though that they apparently embed the Pure-C compiler command line tools into the executable.
This way you won't have to start the Pure C editor, it works by simply double clicking the .PRJ file.
If i understand that correctly, that works by firing up steem, passing some options. Maybe you can achieve similar things by using a similar tools (a Pure-C project parser) that i wrote some time ago (available at https://github.com/th-otto/pcmake).
I'm looking for a way to use cross compilation myself so I'm very interested in further suggestions.
In newer VS versions, you can enhance the MSBuild environment. I've done that long time ago to add support for an old version of MASM. Similarly you should be able to define rules for a cross gcc compiler (either the cygwin version, or maybe simplier by using the plain mingw version which you find at http://tho-otto.de/crossmint.php). Maybe you can find some examples for this in other projects like NASM.
User avatar
rubber_jonnie
Site Admin
Site Admin
Posts: 10462
Joined: Thu Aug 17, 2017 7:40 pm
Location: Essex
Contact:

Re: Atari ST C Dev under Windows

Post by rubber_jonnie »

Excellent stuff from everyone, thank you :)
Collector of many retro things!
800XL and 65XE both with Ultimate1MB,VBXL/XE & PokeyMax, SIDE3, SDrive Max, 2x 1010 cassette, 2x 1050 one with Happy mod, 3x 2600 Jr, 7800 and Lynx II
Approx 20 STs, including a 520 STM, 520 STFMs, 3x Mega ST, MSTE & 2x 32 Mhz boosted STEs
Plus the rest, totalling around 50 machines including a QL, 3x BBC Model B, Electron, Spectrums, ZX81 etc...
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: Atari ST C Dev under Windows

Post by sandord »

thorsten.otto wrote: Fri Feb 19, 2021 1:06 pm
sandord wrote: Fri Feb 19, 2021 9:11 am
- I build the project in an emulator, using the Resevoir Gods' PUREBOT tool, which in turns uses Pure C.
Funny, did not know that such a tool exists. Looks a bit complicated to me though, and from what i can tell after a brief look, it does not handle path names correctly. and also does not handle nested project files. Interesting though that they apparently embed the Pure-C compiler command line tools into the executable.
I wrote instructions for my current project, on how to set up your environment for using it with PUREBOT. I've adapted them to be more generic. Maybe this will be of help to you. It works quite nicely, I have to say. The most important thing is that the location of the repositories are according to the instructions because GODLIB/PUREBOT has some baked-in relative paths, cross-referencing between repository directories.

Note: the following instructions are formatted using Markdown so you might want to copy & paste them into an .md file and open them in a program that supports previewing Markdown for enhanced readability 8-) This of course is very un-retro :roll:

Oh and sorry about the .1 items not counting up but that's an actual Markdown feature where they count up automatically :roll:

#######################################################################################################################

## Development environment setup

- Inside the host OS:

1. First, you might want to consider putting your repository into a sub-directory (e.g. `C:\Git\ATARIST`) because the Reservoir Gods repos are going to have to reside in the same directory as the current repo. Of course this is completely optional but I think organizing them like this is a bit cleaner and emphasizes the dependency between them.

1. Clone the Reservoir Gods repos into the same parent directory as the current repository:

- `cd \Git\ATARIST` (or wherever your repository is located)
- `git clone https://github.com/ReservoirGods/GODLIB`
- `git clone https://github.com/ReservoirGods/TOOLS.RG`

_Note: don't change the default directory names of the clones as several relative paths inside `TOOLS.RG` rely on it to escape from the `TOOLS.RG` repo and reach into the `GODLIB` repo._

1. Start an Atari ST Emulator (e.g. STeem or Hatari)

1. Set the ROM to TOS 2.06

_Note: the **Install Application** feature (which is used below) won't work for PUREBOT in older versions of TOS._

1. Assign 4 MB of RAM to the machine

_Note: the compiler might crash when insufficient memory is available._

1. Map the directory where you cloned the repos as harddrive **C**.

1. Start the emulator.

- Inside GEM:
1. Browse to `C:\TOOLS.RG\BIN\ATARI\PUREBOT` and select `PUREBOT.TTP`.
1. Click **Options** and then **Install Application...**.
1. Enter `PRJ` next to **Document Type**.
1. Click **Install**.
1. Click **Save Desktop** in the **Options** menu.
1. You can now double click `.PRJ` files to have the corresponding project compiled and linked.

## Choosing an editor

Consider using [VS Code](https://code.visualstudio.com) with the following extension:

- [Amiga Assembly for Visual Studio Code](https://marketplace.visualstudio.com/it ... a-assembly) (there is no Atari ST equivalent available at the time of writing but the Amiga Assembly extension nicely color codes and formats `.S` assembly files).

## Compiling

Compile your project by double clicking the `.PRJ` file.

Notes:

- You'll probably have to reset the emulator once the compilation completes because there's an apparent bug that causes any subsequent started applications to crash.
- Sometimes, the compiler makes a mistake when incrementally compiling the project. If the resulting program crashes unexpectedly, try deleting the `OUT` directory and then compile the project again.
- Check out https://github.com/ReservoirGods/GODLIB.SPL to find some examples.
Post Reply

Return to “SOFTWARE PROGRAMMING & DISCUSSION”