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

Postby Fabrizio » Sun Jan 27, 2019 9:20 pm

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
Aurora
Posts: 986
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: XTC68 C Cross compiler

Postby NormanDunbar » Sun Jan 27, 2019 10:20 pm

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 - https://www.amazon.co.uk/Arduino-Softwa ... 1484257898, https://www.apress.com/gb/book/9781484257890
Fabrizio
ROM Dongle
Posts: 17
Joined: Thu Apr 19, 2018 11:09 am

Re: XTC68 C Cross compiler

Postby Fabrizio » Mon Jan 28, 2019 9:49 am

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

Postby Fabrizio » Mon Jan 28, 2019 9:12 pm

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


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

Re: XTC68 C Cross compiler

Postby NormanDunbar » Mon Jan 28, 2019 9:28 pm

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 - https://www.amazon.co.uk/Arduino-Softwa ... 1484257898, https://www.apress.com/gb/book/9781484257890
stephen_usher
Trump Card
Posts: 218
Joined: Tue Mar 11, 2014 8:00 pm

Re: XTC68 C Cross compiler

Postby stephen_usher » Sat Oct 26, 2019 6:10 pm

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
QL Wafer Drive
Posts: 1881
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: XTC68 C Cross compiler

Postby tofro » Sat Oct 26, 2019 6:57 pm

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
Trump Card
Posts: 218
Joined: Tue Mar 11, 2014 8:00 pm

Re: XTC68 C Cross compiler

Postby stephen_usher » Sat Nov 23, 2019 1:36 pm

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
QL Wafer Drive
Posts: 1881
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: XTC68 C Cross compiler

Postby tofro » Sat Nov 23, 2019 2:48 pm

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 34 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

Who is online

Users browsing this forum: No registered users and 3 guests