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

Chuck Guzis cclist at sydex.com
Fri Dec 9 12:48:16 CST 2005


On 12/9/2005 at 11:25 AM woodelf wrote:

>So what instructions did the NEC 8080A have different?

The NEC 8080A kept an extra flag around in the status register, the
"subtract" flag.  Again, this ties in with that awful DAA instruction.
Suppose you have the following code:

	mvi	a,22h
	sbi	13h
	daa

On the Intel 8080a, thre result's 15h, which is clearly wrong.  However, on
the NEC, it's correctly rendered as  09h, since the NEC tracks the use of
the subtract, rather than an add.  The Z80 does this also.

However, this isn't a fatal error in the Intel part; you simply have to do
your BCD subtracts using 10's complement addition.  So,  10's complement of
13h is 87h and

	mvi	a,22h
	adi	87h
	daa

Correctly yields 09h.  The 8086 has the DAS instruction to adjust BCD
subtracts, but the 8080 lacks it.

Cheers,
Chuck




More information about the cctalk mailing list