commit ab62853f9ec65075c9e1a480861b5c0cea7b5e7c
parent 0c986dd34840500ff1f85d44cf5ac3274cbead69
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sun, 7 Aug 2022 14:51:59 -0400
xcomp/tools: fix broken orgifydict
The tool broke the prev entry of the first word! I hadn't noticed it in QEMU
because it lead to a memory space that was zeroed, but on a real machine, it
made "word not found" condition into an infinite loop.
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -12,23 +12,23 @@ posix/boot.fs: $(BOOTFS_SRC)
dusk: posix/vm.c posix/boot.fs fs/init.fs
$(CC) posix/vm.c -Wall -o $@
-mbr.bin: dusk buildmbr.fs
+mbr.bin: dusk buildmbr.fs $(ALLSRCS)
./dusk < buildmbr.fs 2> $@
-pc.bin: dusk buildpc.fs
+pc.bin: dusk buildpc.fs $(ALLSRCS)
./dusk < buildpc.fs 2> $@
-pc.img: mbr.bin pc.bin $(ALLSRCS)
+pc.img: mbr.bin pc.bin
dd if=/dev/zero of=$@ bs=1M count=1
# We need to reserve (-R) enough sectors for MBR + pc.bin
mformat -M 512 -d 1 -R 48 -i $@ ::
dd if=mbr.bin of=$@ bs=1 seek=62 conv=notrunc
dd if=pc.bin of=$@ bs=1 seek=512 conv=notrunc
mcopy -sQ -i $@ fs/* ::
- cat fs/xcomp/pc/init.fs fs/xcomp/init.fs | mcopy -D overwrite -i $@ - ::init.fs
.PHONY: pcrun
pcrun: pc.img
+ cat fs/xcomp/pc/init.fs fs/xcomp/init.fs | mcopy -D overwrite -i $@ - ::init.fs
qemu-system-i386 -drive file=pc.img,format=raw
.PHONY: testpc
diff --git a/fs/xcomp/tools.fs b/fs/xcomp/tools.fs
@@ -19,7 +19,7 @@ newxdict xbindict
\ anymore and becomes opaque binary contents.
: orgifydict ( xdict -- )
@ begin ( a )
- ?dup while ( a )
- 5 - dup @ dup ( 'prev prev prev )
- xoffset + ( 'prev oldprev newprev ) rot ! ( prev ) repeat ;
+ 5 - dup @ ( 'prev prev )
+ ?dup while ( 'prev prev )
+ dup xoffset + ( 'prev oldprev newprev ) rot ! ( prev ) repeat 2drop ;