0

Hi all,

I've been trying to understand how an assembler assembles the JMP command. Consider the following code:

AGAIN:
    OUT 0,AL
    JMP AGAIN

The assembler turns this into the following hex:

E6 00 EB FC

The FC at the end corresponds to a displacement of -4. I would have thought that the displacement would only need to be -3 ( FC->EB, EB->00, 00->E6 ). What is the reason for this extra move? I'm guessing this is related to the 8088 parallel fetch and execution.

Thanks

--Amr

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Colin Mac
0

Maybe because PC is already pointing at the first byte of the next instruction, rather than the last data byte of the JMP instruction.

0

Hi all,

I've been trying to understand how an assembler assembles the JMP command. Consider the following code:

AGAIN:
    OUT 0,AL
    JMP AGAIN

The assembler turns this into the following hex:

E6 00 EB FC

The FC at the end corresponds to a displacement of -4. I would have thought that the displacement would only need to be -3 ( FC->EB, EB->00, 00->E6 ). What is the reason for this extra move? I'm guessing this is related to the 8088 parallel fetch and execution.

Thanks

--Amr

Yeah, the program counter automatically points to the next instruction before the actual execution, so the jump back to FC is counted as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.