Visual C++ 6.0 Compiler settings

So I want to know how to compile this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
void AddToCentre(float a0,float & a1,float & a2)
{
	if(-50.0f >= a2 && 50.0f >= a2 && -50.0f >= a0 && a0 >= 50.0f && a0 > a1 - 2.0f && a0 > a1 + 2.0f )
	{ 
		a2 = a0;
		a1 = a0;
	}
	else
	{
		a2 = 0; 
		a1 = a0; 
	}
}


To look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.text:00417310 ; int __cdecl AddToCentre(float, int, int)
.text:00417310 ?AddToCentre@@YAXMAAM0@Z proc near      ; CODE XREF: SYS_DI::ReadInputs(void)+92A>p
.text:00417310                                         ; SYS_DI::ReadInputs(void)+941>p ...
.text:00417310
.text:00417310 arg_0           = dword ptr  4
.text:00417310 arg_4           = dword ptr  8
.text:00417310 arg_8           = dword ptr  0Ch
.text:00417310
.text:00417310                 mov     ecx, [esp+arg_8]
.text:00417314                 mov     edx, [esp+arg_4]
.text:00417318                 fld     ds:flt_62A354
.text:0041731E                 fcomp   dword ptr [ecx]
.text:00417320                 fld     [esp+arg_0]
.text:00417324                 fnstsw  ax
.text:00417326                 test    ah, 5 ;********* HERE IS THE DIFERENCE
.text:00417329                 jp      short loc_41737F ;********
.text:0041732B                 fld     dword ptr [ecx]
.text:0041732D                 fcomp   ds:flt_62A358
.text:00417333                 fnstsw  ax
.text:00417335                 test    ah, 5
.text:00417338                 jp      short loc_41737F
.text:0041733A                 fld     ds:flt_62A354
.text:00417340                 fcomp   st(1)
.text:00417342                 fnstsw  ax
.text:00417344                 test    ah, 5
.text:00417347                 jp      short loc_41737F
.text:00417349                 fcom    ds:flt_62A358
.text:0041734F                 fnstsw  ax
.text:00417351                 test    ah, 5
.text:00417354                 jp      short loc_41737F
.text:00417356                 fld     dword ptr [edx]
.text:00417358                 fsub    ds:flt_62A35C
.text:0041735E                 fcomp   st(1)
.text:00417360                 fnstsw  ax
.text:00417362                 test    ah, 41h
.text:00417365                 jp      short loc_41737F
.text:00417367                 fld     ds:flt_62A35C
.text:0041736D                 fadd    dword ptr [edx]
.text:0041736F                 fld     st(1)
.text:00417371                 fcompp
.text:00417373                 fnstsw  ax
.text:00417375                 test    ah, 41h
.text:00417378                 jp      short loc_41737F
.text:0041737A                 fst     dword ptr [ecx]
.text:0041737C                 fstp    dword ptr [edx]
.text:0041737E                 retn
.text:0041737F ;
.text:0041737F
.text:0041737F loc_41737F:                             ; CODE XREF: AddToCentre(float,float &,float &)+19<j
.text:0041737F                                         ; AddToCentre(float,float &,float &)+28<j ...
.text:0041737F                 mov     dword ptr [ecx], 0
.text:00417385                 fstp    dword ptr [edx]
.text:00417387                 retn
.text:00417387 ?AddToCentre@@YAXMAAM0@Z endp
Instead of this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.text:00402581 ; int __cdecl AddToCentre(float, int, int)
.text:00402581 ?AddToCentre@@YAXMAAM0@Z proc near
.text:00402581
.text:00402581 arg_0           = dword ptr  4
.text:00402581 arg_4           = dword ptr  8
.text:00402581 arg_8           = dword ptr  0Ch
.text:00402581
.text:00402581                 mov     ecx, [esp+arg_8]
.text:00402585                 mov     edx, [esp+arg_4]
.text:00402589                 fld     ds:__real@4@c004c800000000000000
.text:0040258F                 fcomp   dword ptr [ecx]
.text:00402591                 fld     [esp+arg_0]
.text:00402595                 fnstsw  ax
.text:00402597                 test    ah, 1 ;**************
.text:0040259A                 jnz     short loc_4025F2 ;**************
.text:0040259C                 fld     ds:__real@4@4004c800000000000000
.text:004025A2                 fcomp   dword ptr [ecx]
.text:004025A4                 fnstsw  ax
.text:004025A6                 test    ah, 1
.text:004025A9                 jnz     short loc_4025F2
.text:004025AB                 fld     ds:__real@4@c004c800000000000000
.text:004025B1                 fcomp   st(1)
.text:004025B3                 fnstsw  ax
.text:004025B5                 test    ah, 1
.text:004025B8                 jnz     short loc_4025F2
.text:004025BA                 fcom    ds:__real@4@4004c800000000000000
.text:004025C0                 fnstsw  ax
.text:004025C2                 test    ah, 1
.text:004025C5                 jnz     short loc_4025F2
.text:004025C7                 fld     dword ptr [edx]
.text:004025C9                 fsub    ds:__real@4@40008000000000000000
.text:004025CF                 fld     st(1)
.text:004025D1                 fcompp
.text:004025D3                 fnstsw  ax
.text:004025D5                 test    ah, 41h
.text:004025D8                 jnz     short loc_4025F2
.text:004025DA                 fld     dword ptr [edx]
.text:004025DC                 fadd    ds:__real@4@40008000000000000000
.text:004025E2                 fld     st(1)
.text:004025E4                 fcompp
.text:004025E6                 fnstsw  ax
.text:004025E8                 test    ah, 41h
.text:004025EB                 jnz     short loc_4025F2
.text:004025ED                 fst     dword ptr [ecx]
.text:004025EF                 fstp    dword ptr [edx]
.text:004025F1                 retn
.text:004025F2 ;
.text:004025F2
.text:004025F2 loc_4025F2:                             ; CODE XREF: AddToCentre(float,float &,float &)+19<j
.text:004025F2                                         ; AddToCentre(float,float &,float &)+28<j ...
.text:004025F2                 mov     dword ptr [ecx], 0
.text:004025F8                 fstp    dword ptr [edx]
.text:004025FA                 retn
.text:004025FA ?AddToCentre@@YAXMAAM0@Z endp
Last edited on
If you know what you want the assembly to look like, why not just stick that right in there?

http://www.codeproject.com/Articles/15971/Using-Inline-Assembly-in-C-C
Btw use some decent compiler, not VS6, it's from 1998 for god's sake :(
Why not write the function in assembler? If you use SP5 on VS6, you can install the Processor Pack that has masm.
You maybe not understand me right. I want to configure the VC++ 6.0 Compiler to produce the same asm code in the 1st ASM snapshot made with IDA PRO. Those 2 ASM snapshots are made on EXEs compiled both with VC++ 6.0 without inline ASM (I think). The difference is that I don't have the project and the source for the first exe. Any help? I tried using full optimization but no luck, maybe other compiler setting or new SP or the source code is not that?
Anyway I Installed the Processor Pack and the problem sloved but now I want to ask something - how to install the intel compiler on VC++ 6.0 SP5 to compiler programs with SSE instructions for Pentium 3 or for Pentium 4. The compiler need to be about 2000~2003 year released. Please help.
Topic archived. No new replies allowed.