2
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ If you read the linked post, then it should be clear that object files are not assembly at all. If you're asking how to golf in machine code, then... I don't know a damn thing, so feel free to edit your question to ask that (or head over to the chat room). \$\endgroup\$ Feb 4 at 1:27
  • 1
    \$\begingroup\$ If you submit .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\$
    – Bubbler
    Feb 4 at 1:33
2
\$\begingroup\$

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.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Thanks for answering! Actually I only have MASM available, no Linux :) Is "disassemble and find the expected part" a good option? \$\endgroup\$ Feb 4 at 14:28
  • \$\begingroup\$ I advise you to use nasm, which has the binary output format, making stuff much more convenient. \$\endgroup\$ Feb 4 at 14:39
  • 1
    \$\begingroup\$ Here's the link: nasm Also, ndisasm makes disassembly very convenient (MASM doesn't come with this tool). \$\endgroup\$
    – user99151
    Feb 5 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .