Jump to content

Photo

Red Screen On Sundog emulation in Steem


14 replies to this topic

#1 munny OFFLINE  

munny

    Combat Commando

  • 1 posts

Posted Sat May 12, 2007 7:55 PM

Hi guys!

I am a grown up kid, who was raised on the 1040ST and want to revisit the fun i had with sundog. I got Steem all set up, got the TOS 1.02 (I think that was it whatever the LGD site reccomened for games) and found a Disk Image of Sundog. Got everything wired up and game starts up fine, I make a charecter and get to the process of moving about town to repair my ship when - Red screens. Steem crashes to red screen. sometimes when I enter a building, somtimes When I sit at a booth in the bar, sometimes when I open a locker on the ship.. but it IS quite frequent. I can take memory snapshots every minnuite or so and reboot from that but that takes the fun away.

Anyone have any similar problems? Find A fix?

Thanks eveybody

#2 ppera OFFLINE  

ppera

    Moonsweeper

  • 279 posts

Posted Sun May 13, 2007 7:54 AM

Steem crashes to red screen. sometimes when I enter a building, somtimes When I sit at a booth in the bar, sometimes when I open a locker on the ship.. but it IS quite frequent. I can take memory snapshots every minnuite or so and reboot from that but that takes the fun away.
Anyone have any similar problems? Find A fix?


I had such problems on real Atari, long time ago. It must be because of bad cracking (protection remained).
Not Steem related. Look around for some other version (menudisk, Pasti image or whatever).

#3 VW OFFLINE  

VW

    Chopper Commander

  • 224 posts
  • Location:Idaho, USA

Posted Mon May 14, 2007 4:00 PM

Sundog was an FTL game and FTL was well known for their copy protection. For instance, I wanted to play Dungeon Master because I had heard how great it was but no version I could find on the net was cracked properly for use with Steem or a real ST, it would lock up every few minutes similar to what you are describing. Fortunately I have a real ST and was fortunate enough to have a local shop where I bought the Amiga version brand new shrinkwrapped and traded it with a friend of mine for an original ST Dungeon Master disk. I guess the moral of the story is I am guessing you are out of luck unless you get a real ST and find an original Sundog on Ebay, it pops up every now and then, that is where I bought mine.

#4 remowilliams OFFLINE  

remowilliams

    Quadrunner

  • 10,250 posts
  • Location:Detonation Boulevard

Posted Mon May 14, 2007 4:54 PM

Use the Pasti emulation helper .DLL with Steem, and then you will be able to load this special protected format disk image (Pasti STX) into Steem and play. :)

Attached File  Sundog___Frozen_Legacy_v3.0__1985__FTL_.zip   471.79KB   228 downloads

#5 CyranoJ OFFLINE  

CyranoJ

    River Patroller

  • 4,761 posts
  • RAPTOR in LOCAL
  • Location:Adelaide, SA

Posted Tue May 15, 2007 4:51 AM

Use the Pasti emulation helper .DLL with Steem, and then you will be able to load this special protected format disk image (Pasti STX) into Steem and play. :)

Attached File  Sundog___Frozen_Legacy_v3.0__1985__FTL_.zip   471.79KB   228 downloads


Dungeon Master on Automation 97 works perfectly, as does the Automation Chaos Strikes Back.

Was (Not Was) rules :P

#6 ppera OFFLINE  

ppera

    Moonsweeper

  • 279 posts

Posted Tue May 15, 2007 7:31 AM

Sundog was an FTL game and FTL was well known for their copy protection. For instance, I wanted to play Dungeon Master because I had heard how great it was but no version I could find on the net was cracked properly for use with Steem or a real ST, it would lock up every few minutes similar to what you are describing. Fortunately I have a real ST and was fortunate enough to have a local shop where I bought the Amiga version brand new shrinkwrapped and traded it with a friend of mine for an original ST Dungeon Master disk. I guess the moral of the story is I am guessing you are out of luck unless you get a real ST and find an original Sundog on Ebay, it pops up every now and then, that is where I bought mine.


It is not correct. For instance you may find on dmweb.free.fr at least 3 different versions, all playable with emulators.

There is probably best (mine) solution: usage of RAMdisk for faster load of game and levels (needs 1MB RAM):
http://dmweb.free.fr/?q=node/881

There are some versions for easier play too (with less volnurable characters), and Chaos Strikes back too. You may run it even form hard disk on real ST, just disable hard disk driver after reset.

And one advice for end: in Steem set CPU clock to some high value (64MHz for instance) and emulation speed to about 90%, and will have much better (smoother) gameplay with overall same speed as on 8MHz ST.

#7 witchspace OFFLINE  

witchspace

    Space Invader

  • 19 posts

Posted Thu Jan 12, 2017 1:22 AM

This happened to me on a real ST as well, in the 80's. More recently while reverse engineering SunDog I found the code for this.

 

It's a game specific thing, not a TOS or emulator fail. There is explicitly code to draw a fullscreen red rectangle and go into an infinite loop. This seems to be triggered on "disk corruption". At disk accesses, randomly the 9 sectors in a random track are checked against a list of checksums. Something might be going wrong there, say due to an old disk rip or faulty copying or patching. If so it ends up in this state.

 

The following p-code disassembly shows the code in question:

       ; start of procedure MAINLIB:0x05 RedScreenOfDeath
007c:  .dw 0x0096
007e:  .dw 0x0000
007e:  91 2d       cgp 0x2d ; MAINLIB:0x2d ConditionalWait
0080:  72 23       scxg3 0x23 ; GEMBIND:0x23 SetClippingRectangle2
0082:  72 27       scxg3 0x27 ; GEMBIND:0x27 HideMouseCursor
0084:  01          sldc1 
0085:  72 16       scxg3 0x16 ; GEMBIND:0x16 SetWriteMode
0087:  0c          sldc12 
0088:  72 1a       scxg3 0x1a ; GEMBIND:0x1a SetFillColor
008a:  00          sldc0 
008b:  81 3f 01    ldci 0x13f
008e:  00          sldc0 
008f:  80 c7       ldcb 0xc7
0091:  72 14       scxg3 0x14 ; GEMBIND:0x14 DrawFilledRectangle
0093:  00          sldc0 
0094:  d4 fd       fjp 0x93
0096:  96 00       rpu 0x0

I'm not sure it even is a copy protection, or just against modding/tampering with the game. Why? I have no clue. They go through all kinds of checksum dances to protect the library disks and savegames as well. FTL was really afraid of cheating? :-)

 

I could patch it out or at even make sure a disk verifies as correct by updating the checksums.


Edited by witchspace, Thu Jan 12, 2017 1:23 AM.


#8 witchspace OFFLINE  

witchspace

    Space Invader

  • 19 posts

Posted Thu Jan 12, 2017 3:20 AM

I wrote a small python script to verify the checksums on a raw disk image (sorry, only supports .st):
#!/usr/bin/python3
'''
Verify SunDog: Frozen Legacy 3.0 Atari ST disk image.
 
Only raw .st images are supported right now, not .stx.
 
Usage:
    compute_checksums.py <image.st> <0|1>
'''
import sys
import struct
 
with open(sys.argv[1], 'rb') as f:
    data = f.read()
 
sectors_per_track = 9
tracks = 80
base_track = 3
sector_size = 512
skipset = 0x182
 
track_size = sector_size * sectors_per_track
 
if int(sys.argv[2]): # use hardcoded data
    valid='''
    f2 52 71 8b 5e 15 ad 94 2c d2 b2 84 8b ef 9d ee
    65 c0 ed b0 24 0d 71 f0 2a 0b 30 3f bc b9 06 d8
    e4 d4 67 ec 2d 63 9b 27 f5 48 4d 45 15 6c 54 78
    25 ae 9d 17 21 37 57 44 8b de bc b3 f8 42 c6 aa
    45 3c a2 f1 da f4 1b 81 3b e5 0c 8e c6 31 da b6
    e2 4c c1 9f 30 7e 9b 21 52 99 69 8a 31 2c 3c 65
    47 a3 32 62 0a a8 07 4d c0 92 01 eb 03 d5 65 2a
    bd aa a6 6d 96 a4 06 eb 2c f3 8d 8e de 88 aa cf
    7c 34 dc c1 a2 4a 94 20 d9 45 74 eb 9a eb 08 9a
    4d 5f 25 ff 2d f5 ba 0b 28 8a f2 69 56 4b 08 d9
    '''
    valid = bytes(int(x.strip(),16) for x in valid.split())
    valid = struct.unpack('>80H', valid)
else:
    valid = list(struct.unpack('>80H', data[0xd760:0xd760+2*80]))
    for x in range(80):
        valid[x] = (valid[x] - x*0x169)&0xffff
 
for track in range(tracks):
    base = ((base_track + track)%tracks) * sectors_per_track * sector_size
    expect = valid[track]
    ptr = 0
    x = 0
    while ptr < track_size:
        (a,b) = struct.unpack('>HH', data[base+ptr:base+ptr+4])
        x -= a
        x += b
        x &= 0xffff
        ptr += 4
    if (1<<track)&skipset:
        s = 'SKIP'
    elif x == expect:
        s = 'MATCH'
    else:
        s = 'FAIL'
    print('%3i %08x-%08x 0x%04x 0x%04x %s' % (track, base, base + sectors_per_track * sector_size, x, expect, s))
My output
$ ./compute_checksums.py ./disk_image 0

  0 00003600-00004800 0xf238 0xf252 FAIL
  1 00004800-00005a00 0x075f 0x718b SKIP
  2 00005a00-00006c00 0x5e15 0x5e15 MATCH
  3 00006c00-00007e00 0xad94 0xad94 MATCH
  4 00007e00-00009000 0x2cd2 0x2cd2 MATCH
  5 00009000-0000a200 0xb284 0xb284 MATCH
  6 0000a200-0000b400 0x8bef 0x8bef MATCH
  7 0000b400-0000c600 0xfec6 0x9dee SKIP
  8 0000c600-0000d800 0xeb71 0x65c0 SKIP
  9 0000d800-0000ea00 0xedb0 0xedb0 MATCH
 10 0000ea00-0000fc00 0x240d 0x240d MATCH
 11 0000fc00-00010e00 0x71f0 0x71f0 MATCH
 12 00010e00-00012000 0x2a0b 0x2a0b MATCH
 13 00012000-00013200 0x303f 0x303f MATCH
 14 00013200-00014400 0xbcb9 0xbcb9 MATCH
 15 00014400-00015600 0x06d8 0x06d8 MATCH
 16 00015600-00016800 0xe4d4 0xe4d4 MATCH
 17 00016800-00017a00 0x67ec 0x67ec MATCH
 18 00017a00-00018c00 0x2d63 0x2d63 MATCH
 19 00018c00-00019e00 0x9b27 0x9b27 MATCH
 20 00019e00-0001b000 0xf548 0xf548 MATCH
 21 0001b000-0001c200 0x4d45 0x4d45 MATCH
 22 0001c200-0001d400 0x156c 0x156c MATCH
 23 0001d400-0001e600 0x5478 0x5478 MATCH
 24 0001e600-0001f800 0x25ae 0x25ae MATCH
 25 0001f800-00020a00 0x9d17 0x9d17 MATCH
 26 00020a00-00021c00 0x2137 0x2137 MATCH
 27 00021c00-00022e00 0x5744 0x5744 MATCH
 28 00022e00-00024000 0x8bde 0x8bde MATCH
 29 00024000-00025200 0xbcb3 0xbcb3 MATCH
 30 00025200-00026400 0xf842 0xf842 MATCH
 31 00026400-00027600 0xc6aa 0xc6aa MATCH
 32 00027600-00028800 0x453c 0x453c MATCH
 33 00028800-00029a00 0xa2f1 0xa2f1 MATCH
 34 00029a00-0002ac00 0xdaf4 0xdaf4 MATCH
 35 0002ac00-0002be00 0x1b81 0x1b81 MATCH
 36 0002be00-0002d000 0x3be5 0x3be5 MATCH
 37 0002d000-0002e200 0x0c8e 0x0c8e MATCH
 38 0002e200-0002f400 0xc631 0xc631 MATCH
 39 0002f400-00030600 0xdab6 0xdab6 MATCH
 40 00030600-00031800 0xe24c 0xe24c MATCH
 41 00031800-00032a00 0xc19f 0xc19f MATCH
 42 00032a00-00033c00 0x307e 0x307e MATCH
 43 00033c00-00034e00 0x9b21 0x9b21 MATCH
 44 00034e00-00036000 0x5299 0x5299 MATCH
 45 00036000-00037200 0x698a 0x698a MATCH
 46 00037200-00038400 0x312c 0x312c MATCH
 47 00038400-00039600 0x3c65 0x3c65 MATCH
 48 00039600-0003a800 0x47a3 0x47a3 MATCH
 49 0003a800-0003ba00 0x3262 0x3262 MATCH
 50 0003ba00-0003cc00 0x0aa8 0x0aa8 MATCH
 51 0003cc00-0003de00 0x074d 0x074d MATCH
 52 0003de00-0003f000 0xc092 0xc092 MATCH
 53 0003f000-00040200 0x01eb 0x01eb MATCH
 54 00040200-00041400 0x03d5 0x03d5 MATCH
 55 00041400-00042600 0x652a 0x652a MATCH
 56 00042600-00043800 0xbdaa 0xbdaa MATCH
 57 00043800-00044a00 0xa66d 0xa66d MATCH
 58 00044a00-00045c00 0x96a4 0x96a4 MATCH
 59 00045c00-00046e00 0x06eb 0x06eb MATCH
 60 00046e00-00048000 0x2cf3 0x2cf3 MATCH
 61 00048000-00049200 0x8d8e 0x8d8e MATCH
 62 00049200-0004a400 0xde88 0xde88 MATCH
 63 0004a400-0004b600 0xaacf 0xaacf MATCH
 64 0004b600-0004c800 0x7c34 0x7c34 MATCH
 65 0004c800-0004da00 0xdcc1 0xdcc1 MATCH
 66 0004da00-0004ec00 0xa24a 0xa24a MATCH
 67 0004ec00-0004fe00 0x9420 0x9420 MATCH
 68 0004fe00-00051000 0xd945 0xd945 MATCH
 69 00051000-00052200 0x74eb 0x74eb MATCH
 70 00052200-00053400 0x9aeb 0x9aeb MATCH
 71 00053400-00054600 0x089a 0x089a MATCH
 72 00054600-00055800 0x4d5f 0x4d5f MATCH
 73 00055800-00056a00 0x25ff 0x25ff MATCH
 74 00056a00-00057c00 0x2df5 0x2df5 MATCH
 75 00057c00-00058e00 0xba0b 0xba0b MATCH
 76 00058e00-0005a000 0x288a 0x288a MATCH
 77 00000000-00001200 0x0e6b 0xf269 FAIL
 78 00001200-00002400 0x33c8 0x564b FAIL
 79 00002400-00003600 0xe8a0 0x08d9 FAIL

In my case I get "FAIL" for track 0,77,78,79. The last(=first) three tracks are used by TOS itself, so even touching a file will probably cause these to fail. The mismatch in track 0 (which is the p-system boot track) is more peculiar.
 
I hope someone who still has the original disk can verify this.
 
Edit: I verified the above .stx file after converting it to .st by copying it with fastcopy in the emulator. All tracks MATCH except track 0 is the same as in my image - maybe that one isn't supposed to be checked in practice, I'm not sure. In any case it's better than the image I had, thanks remowilliams.

Edited by witchspace, Thu Jan 12, 2017 4:02 AM.


#9 ParanoidLittleMan OFFLINE  

ParanoidLittleMan

    Dragonstomper

  • 967 posts

Posted Thu Jan 12, 2017 6:21 AM

Ahhh, old, many times discussed FTL copy protection pulled out again. Not sure about Sundog, but Dungeon Master uses 2 level protection: 1st is sector number $F7 - what is not possible to create with WD1772 FDC. Another is fuzzy data in track 0 - what means intentional unreliable read, so diverse reading each time. And that is what IS CHECKED randomly during gameplay, with well hidden code in case of DM. If test fails, your party suddenly dies.


Edited by ParanoidLittleMan, Thu Jan 12, 2017 6:25 AM.


#10 witchspace OFFLINE  

witchspace

    Space Invader

  • 19 posts

Posted Thu Jan 12, 2017 7:33 AM

Ahhh, old, many times discussed FTL copy protection pulled out again. Not sure about Sundog, but Dungeon Master uses 2 level protection: 1st is sector number $F7 - what is not possible to create with WD1772 FDC. Another is fuzzy data in track 0 - what means intentional unreliable read, so diverse reading each time. And that is what IS CHECKED randomly during gameplay, with well hidden code in case of DM. If test fails, your party suddenly dies.

Thanks, that's interesting.

 

I'm not entirely sure but I think SunDog pulls any floppy disk weird sector tricks. There's only a small bit of native 68k code, the rest is p-system VM code which has no way to directly call the system. All disk i/o goes through one function which enforces simple 80 track/9 sectors/512 bytes, so I don't expect any out-of-range sectors used. The fuzzy trick is possible though.



#11 ijor OFFLINE  

ijor

    Stargunner

  • 1,905 posts

Posted Sat Jan 21, 2017 3:39 PM

I'm not entirely sure but I think SunDog pulls any floppy disk weird sector tricks. There's only a small bit of native 68k code, the rest is p-system VM code which has no way to directly call the system. All disk i/o goes through one function which enforces simple 80 track/9 sectors/512 bytes, so I don't expect any out-of-range sectors used. The fuzzy trick is possible though.

 

Sundog is earlier than Dungeon Master and uses a much simpler protection. IIRC it is just a double or duplicated sector. That means that two physical copies, with different content, exist for the same logical sector with the same sector number.

 

I loved Sundog. Played the game to the very end more than once back at the day.

 

A few years ago, one of the original developers of the Apple II version was attempting to create a modern version. Don't know what happened with that.



#12 witchspace OFFLINE  

witchspace

    Space Invader

  • 19 posts

Posted Sun Jan 22, 2017 1:01 PM

 

Sundog is earlier than Dungeon Master and uses a much simpler protection. IIRC it is just a double or duplicated sector. That means that two physical copies, with different content, exist for the same logical sector with the same sector number.

 Interesting - how would a check for that work? I suppose which content it will get dependent on where the disk head went previously?

 

 

I loved Sundog. Played the game to the very end more than once back at the day.

 

A few years ago, one of the original developers of the Apple II version was attempting to create a modern version. Don't know what happened with that.

 

Me too! I played it a lot back in the day and still like it a lot.

 

As far as I know there have been multiple Sundog Resurrection projects, over the years, also with involvement with the original author, but I'm not sure they went anywhere.



#13 ijor OFFLINE  

ijor

    Stargunner

  • 1,905 posts

Posted Sun Jan 22, 2017 3:09 PM

 Interesting - how would a check for that work? I suppose which content it will get dependent on where the disk head went previously?

 

Exactly. Depending on  which sector you read before you will get one or the other. It is also possible to perform a read track, but I don't think Sundog does that.



#14 witchspace OFFLINE  

witchspace

    Space Invader

  • 19 posts

Posted Tue Jan 24, 2017 1:22 AM

 

Exactly. Depending on  which sector you read before you will get one or the other. It is also possible to perform a read track, but I don't think Sundog does that.

Yes I can confirm Sundog only reads per sector. I would have missed any tricks with regard to ordering of reads, though, as I never realized that could be a concern. Thanks for learning me new things about 80's copy protection schemes icon_thumbsup.gif



#15 witchspace OFFLINE  

witchspace

    Space Invader

  • 19 posts

Posted Sun Jan 29, 2017 3:50 AM

Just found the code responsible. It is exactly as you say. Track 3, sector 7 is read then the data is discarded, that read is just to (mis)direct the drive. Then Track 3, sector 4,5,6 are read. Sector 4 is check-summed and compared, and if it fails a state word is set which eventually leads to the Red screen of Death.

 

This is in addition to the per-track integrity check I posted about above. FTL was certainly paranoid :)

 

In my port I just pull down the state word involved in these checks. Too lazy to implement a more accurate implementation of the floppy controller just to make this weird code happy.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users