Live data from Hacker News

CS/A65: A 6502 computer with USB, Ethernet and co-processors

6502.org

21–30 of 50 posts

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#21

Always love to see a 6502 post here on HN. It's a really unique processor compared to other 8-bit processors at the time. With only one general purpose register, and memory mapped IO, the 6502 offers a ton of "addressing modes" to solve problems that the 8080 would solve with register transfers. Ben Eater ( http://beneater.net/ ) makes a neat video series and accompanying product kit where you build a 6502 on a bread…

As much as I love the 6502, I have to say the 8080 has some very neat features that I wish I had with 6502, such as conditional returns (in other words, do a RTS only if a certain flag is set or not).

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#22

Always love to see a 6502 post here on HN. It's a really unique processor compared to other 8-bit processors at the time. With only one general purpose register, and memory mapped IO, the 6502 offers a ton of "addressing modes" to solve problems that the 8080 would solve with register transfers. Ben Eater ( http://beneater.net/ ) makes a neat video series and accompanying product kit where you build a 6502 on a bread…

As much as I love the 6502, I have to say the 8080 has some very neat features that I wish I had with 6502, such as conditional returns (in other words, do a RTS only if a certain flag is set or not).

What significant advantage does that have over a conditional branch followed by an RTS?

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#23
post #6

Noob her! why use a 6502 versus another 8bit cpu like Atmel AVR? Is there any advantage? Does it consume less electricity while running at similar speed ?

One thing that might or might not matter, depending on why you are doing the project, is that a 6502-based computer is less opaque.

A 6502 is a CPU in the "traditional sense". It has limited internal state in the form of a few registers, and communicates with the outside world with address lines and data lines; I only simplified a little there. Everything else is external: RAM, ROM, any external devices on a different bus (I2C etc.), even timers and GPIO need external circuitry with usually other ICs.

An AVR on the other hand tends to have all of that stuff (or at least a sizable subset) built in. That's, obviously, enormously convenient, and often means that with the AVR itself and just minimal external circuitry you have your needs covered. But it's less educational, you've rather plugged a computer into your circuit than built a computer.

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#24

Andre Fachat also wrote a pre-emptive multitasking kernel for the 6502: http://www.6502.org/users/andre/osa/oa1.html This is basically the same CPU as in the NES.

It feels weird to me that some hackers don't know what a 6502 is! Sign of my age I guess.

Days ago a user who declared to be a Google employee wrote that many of his colleagues have no idea what RSS is. (No, sign of the times.)

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#25

Earlier quoted context omitted.

As much as I love the 6502, I have to say the 8080 has some very neat features that I wish I had with 6502, such as conditional returns (in other words, do a RTS only if a certain flag is set or not).

What significant advantage does that have over a conditional branch followed by an RTS?

Code density, and you could potentially save a few cycles with a single instruction. Whether that matters at all depends on how much slack you have in your utilization of available memory and CPU cycles. (Strictly talking about "old" CPUs here.)

It's worth noting that the 8086 got rid of conditional returns, you only have unconditional ones there.

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#26
post #25

Earlier quoted context omitted.

What significant advantage does that have over a conditional branch followed by an RTS?

Code density, and you could potentially save a few cycles with a single instruction. Whether that matters at all depends on how much slack you have in your utilization of available memory and CPU cycles. (Strictly talking about "old" CPUs here.) It's worth noting that the 8086 got rid of conditional returns, you only have unconditional ones there.

A taken branch on the 6502 takes 3 cycles. A not taken branch followed by a Return From Subroutine instruction takes 2 + 6 cycles.

Looking up the conditional return instructions on the 8080 seems to show it takes 5 cycles when false and 11 when true.

So the two 6502 instructions add up to being two or three cycles faster than one 8080 conditional return.

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#27
post #25

Earlier quoted context omitted.

Code density, and you could potentially save a few cycles with a single instruction. Whether that matters at all depends on how much slack you have in your utilization of available memory and CPU cycles. (Strictly talking about "old" CPUs here.) It's worth noting that the 8086 got rid of conditional returns, you only have unconditional ones there.

A taken branch on the 6502 takes 3 cycles. A not taken branch followed by a Return From Subroutine instruction takes 2 + 6 cycles. Looking up the conditional return instructions on the 8080 seems to show it takes 5 cycles when false and 11 when true. So the two 6502 instructions add up to being two or three cycles faster than one 8080 conditional return.

I was not trying to compare the 6502 with the 8080 here, and I said "potentially" exactly because it depends on the architecture wether it works out (and, as said, 8088/8086 removed the conditional returns). On the 8080 specifically, conditional returns seem to be a little cheaper overall.

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#28
post #25

Earlier quoted context omitted.

Code density, and you could potentially save a few cycles with a single instruction. Whether that matters at all depends on how much slack you have in your utilization of available memory and CPU cycles. (Strictly talking about "old" CPUs here.) It's worth noting that the 8086 got rid of conditional returns, you only have unconditional ones there.

A taken branch on the 6502 takes 3 cycles. A not taken branch followed by a Return From Subroutine instruction takes 2 + 6 cycles. Looking up the conditional return instructions on the 8080 seems to show it takes 5 cycles when false and 11 when true. So the two 6502 instructions add up to being two or three cycles faster than one 8080 conditional return.

It’s only fair to compare cycle numbers if you also compare cycle times.

Re: CS/A65: A 6502 computer with USB, Ethernet and co-processors

#30
post #25

Earlier quoted context omitted.

Code density, and you could potentially save a few cycles with a single instruction. Whether that matters at all depends on how much slack you have in your utilization of available memory and CPU cycles. (Strictly talking about "old" CPUs here.) It's worth noting that the 8086 got rid of conditional returns, you only have unconditional ones there.

A taken branch on the 6502 takes 3 cycles. A not taken branch followed by a Return From Subroutine instruction takes 2 + 6 cycles. Looking up the conditional return instructions on the 8080 seems to show it takes 5 cycles when false and 11 when true. So the two 6502 instructions add up to being two or three cycles faster than one 8080 conditional return.

Cycle counts are super misleading. These processors were limited by the speed of RAM, and cycles per RAM access differed. Suppose you have RAM running at 1 MHz... maybe your 6502 is also clocked at 1 MHz, and your 8080 is clocked at 4 MHz. I know you're not trying to compare 6502 performance to 8080 performance in general, just that there's a fairly wide variation in how much you can accomplish in a cycle, and "how many RAM accesses can the processor make" is probably what you want to look for, since it's a bit more directly comparable across processors of that era.
Post reply on HN