zero out bitvars area in cstartup

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi there,

I'm trying to zero out the bitvars area in a 8052 cpu in the 'cstartup'
file.

My compiler (IAR) has two "assembler operators" SFB(..) and SFE(..)
that gives me the start and end of the "bit addresses" that needs to be
cleared.


MOV     R0,#SFB(BITVARS)
SJMP    CLEAR_BITVAR_2
CLEAR_BITVAR:
CLR     R0
INC     R0
CLEAR_BITVAR_2:
CJNE    R0,#SFE(BITVARS),CLEAR_BITVAR

This code doesnt seem to work.
I'm not sure but it's probably the "CLR R0" line that's the problem.
Regards


Re: zero out bitvars area in cstartup



Quoted text here. Click to load it

MOV     R0,#SFB(BITVARS)
SJMP    CLEAR_BITVAR_2
CLEAR_BITVAR:
CLR     R0   ; ******* This is wrong *****
INC     R0
CLEAR_BITVAR_2:
CJNE    R0,#SFE(BITVARS),CLEAR_BITVAR

my 8051 asm is rusty but try:
CLR     @R0

or
CLR A
MOV @R0,A

you need to use R0 as a pointer (indirect move)

If I am wrong try the forum at www.8052.com




Site Timeline