Answer to Question #242963 in Assembler for Israel

Question #242963
Show [x + y/(rs/t) - u] in 3 address, 2 address and 1 address instruction format.
1
Expert's answer
2021-09-27T10:50:28-0400

1.One Address Instructions

This uses an implied ACCUMULATOR register for data manipulation. One operand is in the accumulator and the other is in the register or memory location.

 

Expression: x + y/(rs/t) - u

AC       is accumulator

M[]     is any memory location

M[T]   is temporary location

 

LOAD  rs        AC = M[rs]                 ; AC = rs

DIV     t          AC = AC/t                   ; AC = rs/t

STORE T         M[T] = AC                  ; T = rs/t

LOAD  y         AC = M[y]                   ; AC = y

DIV     T         AC = AC/T                  ; AC = y/(rs/t)

ADD    x         AC = AC + M[x]          ; AC = x+ (y/(rs/t))

SUB    u         AC = AC + M[u]          ; AC = x+ y/(rs/t) –u

 

2.Two Address Instructions

Here two addresses can be specified in the instruction. Unlike earlier in one address instruction, the result was stored in the accumulator, here the result can be stored at different locations rather than just accumulators, but require more number of bit to represent address.

 

Expression: x + y/(rs/t) - u

R1, R2 are registers

M[] is any memory location

 

MOV  R1, rs               R1 = M[rs]                ; R1 = rs

DIV     R1, t                 R1 = R1/M[t]            ; R1 = rs/t

MOV  R2, y                R2 = M[y]                 ; R2 = y

DIV     R2, R1              R2 = R2/R1               ; R2 = y/(rs/t)

ADD    R2, M[x]           R2 = R2+M[x]           ; R2 = y/(rs/t) + x

SUB    R2, M[u]           R2 = R2 – M[u]         ; R2 =  x + y/(rs/t) – u

 

3. Three Address Instructions

This has three address field to specify a register or a memory location.

 

Expression: x+(x/(rs/t))-x

R1, R2 are registers

M[] is any memory location

 

SUB    R1, x, y           R1 = M[x] – M[y]       ; R1 = x - u

DIV     R2, rs, t           R2 = M[rs]/M[t]         ; R2 = rs/t

DIV     R2, y, R2         R2 = y/R2                   ; R2 = y/(rs/t)

ADD    R1, R1, R2      R1 = R1 + R2              ; R1 = x + y/(rs/t) – u


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Israel
27.09.21, 23:09

Thank you assignment expert. You guys are the best.

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS