I need to calculate each line's effective address. I know you shift DS to the left once and add the offset but I am confused when you changing the default data segment? For the first line do I just add ES+DI instead of using DS?

Using these: Register Numbers An example of one that I know is right

IN    AL, 70H

OUT  DX,  AX

OUT    21H ,  AL
有帮助吗?

解决方案

IN/OUT do not use segment registers, the I/O address (port number) is specified either in an immediate operand

IN  AL, 70H    ; Read one byte from I/O port 70H
OUT 21H, AL    ; Write one byte to I/O port 21H

or in the DX register

OUT  DX,  AX   ; Write two bytes from AX to I/O port specified in DX

You gave the following values for registers

enter image description here

It is not obvious there which byte is the low byte and which is the high byte (x86 uses little-endian byte order). Assuming DX has the value 0022H and AX is 2355H then

OUT  DX,  AX   ; Write 2355H (AX) to port 0022H (16-bit data bus)

http://en.wikipedia.org/wiki/Intel_8086

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top