summaryrefslogtreecommitdiffstats
path: root/sw/z80
diff options
context:
space:
mode:
Diffstat (limited to 'sw/z80')
-rw-r--r--sw/z80/build/kernel/filesystem.asm117
-rw-r--r--sw/z80/build/kernel/filesystem.lst117
-rw-r--r--sw/z80/build/kernel/filesystem.rel54
-rw-r--r--sw/z80/build/kernel/filesystem.sym33
-rw-r--r--sw/z80/build/kernel/kernel.asm66
-rw-r--r--sw/z80/build/kernel/kernel.lst66
-rw-r--r--sw/z80/build/kernel/kernel.rel22
-rw-r--r--sw/z80/build/kernel/kernel.sym27
-rw-r--r--sw/z80/build/kernel/memory.asm186
-rw-r--r--sw/z80/build/kernel/memory.lst186
-rw-r--r--sw/z80/build/kernel/memory.rel76
-rw-r--r--sw/z80/build/kernel/memory.sym30
-rw-r--r--sw/z80/build/kernel/process.asm89
-rw-r--r--sw/z80/build/kernel/process.lst89
-rw-r--r--sw/z80/build/kernel/process.rel45
-rw-r--r--sw/z80/build/kernel/process.sym32
-rw-r--r--sw/z80/crt0.rel86
-rw-r--r--sw/z80/kernel/drivers/ctc.c1
-rw-r--r--sw/z80/kernel/drivers/pio.c29
-rw-r--r--sw/z80/kernel/include/drivers/ctc.h6
-rw-r--r--sw/z80/kernel/include/drivers/pio.h20
-rw-r--r--sw/z80/kernel/include/fs/fs.h2
-rw-r--r--sw/z80/kernel/include/memory.h10
-rw-r--r--sw/z80/kernel/include/process.h21
-rw-r--r--sw/z80/kernel/include/syscall.h20
-rw-r--r--sw/z80/kernel/include/types.h42
-rw-r--r--sw/z80/kernel/memory.c32
-rw-r--r--sw/z80/kernel/process.c38
-rw-r--r--sw/z80/libc/string.c20
-rw-r--r--sw/z80/makefile3
30 files changed, 151 insertions, 1414 deletions
diff --git a/sw/z80/build/kernel/filesystem.asm b/sw/z80/build/kernel/filesystem.asm
deleted file mode 100644
index f868b5a..0000000
--- a/sw/z80/build/kernel/filesystem.asm
+++ /dev/null
@@ -1,117 +0,0 @@
-;--------------------------------------------------------
-; File Created by SDCC : free open source ANSI-C Compiler
-; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
-; This file was generated Wed Aug 23 21:44:59 2017
-;--------------------------------------------------------
- .module filesystem
- .optsdcc -mz80
-
-;--------------------------------------------------------
-; Public variables in this module
-;--------------------------------------------------------
- .globl _fs_parse_superblock
- .globl _fs_parse_path
- .globl _fs_get_inode
- .globl _fs_new_inode
- .globl _fs_free_inode
- .globl _fs_chmod
- .globl _fs_chown
- .globl _fs_rename
-;--------------------------------------------------------
-; special function registers
-;--------------------------------------------------------
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _DATA
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _INITIALIZED
-;--------------------------------------------------------
-; absolute external ram data
-;--------------------------------------------------------
- .area _DABS (ABS)
-;--------------------------------------------------------
-; global & static initialisations
-;--------------------------------------------------------
- .area _HOME
- .area _GSINIT
- .area _GSFINAL
- .area _GSINIT
-;--------------------------------------------------------
-; Home
-;--------------------------------------------------------
- .area _HOME
- .area _HOME
-;--------------------------------------------------------
-; code
-;--------------------------------------------------------
- .area _CODE
-;kernel/filesystem.c:3: struct filesystem * fs_parse_superblock(struct filesystem *fs)
-; ---------------------------------
-; Function fs_parse_superblock
-; ---------------------------------
-_fs_parse_superblock::
-;kernel/filesystem.c:5: return 0;
- ld hl,#0x0000
- ret
-;kernel/filesystem.c:9: uint16_t fs_parse_path(const char *path)
-; ---------------------------------
-; Function fs_parse_path
-; ---------------------------------
-_fs_parse_path::
-;kernel/filesystem.c:11: return 0;
- ld hl,#0x0000
- ld e,l
- ld d,h
- ret
-;kernel/filesystem.c:15: inode_t * fs_get_inode(inode_t *buffer, uint16_t i_number)
-; ---------------------------------
-; Function fs_get_inode
-; ---------------------------------
-_fs_get_inode::
-;kernel/filesystem.c:17: return 0;
- ld hl,#0x0000
- ret
-;kernel/filesystem.c:20: inode_t * fs_new_inode(inode_t *inode, const char *name)
-; ---------------------------------
-; Function fs_new_inode
-; ---------------------------------
-_fs_new_inode::
-;kernel/filesystem.c:22: return 0;
- ld hl,#0x0000
- ret
-;kernel/filesystem.c:25: int fs_free_inode(const inode_t *inode)
-; ---------------------------------
-; Function fs_free_inode
-; ---------------------------------
-_fs_free_inode::
-;kernel/filesystem.c:27: return 0;
- ld hl,#0x0000
- ret
-;kernel/filesystem.c:30: void fs_chmod(inode_t *inode, uint8_t mode)
-; ---------------------------------
-; Function fs_chmod
-; ---------------------------------
-_fs_chmod::
-;kernel/filesystem.c:32: }
- ret
-;kernel/filesystem.c:34: void fs_chown(inode_t *inode, uint8_t uid)
-; ---------------------------------
-; Function fs_chown
-; ---------------------------------
-_fs_chown::
-;kernel/filesystem.c:37: }
- ret
-;kernel/filesystem.c:39: int fs_rename(inode_t *inode, const char *name)
-; ---------------------------------
-; Function fs_rename
-; ---------------------------------
-_fs_rename::
-;kernel/filesystem.c:41: return 0;
- ld hl,#0x0000
- ret
- .area _CODE
- .area _INITIALIZER
- .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/filesystem.lst b/sw/z80/build/kernel/filesystem.lst
deleted file mode 100644
index 80ecda7..0000000
--- a/sw/z80/build/kernel/filesystem.lst
+++ /dev/null
@@ -1,117 +0,0 @@
- 1 ;--------------------------------------------------------
- 2 ; File Created by SDCC : free open source ANSI-C Compiler
- 3 ; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
- 4 ; This file was generated Wed Aug 23 21:44:59 2017
- 5 ;--------------------------------------------------------
- 6 .module filesystem
- 7 .optsdcc -mz80
- 8
- 9 ;--------------------------------------------------------
- 10 ; Public variables in this module
- 11 ;--------------------------------------------------------
- 12 .globl _fs_parse_superblock
- 13 .globl _fs_parse_path
- 14 .globl _fs_get_inode
- 15 .globl _fs_new_inode
- 16 .globl _fs_free_inode
- 17 .globl _fs_chmod
- 18 .globl _fs_chown
- 19 .globl _fs_rename
- 20 ;--------------------------------------------------------
- 21 ; special function registers
- 22 ;--------------------------------------------------------
- 23 ;--------------------------------------------------------
- 24 ; ram data
- 25 ;--------------------------------------------------------
- 26 .area _DATA
- 27 ;--------------------------------------------------------
- 28 ; ram data
- 29 ;--------------------------------------------------------
- 30 .area _INITIALIZED
- 31 ;--------------------------------------------------------
- 32 ; absolute external ram data
- 33 ;--------------------------------------------------------
- 34 .area _DABS (ABS)
- 35 ;--------------------------------------------------------
- 36 ; global & static initialisations
- 37 ;--------------------------------------------------------
- 38 .area _HOME
- 39 .area _GSINIT
- 40 .area _GSFINAL
- 41 .area _GSINIT
- 42 ;--------------------------------------------------------
- 43 ; Home
- 44 ;--------------------------------------------------------
- 45 .area _HOME
- 46 .area _HOME
- 47 ;--------------------------------------------------------
- 48 ; code
- 49 ;--------------------------------------------------------
- 50 .area _CODE
- 51 ;kernel/filesystem.c:3: struct filesystem * fs_parse_superblock(struct filesystem *fs)
- 52 ; ---------------------------------
- 53 ; Function fs_parse_superblock
- 54 ; ---------------------------------
- 0000 55 _fs_parse_superblock::
- 56 ;kernel/filesystem.c:5: return 0;
- 0000 21 00 00 [10] 57 ld hl,#0x0000
- 0003 C9 [10] 58 ret
- 59 ;kernel/filesystem.c:9: uint16_t fs_parse_path(const char *path)
- 60 ; ---------------------------------
- 61 ; Function fs_parse_path
- 62 ; ---------------------------------
- 0004 63 _fs_parse_path::
- 64 ;kernel/filesystem.c:11: return 0;
- 0004 21 00 00 [10] 65 ld hl,#0x0000
- 0007 5D [ 4] 66 ld e,l
- 0008 54 [ 4] 67 ld d,h
- 0009 C9 [10] 68 ret
- 69 ;kernel/filesystem.c:15: inode_t * fs_get_inode(inode_t *buffer, uint16_t i_number)
- 70 ; ---------------------------------
- 71 ; Function fs_get_inode
- 72 ; ---------------------------------
- 000A 73 _fs_get_inode::
- 74 ;kernel/filesystem.c:17: return 0;
- 000A 21 00 00 [10] 75 ld hl,#0x0000
- 000D C9 [10] 76 ret
- 77 ;kernel/filesystem.c:20: inode_t * fs_new_inode(inode_t *inode, const char *name)
- 78 ; ---------------------------------
- 79 ; Function fs_new_inode
- 80 ; ---------------------------------
- 000E 81 _fs_new_inode::
- 82 ;kernel/filesystem.c:22: return 0;
- 000E 21 00 00 [10] 83 ld hl,#0x0000
- 0011 C9 [10] 84 ret
- 85 ;kernel/filesystem.c:25: int fs_free_inode(const inode_t *inode)
- 86 ; ---------------------------------
- 87 ; Function fs_free_inode
- 88 ; ---------------------------------
- 0012 89 _fs_free_inode::
- 90 ;kernel/filesystem.c:27: return 0;
- 0012 21 00 00 [10] 91 ld hl,#0x0000
- 0015 C9 [10] 92 ret
- 93 ;kernel/filesystem.c:30: void fs_chmod(inode_t *inode, uint8_t mode)
- 94 ; ---------------------------------
- 95 ; Function fs_chmod
- 96 ; ---------------------------------
- 0016 97 _fs_chmod::
- 98 ;kernel/filesystem.c:32: }
- 0016 C9 [10] 99 ret
- 100 ;kernel/filesystem.c:34: void fs_chown(inode_t *inode, uint8_t uid)
- 101 ; ---------------------------------
- 102 ; Function fs_chown
- 103 ; ---------------------------------
- 0017 104 _fs_chown::
- 105 ;kernel/filesystem.c:37: }
- 0017 C9 [10] 106 ret
- 107 ;kernel/filesystem.c:39: int fs_rename(inode_t *inode, const char *name)
- 108 ; ---------------------------------
- 109 ; Function fs_rename
- 110 ; ---------------------------------
- 0018 111 _fs_rename::
- 112 ;kernel/filesystem.c:41: return 0;
- 0018 21 00 00 [10] 113 ld hl,#0x0000
- 001B C9 [10] 114 ret
- 115 .area _CODE
- 116 .area _INITIALIZER
- 117 .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/filesystem.rel b/sw/z80/build/kernel/filesystem.rel
deleted file mode 100644
index 3ccb28f..0000000
--- a/sw/z80/build/kernel/filesystem.rel
+++ /dev/null
@@ -1,54 +0,0 @@
-XL2
-H 9 areas 9 global symbols
-M filesystem
-O -mz80
-S .__.ABS. Def0000
-A _CODE size 1C flags 0 addr 0
-S _fs_get_inode Def000A
-S _fs_parse_superblock Def0000
-S _fs_rename Def0018
-S _fs_new_inode Def000E
-S _fs_chmod Def0016
-S _fs_free_inode Def0012
-S _fs_chown Def0017
-S _fs_parse_path Def0004
-A _DATA size 0 flags 0 addr 0
-A _INITIALIZED size 0 flags 0 addr 0
-A _DABS size 0 flags 8 addr 0
-A _HOME size 0 flags 0 addr 0
-A _GSINIT size 0 flags 0 addr 0
-A _GSFINAL size 0 flags 0 addr 0
-A _INITIALIZER size 0 flags 0 addr 0
-A _CABS size 0 flags 8 addr 0
-T 00 00
-R 00 00 00 00
-T 00 00 21 00 00 C9
-R 00 00 00 00
-T 04 00
-R 00 00 00 00
-T 04 00 21 00 00 5D 54 C9
-R 00 00 00 00
-T 0A 00
-R 00 00 00 00
-T 0A 00 21 00 00 C9
-R 00 00 00 00
-T 0E 00
-R 00 00 00 00
-T 0E 00 21 00 00 C9
-R 00 00 00 00
-T 12 00
-R 00 00 00 00
-T 12 00 21 00 00 C9
-R 00 00 00 00
-T 16 00
-R 00 00 00 00
-T 16 00 C9
-R 00 00 00 00
-T 17 00
-R 00 00 00 00
-T 17 00 C9
-R 00 00 00 00
-T 18 00
-R 00 00 00 00
-T 18 00 21 00 00 C9
-R 00 00 00 00
diff --git a/sw/z80/build/kernel/filesystem.sym b/sw/z80/build/kernel/filesystem.sym
deleted file mode 100644
index 6e95911..0000000
--- a/sw/z80/build/kernel/filesystem.sym
+++ /dev/null
@@ -1,33 +0,0 @@
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 1.
-Hexadecimal [16-Bits]
-
-Symbol Table
-
- .__.$$$. = 2710 L
- .__.ABS. = 0000 G
- .__.CPU. = 0000 L
- .__.H$L. = 0000 L
- 0 _fs_chmod 0016 GR
- 0 _fs_chown 0017 GR
- 0 _fs_free_inode 0012 GR
- 0 _fs_get_inode 000A GR
- 0 _fs_new_inode 000E GR
- 0 _fs_parse_path 0004 GR
- 0 _fs_parse_superblock 0000 GR
- 0 _fs_rename 0018 GR
-
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2.
-Hexadecimal [16-Bits]
-
-Area Table
-
- 0 _CODE size 1C flags 0
- 1 _DATA size 0 flags 0
- 2 _INITIALIZED size 0 flags 0
- 3 _DABS size 0 flags 8
- 4 _HOME size 0 flags 0
- 5 _GSINIT size 0 flags 0
- 6 _GSFINAL size 0 flags 0
- 7 _INITIALIZER size 0 flags 0
- 8 _CABS size 0 flags 8
-
diff --git a/sw/z80/build/kernel/kernel.asm b/sw/z80/build/kernel/kernel.asm
deleted file mode 100644
index e0839fc..0000000
--- a/sw/z80/build/kernel/kernel.asm
+++ /dev/null
@@ -1,66 +0,0 @@
-;--------------------------------------------------------
-; File Created by SDCC : free open source ANSI-C Compiler
-; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
-; This file was generated Wed Aug 23 21:44:59 2017
-;--------------------------------------------------------
- .module kernel
- .optsdcc -mz80
-
-;--------------------------------------------------------
-; Public variables in this module
-;--------------------------------------------------------
- .globl _kmain
- .globl _usart_init
-;--------------------------------------------------------
-; special function registers
-;--------------------------------------------------------
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _DATA
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _INITIALIZED
-;--------------------------------------------------------
-; absolute external ram data
-;--------------------------------------------------------
- .area _DABS (ABS)
-;--------------------------------------------------------
-; global & static initialisations
-;--------------------------------------------------------
- .area _HOME
- .area _GSINIT
- .area _GSFINAL
- .area _GSINIT
-;--------------------------------------------------------
-; Home
-;--------------------------------------------------------
- .area _HOME
- .area _HOME
-;--------------------------------------------------------
-; code
-;--------------------------------------------------------
- .area _CODE
-;kernel/kernel.c:4: void kmain(void)
-; ---------------------------------
-; Function kmain
-; ---------------------------------
-_kmain::
-;kernel/kernel.c:6: usart_init(USART_BAUDRATE_9600, USART_PARITY_EVEN, USART_STOP_BITS_1);
- ld hl,#0x000A
- push hl
- ld l, #0x01
- push hl
- ld hl,#0x0000
- push hl
- ld hl,#0x000C
- push hl
- call _usart_init
- ld hl,#8
- add hl,sp
- ld sp,hl
- ret
- .area _CODE
- .area _INITIALIZER
- .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/kernel.lst b/sw/z80/build/kernel/kernel.lst
deleted file mode 100644
index e839f83..0000000
--- a/sw/z80/build/kernel/kernel.lst
+++ /dev/null
@@ -1,66 +0,0 @@
- 1 ;--------------------------------------------------------
- 2 ; File Created by SDCC : free open source ANSI-C Compiler
- 3 ; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
- 4 ; This file was generated Wed Aug 23 21:44:59 2017
- 5 ;--------------------------------------------------------
- 6 .module kernel
- 7 .optsdcc -mz80
- 8
- 9 ;--------------------------------------------------------
- 10 ; Public variables in this module
- 11 ;--------------------------------------------------------
- 12 .globl _kmain
- 13 .globl _usart_init
- 14 ;--------------------------------------------------------
- 15 ; special function registers
- 16 ;--------------------------------------------------------
- 17 ;--------------------------------------------------------
- 18 ; ram data
- 19 ;--------------------------------------------------------
- 20 .area _DATA
- 21 ;--------------------------------------------------------
- 22 ; ram data
- 23 ;--------------------------------------------------------
- 24 .area _INITIALIZED
- 25 ;--------------------------------------------------------
- 26 ; absolute external ram data
- 27 ;--------------------------------------------------------
- 28 .area _DABS (ABS)
- 29 ;--------------------------------------------------------
- 30 ; global & static initialisations
- 31 ;--------------------------------------------------------
- 32 .area _HOME
- 33 .area _GSINIT
- 34 .area _GSFINAL
- 35 .area _GSINIT
- 36 ;--------------------------------------------------------
- 37 ; Home
- 38 ;--------------------------------------------------------
- 39 .area _HOME
- 40 .area _HOME
- 41 ;--------------------------------------------------------
- 42 ; code
- 43 ;--------------------------------------------------------
- 44 .area _CODE
- 45 ;kernel/kernel.c:4: void kmain(void)
- 46 ; ---------------------------------
- 47 ; Function kmain
- 48 ; ---------------------------------
- 0000 49 _kmain::
- 50 ;kernel/kernel.c:6: usart_init(USART_BAUDRATE_9600, USART_PARITY_EVEN, USART_STOP_BITS_1);
- 0000 21 0A 00 [10] 51 ld hl,#0x000A
- 0003 E5 [11] 52 push hl
- 0004 2E 01 [ 7] 53 ld l, #0x01
- 0006 E5 [11] 54 push hl
- 0007 21 00 00 [10] 55 ld hl,#0x0000
- 000A E5 [11] 56 push hl
- 000B 21 0C 00 [10] 57 ld hl,#0x000C
- 000E E5 [11] 58 push hl
- 000F CDr00r00 [17] 59 call _usart_init
- 0012 21 08 00 [10] 60 ld hl,#8
- 0015 39 [11] 61 add hl,sp
- 0016 F9 [ 6] 62 ld sp,hl
- 0017 C9 [10] 63 ret
- 64 .area _CODE
- 65 .area _INITIALIZER
- 66 .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/kernel.rel b/sw/z80/build/kernel/kernel.rel
deleted file mode 100644
index 103d026..0000000
--- a/sw/z80/build/kernel/kernel.rel
+++ /dev/null
@@ -1,22 +0,0 @@
-XL2
-H 9 areas 3 global symbols
-M kernel
-O -mz80
-S .__.ABS. Def0000
-S _usart_init Ref0000
-A _CODE size 18 flags 0 addr 0
-S _kmain Def0000
-A _DATA size 0 flags 0 addr 0
-A _INITIALIZED size 0 flags 0 addr 0
-A _DABS size 0 flags 8 addr 0
-A _HOME size 0 flags 0 addr 0
-A _GSINIT size 0 flags 0 addr 0
-A _GSFINAL size 0 flags 0 addr 0
-A _INITIALIZER size 0 flags 0 addr 0
-A _CABS size 0 flags 8 addr 0
-T 00 00
-R 00 00 00 00
-T 00 00 21 0A 00 E5 2E 01 E5 21 00 00 E5 21 0C 00
-R 00 00 00 00
-T 0E 00 E5 CD 00 00 21 08 00 39 F9 C9
-R 00 00 00 00 02 04 01 00
diff --git a/sw/z80/build/kernel/kernel.sym b/sw/z80/build/kernel/kernel.sym
deleted file mode 100644
index b5145d5..0000000
--- a/sw/z80/build/kernel/kernel.sym
+++ /dev/null
@@ -1,27 +0,0 @@
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 1.
-Hexadecimal [16-Bits]
-
-Symbol Table
-
- .__.$$$. = 2710 L
- .__.ABS. = 0000 G
- .__.CPU. = 0000 L
- .__.H$L. = 0000 L
- 0 _kmain 0000 GR
- _usart_init **** GX
-
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2.
-Hexadecimal [16-Bits]
-
-Area Table
-
- 0 _CODE size 18 flags 0
- 1 _DATA size 0 flags 0
- 2 _INITIALIZED size 0 flags 0
- 3 _DABS size 0 flags 8
- 4 _HOME size 0 flags 0
- 5 _GSINIT size 0 flags 0
- 6 _GSFINAL size 0 flags 0
- 7 _INITIALIZER size 0 flags 0
- 8 _CABS size 0 flags 8
-
diff --git a/sw/z80/build/kernel/memory.asm b/sw/z80/build/kernel/memory.asm
deleted file mode 100644
index ffa5214..0000000
--- a/sw/z80/build/kernel/memory.asm
+++ /dev/null
@@ -1,186 +0,0 @@
-;--------------------------------------------------------
-; File Created by SDCC : free open source ANSI-C Compiler
-; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
-; This file was generated Wed Aug 23 21:44:59 2017
-;--------------------------------------------------------
- .module memory
- .optsdcc -mz80
-
-;--------------------------------------------------------
-; Public variables in this module
-;--------------------------------------------------------
- .globl _pages_table
- .globl _mmu_write_table
- .globl _page_map
- .globl _page_unmap
-;--------------------------------------------------------
-; special function registers
-;--------------------------------------------------------
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _DATA
-_pages_table::
- .ds 192
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _INITIALIZED
-;--------------------------------------------------------
-; absolute external ram data
-;--------------------------------------------------------
- .area _DABS (ABS)
-;--------------------------------------------------------
-; global & static initialisations
-;--------------------------------------------------------
- .area _HOME
- .area _GSINIT
- .area _GSFINAL
- .area _GSINIT
-;--------------------------------------------------------
-; Home
-;--------------------------------------------------------
- .area _HOME
- .area _HOME
-;--------------------------------------------------------
-; code
-;--------------------------------------------------------
- .area _CODE
-;kernel/memory.c:5: int mmu_write_table(void)
-; ---------------------------------
-; Function mmu_write_table
-; ---------------------------------
-_mmu_write_table::
-;kernel/memory.c:9: for (i = 0; i < PAGES_MAX_COUNT; i++) {
- ld hl,#0x0000
-00102$:
- inc hl
- ld a,l
- sub a, #0x20
- ld a,h
- rla
- ccf
- rra
- sbc a, #0x80
- jr C,00102$
-;kernel/memory.c:15: return 0;
- ld hl,#0x0000
- ret
-;kernel/memory.c:18: int page_map(int page, int pid, uint16_t addr)
-; ---------------------------------
-; Function page_map
-; ---------------------------------
-_page_map::
- push ix
- ld ix,#0
- add ix,sp
-;kernel/memory.c:20: if (page >= PAGES_MAX_COUNT)
- ld a,4 (ix)
- sub a, #0x20
- ld a,5 (ix)
- rla
- ccf
- rra
- sbc a, #0x80
- jr C,00102$
-;kernel/memory.c:21: return -1;
- ld hl,#0xFFFF
- jr 00105$
-00102$:
-;kernel/memory.c:23: if (pages_table[page].used)
- ld de,#_pages_table+0
- ld c,4 (ix)
- ld b,5 (ix)
- ld l, c
- ld h, b
- add hl, hl
- add hl, bc
- add hl, hl
- add hl,de
- ld c,l
- ld b,h
- ld a,(hl)
- and a,#0x01
- jr Z,00104$
-;kernel/memory.c:24: return -2;
- ld hl,#0xFFFE
- jr 00105$
-00104$:
-;kernel/memory.c:26: pages_table[page].addr = addr;
- ld e, c
- ld d, b
- inc de
- inc de
- push bc
- ld hl, #0x000A
- add hl, sp
- ld bc, #0x0004
- ldir
- pop bc
-;kernel/memory.c:27: pages_table[page].pid = pid;
- ld l, c
- ld h, b
- inc hl
- ld a,6 (ix)
- ld (hl),a
-;kernel/memory.c:29: pages_table[page].used = 1;
- ld a,(bc)
- or a,#0x01
- ld (bc),a
-;kernel/memory.c:30: return 0;
- ld hl,#0x0000
-00105$:
- pop ix
- ret
-;kernel/memory.c:33: int page_unmap(int page)
-; ---------------------------------
-; Function page_unmap
-; ---------------------------------
-_page_unmap::
- push ix
- ld ix,#0
- add ix,sp
-;kernel/memory.c:35: if (page >= PAGES_MAX_COUNT)
- ld a,4 (ix)
- sub a, #0x20
- ld a,5 (ix)
- rla
- ccf
- rra
- sbc a, #0x80
- jr C,00102$
-;kernel/memory.c:36: return -1;
- ld hl,#0xFFFF
- jr 00105$
-00102$:
-;kernel/memory.c:38: if (pages_table[page].used == 0)
- ld de,#_pages_table+0
- ld c,4 (ix)
- ld b,5 (ix)
- ld l, c
- ld h, b
- add hl, hl
- add hl, bc
- add hl, hl
- add hl,de
- ld e,l
- ld d,h
- ld a,(hl)
- and a,#0x01
- jr NZ,00104$
-;kernel/memory.c:39: return -2;
- ld hl,#0xFFFE
- jr 00105$
-00104$:
-;kernel/memory.c:41: pages_table[page].used = 0;
- ld a,(de)
- and a,#0xFE
- ld (de),a
-;kernel/memory.c:42: return 0;
- ld hl,#0x0000
-00105$:
- pop ix
- ret
- .area _CODE
- .area _INITIALIZER
- .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/memory.lst b/sw/z80/build/kernel/memory.lst
deleted file mode 100644
index 5f229f5..0000000
--- a/sw/z80/build/kernel/memory.lst
+++ /dev/null
@@ -1,186 +0,0 @@
- 1 ;--------------------------------------------------------
- 2 ; File Created by SDCC : free open source ANSI-C Compiler
- 3 ; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
- 4 ; This file was generated Wed Aug 23 21:44:59 2017
- 5 ;--------------------------------------------------------
- 6 .module memory
- 7 .optsdcc -mz80
- 8
- 9 ;--------------------------------------------------------
- 10 ; Public variables in this module
- 11 ;--------------------------------------------------------
- 12 .globl _pages_table
- 13 .globl _mmu_write_table
- 14 .globl _page_map
- 15 .globl _page_unmap
- 16 ;--------------------------------------------------------
- 17 ; special function registers
- 18 ;--------------------------------------------------------
- 19 ;--------------------------------------------------------
- 20 ; ram data
- 21 ;--------------------------------------------------------
- 22 .area _DATA
- 0000 23 _pages_table::
- 0000 24 .ds 192
- 25 ;--------------------------------------------------------
- 26 ; ram data
- 27 ;--------------------------------------------------------
- 28 .area _INITIALIZED
- 29 ;--------------------------------------------------------
- 30 ; absolute external ram data
- 31 ;--------------------------------------------------------
- 32 .area _DABS (ABS)
- 33 ;--------------------------------------------------------
- 34 ; global & static initialisations
- 35 ;--------------------------------------------------------
- 36 .area _HOME
- 37 .area _GSINIT
- 38 .area _GSFINAL
- 39 .area _GSINIT
- 40 ;--------------------------------------------------------
- 41 ; Home
- 42 ;--------------------------------------------------------
- 43 .area _HOME
- 44 .area _HOME
- 45 ;--------------------------------------------------------
- 46 ; code
- 47 ;--------------------------------------------------------
- 48 .area _CODE
- 49 ;kernel/memory.c:5: int mmu_write_table(void)
- 50 ; ---------------------------------
- 51 ; Function mmu_write_table
- 52 ; ---------------------------------
- 0000 53 _mmu_write_table::
- 54 ;kernel/memory.c:9: for (i = 0; i < PAGES_MAX_COUNT; i++) {
- 0000 21 00 00 [10] 55 ld hl,#0x0000
- 0003 56 00102$:
- 0003 23 [ 6] 57 inc hl
- 0004 7D [ 4] 58 ld a,l
- 0005 D6 20 [ 7] 59 sub a, #0x20
- 0007 7C [ 4] 60 ld a,h
- 0008 17 [ 4] 61 rla
- 0009 3F [ 4] 62 ccf
- 000A 1F [ 4] 63 rra
- 000B DE 80 [ 7] 64 sbc a, #0x80
- 000D 38 F4 [12] 65 jr C,00102$
- 66 ;kernel/memory.c:15: return 0;
- 000F 21 00 00 [10] 67 ld hl,#0x0000
- 0012 C9 [10] 68 ret
- 69 ;kernel/memory.c:18: int page_map(int page, int pid, uint16_t addr)
- 70 ; ---------------------------------
- 71 ; Function page_map
- 72 ; ---------------------------------
- 0013 73 _page_map::
- 0013 DD E5 [15] 74 push ix
- 0015 DD 21 00 00 [14] 75 ld ix,#0
- 0019 DD 39 [15] 76 add ix,sp
- 77 ;kernel/memory.c:20: if (page >= PAGES_MAX_COUNT)
- 001B DD 7E 04 [19] 78 ld a,4 (ix)
- 001E D6 20 [ 7] 79 sub a, #0x20
- 0020 DD 7E 05 [19] 80 ld a,5 (ix)
- 0023 17 [ 4] 81 rla
- 0024 3F [ 4] 82 ccf
- 0025 1F [ 4] 83 rra
- 0026 DE 80 [ 7] 84 sbc a, #0x80
- 0028 38 05 [12] 85 jr C,00102$
- 86 ;kernel/memory.c:21: return -1;
- 002A 21 FF FF [10] 87 ld hl,#0xFFFF
- 002D 18 38 [12] 88 jr 00105$
- 002F 89 00102$:
- 90 ;kernel/memory.c:23: if (pages_table[page].used)
- 002F 11r00r00 [10] 91 ld de,#_pages_table+0
- 0032 DD 4E 04 [19] 92 ld c,4 (ix)
- 0035 DD 46 05 [19] 93 ld b,5 (ix)
- 0038 69 [ 4] 94 ld l, c
- 0039 60 [ 4] 95 ld h, b
- 003A 29 [11] 96 add hl, hl
- 003B 09 [11] 97 add hl, bc
- 003C 29 [11] 98 add hl, hl
- 003D 19 [11] 99 add hl,de
- 003E 4D [ 4] 100 ld c,l
- 003F 44 [ 4] 101 ld b,h
- 0040 7E [ 7] 102 ld a,(hl)
- 0041 E6 01 [ 7] 103 and a,#0x01
- 0043 28 05 [12] 104 jr Z,00104$
- 105 ;kernel/memory.c:24: return -2;
- 0045 21 FE FF [10] 106 ld hl,#0xFFFE
- 0048 18 1D [12] 107 jr 00105$
- 004A 108 00104$:
- 109 ;kernel/memory.c:26: pages_table[page].addr = addr;
- 004A 59 [ 4] 110 ld e, c
- 004B 50 [ 4] 111 ld d, b
- 004C 13 [ 6] 112 inc de
- 004D 13 [ 6] 113 inc de
- 004E C5 [11] 114 push bc
- 004F 21 0A 00 [10] 115 ld hl, #0x000A
- 0052 39 [11] 116 add hl, sp
- 0053 01 04 00 [10] 117 ld bc, #0x0004
- 0056 ED B0 [21] 118 ldir
- 0058 C1 [10] 119 pop bc
- 120 ;kernel/memory.c:27: pages_table[page].pid = pid;
- 0059 69 [ 4] 121 ld l, c
- 005A 60 [ 4] 122 ld h, b
- 005B 23 [ 6] 123 inc hl
- 005C DD 7E 06 [19] 124 ld a,6 (ix)
- 005F 77 [ 7] 125 ld (hl),a
- 126 ;kernel/memory.c:29: pages_table[page].used = 1;
- 0060 0A [ 7] 127 ld a,(bc)
- 0061 F6 01 [ 7] 128 or a,#0x01
- 0063 02 [ 7] 129 ld (bc),a
- 130 ;kernel/memory.c:30: return 0;
- 0064 21 00 00 [10] 131 ld hl,#0x0000
- 0067 132 00105$:
- 0067 DD E1 [14] 133 pop ix
- 0069 C9 [10] 134 ret
- 135 ;kernel/memory.c:33: int page_unmap(int page)
- 136 ; ---------------------------------
- 137 ; Function page_unmap
- 138 ; ---------------------------------
- 006A 139 _page_unmap::
- 006A DD E5 [15] 140 push ix
- 006C DD 21 00 00 [14] 141 ld ix,#0
- 0070 DD 39 [15] 142 add ix,sp
- 143 ;kernel/memory.c:35: if (page >= PAGES_MAX_COUNT)
- 0072 DD 7E 04 [19] 144 ld a,4 (ix)
- 0075 D6 20 [ 7] 145 sub a, #0x20
- 0077 DD 7E 05 [19] 146 ld a,5 (ix)
- 007A 17 [ 4] 147 rla
- 007B 3F [ 4] 148 ccf
- 007C 1F [ 4] 149 rra
- 007D DE 80 [ 7] 150 sbc a, #0x80
- 007F 38 05 [12] 151 jr C,00102$
- 152 ;kernel/memory.c:36: return -1;
- 0081 21 FF FF [10] 153 ld hl,#0xFFFF
- 0084 18 22 [12] 154 jr 00105$
- 0086 155 00102$:
- 156 ;kernel/memory.c:38: if (pages_table[page].used == 0)
- 0086 11r00r00 [10] 157 ld de,#_pages_table+0
- 0089 DD 4E 04 [19] 158 ld c,4 (ix)
- 008C DD 46 05 [19] 159 ld b,5 (ix)
- 008F 69 [ 4] 160 ld l, c
- 0090 60 [ 4] 161 ld h, b
- 0091 29 [11] 162 add hl, hl
- 0092 09 [11] 163 add hl, bc
- 0093 29 [11] 164 add hl, hl
- 0094 19 [11] 165 add hl,de
- 0095 5D [ 4] 166 ld e,l
- 0096 54 [ 4] 167 ld d,h
- 0097 7E [ 7] 168 ld a,(hl)
- 0098 E6 01 [ 7] 169 and a,#0x01
- 009A 20 05 [12] 170 jr NZ,00104$
- 171 ;kernel/memory.c:39: return -2;
- 009C 21 FE FF [10] 172 ld hl,#0xFFFE
- 009F 18 07 [12] 173 jr 00105$
- 00A1 174 00104$:
- 175 ;kernel/memory.c:41: pages_table[page].used = 0;
- 00A1 1A [ 7] 176 ld a,(de)
- 00A2 E6 FE [ 7] 177 and a,#0xFE
- 00A4 12 [ 7] 178 ld (de),a
- 179 ;kernel/memory.c:42: return 0;
- 00A5 21 00 00 [10] 180 ld hl,#0x0000
- 00A8 181 00105$:
- 00A8 DD E1 [14] 182 pop ix
- 00AA C9 [10] 183 ret
- 184 .area _CODE
- 185 .area _INITIALIZER
- 186 .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/memory.rel b/sw/z80/build/kernel/memory.rel
deleted file mode 100644
index a0cbbca..0000000
--- a/sw/z80/build/kernel/memory.rel
+++ /dev/null
@@ -1,76 +0,0 @@
-XL2
-H 9 areas 5 global symbols
-M memory
-O -mz80
-S .__.ABS. Def0000
-A _CODE size AB flags 0 addr 0
-S _page_map Def0013
-S _mmu_write_table Def0000
-S _page_unmap Def006A
-A _DATA size C0 flags 0 addr 0
-S _pages_table Def0000
-A _INITIALIZED size 0 flags 0 addr 0
-A _DABS size 0 flags 8 addr 0
-A _HOME size 0 flags 0 addr 0
-A _GSINIT size 0 flags 0 addr 0
-A _GSFINAL size 0 flags 0 addr 0
-A _INITIALIZER size 0 flags 0 addr 0
-A _CABS size 0 flags 8 addr 0
-T 00 00
-R 00 00 01 00
-T 00 00
-R 00 00 01 00
-T 00 00
-R 00 00 00 00
-T 00 00 21 00 00
-R 00 00 00 00
-T 03 00
-R 00 00 00 00
-T 03 00 23 7D D6 20 7C 17 3F 1F DE 80 38 F4 21
-R 00 00 00 00
-T 10 00 00 00 C9
-R 00 00 00 00
-T 13 00
-R 00 00 00 00
-T 13 00 DD E5 DD 21 00 00 DD 39 DD 7E 04 D6 20 DD
-R 00 00 00 00
-T 21 00 7E 05 17 3F 1F DE 80 38 05 21 FF FF 18 38
-R 00 00 00 00
-T 2F 00
-R 00 00 00 00
-T 2F 00 11 00 00 DD 4E 04 DD 46 05 69 60 29 09 29
-R 00 00 00 00 00 03 01 00
-T 3D 00 19 4D 44 7E E6 01 28 05 21 FE FF 18 1D
-R 00 00 00 00
-T 4A 00
-R 00 00 00 00
-T 4A 00 59 50 13 13 C5 21 0A 00 39 01 04 00 ED B0
-R 00 00 00 00
-T 58 00 C1 69 60 23 DD 7E 06 77 0A F6 01 02 21
-R 00 00 00 00
-T 65 00 00 00
-R 00 00 00 00
-T 67 00
-R 00 00 00 00
-T 67 00 DD E1 C9
-R 00 00 00 00
-T 6A 00
-R 00 00 00 00
-T 6A 00 DD E5 DD 21 00 00 DD 39 DD 7E 04 D6 20 DD
-R 00 00 00 00
-T 78 00 7E 05 17 3F 1F DE 80 38 05 21 FF FF 18 22
-R 00 00 00 00
-T 86 00
-R 00 00 00 00
-T 86 00 11 00 00 DD 4E 04 DD 46 05 69 60 29 09 29
-R 00 00 00 00 00 03 01 00
-T 94 00 19 5D 54 7E E6 01 20 05 21 FE FF 18 07
-R 00 00 00 00
-T A1 00
-R 00 00 00 00
-T A1 00 1A E6 FE 12 21 00 00
-R 00 00 00 00
-T A8 00
-R 00 00 00 00
-T A8 00 DD E1 C9
-R 00 00 00 00
diff --git a/sw/z80/build/kernel/memory.sym b/sw/z80/build/kernel/memory.sym
deleted file mode 100644
index 26090e8..0000000
--- a/sw/z80/build/kernel/memory.sym
+++ /dev/null
@@ -1,30 +0,0 @@
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 1.
-Hexadecimal [16-Bits]
-
-Symbol Table
-
- .__.$$$. = 2710 L
- .__.ABS. = 0000 G
- .__.CPU. = 0000 L
- .__.H$L. = 0000 L
- 0 _mmu_write_table 0000 GR
- 0 _page_map 0013 GR
- 0 _page_unmap 006A GR
- 1 _pages_table 0000 GR
-
-
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2.
-Hexadecimal [16-Bits]
-
-Area Table
-
- 0 _CODE size AB flags 0
- 1 _DATA size C0 flags 0
- 2 _INITIALIZED size 0 flags 0
- 3 _DABS size 0 flags 8
- 4 _HOME size 0 flags 0
- 5 _GSINIT size 0 flags 0
- 6 _GSFINAL size 0 flags 0
- 7 _INITIALIZER size 0 flags 0
- 8 _CABS size 0 flags 8
-
diff --git a/sw/z80/build/kernel/process.asm b/sw/z80/build/kernel/process.asm
deleted file mode 100644
index f50bb3d..0000000
--- a/sw/z80/build/kernel/process.asm
+++ /dev/null
@@ -1,89 +0,0 @@
-;--------------------------------------------------------
-; File Created by SDCC : free open source ANSI-C Compiler
-; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
-; This file was generated Wed Aug 23 21:44:59 2017
-;--------------------------------------------------------
- .module process
- .optsdcc -mz80
-
-;--------------------------------------------------------
-; Public variables in this module
-;--------------------------------------------------------
- .globl _proc_table
- .globl _newpid
- .globl _fork
- .globl _exec
- .globl _spawn
-;--------------------------------------------------------
-; special function registers
-;--------------------------------------------------------
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _DATA
-_proc_table::
- .ds 6375
-_newpid_last_pid_1_11:
- .ds 1
-;--------------------------------------------------------
-; ram data
-;--------------------------------------------------------
- .area _INITIALIZED
-;--------------------------------------------------------
-; absolute external ram data
-;--------------------------------------------------------
- .area _DABS (ABS)
-;--------------------------------------------------------
-; global & static initialisations
-;--------------------------------------------------------
- .area _HOME
- .area _GSINIT
- .area _GSFINAL
- .area _GSINIT
-;kernel/process.c:7: static pid_t last_pid = 0;
- ld iy,#_newpid_last_pid_1_11
- ld 0 (iy),#0x00
-;--------------------------------------------------------
-; Home
-;--------------------------------------------------------
- .area _HOME
- .area _HOME
-;--------------------------------------------------------
-; code
-;--------------------------------------------------------
- .area _CODE
-;kernel/process.c:5: pid_t newpid(void)
-; ---------------------------------
-; Function newpid
-; ---------------------------------
-_newpid::
-;kernel/process.c:8: return ++last_pid;
- ld hl, #_newpid_last_pid_1_11+0
- inc (hl)
- ld iy,#_newpid_last_pid_1_11
- ld l,0 (iy)
- ret
-;kernel/process.c:11: int fork(void)
-; ---------------------------------
-; Function fork
-; ---------------------------------
-_fork::
-;kernel/process.c:14: }
- ret
-;kernel/process.c:16: int exec(char *path, char *args)
-; ---------------------------------
-; Function exec
-; ---------------------------------
-_exec::
-;kernel/process.c:19: }
- ret
-;kernel/process.c:21: int spawn(char *path, char *args)
-; ---------------------------------
-; Function spawn
-; ---------------------------------
-_spawn::
-;kernel/process.c:24: }
- ret
- .area _CODE
- .area _INITIALIZER
- .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/process.lst b/sw/z80/build/kernel/process.lst
deleted file mode 100644
index eb73943..0000000
--- a/sw/z80/build/kernel/process.lst
+++ /dev/null
@@ -1,89 +0,0 @@
- 1 ;--------------------------------------------------------
- 2 ; File Created by SDCC : free open source ANSI-C Compiler
- 3 ; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
- 4 ; This file was generated Wed Aug 23 21:44:59 2017
- 5 ;--------------------------------------------------------
- 6 .module process
- 7 .optsdcc -mz80
- 8
- 9 ;--------------------------------------------------------
- 10 ; Public variables in this module
- 11 ;--------------------------------------------------------
- 12 .globl _proc_table
- 13 .globl _newpid
- 14 .globl _fork
- 15 .globl _exec
- 16 .globl _spawn
- 17 ;--------------------------------------------------------
- 18 ; special function registers
- 19 ;--------------------------------------------------------
- 20 ;--------------------------------------------------------
- 21 ; ram data
- 22 ;--------------------------------------------------------
- 23 .area _DATA
- 0000 24 _proc_table::
- 0000 25 .ds 6375
- 18E7 26 _newpid_last_pid_1_11:
- 18E7 27 .ds 1
- 28 ;--------------------------------------------------------
- 29 ; ram data
- 30 ;--------------------------------------------------------
- 31 .area _INITIALIZED
- 32 ;--------------------------------------------------------
- 33 ; absolute external ram data
- 34 ;--------------------------------------------------------
- 35 .area _DABS (ABS)
- 36 ;--------------------------------------------------------
- 37 ; global & static initialisations
- 38 ;--------------------------------------------------------
- 39 .area _HOME
- 40 .area _GSINIT
- 41 .area _GSFINAL
- 42 .area _GSINIT
- 43 ;kernel/process.c:7: static pid_t last_pid = 0;
- 0000 FD 21rE7r18 [14] 44 ld iy,#_newpid_last_pid_1_11
- 0004 FD 36 00 00 [19] 45 ld 0 (iy),#0x00
- 46 ;--------------------------------------------------------
- 47 ; Home
- 48 ;--------------------------------------------------------
- 49 .area _HOME
- 50 .area _HOME
- 51 ;--------------------------------------------------------
- 52 ; code
- 53 ;--------------------------------------------------------
- 54 .area _CODE
- 55 ;kernel/process.c:5: pid_t newpid(void)
- 56 ; ---------------------------------
- 57 ; Function newpid
- 58 ; ---------------------------------
- 0000 59 _newpid::
- 60 ;kernel/process.c:8: return ++last_pid;
- 0000 21rE7r18 [10] 61 ld hl, #_newpid_last_pid_1_11+0
- 0003 34 [11] 62 inc (hl)
- 0004 FD 21rE7r18 [14] 63 ld iy,#_newpid_last_pid_1_11
- 0008 FD 6E 00 [19] 64 ld l,0 (iy)
- 000B C9 [10] 65 ret
- 66 ;kernel/process.c:11: int fork(void)
- 67 ; ---------------------------------
- 68 ; Function fork
- 69 ; ---------------------------------
- 000C 70 _fork::
- 71 ;kernel/process.c:14: }
- 000C C9 [10] 72 ret
- 73 ;kernel/process.c:16: int exec(char *path, char *args)
- 74 ; ---------------------------------
- 75 ; Function exec
- 76 ; ---------------------------------
- 000D 77 _exec::
- 78 ;kernel/process.c:19: }
- 000D C9 [10] 79 ret
- 80 ;kernel/process.c:21: int spawn(char *path, char *args)
- 81 ; ---------------------------------
- 82 ; Function spawn
- 83 ; ---------------------------------
- 000E 84 _spawn::
- 85 ;kernel/process.c:24: }
- 000E C9 [10] 86 ret
- 87 .area _CODE
- 88 .area _INITIALIZER
- 89 .area _CABS (ABS)
diff --git a/sw/z80/build/kernel/process.rel b/sw/z80/build/kernel/process.rel
deleted file mode 100644
index f4908e9..0000000
--- a/sw/z80/build/kernel/process.rel
+++ /dev/null
@@ -1,45 +0,0 @@
-XL2
-H 9 areas 6 global symbols
-M process
-O -mz80
-S .__.ABS. Def0000
-A _CODE size F flags 0 addr 0
-S _exec Def000D
-S _spawn Def000E
-S _fork Def000C
-S _newpid Def0000
-A _DATA size 18E8 flags 0 addr 0
-S _proc_table Def0000
-A _INITIALIZED size 0 flags 0 addr 0
-A _DABS size 0 flags 8 addr 0
-A _HOME size 0 flags 0 addr 0
-A _GSINIT size 8 flags 0 addr 0
-A _GSFINAL size 0 flags 0 addr 0
-A _INITIALIZER size 0 flags 0 addr 0
-A _CABS size 0 flags 8 addr 0
-T 00 00
-R 00 00 01 00
-T 00 00
-R 00 00 01 00
-T E7 18
-R 00 00 01 00
-T E7 18
-R 00 00 01 00
-T 00 00 FD 21 E7 18 FD 36 00 00
-R 00 00 05 00 00 04 01 00
-T 00 00
-R 00 00 00 00
-T 00 00 21 E7 18 34 FD 21 E7 18 FD 6E 00 C9
-R 00 00 00 00 00 03 01 00 00 08 01 00
-T 0C 00
-R 00 00 00 00
-T 0C 00 C9
-R 00 00 00 00
-T 0D 00
-R 00 00 00 00
-T 0D 00 C9
-R 00 00 00 00
-T 0E 00
-R 00 00 00 00
-T 0E 00 C9
-R 00 00 00 00
diff --git a/sw/z80/build/kernel/process.sym b/sw/z80/build/kernel/process.sym
deleted file mode 100644
index f6884cd..0000000
--- a/sw/z80/build/kernel/process.sym
+++ /dev/null
@@ -1,32 +0,0 @@
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 1.
-Hexadecimal [16-Bits]
-
-Symbol Table
-
- .__.$$$. = 2710 L
- .__.ABS. = 0000 G
- .__.CPU. = 0000 L
- .__.H$L. = 0000 L
- 0 _exec 000D GR
- 0 _fork 000C GR
- 0 _newpid 0000 GR
- 1 _newpid_last_pid_1_11 18E7 R
- 1 _proc_table 0000 GR
- 0 _spawn 000E GR
-
-
- ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2.
-Hexadecimal [16-Bits]
-
-Area Table
-
- 0 _CODE size F flags 0
- 1 _DATA size 18E8 flags 0
- 2 _INITIALIZED size 0 flags 0
- 3 _DABS size 0 flags 8
- 4 _HOME size 0 flags 0
- 5 _GSINIT size 8 flags 0
- 6 _GSFINAL size 0 flags 0
- 7 _INITIALIZER size 0 flags 0
- 8 _CABS size 0 flags 8
-
diff --git a/sw/z80/crt0.rel b/sw/z80/crt0.rel
deleted file mode 100644
index 880fd57..0000000
--- a/sw/z80/crt0.rel
+++ /dev/null
@@ -1,86 +0,0 @@
-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
new file mode 100644
index 0000000..e23ed8e
--- /dev/null
+++ b/sw/z80/kernel/drivers/ctc.c
@@ -0,0 +1 @@
+#include "drivers/ctc.h" \ No newline at end of file
diff --git a/sw/z80/kernel/drivers/pio.c b/sw/z80/kernel/drivers/pio.c
index 289ebe0..4321fb8 100644
--- a/sw/z80/kernel/drivers/pio.c
+++ b/sw/z80/kernel/drivers/pio.c
@@ -3,17 +3,38 @@
static uint8_t *pio_port = (uint8_t *) ADDR_DEV_PIO;
static uint8_t *pio_ctrl = (uint8_t *) (ADDR_DEV_PIO + 2);
-void _pio_data(int port, uint8_t data)
+inline void _pio_data(int port, uint8_t data)
{
*(pio_port + port) = data;
}
-void _pio_command(int port, uint8_t cmd)
+inline void _pio_control(int port, uint8_t cmd)
{
*(pio_ctrl + port) = cmd;
}
-/* void pio_set_mode(int port, int mode)
+void pio_set_mode(int port, int mode, uint8_t io)
{
+ // 0x0F is a control sequence to set mode
+ _pio_control(port, ((mode << 6) | 0x0F));
-} */
+ // this mode requires an additional argument that sets
+ // a mode for each pin
+ if (mode == PIO_MODE_BIT_IO) {
+ _pio_control(port, io);
+ }
+}
+
+void pio_set_interrupts(int port, int control)
+{
+ // 0x07 is a control sequence to set interrupts
+ _pio_control(port, (control | 0x07));
+}
+
+void pio_set_interrupts_mask(int port, int control, uint8_t mask)
+{
+ // 0x17 is a control sequence to set interrupts
+ // and to interpret the next byte as a mask
+ _pio_control(port, (control | 0x17));
+ _pio_control(port, mask);
+}
diff --git a/sw/z80/kernel/include/drivers/ctc.h b/sw/z80/kernel/include/drivers/ctc.h
new file mode 100644
index 0000000..488e02b
--- /dev/null
+++ b/sw/z80/kernel/include/drivers/ctc.h
@@ -0,0 +1,6 @@
+#ifndef __CTC_H__
+#define __CTC_H__
+
+void ctc_control()
+
+#endif /* __CTC_H__ */ \ No newline at end of file
diff --git a/sw/z80/kernel/include/drivers/pio.h b/sw/z80/kernel/include/drivers/pio.h
index 5d289ca..0df2ed0 100644
--- a/sw/z80/kernel/include/drivers/pio.h
+++ b/sw/z80/kernel/include/drivers/pio.h
@@ -7,25 +7,27 @@
#define PIO_A 0
#define PIO_B 1
-#define PIO_MODE_0 0
-#define PIO_MODE_1 1
-#define PIO_MODE_2 2
-#define PIO_MODE_3 3
+#define PIO_MODE_BYTE_IN 0
+#define PIO_MODE_BYTE_OUT 1
+#define PIO_MODE_BYTE_BI 2
+#define PIO_MODE_BIT_IO 3
#define PIO_INT_ACTIVE_HIGH (1<<5)
#define PIO_INT_AND_MODE (1<<6)
#define PIO_INT_ENABLE (1<<7)
-void _pio_data(int port, uint8_t data);
-void _pio_command(int port, uint8_t cmd);
+inline void _pio_data(int port, uint8_t data);
+inline void _pio_control(int port, uint8_t cmd);
+
+void pio_set_mode(int port, int mode, uint8_t io);
-void pio_set_mode(int port, int mode);
void pio_set_interrupts(int port, int control);
-void pio_set_interrupts_mask(int port, uint8_t mask);
-void pio_set_io(int port, uint8_t io);
+void pio_set_interrupts_mask(int port, int control, uint8_t mask);
// uint8_t pio_read_data(int port);
+uint8_t pio_read(int port);
+void pio_write(int port, uint8_t data);
inline int pio_read_pin(int port, uint8_t pin);
inline void pio_write_pin(int port, uint8_t pin);
diff --git a/sw/z80/kernel/include/fs/fs.h b/sw/z80/kernel/include/fs/fs.h
index b92303d..ad20adb 100644
--- a/sw/z80/kernel/include/fs/fs.h
+++ b/sw/z80/kernel/include/fs/fs.h
@@ -44,7 +44,7 @@ struct fs_inode
#define FS_INODE_ROOT(inode) {inode.dev = 0xff; inode.inode = 0x0}
#define FS_INODE_NULL(inode) {inode.dev = 0x80; inode.inode = 0x0}
-#define FS_USE_ROM(inode) inode.dev == 0x7f
+#define FS_USE_ROM(inode) {inode.dev == 0x7f}
/* get block seek in current device */
devsize_t fs_block(blk_t block);
diff --git a/sw/z80/kernel/include/memory.h b/sw/z80/kernel/include/memory.h
index 45fc325..67c4b88 100644
--- a/sw/z80/kernel/include/memory.h
+++ b/sw/z80/kernel/include/memory.h
@@ -6,6 +6,7 @@
/* maximum number of pages on the system */
#define PAGES_MAX_COUNT 32
+#define PAGE_SIZE 1000
/* in our system there are only 16 pages since only 64KB can be addressed
* to optimize the memory management in ROM and RAM only pages from this set
@@ -31,17 +32,18 @@
#define ADDR_PAGE_14 0xE000
#define ADDR_PAGE_15 0xF000
+#define ADDR_PAGE_FIRST ADDR_PAGE_8
+#define ADDR_PAGE_LAST ADDR_PAGE_15
+
struct page
{
- uint used :1;
- pid_t pid; // process owner of the page
+ pid_t pid; // process owner of the page (0 if free)
uint16_t addr; // physical address
};
-extern struct page pages_table[PAGES_MAX_COUNT];
-
int mmu_write_table(void);
+int page_new(void);
int page_map(int page, int pid, uint16_t addr);
int page_unmap(int page);
diff --git a/sw/z80/kernel/include/process.h b/sw/z80/kernel/include/process.h
index d7aa7fd..3b0c843 100644
--- a/sw/z80/kernel/include/process.h
+++ b/sw/z80/kernel/include/process.h
@@ -9,6 +9,12 @@
*/
#define PROC_COUNT 2
+/* the pid is defined with a single byte (pid_t is uint8_t), because of that
+ * there cannot be more than 255 processes open at the same time. this is a
+ * limitation but for our purposes is more than enough
+ */
+#define PID_COUNT_MAX 255
+
struct executable
{
void *text;
@@ -19,19 +25,12 @@ struct executable
struct process
{
- uint blocked :1; // process is waiting for hardware or locked
- uint running :1; // pid is used
- struct page pages[4]; // pages used by the process
- // TODO: implement quick callback?
+ uint blocked :1; // process is waiting for hardware or locked
+ uint running :1; // pid is used
+ uint pages; // number of pages used by the process
+ struct page page[4]; // pages used by the process
};
-/* the pid is defined with a single byte (pid_t is uint8_t), because of that
- * there cannot be more than 255 processes open at the same time. this is a
- * limitation but for our purposes is more than enough
- */
-extern struct process proc_table[255];
-extern struct process *current_proc;
-
pid_t newpid(void);
int fork(void);
diff --git a/sw/z80/kernel/include/syscall.h b/sw/z80/kernel/include/syscall.h
deleted file mode 100644
index 29941c9..0000000
--- a/sw/z80/kernel/include/syscall.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __SYS_CALL_H__
-#define __SYS_CALL_H__
-
-/*
-* Enable / disable virtual address traslation
-*/
-
-extern void v_addr(uint8_t flag);
-
-/*
-* Programs execution
-*/
-
-extern void prog_exec_0(void);
-extern void prog_exec_1(void);
-
-extern void prog_stop_0(void);
-extern void prog_stop_1(void);
-
-#endif \ No newline at end of file
diff --git a/sw/z80/kernel/include/types.h b/sw/z80/kernel/include/types.h
index c01afb2..c6e620b 100644
--- a/sw/z80/kernel/include/types.h
+++ b/sw/z80/kernel/include/types.h
@@ -3,39 +3,35 @@
/* only types from primitive types are defined in this file */
-#define register_t volatile unsigned char
+typedef volatile unsigned char register_t;
-#define uint unsigned int
+typedef unsigned int uint;
-#define int8_t char
-#define uint8_t unsigned char
-#define int16_t int
-#define uint16_t unsigned short int
+typedef char int8_t;
+typedef unsigned char uint8_t;
+typedef int int16_t;
+typedef unsigned int uint16_t;
+typedef long int int32_t;
+typedef unsigned long int uint32_t;
-#define uint32_t unsigned long int
+typedef uint16_t size_t;
+typedef int16_t ssize_t;
-#define size_t uint16_t
-#define ssize_t int16_t
-#define pid_t uint8_t
+typedef uint8_t pid_t;
+typedef uint16_t ino_t;
-#define ino_t uint16_t
+typedef uint8_t dev_t;
+typedef uint32_t devsize_t;
+typedef uint8_t fd_t;
+typedef uint16_t blk_t;
+typedef uint8_t user_t;
-#define dev_t uint8_t
-#define devsize_t uint32_t
-
-#define fd_t uint8_t
-
-#define blk_t uint16_t
-
-#define user_t int8_t
-
-typedef struct
-{
+typedef struct {
uint8_t member[3];
} uint24_t;
-#define fsize_t uint32_t
+typedef uint32_t fsize_t;
typedef struct
{
diff --git a/sw/z80/kernel/memory.c b/sw/z80/kernel/memory.c
index bcda3c3..cda62ca 100644
--- a/sw/z80/kernel/memory.c
+++ b/sw/z80/kernel/memory.c
@@ -1,13 +1,13 @@
#include "memory.h"
-struct page pages_table[PAGES_MAX_COUNT];
+static struct page pages_table[PAGES_MAX_COUNT];
int mmu_write_table(void)
{
int i;
for (i = 0; i < PAGES_MAX_COUNT; i++) {
- if (pages_table[i].used) {
+ if (pages_table[i].pid != 0) {
// write to mmu table
}
}
@@ -15,18 +15,37 @@ int mmu_write_table(void)
return 0;
}
+int page_new(void)
+{
+ int i, addr, used;
+ 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) {
+ used = 1;
+ break;
+ }
+ }
+
+ if (!used)
+ return i;
+ }
+
+ return -1;
+}
+
int page_map(int page, int pid, uint16_t addr)
{
if (page >= PAGES_MAX_COUNT)
return -1;
- if (pages_table[page].used)
+ if (pages_table[page].pid != 0)
return -2;
pages_table[page].addr = addr;
pages_table[page].pid = pid;
- pages_table[page].used = 1;
return 0;
}
@@ -35,10 +54,11 @@ int page_unmap(int page)
if (page >= PAGES_MAX_COUNT)
return -1;
- if (pages_table[page].used == 0)
+ if (pages_table[page].pid == 0)
return -2;
- pages_table[page].used = 0;
+ pages_table[page].pid = 0;
+ pages_table[page].addr = 0;
return 0;
}
diff --git a/sw/z80/kernel/process.c b/sw/z80/kernel/process.c
index 49b86b8..049c88c 100644
--- a/sw/z80/kernel/process.c
+++ b/sw/z80/kernel/process.c
@@ -1,16 +1,48 @@
#include "process.h"
-struct process proc_table[255];
+static struct process proc_table[PID_COUNT_MAX];
+static struct process *current_proc;
pid_t newpid(void)
{
+ int i;
static pid_t last_pid = 0;
- return ++last_pid;
+
+ for (i = 0; i < PID_COUNT_MAX; i++, last_pid++) {
+ if (last_pid == PID_COUNT_MAX) {
+ last_pid = 0;
+ continue;
+ }
+
+ if (!proc_table[last_pid].running)
+ break;
+ }
+
+ if (i >= PID_COUNT_MAX)
+ return 0;
+
+ return last_pid;
}
int fork(void)
{
-
+ int i, p;
+ pid_t child_pid = newpid();
+
+ if (child_pid == 0)
+ return -1;
+
+
+ for (i = 0; i < current_proc.pages; i++) {
+ p = page_new();
+
+ if (p == -1) {
+
+ return -2;
+ }
+
+ proc_table[child_pid].page[i] = p;
+ }
}
int exec(char *path, char *args)
diff --git a/sw/z80/libc/string.c b/sw/z80/libc/string.c
index 9dd56cc..57b3a7f 100644
--- a/sw/z80/libc/string.c
+++ b/sw/z80/libc/string.c
@@ -1,11 +1,11 @@
#include "string.h"
-void * memset(void *dest, const int8_t src, size_t n) {
+void *memset(void *dest, const int8_t src, size_t n) {
- void *dp = dest;
+ char *dp = (char *) dest;
while (n--)
- *dp++ = src;
+ *(dp++) = src;
return dest;
}
@@ -22,16 +22,14 @@ void *memcpy(void *dest, void *src, size_t n)
return dest;
}
-int8_t memcmp(const void *s1, const void *s2, size_t n) {
-
- uint8_t u1, u2;
-
- for ( ; n--; s1++, s2++) {
+int8_t memcmp(void *s1, void *s2, size_t n)
+{
+ char *u1 = (char *) s1;
+ char *u2 = (char *) s2;
- u1 = *s1;
- u2 = *s2;
+ for ( ; n--; u1++, u2++) {
- if (u1 != u2)
+ if (*u1 != *u2)
return u1 - u2;
}
diff --git a/sw/z80/makefile b/sw/z80/makefile
index 5047824..5ab7e93 100644
--- a/sw/z80/makefile
+++ b/sw/z80/makefile
@@ -20,6 +20,7 @@ CFLAGS := -mz80 \
-I kernel/include \
-I kernel/include/drivers \
-I libc/include \
+ --opt-code-size \
-DDEBUG
LDFLAGS := -mz80 --no-std-crt0 crt0.rel \
@@ -43,7 +44,7 @@ crt0.rel: crt0.s
sdasz80 -o $<
dirs:
- mkdir -p build build/kernel build/libc
+ mkdir -p build build/kernel build/libc build/kernel/drivers
dis: $(BINARY)
@# z80dasm -a -l -g 0h $< -o build/$(OSNAME).s