4 ms·
Nobody (except of hardware guys and compiler writers) needs to learn Asm, but definitely you are got to get a skill of reading it. There are a lot of asms (one
by eimrine 4y ago
Nobody (except of hardware guys and compiler writers) needs to learn Asm, but definitely you are got to get a skill of reading it. There are a lot of asms (one per every computing architerture plus several possible syntaxes).
Of course you need to be an expert in C, in my understanding this is way more important than Asm.
One of the easiest way of starting system programming is to build some electronic toy based on microcontroller and write some code for it to do something useful. Bonus points will be earned if you will manage to pack some complicated behaviour so heavily that your controller will be having zero free memory.
- P_I_Staker 4y agoDepending what you mean by "hardware guys" this isn't completely accurate. Though, you may not need to "learn" it in the sense that you do other programming languages, or like you previously did. It's conceivable that they might have to write ASM at some point. However it will probably be very minimal and geared to a specific low level (hardware) goal. There's still some value to "learning" ASM, or at least having worked with it if you want to write low level code, though it might be minimal. I wouldn't understand C and low level software without having worked with ASM at some point, even though I don't use it. I probably wouldn't recommend it a good use of time.
- baremetal 4y agoIt is good to know how control flow works under the hood. Like C loops and ifs are made of jumps and compares in assembly.
- eimrine 4y ago> jumps <irony>goto is considered harmful</irony>
- P_I_Staker 4y agoIf you do it correctly it can help demystify function call/return and pointers... although, as I understand it pointers are NOT just addresses in memory.
- markus_zhang 4y agoI think there is also the type of the data it points to, or maybe at least the length of the data it points to? I was wondering how come OS understands that say it only needs to grab 4 bytes for an int32_t, but 8 for an int64_t, I guess such information is included.
- ksherlock 4y agoGenerally, the CPU has instructions for loading memory into registers and storing registers into memory and they specify how much memory to read/write. eg: ARM (32) has LDR (32-bit), LDRH (16-bit), and LDRB (8-bit) 68K has MOVE.L (32-bit), MOVE.W (16-bit), MOVE.B (8-bit) There are also some architectures (early Alpha for example) where memory can only be read in aligned 32-bit chunks or aligned 64-bit chunks. If you want to read 8 bits... well the compiler will generate a 32-bit read and then shift/mask the data to get the 8-bits that you care about.
- markus_zhang 4y agoOh you are right, I absolutely forgot the translation part I read about tons of time.
- genmud 4y agoI will go against the trend and disagree. IMHO anyone writing software in C or C++, ASM is an extremely valuable skill. Its really hard to debug code if you don't understand what the compiler is outputting. If you ever do software vulnerability research, or reverse engineering it is also very important. I know its a spicy take, and probably due to my reversing background, but I almost look at C as more of a macro language for ASM. In fact when I write in C, often times I think about what the compiler will produce. It also makes sure that when I write things, I am not doing it in an architecture specific way.