6 ms·
I think the idea of a course is that you will be taught. Why worry about it? Do you not trust your uni to provide the necessary course materials and exercises
by foxfluff 5y ago
I think the idea of a course is that you will be taught. Why worry about it? Do you not trust your uni to provide the necessary course materials and exercises?
Did someone tell you assembly is hard? I will tell you that assembly is easy, very easy. It's easy because instructions are simple and stupid. They do one little thing, and maybe set a few flags. And while modern ISAs have grown a ton of cruft, you get pretty far with a small set of core instructions (loads & stores, register-register and immediate-register moves, arithmetic, testing flags, branching). Given that it's a computer architecture course, they'll probably want you to learn something about ABI and calling conventions too. Not a big deal, it just illustrates the (somewhat arbitrary) convention of what to pass in registers vs what to pass on stack, who saves registers (which registers?) and so on. Simple stuff that you just need to have a convention for if you want to make it easy to interface with prebuilt binaries.
With very basic knowledge, you could disassemble a program and just look up instructions as you go to figure out what it does. That is how I "learned" assembly. I put learned in quotes because for me learning is on-demand and is never fully done. I learn more as I need, including last week when I did some ARM assembly programming.
I think assembly has an undeserved reputation for being difficult, because building large programs in assembly is a lot of work. Also because fear of the unknown: few people learn assembly, and even fewer use it enough to be proficient with it, so in their mind it's the devil they don't know. I doubt the course has you building large applications, it'll be some rather basic things. And that's how a lot of assembly usage is in real life: you just have to do some basic bits in early stage bootloaders, OS kernels, crt, etc. in assembly. But only enough to get the code in a higher level language going. (The other significant use is in optimization, especially SIMD, but I doubt a computer architecture course would focus on that too much).
Have no fear and just dive in. That's how you approach the topic.
Knowing C and checking the compiler output is very helpful. You can do it interactively on godbolt.org, it'll even hilight lines and the corresponding machine instructions.
- 300bps 5y agoI think assembly has an undeserved reputation for being difficult It is difficult. But you put in the work and like anything it gets easier. My first experience was learning 65xx Assembly on my own when I was 11. I think OP will be just fine.
- foxfluff 5y agoMy first experience was in my teens, using a disassembler to change hardcoded keybindings in a game (x86) and then defeat some kind of checksum (anti-tamper?) mechanism because otherwise it wouldn't run after the modifications. I didn't think it was particularly difficult. Of course, starting from scratch, there was a lot I had to look up and thus it was rather time consuming. But at no point did I feel it was hard, I just needed to push on.
- flohofwoe 5y agoOnce it "clicks" it's actually easier than most high-level programming languages IMHO ("easy" doesn't necessarily mean "productive" of course). Some CPUs and assembly dialects are worse than others though (e.g. x86 was never "enjoyable" for me).
- pizza234 5y ago> Did someone tell you assembly is hard? I will tell you that assembly is easy, very easy. I like assembly, but the idea that assembly is easy is not realistic. On one end, there are CPUs like the 6502, which have a stupid easy instruction set, where making anything that is not trivial is complex due to lack of register and instructions - even divisions and multiplications. On the other end there are have modern ISAs like the x64, with the (understandably) complex SSE instructions, and all the idiosynchrasies/inconsistencies of the instruction set due to legacy. Probably a sweet spot (complexity-wise) is the 16-bit 8086. But even that, programming and/or understanding programs means knowing system calls and/or documenting them very clearly, which is a significant amount of work. ASM is difficult (also) because abstractions are paper-thin. With that in mind, > I doubt the course has you building large applications, it'll be some rather basic things. And that's how a lot of assembly usage is in real life: you just have to do some basic bits in early stage bootloaders, OS kernels, crt, etc. in assembly I definitely agree with this, and the OP could relax, as the application of Assembly they'll likely work with is going to be (relatively) comfortable.
- foxfluff 5y ago> I like assembly, but the idea that assembly is easy is not realistic. By assembly, I mean the general idea of machine instructions, which you find on every computer. It is simple and quite easy. It doesn't matter whether you start on x86 or amd64 or arm or whatever; the basics are very similar and quickly learned; a handful of instructions are needed for turing completeness and you can ignore most of the rest. You know and understand assembly in general even if you don't know every instruction on amd64 and avr and arm. When you need more, it's just a matter of looking it up. I'm not saying that learning all of a complex instruction set is easy, but that's more "learning the ins and outs of a complex platform is a lot of work" than it is "assembly is hard." System calls likewise are platform complexity more than they are assembly difficulty. Same for all the hardware registers and peripherals if you're doing bare metal programming as I am.
- pizza234 5y ago> a handful of instructions are needed for turing completeness and you can ignore most of the rest. This is an idea that assumes spherical instructions in the void, in other words, just passively staring at a listing (or at most, writing a hello world). On a simplistic ISA like the 65xx, it's very complex to handle arithmetic as simple as a division or multiplication. Implementing them is hard, and reading them is hard, too ("what is this code doing"?). There are multiple implementations that one has to know in either case, otherwise it takes a considerable time especially when writing them. Anything beyond a "hello world" is definitely complicated in ASM.
- Claude_Shannon 5y ago"I think the idea of a course is that you will be taught." Without complaining a lot, that's not given. One of the professors supposedly is very helpful, while the second one... not so much. And here I cannot "choose" professors, it's pure luck. Okay, enough complaining. I dread it still a little, but I'm also at the same time wanting to start that as soon as I can, as it... I'd lie if I said assembly isn't interesting. And I want to see what's that all about. Thank you