summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-08-26 14:50:06 +0200
committerNao Pross <naopross@thearcway.org>2017-08-26 14:50:06 +0200
commit2f3b8ff5cc1948c46859d3ccd73f7e589b6f5d53 (patch)
tree6888708397c459827bed79d0333f7d5c967c0789
parentedit documentation abstract (diff)
parenttime to inode (diff)
downloadz80uPC-2f3b8ff5cc1948c46859d3ccd73f7e589b6f5d53.tar.gz
z80uPC-2f3b8ff5cc1948c46859d3ccd73f7e589b6f5d53.zip
merge remote-tracking branch 'origin/atlas' into naopross
-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/filesystem.c1
-rw-r--r--sw/z80/kernel/fs.c5
-rw-r--r--sw/z80/kernel/include/filesystem.h77
-rw-r--r--sw/z80/kernel/include/fs/dirent.h13
-rw-r--r--sw/z80/kernel/include/fs/fs.h67
-rw-r--r--sw/z80/kernel/include/fs/mount.h15
-rw-r--r--sw/z80/kernel/include/fs/users.h6
-rw-r--r--sw/z80/kernel/include/sio.h49
-rw-r--r--sw/z80/kernel/include/types.h6
26 files changed, 1482 insertions, 78 deletions
diff --git a/sw/z80/build/kernel/filesystem.asm b/sw/z80/build/kernel/filesystem.asm
new file mode 100644
index 0000000..f868b5a
--- /dev/null
+++ b/sw/z80/build/kernel/filesystem.asm
@@ -0,0 +1,117 @@
+;--------------------------------------------------------
+; 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
new file mode 100644
index 0000000..80ecda7
--- /dev/null
+++ b/sw/z80/build/kernel/filesystem.lst
@@ -0,0 +1,117 @@
+ 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
new file mode 100644
index 0000000..3ccb28f
--- /dev/null
+++ b/sw/z80/build/kernel/filesystem.rel
@@ -0,0 +1,54 @@
+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
new file mode 100644
index 0000000..6e95911
--- /dev/null
+++ b/sw/z80/build/kernel/filesystem.sym
@@ -0,0 +1,33 @@
+ 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
new file mode 100644
index 0000000..e0839fc
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.asm
@@ -0,0 +1,66 @@
+;--------------------------------------------------------
+; 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
new file mode 100644
index 0000000..e839f83
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.lst
@@ -0,0 +1,66 @@
+ 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
new file mode 100644
index 0000000..103d026
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.rel
@@ -0,0 +1,22 @@
+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
new file mode 100644
index 0000000..b5145d5
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.sym
@@ -0,0 +1,27 @@
+ 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
new file mode 100644
index 0000000..ffa5214
--- /dev/null
+++ b/sw/z80/build/kernel/memory.asm
@@ -0,0 +1,186 @@
+;--------------------------------------------------------
+; 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
new file mode 100644
index 0000000..5f229f5
--- /dev/null
+++ b/sw/z80/build/kernel/memory.lst
@@ -0,0 +1,186 @@
+ 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
new file mode 100644
index 0000000..a0cbbca
--- /dev/null
+++ b/sw/z80/build/kernel/memory.rel
@@ -0,0 +1,76 @@
+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
new file mode 100644
index 0000000..26090e8
--- /dev/null
+++ b/sw/z80/build/kernel/memory.sym
@@ -0,0 +1,30 @@
+ 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
new file mode 100644
index 0000000..f50bb3d
--- /dev/null
+++ b/sw/z80/build/kernel/process.asm
@@ -0,0 +1,89 @@
+;--------------------------------------------------------
+; 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
new file mode 100644
index 0000000..eb73943
--- /dev/null
+++ b/sw/z80/build/kernel/process.lst
@@ -0,0 +1,89 @@
+ 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
new file mode 100644
index 0000000..f4908e9
--- /dev/null
+++ b/sw/z80/build/kernel/process.rel
@@ -0,0 +1,45 @@
+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
new file mode 100644
index 0000000..f6884cd
--- /dev/null
+++ b/sw/z80/build/kernel/process.sym
@@ -0,0 +1,32 @@
+ 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
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/filesystem.c b/sw/z80/kernel/filesystem.c
deleted file mode 100644
index 101af75..0000000
--- a/sw/z80/kernel/filesystem.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "filesystem.h" \ No newline at end of file
diff --git a/sw/z80/kernel/fs.c b/sw/z80/kernel/fs.c
new file mode 100644
index 0000000..3ce7f42
--- /dev/null
+++ b/sw/z80/kernel/fs.c
@@ -0,0 +1,5 @@
+#include "fs.h"
+#include "users.h"
+#include "mount.h"
+
+struct fs_mount_point * mount_points[FS_MOUNT_LIMIT];
diff --git a/sw/z80/kernel/include/filesystem.h b/sw/z80/kernel/include/filesystem.h
deleted file mode 100644
index 6505d5e..0000000
--- a/sw/z80/kernel/include/filesystem.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __FILESYSTEM_H__
-#define __FILESYSTEM_H__
-
-#include "types.h"
-
-#define FS_OFFSET 0x1000
-
-#define FS_BLOCK_SIZE 512
-#define FS_BLOCKS_N 12
-/* #define FS_IBLOCKS_N 1 */
-
-#define INODE_TYPE_FILE 0
-#define INODE_TYPE_DIR 1
-#define INODE_TYPE_LINK 2
-
-typedef struct time_s
-{
- uint16_t time;
- uint16_t date;
-} time_t;
-
-
-/* on-disk structures */
-struct fs_superblock
-{
- uint8_t magic;
- uint16_t blk_size; /* default is 512 bytes */
- uint16_t imap_size; /* size of the inode bitmap in blocks */
- uint16_t dmap_size; /* size of the data blocks map in blocks */
-};
-
-
-struct fs_blk
-{
- uint size;
-};
-
-typedef struct fs_inode
-{
- uint i_used :1; // inode is free
- uint i_mode :3; // inode mode (rwx)
-
- uint8_t i_uid; // user (owner) id
- uint16_t i_number; // identifier
-
- uint16_t i_blocks; // number of blocks
-
- struct fs_blk i_block[FS_BLOCKS_N]; // direct blocks
-/* struct fs_blk i_iblock[FS_IBLOCKS_N]; // indirect blocks */
-
- inode_t *parent;
-} inode_t;
-
-/* inode table structures */
-struct fs_inode_entry
-{
- uint16_t i_number;
- uint8_t str_len;
- char name[24];
-};
-
-/* filesystem struct for the operating system */
-struct filesystem
-{
- size_t size;
- size_t fsize;
- inode_t *mntpt;
-};
-
-void fs_parse_superblock(struct filesystem *fs);
-
-void fs_write_imap();
-void fs_write_dmap();
-
-/* void fs_ */
-
-#endif // __FILESYSTEM_H__
diff --git a/sw/z80/kernel/include/fs/dirent.h b/sw/z80/kernel/include/fs/dirent.h
new file mode 100644
index 0000000..ea5699b
--- /dev/null
+++ b/sw/z80/kernel/include/fs/dirent.h
@@ -0,0 +1,13 @@
+#ifndef DIRENT_H
+#define DIRENT_H
+
+#include "types.h"
+
+struct dirent
+{
+ ino_t i_number; // inode referred
+ uint8_t name_size; // size of the name
+ char name[]; // name of the referred inode
+}
+
+#endif
diff --git a/sw/z80/kernel/include/fs/fs.h b/sw/z80/kernel/include/fs/fs.h
new file mode 100644
index 0000000..2a0e9d4
--- /dev/null
+++ b/sw/z80/kernel/include/fs/fs.h
@@ -0,0 +1,67 @@
+#ifndef INODE_H
+#define INODE_H
+
+#include "types.h"
+
+#define FS_OFFSET 0x1000
+
+#define FS_BLOCKS_SIZE 512
+#define FS_BLOCKS_N 8
+#define FS_BLOCKS_IND 6
+
+#define INODE_TYPE_FILE 0x0
+#define INODE_TYPE_DIR 0x1
+#define INODE_TYPE_HLINK 0x2
+#define INODE_TYPE_SLINK 0x3
+
+typedef struct time_s
+{
+ struct
+ {
+ uint minutes :6;
+ uint hour :5;
+
+ } time;
+
+ struct
+ {
+ uint day :5;
+ uint month :4;
+ uint year :12;
+
+ } date;
+
+} time_t;
+
+struct fs_superblock
+{
+ uint8_t magic; // identifier
+
+ uint16_t blk_size; // size of a single block
+ uint16_t imap_size; // quantity of inodes
+ uint16_t dmap_size; // quantity of blocks
+}
+
+struct fs_inode
+{
+
+ /* inode meta data */
+ uint mode :3; // chmod
+ uint uid :3; // chown
+ uint type :2; // file, dir, hard-link, sym-link
+
+ time_t ctime; // creation time
+
+ /* data storage informations */
+ uint24_t size;
+ uint16_t blocks[FS_BLOCKS_N];
+
+}
+
+struct fs_inumber
+{
+ uint dev : 4; // device id, global in the fs
+ ino_t rel; // inode id relative to the volume
+}
+
+#endif
diff --git a/sw/z80/kernel/include/fs/mount.h b/sw/z80/kernel/include/fs/mount.h
new file mode 100644
index 0000000..a0edd5d
--- /dev/null
+++ b/sw/z80/kernel/include/fs/mount.h
@@ -0,0 +1,15 @@
+#ifndef MOUNT_H
+#define MOUNT_H
+
+#include "fs.h"
+
+#define FS_MOUNT_LIMIT 16
+
+struct fs_mount_point
+{
+ struct fs_inumber inode; // dir mounted
+ uint serial_port :4;
+ struct fs_superblock superblock; // block informations
+}
+
+#endif
diff --git a/sw/z80/kernel/include/fs/users.h b/sw/z80/kernel/include/fs/users.h
new file mode 100644
index 0000000..7e4016b
--- /dev/null
+++ b/sw/z80/kernel/include/fs/users.h
@@ -0,0 +1,6 @@
+#ifndef USERS_H
+#define USERS_H
+
+
+
+#endif
diff --git a/sw/z80/kernel/include/sio.h b/sw/z80/kernel/include/sio.h
new file mode 100644
index 0000000..9dc47f6
--- /dev/null
+++ b/sw/z80/kernel/include/sio.h
@@ -0,0 +1,49 @@
+#ifndef SIO_H
+#define SIO_H
+
+#include "types.h"
+
+#define SIO_ROM 0x0
+
+#define SIO_PORT_1 0x1
+#define SIO_PORT_2 0x2
+#define SIO_PORT_3 0x3
+#define SIO_PORT_4 0x4
+#define SIO_PORT_5 0x5
+#define SIO_PORT_6 0x6
+#define SIO_PORT_7 0x7
+
+/* initialize serial interface */
+void sio_init();
+
+/* return the device address in the address space */
+void * sio_dev_addr(uint8_t dev);
+/* return the driver id to be used on dev */
+uint8_t sio_dev_driver(uint8_t dev);
+
+/* set current device in use */
+void sio_set_dev(uint8_t dev);
+/* get current device in use */
+uint8_t sio_cdev();
+
+/* get pointer in given device */
+uint16_t sio_tellg(uint8_t dev);
+/* get pointer in current device */
+uint16_t sio_ctellg();
+
+/* set pointer in given device */
+int sio_seekg(uint8_t dev, uint16_t value);
+/* set pointer in current device */
+int sio_seekg(uint16_t value);
+
+/* syscall: read one byte from the current device */
+uint8_t sio_recv();
+/* syscall: write one byte into the current device */
+void sio_send(uint8_t value);
+
+/* read n bytes from the current device */
+char * sio_read(uint8_t *buffer, size_t n);
+/* write n bytes into the current device */
+int sio_write(const uint8_t *buffer, size_t n);
+
+#endif
diff --git a/sw/z80/kernel/include/types.h b/sw/z80/kernel/include/types.h
index 7c1424a..b822144 100644
--- a/sw/z80/kernel/include/types.h
+++ b/sw/z80/kernel/include/types.h
@@ -15,4 +15,10 @@
#define size_t uint16_t
#define pid_t uint8_t
+#define ino_t uint16_t
+
+typedef struct {
+ uint data : 24;
+} uint24_t;
+
#endif