Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • \$\begingroup\$ Normally I'd golf in machine code, not asm source. But sure, it's just as valid as other languages. Yes as you suspected you're missing some optimizations. If you link into a non-PIE executable, you don't need wrt ..plt. And you can tailcall puts with jmp puts instead of call/ret. You also don't need to put the string in a separate section from main. (And if you did, the default section is .text so you could have just put the data after). You do need extern puts and global main, though, for NASM. With GAS syntax you wouldn't need extern. \$\endgroup\$ Commented Oct 22, 2019 at 3:50
  • \$\begingroup\$ 68 bytes: tio.run/… I'll leave it to you to calc the score. Note the removal of the space after a:, and the newline after main:. Also the space after db. And using backticks instead of double quotes around the string for \0. I tried omitting the \0 to depend on whatever's after it in the .text section, but I didn't get lucky with zero padding. Anyway, it links fine with nasm -felf64 hell0.asm && gcc -no-pie hell0.o \$\endgroup\$ Commented Oct 22, 2019 at 3:59
  • \$\begingroup\$ Hmm, I forgot about the scoring system for a minute. Note that uppercase letters have lower codepoints, so MOV EDI,A / JMP puts. And EXTERN puts / GLOBAL main. And A:DB"Hell0 W0rld!",0. Also use tabs instead of spaces, and tab instead of : on labels. But double-quotes with ,0 is better than backticks with \0. IDK what I was thinking there, it's not even a saving in bytes. tio.run/… \$\endgroup\$ Commented Oct 22, 2019 at 4:16