GBDK libraries documentation | ||
---|---|---|
Prev | Next |
This section assumes that you have installed GBDK properly and build the libraries as per the instructions on Pascal's homepage.
The program 'lcc' is a front end for the actual compiler, assembler and linker. It works out what you want to do based on command line options and the extensions of the files you give it, computes the order in which the various programs must be called and then executes them in order. Some examples are:
lcc -o image.gb source.c - compile the C source 'source.c', assemble and link it producing the Gameboy image 'image.gb'
lcc -o image.gb source.s - assemble the file 'source.s' and link it producing the Gameboy image 'image.gb'
lcc -c -o object1.o source1.c - compile the C program 'source1.c' and assemble it producing the object file 'object1.o' for later linking.
lcc -c -o object2.o source2.s - assemble the file 'source2.s' producing the object file 'object2.o' for later linking
lcc -o image.gb object1.o object2.o - link the two object files 'object1.o' and 'object2.o' and produce the Gameboy image 'image.gb'
lcc -o image.gb source1.c source2.s - do all sorts of clever stuff by compiling then assembling source1.c, assembling source2.s and then linking them together to produce image.gb.
Arguments to the assembler etc can be passed via lcc using -Wp..., -Wf..., -Wa... and -Wl... to pass options to the pre-processor, compiler, assembler and linker respectivly. Some common options are:
-Wa-l to generate an assembler listing file.
-Wl-m to generate a linker map file which can then be turned into a no$gmb .sym file for debugging using maptosym.
-Wl-gvar=addr to bind var to address 'addr' at link time.
lcc -Wa-l -Wl-m -Wl-g_snd_stat=0xff26 -o image.gb hardware.cNote the leading underscore that C adds to symbol names.
Unfortunatly maccer, Michael Hope's macro preprocessor for the assembler has to be run seperatly as lcc dosnt know about it. To turn the assembler file with macros 'source.ms' into the assembler file 'source.s', use
maccer -o source.s source.msIf the -o source.s option isnt specified then maccer writes to stdout. If source.ms isnt specified then maccer reads from stdin.
Prev | Home | Next |
Preface | Using Makefiles |