Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » Wishlist stuff
| Wishlist stuff[message #102353]
|
Fri, 21 October 2005 15:23
|
|
ebuck |
 |
Messages:123
Registered:August 2004 Location: Houston, TX |
|
|
Defrog, or anyone else interested...
there's a small assembly routine in ja2/Build/Tactical/LOS.c that could be converted to C.
Looks like it's a custom floating point stuff packed into integers. I've converted it to GNU's asm, (and brushed up on my very dusty asm in the process). From first appearances, I can state that the GCC port never worked, as the ASM is a hybrid of AT&T and Intel syntaxes.
Well, it would be nice to see it in C...
Report message to a moderator
|
Sergeant
|
|
|
|
|
|
| Re: Wishlist stuff[message #102355]
|
Tue, 25 October 2005 13:24 
|
|
ebuck |
 |
Messages:123
Registered:August 2004 Location: Houston, TX |
|
|
Defrog,
Since I know you're a bit familiar with ASM, I thought I'd just share this with you, as there are not many that might enjoy it as much:
Intel syntax (that you know so well)
asm {
// Load the 32-bit registers with the two values
mov eax, uiA
mov ebx, uiB
// Multiply them
// Top 32 bits (whole portion) goes into edx
// Bottom 32 bits (fractional portion) goes into eax
imul ebx
// Shift the fractional portion back to (lower) 16 bits
shr eax, 16
// Shift the whole portion to 16 bits, in the upper word
shl edx, 16
// At this point, we have edx xxxx0000 and eax 0000xxxx
// Combine the two words into a dword
or eax, edx
// Put the result into a returnable variable
mov uiResult, eax
}
AT&T syntax:
__asm__ __volatile__ (
// Load the 32-bit registers with the two values
"movl %1, %%eax
\t"
"movl %2, %%ebx
\t"
// Multiply them
// Top 32 bits (whole portion) goes into edx
// Bottom 32 bits (fractional portion) goes into eax
"imull %%ebx
\t"
// Shift the fractional portion back to (lower) 16 bits
"shr $16, %%eax
\t"
// Shift the whole portion to 16 bits, in the upper word
"shl $16, %%edx
\t"
// At this point, we have edx xxxx0000 and eax 0000xxxx
// Combine the two words into a dword
"or %%edx, %%eax
\t"
// Put the result into a returnable variable
"movl %%eax, %0
\t"
: "=r" (uiResult)
: "r" (uiA), "r" (uiB)
);
Note the reveral of register order.
Also the use of % (the %% is reduced to % by the time it reaches the assembler, single %'s resolve to the "out" and "in" paramter modifiers at the end. So %0 resolves to (uiResult) while %2 resolved to uiB.
Constants are preceded by '$'.
And most operators are sized (mov becomes movl, imul becomes imull, etc.) The extra l = 32 bit operations.
Yes, this asm is still Intel specific (imul), but at least AT&T syntax is used by gnu's assmebler, which is available on many platforms.
Report message to a moderator
|
Sergeant
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Wishlist stuff[message #102360]
|
Sun, 11 December 2005 23:01
|
|
TrashMan |
 |
Messages:61
Registered:November 2005 Location: Croatia |
|
|
Whishlist?
Hmm...Anyone tried to change the weapons so that single shot and burst fire are two separate entries?
that why you can have precise control over them (including weapons with burst mode only, and weapons with greater single shot cost than burst mode)
Report message to a moderator
|
Corporal
|
|
|
|
Goto Forum:
Current Time: Sat Jun 13 06:10:36 GMT+3 2026
Total time taken to generate the page: 0.01855 seconds
|