2020-06-22 04:10:31 +00:00
|
|
|
# path to RETRO68
|
|
|
|
RETRO68=/Users/zane/Retro68-build/toolchain
|
|
|
|
|
|
|
|
PREFIX=$(RETRO68)/m68k-apple-macos
|
2020-06-26 07:12:08 +00:00
|
|
|
AS=$(RETRO68)/bin/m68k-apple-macos-as
|
2020-06-22 04:10:31 +00:00
|
|
|
CC=$(RETRO68)/bin/m68k-apple-macos-gcc
|
2020-06-24 16:46:30 +00:00
|
|
|
LD=$(RETRO68)/bin/m68k-apple-macos-ld
|
2020-06-22 04:10:31 +00:00
|
|
|
OBJCOPY=$(RETRO68)/bin/m68k-apple-macos-objcopy
|
2020-06-22 20:02:27 +00:00
|
|
|
OBJDUMP=$(RETRO68)/bin/m68k-apple-macos-objdump
|
2020-06-22 04:10:31 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
all: bin/rom2M.bin bin/rom8M.bin obj/rdisk1M5.s obj/rdisk7M5.s obj/driver1M5.s obj/driver7M5.s obj/entry_rel.sym obj/driver_abs.sym
|
2020-06-22 04:10:31 +00:00
|
|
|
|
|
|
|
obj:
|
|
|
|
mkdir obj
|
|
|
|
|
|
|
|
bin:
|
|
|
|
mkdir bin
|
|
|
|
|
2020-06-24 16:46:30 +00:00
|
|
|
|
2020-06-26 07:12:08 +00:00
|
|
|
obj/entry.o: entry.s obj
|
|
|
|
$(AS) $< -o $@
|
2020-06-24 16:46:30 +00:00
|
|
|
|
2020-06-26 07:12:08 +00:00
|
|
|
obj/entry_rel.sym: obj obj/entry.o
|
|
|
|
$(OBJDUMP) -t obj/entry.o > $@
|
2020-06-24 16:46:30 +00:00
|
|
|
|
2020-06-22 20:02:27 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/rdisk1M5.o: rdisk.c obj
|
|
|
|
$(CC) -DRDiskSize=1572864 -c -Os $< -o $@
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/rdisk7M5.o: rdisk.c obj
|
|
|
|
$(CC) -DRDiskSize=7864320 -c -Os $< -o $@
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/rdisk1M5.s: obj obj/rdisk1M5.o
|
|
|
|
$(OBJDUMP) -d obj/rdisk1M5.o > $@
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/rdisk7M5.s: obj obj/rdisk7M5.o
|
|
|
|
$(OBJDUMP) -d obj/rdisk1M5.o > $@
|
2020-06-24 20:58:40 +00:00
|
|
|
|
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/driver1M5.o: obj obj/entry.o obj/rdisk1M5.o
|
|
|
|
$(LD) -Ttext=40851D70 -o $@ obj/entry.o obj/rdisk1M5.o
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/driver7M5.o: obj obj/entry.o obj/rdisk7M5.o
|
|
|
|
$(LD) -Ttext=40851D70 -o $@ obj/entry.o obj/rdisk7M5.o
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/driver1M5.s: obj obj/driver1M5.o
|
|
|
|
$(OBJDUMP) -d obj/driver1M5.o > $@
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/driver7M5.s: obj obj/driver7M5.o
|
|
|
|
$(OBJDUMP) -d obj/driver7M5.o > $@
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-07-31 21:04:20 +00:00
|
|
|
obj/driver_abs.sym: obj obj/driver1M5.o
|
|
|
|
$(OBJDUMP) -t obj/driver1M5.o > $@
|
|
|
|
|
|
|
|
|
|
|
|
bin/driver1M5.bin: bin obj/driver1M5.o
|
|
|
|
$(OBJCOPY) -O binary obj/driver1M5.o $@
|
|
|
|
|
|
|
|
bin/driver7M5.bin: bin obj/driver7M5.o
|
|
|
|
$(OBJCOPY) -O binary obj/driver7M5.o $@
|
|
|
|
|
|
|
|
|
|
|
|
bin/rom2M.bin: baserom.bin RDisk1M5.dsk bin bin/driver1M5.bin obj/driver_abs.sym obj/entry_rel.sym
|
|
|
|
cp baserom.bin $@ # Copy base rom
|
|
|
|
# Patch driver
|
|
|
|
dd if=bin/driver1M5.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
|
|
|
|
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=RDisk1M5.dsk of=$@ bs=1024 seek=512 count=1536 conv=notrunc # copy disk image
|
|
|
|
|
|
|
|
bin/rom8M.bin: baserom.bin RDisk7M5.dsk bin bin/driver7M5.bin obj/driver_abs.sym obj/entry_rel.sym
|
2020-06-30 01:08:50 +00:00
|
|
|
cp baserom.bin $@ # Copy base rom
|
|
|
|
# Patch driver
|
2020-07-31 21:04:20 +00:00
|
|
|
dd if=bin/driver7M5.bin of=$@ bs=1 seek=335248 skip=32 conv=notrunc # Copy driver code
|
2020-06-24 21:13:57 +00:00
|
|
|
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 07:12:08 +00: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
|
2020-07-31 21:04:20 +00:00
|
|
|
dd if=RDisk7M5.dsk of=$@ bs=1024 seek=512 count=7680 conv=notrunc # copy disk image
|
|
|
|
|
2020-06-24 20:58:40 +00:00
|
|
|
|
2020-06-22 04:10:31 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -fr bin obj
|