We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
//please compiler this program //why j equ 0 ? #pragma src #prgma OT (8) unsigned char KeyDisBuf[16]; unsigned char Get_Int_Data(unsigned int i) { unsigned char j,k; for (j=15;;j--) { KeyDisBuf[j]=i%10; i/=10; if (i==0) break; } k=16-j; for (j=0;j<k;j++) KeyDisBuf[j+2]=KeyDisBuf[j+16-k]; //this line is error,(j==0) why? return (k+2); } main() { unsigned char i; i=Get_Int_Data(12345); for (;;); } ; temp.SRC generated from: temp.c NAME TEMP ?PR?_Get_Int_Data?TEMP SEGMENT CODE ?DT?_Get_Int_Data?TEMP SEGMENT DATA OVERLAYABLE ?PR?main?TEMP SEGMENT CODE ?DT?main?TEMP SEGMENT DATA OVERLAYABLE ?DT?TEMP SEGMENT DATA EXTRN CODE (?C?UIDIV) EXTRN CODE (?C_STARTUP) PUBLIC KeyDisBuf PUBLIC main PUBLIC _Get_Int_Data RSEG ?DT?main?TEMP ?main?BYTE: i?143: DS 1 RSEG ?DT?_Get_Int_Data?TEMP ?_Get_Int_Data?BYTE: i?040: DS 2 RSEG ?DT?TEMP KeyDisBuf: DS 16 ; #pragma src ; unsigned char KeyDisBuf[16]; ; ; unsigned char Get_Int_Data(unsigned int i) RSEG ?PR?_Get_Int_Data?TEMP _Get_Int_Data: USING 0 ; SOURCE LINE # 4 MOV i?040,R6 MOV i?040+01H,R7 ; { ; SOURCE LINE # 5 ; unsigned char j,k; ; for (j=15;;j--) ; SOURCE LINE # 7 ;---- Variable 'j?041' assigned to Register 'R3' ---- MOV R3,#0FH ?C0001: ; { ; SOURCE LINE # 8 ; KeyDisBuf[j]=i%10; ; SOURCE LINE # 9 MOV R6,i?040 MOV R7,i?040+01H MOV R4,#00H MOV R5,#0AH LCALL ?C?UIDIV MOV A,#LOW (KeyDisBuf) ADD A,R3 MOV R0,A MOV @R0,AR5 ; i/=10; ; SOURCE LINE # 10 MOV R6,i?040 MOV R7,i?040+01H MOV R4,#00H MOV R5,#0AH LCALL ?C?UIDIV MOV i?040,R6 MOV i?040+01H,R7 ; if (i==0) break; ; SOURCE LINE # 11 MOV A,i?040+01H ORL A,i?040 JZ ?C0002 ; } ; SOURCE LINE # 12 ?C0003: DEC R3 SJMP ?C0001 ?C0002: ; k=16-j; ; SOURCE LINE # 13 CLR C MOV A,#010H SUBB A,R3 MOV R7,A ;---- Variable 'k?042' assigned to Register 'R7' ---- ; for (j=0;j<k;j++) ; SOURCE LINE # 14 CLR A MOV R3,A ?C0005: MOV A,R3 CLR C SUBB A,R7 JNC ?C0006 ; KeyDisBuf[j+2]=KeyDisBuf[j+16-k]; ; SOURCE LINE # 15 CLR C MOV A,R3 SUBB A,R7 ADD A,#LOW (KeyDisBuf+010H) MOV R0,A MOV A,@R0 MOV R6,A MOV A,#LOW (KeyDisBuf+02H) ADD A,R3 MOV R0,A MOV @R0,AR6 (This line have not " INC R3" ,why?) SJMP ?C0005 ?C0006: ; return (k+2); ; SOURCE LINE # 16 MOV A,R7 ADD A,#02H MOV R7,A ; } ; SOURCE LINE # 17 ?C0008: RET ; END OF _Get_Int_Data ; ; main() RSEG ?PR?main?TEMP main: USING 0 ; SOURCE LINE # 19 ; { ; SOURCE LINE # 20 ; unsigned char i; ; i=Get_Int_Data(12345); ; SOURCE LINE # 22 MOV R7,#039H MOV R6,#030H LCALL _Get_Int_Data MOV i?143,R7 ; for (;;); ; SOURCE LINE # 23 ?C0009: SJMP ?C0009 ; END OF main END