diff --git a/recipes/rc2014/Makefile b/recipes/rc2014/Makefile index c51b706..d51a00f 100644 --- a/recipes/rc2014/Makefile +++ b/recipes/rc2014/Makefile @@ -1,5 +1,5 @@ TARGET = os.bin -ZASM = ../../tools/emul/zasm/zasm +ZASM = ../../tools/zasm.sh .PHONY: all all: $(TARGET) diff --git a/recipes/rc2014/glue.asm b/recipes/rc2014/glue.asm index da1c3ed..fd3fe08 100644 --- a/recipes/rc2014/glue.asm +++ b/recipes/rc2014/glue.asm @@ -11,6 +11,7 @@ jp init .fill 0x38-$ jp aciaInt +#include "err.h" #include "core.asm" #include "parse.asm" .equ ACIA_RAMSTART RAMSTART diff --git a/recipes/rc2014/sdcard/Makefile b/recipes/rc2014/sdcard/Makefile index d408c7e..906742d 100644 --- a/recipes/rc2014/sdcard/Makefile +++ b/recipes/rc2014/sdcard/Makefile @@ -1,6 +1,6 @@ TARGETS = os.bin cfsin/helo TOOLS = ../../../tools -ZASM = $(TOOLS)/emul/zasm/zasm +ZASM = $(TOOLS)/zasm.sh CFSPACK = $(TOOLS)/cfspack/cfspack .PHONY: all diff --git a/recipes/rc2014/sdcard/README.md b/recipes/rc2014/sdcard/README.md index 1695839..17a8018 100644 --- a/recipes/rc2014/sdcard/README.md +++ b/recipes/rc2014/sdcard/README.md @@ -1,7 +1,5 @@ # Accessing a MicroSD card -**Status: work in progress.** - SD cards are great because they are accessible directly. No supporting IC is necessary. The easiest way to access them is through the SPI protocol. diff --git a/recipes/rc2014/sdcard/glue.asm b/recipes/rc2014/sdcard/glue.asm index 8e81a5e..36ff7c8 100644 --- a/recipes/rc2014/sdcard/glue.asm +++ b/recipes/rc2014/sdcard/glue.asm @@ -20,6 +20,7 @@ jp sdcSendRecv .fill 0x38-$ jp aciaInt +#include "err.h" #include "core.asm" #include "parse.asm" .equ ACIA_RAMSTART RAMSTART diff --git a/tools/emul/Makefile b/tools/emul/Makefile index 0ccfa52..7e1ab12 100644 --- a/tools/emul/Makefile +++ b/tools/emul/Makefile @@ -3,12 +3,13 @@ CFSPACK = ../cfspack/cfspack KERNEL = ../../kernel APPS = ../../apps ZASMBIN = zasm/zasm +INCCFS = zasm/includes.cfs .PHONY: all all: $(TARGETS) -shell/kernel.h: shell/shell_.asm $(ZASMBIN) - $(ZASMBIN) < $< | ./bin2c.sh KERNEL | tee $@ > /dev/null +shell/kernel.h: shell/shell_.asm $(ZASMBIN) $(INCCFS) + $(ZASMBIN) $(INCCFS) < $< | ./bin2c.sh KERNEL | tee $@ > /dev/null zasm/kernel.h: zasm/kernel.bin ./bin2c.sh KERNEL < $< | tee $@ > /dev/null @@ -16,7 +17,7 @@ zasm/kernel.h: zasm/kernel.bin zasm/user.h: zasm/zasm.bin ./bin2c.sh USERSPACE < $< | tee $@ > /dev/null -zasm/includes.cfs: $(CFSPACK) +$(INCCFS): $(CFSPACK) rm -rf zasm/includes cp -r $(KERNEL) zasm/includes cp -r $(APPS)/zasm zasm/includes/zasm @@ -26,11 +27,8 @@ zasm/includes.cfs: $(CFSPACK) $(CFSPACK) zasm/includes > $@ rm -rf zasm/includes -zasm/includes.h: zasm/includes.cfs - ./bin2c.sh FSDEV < $< | tee $@ > /dev/null - shell/shell: shell/shell.c libz80/libz80.o shell/kernel.h $(CFSPACK) -$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h zasm/includes.h +$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h runbin/runbin: runbin/runbin.c libz80/libz80.o $(TARGETS): $(CC) $< libz80/libz80.o -o $@ @@ -43,9 +41,9 @@ $(CFSPACK): make -C ../cfspack .PHONY: updatebootstrap -updatebootstrap: $(ZASMBIN) - $(ZASMBIN) < zasm/glue.asm > zasm/kernel.bin - $(ZASMBIN) < $(APPS)/zasm/glue.asm > zasm/zasm.bin +updatebootstrap: $(ZASMBIN) $(INCCFS) + $(ZASMBIN) $(INCCFS) < zasm/glue.asm > zasm/kernel.bin + $(ZASMBIN) $(INCCFS) < $(APPS)/zasm/glue.asm > zasm/zasm.bin # Sometimes, when developing zasm, stuff get messed up and it's hard to unmess # because zasm's brake-up ends up in its bootstrap bins. Sure, we can revert diff --git a/tools/emul/zasm/zasm.c b/tools/emul/zasm/zasm.c index c91f6d7..c77ee08 100644 --- a/tools/emul/zasm/zasm.c +++ b/tools/emul/zasm/zasm.c @@ -3,12 +3,14 @@ #include "../libz80/z80.h" #include "kernel.h" #include "user.h" -#include "includes.h" /* zasm reads from a specified blkdev, assemble the file and writes the result * in another specified blkdev. In our emulator layer, we use stdin and stdout * as those specified blkdevs. * + * This executable takes one argument: the path to a .cfs file to use for + * includes. + * * Because the input blkdev needs support for Seek, we buffer it in the emulator * layer. * @@ -152,8 +154,12 @@ static void mem_write(int unused, uint16_t addr, uint8_t val) mem[addr] = val; } -int main() +int main(int argc, char *argv[]) { + if (argc > 2) { + fprintf(stderr, "Too many args\n"); + return 1; + } // initialize memory for (int i=0; i/dev/null 2>&1 && pwd )" +ZASMBIN="${DIR}/emul/zasm/zasm" +INCCFS="${DIR}/emul/zasm/includes.cfs" +"${ZASMBIN}" "${INCCFS}"