diff options
author | Nao Pross <naopross@thearcway.org> | 2017-03-23 20:49:25 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2017-03-23 20:49:25 +0100 |
commit | be51fc021f18aa6c0fc0006ebbc4fa34ebca4c62 (patch) | |
tree | 07934fe1084d1906372e19b66afb39ae4ff0bf55 | |
parent | changed scheme layout (diff) | |
download | z80uPC-be51fc021f18aa6c0fc0006ebbc4fa34ebca4c62.tar.gz z80uPC-be51fc021f18aa6c0fc0006ebbc4fa34ebca4c62.zip |
created bios/kernel source code structure
-rw-r--r-- | sw/z80/crt0.s.old | 43 | ||||
-rw-r--r-- | sw/z80/kernel.c | 7 | ||||
-rw-r--r-- | sw/z80/loader.asm | 18 | ||||
-rw-r--r-- | sw/z80/serial.h | 15 | ||||
-rw-r--r-- | sw/z80/types.h | 9 | ||||
-rw-r--r-- | sw/z80/zcc_opt.def | 6 |
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 + |