Logo 
Search:

Assembly Language Forum

Ask Question   UnAnswered
Home » Forum » Assembly Language       RSS Feeds

writing assembly code using 2 procedure and one macro to sort array of names

  Asked By: Taysir    Date: Apr 14    Category: Assembly Language    Views: 12127
  

String Instructions
Modify lab 5 to sort and search an array of names. Define the array of names as:

Names DB "Edna Mode "
DB "Michael Corleone"
DB "Marty McFly "
DB "Ron Burgundy "
DB "Rick Blaine "
DB "Travis Bickle "
DB "Daniel Plainview"
DB "Patrick Bateman "
DB "Peter Venkman "
DB "Jules Winnfield "
DB "Atticus Finch "
DB "Walter Sobchak "
DB "Ferris Bueller "
DB "Keyser Soze "
DB "Lou Bloom "
DB "Amy Dunne "
DB "Anton Chigurh "
DB "Tommy DeVito "
DB "Rick Deckard "
DB "Lester Burnham "
DB "Harry Callahan "
DB "Ellen Ripley "
DB "Shaun Riley "
DB "Amelie Poulain "
DB "Axel Foley "
DB "Sarah Connor "
DB "George Bailey "
DB "Hans Landa "
DB "Marge Gunderson "
DB "John McClane "
DB "Tony Montana "
DB "Frank Drebin "
DB "Lisbeth Salander"
DB "Martin Blank "
DB "Roy Batty "
DB "Tyler Durden "
DB "Ethan Hunt "
DB "Inigo Montoya "
DB "Norman Bates "
DB "Randle McMurphy "

Note that there are 40 names and each name is 16 characters.

Use string instructions to compare names in the fast bubble sort and fast bubble search.

Procedures and Macros
Use two procedures and one macro in your code as follows:
nCMP:
A macro to compare two strings. The macro uses string instructions to perform the comparison. Pass to the macro the offset of the two strings. Example usage:
nCMP offset X[ESI], offset X[EDI]

namesort:
A procedure to sort a names array. Pass to the procedure the location of the names array, the number of names in the array, and the length of each name. The procedure returns nothing. All arguments must be passed through a stackframe. The procedure uses the fast bubble sort from Lab 4. Use the macro nCMP in the procedure.

namesearch:
A procedure to search for a name in a sorted array. Pass to the procedure the offset of variable contains the name to be searched, location of the names array, the number of names in the array, and the length of each name. The procedure returns a logical 1/0 for found/not found and the index of the name that is found. All arguments must be passed through a stackframe. The procedure uses the fast fast search algorithm from Lab 4. Use the macro nCMP in the procedure.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 




Tagged: