Archvile
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > Procedurally generating trigonometric LUTs
Pages (2): « 1 [2]  
Author
All times are GMT. The time now is 02:27. Post New Thread    Post A Reply
shadow1013
Junior Member


Posts: 228
Registered: 08-10


#ifdef __WATCOMC__
#pragma aux FixedMul = \
"imul ebx", \
"shrd eax,edx,16" \
parm [eax] [ebx] \
value [eax] \
modify exact [eax edx]

#pragma aux FixedDiv2 = \
"cdq", \
"shld edx,eax,16", \
"sal eax,16", \
"idiv ebx" \
parm [eax] [ebx] \
value [eax] \
modify exact [eax edx]
#endif

^ the above is what vanilla doom used to do fixed division.

EDIT: and multiplication. sorry about the long lateness. didnt realize how long ago this thread was

Old Post 05-10-11 01:51 #
shadow1013 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Maes
I like big butts!


Posts: 8664
Registered: 07-06


No problems :-) Since I resumed working on it, I also am interested in accuracy aspects.

Apart from the forced cast to floating point present in the linuxdoom codebase, there seems to be another thing which does not add up to your Watcom disassembly. The code currently used in Mocha Doom for the first part of FixedDiv is this one:

code:
// FixedDiv, Mocha Doom version public final static int FixedDiv (int a, int b ) { if ((Math.abs(a) >> 14) >= Math.abs(b)) { return (a^b) < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE; } else { long result; result = ((long) a << 16) / b; return (int) result; } }


which is actually based on Chocolate Doom's code. The "abs check" bit is also present in the linux doom code:

code:
// // FixedDiv, C version. // fixed_t FixedDiv (fixed_t a,fixed_t b) { if ( (abs(a)>>14) >= abs(b)) return (a^b)<0 ? MININT : MAXINT; return FixedDiv2 (a,b); }


Could you provide a disassembly of FixedDiv "1" for comparison? I'm asking because in the development branch of Mocha Doom, _D_ claimed that the abs check had to be commented out because it caused problems
in various situations. So is it supposed to be part of the vanilla codebase or is it something that crept it afterwards?

Old Post 05-10-11 08:16 #
Maes is online now Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
shadow1013
Junior Member


Posts: 228
Registered: 08-10


That is not dissasembly but rather taken from the hexen sources which provided those macros, it has identical instructions as the released linux doom assembler, where as fixeddiv, is the same function released c, just fixeddiv(1) calls fixeddiv2 after the abs check

Old Post 05-10-11 10:51 #
shadow1013 is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 02:27. Post New Thread    Post A Reply
Pages (2): « 1 [2]  
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > Procedurally generating trigonometric LUTs

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory