source: trunk/src/kernel32/asmutil.asm@ 8415

Last change on this file since 8415 was 8415, checked in by sandervl, 23 years ago

fixed warning

File size: 3.4 KB
Line 
1; $Id: asmutil.asm,v 1.2 2002-05-15 10:57:44 sandervl Exp $
2
3;/*
4; * Project Odin Software License can be found in LICENSE.TXT
5; * Win32 Exception handling + misc functions for OS/2
6; *
7; * Copyright 1998 Sander van Leeuwen
8; *
9; */
10.386p
11 NAME except
12
13DATA32 segment dword use32 public 'DATA'
14DATA32 ends
15CONST32_RO segment dword use32 public 'CONST'
16CONST32_RO ends
17BSS32 segment dword use32 public 'BSS'
18BSS32 ends
19DGROUP group BSS32, DATA32
20 assume cs:FLAT, ds:FLAT, ss:FLAT, es:FLAT
21
22CODE32 SEGMENT DWORD PUBLIC USE32 'CODE'
23
24 PUBLIC getEAX
25 PUBLIC getEBX
26getEAX proc near
27 ret
28getEAX endp
29
30public getEDX
31getEDX proc near
32 mov EAX, EDX
33 ret
34endp
35
36getEBX proc near
37 mov eax, ebx
38 ret
39getEBX endp
40
41 PUBLIC GetFS
42GetFS proc near
43 mov eax, fs
44 ret
45GetFS endp
46
47 PUBLIC SetFS
48SetFS proc near
49 mov eax, [esp+4]
50 mov fs, eax
51 ret
52SetFS endp
53
54 PUBLIC getCS
55getCS proc near
56 mov eax, cs
57 ret
58getCS endp
59
60 PUBLIC getDS
61getDS proc near
62 mov eax, ds
63 ret
64getDS endp
65
66 PUBLIC SetReturnFS
67SetReturnFS proc near
68 push fs
69 mov eax, [esp+8]
70 mov fs, eax
71 pop eax
72 ret
73SetReturnFS endp
74
75 PUBLIC getSS
76getSS proc near
77 mov ax, ss
78 ret
79getSS endp
80
81 PUBLIC getES
82getES proc near
83 mov eax, es
84 ret
85getES endp
86
87 PUBLIC getGS
88getGS proc near
89 mov eax, gs
90 ret
91getGS endp
92
93 PUBLIC getESP
94getESP proc near
95 mov eax, esp
96 ret
97getESP endp
98
99 PUBLIC RestoreOS2FS
100RestoreOS2FS proc near
101 push 150bh
102 mov ax, fs
103 pop fs
104 ret
105RestoreOS2FS endp
106
107 PUBLIC _Mul32x32to64
108_Mul32x32to64 proc near
109 push ebp
110 mov ebp, esp
111 push eax
112 push edx
113 push edi
114
115 mov edi, [ebp+8] ;64 bits result
116 mov eax, [ebp+12] ;op1
117 mov edx, [ebp+16] ;op2
118 mul edx
119 mov [edi], eax
120 mov [edi+4], edx
121
122 pop edi
123 pop edx
124 pop eax
125 pop ebp
126 ret
127_Mul32x32to64 endp
128
129 align 4h
130
131 public _Sub64
132_Sub64 proc
133
134; 34 c = a - b;
135 push ebp
136 mov ebp, esp
137 push esi
138 push edi
139 push edx
140
141 mov edi, [ebp+10h] ;&c
142 mov esi, [ebp+08h] ;&a
143 mov eax,[esi] ;a.low
144 mov edx,[esi+04h] ;a.high
145 mov esi, [ebp+0ch] ;&b
146 sub eax,[esi] ;b.low
147 sbb edx,[esi+04h] ;b.high
148
149 mov [edi], eax ;c.low
150 mov [edi+4], edx ;c.high
151
152 pop edx
153 pop edi
154 pop esi
155 leave
156 ret
157_Sub64 endp
158
159 align 4h
160
161 public _Add64
162_Add64 proc
163
164; 25 c = a + b;
165 push ebp
166 mov ebp, esp
167 push esi
168 push edi
169 push edx
170
171 mov edi, [ebp+10h] ;&c
172 mov esi, [ebp+08h] ;&a
173 mov eax,[esi] ;a.low
174 mov edx,[esi+04h] ;a.high
175 mov esi, [ebp+0ch] ;&b
176 add eax,[esi] ;b.low
177 adc edx,[esi+04h] ;b.high
178
179 mov [edi], eax ;c.low
180 mov [edi+4], edx ;c.high
181
182 pop edx
183 pop edi
184 pop esi
185 leave
186 ret
187
188_Add64 endp
189
190
191CODE32 ENDS
192
193 END
Note: See TracBrowser for help on using the repository browser.