Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| blog:commodore_pet_compiler [2021/11/25 15:41] – created john | blog:commodore_pet_compiler [2021/11/29 15:20] (current) – [Commodore PET - Software Development] john | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| * Assemble your **.S** assembly listing using //ca65//, which will emit a **.o** binary object file | * Assemble your **.S** assembly listing using //ca65//, which will emit a **.o** binary object file | ||
| * Link your **.o** object files using //ld65//, possibly including the cc65 standard library, which will emit a **.prg** executable | * Link your **.o** object files using //ld65//, possibly including the cc65 standard library, which will emit a **.prg** executable | ||
| + | |||
| + | Here's a simple // | ||
| + | |||
| + | < | ||
| + | # Names of the compiler and friends | ||
| + | CC = cc65 | ||
| + | AS = ca65 | ||
| + | LD = ld65 | ||
| + | |||
| + | # libraries and paths | ||
| + | INCLUDES = --include-dir / | ||
| + | LIBS = --lib / | ||
| + | |||
| + | # Compiler flags | ||
| + | ASM_FLAGS= --target pet | ||
| + | LDFLAGS = --target pet | ||
| + | CFLAGS = --target pet -O -Oi -Or -Os | ||
| + | |||
| + | # What our application is named | ||
| + | TARGET = game.prg | ||
| + | |||
| + | all: $(TARGET) | ||
| + | |||
| + | # The main application | ||
| + | OBJFILES = src/test.o | ||
| + | |||
| + | $(TARGET): | ||
| + | $(LD) $(LDFLAGS) --obj $(OBJFILES) $(LIBS) -o bin/ | ||
| + | |||
| + | ################################ | ||
| + | # Main code | ||
| + | ################################ | ||
| + | src/test.s: src/test.c | ||
| + | $(CC) $(CFLAGS) $(INCLUDES) src/test.c | ||
| + | |||
| + | src/test.o: src/test.s | ||
| + | $(AS) $(ASM_FLAGS) src/test.s | ||
| + | |||
| + | ############################### | ||
| + | # | ||
| + | # Clean up | ||
| + | # | ||
| + | ############################### | ||
| + | clean: | ||
| + | rm -f src/*.o | ||
| + | rm -f bin/ | ||
| + | </ | ||
| + | |||
| + | ==== Documentation & Library Reference ==== | ||
| + | |||
| + | * Commodore PET specific functions (which are very few) are defined in **pet.h**, found in the //include// directory of the cc65 installation. | ||
| + | * CC65 implementation guidance can be found [[https:// | ||
| + | * The CC65 standard library can be found [[https:// | ||