Fri Aug 15 08:48:46 BST 2008


Microchip is not really being very helpful providing anything else
than the .pdf programmers reference.  So, let's see if there's a way
to get a hold on the instruction set without typing it in.

The difference between dsPIC and the 8-bit PICs is the addressing
modes.  This chip has more of a classical RISC ISA.

Data memory hierarchy:

RAM, first word      (WREG)
RAM, first 16 words  (Wxx - Working registers)
RAM, first 4K        (File registers, Near RAM)
RAM, all 64K

Data addressing modes:

              | File Register
   |- Basic --| Immediate       | No Modification
   |          | File Register   | Pre-Increment
   |          | Direct          | Pre-Decrement
   |          | Indirect -------| Post-Increment
   |                            | Post-Decrement
   |                            | Literal Offset
   |                            | Register Offset
   |            |- Direct
   |- DSP MAC --|
                |             | No Modification
                |             | Post-Increment (2, 4 and 6)
                |- Indirect --| Post-Decrement (2, 4 and 6)
                              | Register Offset

The only difficulty is to somehow encode the addressing modes
properly.  The generic template is:

 (file  (o b f d)       "oooo oooo obdf ffff ffff ffff")
 (lit10 (o b k d)       "oooo oooo obkk kkkk kkkk dddd")
 (lit5  (o b w k d)     "oooo owww wbqq qddd d11k kkkk")
 (alu3  (o b w q d p s) "oooo owww wbqq qddd dppp ssss")

lit5 -> lit4 for shifts

I'm not feeling much for typing it all in.. Isn't there a way to snarf
the assembler from a file generated by mplab?

Typing the address modes manually, the opcodes i can probably get that
way. So, roadmap:

1. generate an ASM file with all opcodes
2. run mpasm30
3. interpret output (binary?)

Setting up mpasm30.. I have an XP image somewhere.. Wait, there are
linux binaries.