Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 2] Machine Language Programming Iproblem 7.27 & 7.281 and Op code and t

ID: 3738645 • Letter: Q

Question

Question 2] Machine Language Programming Iproblem 7.27 & 7.281 and Op code and the last two digits to the operand memory location. (From page 327/328) The Op.codes are the sht system, the first two digits refer to the READ 10, WRITE LOAD 20: STORE 21, ADD 30; SUBTRACT 31, DIVIDE 32, MULTIPLY 33; BRANCH 40, BRANCHNEG 41, BRANCHZERO 42 HALT 43; in the following machine language program, starting at memory 00 1008 Read A 01 1007 Read B 2007 3108 2111 4300 Halt 0011 -9999 xxocx a) In the above, does the program terminate or loop back at the Halt instruction? Ans- .b) After the program is run starting from location 00, A and B values are 44 and 77. What are stored in locations 07, 08, 09, 10, and 11. Contents of locations 07_08_ 09 c) If contents of location 03 are changed from 3108 to 3008 repeat part (b) above with A 77 and B 44 844.11 Contents of locations 07__ 09 10 .d) Functional memory initialization C program for the above SML system is as shown. for (k-20; k

Explanation / Answer

Taking program as input, The program is executed until it reaches memory location 06 where it executes the HLT instructio (e.g. 4300).

(a). HALT is instruction to CPU to halt its operation and become idle until some external interupt comes to resume the operation. Therfore after HALT executes the program is halted and do not loop back.

(b)

(c) If we change content of location 03 from 31 to 30 then 44 will be added in 77. New values will be

07->44, 08->77, 09->22, 10-> 55 and 11->121

(d) As in for loop the increment is pre increment so k will be incremented first to evaluate the operation. This loop will execute for k=20-29. Therfore total no memory location initialised are 10.

(e) Taking k=20, 22, 24,26 and 28 and evaluating the expression memory[k]=((10*(k-2)+20)) The content of

20->200, 22->220, 24->240, 26-> 260, 28->280

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote