News for hackers. Stuff that matters.
Re:The cost of forsaking C by waynecochran on Tuesday February 13, 2018 @07:24PM (#16372277)
Learn ARM or some other RISC architecture and not x86/amd64 if you want to learn assembly. x86 and its forever backwards compatable Segmented Memory/CISC architecture makes asm programming painful (not to mention I have learned at least three different syntaxes for x86 asm : (1) MASM/BASM/TASM/NASM, (2) GNU AS (gas), (3) Amsterdam Compiler Kit -- the last two are meant for compiler backends and not human programmers).

I actually cut my teeth on TI's TMS34010 asm. Simple RISC (lot's of registers), flat address space, and bit addressable. I loved it.

Re:The cost of forsaking C by RealityVoid on Wednesday February 14, 2018 @02:04AM (#16374057)
Garrch, when I hear bit-addressable I get a twitch since a had to spend a night debugging a RISC system that was failing because a class of RAM didn't work with bit addressable instructions, the system was huge, the error cascaded strangely and the information was hidden somewhere in the 2000 page datasheet.
Re:The cost of forsaking C by kqr on Tuesday February 13, 2018 @08:07PM (#16372516)
I can recommend MIPS assembly. It has been the only assembly I've used that actually felt like it was intended for human consumption.
Re:The cost of forsaking C by userbinator on Tuesday February 13, 2018 @08:23PM (#16372605)
My experience with MIPS is the complete opposite --- simple things like loading a single constant into a register require two instructions, and the lack of addressing modes is also a bit annoying. Breaking dords into bytes and vice-versa involves long sequences of shifts and logical operations, the branch delay slot is confusing to say the least, and the plentiful-yet-unhelpfully-named registers don't really make things any easier. At least ARM's conditional execution and barrel shifter are more interesting and versatile.

Then again, I admittedly learned 8080 and then Z80 and x86 first, so any RISC feels too simple; but those who learned any RISC first probably feel the exact opposite.

Re:The cost of forsaking C by nbsd4lyfe on Tuesday February 13, 2018 @08:38PM (#16372697)
> Breaking dords into bytes and vice-versa involves long sequences of shifts and logical operations

modern MIPS has "ext" and "ins", which are probably an improvement in that regard.

> plentiful-yet-unhelpfully-named registers

what's wrong with MIPS register names? my only comparison is x86 and that has been awful. I'm constantly looking up which registers are what.

Re:The cost of forsaking C by userbinator on Wednesday February 14, 2018 @06:41AM (#16375093)
what's wrong with MIPS register names?

They're not really names, just "addresses" of a different form --- and of course, 0 is not really a register. x86 register names are supposed to be mnemonic, because certain instructions are only usable with, or have shorter forms when used with, the "right" register: Accumulator, Count, Base, Data/Divide, Stack Pointer, Base Pointer, Source Index, Destination Index.

Re:The cost of forsaking C by crankybear1337 on Wednesday February 14, 2018 @02:46PM (#16378737)
Those explanations for the x86 register mnemonics were great, thanks!

To me the MIPS registers seem pretty logical too, though: $zr for zero, $sp for stack pointer, $a0-3 for arguments, $t0-7 for temporaries and $s0-7 for saved registers. Much better than the plain numbered registers on some assembly flavors.