From 8e624034bfce9d6f7aa610806f732b5cc20abace Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 20 Sep 2020 10:21:21 -0400 Subject: [PATCH] recipes/sms: move recipe blocks into local overlay --- blk/001 | 2 +- cvm/Makefile | 6 +++--- cvm/forth.c | 5 ++++- cvm/stage.c | 9 ++++++++- cvm/vm.c | 9 +++------ recipes/sms/Makefile | 11 +++++++++-- blk/620 => recipes/sms/blk/600 | 0 blk/622 => recipes/sms/blk/602 | 0 blk/623 => recipes/sms/blk/603 | 0 blk/624 => recipes/sms/blk/604 | 0 blk/625 => recipes/sms/blk/605 | 0 blk/626 => recipes/sms/blk/606 | 0 blk/627 => recipes/sms/blk/607 | 0 blk/628 => recipes/sms/blk/608 | 0 blk/630 => recipes/sms/blk/610 | 0 blk/631 => recipes/sms/blk/611 | 0 blk/632 => recipes/sms/blk/612 | 0 blk/633 => recipes/sms/blk/613 | 0 blk/634 => recipes/sms/blk/614 | 0 blk/635 => recipes/sms/blk/615 | 0 blk/636 => recipes/sms/blk/616 | 0 blk/637 => recipes/sms/blk/617 | 0 blk/640 => recipes/sms/blk/620 | 0 blk/641 => recipes/sms/blk/621 | 0 recipes/sms/xcomp.fs | 4 ++-- 25 files changed, 30 insertions(+), 16 deletions(-) rename blk/620 => recipes/sms/blk/600 (100%) rename blk/622 => recipes/sms/blk/602 (100%) rename blk/623 => recipes/sms/blk/603 (100%) rename blk/624 => recipes/sms/blk/604 (100%) rename blk/625 => recipes/sms/blk/605 (100%) rename blk/626 => recipes/sms/blk/606 (100%) rename blk/627 => recipes/sms/blk/607 (100%) rename blk/628 => recipes/sms/blk/608 (100%) rename blk/630 => recipes/sms/blk/610 (100%) rename blk/631 => recipes/sms/blk/611 (100%) rename blk/632 => recipes/sms/blk/612 (100%) rename blk/633 => recipes/sms/blk/613 (100%) rename blk/634 => recipes/sms/blk/614 (100%) rename blk/635 => recipes/sms/blk/615 (100%) rename blk/636 => recipes/sms/blk/616 (100%) rename blk/637 => recipes/sms/blk/617 (100%) rename blk/640 => recipes/sms/blk/620 (100%) rename blk/641 => recipes/sms/blk/621 (100%) diff --git a/blk/001 b/blk/001 index f07f2c4..388b804 100644 --- a/blk/001 +++ b/blk/001 @@ -10,7 +10,7 @@ MASTER INDEX 440-489 unused 490 TRS-80 Recipe 520 Fonts 550 TI-84+ Recipe 580 RC2014 Recipe -600-619 unused 620 Sega Master System Recipe +600-649 unused 650 AVR assembler 690 AVR SPI programmer 700-729 unused 730 8086 assembler 800 8086 boot code 830 PC/AT recipe diff --git a/cvm/Makefile b/cvm/Makefile index f37c480..0dfd574 100644 --- a/cvm/Makefile +++ b/cvm/Makefile @@ -13,16 +13,16 @@ $(BLKPACK): $(BLKUNPACK): $(BLKPACK) stage: stage.c $(OBJS) blkfs - $(CC) stage.c $(OBJS) -o $@ + $(CC) -DBLKFS_PATH=\"`pwd`/blkfs\" stage.c $(OBJS) -o $@ blkfs: $(BLKPACK) $(BLKPACK) ../blk > $@ forth: forth.c $(OBJS) - $(CC) forth.c $(OBJS) -lncurses -o $@ + $(CC) -DBLKFS_PATH=\"`pwd`/blkfs\" forth.c $(OBJS) -lncurses -o $@ vm.o: vm.c blkfs - $(CC) -DFBIN_PATH=\"`pwd`/forth.bin\" -DBLKFS_PATH=\"`pwd`/blkfs\" -c -o vm.o vm.c + $(CC) -DFBIN_PATH=\"`pwd`/forth.bin\" -c -o vm.o vm.c .PHONY: updatebootstrap diff --git a/cvm/forth.c b/cvm/forth.c index 28c02ae..aedc48a 100644 --- a/cvm/forth.c +++ b/cvm/forth.c @@ -5,6 +5,9 @@ #include #include "vm.h" +#ifndef BLKFS_PATH +#error BLKFS_PATH needed +#endif #define WCOLS 80 #define WLINES 32 #define STDIO_PORT 0x00 @@ -74,7 +77,7 @@ static void iowr_sety(uint8_t val) int main(int argc, char *argv[]) { - VM *vm = VM_init(); + VM *vm = VM_init(BLKFS_PATH); if (!vm) { return 1; } diff --git a/cvm/stage.c b/cvm/stage.c index c1a1a0e..0b1015e 100644 --- a/cvm/stage.c +++ b/cvm/stage.c @@ -3,6 +3,9 @@ #include #include "vm.h" +#ifndef BLKFS_PATH +#error BLKFS_PATH needed +#endif #define RAMSTART 0 #define STDIO_PORT 0x00 // To know which part of RAM to dump, we listen to port 2, which at the end of @@ -41,7 +44,11 @@ static void iowr_here(uint8_t val) int main(int argc, char *argv[]) { - vm = VM_init(); + if (argc < 2) { + vm = VM_init(BLKFS_PATH); + } else { + vm = VM_init(argv[1]); + } if (vm == NULL) { return 1; } diff --git a/cvm/vm.c b/cvm/vm.c index a5b7d37..8d54cd9 100644 --- a/cvm/vm.c +++ b/cvm/vm.c @@ -11,9 +11,6 @@ // 5 - dest addr LSB #define BLK_PORT 0x03 -#ifndef BLKFS_PATH -#error BLKFS_PATH needed -#endif #ifndef FBIN_PATH #error FBIN_PATH needed #endif @@ -271,9 +268,9 @@ static void native(NativeWord func) { vm.nativew[vm.nativew_count++] = func; } -VM* VM_init() { - fprintf(stderr, "Using blkfs %s\n", BLKFS_PATH); - blkfp = fopen(BLKFS_PATH, "r+"); +VM* VM_init(char *blkfs_path) { + fprintf(stderr, "Using blkfs %s\n", blkfs_path); + blkfp = fopen(blkfs_path, "r+"); if (!blkfp) { fprintf(stderr, "Can't open\n"); return NULL; diff --git a/recipes/sms/Makefile b/recipes/sms/Makefile index 28b1fbb..f3d661c 100644 --- a/recipes/sms/Makefile +++ b/recipes/sms/Makefile @@ -1,12 +1,19 @@ TARGET = os.bin BASE = ../../ STAGE = $(BASE)/cvm/stage +BLKPACK = $(BASE)/tools/blkpack EMUL = $(BASE)/emul/hw/sms/sms .PHONY: all all: $(TARGET) -$(TARGET): xcomp.fs $(STAGE) - cat xcomp.fs | $(STAGE) > $@ +$(TARGET): xcomp.fs $(STAGE) blkfs + cat xcomp.fs | $(STAGE) blkfs > $@ + +$(BLKPACK): + $(MAKE) -C ../tools + +blkfs: $(BLKPACK) + $(BLKPACK) $(BASE)/blk blk > $@ $(STAGE): $(MAKE) -C $(BASE)/cvm stage diff --git a/blk/620 b/recipes/sms/blk/600 similarity index 100% rename from blk/620 rename to recipes/sms/blk/600 diff --git a/blk/622 b/recipes/sms/blk/602 similarity index 100% rename from blk/622 rename to recipes/sms/blk/602 diff --git a/blk/623 b/recipes/sms/blk/603 similarity index 100% rename from blk/623 rename to recipes/sms/blk/603 diff --git a/blk/624 b/recipes/sms/blk/604 similarity index 100% rename from blk/624 rename to recipes/sms/blk/604 diff --git a/blk/625 b/recipes/sms/blk/605 similarity index 100% rename from blk/625 rename to recipes/sms/blk/605 diff --git a/blk/626 b/recipes/sms/blk/606 similarity index 100% rename from blk/626 rename to recipes/sms/blk/606 diff --git a/blk/627 b/recipes/sms/blk/607 similarity index 100% rename from blk/627 rename to recipes/sms/blk/607 diff --git a/blk/628 b/recipes/sms/blk/608 similarity index 100% rename from blk/628 rename to recipes/sms/blk/608 diff --git a/blk/630 b/recipes/sms/blk/610 similarity index 100% rename from blk/630 rename to recipes/sms/blk/610 diff --git a/blk/631 b/recipes/sms/blk/611 similarity index 100% rename from blk/631 rename to recipes/sms/blk/611 diff --git a/blk/632 b/recipes/sms/blk/612 similarity index 100% rename from blk/632 rename to recipes/sms/blk/612 diff --git a/blk/633 b/recipes/sms/blk/613 similarity index 100% rename from blk/633 rename to recipes/sms/blk/613 diff --git a/blk/634 b/recipes/sms/blk/614 similarity index 100% rename from blk/634 rename to recipes/sms/blk/614 diff --git a/blk/635 b/recipes/sms/blk/615 similarity index 100% rename from blk/635 rename to recipes/sms/blk/615 diff --git a/blk/636 b/recipes/sms/blk/616 similarity index 100% rename from blk/636 rename to recipes/sms/blk/616 diff --git a/blk/637 b/recipes/sms/blk/617 similarity index 100% rename from blk/637 rename to recipes/sms/blk/617 diff --git a/blk/640 b/recipes/sms/blk/620 similarity index 100% rename from blk/640 rename to recipes/sms/blk/620 diff --git a/blk/641 b/recipes/sms/blk/621 similarity index 100% rename from blk/641 rename to recipes/sms/blk/621 diff --git a/recipes/sms/xcomp.fs b/recipes/sms/xcomp.fs index b0ab948..d8db458 100644 --- a/recipes/sms/xcomp.fs +++ b/recipes/sms/xcomp.fs @@ -27,8 +27,8 @@ CURRENT @ XCURRENT ! 283 335 LOADR ( boot.z80 ) 353 LOAD ( xcomp core low ) CREATE ~FNT CPFNT7x7 -623 628 LOADR ( VDP ) -632 637 LOADR ( PAD ) +603 608 LOADR ( VDP ) +612 617 LOADR ( PAD ) 380 LOAD ( xcomp core high ) (entry) _ ( Update LATEST )