Implement A Simple Guessing Game In JavaScript
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Implement A Simple Guessing Game In JavaScript
Objectives:
-
combining C language with assembler language programs
-
debugging existing C language code
-
first x86-64 experience
-
correctly using memory addressing in assembler
-
correctly using different size registers
REMINDERS and GRADING CRITERIA:
-
This is an individual lab. No partners are permitted
-
Every lab requires a Readme file (for this lab, it should be called lab6Readme – use this name, without an extension or any other modification). This file must include the following:
# BY SUBMITTING THIS FILE AS PART OF MY LAB ASSIGNMENT, I CERTIFY THAT
# ALL OF THE CONTENT OF THIS FILE WAS CREATED BY ME WITH NO
# ASSISTANCE FROM ANY PERSON OTHER THAN THE INSTRUCTOR OF THIS COURSE
# OR ONE OF OUR UNDERGRADUATE GRADERS.
-
Your name
-
Total amount of time (effort) it took for you to complete the lab
-
Short description of any concerns, interesting problems or discoveries encountered, or comments in general about the contents of thelab
-
Describe how you used gdb to find a bug in C language program you were given while debugging it. Include how you set breakpoints, variables you printed out, what values they had, what you found that enabled you to fix the
-
Describe how you used gdb to find a bug in one of your x86-64
-
Did you have to jump between your C language/x86-64 language programs to fix any bugs?
-
You should aim to always hand an assignment in on time or early. If you are late (even by a minute
– or heaven forbid, less than a minute late), you will receive 75% of your earned points for the designated grade as long as the assignment is submitted by 11:30 pm the following day, based on the due date given above. If you are more than 24 hours late, you will receive a zero for the assignment and your assignment will not be graded at all.
-
Any lab submitted that does not compile/make – without errors or warnings – and run WILL RECEIVE AN AUTOMATIC GRADE OF ZERO. No exceptions will be made for this rule – to achieve even a single point on a lab, your code must minimally build (compile to an executable) on stdlinux and execute on stdlinux without crashing, using the following command:
LAB DESCRIPTION
1. Required file names: lab6main.c, lab6assem.s, Makefile. You do not have to create a .h file.
-
You will be given a C programming language lab6main.c file that has 3 bugs in it. IT DOES NOT WORK CORRECTLY. You can fix the bugs by changing executable statements. You may not fix any of the bugs by changing a declaration
-
The main() program accepts an indeterminate number of parameters from the command line. The minimum number of values is 1. These values should all be interpreted as signed
-
main() determines how many integers are on the command line and then creates an appropriate sized dynamic array to hold
-
main() passes the address to the array and a count to each of four assembler
-
There are four functions that must be written in x86-64 assembler:
-
The Min() program must determine the minimum value in the array and then print out the line “The minimum value is .” The minimum value must be returned to main().
-
The Max() program must determine the maximum value in the array and then print out the line “The maximum value is .” The maximum value must be returned to main().
-
The Sum() program sums the values in the array and then print out the line “The sum of values is .” The sum must be returned to main().
-
The Sort() program sorts the array values in to ascending order changing their positon in the array so that the sorted order is retained. The Sort() program must print out each individual integer value on a separate line in sorted order. I suggest a simple bubble sort.
-
Use a Makefile to create your lab6
-
To compile your .c file use gcc -g –ansi –pedantic -c c
-
To compile your .s file use gcc –g –lc –m64 –c s
-
Ignoring blank lines, your Makefile will have 9 lines. You should be able to use the Makefile you created for lab4 as a template
REQUIREMENTS
-
You must use correct stack frame procedures
-
You must use all (needful) x86-64 directives
-
You must use the correct suffix for all data types.
-
You must use correct memory addressing modes
-
You must use correct caller/callee saved register
-
You must comment your code!
-
You may *not* use a temporary array or the stack to aid you in sorting the array into ascending order
-
Your Makefile and the lab6assem.s files submitted to Carmen as a part of this program must
include the following at the top:
# BY SUBMITTING THIS FILE AS PART OF MY LAB ASSIGNMENT, I CERTIFY THAT
# ALL OF THE CONTENT OF THIS FILE WAS CREATED BY ME WITH NO
# ASSISTANCE FROM ANY PERSON OTHER THAN THE INSTRUCTOR OF THIS COURSE
# OR ONE OF OUR UNDERGRADUATE GRADERS.
HELPFUL SUGGESTIONS
-
Don’t forget to use tui reg general when in gdb to see register
-
You can use next in gdb when you want do not want to go in to the code of the function being called.
-
You can use step in gdb when you want do want to go in to the code of the function being called.
-
The gdb instruction x/2w $rdi would show you two (4-byte) words starting at the address in register rdi. Rather than $rdi, you can use a specific memory
-
The general form of this instruction is: x/[NUM][SIZE][FORMAT] where NUM = number of objects to display
SIZE = size of each object (b=byte, h=half-word, w=word, g=giant (quad-word)) FORMAT = how to display each object (d=decimal, x=hex, o=octal, etc.)
If you don’t specify SIZE or FORMAT, either a default value, or the last value you specified in a previous ‘print’ or ‘x’ command is used.
LAB SUBMISSION
Always be sure your linux prompt reflects the correct directory or folder where all of your files to be submitted reside. If you are not in the directory with your files, the following will not work correctly.
You must submit all your lab assignments electronically to Carmen in .zip file format. The format of zip command is as follows:
where <zip_filename> is the name of the file you want zip to add all of your files to and <files-to- submit> is a list of the file(s) that make up the lab. Remember that you have to be at the correct location (the designated directory) for the command to be able to find your files- to-submit.
For lab6, the zip command would look like this:
Once you execute the command, you should find a file in your lab6 directory called lab6.zip; this is the file that must be put in Carmen.