#include <iostream> using namespace std; const int limit = 5; int main(){ int nu
ID: 657559 • Letter: #
Question
#include <iostream>
using namespace std;
const int limit = 5;
int main(){
int number;
cin >> number;
while (number < limit) {
number++;
cout<< number << ' ';
}
return 0;
}
fill in the missing items in the assembly language version:
Options: i,s,d, .BLOCK, .EQUATE, ADDSP, SUBSP CPA, CPX, while, endWh
0000 040003 BR main
limit: ____5 ;constant
number: ___0 ;local variable #2d
;
0003 680002 main:____2,i ;allocate #number
0006 330000 DECI number,s ;cin >> number
0009 C30000 while: LDA number,s ;while (number < limit)
000C B00005 ______ limit,i
000F 0E0024 BRGE___
0012 700001 ADDA 1,___ ; number++
0015 E30000 STA number,s
0018 3B0000 DECO number,s ; cout << number
001B 500020 CHARO ' ',___ ; << ' '
001E 040009 BR ___
0021 600002 ___ 2,i ;deallocate #number
0024 00 endWh: STOP
0025 .END
Explanation / Answer
0000 040003 BR main
limit: .BLOCK 5 ;constant
number:.EQUATE0 ;local variable #2d
;
0003 680002 main:SUBSP 2,i ;allocate #number
0006 330000 DECI number,s ;cin >> number
0009 C30000 while: LDA number,s ;while (number < limit)
000C B00005 CPA limit,i
000F 0E0024 BRGE endWh
0012 700001 ADDA 1,s ; number++
0015 E30000 STA number,s
0018 3B0000 DECO number,s ; cout << number
001B 500020 CHARO ' ',i ; << ' '
001E 040009 BR while
0021 600002 ADDSP 2,i ;deallocate #number
0024 00 endWh: STOP
0025 .END
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.