Hi, I am using following function to display data on LCD:

void table_to_nokialcd(unsigned char charsel)
{
unsigned char i;

        for ( i = 0; i < 5; i++ )
        {
        nokia_write_data(FontLookup[charsel-32][i] << 1);
        }
        nokia_write_data(0x00);
}

but its not working properly for charsel >='T'. I suspect there is a problem 
with FontLookup[charsel-32][i] expression which compiles into this code:

        ...
        MOVLW   0x05
        MOVWF   STK00
        MOVF    r0x1003,W               ;r0x1003=charsel-32 here
        PAGESEL __mulchar
        CALL    __mulchar
        PAGESEL $
        BANKSEL r0x1004
        MOVWF   r0x1004
        CLRF    r0x1005
        CLRF    r0x1003
;unsigned compare: left < lit(0x5=5), size=1
_00172_DS_
        MOVLW   0x05
        BANKSEL r0x1003
        SUBWF   r0x1003,W
        BTFSC   STATUS,0
        GOTO    _00175_DS_
;genSkipc:3057: created from rifx:0xbfead8f0
;       .line   165; "nokia.c"  nokia_write_data(FontLookup[charsel-32][(int)i] 
<< 
1);
        MOVF    r0x1004,W
        ADDLW   (_FontLookup + 0)
        MOVWF   r0x1006
        MOVLW   high (_FontLookup + 0)
        MOVWF   r0x1007
        ...

I think so the problem comes from ignoring __mulchar overflow (which can and 
will overflow for r0x1003>51). Is this some kind of bug or am I overlooking 
something? Thanks.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to