Question
Translate the following source code into a machine code using the assembly language of LMC and complete the table below. Var i=0; var j=1; var
Translate the following source code into a machine code using the assembly language of LMC and complete the table below. Var i=0; var j=1; var k=0; while(k<4) { var fib=i+j; i=j; j=fib; print(i); k=k+1; } 01 ? LDA 20 ;load k 02 ? ? ;k-4 03 717 ? ;Branch if equal to zero 04 ? ? ;load i 05 ? ? ; i+j 06 ? ? ;Store into fib 07 ? ? ;load j 08 ? ? ; Assign j to i (i=j) 09 ? ? ; load fib 10 ? ? ; Assign fib to j (j=fib) 11 ? ? ; load i 12 ? ? ; print into out basket 13 ? ? ;load k 14 ? ? ;k=k+1 15 ? ? ;store to k 16 ? ? ;load to the first 17 000 HLT ;end of the program 18 DAT 00 000 ;var i 19 DAT 00 001 ;var j 20 DAT 00 000 ;var k 21 DAT 00 100 ; const =4 22 DAT 00 000 ;fib=0 23 DAT 00 001 ;const =1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started