summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/report/res/kernel_mem_base.pdfbin0 -> 16923 bytes
-rw-r--r--doc/report/res/kernel_mem_base.svg613
-rw-r--r--doc/report/res/mem_kern_alloc.svg132
-rw-r--r--sw/z80/build/helvetiOS.lk11
-rw-r--r--sw/z80/build/helvetiOS.map182
-rw-r--r--sw/z80/build/helvetiOS.noi50
-rw-r--r--sw/z80/build/kernel/kernel.asm65
-rw-r--r--sw/z80/build/kernel/kernel.lst65
-rw-r--r--sw/z80/build/kernel/kernel.rel23
-rw-r--r--sw/z80/build/kernel/kernel.sym27
-rw-r--r--sw/z80/crt0.rel86
-rw-r--r--sw/z80/kernel/boot_loader.c43
-rw-r--r--sw/z80/kernel/include/boot.h35
-rw-r--r--sw/z80/kernel/include/progman.h86
-rw-r--r--sw/z80/kernel/programs.c110
15 files changed, 1528 insertions, 0 deletions
diff --git a/doc/report/res/kernel_mem_base.pdf b/doc/report/res/kernel_mem_base.pdf
new file mode 100644
index 0000000..875d16e
--- /dev/null
+++ b/doc/report/res/kernel_mem_base.pdf
Binary files differ
diff --git a/doc/report/res/kernel_mem_base.svg b/doc/report/res/kernel_mem_base.svg
new file mode 100644
index 0000000..02ac0b8
--- /dev/null
+++ b/doc/report/res/kernel_mem_base.svg
@@ -0,0 +1,613 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 744.09448819 1052.3622047"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="disegno.svg">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="marker4631"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4633"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="marker4609"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4611"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4308"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4305"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4202"
+ osb:paint="gradient">
+ <stop
+ style="stop-color:#ff6600;stop-opacity:1;"
+ offset="0"
+ id="stop4204" />
+ <stop
+ style="stop-color:#ff6600;stop-opacity:0;"
+ offset="1"
+ id="stop4206" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6665"
+ osb:paint="solid">
+ <stop
+ style="stop-color:#ff6600;stop-opacity:1;"
+ offset="0"
+ id="stop6667" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient6457">
+ <stop
+ style="stop-color:#ff7f2a;stop-opacity:1;"
+ offset="0"
+ id="stop6459" />
+ <stop
+ style="stop-color:#ff7f2a;stop-opacity:0;"
+ offset="1"
+ id="stop6461" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient6445">
+ <stop
+ style="stop-color:#ff7f2a;stop-opacity:1;"
+ offset="0"
+ id="stop6447" />
+ <stop
+ style="stop-color:#ff7f2a;stop-opacity:0;"
+ offset="1"
+ id="stop6449" />
+ </linearGradient>
+ <pattern
+ inkscape:isstock="true"
+ inkscape:stockid="Stripes 1:1"
+ id="Strips1_1"
+ patternTransform="translate(0,0) scale(10,10)"
+ height="1"
+ width="2"
+ patternUnits="userSpaceOnUse"
+ inkscape:collect="always">
+ <rect
+ id="rect5652"
+ height="2"
+ width="1"
+ y="-0.5"
+ x="0"
+ style="fill:black;stroke:none" />
+ </pattern>
+ <linearGradient
+ id="linearGradient4142"
+ osb:paint="solid">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop4144" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4142"
+ id="linearGradient4146"
+ x1="337.14285"
+ y1="609.50507"
+ x2="594.28571"
+ y2="609.50507"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-168.57143,57.142857)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6445"
+ id="radialGradient6451"
+ cx="304.62296"
+ cy="670.52742"
+ fx="304.62296"
+ fy="670.52742"
+ r="118.57143"
+ gradientTransform="matrix(1,0,0,1.0722891,0,-48.471841)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6457"
+ id="linearGradient6463"
+ x1="185.76582"
+ y1="670.52742"
+ x2="422.90868"
+ y2="670.52742"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4202"
+ id="linearGradient4212"
+ x1="180.94939"
+ y1="668.38457"
+ x2="428.29653"
+ y2="668.38457"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="653.19439"
+ inkscape:cy="331.26335"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1301"
+ inkscape:window-height="744"
+ inkscape:window-x="65"
+ inkscape:window-y="24"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="display:inline">
+ <rect
+ style="fill:#ffffff;stroke:url(#linearGradient4146);stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4140"
+ width="242.85713"
+ height="728.57147"
+ x="182.85713"
+ y="206.6479" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="110.85714"
+ y="74.933632"
+ id="text4150"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4152"
+ x="110.85714"
+ y="74.933632">Kernel program structure</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 182.85714,386.64792 c 81.42857,0 162.85715,0 244.28572,0"
+ id="path4182"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 427.14286,329.50506 c -82.38096,0 -164.76191,0 -247.14286,0"
+ id="path4184"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="261.42859"
+ y="306.64792"
+ id="text4186"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4188"
+ x="261.42859"
+ y="306.64792">Text</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="278.57144"
+ y="452.36221"
+ id="text4194"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4196"
+ x="278.57144"
+ y="452.36221" /></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="207.14285"
+ y="425.21933"
+ id="text4198"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4200"
+ x="207.14285"
+ y="425.21933"
+ style="font-size:27.5px">Global defined</tspan><tspan
+ sodipodi:role="line"
+ x="207.14285"
+ y="459.59433"
+ id="tspan4202"
+ style="font-size:27.5px"> data</tspan></text>
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4204"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"><flowRegion
+ id="flowRegion4206"><rect
+ id="rect4208"
+ width="24.285715"
+ height="54.285713"
+ x="262.85715"
+ y="362.36221" /></flowRegion><flowPara
+ id="flowPara4210" /></flowRoot> <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="246.57143"
+ y="875.21936"
+ id="text4218"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4220"
+ x="246.57143"
+ y="875.21936">Stack</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="261.42859"
+ y="529.21936"
+ id="text4222"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4224"
+ x="261.42859"
+ y="529.21936">BSS</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:30px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="45.714287"
+ y="398.07648"
+ id="text4226"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4228"
+ x="45.714287"
+ y="398.07648">0x8000</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="42.857143"
+ y="217.79079"
+ id="text4230"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4232"
+ x="42.857143"
+ y="217.79079"
+ style="font-size:30px">0x0000</tspan></text>
+ <path
+ style="fill:url(#Strips1_1);fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 185.76582,357.67028 0,-27.14285 118.57143,0 118.57143,0 0,27.14285 0,27.14286 -118.57143,0 -118.57143,0 0,-27.14286 z"
+ id="path4163"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:url(#radialGradient6451);fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 186.05153,670.52743 0,-127.14286 118.57143,0 118.57143,0 0,127.14286 0,127.14285 -118.57143,0 -118.57143,0 0,-127.14285 z"
+ id="path6443"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:#ff7f2a;fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 185.76582,670.52743 0,-127.14286 118.57143,0 118.57143,0 0,127.14286 0,127.14285 -118.57143,0 -118.57143,0 0,-127.14285 z"
+ id="path6453"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:url(#linearGradient6463);fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 185.76582,670.52743 0,-127.14286 118.57143,0 118.57143,0 0,127.14286 0,127.14285 -118.57143,0 -118.57143,0 0,-127.14285 z"
+ id="path6455"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:#ff7f2a;fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 186.05153,670.52743 0,-127.14286 118.57143,0 118.57143,0 0,127.14286 0,127.14285 -118.57143,0 -118.57143,0 0,-127.14285 z"
+ id="path6465"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:#ff7f2a;fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 186.05153,670.52743 0,-127.14286 118.57143,0 118.57143,0 0,127.14286 0,127.14285 -118.57143,0 -118.57143,0 0,-127.14285 z"
+ id="path6467"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:#ff6600;fill-opacity:1;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 186.05153,670.52743 0,-127.14286 118.57143,0 118.57143,0 0,127.14286 0,127.14285 -118.57143,0 -118.57143,0 0,-127.14285 z"
+ id="path6469"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:0;fill:#ff6600;fill-opacity:1;stroke:#000000;stroke-width:7.14285707;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 186.05078,543.38477 0,127.14257 0,127.14258 118.57227,0 118.57226,0 0,-127.14258 0,-127.14257 -118.57226,0 -118.57227,0 z m 76.80664,20.49218 c 3.57143,0 7.14258,3.53441 7.14258,10.60547 l 0,8.0586 0,16.96484 0,25.69726 0,18.99415 c 1.30527,3.67724 2.79929,7.27329 4.77344,10.68554 1.9029,2.01143 3.39387,4.7456 3.08398,7.67774 -0.18499,1.75031 -1.29422,3.27339 -1.9414,4.91015 -2.57431,6.51052 -4.31433,1.0603 -5.91602,-4.46093 l 0,14.62109 0,9.04102 c 0.23728,-0.008 0.46902,-0.0234 0.71484,-0.0234 l 29.19532,0 11.51757,0 0,-18.49414 0,-17.48828 0,-21.875 c 0,-7.07107 3.57311,-10.60743 7.14454,-10.60743 3.57143,0 7.14257,3.53636 7.14257,10.60743 l 0,21.875 0,17.48828 0,18.49414 0.0547,0 24.94531,0 c 0.95331,0 1.9159,0.12229 2.86133,0 0.62259,-0.0805 0.94197,-0.834 1.45117,-1.20117 1.26721,-0.91376 3.63871,-1.86043 3.9043,-3.60157 2.44333,-5.66619 1.54874,-8.13237 1.08008,-13.98242 -0.27501,-5.52567 -0.16958,-11.06261 -0.006,-16.58984 0.20885,-7.06799 3.8861,-10.49525 7.45703,-10.38867 3.57093,0.10657 7.03548,3.74659 6.82227,10.81445 -0.15105,5.00712 -0.24834,10.0225 -0.0332,15.0293 0.29106,3.67763 0.91246,7.43195 0.51172,11.12695 -0.45592,4.20377 -2.09393,8.02562 -3.875,11.80859 -0.97418,1.29958 -1.81952,2.70565 -2.92187,3.89844 -0.80293,0.8688 -1.79781,1.54283 -2.75196,2.24219 -4.28196,3.13855 -9.04115,5.56666 -14.49804,5.1289 l -24.94532,0 -0.0566,0 0,11.74024 0,9.61133 c 0,14.14214 -14.28711,14.14214 -14.28711,0 l 0,-9.61133 0,-11.74024 -11.51562,0 -29.19727,0 c -0.24582,0 -0.47756,-0.0149 -0.71484,-0.0234 l 0,0.73828 c 0,14.14213 -14.28516,14.14213 -14.28516,0 l 0,-24.01758 0,-26.77539 0,-4.24024 c -0.86103,-2.53918 -1.66553,-5.10902 -2.45117,-7.71093 -2.86412,-8.80038 -6.10189,-17.4634 -9.0332,-26.23828 -0.36006,-1.46107 -0.76188,-2.91206 -1.08008,-4.38282 -0.0461,-0.21313 -1.19036,-6.64935 -1.30664,-7.08984 -1.43039,-5.41854 -4.47672,-9.99407 -8.04492,-14.25781 -6.23989,-7.45621 -3.01218,-14.10178 2.57031,-14.00782 2.53749,0.0427 5.56244,1.4768 8.4043,4.86133 4.65292,5.54144 8.41124,11.64761 10.52539,18.59961 0.14977,0.49251 0.28667,0.98908 0.41601,1.48828 l 0,-15.33593 0,-8.0586 c 0,-7.07106 3.57115,-10.60547 7.14258,-10.60547 z"
+ id="path3382"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="opacity:0;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3425"
+ width="235.71429"
+ height="82.857147"
+ x="185.71428"
+ y="472.36221"
+ ry="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 184.28571,473.79078 c 80,0 160,0 240,0"
+ id="path4229"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 424.28571,543.79078 c -15.71428,0 -31.42857,0 -47.14285,0 -45.71429,0 -91.42857,0 -137.14286,0 -13.33333,0 -26.66667,0 -40,0 -5.71429,0 -11.42857,0 -17.14286,0 -0.95238,0 -1.90476,0 -2.85714,0 -0.47619,0 -1.42857,0.47619 -1.42857,0 0,-0.47619 0.95238,0 1.42857,0 1.42857,0 2.85714,0 4.28571,0"
+ id="path4231"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 184.28571,793.79078 c 79.52381,0 159.04762,0 238.57143,0"
+ id="path4233"
+ inkscape:connector-curvature="0" />
+ <path
+ style="opacity:1;fill:url(#linearGradient4212);fill-opacity:1;stroke:#000000;stroke-width:10.20428562;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 186.05153,668.38457 c 0,41.19047 0,82.38096 0,123.57143 79.04762,0 158.09525,0 237.14286,0 0,-82.38096 0,-164.76191 0,-247.14286 -79.04761,0 -158.09524,0 -237.14286,0 0,41.19048 0,82.38095 0,123.57143 z"
+ id="path4200"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="228.85715"
+ y="636.93365"
+ id="text4214"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4216"
+ x="228.85715"
+ y="636.93365"
+ style="font-size:30px"> Free</tspan><tspan
+ sodipodi:role="line"
+ x="228.85715"
+ y="671.30865"
+ id="tspan4218"
+ style="font-size:30px">memory to</tspan><tspan
+ sodipodi:role="line"
+ x="228.85715"
+ y="705.68365"
+ id="tspan4221"
+ style="font-size:30px"> allocate</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="43.14286"
+ y="940.07648"
+ id="text4233"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4235"
+ x="43.14286"
+ y="940.07648"
+ style="font-size:30px">0xffff</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 185.71429,252.3622 240,0"
+ id="path4237"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="215.42857"
+ y="237.79079"
+ id="text4239"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4241"
+ x="215.42857"
+ y="237.79079"
+ style="font-size:27.5px">System calls</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="42.857143"
+ y="257.79077"
+ id="text4243"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4245"
+ x="42.857143"
+ y="257.79077"
+ style="font-size:30px">0x00ff</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="464"
+ y="275.21936"
+ id="text4247"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4249"
+ x="464"
+ y="275.21936">Space containing</tspan><tspan
+ sodipodi:role="line"
+ x="464"
+ y="300.21936"
+ id="tspan4251">the instruction set</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="457.42856"
+ y="412.36221"
+ id="text4253"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4255"
+ x="457.42856"
+ y="412.36221">Space where global </tspan><tspan
+ sodipodi:role="line"
+ x="457.42856"
+ y="437.36221"
+ id="tspan4257">variables are placed</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="462.28571"
+ y="491.21936"
+ id="text4259"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="462.28571"
+ y="491.21936"
+ id="tspan4263"
+ style="font-size:17.5px">Space where global </tspan><tspan
+ sodipodi:role="line"
+ x="462.28571"
+ y="513.09436"
+ id="tspan4267"
+ style="font-size:17.5px">undefined variables </tspan><tspan
+ sodipodi:role="line"
+ x="462.28571"
+ y="534.96936"
+ id="tspan4269"
+ style="font-size:17.5px">are placed</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="451.14285"
+ y="823.50507"
+ id="text4271"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4273"
+ x="451.14285"
+ y="823.50507">Stack space</tspan><tspan
+ sodipodi:role="line"
+ x="451.14285"
+ y="848.50507"
+ id="tspan4281">Local variables storage</tspan><tspan
+ sodipodi:role="line"
+ x="451.14285"
+ y="873.50507"
+ id="tspan4275">The size depends on</tspan><tspan
+ sodipodi:role="line"
+ x="451.14285"
+ y="898.50507"
+ id="tspan4277">all local variables declared</tspan><tspan
+ sodipodi:role="line"
+ x="451.14285"
+ y="923.50507"
+ id="tspan4279">in the code</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="464.28571"
+ y="579.50507"
+ id="text4283"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4285"
+ x="464.28571"
+ y="579.50507"
+ style="font-size:22.5px">Kernel heap</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="460"
+ y="616.64795"
+ id="text4287"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="460"
+ y="616.64795"
+ id="tspan4677">Free memory available</tspan><tspan
+ sodipodi:role="line"
+ x="460"
+ y="641.64795"
+ id="tspan4679" /><tspan
+ sodipodi:role="line"
+ x="460"
+ y="666.64795"
+ id="tspan4669">Possible uses:</tspan><tspan
+ sodipodi:role="line"
+ x="460"
+ y="691.64795"
+ id="tspan4291"> - OS data allocation</tspan><tspan
+ sodipodi:role="line"
+ x="460"
+ y="716.64795"
+ id="tspan4293"> - Processes allocation</tspan></text>
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93114746px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 116.66261,420.53984 -1.07181,439.14017 -24.651718,0 33.226228,39.62167 30.01078,-39.62167 -21.43628,0 0,-437.48927 z"
+ id="path4659"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40.60287094px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="-544.68542"
+ y="115.05645"
+ id="text4665"
+ sodipodi:linespacing="125%"
+ transform="matrix(0.00208827,-1.1600786,0.8620055,0.00281037,0,0)"><tspan
+ sodipodi:role="line"
+ id="tspan4667"
+ x="-544.68542"
+ y="115.05645">RAM</tspan></text>
+ </g>
+</svg>
diff --git a/doc/report/res/mem_kern_alloc.svg b/doc/report/res/mem_kern_alloc.svg
new file mode 100644
index 0000000..cb7cbeb
--- /dev/null
+++ b/doc/report/res/mem_kern_alloc.svg
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 744.09448819 1052.3622047"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="mmap.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="193.36209"
+ inkscape:cy="644.02035"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1301"
+ inkscape:window-height="744"
+ inkscape:window-x="65"
+ inkscape:window-y="24"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="358.76703"
+ y="65.790771"
+ id="text3336"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3338"
+ x="365.13422"
+ y="65.790771">Kernel allocations </tspan><tspan
+ sodipodi:role="line"
+ x="358.76703"
+ y="115.79077"
+ id="tspan3342">and heap mapping</tspan></text>
+ <rect
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:4.01201391;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3365"
+ width="195.27371"
+ height="326.70227"
+ x="458.07745"
+ y="375.86819" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 460,419.50506 c 64.76191,0 129.52381,0 194.28571,0"
+ id="path4169"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 651.42857,476.64792 c -63.80952,0 -127.61905,0 -191.42857,0"
+ id="path4173"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="482"
+ y="406.64792"
+ id="text4175"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4177"
+ x="482"
+ y="406.64792">status: 1 bit</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="488"
+ y="456.07648"
+ id="text4179"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4181"
+ x="488"
+ y="456.07648">size: 15 bit</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="556.10547"
+ y="525.21936"
+ id="text4183"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan4185"
+ x="560.08496"
+ y="525.21936">Allocated </tspan><tspan
+ sodipodi:role="line"
+ x="556.10547"
+ y="556.46936"
+ id="tspan4187">memory</tspan></text>
+ <rect
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4189"
+ width="208.57141"
+ height="725.71423"
+ x="70"
+ y="209.50507" />
+ </g>
+</svg>
diff --git a/sw/z80/build/helvetiOS.lk b/sw/z80/build/helvetiOS.lk
new file mode 100644
index 0000000..c16247f
--- /dev/null
+++ b/sw/z80/build/helvetiOS.lk
@@ -0,0 +1,11 @@
+-mjwx
+-i build/helvetiOS.hex
+-b _CODE = 0x0800
+-b _DATA = 0x8000
+-k /usr/bin/../share/sdcc/lib/z80
+-k /usr/share/sdcc/lib/z80
+-l z80
+crt0.rel
+build/kernel/kernel.rel
+
+-e
diff --git a/sw/z80/build/helvetiOS.map b/sw/z80/build/helvetiOS.map
new file mode 100644
index 0000000..98210c7
--- /dev/null
+++ b/sw/z80/build/helvetiOS.map
@@ -0,0 +1,182 @@
+ ASxxxx Linker V03.00 + NoICE + sdld, page 1.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+. .ABS. 00000000 00000000 = 0. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ 00000000 .__.ABS. kernel
+ 00000000 l__BSEG
+ 00000000 l__BSS
+ 00000000 l__CABS
+ 00000000 l__DABS
+ 00000000 l__DATA
+ 00000000 l__HEADER
+ 00000000 l__HEAP
+ 00000000 l__HOME
+ 00000000 l__INITIALIZED
+ 00000000 l__INITIALIZER
+ 00000000 s__CABS
+ 00000000 s__DABS
+ 00000000 s__HEADER
+ 00000000 s__HEADER0
+ 00000000 s__HEADER1
+ 00000000 s__HEADER2
+ 00000000 s__HEADER3
+ 00000000 s__HEADER4
+ 00000000 s__HEADER5
+ 00000000 s__HEADER6
+ 00000000 s__HEADER7
+ 00000000 s__HEADER8
+ 00000001 l__GSFINAL
+ 00000002 l__HEADER1
+ 00000002 l__HEADER2
+ 00000002 l__HEADER3
+ 00000002 l__HEADER4
+ 00000002 l__HEADER5
+ 00000002 l__HEADER6
+ 00000002 l__HEADER7
+ 00000003 l__HEADER0
+ 00000006 l__GSINIT
+ 0000000C l__HEADER8
+ 00000017 l__CODE
+ 00000800 s__CODE
+ 00000817 s__GSINIT
+ 00000817 s__HOME
+ 00000817 s__INITIALIZER
+ 0000081D s__GSFINAL
+ 00008000 s__BSEG
+ 00008000 s__BSS
+ 00008000 s__DATA
+ 00008000 s__HEAP
+ 00008000 s__INITIALIZED
+ ASxxxx Linker V03.00 + NoICE + sdld, page 2.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_CODE 00000800 00000017 = 23. bytes (REL,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ 00000800 __clock crt0
+ 00000804 _exit crt0
+ 0000080A _main kernel
+ ASxxxx Linker V03.00 + NoICE + sdld, page 3.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER0 00000000 00000003 = 3. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 4.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER1 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 5.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER2 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 6.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER3 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 7.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER4 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 8.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER5 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 9.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER6 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 10.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER7 00000000 00000002 = 2. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 11.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_HEADER8 00000000 0000000C = 12. bytes (ABS,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 12.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_GSINIT 00000817 00000006 = 6. bytes (REL,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ 00000817 gsinit crt0
+
+ ASxxxx Linker V03.00 + NoICE + sdld, page 13.
+Hexadecimal [32-Bits]
+
+Area Addr Size Decimal Bytes (Attributes)
+-------------------------------- ---- ---- ------- ----- ------------
+_GSFINAL 0000081D 00000001 = 1. bytes (REL,CON)
+
+ Value Global Global Defined In Module
+ ----- -------------------------------- ------------------------
+ ASxxxx Linker V03.00 + NoICE + sdld, page 14.
+
+Files Linked [ module(s) ]
+
+crt0.rel [ crt0 ]
+build/kernel/kernel.rel [ kernel ]
+
+ ASxxxx Linker V03.00 + NoICE + sdld, page 15.
+
+User Base Address Definitions
+
+_CODE = 0x0800
+_DATA = 0x8000
+
+ \ No newline at end of file
diff --git a/sw/z80/build/helvetiOS.noi b/sw/z80/build/helvetiOS.noi
new file mode 100644
index 0000000..1b9c284
--- /dev/null
+++ b/sw/z80/build/helvetiOS.noi
@@ -0,0 +1,50 @@
+DEF .__.ABS. 0x0
+DEF l__BSEG 0x0
+DEF l__BSS 0x0
+DEF l__CABS 0x0
+DEF l__DABS 0x0
+DEF l__DATA 0x0
+DEF l__HEADER 0x0
+DEF l__HEAP 0x0
+DEF l__HOME 0x0
+DEF l__INITIALIZED 0x0
+DEF l__INITIALIZER 0x0
+DEF s__CABS 0x0
+DEF s__DABS 0x0
+DEF s__HEADER 0x0
+DEF s__HEADER0 0x0
+DEF s__HEADER1 0x0
+DEF s__HEADER2 0x0
+DEF s__HEADER3 0x0
+DEF s__HEADER4 0x0
+DEF s__HEADER5 0x0
+DEF s__HEADER6 0x0
+DEF s__HEADER7 0x0
+DEF s__HEADER8 0x0
+DEF l__GSFINAL 0x1
+DEF l__HEADER1 0x2
+DEF l__HEADER2 0x2
+DEF l__HEADER3 0x2
+DEF l__HEADER4 0x2
+DEF l__HEADER5 0x2
+DEF l__HEADER6 0x2
+DEF l__HEADER7 0x2
+DEF l__HEADER0 0x3
+DEF l__GSINIT 0x6
+DEF l__HEADER8 0xC
+DEF l__CODE 0x17
+DEF s__CODE 0x800
+DEF s__GSINIT 0x817
+DEF s__HOME 0x817
+DEF s__INITIALIZER 0x817
+DEF s__GSFINAL 0x81D
+DEF s__BSEG 0x8000
+DEF s__BSS 0x8000
+DEF s__DATA 0x8000
+DEF s__HEAP 0x8000
+DEF s__INITIALIZED 0x8000
+DEF __clock 0x800
+DEF _exit 0x804
+DEF _main 0x80A
+DEF gsinit 0x817
+LOAD build/helvetiOS.ihx
diff --git a/sw/z80/build/kernel/kernel.asm b/sw/z80/build/kernel/kernel.asm
new file mode 100644
index 0000000..a29db4d
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.asm
@@ -0,0 +1,65 @@
+;--------------------------------------------------------
+; File Created by SDCC : free open source ANSI-C Compiler
+; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
+; This file was generated Tue May 2 18:13:35 2017
+;--------------------------------------------------------
+ .module kernel
+ .optsdcc -mz80
+
+;--------------------------------------------------------
+; Public variables in this module
+;--------------------------------------------------------
+ .globl _main
+;--------------------------------------------------------
+; 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 main(void)
+; ---------------------------------
+; Function main
+; ---------------------------------
+_main::
+;kernel/kernel.c:7: for (i = 0; i < 10; i++) {
+ ld de,#0x000A
+00104$:
+;kernel/kernel.c:8: j--;
+ ld c,e
+ ld b,d
+ dec bc
+ ld e, c
+;kernel/kernel.c:7: for (i = 0; i < 10; i++) {
+ ld a,b
+ ld d,a
+ or a,c
+ jr NZ,00104$
+ 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..8ec7438
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.lst
@@ -0,0 +1,65 @@
+ 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 Tue May 2 18:13:35 2017
+ 5 ;--------------------------------------------------------
+ 6 .module kernel
+ 7 .optsdcc -mz80
+ 8
+ 9 ;--------------------------------------------------------
+ 10 ; Public variables in this module
+ 11 ;--------------------------------------------------------
+ 12 .globl _main
+ 13 ;--------------------------------------------------------
+ 14 ; special function registers
+ 15 ;--------------------------------------------------------
+ 16 ;--------------------------------------------------------
+ 17 ; ram data
+ 18 ;--------------------------------------------------------
+ 19 .area _DATA
+ 20 ;--------------------------------------------------------
+ 21 ; ram data
+ 22 ;--------------------------------------------------------
+ 23 .area _INITIALIZED
+ 24 ;--------------------------------------------------------
+ 25 ; absolute external ram data
+ 26 ;--------------------------------------------------------
+ 27 .area _DABS (ABS)
+ 28 ;--------------------------------------------------------
+ 29 ; global & static initialisations
+ 30 ;--------------------------------------------------------
+ 31 .area _HOME
+ 32 .area _GSINIT
+ 33 .area _GSFINAL
+ 34 .area _GSINIT
+ 35 ;--------------------------------------------------------
+ 36 ; Home
+ 37 ;--------------------------------------------------------
+ 38 .area _HOME
+ 39 .area _HOME
+ 40 ;--------------------------------------------------------
+ 41 ; code
+ 42 ;--------------------------------------------------------
+ 43 .area _CODE
+ 44 ;kernel/kernel.c:4: void main(void)
+ 45 ; ---------------------------------
+ 46 ; Function main
+ 47 ; ---------------------------------
+ 0000 48 _main::
+ 49 ;kernel/kernel.c:7: for (i = 0; i < 10; i++) {
+ 0000 11 0A 00 [10] 50 ld de,#0x000A
+ 0003 51 00104$:
+ 52 ;kernel/kernel.c:8: j--;
+ 0003 4B [ 4] 53 ld c,e
+ 0004 42 [ 4] 54 ld b,d
+ 0005 0B [ 6] 55 dec bc
+ 0006 59 [ 4] 56 ld e, c
+ 57 ;kernel/kernel.c:7: for (i = 0; i < 10; i++) {
+ 0007 78 [ 4] 58 ld a,b
+ 0008 57 [ 4] 59 ld d,a
+ 0009 B1 [ 4] 60 or a,c
+ 000A 20 F7 [12] 61 jr NZ,00104$
+ 000C C9 [10] 62 ret
+ 63 .area _CODE
+ 64 .area _INITIALIZER
+ 65 .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..1079edc
--- /dev/null
+++ b/sw/z80/build/kernel/kernel.rel
@@ -0,0 +1,23 @@
+XL2
+H 9 areas 2 global symbols
+M kernel
+O -mz80
+S .__.ABS. Def0000
+A _CODE size D flags 0 addr 0
+S _main 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 11 0A 00
+R 00 00 00 00
+T 03 00
+R 00 00 00 00
+T 03 00 4B 42 0B 59 78 57 B1 20 F7 C9
+R 00 00 00 00
diff --git a/sw/z80/build/kernel/kernel.sym b/sw/z80/build/kernel/kernel.sym
new file mode 100644
index 0000000..d01735c
--- /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 _main 0000 GR
+
+
+ ASxxxx Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180), page 2.
+Hexadecimal [16-Bits]
+
+Area Table
+
+ 0 _CODE size D 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/crt0.rel b/sw/z80/crt0.rel
new file mode 100644
index 0000000..809c0e6
--- /dev/null
+++ b/sw/z80/crt0.rel
@@ -0,0 +1,86 @@
+XL2
+H 14 areas 5 global symbols
+M crt0
+S _main Ref0000
+S .__.ABS. Def0000
+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 00 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/boot_loader.c b/sw/z80/kernel/boot_loader.c
new file mode 100644
index 0000000..ddca4f9
--- /dev/null
+++ b/sw/z80/kernel/boot_loader.c
@@ -0,0 +1,43 @@
+#include "boot.h"
+#include "progman.h"
+
+#define DEFAULT_EXEC_STATUS 0x4000
+
+struct exec_status *status = EXEC_STATUS;
+
+void boot_init() {
+
+ *status = DEFAULT_EXEC_STATUS;
+
+ // TODO other stuff
+}
+
+int8_t authenticate(const char *pwd) {
+
+ const char *c_pwd = PWD_ADDR, *c_req = pwd;
+
+ for (uint8_t i = 0; i < PWD_SIZE; i++) {
+
+ if (*c_pwd != *c_req)
+ return 0;
+
+ c_pwd++;
+ c_req++;
+ }
+
+ return 1;
+}
+
+void set_pwd(const char *pwd) {
+
+ char *c_pwd = PWD_ADDR;
+ const char *c_req = pwd;
+
+ for (uint8_t i = 0; i < PWD_SIZE; i++) {
+
+ *c_pwd = *c_req;
+
+ c_pwd++;
+ c_req++;
+ }
+} \ No newline at end of file
diff --git a/sw/z80/kernel/include/boot.h b/sw/z80/kernel/include/boot.h
new file mode 100644
index 0000000..5310e45
--- /dev/null
+++ b/sw/z80/kernel/include/boot.h
@@ -0,0 +1,35 @@
+#ifndef BOOT_H
+#define BOOT_H
+
+#include "types.h"
+
+#define LOGIN_PC // TODO find an address in ROM, to perform jumps
+
+#define EXEC_STATUS // TODO find an address in Kernel space
+
+#define PWD_ADDR // TODO find an address in ROM, password
+#define PWD_SIZE 8
+
+struct exec_status {
+
+ volatile int logged_in:1; // authenticated
+ volatile int k_control:1; // no running programs
+ volatile int program_id:1; // current running program id, see "progman.h"
+ volatile int hidden_pc:13; // program counter of the paused program
+};
+
+void boot_init();
+
+/*
+* It returns 1 if succeded, otherwise 0
+*/
+
+int8_t authenticate(const char *pwd);
+
+/*
+* It sets the password in the ROM space, maximum 8 characters
+*/
+
+void set_pwd(const char *pwd);
+
+#endif \ No newline at end of file
diff --git a/sw/z80/kernel/include/progman.h b/sw/z80/kernel/include/progman.h
new file mode 100644
index 0000000..0f56bb3
--- /dev/null
+++ b/sw/z80/kernel/include/progman.h
@@ -0,0 +1,86 @@
+#ifndef PROGRAM_MAN
+#define PROGRAM_MAN
+
+#include "types.h"
+
+#define PROG_0 0x0
+#define PROG_1 0x1
+
+#define PROG_VSTART 0x1000
+#define PROG_0_PREFIX 0xA000
+#define PROG_1_PREFIX 0xC000
+
+#define PROG_0_INFO // TODO
+#define PROG_1_INFO // TODO find a space in the ram
+
+struct program_info {
+
+ volatile int enabled:1;
+ volatile int running:1;
+ volatile int exiting:1;
+ volatile int heap_addr:13;
+ volatile void (*quit_cb)(void); // 16
+};
+
+/*
+* Initialize the program manager system
+*/
+
+void progman_init();
+
+/*
+* Check if it can start a new program
+* If it succedes, the program id is returned,
+* otherwise it is returned an error number
+*/
+
+#define PROG_REQ_FULL -1
+#define PROG_REQ_ERR -2 // Maybe we don't need this, but just in case
+
+int8_t prog_req(struct program_info *info);
+
+/*
+* It allocates a program in the RAM
+* To obtain the right id call prog_req() first
+* Basic informations must be allocated and referenced by a program_base struct
+*/
+
+struct program_base {
+
+ void * inst_set; // pointer to the instructions set
+ size_t inst_size; // size of the instructions set
+ void * bss_data; // pointer to the bss/data space
+ size_t data_size; // size of the bss/data space
+ size_t stack_size; // size of the stack to determine the stack limit
+};
+
+void prog_alloc(int8_t id, struct program_info *info, const struct program_base *base);
+
+/*
+* It jumps the program counter to the given one
+*/
+
+void prog_exec(int8_t id, struct program_info *info);
+
+/*
+* It sets a quit callback
+*/
+
+void prog_0_qcb(void (*callback)(void));
+void prog_1_qcb(void (*callback)(void));
+
+/*
+* It quits a program, if a callback is set, it will be called
+*/
+
+void prog_0_quit();
+void prog_1_quit();
+
+/*
+* It forces a program to quit
+*/
+
+void prog_0_fquit();
+void prog_1_fquit();
+
+#endif \ No newline at end of file
diff --git a/sw/z80/kernel/programs.c b/sw/z80/kernel/programs.c
new file mode 100644
index 0000000..0f75887
--- /dev/null
+++ b/sw/z80/kernel/programs.c
@@ -0,0 +1,110 @@
+#include "progman.h"
+
+#define EMPTY_PROG_INFO 0x0
+
+struct program_info *prog_0 = PROG_0_INFO,
+ *prog_1 = PROG_1_INFO;
+
+void progman_init() {
+
+ *prog_0 = EMPTY_PROG_INFO;
+ *prog_1 = EMPTY_PROG_INFO;
+
+ // TODO other stuff
+}
+
+int8_t prog_req(struct program_info *info) {
+
+ uint8_t prog;
+
+ if (!prog_0->enabled) {
+
+ prog = PROG_0;
+ *info = *prog_0;
+
+ } else if (!prog_1->enabled) {
+
+ prog = PROG_1;
+ *info = *prog_1;
+
+ } else {
+
+ return PROG_REQ_FULL;
+ }
+
+ return prog;
+}
+
+void prog_alloc(int8_t id, struct program_info *info, const struct program_base *base) {
+
+ // TODO, implements program allocation
+}
+
+void prog_exec(int8_t id, struct program_info *info) {
+
+ // TODO, perform a program counter jump
+}
+
+void prog_0_qcb(void (*callback)(void)) {
+
+ prog_0->quit_cb = callback;
+}
+
+void prog_1_qcb(void (*callback)(void)) {
+
+ prog_1->quit_cb = callback;
+}
+
+void prog_0_quit() {
+
+ if (!prog_0->enabled || prog_0->exiting)
+ return;
+
+ if (prog_0->quit_cb)
+ prog_0->quit_cb();
+
+ // TODO free space in RAM
+
+ *prog_0 = EMPTY_PROG_INFO;
+
+ // TODO jump program counter
+}
+
+void prog_1_quit() {
+
+ if (!prog_1->enabled || prog_1->exiting)
+ return;
+
+ if (prog_1->quit_cb)
+ prog_1->quit_cb();
+
+ // TODO free space in RAM
+
+ *prog_1 = EMPTY_PROG_INFO;
+
+ // TODO jump program counter
+}
+
+void prog_0_fquit() {
+
+ if (!prog_0->enabled)
+ return;
+
+ // TODO free space in RAM
+
+ *prog_0 = EMPTY_PROG_INFO;
+
+ // TODO jump program counter
+}
+
+void prog_1_fquit() {
+
+ if (!prog_1->enabled)
+ return;
+
+ // TODO free space in RAM
+
+ *prog_1 = EMPTY_PROG_INFO;
+
+ // TODO jump program counter
+} \ No newline at end of file