Reference no: EM132175033
Assembly Problem 1:
- Ensuring that it assembles and runs correctly using the tools on edoras.
- Documenting your solutions correctly.
- Organizing your handin directory and submissions correctly.
Problem :
1) Your program will prompt the user to enter a number that is less than 500. Your program will then print each of the even numbers 2 through N, one number per line.
2) You must ensure that your assembler can be assembled and run on edoras using the tools ppasm and bsvc. You may develop your solution on any machine you desire, as long as the final solution works on edoras.
3) Your solution must have a complete comment header as is detailed in your template.s file. During runtime, your solution to section 1 must output a correct title string as the first line printed. It should be in this format:
Program #3, Student Name, csscxxxx
Example Output
Output is being recorded in, outfile 55555 Program #3, Scott Kppppp, cssc1558
Enter a Number less than 500: 6
2
4
6
Output is being recorded in, outfile 55555 Program #3, Scott Kppppp, cssc1558
Enter a Number less than 500: 9
2
4
6
8
Additional Details
You do not need to do input checking. You can assume that the input value is a valid input.
Your response line must be on a single line as per the example output.
Assembly Problem 2:
1. What is printed by the following program?
move.1 alpha,D1
move.1 beta,D2
cmp.w D2,D1
bge next
lineout one
bra done
next:
lineout two
done:
break
alpha: dc.1 12345678
beta: dc.1 87654321
one: dc.b 'Message one',0
two: dc.b |'Message two',0
end
2. What is printed by the following program?
move.1 alpha,D1
move.1 beta,D2
cmp.w D2,D1
ble next
lineout one
bra done
next:
lineout two
done:
break
alpha: dc.b 1234
beta: dc.1 '1234'
one: dc.b 'Message one',0
two: dc.b 'Message two',0
end
3. Given the code fragment below, write an equivalent M68000 assembly language.
sum = 0
for i = 0; i <= 25; i+= 3 }
if { i % 2 == 0 }
sum = sum + i
You must assume that the following variable -> register assignments.
i -> DO
sum -> D1
You do not know the values of i or sum prior to where your code begins, but you can assume that they are valid. Use the provided lines and provided labels. (You do not need to use all lines ).
1)
2)
3)
4)
5)
6) loop:
7)
8)
9)
10)
11)
12)
13)
14)
15) sum:
16)
17)
18)
19)
20)
21)
22)
23) exit:
24)
25)
4. Given the following register values:
D0: FFFF FFF2
D1: 0000 4321
After execution of the instruction:
cmp.l D0,D1
a) What are the resulting values in the CCR?
b) State (YES or NO) whether or not each of the following branches to <label> would occur:
i. BHI <label>
ii. BLO <label>
iii. BCS <label>
iv. BVS <label>
v. BLE <label>
vi. BMI <label>
5 . Given the following initial register and memory values, show any changes to register(s) and/or memory that would result from execution of each instruction below, and show the value of the CCR after each.
Use the same initial values for each question.
[Note : do not translate these irstructions to machine code ].
DO: 7FFF FFFF
AO: 0000 7010
CCR: 0100
0000 7000 alpha: dc.w. 1,2,3,4,5,6,7,8,9,10
a) move.1 (A0),D0
b) add.1 alpha+8,D0
c) adda.1 #2,A0
d) addi.1 #6,D0
e) add.1 (A0),D0
6. Write Motorolla 68000 assembler code that will prompt the user to enter any number N up to 10,000. Your program will then split that number into three roughly equal chunks that add up to that original number N and print those three numbers on a single line separated by a space. If N is divisible by 3, the three chunks will be exactly equal, otherwise you will print the three numbers closest to dividing the number by 3 such that adding those 3 numbers you will have exactly N.
For example:
Enter a number:
9
333
Enter a number:
10
433
Enter a number:
11
443
Enter a number: 9997
3333 3332 3332
Attachment:- Assignment.rar