8086 bugs (was: Legacy apps in Windows/OS X was Re: Old MS-DOS & Win Software)

Jim Battle frustum at pacbell.net
Fri Dec 9 21:16:14 CST 2005


Jim Leonard wrote:

> Chuck Guzis wrote:
> 
>> The V20 and V30 had an emulation bug that would cause nasty things to
> 
> 
> Speaking of 808x CPU bugs, I remember a bit of controversy over altering 
> the stack registers.  You were supposed to be able to do this:
> 
> MOV SS,AX
> MOV SS,DX
> 
> ...to switch the stack to somewhere else, and the 8088 was supposed to 
> disable interrupts after the MOV SS for the next instruction (MOV SP).  
> However, I read somewhere that early versions of the 8088 didn't honor 
> this (or at least didn't honor it all the time).  The generally accepted 
> workaround was something like:
> 
> CLI
> MOV SS,AX
> MOV SS,DX
> STI
...

Of course you meant "SP" not "SS" in second of each of the MOV pairs above.

I recall reading a book back in 1982 or so written by Stephen Morse, one of the 
architects on the 8086.  The book was 8086 Primer, I think.  Anyway, he explains 
the addressing modes and instructions and such, but along the way drops a few 
nuggets like the one you mentioned above.  He also mentioned that the architects 
called the sign extend instruction SEX, but management wouldn't have it. 
Motorola apparently was less stodgy.

After some digging, I have found the book (it isn't the same copy I read in 82; 
a few years ago I happened upon a copy for $1 and snagged it).

On page 89 he says:

   An 8086 Mistake  (... describes what Jim Leonard discusses ...)  This mistake 
was not discovered until after the 8086 was designed and built.  After the 
mistake was discovered, the 8086 was modified so that it will not accept any 
interrupts immediately after executing an instruction that moves a new value 
into SS.

On page 94 there is a section called "A Postscript on Prefixes" where he 
describes some of the prefix byte quirks.  After mentioning some, he says: "The 
combination of a prefix with a repeat prefix will make it impossible to restart 
the string operation after being interrupted.  To understand why ....  This is a 
flaw in the 8086 design!

On page 54 he says: "The 8086 provides instructions (Fig. 3.29) to facilitate 
the task of sign extension.  These instructions were initially named SEX (Sign 
EXtend) but were later renamed to the more conservative CBW (Convert Byte to 
Word) and CWD (Convert Word to Double word). ...

On pages 97-98 he is discussing flags and DAA.  He mentions that the only flag 
that really needs to be changed on a DAA is the carry flag, but to increase 
compatibility with 8080 code, they set all five flags like the 8080.  DAS does 
as well.  Then he says how boolean operations affect flags.  Then "One Boolean 
instruction, NOT, is missing from the list of Boolean instructions that affect 
the flags.  NOT does not afect the flags.  This was the result of an oversight 
(I goofed!) when the processor was being defined."

There might be some other tidbits in there, but I don't particularly want to 
read it to find them.





More information about the cctech mailing list