;---------------------------------------------------------------------------\r
\r
DivU64x32 PROC\r
+ push ebp\r
+ mov ebp, esp\r
xor edx, edx ; Clear EDX\r
\r
- mov eax, [esp + 8] ; Put high 32 bits of 64-bit dividend in EAX\r
- mov ecx, [esp + 12] ; Put 32 bits divisor in ECX\r
+ mov eax, [ebp + 0Ch] ; Put high 32 bits of 64-bit dividend in EAX\r
+ mov ecx, [ebp + 10h] ; Put 32 bits divisor in ECX\r
div ecx ; Dividend Divisor Quoitent...Remainder\r
; 0:EAX / ECX = EAX EDX \r
\r
push eax ; Push quoitent in stack\r
\r
- mov eax, [esp + 4] ; Put low 32 bits of 64-bit dividend in EAX \r
+ mov eax, [ebp + 8] ; Put low 32 bits of 64-bit dividend in EAX \r
div ecx ; Leave the REMAINDER in EDX as High 32-bit of new dividend\r
; Dividend Divisor Quoitent...Remainder \r
; EDX:EAX / ECX = EAX EDX \r
\r
- mov ecx, [esp + 16] ; Put &REMAINDER to ecx\r
+ mov ecx, [ebp + 14h] ; Put &REMAINDER to ecx\r
\r
jecxz Label1 ; If ecx == 0, no remainder exist, return with quoitent in EDX directly \r
mov dword ptr [ecx], edx ; Put EDX through REMAINDER pointer in ECX \r
\r
Label1:\r
pop edx ; Pop High 32-bit QUOITENT to EDX\r
+ pop ebp\r
+\r
+ ret\r
\r
DivU64x32 ENDP\r
END\r