Due date: See Class Webpage
Observe the Emory Honor Code when doing this (and all other) homework.
|
Open the Terminal in EGTAPI and enter these commands into the terminal (at the bottom of EGTAPI):
mkdir ~/cs255/pj5 cp /home/cs255001/Handouts/pj5/* ~/cs255/pj5 |
|
In depth understanding about (1) how a computer accesses variables (especially structured varaibles) in memory and (2) using registers in computations forms the basis of assembler programming.
To get you going with programming in ARM, I have provided the skeletal program pj5.s and its Egtapi debug information file egt.pj5.arm. In the preparation step, you have made a copy of these files into your CS255 project directory.
The skeletal program pj5.s has 10 sections, labeled as Q1, Q2, ..., Q10 corresponding to questions 1 through 10 (see below).
Write the assembler instructions the each answer in the corresponding section of the pj5.s file.
The variables definition section of the skeletal program pj5.s contains the following:
************************************** * Variables used to display output ************************************** ans_b: .skip 1 * In Java: byte ans_b; ans_w: .skip 2 * In Java: short ans_b; ans_l: .skip 4 * In Java: int ans_b; **************************************** * Indices used to select array elements **************************************** i: .byte 2 * In Java: byte i = 2; j: .2byte 3 * In Java: short w = 3; k: .4byte 4 * In Java: int k = 4; **************************************** * 3 arrays of 10 elements **************************************** A: .byte 11, -22, 33, -44, 55, -66, 77, -88, 99, -123 B: .2byte 111, -222, 333, -444, 555, -666, 777, -888, 999, -5432 C: .4byte 1111, -2222, 3333, -4444, 5555, -6666, 7777, -8888, 9999, -9876 Comment: A is an array of 10 bytes, Comment: B is an array of 10 shorts and Comment: C is an array of 10 integers. ******************************************************** * One linked list starting at head * * head ->[1234,89,-11]->[2345,78,66]->[-3456,67,44] * ->[4567,56,77]->[5678,45,44] ******************************************************** head .4byte list1 Comment: head points to the first element of a linked list. The linked list has been set up already. Each linked list element has the following structure: class list { int value1; // 4 bytes short value2 // 2 bytes short value3 // 2 bytes list next; // points to the next list element } |
The homework assignment questions will ask you to:
|
Be very careful and use the correct operand size.
Q1: ans_b = A[3]; (ans_b: -44) Q2: ans_i = B[8]; (ans_i: 999) Q3: ans_s = C[k]; (ans_s: 5555) Q4: ans_s = A[i + j]; (ans_s: -66) Q5: ans_s = C[j + k]; (ans_s: -8888) Q6: ans_i = A[i] + B[k]; (ans_i: 33 + 555 = 588) Q7: ans_i = B[A[k] - 50]; (ans_i: B[55 - 50] = B[5] = -666) Q8: ans_s = B[14]; (ans_s: 3333, figure out for yourself what happened !!) Q9: ans_i = head.value3; (ans_i: -11) Q10: ans_s = head.next.next.value1; (ans_s: -3456) |
The following is a general guideline for debugging assembler programs:
|
(More information on debug: read the Egtapi documentation)
A concrete Example:
|
(In EGTAPI, select: File Browser, Turnin, click on the file you want to turn in, use the turn in code: pj5)
You can also use the turnin command (executed while you're in your cs255 directory)
Open the Terminal in EGTAPI and type in these command:
/home/cs255001/turnin pj5.s pj5 // If you're in section 1 or /home/cs255002/turnin pj5.s pj5 // If you're in section 2 |
I want the source (so I can read it). DO NOT turn in the executable or the object code !
/home/cs255001/req-ext pj5 // If you're in section 1 or: /home/cs255002/req-ext pj5 // If you're in section 2 |
You request will be successful if you have not exceeded the maximum number of "free" (no-questions-asked) requests allowed