Jump to content
IGNORED

XFD to ATR Converter Needed


Recommended Posts

17 minutes ago, rcamp48 said:

I am looking for a quick way of converting all of my 200 XFD files into ATRS , preferably with Windows 10, or a way of reading XFDs into Fujinet. For some reason Fujinet does not open XFD files.

 

Until somebody adds a XFD media type, you may have to engineer something.

 

The XFD file format is header-less, it just has the sectors dumped (with the first three being 128 bytes, the rest being either 128 or 256 bytes in length)

 

The disk type is determined by the file size.

 

and once the disk type is determined, a header can be pre-pended to the disk image, e.g. for 90K disks:

96 02 80 16 80 00 00 00  00 00 00 00 00 00 00 00

 

96 02 = checksum for NICKATARI

80 16 = 5,760 paragraphs in size (92160 * 128)

80 = sector size 128 bytes

00 = high byte of disk size (used for very large disks)

00 00 = 16-bit CRC (pretty much ignored by everybody)

00 = unused

00 = bit 10 is used by APE to denote read only disks, otherwise unused.

00 00 00 00 00 00 = unused

 

For those who want to implement a media type in fujinet, you can copy diskTypeAtr and base your code on that:

https://github.com/FujiNetWIFI/fujinet-platformio/blob/master/lib/media/atari/diskTypeAtr.cpp

 

and add the new media type to disktype.cpp:

https://github.com/FujiNetWIFI/fujinet-platformio/blob/master/lib/media/atari/diskType.cpp

 

  • Like 1
Link to comment
Share on other sites

you could use an emulator (altirra), load the image , then save as X, different image type. atari800winplus has a misc pulldown that does a direct conversion. 

I have used this tool for long time , no idea if it works in w10 . also no idea if there is a tool that will batch convert disk.

 for some reason i cant attach it . it is atrutil by ken siders

Link to comment
Share on other sites

7 hours ago, tschak909 said:

80 16 = 5,760 paragraphs in size (92160 * 128)

Don't think that's quite right:-

From Nick Kennedy's document

 

STRUCTURE OF AN SIO2PC ATARI DISK IMAGE:

It's extremely simple. There is first a 16 byte header with the following 
information:

WORD = special code* indicating this is an Atari disk file
WORD = size of this disk image, in paragraphs (size/16)
WORD = sector size. (128 or 256) bytes/sector
WORD = high part of size, in paragraphs (added by REV 3.00)
BYTE = disk flags such as copy protection and write protect; see copy 
protection chapter.
WORD=1st (or typical) bad sector; see copy protection chapter.
SPARES 5 unused (spare) header bytes (contain zeroes)

After the header comes the disk image. This is just a continuous string of 
bytes, with the first 128 bytes being the contents of disk sector 1, the 
second being sector 2, etc.

* The "code" is the 16 bit sum of the individual ASCII values of the 
string of bytes: "NICKATARI". If you try to load a file without this first 
WORD, you get a "THIS FILE IS NOT AN ATARI DISK FILE" error 
message. Try it.

Link to comment
Share on other sites

Here is the QB64 routine that I am using to pad the extra header on the file:

 

Dim myarray(1 To 92176) As String * 92176
header$ = "96028016800000000000000000000000"
Open "KWEST01B.XFD" For Binary As #1
Get #1, , temp$ 'get the whole array
myarray() = temp$
Close
For i = 1 To 92176
    Print Hex$(Asc(myarray()));
Next


Open "KWEST01B.XFD" For Binary As #1
For i = LBound(myarray) To UBound(myarray)
    junk$ = temp$
    myarray() = junk$
Next
junk$ = myarray()
Put #1, , junk$
Close

 

Edit: I don't think this is quite right as all I get is 20s in hex


 

Edited by rcamp48
Link to comment
Share on other sites

just had a thought, easy way to do this using Windows, open the .XFD in a hex editor and

insert the header, then save as .ATR

 

Just download HxD Hex Editor, load your disk, make sure the cursor is on

the first byte, then on the edit menu select "Insert Bytes" and choose Dec and type 16 then OK

 

then just type the values you want in those new 16 bytes :)

 

If you copy the new 16 bytes, then use "Paste Insert" on the next disk you do (saves the typing )

 

https://mh-nexus.de/en/

Edited by TGB1718
Link to comment
Share on other sites

1 hour ago, TGB1718 said:

just had a thought, easy way to do this using Windows, open the .XFD in a hex editor and

insert the header, then save as .ATR

 

Just download HxD Hex Editor, load your disk, make sure the cursor is on

the first byte, then on the edit menu select "Insert Bytes" and choose Dec and type 16 then OK

 

then just type the values you want in those new 16 bytes :)

 

If you copy the new 16 bytes, then use "Paste Insert" on the next disk you do (saves the typing )

 

https://mh-nexus.de/en/


I think he’s looking for an easy way to do it quickly like some sort of bat batch operation.

 

If he needs to open each image file separately, he might as well load them in an emulator and save them as atrs. I’m pretty sure at least one popular emulator will let you do this, but I fail to remember which one at the moment.

 

Link to comment
Share on other sites

Hi,

 

    Can you use imagic from: https://www.atarimax.com/ - there's an msdos version (and windows), so maybe the dos version can be put in a .bat file (not tried this myself).

 

  Also, @TGB1718, would you mind sharing the Nick Kennedy document, I'm curious about what's in the copy protection chapter, the only link I have worked from is at: https://www.atarimax.com/jindroush.atari.org/afmtatr.html - but if there is more extensive info I'd appreciate a link, etc.

 

   Thanks!

Link to comment
Share on other sites

I suppose CMD or PowerShell can easily loop over all the *.xfd files, no?

 

Or install WSL(2), run bash, and do:

for i in *.xfd ; do
	j=`basename "$i" .xfd`.atr
	cat header "$i" > "$j"
done

Or .XFD and .ATR for non-case file systems, or if your files are still named as such.

 

Edited by ivop
Link to comment
Share on other sites

I have an easy solution that I wrote in QB64 , it takes the header and scans your directorie(s) for xfd files, it then writes them out as proper atrs

The program is easy to use and works good on all xfds I will add a check to see if the length is alreasdy 92176 instead of 92160 that is not hard to do, 

you would not want to patch a file that is already patched. Also included are the original XFD files from the KWEST library and the created ATR files

from the program. 

 

The program is written so that you can patch your own files in your own directories, and looks for ':"s and '\"s in your path names. Almost fool proof.

Here is the program and all of the xfd and atr files... Russ's XFD To ATR Converter.ZIP

 

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 1/19/2022 at 10:01 AM, Wrathchild said:

I tend to go overboard here and prefix each file with /b, or does just one up front cover all?

It's the binary switch so the copy executable can't treat any of them as a text file, once up front is all it takes and no take backs either. So doing it more is probably just ignored anyway.

 

A proper batch file might be able to judge the size of the target file and assign the proper header to it making it capable of doing an entire folder of all sizes at one go. And batch when MS went with NT operating systems just became insanely even more powerful and useful. So much so I would have to lurk in those old forums for few days to even feel like I might have an idea of how to go about it now.

 

And it looks like Russ Campbell did some of his QB magic and there is a solution now anyway.

Edited by 1050
credited the wrong guy
Link to comment
Share on other sites

17 hours ago, 1050 said:

It's the binary switch so the copy executable can't treat any of them as a text file, once up front is all it takes and no take backs either. So doing it more is probably just ignored anyway.

 

A proper batch file might be able to judge the size of the target file and assign the proper header to it making it capable of doing an entire folder of all sizes at one go. And batch when MS went with NT operating systems just became insanely even more powerful and useful. So much so I would have to lurk in those old forums for few days to even feel like I might have an idea of how to go about it now.

 

And it looks like Russ Campbell did some of his QB magic and there is a solution now anyway.

I use that binary switch in my QB64 program as a silent batch file command anyways , but I just use it to create a basic list.

Link to comment
Share on other sites

  • 7 months later...
On 1/19/2022 at 9:28 PM, rcamp48 said:

The program is written so that you can patch your own files in your own directories, and looks for ':"s and '\"s in your path names. Almost fool proof.

Here is the program and all of the xfd and atr files... Russ's XFD To ATR Converter.ZIP

 

Hello,
thank you for the program.

I have a problem to enter the path of XFD files with a windows and a French keyboard : It's impossible to send the "\" key. Normally it is with "Alt Gr "+"8". I also tried with "Alt Gr "+"92" but same problem.
Any idea ? 
Thanks :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...