Itszor/puppeh gcc cross compiler for the BBC: Instructions, examples and library

handy tools that can assist in the development of new software
Post Reply
User avatar
flibble
Posts: 757
Joined: Tue Sep 22, 2009 11:29 am
Contact:

Itszor/puppeh gcc cross compiler for the BBC: Instructions, examples and library

Post by flibble » Thu Jun 04, 2020 2:20 am

A few years ago Chris M helped me setup a copy of puppeh's gcc port for the BBC. I've been using it for my game developments since then, and several people asked if I could share details on how I set it up.

I'd not forgotten, I've just been really slow doing it! However;

https://www.4corn.co.uk/articles/gccforbbc/

I hope others will be able to follow this guide and get started with C on the beeb!

I've also included a library of functions that I use in my own programs that could help others. Wrappers for the MOS APIs and a set of functions designed to impersonate BASIC keywords, COLOUR, PRINT, SOUND etc.

Please let me know if you have any trouble following the instructions and I'll try to update them.

hellow.png

cmorley
Posts: 1260
Joined: Sat Jul 30, 2016 8:11 pm
Location: Oxford
Contact:

Re: Itszor/puppeh gcc cross compiler for the BBC: Instructions, examples and library

Post by cmorley » Thu Jun 04, 2020 7:56 am

Unused functions appear to not be stripped out of the final binary, as such remove any that you are not using.
This is a feature of the way C is compiled and linked. You need "static" or "static inline" functions to avoid unused functions being included in the binary. Alternatively you can build a static library and the linker will then only pull in one copy of used functions.
The implementation of printf() seems to be lacking some functionality e.g. outputing 32 bit values, padding etc.
I wrote a compact more featured printf for use with the BBC... I can dig it out and post it. It burns a couple of KB of code space.

Note you can arrange it so the init code sits where unintialised variables are or in screen RAM say. You can then do a lot of bloated init work and recover that memory.

I'm using the gcc8 build. The main improvement I'd like to see is better pointer dereferencing with the Y and X index registers. At the moment it always emits "STY temp:LDY#0:ST/LDA (zp),Y:LDY temp" code because implementation reasons. It would be great if that were improved.

Itzor hasn't done any commits for about a year so I don't think he is actively developing it at the moment. :(

Post Reply

Return to “development tools”