Page 2 of 2

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Mon Jun 13, 2016 5:58 pm
by BigEd
(I think we've all benefited from the prime directive of the 6502 - to be the smallest viable 8bit CPU, and therefore the cheapest.)

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Tue Jun 14, 2016 7:09 am
by joe7
BigEd wrote:
(I think we've all benefited from the prime directive of the 6502 - to be the smallest viable 8bit CPU, and therefore the cheapest.)
I voted 6502 for that reason. It was an important-stepping stone for me to learn more advanced computer concepts. I still suck at ML, but at least I have a sense of what's going on "under the hood" when I use other languages.

If someone votes for 8086 then we are no longer friends.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Wed Jun 15, 2016 11:27 pm
by nonanon
So I take it the best CPU to learn assembly programming is the 6502, based on the elegance everybody mentions here... Although the main reason why I want to learn assembly programming in the first place is to be able to program in x86 and ARM assembly. So do you think the 6502 would make a good stepping stone to learn those languages? Or should I start with one of those processors first?

I also found this website which sells 6502 and 65186 SBCs (and apparently bill mensch is the CEO btw), so should I get one of those? I don't mind saving for one even though the one I want is 199.00 . Thoughts?

I was also thinking about getting the gr8bit but $499 is a bit too much for me. :P

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Wed Jun 15, 2016 11:59 pm
by whartung
You should learn assembly on the platform you want to write assembly for. Each CPU has their own architectural quirks, which won't translate from one CPU to the other. Fundamentals will translate (register usage, math, addressing modes, etc.), but machine has their own character and own idioms that won't move over.

If there's a specific project you want to learn assembly for, you should just do it. Get your tool chain set up and start banging away. Get your project started If you want to do some ARM assembly for some controller project, you should just do it.

The reason is simply that the your motivation is likely external ("I want to do X on an ARM machine") rather than "Gee I'd like to learn assembly". The primary task with provide the motivation to learn the actual details of coding. It will also focus your efforts on your task at hand.

Unless you have some desire for a 6502 machine in house, I wouldn't purchase one just to learn coding. You can use a simulator if you want instead.

But, again, I'd focus on the higher level task. Assembly is simply a means to an end. The end is what's more interesting for most folks, so focus on that, and the assembly will come along as much as it needs to.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Thu Jun 16, 2016 12:10 am
by jds
nonanon wrote:
So I take it the best CPU to learn assembly programming is the 6502, based on the elegance everybody mentions here... Although the main reason why I want to learn assembly programming in the first place is to be able to program in x86 and ARM assembly. So do you think the 6502 would make a good stepping stone to learn those languages? Or should I start with one of those processors first?
I'd suggest that if you just wanted to learn about assembly language then choose ARM. It's a very simple RISC instruction set that doesn't take long to learn. The best way to get started is to get an ARM board running linux (like a Raspberry Pi), then you can just install the GNU build tools and start programming right away. You can do this on a PC with QEMU too, but it's easier to not have to cross compile. This has the advantage of being something that you could use for work and it leads on to more advanced concepts like operating systems, cache's, memory management and a lot of stuff that happened since the 6502.

If you are more interested in learning about how computers work at the hardware level then there is probably nothing better than the 6502. You could build your own system on a breadboard, it's not that hard. You'll need an EPROM programmer (or some other way of getting started), but otherwise you can do it quite cheaply. Or you could get a WDC board, that would get you up and going quickly.

Most of the difficulty in getting started is setting up an environment which doesn't get in your way. The 6502 is a more pure way to learn because it's simpler and needs less support. For a more complex processor the possibilities are endless, but you will have more work setting up a toolchain and development system. I guess another consideration is the support you can get from 6502.org, if you get stuck there are plenty of people here that always help out and are happy to discuss any problems you may come across. Maybe spend some time looking through Garth's primer, it may get you hooked on going down the 6502 path.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Thu Jun 16, 2016 1:00 am
by nonanon
I see, maybe I'm too used to high level languages where if you learn one, then learning the others is a lot easier.

The goal is x86 assembly. Is there even such a thing as a 8086 or 186 development board though?

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Thu Jun 16, 2016 4:56 am
by whartung
nonanon wrote:
The goal is x86 assembly. Is there even such a thing as a 8086 or 186 development board though?
Sure, it's called "A laptop".

Seriously, what do you want to do with the hardware?

If you want to learn ARM, hard to go wrong with a Raspberry Pi and you have little pins to do stuff with.

If you want a "bare metal" x86, you can look at emulators like QEMU. Gives you a basic PC with basic hardware (floppies, hard drive, network card, etc.) that you can code on at assembly without having to constantly restart you machine.

Yea, it's all software, but again, it depends on what you want to do with the hardware. Lots of folks do early OS hacking on something like QEMU.

There's DosBOX if you just want a dos PC to play with.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Thu Jun 16, 2016 7:51 am
by BigEd
Not much to add here - there is something to be said for speaking several flavours of assembly language and having a view on the different kinds of CPUs out there, and that would be good background for someone wanting to understand CPU design, but if you intend to write x86 code then x86 code is probably the best place to start. It is much more fiddly than 6502 or ARM. Running your own code on your dev machine and possibly crashing the machine will probably get tiresome, so if that seems to happen, consider running in an emulator or virtual machine.

Intel do make the Edison board as a kinda sorta x86 equivalent to Raspberry Pi, but I'm not sure it offers anything special if your aim is to program - as opposed to making a robot or embedded computer of some kind.

Search online for x86 tutorials - there are plenty out there. I suppose if you find yourself totally baffled it might suit your learning style to start on a simpler CPU - easy6502 would be my recommendation in that case. But once you've got to grips with registers and memory, you'd then have to unlearn the 6502 specifics as you learn the x86.

Edit: these links look like they might be good starting points:
https://www.reddit.com/r/learnprogrammi ... embly_for/
http://stackoverflow.com/questions/8631 ... 6-assembly

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Thu Jun 16, 2016 12:09 pm
by Dr Jefyll
nonanon wrote:
maybe I'm too used to high level languages where if you learn one, then learning the others is a lot easier.
I'd say it's the same in assembly. IOW, learning one assembly language (eg:6502) will make learning another assembly language (eg:x86) a lot easier. And, as Ed said, there is something to be said for having a view on the different kinds of CPUs out there.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Thu Jun 16, 2016 3:37 pm
by fastgear
One could probably argue if the CISC nature of the 8086 is really an attractive feature. I think when it comes to learning assembly language it is only human to learn the smallest set of instructions that can do most of the work for you. So all in all most of the CISC intructions is probably under utilised anyway.

Where CISC is a real pain is if you try to read a 8086 assembly program and figure out how it accomplish its task. Sometimes just this task itself is a steep learning curve because now you need to know what all these extra instructions does. Sometimes it is even neccessary to consult several resources before it comes clear on what an instruction does.

With the 6502, however, you can sumarise its instructions in a couple of pages.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Fri Jun 17, 2016 2:29 am
by nonanon
whartung wrote:
nonanon wrote:
The goal is x86 assembly. Is there even such a thing as a 8086 or 186 development board though?
Sure, it's called "A laptop".

Seriously, what do you want to do with the hardware?

If you want to learn ARM, hard to go wrong with a Raspberry Pi and you have little pins to do stuff with.

If you want a "bare metal" x86, you can look at emulators like QEMU. Gives you a basic PC with basic hardware (floppies, hard drive, network card, etc.) that you can code on at assembly without having to constantly restart you machine.

Yea, it's all software, but again, it depends on what you want to do with the hardware. Lots of folks do early OS hacking on something like QEMU.

There's DosBOX if you just want a dos PC to play with.
Yeah, I guess the right way to do things is usually the most boring way :P

But does QEMU really support the entire x86-64 instructing set? My goal is to get up to being able to code the latest intel cpus in their entire assembly, including say, iommu, vt-x, etc...

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Fri Jun 17, 2016 2:36 am
by kc5tja
fastgear wrote:
Where CISC is a real pain is if you try to read a 8086 assembly program and figure out how it accomplish its task. Sometimes just this task itself is a steep learning curve because now you need to know what all these extra instructions does. Sometimes it is even neccessary to consult several resources before it comes clear on what an instruction does.
That's a business decision made by Intel, and irrelevant to its CISC nature.

That said, Hennessy and Patterson don't consider quantity of instructions as a criteria for what is and is not RISC. What defines a processor as a RISC CPU is how the instruction set itself is designed. E.g., RISC CPUs in the 80s had 30 to 60 instructions. Today, they often have as many instructions as any half-way decent x86 CPU. Vis. the latest ARM and POWER CPUs. However, the one thing that both generations have in common is the instruction set is atomic enough for easy (or, at least, efficient) pipeline execution.

Indeed, if you look at most of the x86 instruction set today, as wildly varied as it is, most are designed with register-register semantics in mind. A lot do support register-memory operation, but even this is positively RISC compared to the benchmark that Hennessy and Patterson used to define what a CISC architecture definitively is: VAX-11/780.

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Fri Jun 17, 2016 2:41 am
by kc5tja
nonanon wrote:
whartung wrote:
nonanon wrote:
The goal is x86 assembly. Is there even such a thing as a 8086 or 186 development board though?
Sure, it's called "A laptop".

Seriously, what do you want to do with the hardware?

If you want to learn ARM, hard to go wrong with a Raspberry Pi and you have little pins to do stuff with.

If you want a "bare metal" x86, you can look at emulators like QEMU. Gives you a basic PC with basic hardware (floppies, hard drive, network card, etc.) that you can code on at assembly without having to constantly restart you machine.

Yea, it's all software, but again, it depends on what you want to do with the hardware. Lots of folks do early OS hacking on something like QEMU.

There's DosBOX if you just want a dos PC to play with.
Yeah, I guess the right way to do things is usually the most boring way :P

But does QEMU really support the entire x86-64 instructing set? My goal is to get up to being able to code the latest intel cpus in their entire assembly, including say, iommu, vt-x, etc...
Qemu can run itself, so I would have to say that its level of Intel support is commensurate with what Intel has published publicly. Note that there are ISA features which Intel does not release to the public unless you pay significant fees to Intel. (Vis. a vis. Appendix H from years ago.)

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Fri Jun 17, 2016 6:55 am
by BigEd
Here's what QEMU says about its support:
https://qemu.weilnetz.de/qemu-tech.html ... femulation

But asking for the very latest feature set is probably pushing you in the direction of running on silicon. You can get a long way in a virtual machine, but if you really want to get to IOMMU stuff, well, that might mean baremetal. Certainly it's an enormous distance from a 6502. A journey of a thousand miles, as they say, begins with a single step.

To your advantage, AMD64 aka x86_64 is a much simpler world to live in. Or is it - the 32 bit world is a Russian Doll of compatible extensions to an idiosyncratic interior... good luck, you're going to need it!
https://en.wikipedia.org/wiki/X86#x86_registers

Re: Z80, 8086, 6502 and 65k opinions?

Posted: Fri Jul 01, 2016 11:56 am
by Bregalad
The CPU from the 80s which was the most powerful was probably the original MIPS, they were the first RISC design, which allowed for much more efficient usage of silicon, but they required tremendous amount of memory.

Now, if you ask my favourite, it's without a single doubt the 6502, even though it's from the 70s. I have never developed any assembly program for neither the 8086, nor the Z80, nor the 68k (not 65k by the way), so I cannot juge. The Z80 looks like it has an elegant instruction set as well.

You probably also forgot the 6800, which was the distant cousin of the 6502 and Motorola's main chip before the 68k.