Robert Wuest - 2008-10-23

I'm trying to port Microchip's USB bootloader for a pic18f4450.
I have Version:
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.8.4 #5252 (Oct 22 2008) (UNIX)
compile command is: sdcc -mpic16 -p18f4450 -c usbdrv.c

So the code in question is:
void ClearArray(byte* startAdr,byte count)
{
    *startAdr;
    POSTINC0;   // <----- Added by me to try and fake out the compiler
    while(count)
    {
        _asm
        clrf POSTINC0,0
        _endasm;
        count--;
    }//end while
}//end ClearArray

POSTINC0 is define in pic18f4450.h as:

extern __sfr __at (0xFEE) POSTINC0;

However, the generated assembler omits POSTINC0.  Apparently since it is inside the _asm, it isn't flagged as need by the compiler.  That one line "POSTINC0;" was my failed attempt to get the compiler to put out the equate.

here's the pertinent .asm code that gets generated for this module:

;    Equates to used internal registers
;--------------------------------------------------------
STATUS    equ    0xfd8
FSR1L    equ    0xfe1
FSR2L    equ    0xfd9
INDF0    equ    0xfef
POSTDEC1    equ    0xfe5
PREINC1    equ    0xfe4
PLUSW2    equ    0xfdb

So is there someway to get the compiler to think I've used POSTINC0 without actually using it?

Robert