Jump to content
IGNORED

Repairing / modifying ATX images


DjayBee

Recommended Posts

Hi,

is there some software to modify ATX files?

Short story:
- Replace a bit-rotten sector with its good original
- Overwrite several good tracks of an ATX with content from a different ATR

Long story:
Kevin Savetz found an educational title from Sunburst Communications (Survival Math) but has only plain sector copies of the two disks.
Recently I found an ATX of disk 1 on Atarimania, but it obviously contains one bad sector which should not be bad.

By taking data from both images of disk 1 and cracking the protection I was able to make a working copy of it.

Since Sunburst used the exact same protection down to the location on disk for several disks, I was also able to make a working crack of disk 2. I took the protection part from disk 1 and the remaining sectors from disk 2.

I now would like to replace the bad sector in the ATX of disk 1 with the correct one from Kevin's ATR.
Then I want to inject the real data for disk 2 in an ATX of disk 1.
This way we would have copies as near to the originals as currently possible.

  • Like 6
Link to comment
Share on other sites

Here's some perl code that should be able to patch your files. It parses atx and atr files, determines the sector offsets, and lets you copy sectors from one file to another. It's lightly tested, so work on copies. If you can't get it to work, post the files and sectors you want changed to the thread and I'll update the script and files.

 

Usage:
perl atx.pl [-verbose=<level>] file1 file2 ... -dump=<sectorNum> -dump=<sectorNum> ...
Dump sectors from atr/atx files
perl atx.pl [-verbose=<level>] srcfile dstfile -copy=<sectorNum> -copy=<sectorNum> ...
Copy sectors from src to dst

atx-20160415-1.zip

Link to comment
Share on other sites

It looks like there's some extra data at the end of the file I wasn't expecting, starting at offset 0x018778. If you change line 136 from "die if..." to "last if..." it will then skip over this extra data. I've done that and added support for ranges to -dump and -copy to make it easier to fix the disks. I believe I've done what you asked in the readme, although the disk two instructions seem to be reversed. You should be able to use atx.pl to do it now if I got your instructions wrong.

 

SurvivalMath.zip

atx-20160417-1.zip

 

Link to comment
Share on other sites

I added a bit more error checking and proper handling of that extra data (it was track type 256, which as opposed to zero, so I should have just skipped it). If you run with -verbose=0, it will report on phantom and missing sectors, which this tool can't effectively edit at the moment. I also allow disconnected ranges now, so -copy=361,400-410,500 does what you'd expect.

atx-20160418-1.zip

Link to comment
Share on other sites

Your ATX was OK and I was able to generate disk 2 with the atx.pl from yesterday. The only thing I had to do manually was to change the sector_status for sector 361 from $48 (bad CRC) to $00 (OK) with a hex editor.

 

Now we have restored two disks (see attachment).

One corrupt ATX + two good sector copies = two good ATXs :thumbsup:

 

Can you change your script to copy whole tracks between images?

I have one more good sector copy which I could combine with a corrupt ATX to have a good ATX.

In this case the ATX misses sectors and your current script cannot add them from the ATR.

 

Btw.: Alle these disks need BASIC to run.

SurvivalMath-ATX.zip

TheSemanticCalculator.zip

Link to comment
Share on other sites

Since you want to copy a track from atr to atx, we're going to lose timing information in the atx file (I'll fill in some fake interleave and timing). Can you send me the disk in question and which track you want to patch out? I suspect a better approach is to preserve the existing timing as much as possible, patch in zero sectors and adjust the interleave if necessary, then copy the data in sector by sector as in the other cases. That should preserve more of the data.

Link to comment
Share on other sites

The images are in my last post inside "TheSemanticCalculator.zip".

Concerning the sector timing, this is nice to have but not needed since all protection stays in the first two tracks of the ATX which will not be altered.

 

What needs to be done to generate an ATX of TheSemanticCalculator.

 

- Take the "bad.ATX" as a starting point.

 

DIsk format:

- Keep tracks 1-2 untouched

- Tracks 3, 26 and 40 need to have 18 good sectors each (see "?" in sector map)

- All other tracks are OK (and may become the source for timing information)

 

Contents:

- Sectors 1-30 stay untouched

- Sectors 31-720 copied from the "The Semantic Calculator.atr"

 

Attached is a sector map of the ATX which is better readable than the one in the ZIP (Tracks from left to right, sectors within from top to bottom).

 

 

post-6495-0-61786100-1461083471_thumb.png

Link to comment
Share on other sites

OK, I added the ability to copy tracks to the script.

 

I've attached the script and an atx file built from the first two tracks of the atx file and the last 38 tracks of the atr file, generated using.

 

atx.pl tsc.atr new.atx -copyTrack=2-39

 

If that isn't what you want, hopefully you can accomplish what you want with the script.

sc2.zip

atx-20160419-1.zip

Link to comment
Share on other sites

Atari_Ace, your script helped resurrecting all these disks :) :

 

Basic Arithmetic (1982)(MECC)(US)[bASIC]
Classroom Toolbox (1983)(MECC)(US)[bASIC]
Counting (1983)(MECC)(US)[bASIC]
Elementary Biology (1982)(MECC)(US)[bASIC]
Expeditions (1983)(MECC)(US)[bASIC]
Pre-Reading (1982)(MECC)(US)[bASIC]
Spelling Bee (1983)(MECC)(US)[a][bASIC]
Word Games (1982)(MECC)(US)[bASIC]
Earth Science (1982)(APX)(US)[bASIC]
Music I - Terms and notations (1982)(APX)(US)[OS-B][bASIC]
Music II - Rhythm and Pitch (1982)(APX)(US)[OS-B][bASIC]
Music III - Scales and Chords (1982)(APX)(US)[OS-B][bASIC]
Semantic Calculator, The (1983)(Sunburst)(US)[bASIC]
Survival Math (1982)(Sunburst(US)(Disk 1)[bASIC]
Survival Math (1982)(Sunburst(US)(Disk 2)[bASIC]

 

thanks again

  • Like 4
Link to comment
Share on other sites

I added a bit more error checking and proper handling of that extra data (it was track type 256, which as opposed to zero, so I should have just skipped it).

 

If I remember right ...

 

Some images have a track with type 256 at the end of the image. Without checking, I don't remember exactly which kind of data was stored there. But it's information about how the image was produced, not related to the actual disk content.

 

Btw, great scripts. I never developed such a tool.

Link to comment
Share on other sites

Those chunks seem to always be after the total size of the file in the header (offset 0x20 in the file), and are usually 0x30 bytes, so it's unclear what they represent. I went through all the images in the current Atari 8bit Preserved Software torrent, and they appear on a fair number of them as well. My last script iteration just ignores anything after the total size header field so I no longer parse them.

 

The atx parsing logic my script implements is thanks to phaeron's a8rawconv source code. His code ignores the totalSize in the header and just skips these chunks at the end since they have a track type != 0.

 

Link to comment
Share on other sites

  • 3 years later...

@Atari_Ace Can you please help once more.

 

Metric and Problem Solving v1.2 (1982)(APX)(US)[f][BASIC].atx

 

This ATX always crashes atx.pl with that error message:

Use of uninitialized value $class in bless at /data/atx/atx.pl line 528.
Explicit blessing to '' (assuming package main) at /data/atx/atx.pl line 528.
Can't locate object method "parse" via package "main" at /data/atx/atx.pl line 529.
Metric and Problem Solving (1982)(APX)(US)[f][BASIC].atr

Farb already analyzed something but did not find out if the crash results from a malformed ATX or a bug in your script.

Quote

The problem seems to start in the parse_header subroutine that resides within the atx package when it checks the actual size of the file against the “size” data listed within the File Header from 0x1c.

Line 205
my ($trackDataOffset, $totalSize) = unpack “VV”, substr($$rbuff, 0x1c, 8);

However, on line 206 the $totalSize is compared to the $$rbuff, which in the case of Metric and Problem Solving is larger, so the subroutine is exited before passing back data it was called for.
The $totalSize is 99944 compared to $$rbuff of 99936.

I’ve tried offsetting this by adding a number of zero of bytes to the end the atx file and can get it to work after adding 12 bytes, but it does display:
EXTRA: 8
If I add less than 12 bytes, it fails as before.

 

Link to comment
Share on other sites

The size in the header is 8 bytes larger than the size of the file.  If you add 8 bytes and then parse, the parse routine says there are 8 unused bytes at the end of the file.  So the size in the header is probably wrong, and you should change the byte at offset 0x20 in the file from 0x68 to 0x60 (I've attached this modification).

 

I've added code to automatically pad the buffer if it is truncated, which might allow you to manipulate the file with the script, I haven't further tested it.

atx-20191117-1.zip mps12-patched.atx

  • Like 2
Link to comment
Share on other sites

4 hours ago, Atari_Ace said:

I've added code to automatically pad the buffer if it is truncated, which might allow you to manipulate the file with the script, I haven't further tested it.

Thanks for your work.

Yes, the padding works and atx.pl successfully worked on the bad ATX. :)

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
On 4/23/2016 at 8:01 AM, DjayBee said:

Atari_Ace, your script helped resurrecting all these disks :) :

 

Basic Arithmetic (1982)(MECC)(US)[bASIC]
Classroom Toolbox (1983)(MECC)(US)[bASIC]
Counting (1983)(MECC)(US)[bASIC]
Elementary Biology (1982)(MECC)(US)[bASIC]
Expeditions (1983)(MECC)(US)[bASIC]
Pre-Reading (1982)(MECC)(US)[bASIC]
Spelling Bee (1983)(MECC)(US)[a][bASIC]
Word Games (1982)(MECC)(US)[bASIC]
Earth Science (1982)(APX)(US)[bASIC]
Music I - Terms and notations (1982)(APX)(US)[OS-B][bASIC]
Music II - Rhythm and Pitch (1982)(APX)(US)[OS-B][bASIC]
Music III - Scales and Chords (1982)(APX)(US)[OS-B][bASIC]
Semantic Calculator, The (1983)(Sunburst)(US)[bASIC]
Survival Math (1982)(Sunburst(US)(Disk 1)[bASIC]
Survival Math (1982)(Sunburst(US)(Disk 2)[bASIC]

 

thanks again

are all of the recovered disks posted in another thread?

Link to comment
Share on other sites

9 hours ago, _The Doctor__ said:

are all of the recovered disks posted in another thread?

Oh, what a necro-bump.

;)

 

Most of the titles have meanwhile been added to Farb's torrent because they came from original dumps in the first place. Back then the torrent only contained unaltered images.

Since we now can edit single sectors within the original disk geometry/timing/whatever, this policy has been changed.

 

There are a few titles which did not make it into the torrent because they came from unknown sources. Theses titles can be found in cracked manner inside my (now quite old) crack-release (i.e. Music II and Survival Math).

I do not spread this type of ATX-files because they have only value for comparison to real dumps. On the other hand they most certainly would go full circle and eventually come back as "original dumps" without a means to identify them as Frankendisks.

  • Like 1
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...