Fixing Bellcom disks 450, 655, 656; more 8-bit picture goodness
After the epic efforts to restore GIRL6 in the last two posts, I thought I'd tackle the remaining damaged pictures in the Bellcom archive. We start with disk 450, which has the title screen from Zaxxon ripped from the game, but unfortunately the first sector of the MicroPainter picture is gone. No problem, we can rip the 125 bytes from the game again.
I found similar byte patterns in the disk "Zaxxon (19xx)(Datasoft).atr" in my collection, so I just need to adapt the copy sector tools to pull a sector of data from a random offset in the file.
To do this, I rewrote copy_sector as follows.
sub fix_disk_link { my ($disk, $sector) = @_; my ($pos, $sectorSize) = sector_offset($disk, $sector); my $sectorData = substr($disk->{buff}, $pos, $sectorSize); substr($sectorData, -1, 1) = pack "C", $sectorSize - 3 if $sectorData =~ /^\0+$/; my ($nextSector, $nBytes) = link_data($sectorData); my $full = $nBytes == $sectorSize - 3; my $offset = $full ? $sectorSize : -$sectorSize; ($nextSector, $nBytes) = link_data(substr($disk->{buff}, $pos + $offset, $sectorSize)); $nextSector = ($nextSector & 0xfc00) | ($full ? $sector + 1 : 0); substr($sectorData, -3, 2) = pack "n", $nextSector; substr($disk->{buff}, $pos, $sectorSize) = $sectorData; } sub copy_sector { my ($srcFile, $dstFile, $srcSector, $dstSector, $fixlink) = @_; $fixlink = 1 if !defined $fixlink; my $raw = $srcSector =~ /^0x/; my $src = $raw ? { buff => read_file($srcFile) } : read_disk($srcFile); my $srcOffset = $raw ? hex $srcSector : sector_offset($src, $srcSector); my $dst = read_disk($dstFile); my ($dstOffset, $sectorSize) = sector_offset($dst, $dstSector); my $sectorData = substr($src->{buff}, $srcOffset, $sectorSize); substr($sectorData, -1, 1) = pack "C", $sectorSize - 3 if $raw && $fixlink; substr($dst->{buff}, $dstOffset, $sectorSize) = $sectorData; fix_disk_link($dst, $dstSector) if $fixlink; write_file($dstFile, $dst->{buff}); }
This is clearly a more complex implementation than before, due to two reasons. Firstly, I isolated the fix_disk_link code into its own subroutine, and changed the logic to better handle empty sectors. If you hand it an empty sector to fix, it now patches it to be a full sectors of zeros linked the next sector. Secondly, I now treat a source sector starting with 0x as a direct offset into the file, so some adjustments had to be made to implement that.
Anyhow, with this updated routine, I can patch the Zaxxon picture like so:
atr.pl -copy "Zaxxon (19xx)(Datasoft).atr" 450.atr 0x296 320 1
450.atr
Two other disks also had damage, disks 655 and 656, both containing collections of CompuEyes black and white scanned images. In both cases sector 327 got dropped. Fortunately the DGS public domain archive has the same pictures on disk #19 (side 1, and 2), so single sector patching restores these old images.
655.atr
656.atr
Next time I'll patch the remaining "easy to fix" disks in the archive, and discuss what other issues remain.
- 1
0 Comments
Recommended Comments
There are no comments to display.