tags:

views:

127

answers:

2

Hey guys, Im new to the 8086 architecture and have not been able to find much on Google related to the following:

On the i8086 or i8088 (ie 16bit, segmented addressing) what happens if an instruction fetch occurs with the instruction pointer (program counter) at 0xFFFF? I assume the CPU increments the IP and it overflows and becomes 0x0 while the CS register remains unchanged.

However if this happens do any flags get set (like the overflow bit of the flags register?)

Thanks,

A: 

I'm not sure it is supposed to have any special effect to flags, but it should trigger a reset. IP would increment to 0000: and CS would remain as FFFF, which I would reset the CS:IP to FFFF:0000 which is supposed to be the start instruction for the bootstrap loader.

Mark Baker
If the CS is not FFFF (so that the wrap around instruction is not the reset vector) does a reset trigger? Or do you mean it will effectively reset is this specific case (CS = FFFFh, ip = 0). Thanks
Steve
There's no reset or any other event. It won't even reset IP as you expect. If you were at 0xffff and you tried to fetch 5 bytes, you'd wraparound to 0x4 on the next instruction.
Nathan Fellman
A: 

The architectural flags are changed only as the result of instruction execution, never as the result of a fetch. An overflow like you describe would result in a wraparound but this would not be reflected anywhere except the current IP.

Nathan Fellman
Thanks for the response, so basically the CPU would simply continue execution unawares at CS:0x0?
Steve
So just to clarify on this answer, the IP would simply wrap around and no other event would occur. Thanks.
Steve
@Steve, that's right. I meant to answer your comment bug answered Mark's instead... the peril of answering when I'm too tired :-)
Nathan Fellman