3 ms·
Choice of assembler CPU architecture is rather irrelevant for educational purposes. Once you know one architecture, you'll quickly pick up any other. X86 will d
by vardump 11y ago
Choice of assembler CPU architecture is rather irrelevant for educational purposes. Once you know one architecture, you'll quickly pick up any other. X86 will do, it's one of the quirkiest.
Granted, there's one major quirk on ARM CPUs. Instruction predicates, conditional execution for each instruction based on flags. However it's falling out of favor, because it requires CPU flags register to have a lot of read ports. That in turn limits frequencies, instruction reordering opportunities and consumes power. ARMv8 doesn't have predicates in 64-bit mode anymore.
It's same LoaDs [1] / STores [1], SUBstract / ADD / CoMPare, MULtiply / DIVide, SHift Left / SHift Right, XOR / AND / OR / NEGate / NOT and conditional BRanching / Bcc [2] based on flags-register everywhere. On top of that, if it's anything modern, there's usually FPU, vector extensions and MMU control.
[1]: But "MOV" on x86, "MOVE" on 680x0.
[2]: JMP/Jcc on x86. "cc" is short for condition code, like "Jump Equal", "Jump Not Equal".
- melling 11y agoI did some PDP11 in college and I knew 6502 really well. So, back to my original question: I still think it's better to start with ARM because it's more useful. You can learn a little assembler then ship. You don't need to master assembler. For example, you might do a Mandlebrot and optimize your register usage to avoid touching memory and ship that app. You can learn enough in an a few days to ship something that might be amazing on mobile or a Raspberry Pi. Perhaps there are some vector operations in ARM? In order to use assembler you need a good reason because most optimizing compilers are good.
- vardump 11y agoA beginner is definitely not going to need assembler to ship an app. It's unlikely anyone with just a few days/weeks/months of experience will be able to touch what optimizing C/C++ compilers do. Mandelbrot you'd do anyways easily as a pixel shader. I'd guess it's trivial to get 60 fps full screen for something like 30 iterations. Second best option is using ARM NEON. But I doubt anyone is interested seeing another useless app in any store. Amazing performance wise on Raspberry Pi needs to be written in Videocore IV assembler. 24 Gflops there. On RPi2, you could also try NEON vector instructions, but I doubt it can hold a candle to VCIV even if using all 4 cores. And don't forget soon ARMv7 assembler is thing of a past. 64-bit ARMv8 is rather different to code for. In a few short years only place where you'll find 32-bit CPUs are cheap microcontrollers. But anyways, it really doesn't matter which CPU architecture is used for educational purposes. 6502 would do. Or heck, PDP-11. For most programmers, it's enough to just have some idea how things work under the hood.