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

Consider the MARIE program below. a. List the hexadecimal code for each instruct

ID: 671422 • Letter: C

Question

Consider the MARIE program below.

a. List the hexadecimal code for each instruction.

b. Construct the symbol table.

c. What is the value stored in the OutREG when the program terminates?

Hex Address    Label     Instruction

100            Start,    LOAD A

101                       ADD B

102                       STORE D

103                       ADD C

104                       ADD D

105                       STORE B

106                       OUTPUT

107                       HALT

108            A,        HEX 00FC

109            B,        DEC 14

10A            C,        HEX 0108

10B            D,        HEX 0000

Explanation / Answer

Hi,

Below is the solution to your question:

Answer:

Marie Instructions are listed in below table with hex code

0

Jns X

Store the PC at address X and jump to X+1

1

Load X

Load contents of address x into AC

2

Store X

Store the contents of AC at address X

3

Add X

Add the contents of address X to AC

4

Subt X

Subtract the contents of address X from AC

5

Input

Input a value from the keyboard into AC

6

Output

Output the value in AC to the display

7

Halt

Terminate program

8

Skipcond

Skip next instruction on condition

9

Jump X

Load the value of X into PC

A

Clear

Put all zeros in AC

B

AddI X

Add indirect: Use the value at X as the actual address of the data operand to add to AC

C

JumpI X

Use the value at X as the address to jump to

D

LoadI X

Load indirect: Use the value at X as the address of the value to load

E

StoreI X

Store indirect: Use X the value at X as the address of where to store the value.

F

a.Hexadecimal code for each instruction:

Hexadecimal code for each instruction is listed below

Counter

Label

Opcode

Operand

Hexadecimal code

100

Start

LOAD

A

1108

101

ADD

B

3109

102

STORE

D

210B

103

CLEAR

A000

104

OUTPUT

6000

105

ADDI

D

B10B

106

STORE

B

2109

107

HALT

7000

108

A

HEX

00FC

00FC

109

B

DEC

14

000E

10A

C

HEX

0108

0108

10B

D

HEX

0000

0000

b.Symbol table is as shown below:

Symbol table is shown below

Symbol

Location

A

108

B

109

C

10A

D

10B

Start

100

c.value stored by the outReg when the program terminates:

Value stored in AC when the program terminates is 0108, step wise AC values are shown in below table

Counter

Label

Opcode

Operand

Hexadecimal code

ACC

Value

100

Start

LOAD

A

1108

00FC

101

ADD

B

3109

010A

102

STORE

D

210B

010A

103

CLEAR

A000

0000

104

OUTPUT

6000

0000

105

ADDI

D

B10B

0108

106

STORE

B

2109

0108

107

HALT

7000

0108

108

A

HEX

00FC

00FC

109

B

DEC

14

000E

10A

C

HEX

0108

0108

10B

D

HEX

0000

0000

Hope that helps...HAPPY ANSWERING!!!!!!!

0

Jns X

Store the PC at address X and jump to X+1

1

Load X

Load contents of address x into AC

2

Store X

Store the contents of AC at address X

3

Add X

Add the contents of address X to AC

4

Subt X

Subtract the contents of address X from AC

5

Input

Input a value from the keyboard into AC

6

Output

Output the value in AC to the display

7

Halt

Terminate program

8

Skipcond

Skip next instruction on condition

9

Jump X

Load the value of X into PC

A

Clear

Put all zeros in AC

B

AddI X

Add indirect: Use the value at X as the actual address of the data operand to add to AC

C

JumpI X

Use the value at X as the address to jump to

D

LoadI X

Load indirect: Use the value at X as the address of the value to load

E

StoreI X

Store indirect: Use X the value at X as the address of where to store the value.

F

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