4 ms·
Say hello to x64 Assembly, Part 2
- pmtarantino 12y agoI was very "anti" Assembly until I was forced to use it in college. It was fun, it forces you to change your way of thinking and be creative on how you code!
- bandanabanana 12y agoI enjoy these, hope you keep going! Maybe it's my nasm version, but "\n" seems to be inserted literal for me and not translated into LF. Thus my program outputs "Sum is correct\". Doing "msg: db 'Sum is correct',0xA" works for me though.
- e12e 12y agoNasm uses backquotes to enable c-style string escapes. So `\n` should work, "\n" should render as \n (not new-line). Eg: "Sum is correct",`\n` ;or `Sum is correct\n`
- _RPM 12y agoLooking for thoughts. What do you think is more useful to learn IBM 360 assembly (mainframe) or x64?
- akuma73 12y agoARM
- ANTSANTS 12y agoUndoubtedly x86, but it doesn't have to be an either/or thing, you know. Once you've got one ISA under your belt, it's pretty easy to pick up others.
- _RPM 12y agoThe reason why I ask is because this CS major peer had said that it would be _less_ useful to learn x86. Our class used IBM System/360 I assumed he was just trying to be a smart ass because I thought for sure it would best to learn x64 especially because it is modern and what my machine runs on / everything else.
- ANTSANTS 12y agoI could be wrong, but I think System/360 is like COBOL: utterly obsolete and useless outside of a small handful of multi-bajillion dollar banks and government organizations with decades-long commitments. Maybe it lives on, but any normal programmer is going to get a lot more use out of knowing x86. That said, learning a simpler architecture before you tackle the rat's nest that is x86 isn't a bad idea. 6502, 68000, MIPS, and ARM are all good choices for different reasons. Pick whatever appeals to you most.
- ido 12y agoWouldn't both be kind of extreme niches? Who programs a 64bit x86 in asm? I think the only places where you might use any asm language is embedded and these chips don't use x64 (my last embedded job was around 2006 using 8-bit CPUs @ about 1mhz & 4kB ram and even there we used c). Not to be misunderstood - it's good for you to learn as a programmer but since it's all for educational purposes anyway might as well learn something simpler like the parent suggested. "Practically" both are impractical in the modern world.
- sharpneli 12y agoKnowing how it works is extremely useful. And if you know one it's trivial to get to know another, like ARM as an example. I haven't actually written a line of asm in last few years but when you are thinking about performance you must be able to understand compiler output. And that I have been doing a great deal. You simply cannot make well performing code without that knowledge. You can always say that in modern desktop performance does not matter, but you cannot say the same in mobile space. There every single watt counts if you want to increase your battery life. Because when the CPU is idle they can pretty much shut the whole thing down for a small while.
- pjc50 12y agoLearning IBM 360 assembly is hilariously useless for any practical purpose; where are you going to find one to run it on outside an emulator? ARM is probably the best combination of "actually useful" and "suitable for beginners". 68k might be useful if you're into retrocomputing (Amiga, Sega Megadrive, et al). I learnt 16-bit Intel assembly for games purposes 20 years ago. Since then I've occasionally needed to read 32-bit and 64-bit Intel but never to write it. The default portable assembler is C. Assembler is as much a mindset as a specific set of mnemonics, anyway.
- Sophistifunk 12y agoI think the descriptions of endianness are off. Endianness doesn't affect the order of an array of bytes at all, only the rules for converting longer words to/from a byte array. [0xDE, 0xAD, 0xBE, 0xEF] will always be the same array of bytes, but 0xDEAFBEEF will not.
- readerrrr 12y agoIt is phrased poorly. Author should mention that the memory he is talking about is a single variable. Otherwise I found the article to be very clearly written.
- e40 12y agoWould love to see the same treatment for ARM64.
- floody-berry 12y agoNot ARM64, but "Tonc: Whirlwind Tour of ARM Assembly" [1] is what I'm repeatedly referring to while learning ARM. Pretty confusing coming from x86, but it's starting to make sense and my ARM is getting slightly less awful. [1] http://www.coranac.com/tonc/text/asm.htm http://www.coranac.com/tonc/text/asm.htm
- e40 12y agoQuoting: "Because the ARM processor is 32bit" so this isn't for the 64-bit variant, which is what I meant by ARM64.
- clarry 12y ago> Signed integers are signed binary numbers held as unsigned in a byte, word and etc... The sign bit is set for negative integers and cleared for positive integers and zero. That sounds like a description of sign-and-magnitude.