Quote Originally Posted by Charles Linquis View Post
My only concern is that I have my INIT vector hard-coded at 0x59a, and I'm worried that it won't always work.
It's a good reason for concern, because INIT is always located after the system library code. Some day you'll use a statement that hasn't been used yet in the program and the library size will increase. Then INIT will be moved along with it, and it won't work anymore.

When you compile a program, the first instruction at location 0000 is a GOTO INIT.
But when MC Loader loads the program, it relocates that instruction to an address just before the bootloader code.

I don't have an 18F8722 to look at, but on an 18F452 the bootloader code starts at 0x7D84, and the GOTO gets relocated to 0x7D70.

You can see from the disassembly here, the highlighted line is where the GOTO instruction was moved to.
0x4a is the address of INIT for this test program.



So all you need to do is figure out where it gets relocated with that chip, then jump to that address, which in turn jumps to INIT.

HTH,