Answer :

Answer:

machines and very primitive machines (such as the MARIE), the first instruction of the program is

placed at a fixed address, often called “START”.

After placing one instruction, the assembler must compute the address of the next instruction. For some

architectures, such as the INTEL Pentium™ series, this can be complex, as instructions come in a wide

variety of lengths: 1, 2, 4 bytes, etc.

The MARIE is simple. All instructions have the same length: one word. If an instruction is at location

N, the next is at location (N + 1). Suppose start = 0x000 (hexadecimal).*

000 Load X

001 Add Y

002 Store Z

* REMEMBER: All addresses are 12–bit binary numbers; so three hexadecimal digits.

More on the Assembler/Loader

The assembler must allocate memory locations for each “variable” used in the computation. In more

complex architectures, this needs to account for the number of bytes allocated for the variable: 2 or 4

bits for an integer, 4 or 8 bits for a real, etc.

Again, the simplicity of the MARIE architecture is helpful. Only integers are used as data items.

Each is exactly 16–bits long; one word per integer.

Let’s expand the program slightly, so that its assembly will make sense. We have:

000 Load X

001 Add Y

002 Store Z

003 Halt

004 X, Dec 4

005 Y, Dec 8

006 Z, Dec 0

END

Note the label notation, as in “X,”. It is a symbol followed by a comma.

Other Questions