zero out bitvars area in cstartup

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

Reply to
Beach
Loading thread data ...

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

formatting link

Reply to
Neil Kurzman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.