This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assembly instructions to opcode conversion

Hello, I would like to know if there is any pattern that the compiler follows to write the correspoding opcode into the .hex file

I tried to figure out patterns, but there is always some other instruction countering it

Thanks in advance

Parents
  • Of course there is a pattern.

    The processor manufacturer - or Intel, in case the processor is 100% Intel 8051-compatible - have documentation of how the individual processor instructions are encoded.

    Just note that only some part of the characters in an Intel hex file is file data. And only some of the file data is processor instructions. There can also be data constants (such as text strings to print etc) in the file data.

    There are lots of sources of documentation for the Intel hex file format.

    If you have a full license of the tools, then you can let the tools produce listing files when building your code. The listing files will contain the produced assembler instructions and the corresponding bytes that represents the instructions.

    An important question you forgot to mention is why you wonder about this? It's normally best to tell why you wonder about things, since you may then get much better answers.

Reply
  • Of course there is a pattern.

    The processor manufacturer - or Intel, in case the processor is 100% Intel 8051-compatible - have documentation of how the individual processor instructions are encoded.

    Just note that only some part of the characters in an Intel hex file is file data. And only some of the file data is processor instructions. There can also be data constants (such as text strings to print etc) in the file data.

    There are lots of sources of documentation for the Intel hex file format.

    If you have a full license of the tools, then you can let the tools produce listing files when building your code. The listing files will contain the produced assembler instructions and the corresponding bytes that represents the instructions.

    An important question you forgot to mention is why you wonder about this? It's normally best to tell why you wonder about things, since you may then get much better answers.

Children