Working with PIC assembly can be pretty fun, but sometimes making up names for loop/condition labels and keeping track is just a pain. So I wrote this macro library that lets you write nested IF blocks, just like C or other languages.
This is a runtime if macro library. It compiles into
real run-time evaluated nested if blocks. I use it for
just about everything and I hope you will too.
How come there are NOPs after every goto? I don't remember doing that the last time I wrote assembly for the 10 or 16 series - butvitcwas a few years ago so I might have forgotten all about it. ;-)
Those nops are actually the 2nd word of the GOTO instructions. This was compiled targeting a pic18f series chip which uses 2 words (4 bytes) per GOTO so that it can support up to 2M of flash addresses. The disassembler reads the 2nd word back as a NOP. On 16f series chips GOTOs use 1 word.
There are some brach instructions in the 18f series that take 1 word, but are limited to certain relative address ranges.
Ah... The 18f.... That explains it. I've never coded in assembly for them, only C. The one's that I do assembly for have an 11bit address field + the pclath register as the destination.
But isn't there a disassembler that can generate and display properly formatted "source" for the two-byte gotos?
@matseng, I was just using the Window -> PIC Memory Views -> Program Memory, the disassembly view seems to hide labels (part of what I was trying to demo) but doesn't show any NOPs
How come there are NOPs after every goto? I don't remember doing that the last time I wrote assembly for the 10 or 16 series - butvitcwas a few years ago so I might have forgotten all about it. ;-)