From 2645501186b896a8e939a0e3cb0b12bc632f1877 Mon Sep 17 00:00:00 2001 From: giomba Date: Sun, 8 Oct 2023 21:38:15 +0200 Subject: [PATCH] First commit. --- .clang-format | 6 ++++++ .gitignore | 4 ++++ Makefile | 32 ++++++++++++++++++++++++++++++++ README.md | 7 +++++++ src/ceda_print.c | 11 +++++++++++ src/ceda_print.h | 7 +++++++ src/entrypoint.asm | 9 +++++++++ src/main.c | 8 ++++++++ 8 files changed, 84 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 README.md create mode 100644 src/ceda_print.c create mode 100644 src/ceda_print.h create mode 100644 src/entrypoint.asm create mode 100644 src/main.c diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..6ba126f --- /dev/null +++ b/.clang-format @@ -0,0 +1,6 @@ +# clang-format 15.0.7 +IndentWidth: 4 +AllowShortBlocksOnASingleLine: Empty +AllowShortFunctionsOnASingleLine: Empty +AlignConsecutiveMacros: true + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b863b11 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build/ + +*.o + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ed530f4 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +SRC = \ + src/ceda_print.c \ + src/entrypoint.c \ + src/main.c \ + \ + +OBJ = $(patsubst %, %.o, $(basename $(SRC))) + +ECHO := @echo +QUIET := @ +OUTDIR := build + +$(OUTDIR)/main.prg: $(OUTDIR)/main.rom + dd if=$< of=$@ bs=1 seek=2 + +$(OUTDIR)/main.rom: $(OBJ) | $(OUTDIR) + zcc +z80 -create-app --no-crt -m -o $@ $? + +%.o: %.c + zcc +z80 -c -o $@ $< + +%.o: %.asm + zcc +z80 -c -o $@ $< + +$(OUTDIR): + mkdir -p $@ + +.PHONY: clean +clean: + $(RM) $(OBJ) + $(RM) -r $(OUTDIR) + diff --git a/README.md b/README.md new file mode 100644 index 0000000..bad3e2e --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# ceda-demo + +Demo for the Sanco 800x. + +The purpose of this demo is mainly to thinker with the hardware of the mentioned computer, since we are reverse-engineering it, and even writing an emulator. + +This repository is part of the [CEDA project](https://github.com/GLGPrograms/ceda-home) by [Retrofficina GLG Programs](https://retrofficina.glgprograms.it/). diff --git a/src/ceda_print.c b/src/ceda_print.c new file mode 100644 index 0000000..454621e --- /dev/null +++ b/src/ceda_print.c @@ -0,0 +1,11 @@ +#include "ceda_print.h" + +void ceda_print(const char *s) { + static char *const VIDEO_MEMORY = (char *const)(0xd000); + + char *p = VIDEO_MEMORY; + + while (*s != '\0') { + *p++ = *s++; + } +} diff --git a/src/ceda_print.h b/src/ceda_print.h new file mode 100644 index 0000000..b2c7767 --- /dev/null +++ b/src/ceda_print.h @@ -0,0 +1,7 @@ +#ifndef CEDA_PRINT_H +#define CEDA_PRINT_H + +void ceda_print(const char* s); + +#endif // CEDA_PRINT_H + diff --git a/src/entrypoint.asm b/src/entrypoint.asm new file mode 100644 index 0000000..89991d9 --- /dev/null +++ b/src/entrypoint.asm @@ -0,0 +1,9 @@ +EXTERN _main + +entrypoint: + ld sp,0xc000 + + call _main + + jp ASMPC + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..61699bd --- /dev/null +++ b/src/main.c @@ -0,0 +1,8 @@ +#include "ceda_print.h" + +int main(void) { + ceda_print("Hello world!"); + + return 0; +} +