Computer Science Canada

assembly programming

Author:  tuena [ 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

Author:  Tony [ 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?

Author:  tuena [ 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.

Author:  Tony [ 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.


: