summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-04-04 10:16:51 +0200
committerNao Pross <naopross@thearcway.org>2017-04-04 10:16:51 +0200
commit0a1447470a5eb9def9be423a74d70844ae266268 (patch)
tree996648488c85e308612cb64975af59c1ac7adbba
parentschematic complete (diff)
parentadded missing makefile for z80 and fixed gitignore (diff)
downloadz80uPC-0a1447470a5eb9def9be423a74d70844ae266268.tar.gz
z80uPC-0a1447470a5eb9def9be423a74d70844ae266268.zip
Merge branch 'master' of https://github.com/NaoPross/z80uPC
Diffstat (limited to '')
-rw-r--r--.gitignore61
-rw-r--r--sw/z80/crt0.s.old43
-rw-r--r--sw/z80/kernel.c7
-rw-r--r--sw/z80/loader.asm18
-rw-r--r--sw/z80/makefile27
-rw-r--r--sw/z80/serial.h15
-rw-r--r--sw/z80/types.h9
-rw-r--r--sw/z80/zcc_opt.def6
8 files changed, 159 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index f024179..23cb2e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,36 +13,43 @@ 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
sw/**/*.bin
sw/**/*.o
sw/**/*.a
+
+# custom
+various/*
+
+# sublime
+z80.sublime-project
+z80.sublime-workspace
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/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
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
+