(Section 001, Fall 2007)
The questions carry equal weight.
COMPA 008b,d
compares the number in the
'A' register to the number in memory location 008b. The instruction
BRLT xxx
will cause the processor to jump to label 'xxx' if the
result of the previous comparison was that the value in 'A' is smaller
than the number in memory location 008b. Write pseudo code that
corresponds to the following program:
BR Main counter: .BLOCK d#2 limit: .BLOCK d#2 ; Main: LOADA d#0,i STOREA counter,d LOADA d#40,i STOREA limit,d Do: CHARO C#/H/,i LOADA counter,d ADDA d#1,i STOREA counter,d While: LOADA counter,d COMPA limit,d BRLT Do DECO counter,d STOP .END
BR Main sum: .WORD d#0 num1: .BLOCK d#1 num2: .BLOCK d#1 num3: .BLOCK d#1 Main: LOADA sum,d DECI num1,d DECI num2,d DECI num3,d ADDA num1,d ADDA num2,d ADDA num3,d STOREA sum,d DECO sum,d STOP .END