Whole-known-network
<p><span class="h-card" translate="no"><a href="https://f.duriansoftware.com/@joe" class="u-url mention">@<span>joe</span></a></span> okay, but is nasm documenting Intel format or is it documenting nasm's flavor of Intel format…?</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> it's been a while, but from my recollection nasm did fairly reasonably document its syntax when i first used it (though a lot of its documentation does describe things relative to masm/tasm syntax)</p>
<p>Findings so far:</p><p>- If you put ".intel_syntax" at the top of a gas file, it does *not* give you intel syntax *or* AT&T syntax but a secret third thing. The way to get the real intel syntax is ".intel_syntax noprefix"</p><p>- It didn't accept the 0(reg) syntax to dereference. By experimentation, I found I could do 0[reg]. That is terrifying. Guessing, I mean.</p><p>- No one I have spoken to has learned intel syntax by anything other than oral tradition. Also, no one uses intel with gas (they all use nasm?)</p>
<p>the two genders: terrorist and counter-terrorist</p>
<p>Expanding on my question re: "where is intel assembly format actually documented?"</p><p>mov rax, 60</p><p>This is pretty simple, right? I want the number 60 in rax. This says: ambiguous operand size for mov. Oh, there was something about that in the gas manual. Okay, I say:</p><p>mov rax, dword 60</p><p>It says: junk 60 after expression</p><p>What the heck do I do now? Do I just come back to mastodon for help every time I want to type a number? All the StackOverflow examples on are AT&T format.</p>
<p>2. At a certain point in my code, I wanted to load a pointer to the .data segment variable "input" into my %r10. The way to do this turned out to be</p><p> lea input(%rip), %r10</p><p>rip is… the instruction pointer?? what the devil is the instruction pointer doing there? `input` is at a fixed location, surely it's not loading it from an address relative to the fricking instruction pointer.</p>
<p>So it took longer than I'd hoped, but I now have a working first-pass AMD64 ASM program that can decode an ASCII number in the .data segment and print it out again.</p><p><a href="https://github.com/mcclure/aoc2024/blob/ad0a3f670a4ed6d403f81863977175315284d220/03-01-multiply/src/number-echo.s" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">github.com/mcclure/aoc2024/blo</span><span class="invisible">b/ad0a3f670a4ed6d403f81863977175315284d220/03-01-multiply/src/number-echo.s</span></a></p><p>Build instructions in adjacent run.txt.</p><p>I have some questions.</p><p>(1 of 2). I think I don't like GNU/AT&T assembly format and would like to switch to Intel assembly format. Is Intel format… documented… somewhere? This is the closest I found. <a href="https://sourceware.org/binutils/docs/as/i386_002dVariations.html" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">sourceware.org/binutils/docs/a</span><span class="invisible">s/i386_002dVariations.html</span></a></p>
<p>I'm sorry the x86_64 multiply instruction works fucking *how*. What fucking century is it</p>
<p><span class="h-card" translate="no"><a href="https://dmv.community/@akuchling" class="u-url mention">@<span>akuchling</span></a></span> Hmmm. Seems harmless enough. Thanks for the link.</p>