Implemented build process

This commit is contained in:
Zane Kaminski 2020-06-22 16:02:27 -04:00
parent 45752186ef
commit 3888172c26
2 changed files with 26 additions and 8 deletions

View File

@ -5,13 +5,14 @@ PREFIX=$(RETRO68)/m68k-apple-macos
CC=$(RETRO68)/bin/m68k-apple-macos-gcc
CXX=$(RETRO68)/bin/m68k-apple-macos-g++
OBJCOPY=$(RETRO68)/bin/m68k-apple-macos-objcopy
OBJDUMP=$(RETRO68)/bin/m68k-apple-macos-objdump
REZ=$(RETRO68)/bin/Rez
LDFLAGS=-lRetroConsole
RINCLUDES=$(PREFIX)/RIncludes
REZFLAGS=-I$(RINCLUDES)
all: bin/rdisk.bin
all: bin/rom.bin
obj:
mkdir obj
@ -19,12 +20,29 @@ obj:
bin:
mkdir bin
bin/sym:
mkdir bin/sym
obj/rdisk.o: rdisk.c obj
$(CC) -c -O1 $< -o $@
bin/rdisk.bin: obj/rdisk.o bin
obj/rdisk.s: obj obj/rdisk.o
$(OBJDUMP) -d obj/rdisk.o > obj/rdisk.s
bin/rdisk.bin: bin obj/rdisk.o
$(OBJCOPY) -O binary obj/rdisk.o $@
bin/rom.bin: bin bin/sym bin/rdisk.bin obj/rdisk.s
cp baserom.bin bin/rom.bin
printf '\x18' | dd of=bin/rom.bin bs=1 seek=335168 count=1 conv=notrunc # resource flags
printf '\x4F' | dd of=bin/rom.bin bs=1 seek=335216 count=1 conv=notrunc # driver flags
cat obj/rdisk.s | grep "<.*DiskOpen>\:" | cut -c5-8 | xxd -r -p - | dd of=bin/rom.bin bs=1 seek=335224 count=2 conv=notrunc
cat obj/rdisk.s | grep "<.*DiskPrime>\:" | cut -c5-8 | xxd -r -p - | dd of=bin/rom.bin bs=1 seek=335226 count=2 conv=notrunc
cat obj/rdisk.s | grep "<.*DiskControl>\:" | cut -c5-8 | xxd -r -p - | dd of=bin/rom.bin bs=1 seek=335228 count=2 conv=notrunc
cat obj/rdisk.s | grep "<.*DiskStatus>\:" | cut -c5-8 | xxd -r -p - | dd of=bin/rom.bin bs=1 seek=335230 count=2 conv=notrunc
cat obj/rdisk.s | grep "<.*DiskClose>\:" | cut -c5-8 | xxd -r -p - | dd of=bin/rom.bin bs=1 seek=335232 count=2 conv=notrunc
cat bin/rdisk.bin | dd of=bin/rom.bin bs=1 seek=335244 conv=notrunc
.PHONY: clean
clean:
rm -fr bin obj

12
rdisk.c
View File

@ -21,9 +21,9 @@ OSErr RDiskAddDrive(short drvrRefNum, short drvNum, DrvQElPtr dq) = {0x4840, 0x3
inline char IsRPressed() { return *((char*)0x175) & 0x80; }
inline char ISAPressed() { return *((char*)0x174) & 0x01; }
#define RDiskCopySize (128)
#define Copy24Size (64)
typedef void (*ROMDiskCopy_t)(char *, char *, unsigned long);
void RDiskCopy(char *source, char *dest, unsigned long count) {
void Copy24(char *source, char *dest, unsigned long count) {
char mode = true32b;
SwapMMUMode(&mode);
BlockMove(source, dest, count);
@ -58,7 +58,7 @@ OSErr RDiskOpen(IOParamPtr p, DCtlPtr d) {
if (!d->dCtlStorage) { return openErr; }
// Allocate space for 24-bit copy routine in system heap and move it there
c->copy24_alloc = NewPtrSys(RDiskCopySize);
c->copy24_alloc = NewPtrSys(Copy24Size);
if (!c->copy24_alloc) {
if (d->dCtlStorage) {
HUnlock(d->dCtlStorage);
@ -66,7 +66,7 @@ OSErr RDiskOpen(IOParamPtr p, DCtlPtr d) {
}
return openErr;
}
BlockMove(&RDiskCopy, c->copy24_alloc, RDiskCopySize);
BlockMove(&Copy24, c->copy24_alloc, Copy24Size);
c->copy24 = (ROMDiskCopy_t)StripAddress(c->copy24_alloc);
// Lock our storage struct and get master pointer
@ -91,7 +91,7 @@ OSErr RDiskOpen(IOParamPtr p, DCtlPtr d) {
return noErr;
}
OSErr RDiskInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
static OSErr RDiskInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
char startup, ram;
// Return if initialized. Otherwise mark init done
@ -221,7 +221,7 @@ OSErr RDiskPrime(IOParamPtr p, DCtlPtr d) {
//FIXME: Should we fail if cmd isn't read or write?
}
OSErr RDiskAccRun(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
static OSErr RDiskAccRun(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
// Disable accRun
d->dCtlDelay = 0;
d->dCtlFlags &= ~dNeedTimeMask;