diff --git a/tools/makeadf/Makefile b/tools/makeadf/Makefile index 83b2e1d..e475355 100644 --- a/tools/makeadf/Makefile +++ b/tools/makeadf/Makefile @@ -6,6 +6,7 @@ include ../../shared/tools.mk test: $(PROGRAM) $(PROGRAM) reference/bootblock.bin > out/test.adf diff reference/test.adf out/test.adf + $(PROGRAM) reference/big.bin > out/big.adf; if [ $$? -eq 2 ] ; then echo "Correctly determined that inut will not fit on a floppy..."; else (exit 2); fi @echo "______ ___ _____ _____ ___________ " @echo "| ___ \/ _ \ / ___/ ___| ___| _ \ " @echo "| |_/ / /_\ \\\\\ \`--.\ \`--.| |__ | | | | " diff --git a/tools/makeadf/README.md b/tools/makeadf/README.md index 7cb5cb9..55ba31e 100644 --- a/tools/makeadf/README.md +++ b/tools/makeadf/README.md @@ -6,3 +6,5 @@ The simplest form of ADF creation. Disk layout must be handled by the assembler/linker. This tool only calculates the checksum and pads the disk image to the correct size. This code is taken from [this forum post](http://eab.abime.net/showpost.php?p=895070&postcount=6) + +Slightly modified to bork if the input file exceeds the standard amiga disk size. diff --git a/tools/makeadf/makeadf.c b/tools/makeadf/makeadf.c index 84d40b6..b0148f2 100644 --- a/tools/makeadf/makeadf.c +++ b/tools/makeadf/makeadf.c @@ -45,22 +45,28 @@ int main(int argc,char *argv[]) if (argc == 2) { if ((f = fopen(argv[1],"rb"))) { len = fread(image,1,DISKSIZE,f); - if (len > 0) { - if (len < DISKSIZE) { - memset(image+len,0,DISKSIZE-len); + char temp; + if (fread(&temp,1,1,f) != 0) { + fprintf(stderr, "%s: input data will not fit on a floppy!\n", argv[0]); + rc = 2; + } else { + if (len > 0) { + if (len < DISKSIZE) { + memset(image+len,0,DISKSIZE-len); + } + boot_chksum(image); + fwrite(image,1,DISKSIZE,stdout); + rc = 0; + } else { + fprintf(stderr,"%s: image read error!\n", argv[0]); } - boot_chksum(image); - fwrite(image,1,DISKSIZE,stdout); - rc = 0; } - else - fprintf(stderr,"%s: image read error!\n", argv[0]); - } - else + } else { fprintf(stderr,"%s: file to open open %s\n", argv[0], argv[1]); - } - else + } + } else { fprintf(stderr,"usage: %s \n", argv[0]); + } return rc; } diff --git a/tools/makeadf/reference/big.bin b/tools/makeadf/reference/big.bin new file mode 100755 index 0000000..e664237 Binary files /dev/null and b/tools/makeadf/reference/big.bin differ