6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Sep 25, 2024 2:38 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Jan 26, 2011 6:00 pm 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
I looked at 6502 schematic. It is the basic diagram, but not complex diagram like full of transistors. It can be found at website: http://www.pagetable.com/?p=39.
The Arithmetic Logic Unit has two input registers and one output register (adder hold registor).
The label in ALU shows “Arithmetic Logic with decimal carry”. I am so confused. Is it truly hexidecimal adder or decimal adder or both?
After either decimal mode is turned on or off, two hexidecimal values in both input registers are added together inside ALU register. The output hexidecimal value is transferred to the two decimal adjust adder registers.
If decimal mode is turned on, then output hexidecimal value is converted to decimal value before it is transferred to the accumulator register.
If decimal mode is turned off, then output hexidecimal value is passed through decimal adjust adder register while decimal conversion is ignored before it is transferred to the accumulator register.
Correct? DAA stands for decimal adjust adder. What do DSA stands for? Please tell me how decimal adjust adder register can do calculation, but I wonder that it will calculate invalid decimal value by showing A-F instead of 0-9.
ALU register has half carry output. What is this for? I could not find where it goes to any registers, but I do know that it goes to high program counter register’s half carry input. Both low / high program counters should be able to increment inside PC register without the help from ALU register.

Take care,
Bryan


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 26, 2011 6:34 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
The ALU half carry is needed for the decimal adjust - it has no relation to the PC half carry. I think the details of the PC carry are probably accurate, but only describe a straightforward incrementer - it's calculated with a bit of lookahead for speed reasons.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 26, 2011 6:36 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Half-carry is what makes decimal-adjust circuitry work at all. It is the carry out of bit 3 and into bit 4.

The decimal adjust adders would work by detecting if the lower nybble is greater than 9. If so, add 6 (A+6=10(hex), F+6=15(hex)). Otherwise, or if decimal mode is disabled, add 0. If half-carry is set, you'll also need to add 6, because that means the result is definitely out of BCD range.

The same logic applies also to the upper nybble of a byte.

This article looks like it explains how half-carry works. http://imrannazar.com/Binary-Coded-Deci ... -Atmel-AVR

Hope this helps.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 26, 2011 6:54 pm 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
I know what decimal adjust adder (DAA) is, but you did not answer my question. What do DSA stand for? I think decimal shift with add. Is 6502 schematic accurate? Is DAA register supposed to be inside ALU register?

Bryan


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 26, 2011 7:14 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
I'm guessing DSA = decimal subtract adjust


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 26, 2011 7:18 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Arlet wrote:
I'm guessing DSA = decimal subtract adjust
Agreed. (For subtract, the adjustment is different, and as it happens the half-carry isn't needed. I think.)

Bruce has written a good tutorial about decimal mode (and also mentions decimal mode in his tutorial about the V flag)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jan 27, 2011 8:16 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Bryan Parkoff wrote:
I know what decimal adjust adder (DAA) is, but you did not answer my question.


You actually asked several questions, one of which was what half-carry was.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: