Compiler generates wrong opcode codes for SWAP and SL
Posted: 19 Jun 2009 07:10
Hi,
I found that the mikroVirtualMachine - V. 5.0.0.3 generates the wrong operation codes for the SWAP and SL assembly instructions. When you compile the program and try to run it, the PIC will just restart. I tried debug the program in the software debugger and where the program will also crash.
After I manually edited the HEX file with the correct opcode, the program ran 100% on the PIC.
According to the datasheet the SWAP instruction should generate an opcode of
where B is 1 for byte operation and ssss is the working register number as in the image below.
I whoever found that the compiler generates an opcode of
for both of the following commands
and
Thus it doesn't take the .B into consideration for bit 10 and the other problem is that bit 9 is 1 and should be 0.
Please take this into consideration for the next version and keep up the good work.
I can't wait for the beta version to be released.
Thank you
Anton
I found that the mikroVirtualMachine - V. 5.0.0.3 generates the wrong operation codes for the SWAP and SL assembly instructions. When you compile the program and try to run it, the PIC will just restart. I tried debug the program in the software debugger and where the program will also crash.
After I manually edited the HEX file with the correct opcode, the program ran 100% on the PIC.
According to the datasheet the SWAP instruction should generate an opcode of
Code: Select all
1111 1101 1B00 0000 0000 ssss
where B is 1 for byte operation and ssss is the working register number as in the image below.
I whoever found that the compiler generates an opcode of
Code: Select all
1111 1101 1110 0000 0000 ssss
||
||--> should be 0
|---> should be B
Code: Select all
asm
SWAP W6
end;
Code: Select all
asm
SWAP.B W6
end;
Please take this into consideration for the next version and keep up the good work.
I can't wait for the beta version to be released.
Thank you
Anton