zero address instructions

Upload: salman-muhammad

Post on 03-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Zero Address Instructions

    1/3

    Zero Address Instructions

    An instruction that contains no address fields; operand sources and destination are both implicit. It

    may for example enable stack processing: a zero-address instruction implies that the absolute address

    of the operand is held in a special register that is automatically incremented (or decremented) to point

    to the location of the top of the stack.

    Example: ADD

    The above instruction consists of an operation code only. It has no addrss field. The operation has

    the effect of popping the two top numbers from the stack, adding the numbers and pushing the sum

    into the stack. Here all operands are performed within stack. To evaluate arithmetic expressions, they

    must be first converted into reverse polish notation. The operand at address X is pushed on to the top

    of the stack. Automatically the stack pointer is incremented.

    Example:

    X=(A + B) + (C + D)

    PUSH A ; TOS

  • 7/28/2019 Zero Address Instructions

    2/3

    M[X] = Memory operand at address X.

    Example:

    X=(A + B)X(C + D)

    LOAD A ; AC

  • 7/28/2019 Zero Address Instructions

    3/3

    Example:

    X=(A + B)-(C + D)

    MOV R1,A ; R1