Page 3 of 4

Re: XTC68 C Cross compiler

Posted: Sun Jan 27, 2019 9:20 pm
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"

Re: XTC68 C Cross compiler

Posted: Sun Jan 27, 2019 10:20 pm
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.

Re: XTC68 C Cross compiler

Posted: Mon Jan 28, 2019 9:49 am
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

Re: XTC68 C Cross compiler

Posted: Mon Jan 28, 2019 9:12 pm
by Fabrizio
@NormanDunbar, I think your suggestion is really good.
I just need to check whether it can be used with all compilers.

Re: XTC68 C Cross compiler

Posted: Mon Jan 28, 2019 9:28 pm
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.

Re: XTC68 C Cross compiler

Posted: Sat Oct 26, 2019 6:10 pm
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.)

Re: XTC68 C Cross compiler

Posted: Sat Oct 26, 2019 6:57 pm
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.

Re: XTC68 C Cross compiler

Posted: Sat Oct 26, 2019 7:32 pm
by stephen_usher
Excellent. Thanks.

Re: XTC68 C Cross compiler

Posted: Sat Nov 23, 2019 1:36 pm
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.

Re: XTC68 C Cross compiler

Posted: Sat Nov 23, 2019 2:48 pm
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 104 times
(This is more or less a compilation of the _doc files that come with C68, a bit cross-referenced, indexed and PDFed.)