What a fun!

A forum to introduce yourself and chat to others. Also includes community announcements.
Newcomer? Please read the forum description.
Forum rules
Please read the Forum rules and policies before posting.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

What a fun!

Post by Bit »

Just came here by the encyclopedia - and those pages made my day! :)
Great thanks to all those people around that cared and still care for this old jewel! I can imagine what a lot of work was put in until you could provide the current versions, because ages ago, I tried to go the same way than Paul and the others - just became interrupted by real life. But, after testing the versions and reading a bit around here, feeling that this is a damned good community - I just made it to make that old ST run, with harddisc and monitor - and it's verified now - dust and smoke alone does not kill electric - that dinosaur still lives, and I could bring all DM and CSB files safely to my PC. And now - I'm about to do it from the scratch again - not that it would be necessary, because you've done it already, but - it's the challenge to do it - being a bit older, must check if I still got my programming skills...
With the available knowledge around, I think I got a chance - but - probably for DM only, I won't start all those preparation processes to get a good disassembly of CSB on the ST again, no idea if I even still could handle that disassembler.
Perhaps some stages later, I'll ask for exact differences - perhaps someone still got files close to the start of all - but until then, I'll try to come as far as possible - though I know what I have to expect (I already saw this lovely graphic of the movement flowchart :lol: ).
Until then, I hope I can learn more about you people (before I'll ask why those pretty fine add-on features of RTC and CSB will not be mixed :oops: )
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Welcome to the club. I hope you work
your way up to ConfluxIII. Then you will
be stuck here for a long time.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Hello, welcome to the forums!

I would watch out for asking for 'feel' of the differences between platforms if you do want to try making another clone (though why would you when CSBwin has got it so well done! :D ). People's memories are tricky for gauging that sort of thing.

I think the encyclopaedia is building up a good list of the platform differences if you hunt
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Welcome :)

Beo is right, people's memories are notoriously unreliable (don't even dare to ask about ful bombs!), but the encyclopaedia is an excellent resource. So is Paul's CSBwin code, if you really don't mind digging deep. It's rather difficult to understand, but it's no doubt many times easier than in its initial form, and he has done a great job with that. :)

I've walked the making-a-new-clone road myself, too... not something as bold as reverse engineering, but I did try to extract as many of DM's real formulas as I could from the code. (And, actually, since you mentioned it, it pretty much was some attempt to merge this with significant graphics and sound advantages of rewriting from scratch that RTC has)
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Welcome to the forums Bit, I hope you enjoy reliving your DM memories here! ;-)
User avatar
ChristopheF
Encyclopedist
Posts: 1544
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Post by ChristopheF »

Welcome Bit !
I'm always happy to know people enjoyed the encyclopaedia.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

A nice welcome, indeed.

My initial plan is to have a Win-version in C (C++ later) only - getting all hardware things ported with Allegro. Though I worked long years with DJGPP, I still have no computer with Linux to test with...
I'm with Allegro since ... hmm ... well, must be ten years now, when Shawn himself lead the process, but at some point I stopped receiving the daily digest, couldn't follow the development anymore. I'm really glad that some of you support it too - it's worth it! (Still have running selfmade versions of Heretic & Hexen for DJGPP and MSVC with Allegro - if someone is interested in a truecolor 1024*768-version, just PM ;) )

That first Win-Version should be absolutely close to the original by emulating each ST-opcode. Hope my older PC will be fast enough to have a somewhat acceptable performance - but that emulation is necessary to catch all 'unusual' things (and yes, I know about the sudden death of the party modifying some certain routines.. - don't worry, I've never been a hacker!)
And I know what stands before me - those are 50433 lines of 68000-code..., a few exception routines, some jumptables, one jmp-adress that gets modified, and - a lot of traps ofc. Such and those... Will take a time until I'll get the first pixel in the screen leaving the darkness of theory.
I'll gonna cry if I need some headsup again :P

edit:
and please don't think I would question anyone's work by doing that all again - it's just - that is an unfinished thing of mine and I have to battle it. If there is anything that I can help to reveal being still unknown by coming through the backdoor, even better. That people had the same idea and realized it and build up a community with it - I'd never could imagine.
But it shows two things: It seems to be impossible to have any thought that not another thinks the same moment - and there's always one who is better and faster :)
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

It is indeed a crazy world that we DM fans exist in and if you want to re-engineer the game -- despite it already being done -- go right ahead. There are plenty of us here who will enjoy your efforts. Good luck! :)
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Well said :D
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

It has been a month now - and I haven't more than a night each week and a few hours now and then to continue - but - *drumrolls* - I do have first results!

The DM-disassembly has turned into a large sequence of simple calls, the splitting points for routines have been found, the parameter-format for those too. After all - that finally compiles!
The calls do the minimal operations according to the 68000-opcodes, including flags.
All in all, I did something like an 68000-emulator providing special memory-areas for stack, bss-segment and main memory.
Traps have been carefully replaced, some hardware-registers already too. I walked through the endian hell and solved the register-indirect jumps. Paul will know what I mean... and I am sooo thankful for that CSBwin-source, because at some points I had to debug simultaneously to find the problem.
Now - I didn't do that much until yet - all that happens is the intro logo of 'presents Dungeon Master' - but you know that is has to run through a lot of code until that happens - and pixelformat and colors fit now!
Screen/Bitmap-thingies and palette - done by Allegro, so, the code starts with a simple main() ...

I'll step through the code until the next thing arises, which is probably the mouse - which undoubtfully will be the hardest part!
I also will keep it as close to the initial 'command-call-code' as possible. I remember I made some programs in former times that helped to 'decompile' such type of code (also watching for lifetimes of variables etc.), so that I must not replace all gotos and labels in if-else, do-while and for-blocks manually.

But - I do have a little request now!
My main source is a disassembler-listing of DM (did it with the IDEAL-assembler long time ago) - saved after the loader and the startprogram loaded and reallocated the main program.
The beginning is like this:
L_0477a0:
movea.l $4(sp),a5
move.l $1c(a5),d6
...
jsr $1b0(a5)
jmp L_047a4c(pc) <- which is the main start with the first link-command

Does anything like this exists for CSB too?
I do have CSB too, the ST still runs, so I could generate it myself again, but I know the whole process wasn't that easy.
So, if that is somehow available, please drop me a note, I'd like to insert the differences to the DM-code in my work asap.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Do you have my code with the
original disassembly as comments?
Do you have my disassembly
listing? I can find these things if I
search back far enough in my archives.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

All I got is my twenty years old DM-disassembly and the latest CSBwin-source. Already found the 'FTP'-site with older and other things and tools, but not a pure disassembly.
I found a docfile of mine how I achieved the disassembly, so if there is no other choice, I must do it that way. Sure, a commented one would be very welcome. It's such a big help to have the one or other variable name. Probably I'd been stuck already in that decompression stuff without it.

My concept has a flat. The endianess-swaps happen all the time on non-register-accesses by the minimal 68000-command-emulation routines. Put it gets critical if there is a pointer given as routine-parameter which then points to an adressregister. In that case the routine cannot decide if it's a register or other memory (happened in LZW-getnextcodeword or such and I saw I will meet two or three more of those situations) - which results in dead pointers. There is no simple solution for that except emulating the registers topdown too - which would make debugging much harder. However, I hope that will not crash the idea finally. Next are the mouse things, as I thought. :)
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Do you mind if I split your technical discussion into a new post on the DM forum instead? -- it's not really appropriate in this one anymore.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Bit wrote:All I got is my twenty years old DM-disassembly and the latest CSBwin-source.
I posted:

http://dianneandpaul.net/CSBwin/OldSource.zip

It has the Atari CSB disassembly and my
old source code with the disassembly as
comments.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Thank you very much Paul!
Have to process the listfile, but I think I can make it,

and yes Gambit, move it whereever it should be. I thought I post from time to time how far I am, and maybe have to cry for some help, but I wouldn't say that this a new development branch.

As soon as it is running (if..., but I'm in a good mood atm), we maybe can add the Allegro port to the original CSBwin, and maybe it can help somehow for whatever reason.
The current idea is to keep it as close as possible to the original disassembly code with just a few rules, so that everyone who likes to start another development branch can take it as a very simple and basic beginning.
If it is successful, I'll share the source with whoever needs it.

Now I must continue and have to hurry, because after all, I also want to play those custom dungeons ;)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

bit wrote:The endianess-swaps happen all the time
Welcome to the club. You are taking
a BIG bite. Wow! I've been there. Good luck.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Hehe, I'm already fighting such level 0 monsters like a crash-expanding graphic #2 when the others did before now :roll:

I decided to make all parameters of routines simple integers (casted the right way in the call - for now) - such type of variables will cause no more endian swap, so they can be given to data- and adressregisters without danger. But in a few cases those ones are not given to data- or adressregisters, but process on itself like sub_w(1,param1). That command is not allowed, because param1 has now kind of a const state. A quick replace with param1--; then causes the problem - the flags aren't processed, (sub_w does...) and so... a subsequent
if (_bne) goto .... gives funny results...

I think ... I better keep the values in both formats in a register, in big endian for processing, and in little endian for debugging. Yes, that sounds good and should not hurt much to implement it in that early stage.

And yes, I know it's a big bite. All mouse-things will surely not be easy, still have no idea how to link in the vbl-stuff (there's something with a second palette as I saw), and I wonder if I'll find all locations where I have to blit into screen the right way.
I like your 'hopefully_not_needed'-function most :lol:
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Quick update.
The doors opened, and I am in the dungeon now.
Got some solution for the vbl and the mousestuff.
Mousecursor shows up and moves, keyboard works too.
Though I got a nasty bug now that puts me immediately into nirvana just painting floor and ceiling, while the coordinates are still 1,3. After finding that bug, I wonder which things will work and which not.
The current todo-list (without knowing what still waits for me) just includes sound, savegame-things and probably the timer-stuff. I'm afraid of real interrupts, because then I'm a bit screwed having to lock all memory and functions, which especially will give problems with the emu-part.

Paul, I really appreciated the simultaneous debugging, though it was pretty difficult with the dispatching stuff, and my tag-numbers are pretty different to yours. You also handle some things different to the original (maybe some patch, bugfix or csb-specials, haven't still enough knowledge to decide that).
But one thing I know - you've gone through hell :D

And - I also needed a DJGPP-version of my program, because I couldn't make it to make my outputwindow (in windowed_mode) stay open when reaching a breakpoint in MSVC. That's surely just a bit of MSVC-adjustment - but I have no idea what this is.

Latest Allegro-version (4.2) also seems to have some problems with my graphics-card, I spotted that already with other programs.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

I use Allegro for DSB's graphics output, too. It's handy. :D
So, I don't think I can be any help disassembling, but if you need Allegro help feel free to ask. I'm very interested if you can get into the inner workings of the DM renderer.

I echo Paul's sentiment, good luck!
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Thanks Sophia!
So far it's an easy port with just a few calls.

EDIT:
I'm in the Hall of Champions, and all is fine!!!
Clicking on a portrait stops it - as it should be.
I'M HAPPY!

(those nasty bugs before - forgot to place the modulo part of a division into the high word in the divu-command... tsktsktsk)
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Is there any test-dungeon available with many features and short ways?
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Something like mildew or poison i think
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

YAAAAAAAAAAAAAAAAYYY! Breakthrough!
More soon ;)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Bit wrote:outputwindow (in windowed_mode) stay open when reaching a breakpoint in MSVC.
The only way I ever solved this was by
making sure that the game window was
never overlapped by the MSVC windows.
A big monitor helps. Dual monitors would
be even better but I don't have them.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Second month is almost done.

And I got a version running!
Maybe the one or other got some minutes left to test and write some results, please PM me, I won't upload it public in that stage. You also should have a pretty stable OS... the program may crash very hard, although I installed memory checks etc. - no idea what it is, it happens randomly - maybe just because of my graphics driver, runs pretty fine on my old computer.
So far I believe I got all realized, except loudness of sound, that is in a primary layout and it's good to have sound working at all.
(Btw - what was the original sample frequency? - 5000 comes pretty good).

System requirement is a computer with about 800 MHz (below it comes very slow!), and DirectX 7.0 or greater. The program finally blits to 32-bit-color (and no, that will not take the time, it is because I just have the standard edition of MSVC 6.0 which will not optimize, so the combined color and size conversion is it - even Allegro's stretchblit can't speed it up). Searching this nasty bug, I won't do anything in 8-bit-color depth anymore, and I also wanted a bigger output window. Speeding up is for later.
It comes with Allegro3939, which I trusted more than those things above that version.

A quick note - T0mi pointed me to the DSA things - I really had no idea that they hide program code in graphics.dat - a devastating information in my current state (okay, for you it's pretty fine that this is possible, but I'm some years behind and wanted to realize it pretty quick...).
Those things will not be interpreted - all entry points are closed. Perhaps give me some idea what I have to expect that will not work...

Another mysterious thing:
If I translate that code in DJGPP (older or newer versions, it's equal), walls are fine. But things and monsters and sometimes even switches in the dungeon behave pretty wrong. So, entering the level after the Hall of Champions, some clubs lie on the floor, become suddenly screamers, that can walk through the mummies gate. Funny - that doesn't happen in the MSVC-version... Perhaps a hint to this nasty bug.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

The DSA information is in the dungeon.dat file, not the graphics.dat

But yes, CSBwin has expanded the original format a few times, increasing database size, adding DSA information, adding support for different skins on the same monster, etc
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

You don't have to worry about DSAs. As far as I know they were created by Paul to expand CSBwin and the original DM/CSB engine knows absolutely nothing about them.
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

huu...
I really don't remember giving Bit that direction of DSAs being a part of original DM. We used to PM in english for quite some time till we found out we're both german. I guess we then we started to outgerman ourselfes. :-)
I'm sure Bit will get it right anyway.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Post by Bit »

Sorry, T0mi, that was simply a wrong conclusion of mine.
The question is now: which items do carry code (except the protection) and have special abilities in the original games?
Simply none?
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

Bit has finished his first playable port of DM!

WOW !!! I am deeply impressed. :shock:

He asked me to put the needed files online. Here they are:

(must have:)
http://hometown.aol.com/TToommii/DM/bit/all3939.dll
http://hometown.aol.com/TToommii/DM/bit/allegro.cfg
http://hometown.aol.com/TToommii/DM/bit/dm1.exe
(+ dungeon.dat and graphics.dat from DM)

(additional:)
http://hometown.aol.com/TToommii/DM/bit/djdm.rar
http://hometown.aol.com/TToommii/DM/bit/dungeon.dat
http://hometown.aol.com/TToommii/DM/bit/graphics.dat

Download these files and put them into the same folder.
(dungeon.dat and graphics.dat are from DM and included for completeness, no real need to download them)

details from Bit:

- dm1.exe is the version for Windows.
- djdm.exe is for DOS mode. (rared)
- instead of the Save screen the Allegro Fileselector is included
- to quit the game press F12. This will work ingame, but won't work at the dungeon entrance. (you can however pop up the task manager at any time)
- after entering the dungeon the screen will turn black for a while (depending on the power of your machine), because there are still a lot of checks included.
- Sound volume is always at 100%
- Take a look at allegro.cfg. Note the "windowed = 1" at the end. Setting it to zero runs the game in DirectX-fullscreen. Changing truecolor from 0 to 1 will run the game in 640x400/32bit instead of 320/200/8bit.

Have fun! :D
Post Reply