Getting started in ST C programming and boilerplate code / template?

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
Mozartkugel
Retro freak
Retro freak
Posts: 11
Joined: Tue Apr 09, 2019 6:25 am

Getting started in ST C programming and boilerplate code / template?

Post by Mozartkugel »

Hi guys! I couldn't believe my eyes, but my synth band buddy / 8-bit computer club friend got me an Atari ST for my birthday!! Best present ever! 8O
20190405_230328.jpg
I had an Atari Lynx as a kid after my Commodore 128 and later an Amiga 500, but I've gotten really interested in the Atari ST too in an ongoing "retro computer craze". I was always curious about the ST, because of its good looking industrial design and because no one I knew had one back in the day. Now a days I also like it because of the YM2149F. Old school low bit rate samples sound great but chip music is closest to the heart.

Since I now have an ST It'd be fun to program some small game for it, but I've browsed through the forum and feel a little lost/overwhelemed right now. Could someone kindly help pointing me in the right direction concerning a couple of things?

1.Is there a cross compiler setup comparable to cc65 for programming C for the ST with maybe some ready made libraries for joystick input, sprites, sound and such? C would make sense since I'm not a "real programmer/engineer" more of an artsy fartsy tinkerer, so I would like to go for the simplest approach possible and I care more about a games appeal rather than fps/pushing a system to its limits. Also I know some C from before (I've done some minigames for the Lynx and gotten a good start with C64/VIC20/Plus4 C coding too).

2.What would be the obvious system specific things on the ST that I'd need to look up / read about? I feel I could've saved almost years if someone would've pointed me for example to sprite structures on the Lynx or custom characters, multicolor text mode, screen memory, color memory on the Commodores. Can someone propose a good book and/or online tutorials/documentation?

3.Did someone happen to share boilerplate code / a template / a skeleton that would contain the essential building blocks for a game? Like: background, sprites, joystick input, music/sfx and loader + loader image?

Sorry if someone feels I want everything handed over, well I kinda want that :mrgreen: but I'm not afraid of doing my own research, I'm just looking for a kick start (sorry amiga terminology) / I don't want to reinvent the wheel, because I'm terribly busy as a family man and because of a bunch of other "retro computer" projects.

Any help appreciated, thanks beforehand! [smilie=greencolorz4_pdt_17.gif]
You do not have the required permissions to view the files attached to this post.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2489
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Getting started in ST C programming and boilerplate code / template?

Post by lp »

Have a look at GODLIB: http://rg.atari.org/source.htm
Also this: https://bitbucket.org/d_m_l/agtools/src/default/

Search on this forum for GODLIB and agtools to see related threads.

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: Getting started in ST C programming and boilerplate code / template?

Post by Greenious »

That friend is obviously a keeper... :)

There's so much free stuff out there now, it's impossible to cover it all, but some places worth checking out is:

[A]tari [G]ame [T]ools - 2D prototyping engine for STE
http://www.atari-forum.com/viewtopic.ph ... 58#p316951

Atari Document Archive - most written atari documentations there is, including manuals, programming books, hardware info
https://www.dev-docs.org/docs/

Atari ST sources repository
https://github.com/ggnkua/Atari_ST_Sources
Updated my guides as of june 28th, 2016. Check'em out and feedback!
http://www.atari-forum.com/viewtopic.php?t=5040

neanderthal
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 135
Joined: Sun Jul 10, 2016 10:58 pm

Re: Getting started in ST C programming and boilerplate code / template?

Post by neanderthal »

For reference I tend to use this when dont have the books around.(when talking sys-stuff)
http://toshyp.atari.org/en/index.html

czietz
Hardware Guru
Hardware Guru
Posts: 1188
Joined: Tue May 24, 2016 6:47 pm

Re: Getting started in ST C programming and boilerplate code / template?

Post by czietz »

As for C cross compilers, we have the latest versions of gcc (8.3) available for 68k: https://tho-otto.de/crossmint.php.

Many first time gcc users are shocked to see that a "hello world"-type program is ca. 100 kB after compilation. This is just because of the extensive standard C library that contains many functions required e.g. to port Unix software to Atari/MiNT. When you're interested more in game development, you probably don't need a POSIX compliant standard library. Maybe you can work without standard C library at all (using only system calls) or you can use a smaller library such as https://github.com/mfro0/libcmini.

Generally speaking, gcc produces very well optimized code.

Mozartkugel
Retro freak
Retro freak
Posts: 11
Joined: Tue Apr 09, 2019 6:25 am

Re: Getting started in ST C programming and boilerplate code / template?

Post by Mozartkugel »

Hey thank you so much everyone for all the info and great links! [smilie=greencolorz4_pdt_17.gif] I've started to look through all the stuff already, but there's quite a lot here to digest so I need to investigate closer to be able to know which one is best suited for me.

I forgot to mention that I would've liked to target the first ST model(s), does that rule out godlib or is STFM commonly used as a family name for the first models? I thought FM was just for built in TV modulator and floppy drive?
Complete Reservoir Gods libraries for easy creation of software for STFM,STE,TT and Falcon.
I don't know any C++ so that might push AGT into the future for me, but it looks very nice and tempting!

One more question if I may, does anyone happen to know if any of the YM2149F trackers support an output that would be easy to use in C code?

simonsunnyboy
Moderator
Moderator
Posts: 5228
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Getting started in ST C programming and boilerplate code / template?

Post by simonsunnyboy »

You can also check here:

https://github.com/simonsunnyboy/stlibs4gcc

and

My own framework is in hibernation, never started to work on that since last year. But you can check

https://github.com/simonsunnyboy/eswkernel4st
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Mozartkugel
Retro freak
Retro freak
Posts: 11
Joined: Tue Apr 09, 2019 6:25 am

Re: Getting started in ST C programming and boilerplate code / template?

Post by Mozartkugel »

Hey thanks for the additional links man! I will look into them.

User avatar
Velek
Atarian
Atarian
Posts: 2
Joined: Mon Jul 20, 2020 6:45 am

Re: Getting started in ST C programming and boilerplate code / template?

Post by Velek »

I started programming assembly on my Atari 800XL almost 40 years ago 8O .
I got one of the programming magazines back then, and dreamed of getting an ST when programming articles for it started to appear.
Then I started looking under the hood of the Macintoshes I got to be in charge of in college, abusing them in assembly, Pascal, then C.
So now I have a real ST I bought off of EBay sitting on the shelf because it needs a monitor, but just got the latest Hatari to run.
Thinking about doing some C coding in GEM for fun. Because I didn't get to do it when I was a teenager.
Right now I'm doing mobile development in Swift (iOS) and Flutter (iOS/Android)
I'm thinking about GCC, and using EMACS on my MacBook as the IDE since I can use shared folders. I'm super familiar with GCC from using it to build embedded systems and doing Linux programming.
Open to using one of the classic ST compilers such as PureC, though.

ThorstenOtto
Atari God
Atari God
Posts: 1103
Joined: Sun Aug 03, 2014 5:54 pm

Re: Getting started in ST C programming and boilerplate code / template?

Post by ThorstenOtto »

For EMACS as IDE, you obviously need a cross-compiler (you don't want to run that beast on an ST ;) They are available at http://vincent.riviere.free.fr/soft/m68k-atari-mint/ and http://tho-otto.de/crossmint.php (don't use gcc 10.1 yet, it generates working, but ineffective code).

Pure-C should also be a good choice. I use that most of the time. And with some effort, you can also make your sources be usable by both.

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3559
Joined: Sat Jun 30, 2012 9:33 am

Re: Getting started in ST C programming and boilerplate code / template?

Post by dml »

Mozartkugel wrote:
Wed Apr 10, 2019 9:42 pm
I don't know any C++ so that might push AGT into the future for me, but it looks very nice and tempting!
I missed this when it was posted - but in case anyone reading this has similar concerns, AGT doesn't really require C++ knowledge as most of the code you'd be writing is much closer to C. The boilerplate & config uses some C++ but there isn't a lot to it. You can write your own parts in C.

So if you are familiar with C then its probably enough to do something - certainly enough to mess around with the samples and begin something new. The rest can be picked up from the examples themselves. There is also some info on the wiki related to this.

The main thing you get out of AGT is not having to deal with low-level graphics and hardware interfaces, so you can spend more time designing game stuff, making maps, trying out art and gameplay changes etc.

(and If you *do* want to get into low level programming on Atari ST/e, AGT is not the best option)

User avatar
Velek
Atarian
Atarian
Posts: 2
Joined: Mon Jul 20, 2020 6:45 am

Re: Getting started in ST C programming and boilerplate code / template?

Post by Velek »

Got as far as trying out PureC and installing Cross MINT.
I didn't know that Borland got into Atari ST compilers.
At least if I develop under my Mac host I can use my Git server.
Now I have to learn how to code for GEM. Wish I still had some of those 30+ year old magazines.

Post Reply

Return to “C / PASCAL etc.”