Back to the source: ReDMCSB

Use this forum to discuss dungeon editors and other tools, like DMute (by George Gilbert, also working for RTC dungeons), DM Builder (by Sphenx), and ADGE by `rain. Includes DM editing tips and tricks.
Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Back to the source: ReDMCSB

Post by ChristopheF » 18-Jan-14 20:26

I've been working for nearly 5 years to reverse engineer the Atari ST versions of DM and CSB, and today I release the result of my work, named ReDMCSB (Reverse Engineered Dungeon Master/Chaos Strikes Back).
It contains source code (C language and a few parts in assembly) for all executable code on the game disk of all known Atari ST versions:
  • Dungeon Master for Atari ST 1.0a English (no version visible in dialog boxes)
  • Dungeon Master for Atari ST 1.0b English (version '1.0' visible in dialog boxes)
  • Dungeon Master for Atari ST 1.1 English
  • Dungeon Master for Atari ST 1.2 English
  • Dungeon Master for Atari ST 1.2 German
  • Dungeon Master for Atari ST 1.3a French (version 1.3 visible in dialog boxes)
  • Dungeon Master for Atari ST 1.3b French (variant, version 1.3 also visible in dialog boxes)
  • Chaos Strikes Back for Atari ST 2.0 English
  • Chaos Strikes Back for Atari ST 2.1 English
The source code is as accurate as possible: once compiled with the Megamax C compiler version 1.1 (also supplied in the package) it generates machine code nearly identical to the one in the original games. All the differences come from the fact that I used a different version of the compiler than the one FTL used and not because the source code is 'wrong'. If I can get my hands on version 1.2 of the Megamax C compiler, I'm pretty sure the source code will be proved to be 'perfect' by generating executables strictly identical to the originals.

The source code contains:
  • Meaningful and consistent names for all functions and their parameters, global and local variables, constants and macros.
  • Comments.
  • Conditional compilation directives allowing compilation of each version from the same source code. They also provide easy identification of the differences between versions
  • Conditional compilation directives allowing compilation without the copy protection. They also provide easy identification of all code related to the copy protection

The package does not contain as much documentation as I would like because it is very time consuming to write accurate documentation, but you will find the list of all known bugs and all changes between versions as well as a detailed description of the copy protection, and some more.

Download the package, and check the readme in the DOC folder for more information.
http://dmweb.free.fr/Stuff/ReDMCSB_Release2.7z

Previous release: http://dmweb.free.fr/Stuff/ReDMCSB_Release1.7z

User avatar
Paul Stevens
CSBwin Guru
Posts: 4099
Joined: 8-Apr-01 16:00
Location: Madison, Wisconsin, USA

Re: Back to the source: ReDMCSB

Post by Paul Stevens » 18-Jan-14 22:43

I've been working for nearly 5 years to reverse engineer
does not contain as much documentation as I would like because it is very time consuming
I see. The reverse engineering went pretty quickly then.

Oh my goodness! What a monumental effort. Did you
deal with the Hint Oracle? I looked a bit and did not see it.

User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Re: Back to the source: ReDMCSB

Post by ChristopheF » 18-Jan-14 23:11

I have only worked on the game disk and not the utility disk, so there is no hint oracle. On the utility disk, there is a start.prg that was developed with Megamax C (I have the source code for this one too although it is not part of this package). Other executable files use a custom 'FTL' format (start.prg contains the code to load these files) and they were not compiled with Megamax C.
They were developed and cross compiled on Macintosh, but I have not yet worked on these FTL files to identify the compiler that was used.

User avatar
Sophia
Concise and Honest
Posts: 3978
Joined: 12-Sep-02 19:50
Location: Nowhere in particular
Contact:

Re: Back to the source: ReDMCSB

Post by Sophia » 18-Jan-14 23:15

:shock: :shock: :shock: :shock: :shock:

User avatar
ebeneezergude
Expert
Posts: 345
Joined: 21-Jan-13 21:58
Location: I see walls stretching off into the darkness...

Re: Back to the source: ReDMCSB

Post by ebeneezergude » 19-Jan-14 00:34

Sophia, 'Concise and Honest' I get, but what does :shock: :shock: :shock: :shock: :shock: mean....?! ;-) Penny for your thoughts?

sixfourfour
Novice
Posts: 15
Joined: 4-Mar-10 18:43

Re: Back to the source: ReDMCSB

Post by sixfourfour » 19-Jan-14 02:52

WOW. Had a quick look around. I'll do more for sure. THANKS for sharing what you know. That original game, for me, was and is a timeless classic.

THANKS!

User avatar
Sophia
Concise and Honest
Posts: 3978
Joined: 12-Sep-02 19:50
Location: Nowhere in particular
Contact:

Re: Back to the source: ReDMCSB

Post by Sophia » 19-Jan-14 19:45

It means I am impressed.
This is quite an effort!

User avatar
Chaos-Shaman
High Lord
Posts: 2595
Joined: 3-May-06 17:26
Location: The Gates of Hell

Re: Back to the source: ReDMCSB

Post by Chaos-Shaman » 19-Jan-14 23:47

5 years is a long time, pure devotion and love for the magical game.
keep your gor coin handy

User avatar
Bit
Mon Master
Posts: 1021
Joined: 3-Mar-08 09:53
Location: Nuts trees

Re: Back to the source: ReDMCSB

Post by Bit » 20-Jan-14 09:33

Just amazing!
Matching up with the compiler... so, digging out all the compiler's patterns in all their dependencies...
Paul told me I'm nuts when I started the recompilation of DM2 (and I'm still in the nuts trees, but there is light in the end of the tunnel) - and kentaro pointed me to the Watcom compiler. But that deep that it matches...
/me bows!!!

btw: didn't look into the source yet, but if it is pretty pure C (without Windows-API like CSBwin is), I probably can spend the extensions to handle true-color-graphic. I went through that when doing my recompilation - there are more different parts than one would think, including such things as fluxcage/teleporter-graphic on the sideview etc. It's just - I had to kill the old caching system for that...

User avatar
Gambit37
Should eat more pies
Posts: 13203
Joined: 31-May-00 11:57
Location: Location, Location
Contact:

Re: Back to the source: ReDMCSB

Post by Gambit37 » 20-Jan-14 14:23

An amazing effort Christophe! And there was I thinking that only Mr Stevens was crazy enough to undertake such an effort...

It's amazing what one can achieve with dedication and focus. I'm altogether too easily distracted to finish things.

Well done. :-)

User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Re: Back to the source: ReDMCSB

Post by ChristopheF » 20-Jan-14 19:27

Thanks everybody! I agree with 'nuts' and 'crazy' :)

@Bit
I'm sure the methods I've used would also work on DM2 if you have the correct compiler version. The DM2 program is much larger, though.

About the 5 years, I want to add that it has not been a full time job at all, it is just that I started around 5 years ago. I don't know how many hours I spent on all this... probably several hundreds.
When I started, I knew nothing about 68000 assembly and the inner workings of the Atari ST, compilers/linkers. I learned a lot.
I spent less than 3 years working on the disassembled code. Around 8 months working with Megamax C and converting all assembly code to C code. Then more than one year to understand how everyting worked, give nice names to functions and variables, and write the documentation (the list of bugs took me a lot of time to build).

User avatar
dungeon.master
Artisan
Posts: 178
Joined: 25-Dec-02 19:29

Re: Back to the source: ReDMCSB

Post by dungeon.master » 20-Jan-14 19:55

Bravo Christophe ! :D

Amazing work, I started to read the protection and bugs sections : it's really impressive.

About the protection I remember that it was very nasty : a friend who mades a copy from my original has a lot of troubles with it :lol:
He said that its party was killed by giant fireballs coming from nowhere, some areas or weapons were not avalaible, the games hangs after 1 or 2 hours playing etc ... Just enough to make you buy the original :lol: :lol:

I also appreciate the efforts you put to list and explains the several bugs.

THANKS !
In Search Of Dungeon Master Grail
But
Resting Now, as
Banned User

User avatar
terkio
Pal Master
Posts: 805
Joined: 10-Jul-12 18:24

Re: Back to the source: ReDMCSB

Post by terkio » 21-Jan-14 08:49

Many thanks. :D
An outstanding professional work. The ultimate knowledge on DM and CSB.
I recently said, the Dungeon Master Encyclopedia has everything....Now, it has everything including the source code and all to build.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman

User avatar
Bit
Mon Master
Posts: 1021
Joined: 3-Mar-08 09:53
Location: Nuts trees

Re: Back to the source: ReDMCSB

Post by Bit » 21-Jan-14 11:38

Gave the 'make' a work - takes some time (even with Altgr-X), but completed!
Still, that work is more incredible than anyone of us can imagine.

User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Re: Back to the source: ReDMCSB

Post by ChristopheF » 5-Aug-14 09:00

Release 2 is now available (Updated link in the first post of this thread)

This minor release has updates to the documentation (mainly additional bugs are documented) and a few minor changes here and there. Check the History section in Readme.htm

zoinkers
Novice
Posts: 19
Joined: 11-Feb-14 19:09

Re: Back to the source: ReDMCSB

Post by zoinkers » 17-Oct-15 18:53

As an ex-Amiga user, I'm interested in looking over the source code of the Amiga versions you did. I see in the quora post by Doug Bell, you even did the PC version. Is there a v3 release coming? :-)

User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Re: Back to the source: ReDMCSB

Post by ChristopheF » 18-Oct-15 13:28

Doug Bell mentioned my work on ReDMCSB here: https://www.quora.com/Is-it-possible-to ... ource-code

There is definitely a Release 3 package in the works. In the past weeks, I have been working on merging my Amiga source code with the Atari ST source code from Releases 1 and 2. I had to update quite a lot of small details here and there and split the source code over more files so that things are consistent and also to avoid code duplication. I still have a lot of work though to make the code cleaner, but right now I can compile both Atari ST and Amiga versions from the same set of source code (using conditional compilation directives). Note that for Amiga, this only covers versions 2.x as versions 3.x are quite different (cross compiled on Macintosh, and with some major differences in the code itself).

If you want to have a glimpse into the source code in its current state, send me an email and I'll reply with a preview package.

zoinkers
Novice
Posts: 19
Joined: 11-Feb-14 19:09

Re: Back to the source: ReDMCSB

Post by zoinkers » 18-Oct-15 18:11

Thanks for the info. I'm happy to wait for the final polished release :-)

zoinkers
Novice
Posts: 19
Joined: 11-Feb-14 19:09

Re: Back to the source: ReDMCSB

Post by zoinkers » 19-Mar-17 21:08

How's things going Christophe?

User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Re: Back to the source: ReDMCSB

Post by ChristopheF » 20-Mar-17 06:46

I have been working for some months on the versions that were compiled on Macintosh (the ones that have .FTL executable files = X68000 and Amiga 3.x versions). Each of these versions contains several .FTL files: one for the game engine and others containing 'drivers' or other programs (swoosh FTL logo, champion editor, anim engine, etc.).
As of now, I have only completed the main program of DM/CSB for X68000 and I will soon complete the one from CSB 3.1 Amiga (the other amiga versions should follow quickly as they are very similar).
I still have a few months of work though before this is completed.

zoinkers
Novice
Posts: 19
Joined: 11-Feb-14 19:09

Re: Back to the source: ReDMCSB

Post by zoinkers » 21-Mar-17 06:17

Crikey, that's dedication. Is there any chance of a point release to scrape through?

User avatar
ChristopheF
Encyclopedist
Posts: 1259
Joined: 24-Oct-99 12:36
Location: France
Contact:

Re: Back to the source: ReDMCSB

Post by ChristopheF » 21-Mar-17 06:58

If you want to have a look, I can share my work-in-progress unified source code for Atari, Amiga, PC, PC-98 and X68000.
If you're interested in Amiga versions, I'd wait a few weeks so I can at least complete the work on the game engine in these versions.

FGoset
Neophyte
Posts: 1
Joined: 17-Jun-17 14:00

Re: Back to the source: ReDMCSB

Post by FGoset » 17-Jun-17 14:06

Many thanks for your work. I'm currently writing a clone of DM and this will be very helpful to understand many of the hidden aspects of this game.

Post Reply