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

How do you convert each instruction in the following program to its correspondin

ID: 3565508 • Letter: H

Question

How do you convert each instruction in the following program to its corresponding machine code in hex?

The answers are provided but I need to understand how to do it

Location

Instruction

Machine Code

000

       Load X

100C

001

       Subt Y

400D

002

       Skipcond 000

8000

0003

       Jump Else

9008

004

Then, Load Y

100D

005

       Subt X

400C

006

       Store Y

200D

007

       Jump Endif

900B

008

Else, Load X

100C

009

       Subt Y

400D

00A

       Store X

200C

00B

Endif, Halt

7000

00C

X,     DEC 20

0014

00D

Y,     DEC 30

001E

Location

Instruction

Machine Code

000

       Load X

100C

001

       Subt Y

400D

002

       Skipcond 000

8000

0003

       Jump Else

9008

004

Then, Load Y

100D

005

       Subt X

400C

006

       Store Y

200D

007

       Jump Endif

900B

008

Else, Load X

100C

009

       Subt Y

400D

00A

       Store X

200C

00B

Endif, Halt

7000

00C

X,     DEC 20

0014

00D

Y,     DEC 30

001E

Explanation / Answer

We write the instructions using a compiler such as Eclipse IDE. It automatically converts these instructions using inbuilt converters and churns it as machine code.

[In C language, when we type the instructions, it gets saved as .OBJ file. The file is linked using linker. After that, the compiler takes over and converts the instructions into machine language. The same process is used in any language.]

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