summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-03-23 20:49:25 +0100
committerNao Pross <naopross@thearcway.org>2017-03-23 20:49:25 +0100
commitbe51fc021f18aa6c0fc0006ebbc4fa34ebca4c62 (patch)
tree07934fe1084d1906372e19b66afb39ae4ff0bf55 /sw
parentchanged scheme layout (diff)
downloadz80uPC-be51fc021f18aa6c0fc0006ebbc4fa34ebca4c62.tar.gz
z80uPC-be51fc021f18aa6c0fc0006ebbc4fa34ebca4c62.zip
created bios/kernel source code structure
Diffstat (limited to 'sw')
-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/serial.h15
-rw-r--r--sw/z80/types.h9
-rw-r--r--sw/z80/zcc_opt.def6
6 files changed, 98 insertions, 0 deletions
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
+