Monday, May 17, 2010

Assembly programming rules & LEA

Question

Identify the mistake in the following code, then rewrite a correct code.

LEA AX, DATA2

MOV ES:[0111h] , 1234H
ADD ES:[0111h], (AX)

Answer


The major mistake is the third line where there is an attempt to transfer data from memory location pointed by AX to another memory location in Extra Segment memory location. Memory to memory transfer is not permitted in 8086/8088 microprocessor.

An alternative code:

LEA AX, DATA2

MOV ES:[0111h] , 1234H
MOV DX,(AX)
ADD ES:[0111h],DX

No comments:

Post a Comment

Popular Posts

Latest Post from my Other Blog