Yes, I've checked this post (How are bytes counted in assembly), but I'm asking a different question. I'm asking, if I have an .asm
file, an .obj
file and an .exe
file, which one should I submit? Which part in the code should I submit? Especially for .obj
files and .exe
files -- I have no idea which part of code is the real assembled code, while others are only boilerplates.
1 Answer
It's up to you!
Some of my assembly answers are provided as instruction listings, because the assembly IR / target code is larger than the mnemonic size.
For x86, it's usually the best idea to provide the assembled machine code as a flat binary, state where the entry point is, and describe the calling convention. If you need to access the system interface, you're locked out of libc, so you'll have to use either linux syscalls, or whatever your operating system supports.
You can also post DOS .com submissions - MS-DOS provides you some system API's (and some users on codegolf made a lot of MS-DOS specific answers!), but also it provides you the flexibility and code golf potential with unrestricted hardware and memory access.
-
2\$\begingroup\$ Thanks for answering! Actually I only have MASM available, no Linux :) Is "disassemble and find the expected part" a good option? \$\endgroup\$– atzltCommented Feb 4, 2021 at 14:28
-
\$\begingroup\$ I advise you to use nasm, which has the binary output format, making stuff much more convenient. \$\endgroup\$ Commented Feb 4, 2021 at 14:39
-
1\$\begingroup\$ Here's the link: nasm Also, ndisasm makes disassembly very convenient (MASM doesn't come with this tool). \$\endgroup\$– user99151Commented Feb 5, 2021 at 8:44
.asm
(whether it is a function or a program), then it simply becomes a valid assembly submission. I think a full program machine code submission should be the entirety of the.exe
or whatever executable you have, but for a function submission, I believe most machine code golfers use some kind of disassembly tool (which shows the address, the raw machine code bytes in hex, and the corresponding assembly). \$\endgroup\$