① 單片機程序分析題
設R0=20H,R1=25H,(20H)=70H,(21H)=80H,(22H)=A0H,(22H)=A0H,(25H)=A0H(26H)=6FH,(27H)=76H,下列程序執行後,
CLR C ;CY=0
MOV R2,#3 ;R2=03H R2=02H R2=01H
LOOP:
MOV A,@R0 ;A=70H A=80H A=A0H
ADDC A,@R1 ;CY=1,A=10H CY=0,A=F0H CY=1,A=16H
MOV @R0,A ;(20H)=10H (21H)=F0H (22H)=16H
INC R0 ;R0=21H R0=22H R0=23H
INC R1 ;R1=26H R1=27H R1=28H
DJNZ R2,LOOP ;
JNC NEXT ;
MOV @R0,#01H ; 23H=01H
SJMP $
NEXT: DEC R0 ;
SJMP $
結果:(20H)=10H ,(21H)=F0H ,(22H)=16H ,(23H)=01H ,(A)=16H ,(CY)=1 .
分析過程參照注釋