In infenion Instrction set manual,there are 2 instrctions as follow, MOV Rwn, #data4 E0 #n 2 MOV reg, #data16 E6 RR ## ## 4 where Rwn refers to Word GPR (R0, R1, …, R15); reg refers to SFR/ESFR or GPR In my BIN file there is one machine code"E6 RR ####",for example"E6 F9 00 00",after being disasembled by IDA,the code is transfered to"MOV R9,#0".But when I used KEIL to build it,it is changed into "E0 09",how can I get it back into "E6 F9 00 00"using Keil,Can anyone give me some advice or help?Thanks a lot! wangwei
This surely must be the first time anybody complained about a programming tool generating a smaller, faster opcode to implement a given operation than some other. It implies you're trying to do the wrong thing --- not to mention that the way you describe your workflow rather strongly indicates you're probably trying to violate somebody else's copyright in the process.
"a programming tool generating a smaller, faster opcode to implement a given operation than some other" Thank you for your help. But I want to say that it surely not a copyright problem,only a work done by someone in my school,but its' source file hasn't been found by now. In my BIN file,the opcode "E0 09" and "E6 F9 00 00" are all disasmbled to be MOV r9,#0.that is, it isn't indentical,why?
In my BIN file,the opcode "E0 09" and "E6 F9 00 00" are all disasmbled to be MOV r9,#0.that is, it isn't indentical,why? You're still missing the point. They're both disassembled like that because these two opcodes have identical effect, even though their encoding is different. Either that, or the disassembler is broken (which would be way off-topic in this forum, since IDA is not by Keil). The point you're completely missing is that this is not anything to be worried about unless you somehow need to match the existing code byte for byte.
unless you somehow need to match the existing code byte for byte I assumed that was the problem in this case. That is, what if you need to patch some old code and you have only the binary? You'd like everything but your change to remain byte-for-byte identical just to avoid worries and testing hassle. So, the question is how to force the C166 assembler to generate the less than optimal instruction for MOV R9, #0. Perhaps there's a way to force the data width to 16 bits. A really crude and ugly way to get the desired instruction would be to use a 16-bit value (MOV R9, #8000), and then patch just that one byte in the output from the assembler.
"Perhaps there's a way to force the data width to 16 bits.A really crude and ugly way to get the desired instruction would be to use a 16-bit value (MOV R9, #8000)" The idea is very good,but I have tried it and it has no sense.Finally,an advice from a kindly friend of Keil technical support in Asia help me to settle the problem.Itis using the format as "MOV R9,#DATA16 0X00" can get the "E6 F9 00 00"16 bits opcode. I am very appreciate of all the kindly help. wangwei