70 lines
2.2 KiB
Makefile
Raw Normal View History

2021-06-06 20:20:52 -04:00
PREFIX=m68k-apple-macos
2021-03-04 12:34:49 -05:00
AS=$(PREFIX)-as
CC=$(PREFIX)-gcc
LD=$(PREFIX)-ld
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
2020-06-22 00:10:31 -04:00
2021-03-03 06:34:14 -05:00
all: bin/rom16M_swap.bin obj/rdisk7M5.s obj/driver7M5.s obj/entry_rel.sym obj/driver_abs.sym
2020-06-22 00:10:31 -04:00
obj:
mkdir obj
bin:
mkdir bin
2020-06-24 12:46:30 -04:00
2020-06-26 03:12:08 -04:00
obj/entry.o: entry.s obj
$(AS) $< -o $@
2020-06-24 12:46:30 -04:00
2020-06-26 03:12:08 -04:00
obj/entry_rel.sym: obj obj/entry.o
$(OBJDUMP) -t obj/entry.o > $@
2020-06-24 12:46:30 -04:00
2020-06-22 16:02:27 -04:00
2020-07-31 17:04:20 -04:00
obj/rdisk7M5.o: rdisk.c obj
2021-04-02 02:26:34 -04:00
$(CC) -Wall -DRDiskSize=7864320 -march=68030 -c -Os $< -o $@
2020-07-31 17:04:20 -04:00
obj/rdisk7M5.s: obj obj/rdisk7M5.o
2021-03-03 06:34:14 -05:00
$(OBJDUMP) -d obj/rdisk7M5.o > $@
2020-07-31 17:04:20 -04:00
obj/driver7M5.o: obj obj/entry.o obj/rdisk7M5.o
$(LD) -Ttext=40851D70 -o $@ obj/entry.o obj/rdisk7M5.o
2020-07-31 17:04:20 -04:00
obj/driver7M5.s: obj obj/driver7M5.o
$(OBJDUMP) -d obj/driver7M5.o > $@
2021-03-03 06:34:14 -05:00
obj/driver_abs.sym: obj obj/driver7M5.o
$(OBJDUMP) -t obj/driver7M5.o > $@
2020-07-31 17:04:20 -04:00
bin/driver7M5.bin: bin obj/driver7M5.o
$(OBJCOPY) -O binary obj/driver7M5.o $@
bin/rom8M.bin: bin baserom.bin RDisk7M5.dsk bin bin/driver7M5.bin obj/driver_abs.sym obj/entry_rel.sym
2020-06-29 21:08:50 -04:00
cp baserom.bin $@ # Copy base rom
# Patch driver
2020-07-31 17:04:20 -04:00
dd if=bin/driver7M5.bin of=$@ bs=1 seek=335248 skip=32 conv=notrunc # Copy driver code
printf '\x78' | dd of=$@ bs=1 seek=335168 count=1 conv=notrunc # Set resource flags
printf '\x4F' | dd of=$@ bs=1 seek=335216 count=1 conv=notrunc # Set driver flags
2020-06-26 03:12:08 -04:00
cat obj/entry_rel.sym | grep "DOpen" | cut -c5-8 | xxd -r -p - | dd of=$@ bs=1 seek=335224 count=2 conv=notrunc
cat obj/entry_rel.sym | grep "DPrime" | cut -c5-8 | xxd -r -p - | dd of=$@ bs=1 seek=335226 count=2 conv=notrunc
cat obj/entry_rel.sym | grep "DControl" | cut -c5-8 | xxd -r -p - | dd of=$@ bs=1 seek=335228 count=2 conv=notrunc
cat obj/entry_rel.sym | grep "DStatus" | cut -c5-8 | xxd -r -p - | dd of=$@ bs=1 seek=335230 count=2 conv=notrunc
cat obj/entry_rel.sym | grep "DClose" | cut -c5-8 | xxd -r -p - | dd of=$@ bs=1 seek=335232 count=2 conv=notrunc
dd if=RDisk7M5.dsk of=$@ bs=1024 seek=512 count=7680 conv=notrunc # copy disk image
2020-07-31 17:04:20 -04:00
bin/rom8M_swap.bin: bin bin/rom8M.bin
2020-08-09 21:41:09 -04:00
dd if=bin/rom8M.bin of=$@ conv=swab # swap bytes
bin/iisi_swap.bin: bin iisi.bin
dd if=iisi.bin of=$@ conv=swab # swap bytes
bin/rom16M_swap.bin: bin/iisi_swap.bin bin/rom8M_swap.bin
2020-08-09 21:41:09 -04:00
cat bin/rom8M_swap.bin > $@
cat bin/iisi_swap.bin >> $@
2020-08-09 21:41:09 -04:00
2020-06-22 00:10:31 -04:00
.PHONY: clean
clean:
rm -fr bin obj