[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NIB and DSK questions



Egan Ford wrote:
> 1.  Is there a CLI tool (with source, preferably POSIX) that will
> convert unprotected NIB to DSK?  I've searched and have not found much
> (with links that still exist).  BTW, is there a NIB format description
> floating around anywhere?
> 
> 2.  From time to time I encounter a DSK file that is not 143360 in
> length.  Is the assumption that the rest of the file is zeros?
> 
> Thanks.
>

Here's a program for item 2.  I used this make some very old partial DSK
files somewhat to mostly usable again.
To build and use it:

make zerofill
/zerofill < undersized.dsk > therightsize.dsk

http://hoop-la.ca/apple2/src/zerofill.c

#include <stdio.h>

#define DISK_LENGTH 143360

int main(int argc, char * argv[])
{
	int c;
	int i;
	int not_end_of_file;

	not_end_of_file = 1;
	for (i = 0; i < DISK_LENGTH; i++) {
		if (not_end_of_file) {
			c = getchar();
			if (c == EOF) {
				c = not_end_of_file = 0;
			}
		}
		putchar(c);
	}
	
	return 0;
}