This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

online asm in c51, what is the matter?

I use this code:

#include <reg52.h>

void main(void)
{
  unsigned char data x8,x9,x10;
  while(1)
  {
  x8 = 0;
  x9 = 9;
  x10 = x8 + x9;
  __asm CLR A;
  }
}

and the SRC file is look like this, I think this is right:
; void main(void)

	RSEG  ?PR?main?MAIN
main:
	USING	0
			; SOURCE LINE # 5
; {
			; SOURCE LINE # 6
?C0001:
;   unsigned char data x8,x9,x10;
;   while(1)
			; SOURCE LINE # 8
;   {
			; SOURCE LINE # 9
;   x8 = 0;
			; SOURCE LINE # 10
;---- Variable 'x8?040' assigned to Register 'R7' ----
	CLR  	A
	MOV  	R7,A
;   x9 = 9;
			; SOURCE LINE # 11
;---- Variable 'x9?041' assigned to Register 'R6' ----
	MOV  	R6,#09H
;   x10 = x8 + x9;
			; SOURCE LINE # 12
	ADD  	A,R6
	MOV  	x10?042,A
;   __asm CLR A;
	 CLR A;
;   }
			; SOURCE LINE # 14
	SJMP 	?C0001
	RET  	
; END OF main

	END

But, when Debug it, it look like this in debug window:
C_STARTUP:
C:0x0000    020003   LJMP     STARTUP1(C:0003)
STARTUP1:
C:0x0003    787F     MOV      R0,#0x7F
C:0x0005    E4       CLR      A
IDATALOOP:
C:0x0006    F6       MOV      @R0,A
C:0x0007    D8FD     DJNZ     R0,IDATALOOP(C:0006)
C:0x0009    758108   MOV      SP(0x81),#0x08
C:0x000C    020000   LJMP     C_STARTUP(C:0000)========>You see here!!!
MAIN:
C:0x000F    E4       CLR      A
C:0x0010    FF       MOV      R7,A
C:0x0011    7E09     MOV      R6,#0x09
C:0x0013    2E       ADD      A,R6
C:0x0014    F508     MOV      0x08,A
C:0x0016    E4       CLR      A
C:0x0017    80F6     SJMP     MAIN(C:000F)
C:0x0019    22       RET

do you know why?