Jump to content
IGNORED

Interesting Issue with a Wavy Navy ATR


a8isa1

Recommended Posts

A fellow Atariage user complained of this Wavy Navy ATR that when converted to a real disk (via sector copying) doesn't work. The boat won't move to the left.

 

The ATR worked fine for the user via SIO2PC and SIO2SD. For me it works via SDrive and Atari800 and Altirra emulators. However, I also couldn't get it to work as a real floppy..

 

Finally, in Altirra I discovered something strange. If I enable "accurate sector timing" then the problem appears.

 

Is the issue some remnant of copy protection?

 

The ATR is available at Atarimania.com. It's the only version of Wavy Navy that I have seen where the helicopters strafe.

 

Joey_Z has been working at this. Perhaps he can shed some light.

 

-SteveS

Link to comment
Share on other sites

this is what appears to have happened:

On the original disk, there must have been a duplicate sector 696. The unmodified game has code that appears to check how many times the atari can read that sector within 12 jiffies, about 1/5 of a second. 1/5 of a second is also the amount of time it takes a 300 RPM floppy to rotate once. normally, a real disk drive could only read sector 696 once, maybe twice maximum in a 1/5 of a second, but if there is a duplicate sector it can read both of the duplicate sectors in 1/5 of a second thus passing the test.

 

Specifically, the game code calls the SIOV to read sector 696 on D1: and stores 0 in the low byte of RTCLOK (location 20 or $14) immediately afterward. It then reads 696 again, increments a counter, and repeats until the low byte of RTCLOK is greater than or equal to 12. Afterward, it checks to see if the counter was more than or less than 2 reads, and decides whether to screw up the game based on that.

 

With a real disk, and no duplicate sector 696, the drive can only read once, and fails the copy protection. With an SIO2nnn device, there isn't an emulation of real disk timing, and the game can read plenty of times within 1/5 of a second, so the game does not fail the copy protection.

 

The obvious solution is to NOP out the copy protection code. In addition to this copy protection code however, there were tamper resistant measures as well. For one, the majority of the disk is scrambled by XOR'ing with EB, which made finding the right place to NOP out more difficult, though not impossible. The other measure, was a form of 'error detection' though I assume it was meant for tamper detection rather than error detection. There was a table of 16 bit values for each sector, and the ones pertaining to the sectors containing the copy protection code had to be recalculated and modified on disk.

 

I have done these things, and here is what I believe to be a fixed ATR. It should work both with SIO2nnn devices as well as real floppy drives now.

fixed copy of Wavy Navy (HOLD OPTION).atr

  • Like 6
Link to comment
Share on other sites

this is what appears to have happened:

On the original disk, there must have been a duplicate sector 696. The unmodified game has code that appears to check how many times the atari can read that sector within 12 jiffies, about 1/5 of a second. 1/5 of a second is also the amount of time it takes a 300 RPM floppy to rotate once. normally, a real disk drive could only read sector 696 once, maybe twice maximum in a 1/5 of a second, but if there is a duplicate sector it can read both of the duplicate sectors in 1/5 of a second thus passing the test.

 

Specifically, the game code calls the SIOV to read sector 696 on D1: and stores 0 in the low byte of RTCLOK (location 20 or $14) immediately afterward. It then reads 696 again, increments a counter, and repeats until the low byte of RTCLOK is greater than or equal to 12. Afterward, it checks to see if the counter was more than or less than 2 reads, and decides whether to screw up the game based on that.

 

With a real disk, and no duplicate sector 696, the drive can only read once, and fails the copy protection. With an SIO2nnn device, there isn't an emulation of real disk timing, and the game can read plenty of times within 1/5 of a second, so the game does not fail the copy protection.

 

The obvious solution is to NOP out the copy protection code. In addition to this copy protection code however, there were tamper resistant measures as well. For one, the majority of the disk is scrambled by XOR'ing with EB, which made finding the right place to NOP out more difficult, though not impossible. The other measure, was a form of 'error detection' though I assume it was meant for tamper detection rather than error detection. There was a table of 16 bit values for each sector, and the ones pertaining to the sectors containing the copy protection code had to be recalculated and modified on disk.

 

I have done these things, and here is what I believe to be a fixed ATR. It should work both with SIO2nnn devices as well as real floppy drives now.

It was brought to my attention that the game is now broken (regardless of real floppy or SIO2nnn) when level 2 is reached. I probably removed something in the protection code that set a flag, and now (because it's all NOPs) the flag isn't getting set, and it's failing the copy protection. I'll have a look at the old protection code, and see what needs to be done.

Link to comment
Share on other sites

It was brought to my attention that the game is now broken (regardless of real floppy or SIO2nnn) when level 2 is reached. I probably removed something in the protection code that set a flag, and now (because it's all NOPs) the flag isn't getting set, and it's failing the copy protection. I'll have a look at the old protection code, and see what needs to be done.

Thanks Joey!

Link to comment
Share on other sites

  • 3 weeks later...

Very tenuously linked to this topic - I once had an almost identical thing occur with 'Ultima IV'. The disk was damaged on only a single sector. It played fine in every way, except you couldn't kill anything!!! Everything else worked 100% - and it was even an official copy - but each and every fight you got in to either ended with death or running away. And as anyone who has played the Ultima games know it is difficult to become all eight parts if an avatar without the 'Valar' virtue points from each successful encounter! It drove me crazy and I even sent the disk back to electronic arts. However this was April 1991 and they had no replacement copies to give me. i never finished the game until I got a PC copy of the entire collection of Ultima games 7 years later.

 

Weird though. A single sector and it didn't cause any crashes or glitches other than that singular problem.

Link to comment
Share on other sites

I think you are right Bryan. U4 seemed to use the disk as a direct extension of memory. Icons and Sprites seemed to be stored directly on the disk and read when needed. Attributes were probably read the same way. In fact I once discovered independently - in the LONG days before the internet - there was an incredibly useful exploit to get a new 'Frigate' whenever you wanted one which used this property.

 

If you put the wrong disk in, exited Castle British and walked left until the game was forced to read from disk to get more map - a wall of miscellaneous sprites appeared instead of landscape. At this specific location a ship appeared where water should have been. What is more the sprites interacted perfectly normally with your party, so if you entered and then left the ship, replaced the proper disk and forced another map redraw the ship remained, quietly docked! ESSENTIAL as I could not kill a pirate crew and commandeer their ship so this was the only way of getting transport over water. You had to be careful though as there were enemies in the glitch-sprites too. It was not good to get too close to a Balron or Reaper!!!

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...