-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (46 loc) · 2.5 KB
/
Copy pathMakefile
File metadata and controls
54 lines (46 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Beautiful Boot PC — builds a 1.44 MB bootable floppy image
# Requires: nasm, dd (GNU coreutils), qemu-system-i386 (for test)
IMG = beautiful.img
BOOT = boot.bin
STAGE2 = stage2.bin
GAMES = $(shell find games/ -type f \( -iname "*.com" -o -iname "*.exe" -o -iname "*.bin" \) 2>/dev/null)
.PHONY: all clean test
all: $(IMG)
$(BOOT): boot.asm
nasm -f bin -o $@ $<
@test $$(stat -c%s $@) -eq 512 || (echo "boot sector != 512 B" && exit 1)
$(STAGE2): stage2.asm font.inc exe_reloc.asm
nasm -f bin -o $@ $<
$(IMG): $(BOOT) $(STAGE2)
rm -f $@
mkfs.fat -C $@ 1440
dd if=$(BOOT) of=$@ bs=1 count=3 conv=notrunc status=none
dd if=$(BOOT) of=$@ bs=1 skip=62 seek=62 count=450 conv=notrunc status=none
mcopy -i $@ $(STAGE2) ::stage2.bin
@find games/ -type f \( -iname "*.com" -o -iname "*.exe" -o -iname "*.bin" -o -iname "*.his" -o -iname "*.cfg" -o -iname "*.doc" -o -iname "*.sav" \) 2>/dev/null | while read -r game; do \
rel=$${game#games/}; \
dir=$$(dirname "$$rel"); \
base=$$(basename "$$rel"); \
if [ "$$dir" != "." ]; then \
mdir -i $@ "::$$dir" >/dev/null 2>&1 || mmd -i $@ "::$$dir"; \
mcopy -o -i $@ "$$game" "::$$dir/$$base"; \
else \
mcopy -o -i $@ "$$game" "::$$base"; \
fi; \
done
@echo "✅ $(IMG) ready"
@python3 -c "import zipfile; zipf=zipfile.ZipFile('beautiful-xt.jsdos', 'w', zipfile.ZIP_DEFLATED); zipf.write('beautiful.img', 'beautiful.img'); zipf.writestr('.jsdos/dosbox.conf', '[cpu]\ncycles=fixed 800\n[autoexec]\nimgmount a beautiful.img -t floppy\nboot beautiful.img\n'); zipf.close()"
@echo "✅ beautiful-xt.jsdos ready"
@python3 -c "import zipfile; zipf=zipfile.ZipFile('beautiful.jsdos', 'w', zipfile.ZIP_DEFLATED); zipf.write('beautiful.img', 'beautiful.img'); zipf.writestr('.jsdos/dosbox.conf', '[cpu]\ncycles=max\n[autoexec]\nimgmount a beautiful.img -t floppy\nboot beautiful.img\n'); zipf.close()"
@echo "✅ beautiful.jsdos ready"
test: $(IMG)
@echo "Opening http://localhost:8000 in your browser..."
@if grep -qi microsoft /proc/version 2>/dev/null; then \
explorer.exe "http://localhost:8000" 2>/dev/null || true; \
else \
xdg-open "http://localhost:8000" 2>/dev/null || sensible-browser "http://localhost:8000" 2>/dev/null || x-www-browser "http://localhost:8000" 2>/dev/null || true; \
fi
@echo "Starting http server on port 8000. Press Ctrl+C to stop."
python3 -m http.server 8000 2>/dev/null || python -m http.server 8000
clean:
rm -f $(BOOT) $(STAGE2) $(IMG) beautiful.jsdos beautiful-xt.jsdos