Write an assembly language programming for the following
expressions using IAS computer instruction set and interpret to the flow of LAS computer. Make necessary assumption
i) A= (B-C)/D
ii) A= B/(C*D)
Answers
Answer:
IAS Computer Instruction Set:
i) A = (B-C)/D
MOV R1,B ; Move contents of B to Register R1
SUB R1,C ; Subtract contents of C from R1
DIVIDE R1,D ; Divide contents of R1 by D
MOV A,R1 ; Move the result to A
LAS Computer Instruction Set:
LOAD R1,B ; Load contents of B to Register R1
SUB R1,C ; Subtract contents of C from R1
DIV R1,D ; Divide contents of R1 by D
STORE A,R1 ; Store the result to A
ii) A= B/(C*D)
MOV R1,B ;Move contents of B to Register R1
MOV R2,C ;Move contents of C to Register R2
MUL R2,D ;Multiply contents of R2 by D
DIVIDE R1,R2 ;Divide contents of R1 by R2
MOV A,R1 ;Move the result to A
LAS Computer Instruction Set:
LOAD R1,B ;Load contents of B to Register R1
LOAD R2,C ;Load contents of C to Register R2
MUL R2,D ;Multiply contents of R2 by D
DIV R1,R2 ;Divide contents of R1 by R2
STORE A,R1 ;Store the result to A