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
If you are able to add that ORG statement, then you are obviously modifying source code. So don't waste more time - add that nop where it should be - on the line before the call.
You can't have a nop unless there is a free space for it. Placing the nop on the line before the call, the assembler+linker will reserve space for it. Trying to play with ORG will not reserve any space. The memory cell can either store a nop, or the first part of that call instruction.
An alternative is that you, as hinted at by previous posters, tells us exactly why you feel there is a need for a nop before that call. And why you see it so problematical to just insert it on the proper line of the source file.