From 9917f2dfdaf62864c5d13d32090563cfe4b5a6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Tue, 3 Jul 2018 15:09:28 +0200 Subject: [PATCH] fixup! Disassemble the OS (use a compact representation for repetitive parts), re-assemble and check that the result is identical. --- example-os/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/example-os/Makefile b/example-os/Makefile index 7a1a2a3..5b4e11c 100644 --- a/example-os/Makefile +++ b/example-os/Makefile @@ -9,10 +9,12 @@ os.sh: os.asm ../deploy-screenshots Makefile chmod a+x $@ os.ndisasm.disasm: os.sh Makefile - ndisasm $< \ - | uniq -s 8 -c \ - | sed -r -e 's/\s*1 //; t; s/\s*([0-9]+) ([^ ]+\s+[^ ]+\s+)/\2times \1 /' \ - | sed -r -e 's/([^ ]+\s+[0-9A-F]{4}\s+jz) 0x/\1 short 0x/' > $@ + (echo "[BITS 16]"; \ + echo "[ORG 0x7c00]"; \ + ndisasm -o 0x7C00 $< \ + | uniq -s 8 -c \ + | sed -r -e 's/\s*1 //; t; s/\s*([0-9]+) ([^ ]+\s+[^ ]+\s+)/\2times \1 /' \ + | sed -r -e 's/([^ ]+\s+[0-9A-F]{4}\s+jz) 0x/\1 short 0x/') > $@ # The last sed line just above fixes an issue with ndisasm # (it fails to annotate the jz with short).