rcamp48 Posted January 19, 2022 Share Posted January 19, 2022 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. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted January 19, 2022 Share Posted January 19, 2022 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 1 Quote Link to comment Share on other sites More sharing options...
351coug Posted January 19, 2022 Share Posted January 19, 2022 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 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted January 19, 2022 Share Posted January 19, 2022 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. Quote Link to comment Share on other sites More sharing options...
rcamp48 Posted January 19, 2022 Author Share Posted January 19, 2022 (edited) 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 January 19, 2022 by rcamp48 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted January 19, 2022 Share Posted January 19, 2022 You are trying to create an array of 92176 bytes on a 64K machine unless your using a RAM disk ? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted January 19, 2022 Share Posted January 19, 2022 (edited) 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 January 19, 2022 by TGB1718 Quote Link to comment Share on other sites More sharing options...
ivop Posted January 19, 2022 Share Posted January 19, 2022 1 hour ago, TGB1718 said: You are trying to create an array of 92176 bytes on a 64K machine unless your using a RAM disk ? It's QB64/Quick Basic and runs Windows, Linux and macOS. It's not run on the Atari itself. Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted January 19, 2022 Share Posted January 19, 2022 Thanks, didn't realise that Quote Link to comment Share on other sites More sharing options...
bfollowell Posted January 19, 2022 Share Posted January 19, 2022 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. Quote Link to comment Share on other sites More sharing options...
+DjayBee Posted January 19, 2022 Share Posted January 19, 2022 Create a file with only the header and then in CMD copy /b headerfile + file.xfd file.atr Quote Link to comment Share on other sites More sharing options...
E474 Posted January 19, 2022 Share Posted January 19, 2022 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! Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted January 19, 2022 Share Posted January 19, 2022 Sure, here's what I have, downloaded from Nick Kennedy's site donkeys years ago. SIO2PC.zip Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted January 19, 2022 Share Posted January 19, 2022 44 minutes ago, DjayBee said: Create a file with only the header and then in CMD copy /b headerfile + file.xfd file.atr I tend to go overboard here and prefix each file with /b, or does just one up front cover all? Quote Link to comment Share on other sites More sharing options...
+DjayBee Posted January 19, 2022 Share Posted January 19, 2022 dunno for sure but why not DOS's been a while Quote Link to comment Share on other sites More sharing options...
ivop Posted January 19, 2022 Share Posted January 19, 2022 (edited) 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 January 19, 2022 by ivop Quote Link to comment Share on other sites More sharing options...
E474 Posted January 19, 2022 Share Posted January 19, 2022 @TGB1718 Thanks! Quote Link to comment Share on other sites More sharing options...
rcamp48 Posted January 19, 2022 Author Share Posted January 19, 2022 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 1 1 Quote Link to comment Share on other sites More sharing options...
rcamp48 Posted January 20, 2022 Author Share Posted January 20, 2022 (edited) I now have a catalog disk for the Kwest Library, Library disks 1 are ready, but I want to add Library 2 before releasing it. Russ Kwest Library Index One.atr Kwest Library IndexTwo.atr Edited January 20, 2022 by rcamp48 1 Quote Link to comment Share on other sites More sharing options...
1050 Posted January 21, 2022 Share Posted January 21, 2022 (edited) 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 January 21, 2022 by 1050 credited the wrong guy Quote Link to comment Share on other sites More sharing options...
tschak909 Posted January 21, 2022 Share Posted January 21, 2022 @rcamp48 I am glad you were able to put something together. -Thom Quote Link to comment Share on other sites More sharing options...
rcamp48 Posted January 21, 2022 Author Share Posted January 21, 2022 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. Quote Link to comment Share on other sites More sharing options...
Marsupilami Posted September 17, 2022 Share Posted September 17, 2022 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.