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

Re: NIB and DSK questions



David Schmidt wrote:
On 2/8/2012 8:41 PM, Egan Ford wrote:

On 2/8/12 2:49 PM, Linards Ticmanis wrote:

On 02/08/2012 06:40 PM, Egan Ford wrote:

I wanted to avoid this, but perhaps I need to create a nibble writer.
Is there any Apple ASM code floating around that I can look at?


NIB depends on an emulated Disk II controller that always reads whole
bytes at a time. It has too little information to work on a real Disk II
(or other Apple 5.25") controller that reads data bit by bit, assembling
them to bytes with the help of those special, longer "sync" bytes.

Also, the tracks of (most) NIBs are longer than real floppy tracks so
you have to know what to truncate, a problem for which there is probably
no fully automatic solution.

These two problems prevent a general solution.

Once you manage to throw out the garbage/duplicate data and to guess
correctly which bytes are "sync", writing it back to a real disk is
eminently possible with a fairly short assembler loop construct. I did
it once and used a mixture of assembler and C (cc65 compiled) to write
the disk. I can send you the code if you're interested, I think it's
originally from "Beyond Apple DOS" or some similar book.


Please do. Thanks.


My first reaction - "it's been tried, you can't do it."

After sleeping on it, my reaction is now - "that's probably why you should try."

The code in ADTPro that does the nibble track analysis, finds the gap, etc. is here: http://adtpro.cvs.sourceforge.net/viewvc/adtpro/adtpro/org/adtpro/NibbleBufferMap.java?revision=1.9&view=markup

You'll find a number of files starting with Nibble in that directory that do the various bits of processing. Gerard Putter's A2V2 (an ADT derivative) can do the nibble reading; that code is also in the most recent CVS snapshot here: http://adtpro.cvs.sourceforge.net/viewvc/adtpro/adtpro/client/src/dos/adt.s?revision=1.18&view=markup

The only reliable nibble reading is in A2V2, though, not my code. There isn't any nibble write in either code base. See:
http://www.virtualii.com/A2V2Help/A2V2Help.html

The very earliest versions of popular bit copiers were pure nibble
copiers--like Locksmith 1.0, Nibbles Away, etc.

These programs read each track into a large buffer (more than one
revolution), then searched for the large gap (usually the end of
the track) and wrote the data between the two large gaps to the
target disk, assuming that the nibbles between epilogs and prologs
were self-sync nibbles.

Since a .nib image represents track data without sync identification,
just as early nibble copiers, it has the same information as those
copiers had.  This data can be written to a disk with essentially the
same result as the early nibble copiers.

So, assuming that the .nib contained enough information to successfully
run the program, the nibble-written disk should also be usable.

Of course, if the protection scheme used more information than was
captured in the .nib, the disk would be detected as a copy, but
that's just the way it is...

There is one complication that must be dealt with in writing the
nibbles to a disk:  the speed of the target disk must be slow
enough to fit all the relevant nibbles, and, if a rotation is
somewhat longer than the track data, provision must be made for
padding the nibbles with something that will not cause problems.

Typically, writing a lot of additional sync nibbles before writing
the track data will do the job.

-michael

NadaNet 3.1 for Apple II parallel computing!
Home page:  http://home.comcast.net/~mjmahon/

"The wastebasket is our most important design
tool--and it's seriously underused."