Stephen Ierodiaconou
Stephen Ierodiaconou

Reputation: 789

Flags on Instruction pointer overflow in 8086/8088

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,

Upvotes: 1

Views: 1035

Answers (2)

Nathan Fellman
Nathan Fellman

Reputation: 127478

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.

Upvotes: 1

Mark Baker
Mark Baker

Reputation: 212422

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.

Upvotes: 0

Related Questions