Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 assembly programming
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tuena




PostPosted: Wed Dec 02, 2009 4:10 pm   Post subject: assembly programming

can anyone help me about this question?

Write a subroutine CMP ARRAY which compares two arrays of bytes lexigraphically.
CMP_ARRAY: ...
...
...
RET
? Assume the arrays are stored in memory location: 100 ? 109 for the first
array, and 110 ? 119 for the second array.
? Make use of the subroutine CMP.
? The return value is 0, 1, 2:
? If array 1 equals to array 2, then return 0.
? If array 1 is less than array 2, then return 1.
? Otherwise return 2.
? The return value is to be stored in register D.
? You are allowed to use memory to store temporary counters and variables
etc.
3
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Dec 02, 2009 4:22 pm   Post subject: RE:assembly programming

Assuming that this is the previous assignment from your class, have you figured that out?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
tuena




PostPosted: Wed Dec 02, 2009 4:32 pm   Post subject: RE:assembly programming

I haven't done it yet. i dont know how to compare arrays.
Tony




PostPosted: Wed Dec 02, 2009 5:12 pm   Post subject: RE:assembly programming

You should figure out how to compare individual elements first. If one is less than or greater than, then so is the lexicographic order of the arrays. If the elements are equal, you move on to compare the next element, until you find a difference or run out of elements to compare.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: