; Copyright (C) 1992-1994 by Celso Minnitti Jr. All Rights Reserved. PUBLIC root32 _TEXT segment byte public 'CODE' assume cs:_TEXT, ds:_TEXT .386 ;************************************************************************** ; ROOT32 ; enter: EAX = # ; return: EAX = cubic root ; EDX = reminder ;************************************************************************** root32 proc near push ecx push ebx push esi xor ecx,ecx inc cx mov edx,ecx mov ebx,ecx ;ecx=edx=ebx=1 mov esi,6 root32_loop: cmp edx,eax je short root32_ret ja short root32_ret0 add ebx,esi ;ebx=7 ,19,37,61... add esi,6 ;esi=12,18,24,30... add edx,ebx ;edx=8 ,27,64,125... inc ecx ;ecx=2 , 3, 4, 5 jmp root32_loop root32_ret0: dec ecx sub edx,ebx root32_ret: sub edx,eax neg edx mov eax,ecx pop esi pop ebx pop ecx ret root32 endp _TEXT ends end