Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could someone explain this? Not understanding how to approach this/ what to do. It's supposed to be in C. I just don't know how to

image text in transcribedimage text in transcribedCould someone explain this? Not understanding how to approach this/ what to do. It's supposed to be in C. I just don't know how to approach. I would appreciate guidance on how to approach this. I so far have a switch statement.

Appendix C Example of Execution This example shows how to print the stack after the execution of each instruction. The following PL/0 program, once compiled, will be translated into a sequence code for the virtual machine PM/0 as shown below in the INPUT FILE. const n = 9: int i.h; procedure sub; const k = 7: int j.h: begin j:-n; i:=1: h:=k; end; begin i:=3; h:=0; call sub; end. INPUT FILE For every line, there must be 3 integers representing OP, L and M. 70 10 702 606 we recommend using the following structure for your instructions: 109 struct { int op: /* opcode int 1; 404 101 /*L 414 int m; /* M }instruction; 107 405 200 606 103 404 100 405 502 1103 OUTPUT FILE 1) Print out the program in interpreted assembly language with line numbers: Line OP M 10 jmp 2 jmp inc lit 3 4 4 sto lit 6. 1 4 sto lit sto opr inc 10 11 lit 3 12 4 sto lit 13 5 14 sto cal sio 15 16 3. 2) Print out the execution of the program in the virtual machine, showing the stack and registers pc, bp, and sp: stack bp data sp 23 gp -1 pc Initial values 0 jmp 0 10 10 inc 0 6 11 lit 23 -1 10 0 00000 23 11 23 0000003 12 12 sto 0 4 13 lit 13 23 000030 23 0000300 6. 14 14 sto 0 5 15 cal 0 2 15 23 000030 23 000030|0000000000000 16 1 10 6. 2 inc 0 6 3 lit 00 16 1 10 000030| 000030| 3 22 17 4 22 16 900 16 1 1 0 09 16 1 10 000030 4 sto 5 5 22 17 5 lit 6 sto 7 lit 8 sto 000030| 000010| 109 16 1 10 09 16 1 10 709 16 1 1 0 6. 22 16 22 17 22 16 000010 000010 0 5 22 17 79 16 1 10 9 opr 0 0 16 sio 0 3 NOTE: It is necessary to separate each Activation Record with a bar "". 16 23 000010 5 17 23 Appendix C Example of Execution This example shows how to print the stack after the execution of each instruction. The following PL/0 program, once compiled, will be translated into a sequence code for the virtual machine PM/0 as shown below in the INPUT FILE. const n = 9: int i.h; procedure sub; const k = 7: int j.h: begin j:-n; i:=1: h:=k; end; begin i:=3; h:=0; call sub; end. INPUT FILE For every line, there must be 3 integers representing OP, L and M. 70 10 702 606 we recommend using the following structure for your instructions: 109 struct { int op: /* opcode int 1; 404 101 /*L 414 int m; /* M }instruction; 107 405 200 606 103 404 100 405 502 1103 OUTPUT FILE 1) Print out the program in interpreted assembly language with line numbers: Line OP M 10 jmp 2 jmp inc lit 3 4 4 sto lit 6. 1 4 sto lit sto opr inc 10 11 lit 3 12 4 sto lit 13 5 14 sto cal sio 15 16 3. 2) Print out the execution of the program in the virtual machine, showing the stack and registers pc, bp, and sp: stack bp data sp 23 gp -1 pc Initial values 0 jmp 0 10 10 inc 0 6 11 lit 23 -1 10 0 00000 23 11 23 0000003 12 12 sto 0 4 13 lit 13 23 000030 23 0000300 6. 14 14 sto 0 5 15 cal 0 2 15 23 000030 23 000030|0000000000000 16 1 10 6. 2 inc 0 6 3 lit 00 16 1 10 000030| 000030| 3 22 17 4 22 16 900 16 1 1 0 09 16 1 10 000030 4 sto 5 5 22 17 5 lit 6 sto 7 lit 8 sto 000030| 000010| 109 16 1 10 09 16 1 10 709 16 1 1 0 6. 22 16 22 17 22 16 000010 000010 0 5 22 17 79 16 1 10 9 opr 0 0 16 sio 0 3 NOTE: It is necessary to separate each Activation Record with a bar "". 16 23 000010 5 17 23

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

1. Where will you recommend that she hold the focus group?

Answered: 1 week ago

Question

3. What might you have done differently

Answered: 1 week ago