makeadf borks on big files
This commit is contained in:
parent
ef03eb68bb
commit
1562e0894b
|
@ -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 "| |_/ / /_\ \\\\\ \`--.\ \`--.| |__ | | | | "
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 <image data>\n", argv[0]);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue