4.8 Subroutines - Recursive4 Class Schedule4.6 Subroutines and the interface to 4.7 Pointers and addressing

4.7 Pointers and addressing

 

4.7.1 Reading and Web Sites

  1. Read about operand addressing. Intel Vol # 1 p3-17
  2. Read about shell sorts.
  3. Read about pseudo random generators.
  4. Read about the XCHG instruction.
  5. Read about arrays in Carter Chapter 5.
  6. Read nasm section 3.3 page 33
  7. Read about JMP Intel Vol # 2A p3-384. Last sentence in the first paragraph under"Description". What does "or a memory location" mean?
  8. Search the web for "shell sort". Or try this link:

4.7.2 Notes

4.7.3 Lab Assignment, Shell & Bubble Sorts

 
  1. Use sortdvr.c at the driver program. Copy it over using this command. (Please note the period at the end of the command.)
    cp ~ltaber/sortdvr.c .
    
  2. Write a bubble sort and a shell sort as assembly language subroutines. Call them absort and ashellsort.
  3. Keep the C versions of the sorts, so you can compare your run times with the C compiler.
  4. Link your assembly language subroutines with the slightly modified sortdvr.asm. Lines with an * have been added.
       if( i<3 )   /* DO NOT bubble sort large arrays ! */
         
         start = clock();
         bsort(sort_size);
         finish = clock();
         print(sort_size, finish-start,"Bubble   ");
    
    *    start = clock();
    *    absort(sort_size);  
    *    finish = clock();
    *    print(sort_size, finish-start,"Assembly B ");
         
       init(sort_size);
       start = clock();
       shellsort(sort_size);
       finish = clock();
       print(sort_size, finish-start,"Shell    ");
    
    *  init(sort_size);
    *  start = clock();
    *  ashellsort(sort_size);
    *  finish = clock();
    *  print(sort_size, finish-start,"Assembly Shell ");
    
  5. Assembly, link, and run:
    nasm -f elf labsort.asm        (you need to write labsort.asm)
    gcc -o sortdvr labsort.o sortdvr.c
    sortdvr d                       (d for debug)
                 or
    sortdvr
              
  6. Turn in a listing and your output. The output of the assembly language sorts should match the output of the ``C'' sorts except for the sort times.

Instructor: Louis Taber, louis.taber.at.pima at gmail dot com (520) 206-6850
My web site in California
The Pima Community College web site

4.8 Subroutines - Recursive4 Class Schedule4.6 Subroutines and the interface to 4.7 Pointers and addressing