2

I'm trying to make a Doom-like game similar to classic Doom that runs on older hardware, and as such I would like to use Boom, an older, open source port of Doom. I've also looked into PrBoom, but the pre-compiled Boom executable works fine on Windows so I'm left to wonder what the point of PrBoom was. Anywho, I've found out that Boom is compiled via DJGPP version 2.02. I've jumped through what seems like hoops to find that version - and all of the programs that will run with it - to compile the code (they're avaliable here, under the v2 folders). This is what I've ended up with (I apologize but I don't know what some of the exact version numbers are, but I'm sure they're the right version because of the date they were added to the ftp server in question):

  • bnu2121.zip (Binutils 2.121)
  • bsn128n.zip (Bison 1.28)
  • em1934s3.zip (Emacs)
  • gcc2952b.zip (GCC 2.952)
  • gdb418b.zip (GNU Debugger 4.18 (?))
  • gpp2952b.zip (G++ 2.952)
  • mak379b.zip (Make 3.79)
  • objc2952.zip (ObjectiveC)
  • txi40b.zip ("Text file viewer" according to the website I used to find out how to install DJGPP in general)

Using the website I just posted to download the files proved to be unsuccessful as I got multiple errors regarding dprintf when trying to compile. The versions I found and downloaded from that first website don't have that error, but instead I get a new error that seems to suggest I got one of the programs wrong:

m_fixed.h:82: operand constraint contains '+' or '=' at illegal position.

and alas, I'm very unexperienced with x86 assembly code, so I have no idea how to fix the code in question to make it compile. So, what program did I get wrong?

EDIT: For those asking, the code is as follows:

            asm("  imull %2 ;"
                "  shrdl $16,%%edx,%0 ;"
                : "=a,=a" (result)           // eax is always the result
                : "0,0" (a),                 // eax is also first operand
                 "m,r" (b)                  // second operand can be mem or reg
                : "%edx", "%cc"              // edx and condition codes clobbered
[line 119]      );
ioi-xd
  • 209
  • 1
  • 2
  • 2
    Instead of juggling around with versions of the tools installed, it might be faster to just look at the places the compiler is complaining about, and to fix the code to make it compile. Yes, that requires knowledge about how to program in C, and if your header file contains assembly, how to use that with gcc (docs are available). No, I can't tell what to fix here just based on the error message. – dirkt Jul 10 '20 at 04:48
  • It would be good if you could show us line 199 of m_fixed.h and the surrounding code – Omar and Lorraine Jul 10 '20 at 07:02
  • and at least 3 lines before it ... Also are you compiling as C or C++ ? – Spektre Jul 10 '20 at 08:23
  • @OmarL I added the code in question. – ioi-xd Jul 10 '20 at 14:31
  • @Spektre The game is coded in regular C. – ioi-xd Jul 10 '20 at 14:31
  • check your compiler setting C files compiled as C++ are sometimes making bad stuff on GCC (sometimes encapsulation in extern "C" { here #include }; helps. 2. the asm syntax is weird. its more usual to have asm { instruction; instruction; .... } in C/C++ no "instruction" also the $ and % are weird maybe you should get the operands from BP pointed heap instead of % and direct constant for $ (but I am just assuming the meaning of those). However according to GC its extended asm but I never saw this in GCC
  • – Spektre Jul 10 '20 at 15:26
  • How would I check that? If you're referring to the Makefile, it explicitly uses gcc to compile and not g++. Also, I tried using the extern "C" line in one of the files that "m_fixed.h" is included in gives the following error: parse error before string constant. As far the extended asm, I'm willing to believe that it's there due to this being older gcc (version 2) – ioi-xd Jul 10 '20 at 16:37
  • some IDEs have project options and there you can see if it is C or C++ however it looks like you really have C. The asm {} C/C++ syntax is actually older than Windows ...IIRC it starts with Borland's TC,TCPP. The extern "C" directive tells CPP compiler to compile what is inside {} as C and also to use C calling style of functions (for importing obj,dll,...). – Spektre Jul 11 '20 at 08:08
  • I'm just guessing - I am not sure about the two output operands. Try removing the , =a. This is the result - C only takes one result. – cup Jul 11 '20 at 08:41
  • I would suggest writing levels for Doom instead. Much faster to get to actual gameplay. – Thorbjørn Ravn Andersen Jul 13 '20 at 14:03
  • @cup Now the error is operand constraints for 'asm' differ in number of alternatives – ioi-xd Jul 13 '20 at 14:38
  • @ThorbjørnRavnAndersen I would like to add new features to the Doom code that can't be added in WADs, though. – ioi-xd Jul 13 '20 at 14:39
  • @ioi-xd Ah, but given your current problems I would suggest smaller steps to get there. What are the features? – Thorbjørn Ravn Andersen Jul 13 '20 at 15:11
  • Multiple characters, new items, new music...I'm not sure what other features I want to add just yet but I'm sure they can't be accomplished with WADs alone. – ioi-xd Jul 13 '20 at 15:36
  • I would spend some time looking at how the precompiled boom binary was compiled, as you need to reconstruct this precisely. – Thorbjørn Ravn Andersen Jul 13 '20 at 16:09