1 | ; $Id: tst1asm.asm 678 2003-09-09 19:21:51Z bird $
|
---|
2 | ;
|
---|
3 | ; Optlink testcase no. 1.
|
---|
4 | ;
|
---|
5 | ; InnoTek Systemberatung GmbH confidential
|
---|
6 | ;
|
---|
7 | ; Copyright (c) 2003 InnoTek Systemberatung GmbH
|
---|
8 | ; Author: knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
9 | ;
|
---|
10 | ; All Rights Reserved
|
---|
11 | ;
|
---|
12 | ;
|
---|
13 |
|
---|
14 | .386
|
---|
15 | .387
|
---|
16 | CODE32 segment para use32 public 'CODE'
|
---|
17 | CODE32 ends
|
---|
18 | DATA32 segment para use32 public 'DATA'
|
---|
19 | DATA32 ends
|
---|
20 | CONST32_RO segment para use32 public 'CONST'
|
---|
21 | CONST32_RO ends
|
---|
22 | BSS32 segment para use32 public 'BSS'
|
---|
23 | BSS32 ends
|
---|
24 | DGROUP group BSS32, DATA32
|
---|
25 | assume cs:FLAT, ds:FLAT, ss:FLAT, es:FLAT
|
---|
26 | CONST32_RO segment
|
---|
27 | @CBE1 dq 3ff199999999999ar ; 1.1000000000000000e+00
|
---|
28 | @CBE2 dq 3ff3333333333333r ; 1.2000000000000000e+00
|
---|
29 | @CBE3 dq 3ff4cccccccccccdr ; 1.3000000000000000e+00
|
---|
30 | @CBE4 dq 3ff6666666666666r ; 1.4000000000000000e+00
|
---|
31 | CONST32_RO ends
|
---|
32 | CODE32 segment
|
---|
33 |
|
---|
34 | ; 15 extern int _Optlink asmfoo (int i1, int i2, int i3, double rf1, double rf2, double rf3, double rf4)
|
---|
35 | align 010h
|
---|
36 |
|
---|
37 | public asmfoo
|
---|
38 | asmfoo proc
|
---|
39 | push ebp
|
---|
40 | mov ebp,esp
|
---|
41 | mov [ebp+08h],eax; i1
|
---|
42 | mov [ebp+0ch],edx; i2
|
---|
43 | mov [ebp+010h],ecx; i3
|
---|
44 | fstp qword ptr [ebp+014h]; rf1
|
---|
45 | fstp qword ptr [ebp+01ch]; rf2
|
---|
46 | fstp qword ptr [ebp+024h]; rf3
|
---|
47 | fstp qword ptr [ebp+02ch]; rf4
|
---|
48 |
|
---|
49 | ; 17 if (i1 != 1)
|
---|
50 | cmp dword ptr [ebp+08h],01h; i1
|
---|
51 | je @BLBL1
|
---|
52 |
|
---|
53 | ; 18 return 1;
|
---|
54 | mov eax,01h
|
---|
55 | pop ebp
|
---|
56 | ret
|
---|
57 | align 010h
|
---|
58 | @BLBL1:
|
---|
59 |
|
---|
60 | ; 19 if (i2 != 2)
|
---|
61 | cmp dword ptr [ebp+0ch],02h; i2
|
---|
62 | je @BLBL2
|
---|
63 |
|
---|
64 | ; 20 return 2;
|
---|
65 | mov eax,02h
|
---|
66 | pop ebp
|
---|
67 | ret
|
---|
68 | align 010h
|
---|
69 | @BLBL2:
|
---|
70 |
|
---|
71 | ; 21 if (i3 != 3)
|
---|
72 | cmp dword ptr [ebp+010h],03h; i3
|
---|
73 | je @BLBL3
|
---|
74 |
|
---|
75 | ; 22 return 3;
|
---|
76 | mov eax,03h
|
---|
77 | pop ebp
|
---|
78 | ret
|
---|
79 | align 010h
|
---|
80 | @BLBL3:
|
---|
81 |
|
---|
82 | ; 23 if (rf1 != 1.1)
|
---|
83 | fld qword ptr @CBE1
|
---|
84 | fld qword ptr [ebp+014h]; rf1
|
---|
85 | fucompp
|
---|
86 | fnstsw ax
|
---|
87 | and ax,04500h
|
---|
88 | cmp ax,04000h
|
---|
89 | je @BLBL4
|
---|
90 |
|
---|
91 | ; 24 return 4;
|
---|
92 | mov eax,04h
|
---|
93 | pop ebp
|
---|
94 | ret
|
---|
95 | align 010h
|
---|
96 | @BLBL4:
|
---|
97 |
|
---|
98 | ; 25 if (rf2 != 1.2)
|
---|
99 | fld qword ptr @CBE2
|
---|
100 | fld qword ptr [ebp+01ch]; rf2
|
---|
101 | fucompp
|
---|
102 | fnstsw ax
|
---|
103 | and ax,04500h
|
---|
104 | cmp ax,04000h
|
---|
105 | je @BLBL5
|
---|
106 |
|
---|
107 | ; 26 return 5;
|
---|
108 | mov eax,05h
|
---|
109 | pop ebp
|
---|
110 | ret
|
---|
111 | align 010h
|
---|
112 | @BLBL5:
|
---|
113 |
|
---|
114 | ; 27 if (rf3 != 1.3)
|
---|
115 | fld qword ptr @CBE3
|
---|
116 | fld qword ptr [ebp+024h]; rf3
|
---|
117 | fucompp
|
---|
118 | fnstsw ax
|
---|
119 | and ax,04500h
|
---|
120 | cmp ax,04000h
|
---|
121 | je @BLBL6
|
---|
122 |
|
---|
123 | ; 28 return 6;
|
---|
124 | mov eax,06h
|
---|
125 | pop ebp
|
---|
126 | ret
|
---|
127 | align 010h
|
---|
128 | @BLBL6:
|
---|
129 |
|
---|
130 | ; 29 if (rf4 != 1.4)
|
---|
131 | fld qword ptr @CBE4
|
---|
132 | fld qword ptr [ebp+02ch]; rf4
|
---|
133 | fucompp
|
---|
134 | fnstsw ax
|
---|
135 | and ax,04500h
|
---|
136 | cmp ax,04000h
|
---|
137 | je @BLBL7
|
---|
138 |
|
---|
139 | ; 30 return 7;
|
---|
140 | mov eax,07h
|
---|
141 | pop ebp
|
---|
142 | ret
|
---|
143 | align 010h
|
---|
144 | @BLBL7:
|
---|
145 |
|
---|
146 | ; 31 return 0;
|
---|
147 | mov eax,0h
|
---|
148 | pop ebp
|
---|
149 | ret
|
---|
150 | asmfoo endp
|
---|
151 | CODE32 ends
|
---|
152 | end
|
---|