Hi Peter,

> Weird, it gets stuck in gpsim about [****] here:
> 
>       BCF     STATUS,5
>       BCF     STATUS,6
>  ****      MOVWF      _var_u_char_8_b                         
> ;     .line   14; "bDIV.c"        return var_u_char_8_b;
>       MOVF    _var_u_char_8_b,W
>       RETURN  
> ; exit point of _div1

Any message from gpsim?

> The offending routine is at the bottom of the post, I've added ******* 
> to the offending bit.  I think I will upgrade my installation (Slackware) 
> to see if latest gpsim and sdcc on a fresh installation makes a 
> difference, not that it should.  Just in case there is something odd this 
> will not destroy the old installation as it will be on a different disk 
> partition.

Did you recompile the pic14 library after upgrading?
I use gpsim r1748 (roughly 0.21.12-pre) and SDCC r4440, when last I
looked gpsim releases were rather outdated, maybe you should use the svn
version as well?

> The idea of the function below is that it outputs a pulse 1msec wide for 
> position = -1000 and 2msec wide for position = 1000.

Checked your code with a main() that calls the given function with
arguments of -1000, -500, 0, 500, and 1000, and set a breakpoint once
the result of __divsint has been stored into the registers (address
taken from .lst file). I then used 'trace 20' to obtain the past
assignments of both result bytes and found they were totally reasonable
0x0000, 0x003e, 0x007d, 0x00bb, and 0x00fa respectively. Target PIC was
a 16f877 (which one do you use?).

((Two side notes: If you put position + 1000 in an unsigned variable, SDCC
should optimize the division to right shifts---and possibly hide your
problem... Using 8u instead of 8 might also be required...))

You may want to inspect your .map files to see if you are out of memory;
or if gputils have allocated some variables where they should not have
been, possibly instructed by SDCC; or ...

-- 

Regards,
Raphael Neider



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to