forum home page
register faq member list calendar search
MacShock.com - Apple Forums
Reload this Page
Old 02-07-2012, 04:30 AM
Egan Ford
Guest
 
Posts: n/a
Default NIB and DSK questions

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.
  Reply With Quote
Old 02-07-2012, 04:30 AM
BLuRry
Guest
 
Posts: n/a
Default NIB and DSK questions

1: I don't have one handy but if you don't mind java, I can make one for you. JACE has all the necessary routines to do the conversion for you so it would really not be too much of a burden.

2: I believe that most interpretations will just ignore the trailing part -- but I have seen some HDV/2mg images with the wrong extension. When in doubt, open it up and see if there is any sort of header (which would indicate 2mg). Secondly, check that it doesn't just have a lot of trailing zeros.If the file size is a multiple of 512 bytes then it might be a HDV image in disguise.
  Reply With Quote
Old 02-07-2012, 04:30 AM
Egan Ford
Guest
 
Posts: n/a
Default NIB and DSK questions

On Feb 5, 10:44*am, BLuRry <brendan.rob...@gmail.com> wrote:
> 1: I don't have one handy but if you don't mind java, I can make one for you. *JACE has all the necessary routines to do the conversion for you soit would really not be too much of a burden.
> 2: I believe that most interpretations will just ignore the trailing part-- but I have seen some HDV/2mg images with the wrong extension. *When in doubt, open it up and see if there is any sort of header (which would indicate 2mg). *Secondly, check that it doesn't just have a lot of trailing zeros. *If the file size is a multiple of 512 bytes then it might be a HDV image in disguise.


1. Thanks! I do not mind java as long as Ubuntu does not. :-)
2. Got it. Thanks.
  Reply With Quote
Old 02-07-2012, 04:30 AM
BLuRry
Guest
 
Posts: n/a
Default NIB and DSK questions

Ubuntu doesn't care for Oracle's shenanigans. But otherwise, Java works fine and OpenJDK seems to agree with JACE just fine. I'll update you when I have something to play with.

-Brendan
  Reply With Quote
Old 02-07-2012, 04:30 AM
BLuRry
Guest
 
Posts: n/a
Default NIB and DSK questions

Ok, grab the new build of JACE from sourceforge. Since this is not the default startup class you'll have to use an alternate way of starting Java to get to it, namely:

java -cp jace.jar jace.ConvertDiskImage

I haven't tested it yet (out the door for a gathering with friends) but please let me know if it works for you!

Note: THIS VERSION HAS MOUSE SUPPORT!! w00t!!!

-Brendan
  Reply With Quote
Old 02-07-2012, 04:30 AM
Egan Ford
Guest
 
Posts: n/a
Default NIB and DSK questions

On Feb 5, 3:46*pm, BLuRry <brendan.rob...@gmail.com> wrote:
> Ok, grab the new build of JACE from sourceforge. *Since this is not thedefault startup class you'll have to use an alternate way of starting Javato get to it, namely:
>
> java -cp jace.jar jace.ConvertDiskImage
>
> I haven't tested it yet (out the door for a gathering with friends) but please let me know if it works for you!
>
> Note: THIS VERSION HAS MOUSE SUPPORT!! w00t!!!
>
> -Brendan


Thanks. I think you need to change:

if (in.exists()) {

to:

if (!in.exists()) {
  Reply With Quote
Old 02-07-2012, 04:30 AM
BLuRry
Guest
 
Posts: n/a
Default NIB and DSK questions

Man, you are right. Bad validation. Sorry for not testing it -- was literally out the door after writing the core of the tool. I've done some testing and kicked out some rather silly bugs. Seems to work fine now AFAIK andI've committed code and updated the sourceforge download to this fixed copy.

As I said, it basically takes advantage of the fact that JACE already performs conversion to and from NIB formats as part of emulating the disk drive,since the raw NIB format is required for proper disk drive emulation but to support writes, it has to convert the raw data back per track on the fly.Converting a DSK or PO to NIB file is simply a matter of creating the FloppyDisk object and grabbing the generated NIB byte array. Converting NIB to DSK is a little more interesting: I read in the disk as a NIB and then Ichange the disk file to the output file and monkey with the variables thattell JACE what kind of disk image it is. Once I loop through all tracks to flag them to be written, JACE converts the data and saves it as appropriate, respecting the desired sector ordering.

------------

ConvertDiskImage
----------------
Usage: java -cp jace.jar jace.ConvertDiskImage DISK_INPUT_NAME DISK_OUTPUT_NAME
where DISK_INPUT_NAME is the path of a valid disk image,
and DISK_OUTPUT_NAME is the path where you want to
save the converted disk image.
Supported input formats:
DSK (assumes DO), DO, PO, 2MG (140kb), NIB
Supported output formats:
DO/DSK, PO, NIB
-------

-B
  Reply With Quote
Old 02-07-2012, 04:30 AM
Egan Ford
Guest
 
Posts: n/a
Default NIB and DSK questions

On Feb 5, 10:24*pm, BLuRry <brendan.rob...@gmail.com> wrote:
> Man, you are right. *Bad validation. *Sorry for not testing it -- wasliterally out the door after writing the core of the tool. *I've done some testing and kicked out some rather silly bugs. *Seems to work fine nowAFAIK and I've committed code and updated the sourceforge download to thisfixed copy.
>
> As I said, it basically takes advantage of the fact that JACE already performs conversion to and from NIB formats as part of emulating the disk drive, since the raw NIB format is required for proper disk drive emulation butto support writes, it has to convert the raw data back per track on the fly. *Converting a DSK or PO to NIB file is simply a matter of creating theFloppyDisk object and grabbing the generated NIB byte array. *ConvertingNIB to DSK is a little more interesting: *I read in the disk as a NIB and then I change the disk file to the output file and monkey with the variables that tell JACE what kind of disk image it is. *Once I loop through all tracks to flag them to be written, JACE converts the data and saves it asappropriate, respecting the desired sector ordering.
>
> ------------
>
> ConvertDiskImage
> ----------------
> Usage: java -cp jace.jar jace.ConvertDiskImage DISK_INPUT_NAME DISK_OUTPUT_NAME
> where DISK_INPUT_NAME is the path of a valid disk image,
> and DISK_OUTPUT_NAME is the path where you want to
> save the converted disk image.
> Supported input formats:
> * * * * DSK (assumes DO), DO, PO, 2MG (140kb), NIB
> Supported output formats:
> * * * * DO/DSK, PO, NIB
> -------
>
> -B


Command runs, but the output is wrong. NIB->DSK, the DSK file is the
same size as the NIB file (232960). It should be 143360.

Thanks again.
  Reply With Quote
Old 02-07-2012, 04:30 AM
BLuRry
Guest
 
Posts: n/a
Default NIB and DSK questions

Odd... I'll take another look at it. Sorry for the mixup. DSK->NIB seems to work at least. :->
  Reply With Quote
Old 02-07-2012, 04:30 AM
schmidtd
Guest
 
Posts: n/a
Default NIB and DSK questions

On Feb 5, 11:30*am, Egan Ford <dataj...@gmail.com> 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?


Looks like BLuRry took care of you there. But what do you have an
unprotected .NIB for in the first place? I can imagine their use in
preserving a volume number. But if the .NIB had anything significant
in it (different headers, etc.) the .DSK you convert it to won't be of
much use.

A .NIB captures all of the nibbles on a track - including all those
headers, and data in whatever encoding scheme is in force (see Beyond
DOS or ProDOS for encoding descriptions). It's a de-facto standard
that started with the SST tool. Most emulators take a .DSK and expand
it into a .NIB anyway - which is why Brendan had such an easy time
making the conversion external.

> 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?


No such assumption of any kind is made. If they're not 143360,
they're bad - or they're not an undecorated .dsk/.do/.po. Like
Brendan said, inspection usually will show you what the problem is.
I've seen random garbage at the end of too-long images, and if they're
short... zeroes are your only option.
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:17 PM.
Copyright ©2007-2008 MacShock.com. Powered by vBulletin
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.