mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:48:06 +11:00
Move /parts/z80 to /kernel
Let go of that "meta os" thing. it's not as meta as I made it sound like. It's a kernel.
This commit is contained in:
parent
78d9764005
commit
7fad3b0c90
@ -83,8 +83,9 @@ in a couple of decades, build a new IC fab (or bring an old one back to life).
|
|||||||
The project is progressing well and I already have a working shell (see `doc`
|
The project is progressing well and I already have a working shell (see `doc`
|
||||||
to see what it can do) on a classic RC2014. Highlights:
|
to see what it can do) on a classic RC2014. Highlights:
|
||||||
|
|
||||||
* Extremely flexible: this is not an OS, but a meta OS. You build your own OS
|
* Extremely flexible: Kernel parts are written as loosely knit modules that
|
||||||
through glue code.
|
are bound through glue code. This makes the kernel adaptable to many unforseen
|
||||||
|
situations.
|
||||||
* 2K binary (but size vary wildly depending on what parts you include. 2K is
|
* 2K binary (but size vary wildly depending on what parts you include. 2K is
|
||||||
for a shell using all parts).
|
for a shell using all parts).
|
||||||
* Built with minimal tooling: only [scas][scas] is needed
|
* Built with minimal tooling: only [scas][scas] is needed
|
||||||
@ -101,7 +102,8 @@ to see what it can do) on a classic RC2014. Highlights:
|
|||||||
|
|
||||||
There's very little done so far, but here's how it's organized:
|
There's very little done so far, but here's how it's organized:
|
||||||
|
|
||||||
* `parts`: Pieces of code to be assembled by the user into an OS.
|
* `kernel`: Pieces of code to be assembled by the user into a kernel.
|
||||||
|
* `apps`: Pieces of code to be assembled into "userspace" application.
|
||||||
* `recipes`: collection of recipes that assemble parts together on a specific
|
* `recipes`: collection of recipes that assemble parts together on a specific
|
||||||
machine.
|
machine.
|
||||||
* `doc`: User guide for when you've successfully installed Collapse OS.
|
* `doc`: User guide for when you've successfully installed Collapse OS.
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
# User applications
|
# User applications
|
||||||
|
|
||||||
This folder contains code designed to be loaded and ran in RAM.
|
This folder contains code designed to be "userspace" application. Unlike the
|
||||||
|
kernel, which always stay in memory. Those apps here will more likely be loaded
|
||||||
|
in RAM from storage, ran, then discarded so that another userspace program can
|
||||||
|
be run.
|
||||||
|
|
||||||
|
That doesn't mean that you can't include that code in your kernel though, but
|
||||||
|
you will typically not want to do that.
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# Z80 Parts
|
# Kernel
|
||||||
|
|
||||||
Bits and pieces of code that you can assemble to build an OS for your machine.
|
Bits and pieces of code that you can assemble to build a kernel for your
|
||||||
|
machine.
|
||||||
|
|
||||||
These parts are made to be glued together in a single `main.asm` file you write
|
These parts are made to be glued together in a single `glue.asm` file you write
|
||||||
yourself.
|
yourself.
|
||||||
|
|
||||||
As of now, the z80 assembler code is written to be assembled with [scas][scas],
|
As of now, the z80 assembler code is written to be assembled with [scas][scas],
|
||||||
@ -39,15 +40,7 @@ Thus, code that glue parts together coould look like:
|
|||||||
|
|
||||||
The asm code used in these parts is heavily dependent on what scas offers. I
|
The asm code used in these parts is heavily dependent on what scas offers. I
|
||||||
try to be as "low-tech" as possible because the implementation of the assembler
|
try to be as "low-tech" as possible because the implementation of the assembler
|
||||||
to be implemented for the z80 will likely be more limited. For example, I try
|
to be implemented for the z80 will likely be more limited. For example, we don't
|
||||||
to avoid macros.
|
use macros.
|
||||||
|
|
||||||
One exception, however, is for the routine hooks (`SHELL_GETC` for example). At
|
|
||||||
first, I wanted to assign a label to a const (`SHELL_GETC .equ aciaGetC` for
|
|
||||||
example), but it turns out that scas doesn't support this (but it could: label
|
|
||||||
addresses are known at compile time and thus can be consts (maybe at the cost
|
|
||||||
of an extra pass though)). I went for macros instead, but that doesn't mean
|
|
||||||
that the z80 assembler will need to support macros. It just need to support
|
|
||||||
labels-as-consts.
|
|
||||||
|
|
||||||
[scas]: https://github.com/KnightOS/scas
|
[scas]: https://github.com/KnightOS/scas
|
@ -1,11 +0,0 @@
|
|||||||
# Parts
|
|
||||||
|
|
||||||
Pieces of code that you can assemble together to make your machine work as you
|
|
||||||
want them to work.
|
|
||||||
|
|
||||||
Collapse OS is built around the z80, but it doesn't mean that your machine can't
|
|
||||||
mix and match microcontrollers. This is why this folder is subdivided by
|
|
||||||
architectures.
|
|
||||||
|
|
||||||
Obviously, different architectures can't be assembled together in the same
|
|
||||||
binary, but they can nevertheless be made to work well together.
|
|
@ -1,15 +0,0 @@
|
|||||||
# AVR parts
|
|
||||||
|
|
||||||
The idea with the AVR parts is that you will design peripherals plugged into
|
|
||||||
your z80 that are controlled by AVR microcontrollers.
|
|
||||||
|
|
||||||
AVR is a large family and although they all work more-or-less the same,
|
|
||||||
assembler code for one model can't be directly used on another model. Despite
|
|
||||||
this, parts are only written once. If the model you have on hand doesn't match,
|
|
||||||
you'll have to translate yourself.
|
|
||||||
|
|
||||||
There are also tons of possible variants to some of those parts. You could want
|
|
||||||
to implement a feature with a certain set of supporting ICs that aren't the
|
|
||||||
same as implemented in the part. We can't possibly cover all combinations. We
|
|
||||||
won't. We'll try to have a good variety of problems we solve so that you have
|
|
||||||
good material for mix-and-matching your own solution.
|
|
@ -2,7 +2,7 @@ TARGETS = shell/shell zasm/zasm runbin/runbin
|
|||||||
KERNEL_HEADERS = shell/kernel.h zasm/kernel.h
|
KERNEL_HEADERS = shell/kernel.h zasm/kernel.h
|
||||||
USER_HEADERS = zasm/user.h
|
USER_HEADERS = zasm/user.h
|
||||||
CFSPACK = ../cfspack/cfspack
|
CFSPACK = ../cfspack/cfspack
|
||||||
PARTS = ../../parts/z80
|
KERNEL = ../../kernel
|
||||||
APPS = ../../apps
|
APPS = ../../apps
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@ -11,12 +11,12 @@ all: $(TARGETS)
|
|||||||
shell/kernel.h: shell/shell_.asm
|
shell/kernel.h: shell/shell_.asm
|
||||||
zasm/kernel.h: zasm/glue.asm
|
zasm/kernel.h: zasm/glue.asm
|
||||||
$(KERNEL_HEADERS):
|
$(KERNEL_HEADERS):
|
||||||
scas -o - -I $(PARTS) -I $(APPS) $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
scas -o - -I $(KERNEL) -I $(APPS) $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
|
||||||
|
|
||||||
zasm/includes.cfs: $(CFSPACK)
|
zasm/includes.cfs: $(CFSPACK)
|
||||||
rm -rf zasm/includes
|
rm -rf zasm/includes
|
||||||
cp -r ../../parts/z80 zasm/includes
|
cp -r $(KERNEL) zasm/includes
|
||||||
cp -r ../../apps/zasm zasm/includes/zasm
|
cp -r $(APPS)/zasm zasm/includes/zasm
|
||||||
find zasm/includes -name *.md -delete
|
find zasm/includes -name *.md -delete
|
||||||
find zasm/includes -type f -exec sed -i -e 's/;.*//g' {} \;
|
find zasm/includes -type f -exec sed -i -e 's/;.*//g' {} \;
|
||||||
$(CFSPACK) zasm/includes > $@
|
$(CFSPACK) zasm/includes > $@
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
EMULDIR = ../../tools/emul
|
EMULDIR = ../emul
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run:
|
run:
|
||||||
|
@ -4,13 +4,13 @@ set -e
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
SCAS=scas
|
SCAS=scas
|
||||||
PARTS=../../../parts/z80
|
KERNEL=../../../kernel
|
||||||
APPS=../../../apps
|
APPS=../../../apps
|
||||||
RUNBIN=../../emul/runbin/runbin
|
RUNBIN=../../emul/runbin/runbin
|
||||||
|
|
||||||
for fn in *.asm; do
|
for fn in *.asm; do
|
||||||
echo "Running test ${fn}"
|
echo "Running test ${fn}"
|
||||||
if ! ${SCAS} -I ${PARTS} -I ${APPS} -o - ${fn} | ${RUNBIN}; then
|
if ! ${SCAS} -I ${KERNEL} -I ${APPS} -o - ${fn} | ${RUNBIN}; then
|
||||||
echo "failed with code ${PIPESTATUS[1]}"
|
echo "failed with code ${PIPESTATUS[1]}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -4,13 +4,13 @@ set -e
|
|||||||
|
|
||||||
TMPFILE=$(mktemp)
|
TMPFILE=$(mktemp)
|
||||||
SCAS=scas
|
SCAS=scas
|
||||||
PARTS=../../../parts/z80
|
KERNEL=../../../kernel
|
||||||
APPS=../../../apps
|
APPS=../../../apps
|
||||||
ZASM=../../emul/zasm/zasm
|
ZASM=../../emul/zasm/zasm
|
||||||
ASMFILE=${APPS}/zasm/instr.asm
|
ASMFILE=${APPS}/zasm/instr.asm
|
||||||
|
|
||||||
cmpas() {
|
cmpas() {
|
||||||
EXPECTED=$($SCAS -I ${PARTS} -I ${APPS} -o - "$1" | xxd)
|
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -o - "$1" | xxd)
|
||||||
ACTUAL=$(cat $1 | $ZASM | xxd)
|
ACTUAL=$(cat $1 | $ZASM | xxd)
|
||||||
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
||||||
echo ok
|
echo ok
|
||||||
|
Loading…
Reference in New Issue
Block a user