1
\$\begingroup\$

If an opcode solution uses but doesn't rely on value of somewhere

  • At the beginning/end of program
  • In the middle of program

, then do these count as program size?

Example where placed at end:

use16
...
pop word [end]
fild word [end]

Example where placed in middle:

use16
...
mov [ins1+1], cx
...
ins1:
mov ax, ?
\$\endgroup\$
2
  • \$\begingroup\$ Can you explain more about the examples? Like, how does the machine code look like? Which address is read/written by which instruction? Also, what type of solution is an "opcode solution" - is it a function or full program? \$\endgroup\$
    – Bubbler
    Jul 11, 2023 at 7:47
  • \$\begingroup\$ @Bubbler how does the machine code look like? - Exact machine code usually not cared. Which address is read/written by which instruction? -- If someone know asm it should be self documented. Also, what type of solution is an "opcode solution" - is it a function or full program? -- A real question. Usually function is considered. Full program can use space after without larger file. Yet when placed in middle this is still a question \$\endgroup\$
    – l4m2
    Jul 11, 2023 at 8:36

1 Answer 1

3
\$\begingroup\$

I'm not that literate with asm, but given that asm solutions are measured in bytes of machine code, I believe that answers must ultimately be a contiguous block of bytes. One rationale is that the block of machine code is read from a file, placed in memory as-is, and then executed. This means several things for this question:

  • if your function or full program uses some scratch space before or after your code in memory, it is OK to not count those bytes even if they are executed, or some instructions are incomplete (and to be completed dynamically so that it can run).

  • if your function or full program overwrites some bytes in the middle of your code in memory, you must count those bytes even if the original value of that byte is not used.

\$\endgroup\$

You must log in to answer this question.

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