at last sprites "work"
[ld45_start_nothing] / Makefile
index 165c473..1a2fcb4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ name = game
 elf = $(name).elf
 bin = $(name).bin
 
-ASFLAGS = -f elf32
+ASFLAGS = -f elf32 -i src/
 LDFLAGS = -m elf_i386 -T game.ld -print-gc-sections
 
 QEMU_FLAGS = -fda floppy.img -serial file:serial.log -d guest_errors
@@ -23,27 +23,26 @@ boot.img: bootldr.bin $(bin)
 bootldr.bin: $(elf)
        objcopy -O binary -j '.boot*' $< $@
 
-$(bin): $(elf) $(data)
+$(bin): $(elf)
        objcopy -O binary -R '.boot*' $< $@
 
 $(elf): $(obj)
        $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
 
+src/data.o: src/data.asm $(data)
+
 %.o: %.asm
        nasm -o $@ $(ASFLAGS) $<
 
-data/sprsheet.inc: data/sprsheet.png
-       img2tiles -o $@ -n -t 32x32 $<
-
 .PHONY: clean
 clean:
-       rm -f $(bin) $(obj) bootldr.img floppy.img boot.img
+       rm -f $(bin) $(obj) $(data) bootldr.bin floppy.img boot.img
 
 .PHONY: disasm
-disasm: bootldr.disasm $(bin).disasm
+disasm: bootldr.disasm $(name).disasm
 
-bootldr.disasm: bootldr.img
-       ndisasm -b 16 -o 7c00h $< >$@
+bootldr.disasm: $(elf)
+       objdump -d $< -j .boot -j .boot2 -m i8086 >$@
 
 $(name).disasm: $(elf)
        objdump -d $< -j .text -m i386 >$@
@@ -61,3 +60,13 @@ debug: floppy.img
 
 .PHONY: sym
 sym: $(name).sym
+
+
+tools/csprite/csprite:
+       $(MAKE) -C tools/csprite
+
+data/sprsheet.inc: data/sprsheet.png
+       tools/csprite/csprite -n sprsheet -s 32x32 $< >$@
+
+#data/sprsheet.inc: data/sprsheet.png
+#      img2tiles -o $@ -n -t 32x32 $<