From f000d406809d8a7a0e71c388ebfb15d7564728e4 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 5 Oct 2017 12:17:37 +0200 Subject: Test units are now in their own folder 'z80_test', add programmer cli interface --- sw/z80/crt0.rel | 86 +++++++++++++++++++++++++++++++++++++ sw/z80/kernel/drivers/ctc.c | 7 ++- sw/z80/kernel/include/drivers/ctc.h | 4 +- sw/z80/kernel/memory.c | 6 ++- sw/z80/kernel/process.c | 8 ++-- 5 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 sw/z80/crt0.rel (limited to 'sw/z80') diff --git a/sw/z80/crt0.rel b/sw/z80/crt0.rel new file mode 100644 index 0000000..880fd57 --- /dev/null +++ b/sw/z80/crt0.rel @@ -0,0 +1,86 @@ +XL2 +H 14 areas 5 global symbols +M crt0 +S .__.ABS. Def0000 +S _kmain Ref0000 +A _CODE size A flags 0 addr 0 +S __clock Def0000 +S _exit Def0004 +A _HEADER size 0 flags 8 addr 0 +A _HEADER0 size 3 flags 8 addr 0 +A _HEADER1 size 2 flags 8 addr 8 +A _HEADER2 size 2 flags 8 addr 10 +A _HEADER3 size 2 flags 8 addr 18 +A _HEADER4 size 2 flags 8 addr 20 +A _HEADER5 size 2 flags 8 addr 28 +A _HEADER6 size 2 flags 8 addr 30 +A _HEADER7 size 2 flags 8 addr 38 +A _HEADER8 size C flags 8 addr 100 +A _HOME size 0 flags 0 addr 0 +A _INITIALIZER size 0 flags 0 addr 0 +A _GSINIT size 6 flags 0 addr 0 +S gsinit Def0000 +A _GSFINAL size 1 flags 0 addr 0 +A _DATA size 0 flags 0 addr 0 +A _INITIALIZED size 0 flags 0 addr 0 +A _BSEG size 0 flags 0 addr 0 +A _BSS size 0 flags 0 addr 0 +A _HEAP size 0 flags 0 addr 0 +T 00 00 +R 00 00 02 00 +T 00 00 C3 00 01 +R 00 00 02 00 00 03 0A 00 +T 08 00 +R 00 00 03 00 +T 08 00 ED 4D +R 00 00 03 00 +T 10 00 +R 00 00 04 00 +T 10 00 ED 4D +R 00 00 04 00 +T 18 00 +R 00 00 05 00 +T 18 00 ED 4D +R 00 00 05 00 +T 20 00 +R 00 00 06 00 +T 20 00 ED 4D +R 00 00 06 00 +T 28 00 +R 00 00 07 00 +T 28 00 ED 4D +R 00 00 07 00 +T 30 00 +R 00 00 08 00 +T 30 00 ED 4D +R 00 00 08 00 +T 38 00 +R 00 00 09 00 +T 38 00 ED 4D +R 00 00 09 00 +T 00 01 +R 00 00 0A 00 +T 00 01 +R 00 00 0A 00 +T 00 01 31 FF FF CD 00 00 CD 00 00 C3 04 00 +R 00 00 0A 00 00 06 0D 00 02 09 01 00 00 0C 00 00 +T 00 00 +R 00 00 00 00 +T 00 00 3E 02 CF C9 +R 00 00 00 00 +T 04 00 +R 00 00 00 00 +T 04 00 3E 00 CF +R 00 00 00 00 +T 07 00 +R 00 00 00 00 +T 07 00 76 18 FD +R 00 00 00 00 +T 00 00 +R 00 00 0D 00 +T 00 00 78 B1 28 02 ED B0 +R 00 00 0D 00 +T 06 00 +R 00 00 0D 00 +T 00 00 C9 +R 00 00 0E 00 diff --git a/sw/z80/kernel/drivers/ctc.c b/sw/z80/kernel/drivers/ctc.c index e23ed8e..841202a 100644 --- a/sw/z80/kernel/drivers/ctc.c +++ b/sw/z80/kernel/drivers/ctc.c @@ -1 +1,6 @@ -#include "drivers/ctc.h" \ No newline at end of file +#include "drivers/ctc.h" + +void ctc_control() +{ + +} diff --git a/sw/z80/kernel/include/drivers/ctc.h b/sw/z80/kernel/include/drivers/ctc.h index 488e02b..80e8b4b 100644 --- a/sw/z80/kernel/include/drivers/ctc.h +++ b/sw/z80/kernel/include/drivers/ctc.h @@ -1,6 +1,6 @@ #ifndef __CTC_H__ #define __CTC_H__ -void ctc_control() +void ctc_control(); -#endif /* __CTC_H__ */ \ No newline at end of file +#endif /* __CTC_H__ */ diff --git a/sw/z80/kernel/memory.c b/sw/z80/kernel/memory.c index cda62ca..1b2cc76 100644 --- a/sw/z80/kernel/memory.c +++ b/sw/z80/kernel/memory.c @@ -17,12 +17,14 @@ int mmu_write_table(void) int page_new(void) { - int i, addr, used; + int i, used; + uint16_t addr; + for (addr = ADDR_PAGE_FIRST; addr < ADDR_PAGE_LAST; addr += PAGE_SIZE) { used = 0; for (i = 0; i < PAGES_MAX_COUNT; i++) { - if (page_map[i].addr == addr) { + if (pages_table[i].addr == addr) { used = 1; break; } diff --git a/sw/z80/kernel/process.c b/sw/z80/kernel/process.c index 049c88c..7d8db89 100644 --- a/sw/z80/kernel/process.c +++ b/sw/z80/kernel/process.c @@ -33,15 +33,17 @@ int fork(void) return -1; - for (i = 0; i < current_proc.pages; i++) { + for (i = 0; i < current_proc->pages; i++) { p = page_new(); if (p == -1) { - return -2; } - proc_table[child_pid].page[i] = p; + // TODO: use memcpy() + // SDCC does not allow assignemnts of structs + + // proc_table[child_pid].page[i] = p; } } -- cgit v1.2.1