Instruction Minutia for Enhanced Mid-range PIC's

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
Minutia

upload_2019-3-5_9-20-24.png

The addfsr offsets are limited to -32 to +31. What happens if you want to move an indirect register to W without an increment or decrement? You can use moviw 0[FSR0] or the older movf INDF0,W.

"movf INDF0,W" compiles to "movf 0,W" in the disassembly listing. Alternatively, one can write "movf 0,W" in code, and it compiles to the same instruction.

Now, here's the minutia:
"moviw 0[FSR0] " compiles to "moviw [0]FSR0", but if you use the latter format in your code, you get an error.

I have certainly not tested all of the instructions, but it is the only instance I am aware of for which the disassembly "instruction" cannot be used as an instruction in code. I am using MPLAB 8.92.
 

JohnInTX

Joined Jun 26, 2012
4,787
It looks like whoever wrote the disassembler whiffed on the syntax for that instruction. Keep in mind that the disassembler itself uses the source code to associate comments etc. but rebuilds the mnemonic instructions themselves from the raw memory image, not the instruction source file. That way, you can evaluate what the actual PIC executable is rather than what the source implies. They should be the same of course but decoding from the raw source will identify assembler/compiler and processor header file bugs - or syntax errors in the disassembler.

Curious but I wouldn't worry about it.
Have fun!
 

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
It looks like whoever wrote the disassembler whiffed on the syntax for that instruction.
Have fun!
That was my thought exactly. Maybe that person was thinking of the syntax for high and low directives (e.g., low(412)...) and had a headache.

The only practical application that occurred to me would be someone who disassembles a hex file, makes a minor change, and then finds that it won't assemble (assuming he is using a disassembler with the same error). Those instructions are included in the C-compiler optimized group, which suggests they may be used frequently.

As for the "disassembly" that MPLab gives, I look at it quite frequently when debugging, which is how I notice the brackets on the wrong part of the operand.
 
Top