-1

I'm reading the book: "The Essential of Computer Organization and Architecture, Linda Null and Julia Lobur". On chapter 4 page 172 it is a example how the assembly language work with instruction but I cannot understand it. I cannot understand because there is not a good explanation for the number on the image.

Here is the image: http://postimg.org/image/6imlsa3t9/

Can anyone help me?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 2
    Without further context there is no way to tell what the “similar procedure” from the excerpt or “the number” in your question are. – Dour High Arch Jun 14 '14 at 00:12
  • Your image host is cutting off so much of the page that I can't see what the book author is trying to convey. Can you find a host who will let you display the full scan of the page ? I really can't see what that author is trying to convey. – User.1 Jun 14 '14 at 03:55

1 Answers1

0

The chapter deals with the MARIE Assembler and its instructions. Look at the program in table 4.3. Assembly syntax:

Load 104
Add 105
Store 106
Halt
0023
FFE9
0000

and the opcodes in hexadecimal (7 16-bit values):

0x1104
0x3105
0x2106
0x7000
0x0023
0xFFE9
0x0000

The question is: how to translate assembly to opcodes.

1) We have an instruction Load X which is number 1. This is the first hexadecimal number in the term or the first 4 bits of the 16-bit value. The rest (12 bits - 3 hexnumbers) contains the 'X' - in this case '104'. The whole term is 1104.

2) For the second line we have to search anything appropriate with ADD in the instruction set and find ADD X (hexnumber 3). '3' & X => 3105.

3) For the third line we connect STORE X (2) with '106' and get 2106.

4) The fourth line stops the program with HALT (7). Nothing else, so the 16-bit-value is 7000. After the HALT there is no program left, but data.

HTH

rkhb
  • 14,159
  • 7
  • 32
  • 60