mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-10-06 07:45:44 +00:00
makeadf borks on big files
This commit is contained in:
@@ -6,6 +6,7 @@ include ../../shared/tools.mk
|
|||||||
test: $(PROGRAM)
|
test: $(PROGRAM)
|
||||||
$(PROGRAM) reference/bootblock.bin > out/test.adf
|
$(PROGRAM) reference/bootblock.bin > out/test.adf
|
||||||
diff reference/test.adf 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 "| ___ \/ _ \ / ___/ ___| ___| _ \ "
|
@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.
|
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)
|
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.
|
||||||
|
|||||||
+18
-12
@@ -45,22 +45,28 @@ int main(int argc,char *argv[])
|
|||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
if ((f = fopen(argv[1],"rb"))) {
|
if ((f = fopen(argv[1],"rb"))) {
|
||||||
len = fread(image,1,DISKSIZE,f);
|
len = fread(image,1,DISKSIZE,f);
|
||||||
if (len > 0) {
|
char temp;
|
||||||
if (len < DISKSIZE) {
|
if (fread(&temp,1,1,f) != 0) {
|
||||||
memset(image+len,0,DISKSIZE-len);
|
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
|
} else {
|
||||||
fprintf(stderr,"%s: image read error!\n", argv[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf(stderr,"%s: file to open open %s\n", argv[0], argv[1]);
|
fprintf(stderr,"%s: file to open open %s\n", argv[0], argv[1]);
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
fprintf(stderr,"usage: %s <image data>\n", argv[0]);
|
fprintf(stderr,"usage: %s <image data>\n", argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user