XTC68 C Cross compiler

Anything QL Software or Programming Related.
Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: XTC68 C Cross compiler

Post by Fabrizio »

Hi everyone!

I have managed to install XTC68. It does work on a single file but I don't know how to get it to compile files some of which have
#include directives of user-created header files with relative paths.

I get these errors:
root@brizio-VirtualBox:/media/sf_Retro/CROSS-CHASE/src# make cc_tiny_no_graphics
qcc \
-D__GCC_BUFFERED__ \
...
-DALT_CLEAR_SCREEN \
cross_lib/display/display_macros.c cross_lib/display/init_images.c cross_lib/input/input_macros.c cross_lib/text/text_macros.c chase/move_player.c chase/ghost.c chase/level.c chase/character.c chase/game_text.c chase/main.c chase/strategy.c
cross_lib/display/display_macros.c:23: ../../cross_lib/cross_lib.h: No such file or directory
cross_lib/display/display_macros.c:35: images.h: No such file or directory
cross_lib/display/display_macros.c:43: graphics_settings.h: No such file or directo
...

Maybe I am not using the compiler correctly...

Are #include of user-created headers supported in XTC68?
I use includes such as:
#include "../../cross_lib/cross_lib.h"


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: XTC68 C Cross compiler

Post by NormanDunbar »

Don't use paths, just include the header files. Then, on the compiler execution, supply as many "-I path_to_headers" as necessary. These options tell the compiler where to look for header files.

That's an upper case "i" not a lower case "L" by the way.

So for

Code: Select all

#include "../../cross_lib/cross_lib.h"
Use

Code: Select all

#include "cross_lib.h"
And

Code: Select all

qcc -o binaryfile.exe -I "../../cross_lib" sourcefile.c
(edited to remove crud!)


HTH

Cheers,
Norm.
Last edited by NormanDunbar on Sat Oct 26, 2019 10:20 pm, edited 1 time in total.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: XTC68 C Cross compiler

Post by Fabrizio »

Thanks!

My code goes through a tool chain made of more or less C89 C cross-compilers including also CC65, Z88DK, CMOC, ACK, Z8K-GCC...

#include "../foo.h"
seems to be C89-compliant

I need my code to compile on all of these compilers. The solution is to have my code to be C89-compliant.

What you propose will break the compilation on all other compilers... unless I pollute tens of files with #ifdef XTC68 directives to do a different include only for XTC69.

A clear solution would be to understand how to avoid includes with relative paths in a C89-compliant way that can be understood by all the compilers of my "universal" tool chain...
I need to figure it out...

Fabrizio


Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: XTC68 C Cross compiler

Post by Fabrizio »

@NormanDunbar, I think your suggestion is really good.
I just need to check whether it can be used with all compilers.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: XTC68 C Cross compiler

Post by NormanDunbar »

Hi Fabrizio,

All the C compilers that I've ever used have the "-I" command line options, including C68 for the QL. So you shouldn't need to worry about polluting your files with #ifdefs.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: XTC68 C Cross compiler

Post by stephen_usher »

A quick question about the libraries, specifically the QDOS system calls, specifically mt_susjb

The call is defined to have three arguments, the job id, timeout period and a char *. What's the char * for? The system call doesn't use one or return a string.

(The only QL C compiler docs I have are for the Metacomco C Compiler and that doesn't have that sort of syscall interface.)


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: XTC68 C Cross compiler

Post by tofro »

C68 Manual wrote: char *zero is an address of a byte to set to zero on release of the job if required. If this is not required pass NULL in place of 'char *zero'.
At least the QL Technical Guide mentions the flag byte - It's the MT.SUSJB trap's A1 parameter. The byte this address points to is set to "0" by QDOS when the suspension is either lifted by the OS (when the timeout expires) or an MT.RELJB call. You can use this if another job wants to be notified when the suspended job is released.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: XTC68 C Cross compiler

Post by stephen_usher »

Excellent. Thanks.


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: XTC68 C Cross compiler

Post by stephen_usher »

Is there any documentation on the XTC68LIB libraries? I can't find any (or even the source).

I see from the headers that there's a do_sound function but without a description of what the parameters actually are it's pretty useless.

I'm sure there's a lot of other very useful stuff locked up in there which is also unusable without documentation.


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: XTC68 C Cross compiler

Post by tofro »

Stephen,

both documentation and source code for the XTC68 libs are part of the C68 distribution (the libraries are the same and built from the very same sources). Check Dilwyn's site.
2.8.9 void do_sound( int duration, int pitch, int pitch2, int wrap, int g_x, int g_y,int fuzz, int random)


QDOS call to make a sound. Parameters defined as for SuperBasic beep call.
Or check here:
c68_lib.pdf
(635.36 KiB) Downloaded 103 times
(This is more or less a compilation of the _doc files that come with C68, a bit cross-referenced, indexed and PDFed.)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply