From be51fc021f18aa6c0fc0006ebbc4fa34ebca4c62 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 23 Mar 2017 20:49:25 +0100 Subject: created bios/kernel source code structure --- sw/z80/crt0.s.old | 43 +++++++++++++++++++++++++++++++++++++++++++ sw/z80/kernel.c | 7 +++++++ sw/z80/loader.asm | 18 ++++++++++++++++++ sw/z80/serial.h | 15 +++++++++++++++ sw/z80/types.h | 9 +++++++++ sw/z80/zcc_opt.def | 6 ++++++ 6 files changed, 98 insertions(+) create mode 100644 sw/z80/crt0.s.old create mode 100644 sw/z80/kernel.c create mode 100644 sw/z80/loader.asm create mode 100644 sw/z80/serial.h create mode 100644 sw/z80/types.h create mode 100644 sw/z80/zcc_opt.def diff --git a/sw/z80/crt0.s.old b/sw/z80/crt0.s.old new file mode 100644 index 0000000..f3bf8e8 --- /dev/null +++ b/sw/z80/crt0.s.old @@ -0,0 +1,43 @@ + .module crt0 + .globl _main + + .area _HEADER (ABS) +;; reset vector + .org 0x0000 + jp init + + .org 0x0100 + +init: +;; Stack at the top of memory. + ld sp,#0xffff + + ;; initialise global variables + call gsinit + call _main + jp _exit + + ;; Ordering of segments for the linker. + .area _HOME + .area _CODE + .area _GSINIT + .area _GSFINAL + + .area _DATA + .area _BSS + .area _HEAP + + .area _CODE +__clock:: + ret + +_exit:: + ret + + .area _GSINIT + +gsinit:: + +.area _GSFINAL + ret + diff --git a/sw/z80/kernel.c b/sw/z80/kernel.c new file mode 100644 index 0000000..172eee1 --- /dev/null +++ b/sw/z80/kernel.c @@ -0,0 +1,7 @@ +#include "types.h" + + +void main(void) +{ + +} diff --git a/sw/z80/loader.asm b/sw/z80/loader.asm new file mode 100644 index 0000000..85f5abe --- /dev/null +++ b/sw/z80/loader.asm @@ -0,0 +1,18 @@ +; C crt0 loader +; + module crt0 + +; general scope declarations + extern _main ; C code + +; startup code + org 0000h ; reset vector + jp _start + +_start: + ld sp, 0xffff + call _main + jp _exit + +_exit: + ret diff --git a/sw/z80/serial.h b/sw/z80/serial.h new file mode 100644 index 0000000..3dc9b18 --- /dev/null +++ b/sw/z80/serial.h @@ -0,0 +1,15 @@ +#ifndef __SERIAL_H__ +#define __SERIAL_H__ + +#include "types.h" + +// define all +#define USART_BAUD_9600 +#define USART_BAUD_115200 + +uint8_t usart_registers[8]; +usart_registers = 0x80FF; // TODO: set real address + +void usart_init(int16_t baudprescale); + +#endif diff --git a/sw/z80/types.h b/sw/z80/types.h new file mode 100644 index 0000000..adde214 --- /dev/null +++ b/sw/z80/types.h @@ -0,0 +1,9 @@ +#ifndef __TYPES_H__ +#define __TYPES_H__ + +#define int8_t char +#define uint8_t unsigned char +#define int16_t int +#define uint16_t unsigned int + +#endif diff --git a/sw/z80/zcc_opt.def b/sw/z80/zcc_opt.def new file mode 100644 index 0000000..de830a9 --- /dev/null +++ b/sw/z80/zcc_opt.def @@ -0,0 +1,6 @@ + +IF !DEFINED_startup + defc DEFINED_startup = 1 + defc startup = 1 +ENDIF + -- cgit v1.2.1 From 4f1967b77e71769fc5666b4288e6a664667c5849 Mon Sep 17 00:00:00 2001 From: Atlas Date: Sat, 25 Mar 2017 10:37:29 +0100 Subject: Git repository setup Git merge from master by atlas --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index f024179..f9378ca 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,10 @@ sw/**/*.hex sw/**/*.bin sw/**/*.o sw/**/*.a + +# custom +various/* + +# sublime +z80.sublime-project +z80.sublime-workspace -- cgit v1.2.1 From fdce798dca64b48481fd002e8f1ac30302f48e0e Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 25 Mar 2017 10:10:24 +0100 Subject: added missing makefile for z80 and fixed gitignore --- .gitignore | 54 +++++++++++++++++++++++++++--------------------------- sw/z80/makefile | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 sw/z80/makefile diff --git a/.gitignore b/.gitignore index f9378ca..23cb2e2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,33 +13,33 @@ doc/**/*.log ## sw related # autotools -sw/**/makefile -sw/**/makefile.in -sw/**/ar-lib -sw/**/mdate-sh -sw/**/py-compile -sw/**/test-driver -sw/**/ylwrap -sw/**/autom4te.cache -sw/**/autoscan.log -sw/**/autoscan-*.log -sw/**/aclocal.m4 -sw/**/compile -sw/**/config.guess -sw/**/config.h.in -sw/**/config.log -sw/**/config.status -sw/**/config.sub -sw/**/configure -sw/**/configure.scan -sw/**/depcomp -sw/**/install-sh -sw/**/missing -sw/**/stamp-h* -sw/**/build-aux -sw/**/ltmain.sh -sw/**/texinfo.tex -sw/**/.deps +sw/linux/**/makefile +sw/linux/**/makefile.in +sw/linux/**/ar-lib +sw/linux/**/mdate-sh +sw/linux/**/py-compile +sw/linux/**/test-driver +sw/linux/**/ylwrap +sw/linux/**/autom4te.cache +sw/linux/**/autoscan.log +sw/linux/**/autoscan-*.log +sw/linux/**/aclocal.m4 +sw/linux/**/compile +sw/linux/**/config.guess +sw/linux/**/config.h.in +sw/linux/**/config.log +sw/linux/**/config.status +sw/linux/**/config.sub +sw/linux/**/configure +sw/linux/**/configure.scan +sw/linux/**/depcomp +sw/linux/**/install-sh +sw/linux/**/missing +sw/linux/**/stamp-h* +sw/linux/**/build-aux +sw/linux/**/ltmain.sh +sw/linux/**/texinfo.tex +sw/linux/**/.deps # binaries sw/**/*.hex diff --git a/sw/z80/makefile b/sw/z80/makefile new file mode 100644 index 0000000..94646a9 --- /dev/null +++ b/sw/z80/makefile @@ -0,0 +1,27 @@ +#### +# source code settings +# +OSNAME := helvetiOS + +CSOURCES := $(wildcard *.c) +BINARY := $(OSNAME).bin + +### +# compiler settings +# +CC := zcc +CARGS := -Wall -I . -DDEBUG -crt0 loader -asm z80asm -nostdlib + +all: $(BINARY) + +# build binary +$(BINARY): $(CSOURCES) + cp loader.asm loader.opt + $(CC) $(CARGS) $(CSOURCES) -o $@ + +dis: $(BINARY) + z80dasm -a -g 0h $< + +clean: + - rm $(BINARY) + - rm loader.opt -- cgit v1.2.1