Use miminal config file and bare-bone custom CRT.

This commit is contained in:
giomba 2023-10-11 22:07:04 +02:00
parent 2645501186
commit 640314be8a
4 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,7 @@
PROJECT := demo
SRC = \
src/ceda_print.c \
src/entrypoint.c \
src/main.c \
\
@ -10,11 +11,14 @@ ECHO := @echo
QUIET := @
OUTDIR := build
$(OUTDIR)/main.prg: $(OUTDIR)/main.rom
dd if=$< of=$@ bs=1 seek=2
$(OUTDIR)/$(PROJECT).prg: $(OUTDIR)/$(PROJECT)_code_compiler.bin
echo -n -e '\x00\x10' > $@
cat $< >> $@
$(OUTDIR)/main.rom: $(OBJ) | $(OUTDIR)
zcc +z80 -create-app --no-crt -m -o $@ $?
$(OUTDIR)/$(PROJECT)_code_compiler.bin: $(OBJ) | $(OUTDIR)
zcc +conf.cfg \
-crt0=src/crt.asm \
-m -o $(OUTDIR)/$(PROJECT) $?
%.o: %.c
zcc +z80 -c -o $@ $<

0
conf.cfg Normal file
View File

View File

@ -1,9 +1,13 @@
SECTION code_compiler
org $1000
EXTERN _main
entrypoint:
PUBLIC __Start
__Start:
ld sp,0xc000
call _main
jp ASMPC

View File

@ -1,8 +1,9 @@
#include "ceda_print.h"
int globalvar = 0x7777;
int main(void) {
ceda_print("Hello world!");
return 0;
}