CSC 376
HW 3 (50 points total)
HW3 Exercises (40 points)
4.2a b c
4.4a b c d e f
4.6a b c d e f
4.8
4.9b
5.2a b c
5.3a b c
5.4a b c
5.5a b c
5.6a b c
5.7
5.8
5.9
5.11
5.12
5.14
5.16
HW1 Problems
Problem 1 (14 points)
Problems 5.20 5.21 5.22 5.23 in 4th edition text
5.20
• Comment each line except STOP and END.
• Cut and paste the Assembler Listing into your document and paste a screenshot of the Output area of the Pep8.
5.21
• Comment each line except STOP and END.
• Cut and paste the Assembler Listing into your document and paste a screenshot of the Output area of the Pep8.
5.22
• Comment each line except STOP and END.
• Cut and paste the Assembler Listing into your document and paste a screenshot of the Output area of the Pep8.
5.23
• Comment each line except STOP and END.
• Cut and paste the Assembler Listing into your document and paste a screenshot of the Output area of the Pep8.
Problem 2 (8 points)
Problem 5.25 in 4th edition of text.
5.25
• Comment each line except STOP and END.
• Cut and paste the Assembler Listing into your document and paste a screenshot of the Output area of the Pep8.
Problem 3 (8 points)
Problem 5.28 in 4th edition of text
5.28
• Comment each line except STOP and END.
• Cut and paste the Assembler Listing into your document and paste a screenshot of the Output area of the Pep8.
Problem 4(10 Points)
4a. (3 points) What is the output of the Pep8 program (below).
4b. (5 points) Explain how each of the 5 outputs are produced
—————————————————————-
Object
Addr code Symbol Mnemon Operand Comment
—————————————————————-
;HW3P1
0000 040009 BR 0x0009 ;Branch around data
0003 F102 .WORD 0xF102 ;First input
0005 00 .BYTE 0x00 ;Second input
0006 44 .BYTE ‘D’ ;Third input
0007 4F47 .WORD 20295 ;Fourth input
;
0009 390003 DECO 0x0003,d ;First output
000C 50000A CHARO ‘\n’,i
000F 390005 DECO 0x0005,d ;Second output
0012 50000A CHARO ‘\n’,i
0015 510006 CHARO 0x0006,d ;Third output
0018 50000A CHARO ‘\n’,i
001B 510007 CHARO 0x0007,d ;Fourth output
001E 50000A CHARO ‘\n’,i
0021 510008 CHARO 0x0008,d ;Fifth output
0024 00 STOP
0025 .END
—————————————————————-
4a (3 points) What is the output of the Pep8 program.
4b (5 points) Explain the 5 outputs
Problem 5 (10 Points)
• 5a (5 Points) Write the following assembly language program.
• Start at 6 and counts down by 2 to 0. (No Loops!)
• Comment each line except STOP and .END.
• Add something to the output that makes this program uniquely yours.
• Cut and paste the Assembler Listing into your document.
• 5b (3 points) Paste a screenshot of the Output area of the Pep8
• 5c (2 points) Explain the status bits NZVC at the point STOP is loaded.
5a Assembler Listing
5b Screenshot of Output Area
5c Explain the status bits NZVC
Problem 6 (10 Points)
• 6a (4 points) Write an assembly language program that corresponds to the C++ program:
• Comment each line except STOP and .END.
• Add something to the output that makes this program uniquely yours.
• Cut and paste Source Code into your document.
• 6b (4 points) Run it twice – once with values that yield an output that is within the range of the Pep8 and once with values that yield an output that is outside the range of the Pep8. Explain the limits. Paste screen shots of the Output area of the Pep8 for both runs
• 6c (2 points) Explain the status bits NZVC at the point that STOP is loaded for the invalid run.
/******************
HW3P6
******************/
#include
using namespace std;
int a;
int b;
int c;
int d;
int sum;
int ave;
int main(){
cin>>a>>b>>c>>d;
sum = a+b+c+d;
ave = sum/2/2;
cout<<"input a = "<
Post navigation