cancel
Showing results for 
Search instead for 
Did you mean: 

LDI instruction

mbuto
Associate II
Posted on March 24, 2004 at 07:55

LDI instruction

4 REPLIES 4
mbuto
Associate II
Posted on March 24, 2004 at 04:40

Hallo, i've programmed over an st62t60c in c language and then i've used the st assembler and linker. Looking at the .pop file in assembler i've noticed that, for almost all the global variables used in the program, the compiler produces only one a LDI instruction to initialize values; while for some other local variable he doesn't. Here follows what i mean:

*for some global variables he uses this addressing:

LDI XY0,_buffer+4

LDI A,0x0

LD *XY0,A

*while for others it produces only the following instruction:

LDI _buffer+4,0x0

I've tried to substitute this second way of addressing even for the other variables, and the sw seems to work properly.

Now i would like to know why the compiler has this behaviour and if substituting the second instance on all the global variables could create any hidden problem.

Thank you very much and bye, Marco

sjo
Associate II
Posted on March 24, 2004 at 06:02

Its look like you have the old cst6 c compiler, what version is it ?

The first method is used for clearing arrays of numbers.

the syntax of the asm in the pop file looks incorrect, this is how I think it should be.

LDI X,_buffer+4

LDI A,0x0

LD (X),A ; clear data pointed to by X

singular bytes are cleared with

clr _buffer+4 which is the same as ldi _buffer+4, 0

Are you updating an old project, why not use the compiler from Raisonance ?

Regards

sjo
mbuto
Associate II
Posted on March 24, 2004 at 07:01

Thanks for your reply.

The *.pop file i've referred to, produces the commands i've written; while the *.lis file produced exactly the lines you've written.

I tried to use the Raisonance compiler but i've some troubles with its configuration. Now i'm using a CST6 compiler Version 1.0 (with st6 macro assembler version 4.50 and linkage editor v. 3.40).

do you think that the updating of the global variable with the only LDI instruction will cause any problem?

Hi, marco
sjo
Associate II
Posted on March 24, 2004 at 07:55

Version 1.0 was a bit buggy, version 1.1 is better (the last version I think) - but none are as good as Raisonance

Version 1.1 also adds wgd6 support.

The version of lst6 with cst6 1.1 is 3.5.

Regards

sjo