Crash - Launch a new game - ZDoom for Linux

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Crash - Launch a new game - ZDoom for Linux

Re: Crash - Launch a new game - ZDoom for Linux

by nerotriple6 » Wed Jun 22, 2011 5:11 pm

Wicked. Thanks for fixing guys! :mrgreen: :twisted:

Re: Crash - Launch a new game - ZDoom for Linux

by Edward-san » Wed Jun 22, 2011 2:26 pm

You should update the svn revision and recompile. This is all :P

Re: Crash - Launch a new game - ZDoom for Linux

by nerotriple6 » Wed Jun 22, 2011 11:48 am

Cool, thanks a lot! :wub:

Sorry but I just found this thread, relocated. Anywhoo, does it work to compile it normally now or is there some hocus pocus to be done?

Re: Crash - Launch a new game - ZDoom for Linux

by randi » Fri Jun 17, 2011 11:44 pm

Alright. Sounds good.

Re: Crash - Launch a new game - ZDoom for Linux

by Blzut3 » Fri Jun 17, 2011 11:18 pm

Seems to work.

Edit: Still need to check the 2nd version. It will take awhile though since my 32-bit laptop isn't very fast.

Edit 2: Second version works as well.

Re: Crash - Launch a new game - ZDoom for Linux

by randi » Fri Jun 17, 2011 10:51 pm

Sorry, I forgot about this.

How does this fare:

Code: Select all

static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
    SDWORD result, dummy;

    asm volatile
        ("xor %%eax,%%eax\n\t"
         "idivl %3"
        :"=&a,&a" (result),
         "=d,d" (dummy)
        : "d,d" (a),
          "r,m" (b)
        : "%cc");
    return result;
} 
Actually, I think I like this version better:

Code: Select all

    int result = 0, dummy;

    asm volatile
        ("idivl %3"
        :"+a,a" (result),
         "=d,d" (dummy)
        : "d,d" (a),
          "r,m" (b)
        : "%cc");
    return result;

Re: Crash - Launch a new game - ZDoom for Linux

by Blzut3 » Fri Jun 17, 2011 6:38 pm

Randy, do you want me to go ahead and commit what I have working or do you intend to find a better solution?

Re: Crash - Launch a new game - ZDoom for Linux

by Blzut3 » Mon Jun 13, 2011 10:05 pm

Same, only a line lower.

Edit: changing it to "idivl %4" and dropping the ampersand on the result line works (latter fixes the errors, former to avoid a different division by zero error). You can even use (0) per the first attempt as well this way. I, of course, have no idea what I'm doing, but that's what works.

Re: Crash - Launch a new game - ZDoom for Linux

by randi » Mon Jun 13, 2011 9:00 pm

Okay, what about this?

Code: Select all

static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
   SDWORD result, dummy;
   int zero = 0;

   asm volatile
      ("idivl %3"
      :"=&a,a" (result),
       "=d,d" (dummy)
      : "a,a" (zero),
        "d,d" (a),
        "r,m" (b)
      : "%cc");
   return result;
}  

Re: Crash - Launch a new game - ZDoom for Linux

by Blzut3 » Mon Jun 13, 2011 8:08 pm

Code: Select all

/home/blzut3/Code/ZDoom/src/gccinlines.h: In member function ‘virtual void AActor::Tick()’:
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: can't find a register in class ‘AREG’ while reloading ‘asm’
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: can't find a register in class ‘AREG’ while reloading ‘asm’
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: can't find a register in class ‘AREG’ while reloading ‘asm’
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints

Re: Crash - Launch a new game - ZDoom for Linux

by randi » Mon Jun 13, 2011 6:59 pm

What happens if you change it to this?

Code: Select all

static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
   SDWORD result, dummy;

   asm volatile
      ("idivl %3"
      :"=&a,a" (result),
       "=d,d" (dummy)
      : "a,a" (0),
        "d,d" (a),
        "r,m" (b)
      : "%cc");
   return result;
} 

Re: Crash - Launch a new game - ZDoom for Linux

by Guest » Mon Jun 13, 2011 6:39 pm

Hi !

Years later, I have the same problem (divide by 0) and I don't understand the fix in "r_main.cpp" or in "gccinlines.h"
Could you give me more precisions ?

Thanx

Re: Crash - Launch a new game - ZDoom for Linux

by Blzut3 » Mon Jun 13, 2011 4:47 pm

Here's the output from the disassembler for a version which works (MAKECONSTDivScale(32)) and the broken function. The line numbers may be a little off due to my modifications but you can find DivScale32() in there.

Re: Crash - Launch a new game - ZDoom for Linux

by Blzut3 » Sun Jun 12, 2011 11:50 pm

Is there a particular way you want me to do this? I can probably disassemble r_main.

Re: Crash - Launch a new game - ZDoom for Linux

by randi » Sun Jun 12, 2011 9:26 pm

Can you show what the compiler turned it into?

Top