4 ms·
Assembly was my second language (BASIC being my first), but it was not the x86 line I learned first (it was my second assembly language). I can name half a doz
by spc476 10y ago
Assembly was my second language (BASIC being my first), but it was not the x86 line I learned first (it was my second assembly language). I can name half a dozen architectures that are probably better for learning than the x86, some of them relevant today.
Probably in order: 6502---not my favorite, but tons of material and emulators exist. The most popular 8 bit CPU and one of the most simple ones.
6809---my favorite 8-bit and it lends itself fairly well towards higher level languages. A nice register set (2 8bit general purpose registers, four 16bit index registers) and a regular instruction set makes it easy to program.
8080 (or Z80)---if you are going to start down the dark side of x86 line, it's probably best to start at the beginning. A mess of registers, most of which are somewhat general purpose but each has a specific use.
68000---a very nice 32-bit architecture with enough regularity to make it easy to write compilers for, with enough instructions to make it fun to write assembly code. 8 32bit data registers, 8 32bit index registers.
VAX---another nice 32-bit architecture with a very regular instruction set. 16 32bit general purpose registers.
MIPS---one of the original RISC architectures that's still in use. Perhaps a bit too spare on instructions. 32 32bit registers.
ARM---Kind of reminds me of a RISCish 68000 with unique features that make it, again, fun to program at the assembly level.
The x86 line is ... baroque due to its history (you can think of it as an overglorified 8080 that gained power over time, much like the MCP in TRON if you think about it) of ossified layers. It's hard to learn because it's almost all exceptions to a non-regular instruction format.
- mikekchar 10y ago6809 is vastly underrated I think. It is super simple, but also has everything you need to program efficiently. I think if I were to introduce people to assembly langue programming first, I would pick that one. Especially being 8 bit with 16 bit addressing gives you a good segue into byte ordering. 6502 was my first (and only really significant) experience with assembly. It is so minimal as to be awkward at times, but as you say with the huge numbers of emulators and instructional materials around, it's hard to discount it. Personally, I would skip x86 altogether unless you actually want to do x86 programming ;-). I've never looked at ARM, but your description makes me want to play with it. The added bonus is that it is still relevant today.
- clishem 10y agoI've been looking to buy "Introduction to 64 Bit Assembly Programming for Linux and OS X: Third Edition - for Linux and OS X". It's an introduction to x84-64 assembly, which I thought makes sense for me to learn, because it is the architecture all my computers use. You say x86 is not a good choice to learn, but this book purports to make assembly for this architecture accessible. If you stand by your opinion, are there even CPUs readily available that support the alternative architectures you mention? Also, can anyone recommend this or any other book or learning resource?
- e12e 10y agoSource code etc on the book homepage for those interested: http://rayseyfarth.com/asm/index.html http://rayseyfarth.com/asm/index.html
- spc476 10y agoAs a first language, or even as a first assembly language. Once can certainly learn it, and it may even come across as half decent if you skip some of the less used instructions (like LOOP, REP, LODS, STOS, AAD, AAS---basically, the really archaic instructions that aren't really used or optimized). But with nearly 40 years of backwards compatibility, it's a monster of an architecture.
- e12e 10y agoI'm not sure it's fair to group x86 with x86_64 - the latter is much more pleasant (or less unpleasant). It certainly is a huge instruction set, and if you really want to know the ins and out, it's going to be a long journey. But for playing around, it's actually kind of fun IMNHO. I don't think 32 bit x86 really qualifies as fun. Maybe fun, as in trying to solve a complicated murder mystery fun, but not so much as in playing with water colours fun.
- sanderjd 10y agoGreat anecdotes! I still have a real soft spot for 68000. It's definitely the IS that made this whole "how computers work" thing make sense to me, and I still often imagine what my programs are doing in terms of what they'd be doing in the 68000 world, even though I know it's actually x86_64 (or ARM, on my phone). Question for you, if you happen to come back to this: what's the best documentation on ARM that you've found? Every time I try to find some, it seems like I'm supposed to pay for a license, and I get confused.