A computer components & hardware forum. HardwareBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » HardwareBanter forum » Processors » Intel
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

8080 DAA opcode



 
 
Thread Tools Display Modes
  #1  
Old May 27th 07, 01:30 PM posted to comp.sys.intel
IanB
external usenet poster
 
Posts: 3
Default 8080 DAA opcode

Can anyone point me at a reasonably detailed description of the
workings of the 8080 DAA instruction?

I've written an 8080 simulator but if I follow the details that I have
found for DAA [1] then it doesn't quite work as expected. If I make a
very small change to the details (reading between the lines really)
then I can get BCD add, subtract (using Intel's published method) and
increment to work correctly with DAA.

I'm sure I remember reading that DAA didn't work properly (or as
intended?) on the 8080 so I'm just trying to work out if my simulator
is wrong or not.

Thanks

[1] I'm following this two step process

(1) If the least significant four bits of the accumulator represent a
number greater than 9, or if the auxiliary carry bit is equal to one,
the accumulator is incremented by six. Otherwise, no incrementing
occurs.

(2) If the most significant four bits of the accumulator now represent
a number greater than 9, or if the normal carry bit is equal to one
(*), the most significant four bits of the accumulator are incremented
by six. Otherwise, no incrementing occurs.

(*) The bit I added to get BCD to work is to add "or step 1 caused a
carry from bit 7"
--
Ian

The From address is valid
  #2  
Old May 29th 07, 05:51 AM posted to comp.sys.intel
Andy
external usenet poster
 
Posts: 354
Default 8080 DAA opcode

http://www.geocities.com/SiliconValley/Peaks/3938/z80syntx.htm#DAA

On Sun, 27 May 2007 12:30:16 +0000, IanB wrote:

Can anyone point me at a reasonably detailed description of the
workings of the 8080 DAA instruction?

I've written an 8080 simulator but if I follow the details that I have
found for DAA [1] then it doesn't quite work as expected. If I make a
very small change to the details (reading between the lines really)
then I can get BCD add, subtract (using Intel's published method) and
increment to work correctly with DAA.

I'm sure I remember reading that DAA didn't work properly (or as
intended?) on the 8080 so I'm just trying to work out if my simulator
is wrong or not.

Thanks

[1] I'm following this two step process

(1) If the least significant four bits of the accumulator represent a
number greater than 9, or if the auxiliary carry bit is equal to one,
the accumulator is incremented by six. Otherwise, no incrementing
occurs.

(2) If the most significant four bits of the accumulator now represent
a number greater than 9, or if the normal carry bit is equal to one
(*), the most significant four bits of the accumulator are incremented
by six. Otherwise, no incrementing occurs.

(*) The bit I added to get BCD to work is to add "or step 1 caused a
carry from bit 7"


  #3  
Old May 29th 07, 07:23 PM posted to comp.sys.intel
IanB
external usenet poster
 
Posts: 3
Default 8080 DAA opcode

On Mon, 28 May 2007 21:51:39 -0700, Andy wrote:

http://www.geocities.com/SiliconValley/Peaks/3938/z80syntx.htm#DAA


Thanks for the link. That's for a Z80 though, which is supposed to be
a "fixed" version of the 8080 DAA instruction. That's why I'm trying
to find out just *what* it fixed :-)

Thanks anyway
--
Ian

The From address is valid
  #4  
Old May 30th 07, 02:37 AM posted to comp.sys.intel
Ian D
external usenet poster
 
Posts: 333
Default 8080 DAA opcode

There is a good book that has several pages devoted to this very tricky
instruction: "The 8080A BUGBOOK", published by SAMS, ISBN #
0-672-21447-4. This is an excellent book with many practical programming
examples for the 8080A. Do a Google search and you will find low priced
sources for the book. One thing they do say is " Use the decimal adjust
accumulator (DAA) instruction only after an ADD, ADC, or ADI
instruction." A suggested way to use the very weird DAA is:

Octal Mnem.
306 ADI
000 000
047 DAA


Ian





  #5  
Old May 30th 07, 02:50 AM posted to comp.sys.intel
Ian D
external usenet poster
 
Posts: 333
Default 8080 DAA opcode - another book

Another SAMS book by the same authors is "8080 8085 Software Design",
ISBN # 0-672-21541-1. It also covers the DAA instruction in some detail.


  #6  
Old June 5th 07, 09:26 PM posted to comp.sys.intel
IanB
external usenet poster
 
Posts: 3
Default 8080 DAA opcode

On Tue, 29 May 2007 21:37:11 -0400, "Ian D"
wrote:

Thanks for the reply and apologies for the delay in replying

There is a good book that has several pages devoted to this very tricky
instruction: "The 8080A BUGBOOK", published by SAMS, ISBN #
0-672-21447-4.


I've actually got a copy of that book, purchased back in the late 70's
or early 80's I seem to recall it was one of the first "useful'
programming books that Tandys (the UK's version of Radio Shack)
stocked.

I'm pretty sure now that I must have some flag logic wrong, and that's
why I can't get DAA to work even in the "half hearted way" described
in the various 8080 references.

I've just got a Z80 emulator working correctly [1] so, with the added
insight that has given me, I'll go back and see what I had wrong with
the 8080.

Thanks again

Ian

[1] It passes some stringent tests I found on the web and also some
(less stringent) comparisons against a working z80 system..
--
Ian

The From address is valid
  #7  
Old June 15th 07, 05:32 PM posted to comp.sys.intel
Bill Davidsen
external usenet poster
 
Posts: 245
Default 8080 DAA opcode

IanB wrote:
On Tue, 29 May 2007 21:37:11 -0400, "Ian D"
wrote:

Thanks for the reply and apologies for the delay in replying

There is a good book that has several pages devoted to this very tricky
instruction: "The 8080A BUGBOOK", published by SAMS, ISBN #
0-672-21447-4.


I've actually got a copy of that book, purchased back in the late 70's
or early 80's I seem to recall it was one of the first "useful'
programming books that Tandys (the UK's version of Radio Shack)
stocked.

I'm pretty sure now that I must have some flag logic wrong, and that's
why I can't get DAA to work even in the "half hearted way" described
in the various 8080 references.

I've just got a Z80 emulator working correctly [1] so, with the added
insight that has given me, I'll go back and see what I had wrong with
the 8080.


We've been waiting to hear what you found.

Thanks again

Ian

[1] It passes some stringent tests I found on the web and also some
(less stringent) comparisons against a working z80 system..



--
Bill Davidsen
He was a full-time professional cat, not some moonlighting
ferret or weasel. He knew about these things.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace a 8080 with 8085 Chrown Intel 7 March 27th 07 09:15 PM
IMSAI 8080 forsale [email protected] General 0 April 16th 06 02:37 PM


All times are GMT +1. The time now is 03:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 HardwareBanter.
The comments are property of their posters.