al_homework repository.
You may NOT use/access:
Failure to abide by these guidelines will result in a zero for the assignment and the incident will be reported to the university provost as a violation of the university academic integrity policy. A second incident of academic dishonesty (whether from this course or another computer science course) will result in an F in the course.
rank-1 height-1 weight-1 lastname-1 firstname-1 [middlename-1] rank-2 height-2 weight-2 lastname-2 firstname-2 [middlename-2] . . . . . . rank-n height-n weight-n lastname-n firstname-n [middlename-n]
The SWOPSC limits membership to no more than 100 wrestlers. All entries on a line are separated by a single space. Rank values range from 1 to n. Height and weight values are integers represented in centimeters and kilograms, respectively. Names are given with last name first. Some names include a middle name or initial. For our purposes the name can be read as a single string (i.e., no need to split last name and first name). You may assume that the longest combined name will have no more than 19 characters.
You will build an array of structs/classes to store the information from the file. After building your array you will traverse the array in search of the tallest wrestler and of the heaviest wrestler. The output of your program will simply be the array index of the heaviest wrestler and of the tallest wrestler. If there is a tie for either of these statistics then display the smallest appropriate index.
Your program will be graded according to the following criteria:
| Correctness/Completeness | 18 | pts |
| Documentation | 3 | pts |
| x86 Conventions | 3 | pts |
| Total | 24 | pts |
Documentation should include a header at the top of the program that specifies a one-line description, your name, due date, followed by a any additional info you think would be helpful (e.g., format of input file or a more lengthly explanation of the program.
It is not uncommon for each line of assembly code to have a comment. There are some better ways to do this than others. Consider the following code that is intended to set each element of an array of 100 ints to zero.
; poor documentation
xor rax,rax ; request favor from the assembly gods
loop: cmp rax,100 ; compare rax to 100
jge done ; jump if greater than or equal to
mov [a+4*rax],0 ; set memory at a+4*rax to 0
inc rax ; increment rax
jmp loop ; jump to label loop
done:
While the initial comment is funny and worthy, it doesn't contribute much. The remaining comments simply make the assembly code more verbose. In fact, anyone who knows how to code in assembly gets nothing from the comments that was not immediately evident from the statements themselves.
Consider an alternative:
; better documentation
; initialize a to have all zeroes
; for i=0 to 99 do
; a[i]= 0
xor rax,rax ; i=0
loop: cmp rax,100 ; while i<100 do
jge done
mov [a+4*rax],0 ; a[i]= 0
inc rax ; i++
jmp loop
done:
In this case the comment before the code block explains what we are trying to do
and then gives pseudocode for our plan for doing that. The comments in the code
tie the assembly commands to our pseudocode which is helpful.
NOTE: We will be modifying this program in an upcoming assignment so good documentation will be helpful.
The x86/NASM programming conventions you should follow are:
%include and %define commands.
I find it easier to set tab widths wider than the default. For those of you using vim you can edit the .vimrc folder in your home directory to contain the following line which will take effect when editing files with a .asm extension:
autocmd FileType asm setlocal shiftwidth=8 tabstop=8 softtabstop=8 noexpandtab