Repository navigation
C Programs
WacKEDmaN edited this page Nov 6, 2026
·
2 revisions
The assembler window also builds C programs. Open a .c file as a program: F9 then builds it with a C compiler instead of RASM.
- SDCC (sdcc.sourceforge.net). It is not included: install it.
- Optional: CPCtelera (the cpctelera_next branch): its library and its asset tools. You do not need Cygwin, make or bash: the program builds the library once from its
srcfolder. - Or z88dk (z88dk.org) as the compiler in place of SDCC.
C settings... (in the assembler window's toolbar, for a .c program):
| Setting | What it is |
|---|---|
| Compiler | SDCC / CPCtelera or z88dk |
| SDCC folder | Empty: C:\Program Files\SDCC, or the PATH |
| CPCtelera folder | Empty: plain SDCC, no library. It must have src/cpctelera.h. |
| Code address | Where the code goes (hex). A CPCtelera project's cfg/build_config.mk (Z80CODELOC) wins. |
| Extra sdcc flags | More options for sdcc |
| z88dk folder | Empty: C:\z88dk, beside the program, or the PATH |
| Compile with zsdcc | z88dk's SDCC: C lines can be stepped in the debugger. Off: z88dk's own sccz80 (no line stepping). |
| Extra zcc flags | More options for zcc |
The settings line shows if each tool was found.
| Button | Key | What it does |
|---|---|---|
| Build | F9 | Saves the edited tabs of the program, then builds it on a background thread. The window stays usable. |
| Build + run | Ctrl+F9 | Builds, then runs the program from BASIC, as a real CPC runs a binary |
| Run to cursor | Ctrl+F10 | Runs to the cursor's C line, past every breakpoint, and pauses there |
| Convert assets | Runs every asset step of a CPCtelera project again |
- Build log shows the commands and what they printed. Errors go to the messages list, on their files' tabs.
- The
.hfiles that a.cfile includes open in tabs after it.
Open the project's src/main.c. The build follows the project's cfg/*.mk files:
-
Asset steps run first: images, Tiled maps, Arkos Tracker 3 music, packed data (zx0, zx1, zx7b, RLE-WB) and
.binfiles. Plus palettes (CONVERT_PALETTE_PLUS,SET_PALETTE_PLUS) and Plus hardware sprites (SET_IMG_FORMAT spritehardware) are made too. F9 runs only the steps whose outputs are older than their inputs. Convert assets runs all of them again. - The project's disc and tape images (DSK, CDT, FILE2SECTOR) are made as iDSK, cpc2cdt and RASM make them, and an SNA snapshot too.
- All 60 example projects of CPCtelera_next 1.04a build and run.
- The library cache and the temporary files of the build are in the
cachefolder next to the program.
- Step a C line: F10 (over), F11 (into), Shift+F11 (out), or the Line, Over and Out buttons.
- When the machine stops on a C line, its file opens in a tab and the line is marked.
- Click a line number in the gutter to set or remove a breakpoint on that line's first instruction.
- Mouse-over a variable or function: its address and value (a byte, a word, a long, or the bytes, from the build's listings).
- The disassembly in the Debugger window shows the C lines.
--cbuild <main.c> builds a C project and runs it, with no window (for scripts). Add --cpctelera <folder>, --sdcc <folder>, --codeloc <address>, --force-assets, --z88dk <folder> or --sccz80 as needed. Use it with --shot (refer to Command line).
Start
The machine
Media
Expansions
Tools
Automation
Help