Google-apper
Hovedmeny

Post a Comment On: Ken Shirriff's blog

"Inside the ALU of the 8085 microprocessor"

12 Comments -

1 – 12 of 12
Blogger Ed said...

Excellent post! I've reposted it to Retro Communities at https://plus.google.com/communities/109052413018437647853

January 25, 2013 at 12:40 AM

Anonymous Anonymous said...

Okay, now i understand the reason why the 6502 has illegal opcodes that combine 2 alu commands with each other....

January 26, 2013 at 3:49 AM

Blogger Ken Shirriff said...

Anonymous: if you want to know the details of 6502 illegal opcodes, the page to read is pagetable.com.

January 26, 2013 at 6:10 PM

Anonymous Anonymous said...

It is interesting, how value for /XN input is generated. Is there one more adder for that?

April 27, 2013 at 8:50 AM

Blogger Ken Shirriff said...

Anonymous: I should have given XN and /XN the names TMPN and /TMPN: they come from the TMP register, which holds one of the arguments for the ALU. Since each latch in TMP is a pair of inverters, the complemented bit is available "for free".

May 1, 2013 at 11:07 PM

Anonymous Anonymous said...

Ken this is great information. Have a question from my students, why during AND operation AC is set? Could not get a very good answer, can you help please? Thanks a lot. from Prad

May 2, 2013 at 8:40 AM

Blogger Ken Shirriff said...

Hi Prad. That's a great question, which AC gets set during an AND operation.

There are two factors. First, the Sign, Zero, Auxiliary Carry, and Parity flags are all loaded by the same control line, for arithmetic instructions. Thus, the AC flag gets set to something for AND instructions, even though it doesn't make a lot of sense.

Second, the ALU circuit happens to output 0 on the internal inverted-carry line for an AND instruction. (See the table under "Combine with Carry" above.) This 0 is just the value the ALU circuit generates for AND. For OR, it happens to generate 1. Remember that these are inverted values.

Putting these two factors together, the AC flag is set for AND operations and cleared for OR operations. This doesn't really make mathematical sense; it's just a consequence of how the circuit is implemented.

I'm planning to write another blog post about the ALU and flags, so I'm interested in the questions people have.

May 2, 2013 at 9:21 PM

Anonymous Anonymous said...

Ken Thanks a lot for the answer given. I will check for other instructions also which have flags reset or set but not in a very logical way. In the mean time thanks again and information you have put here is very nice indeed. From Prad

May 4, 2013 at 2:23 PM

Anonymous Anonymous said...

Can you show the reverse engineering of pic16f84 mcu.Thanks in adv...

October 20, 2013 at 8:55 AM

Blogger Unknown said...

Shift-right simply outputs the A bit from the slice to the right.

You mean from the left.

August 21, 2015 at 7:15 PM

Anonymous Anonymous said...

Hey ken, where is this carry is coming from ? Is this the carry which generates from sum operation? Why there is a circuit for generation of carry? I have a lot of confusion regarding from carry concept?

May 1, 2018 at 10:17 PM

Blogger Ken Shirriff said...

Anonymous: when you add two binary bits, you get a sum bit and a carry bit. E.g. 1 + 1 = carry 1, sum 0. See Full Adder for more details.

May 1, 2018 at 10:22 PM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot