Author Topic: Russ's XFD to ATR Converter  (Read 3423 times)

0 Members and 1 Guest are viewing this topic.

Offline rcamp48

  • Newbie
  • Posts: 62
    • View Profile
Russ's XFD to ATR Converter
« on: January 19, 2022, 04:15:06 pm »
I have successfully written an XFD to ATR converter for the PC for those Atari 8 Bit XFD files. The program is fairly fast , it will convert 180 programs in under 10 seconds. I am including both the zip file and the code, the zip file has the executable and source code, and the two directories that were used.

 
Code: QB64: [Select]
  1. Dim temp$(92160)
  2. Dim TEMP2$(92176)
  3. Dim HEADER$(16)
  4. Dim file$(50)
  5. Dim file2$(50)
  6. Dim path1$(120)
  7. Dim path2$(120)
  8. Color 1, 6
  9. start:
  10. Print "Quick and easy XFD to ATR Converter"
  11. Print "Written by Russ Campbell"
  12. Print "Copyright (c) 2022"
  13. Print "When entering your paths below"
  14. Print "Don't forget your drive [c:\XFD\]"
  15. Print "And don't forget proper ':' and  '\s' as above"
  16. Input "Please Enter your path for XFDs : ", path1$
  17. If Mid$(path1$, 2, 1) <> ":" Then
  18.     Print "Missing the ':' Character, try again."
  19.     Print "Press any key..."
  20.     Do While InKey$ = ""
  21.     Loop
  22.     GoTo start
  23. If Mid$(path1$, 3, 1) <> "\" Or Mid$(path1$, (Len(path1$))) <> "\" Then
  24.     Print "Missing the '\' Character, try again."
  25.     Print "Press any key..."
  26.     Do While InKey$ = ""
  27.     Loop
  28.     GoTo start
  29.  
  30. Input "Please Enter your path for ATRs : ", path2$
  31. If Mid$(path2$, 2, 1) <> ":" Then
  32.     Print "Missing the ':' Character, try again."
  33.     Print "Press any key"
  34.     Do While InKey$ = ""
  35.     Loop
  36.     GoTo start
  37. If Mid$(path2$, 3, 1) <> "\" Or Mid$(path2$, (Len(path2$))) <> "\" Then
  38.     Print "Missing the '\' Character, try again."
  39.     Print "Press any key"
  40.     Do While InKey$ = ""
  41.     Loop
  42.     GoTo start
  43.  
  44. header$ = "0000000000000000"
  45. For i = 1 To 16
  46.     Read x
  47.     Mid$(header$, i, 1) = Chr$(x)
  48. Data 150,2,128,22,128,0,0,0,0,0,0,0,0,0,0,0
  49. Shell _Hide Chr$(34) + "dir /b " + path1$ + "*.xfd >directory.txt" + Chr$(34)
  50. Open "directory.txt" For Input As #1
  51.  
  52.  
  53.  
  54.     Input #1, a$
  55.     file$ = a$
  56.     'On Error GoTo FINISH
  57.  
  58.     Open path1$ + file$ For Binary As #2
  59.     temp$ = Space$(LOF(2)) 'set temp$ to be the size of the file, if you want to get the whole thing at once.
  60.     Get #2, , temp$ 'get the whole array
  61.     Close #2
  62.     temp2$ = header$ + temp$
  63.     file2$ = file$
  64.  
  65.     Mid$(file2$, (Len(file2$) - 3), 4) = ".atr"
  66.     Print "Header added to "; path1$; file$
  67.     Print "Saved as       "; path2$; file2$
  68.     Print "Length of "; file2$; " = "; Len(temp2$)
  69.     Open path2$ + file2$ For Binary As #2
  70.     Put #2, , temp2$
  71.  
  72.  
  73.     Close #2
  74.  
  75. FINISH:
  76. Print "Program finished, if you reached this in error "
  77. Print "Check your xfd and atr paths."
  78. Shell _Hide Chr$(34) + "erase directory.txt" + Chr$(34)
  79.  
  80.  
Russ Campbell
rcamp48@rogers.com
BBS Files Programmer