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

How to insert NOP instruction in the specified address

Hi all

I have a normal 8051's code ,but i want insert NOP instruction in the specified address
without modify the original code (it meaning I didn't need to check LST file to find the address
and then insert a nop )

for example
The code before insert NOP:

02FF F1EA           4147             CALL    A_FUNC
0301 22             4148             RET

The code after insert NOP:

02FF 00             XXXX             NOP
0300 F1EB           4147             CALL    A_FUNC
0302 22             4148             RET

I try to put

ORG 2FFh
NOP

in the top or bottom of the code ,

In the top ,It will be overwritten , there is nothing change,
In the bottom , It will insert a NOP instruction, but destroyed the original instructions format

Does the compiler or linker can help to do this work ??
it also can say I want retain the specified location for NOP,
so compiler will skip it but still compiled correctly

Thanks a lot for you read this post , and please forgive my poor English

Parents
  • I have a normal 8051's code ,but i want insert NOP instruction in the specified address
    without modify the original code

    That wish is self-contradictory. Inserting a NOP is a modification of the original code.

    So now we know there's absolutely way you can have what you think you want, how about we find out what you actually want? You'll have to start by telling why it is you think you want what you said.

Reply
  • I have a normal 8051's code ,but i want insert NOP instruction in the specified address
    without modify the original code

    That wish is self-contradictory. Inserting a NOP is a modification of the original code.

    So now we know there's absolutely way you can have what you think you want, how about we find out what you actually want? You'll have to start by telling why it is you think you want what you said.

Children
No data