CSCI 360 Assignment 1 50 points This assignment is in three
CSCI 360
Assignment 1
50 points
This assignment is in three parts:
Part A
Write a program that does the following:
Declare a fullword FIRST with the value 103.
Declare a fullword SECOND with the value 68.
Subtract SECOND from FIRST. To do this, simply load these numbers into registers and use an SR.
Add FIRST to SECOND. To do this, load the two numbers into registers (a different pair of registers) and use an AR.
Now use an XDUMP to dump out the registers and look at the register values to see your answer.
Part B
Modify the program from Part A as follows:
Declare two consecutive fullwords of storage called DIFF and SUM.
Store (ST) the first answer (FIRST minus SECOND) into DIFF.
Store (ST) the second answer (SECOND plus FIRST) into SUM.
XDUMP that area of storage (containing DIFF and SUM) using XDUMP. You can use XDUMP to print the values in storage by using the label followed by the length of the field like this: XDUMP DIFF,8.
Go into the XDUMP output and verify your math is correct.
Part C
Now rewrite your program using explicit addressing. This means on the L and ST, take out your labels and fill in the addresses of the various fullwords. You can get these addresses from the program listing of part B.
Other Notes
Hint: Start with the JCL and the trivial little program we had in the lab training exercise. Take out the two SR lines and put in what you need.
Be sure your name and the assignment number (including Part A, B or C) is included in the documentation for each file.
Turn in all three programs (from Parts A, B and C) and the output file from Part C.
This assignment is in three parts Write a program that does the following: Declare a fullword FIRST with the value 103. Declare a fullword SECOND with the value 68. Subtract SECOND from FIRST. o do this, simply load these numbers into registers and use an SR. Add FIRST to SECOND. To do this, load the two numbers into registers (a different pair of registers) and use an AR. Now use an XDUMP to dump out the registers and look at the register values to see your answer. Modify the program from Part A as follows: Declare two consecutive fullwords of storage called DITT and SUM. Store (ST) the first answer (FIRST minus SECOND) into Store (ST) the second answer (SECOND plus FIRST) into SUM. XDUMP that area of storage (containing DIFF and SUM) using XDUMP. You can use XDUMP to print the values in storage by using the label followed by the length of the field like this: XDUMP DIPF, 8. Go into the XDUMP output and verify your math is correct. Now rewrite your program using explicit addressing. This means on the Land ST, take out your labels and fill in the addresses of the various fullwords. You can get these addresses from the program listing of part B. Be sure your name and the assignment number (including Part A, Bor C)is included in the documentation for each file. Turn in all three programs (from Parts A. Band and the output file from Part C.Solution
firstsecond
.data
var1 : .first,103
var2: .second,68
.text
-start
lw $to,first
lw $t1,second
SUB $t1,$t0
lw $t2,first
lw $t3,second
ADD $t2.$t3
-xdump-metadata-output-file=sumdiff
2.diff,sum
.data
var1: .diff
var2: .sum
.text
-start
add $t0,$t1,$t2
mov sum,$t0
sub $t3,$t4,$t5
mov diff,$t3
sw sum,$t0
sw diff,$t3
xdump sum,8
xdump diff,8
3.
.data
var1: .diff
var2: .sum
.text
-start
add $t0,$t1,$t2
mov sum,0x01234
sub $t3,$t4,$t5
mov diff,0x05678
sw sum,$t0
sw diff,$t3


