mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 10:20:55 +11:00
Compare commits
3 Commits
b162ef84f5
...
e37f4c2551
Author | SHA1 | Date | |
---|---|---|---|
|
e37f4c2551 | ||
|
217df20d77 | ||
|
f65c189e9b |
@ -6,6 +6,7 @@ ZASMBIN = zasm/zasm
|
|||||||
AVRABIN = zasm/avra
|
AVRABIN = zasm/avra
|
||||||
SHELLAPPS = zasm ed
|
SHELLAPPS = zasm ed
|
||||||
SHELLTGTS = ${SHELLAPPS:%=cfsin/%}
|
SHELLTGTS = ${SHELLAPPS:%=cfsin/%}
|
||||||
|
BIN2C = ../tools/bin2c
|
||||||
# Those Forth source files are in a particular order
|
# Those Forth source files are in a particular order
|
||||||
FORTHSRCS = core.fs str.fs parse.fs readln.fs fmt.fs z80a.fs
|
FORTHSRCS = core.fs str.fs parse.fs readln.fs fmt.fs z80a.fs
|
||||||
FORTHSRC_PATHS = ${FORTHSRCS:%=../forth/%}
|
FORTHSRC_PATHS = ${FORTHSRCS:%=../forth/%}
|
||||||
@ -14,15 +15,18 @@ OBJS = emul.o libz80/libz80.o
|
|||||||
SHELLOBJS = $(OBJS) $(CFSPACK_OBJ)
|
SHELLOBJS = $(OBJS) $(CFSPACK_OBJ)
|
||||||
ZASMOBJS = $(SHELLOBJS)
|
ZASMOBJS = $(SHELLOBJS)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all tools
|
||||||
all: $(TARGETS) $(AVRABIN) $(CFSIN_CONTENTS)
|
all: $(TARGETS) $(AVRABIN) $(CFSIN_CONTENTS)
|
||||||
|
|
||||||
|
tools:
|
||||||
|
$(MAKE) -C ../tools
|
||||||
|
|
||||||
# -o in sync with SHELL_CODE in shell/glue.asm
|
# -o in sync with SHELL_CODE in shell/glue.asm
|
||||||
shell/shell.bin: shell/glue.asm $(ZASMBIN)
|
shell/shell.bin: shell/glue.asm $(ZASMBIN) tools
|
||||||
$(ZASMBIN) $(KERNEL) shell/user.h $(APPS) < shell/glue.asm | tee $@ > /dev/null
|
$(ZASMBIN) $(KERNEL) shell/user.h $(APPS) < shell/glue.asm | tee $@ > /dev/null
|
||||||
|
|
||||||
shell/shell-bin.h: shell/shell.bin
|
shell/shell-bin.h: shell/shell.bin tools
|
||||||
./bin2c.sh KERNEL < shell/shell.bin | tee $@ > /dev/null
|
$(BIN2C) KERNEL < shell/shell.bin | tee $@ > /dev/null
|
||||||
|
|
||||||
shell/shell: shell/shell.c $(SHELLOBJS) shell/shell-bin.h
|
shell/shell: shell/shell.c $(SHELLOBJS) shell/shell-bin.h
|
||||||
$(CC) shell/shell.c $(SHELLOBJS) -o $@
|
$(CC) shell/shell.c $(SHELLOBJS) -o $@
|
||||||
@ -32,8 +36,8 @@ shell/shell: shell/shell.c $(SHELLOBJS) shell/shell-bin.h
|
|||||||
forth/forth0.bin:
|
forth/forth0.bin:
|
||||||
cat forth/boot.bin forth/z80c.bin > $@
|
cat forth/boot.bin forth/z80c.bin > $@
|
||||||
|
|
||||||
forth/forth0-bin.h: forth/forth0.bin
|
forth/forth0-bin.h: forth/forth0.bin tools
|
||||||
./bin2c.sh KERNEL < forth/forth0.bin | tee $@ > /dev/null
|
$(BIN2C) KERNEL < forth/forth0.bin | tee $@ > /dev/null
|
||||||
|
|
||||||
forth/stage1: forth/stage.c $(OBJS) forth/forth0-bin.h
|
forth/stage1: forth/stage.c $(OBJS) forth/forth0-bin.h
|
||||||
$(CC) forth/stage.c $(OBJS) -o $@
|
$(CC) forth/stage.c $(OBJS) -o $@
|
||||||
@ -47,8 +51,8 @@ forth/core.bin: $(FORTHSRC_PATHS) forth/stage1
|
|||||||
forth/forth1.bin: forth/forth0.bin forth/core.bin
|
forth/forth1.bin: forth/forth0.bin forth/core.bin
|
||||||
cat forth/forth0.bin forth/core.bin > $@
|
cat forth/forth0.bin forth/core.bin > $@
|
||||||
|
|
||||||
forth/forth1-bin.h: forth/forth1.bin
|
forth/forth1-bin.h: forth/forth1.bin tools
|
||||||
./bin2c.sh KERNEL < forth/forth1.bin | tee $@ > /dev/null
|
$(BIN2C) KERNEL < forth/forth1.bin | tee $@ > /dev/null
|
||||||
|
|
||||||
forth/stage2: forth/stage.c $(OBJS) forth/forth1-bin.h
|
forth/stage2: forth/stage.c $(OBJS) forth/forth1-bin.h
|
||||||
$(CC) -DSTAGE2 forth/stage.c $(OBJS) -o $@
|
$(CC) -DSTAGE2 forth/stage.c $(OBJS) -o $@
|
||||||
@ -56,11 +60,11 @@ forth/stage2: forth/stage.c $(OBJS) forth/forth1-bin.h
|
|||||||
forth/forth: forth/forth.c $(OBJS) forth/forth1-bin.h
|
forth/forth: forth/forth.c $(OBJS) forth/forth1-bin.h
|
||||||
$(CC) forth/forth.c $(OBJS) -o $@
|
$(CC) forth/forth.c $(OBJS) -o $@
|
||||||
|
|
||||||
zasm/kernel-bin.h: zasm/kernel.bin
|
zasm/kernel-bin.h: zasm/kernel.bin tools
|
||||||
./bin2c.sh KERNEL < zasm/kernel.bin | tee $@ > /dev/null
|
$(BIN2C) KERNEL < zasm/kernel.bin | tee $@ > /dev/null
|
||||||
|
|
||||||
zasm/zasm-bin.h: zasm/zasm.bin
|
zasm/zasm-bin.h: zasm/zasm.bin tools
|
||||||
./bin2c.sh USERSPACE < zasm/zasm.bin | tee $@ > /dev/null
|
$(BIN2C) USERSPACE < zasm/zasm.bin | tee $@ > /dev/null
|
||||||
|
|
||||||
$(ZASMBIN): zasm/zasm.c $(ZASMOBJS) zasm/kernel-bin.h zasm/zasm-bin.h
|
$(ZASMBIN): zasm/zasm.c $(ZASMOBJS) zasm/kernel-bin.h zasm/zasm-bin.h
|
||||||
$(CC) zasm/zasm.c $(ZASMOBJS) -o $@
|
$(CC) zasm/zasm.c $(ZASMOBJS) -o $@
|
||||||
@ -68,8 +72,8 @@ $(ZASMBIN): zasm/zasm.c $(ZASMOBJS) zasm/kernel-bin.h zasm/zasm-bin.h
|
|||||||
zasm/avra.bin: $(ZASMBIN)
|
zasm/avra.bin: $(ZASMBIN)
|
||||||
$(ZASMBIN) $(KERNEL) $(APPS) zasm/user.h < $(APPS)/zasm/gluea.asm > $@
|
$(ZASMBIN) $(KERNEL) $(APPS) zasm/user.h < $(APPS)/zasm/gluea.asm > $@
|
||||||
|
|
||||||
zasm/avra-bin.h: zasm/avra.bin
|
zasm/avra-bin.h: zasm/avra.bin tools
|
||||||
./bin2c.sh USERSPACE < zasm/avra.bin | tee $@ > /dev/null
|
$(BIN2C) USERSPACE < zasm/avra.bin | tee $@ > /dev/null
|
||||||
|
|
||||||
$(AVRABIN): zasm/zasm.c $(ZASMOBJS) zasm/kernel-bin.h zasm/avra-bin.h
|
$(AVRABIN): zasm/zasm.c $(ZASMOBJS) zasm/kernel-bin.h zasm/avra-bin.h
|
||||||
$(CC) -D AVRA zasm/zasm.c $(ZASMOBJS) -o $@
|
$(CC) -D AVRA zasm/zasm.c $(ZASMOBJS) -o $@
|
||||||
@ -109,3 +113,4 @@ fbootstrap: forth/stage2
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS) $(SHELLTGTS) emul.o zasm/*-bin.h shell/*-bin.h
|
rm -f $(TARGETS) $(SHELLTGTS) emul.o zasm/*-bin.h shell/*-bin.h
|
||||||
|
$(MAKE) -C ../tools clean
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo "unsigned char $1[] = { "
|
|
||||||
xxd -i -
|
|
||||||
echo " };"
|
|
@ -4,8 +4,9 @@ UPLOAD_TGT = upload
|
|||||||
FONTCOMPILE_TGT = fontcompile
|
FONTCOMPILE_TGT = fontcompile
|
||||||
TTYSAFE_TGT = ttysafe
|
TTYSAFE_TGT = ttysafe
|
||||||
PINGPONG_TGT = pingpong
|
PINGPONG_TGT = pingpong
|
||||||
|
BIN2C_TGT = bin2c
|
||||||
TARGETS = $(MEMDUMP_TGT) $(BLKDUMP_TGT) $(UPLOAD_TGT) $(FONTCOMPILE_TGT) \
|
TARGETS = $(MEMDUMP_TGT) $(BLKDUMP_TGT) $(UPLOAD_TGT) $(FONTCOMPILE_TGT) \
|
||||||
$(TTYSAFE_TGT) $(PINGPONG_TGT)
|
$(TTYSAFE_TGT) $(PINGPONG_TGT) $(BIN2C_TGT)
|
||||||
OBJS = common.o
|
OBJS = common.o
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
@ -20,6 +21,7 @@ $(UPLOAD_TGT): $(UPLOAD_TGT).c
|
|||||||
$(FONTCOMPILE_TGT): $(FONTCOMPILE_TGT).c
|
$(FONTCOMPILE_TGT): $(FONTCOMPILE_TGT).c
|
||||||
$(TTYSAFE_TGT): $(TTYSAFE_TGT).c
|
$(TTYSAFE_TGT): $(TTYSAFE_TGT).c
|
||||||
$(PINGPONG_TGT): $(PINGPONG_TGT).c
|
$(PINGPONG_TGT): $(PINGPONG_TGT).c
|
||||||
|
$(BIN2C_TGT): $(BIN2C_TGT).c
|
||||||
$(TARGETS): $(OBJS)
|
$(TARGETS): $(OBJS)
|
||||||
$(CC) $(CFLAGS) $@.c $(OBJS) -o $@
|
$(CC) $(CFLAGS) $@.c $(OBJS) -o $@
|
||||||
|
|
||||||
|
50
tools/bin2c.c
Normal file
50
tools/bin2c.c
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 Byron Grobe
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define BUFSZ 32
|
||||||
|
|
||||||
|
static const char intro[] = "static const unsigned char %s[] = {\n ";
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
int n;
|
||||||
|
int col = 0;
|
||||||
|
uint8_t buf[BUFSZ];
|
||||||
|
|
||||||
|
if (argc < 2) {
|
||||||
|
fprintf(stderr, "Specify a name for the data structure...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(intro, argv[1]);
|
||||||
|
|
||||||
|
while(!feof(stdin)) {
|
||||||
|
n = fread(buf, 1, BUFSZ, stdin);
|
||||||
|
for(int i = 0; i < n; ++i) {
|
||||||
|
if (col+4 >= 76) {
|
||||||
|
printf("\n ");
|
||||||
|
col = 0;
|
||||||
|
}
|
||||||
|
printf("0x%.2x, ", buf[i]);
|
||||||
|
col += 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("};\n");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user