Answer the following questions which refer to the above PEP9 program. You must e
ID: 3709631 • Letter: A
Question
Answer the following questions which refer to the above PEP9 program. You must express ALL of your answers in HEXADECIMAL using m-4 hexadecimal digits Assuming the STWA instruction at the label 'p1' has executed, the value stored from the A register to the variable RES will be: 1. 2. Assuming the STWA instruction at the label 'p2' has executed, the value stored from the A- register to the variable RES will be: Assuming the STWA instruction at the label p3' has executed, the value stored from the A- register to the variable RES will be: 3. Assuming the STWA instruction at the label p4' has executed, the value stored from the A- register to the variable RES will be: 4. 5. Assuming the STWA instruction at the label p5' has executed, the value stored from the A- register to the variable RES will be:Explanation / Answer
1)
LDWA 0x8002,i
ADDA 0x7FFF,i
1000 0000 0000 0010
0111 1111 1111 1111
0000 0000 0000 0001 ADDA => This will return a carry 1 thus BRC p1 will be taken and value modes to RES would be 0001
2)
LDWA 0x7F00,i
SUBA 0x0001,i
0111 1111 0000 0000
0000 0000 0000 0001
0111 1110 1111 1111 SUBA => Since there is not overflow BRV will be false, next instruction executes is:
LDWA 22,i => RES has 22
3)
LDWA 0x4041,i
NEGA => negate the value in A
BRGE p3 => branch if greater than or equal to 0, which is false, Next instruction will be executed:
LDWA 23,i => RES has 23
4)
LDWA -2, i
SUBA 1,i => A = -1
BRLT p4 => branch if less than 0, which is true => RES = -1
5)
LDWA 0x7FFF, i
ADDA 0x8001,i
0111 1111 1111 1111
1000 0000 0000 0001
0000 0000 0000 0000 ADDA => There is overflow
BRNE p5 => branch if not equal to 0, which is false since addition resulted in 0, next instruction:
LDWA 25,i => RES has 25
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.