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
zero out bitvars area in cstartup
Started by ●January 11, 2005
Reply by ●January 11, 20052005-01-11
Beach wrote:> 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. > RegardsMOV 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