Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 28th, 2005, 1:48 AM   #1
Brom02
Newbie
 
Join Date: Apr 2005
Posts: 1
Rep Power: 0 Brom02 is on a distinguished road
Converting ASM to 68000

Can someone help me convert ASM to 86000 I do not know much about ASM and I need this this subroutine for the program I am working on.

This is a binary search subroutine if you didn't know :-)

Thank You

Input: term is the term being searched for
Array is the pointer to the array
Asize indicates the size of array in bytes

bsearch proc termWORD,arrayWORD,asizeWORD
mov eax,array
mov ecx,array
add ecx,asize
@@:
cmp eax,ecx
jg not_found
mov edx,eax
add edx,ecx
shr edx,1
xchg DWORD PTR [edx],eax
cmp eax,term
xchg DWORD PTR [edx],eax
jg search_right
jl search_left
mov eax,edx
sub eax,array
ret
search_right:
mov ecx,edx
jmp @B
search_left:
mov eax,edx
jmp @B
not_found:
mov eax,-1
ret
bsearch endp

Last edited by Brom02; Apr 28th, 2005 at 2:39 AM.
Brom02 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC