Sundog: Frozen legacy port

Talk about everything related to general reverse engineering of computer games!

Moderator: Kroah

Sundog: Frozen legacy port

Postby witchspace » 29 Jan 2017, 14:03

I've begun a port of the Atari ST game Sundog: Frozen Legacy to modern platforms with SDL and OpenGL ES 2. This is not a complete remake: it emulates the p-system interpreter that the original game ran in, on current hardware. A few 68000 assembly routines that it called out to did have to be reverse-engineered and re-implemented.

It is basically playable though not completely tested, there may still be a few flukes left.

Code can be found here: https://github.com/laanwj/sundog
witchspace
 
Posts: 5
Joined: 06 Jan 2017, 07:13

Re: Sundog: Frozen legacy port

Postby Kroah » 19 Apr 2017, 02:37

witchspace,

You did an impressive work there.

Writing a working Pascal interpreter is not an easy task.
Having build several virtual machines for some games, i understand your motivation, and it's with a great satisfaction we look at the p-code being executed by the VM.

I see you've documented some parts (the doc folder i'm actually reading), nice :) .

Since January, have you tried to do a full run of the game ?

Do you have implemented something to dump the p-code to readable pseudo-C ?
Kroah
Site Admin
 
Posts: 417
Joined: 07 Feb 2006, 01:01
Location: France

Re: Sundog: Frozen legacy port

Postby witchspace » 12 Aug 2017, 18:20

Thanks, yes it was a lot of work.
But it was lots of fun figuring this out for old times sake.
Kroah wrote:I see you've documented some parts (the doc folder i'm actually reading), nice :) .

Since January, have you tried to do a full run of the game ?

I got quite far, but didn't finish the game. But I think everything important works now.
The last barrier was the age-old copy protection still doing its thing... It's defeated though not in a particularly elegant way :D
Do you have implemented something to dump the p-code to readable pseudo-C ?

Sort of - tools/list_pcode.py has a mode 9 which tries this. It builds expression trees and statements and outputs in this format:
Code: Select all
$ tools/list_pcode.py -m 2 files/SYSTEM.STARTUP
...
Procedure MAINLIB_0x02_WaitMouseRelease
===========
bb001a:
  001c: T1 = GEMBIND_1F_GetMouseButton(0x0)
  0020: T2 = GEMBIND_1F_GetMouseButton(0x1)
  0023: tjp(0x1a, lor(T1, T2))
bb0025:
  0025: rpu(0x0)

Procedure MAINLIB_0x03_Sound(x)
===========
bb002c:
  003c: MAINLIB_03_L1 = sbi(sind0(ixa(0x1, &MAINLIB_G53f, inci(MAINLIB_03_P0))), sind0(ixa(0x1, &MAINLIB_G53f, MAINLIB_03_P0)))
  004c: KERNEL_0F_moveleft(&MAINLIB_G563, sind0(ixa(0x1, &MAINLIB_G53f, MAINLIB_03_P0)), &MAINLIB_G6e6, 0x0, MAINLIB_03_L1)
  0062: KERNEL_0F_moveleft(&MAINLIB_G563, sind0(ixa(0x1, &MAINLIB_G53f, MAINLIB_G6e5)), &MAINLIB_G6e6, MAINLIB_03_L1, sbi(0x80, MAINLIB_03_L1))
  0067: GEMBIND_08_DoSound(&MAINLIB_G6e6)
  0069: rpu(0x2)

Its implementation is in tools/decompiler. Still needs some polishing, that's for sure.

If you'd like to play with it and wonder about something I didn't document, or if I missed some file, please let me know!
witchspace
 
Posts: 5
Joined: 06 Jan 2017, 07:13


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron