《单片机》读程序题题库答案1

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

四、阅读下列程序,注释并填写指令执行后的结果(每题10分)
1、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START:MOV R0,#20H ;#20H->R0 (R0)=20H
MOV R1,#30H ; #30H->R1 (R1)=30H
MOV A,R0 ;(R0)->A (A)=20H
ADD A,#36H ;(A)+#36H->A (A)=56H
MOV P1,A ;(A)->P1 (P1)=56H
INC R0 ;(R0)+1->R0 (R0)=21H
INC R1 ;(R1)+1->R0 (R1)=31H
ANL A,R1 ;(A)&(R1)->A (A)=10H
SWAP A ;累加器A的高低4位交换 (A)=01H
PUSH ACC ;累加器A内容压栈
MOV P1,A ;(A)->P1 (P1)=01H
POP B ;堆栈内容出栈到B寄存器 (B)=01H
MOV R0,A ;(A)->R0 (R0)=01H
MOV DPTR,#2200H ;#2200H->DPTR (DPTR)=2200H
SETB C ;1->Cy (Cy)=1
ADDC A,#0 ;(A)+0+(Cy)->A (A)=02H
MOVX @DPTR,A ;(A)->(DPTR) (2200H)=02H
END
(R0)= 01H (R1)= 31H (P1)= 01H
(B)= 01H (2200H)= 02H
2、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START:MOV SP,#50H ;#50H->SP (SP)=50H
第1页共57页
MOV R2,#10H ;#10H->R2 (R2)=10H
MOV DPTR,#3000H ;#3000H->DPTR (DPTR)=3000H
CRL A ;0->A (A)=0
LOOP: MOVX @DPTR,A ;(A)->(DPTR)
INC DPTR ;(DPTR)+1->DPTR
DJNZ R2,LOOP ;(R2)-1->R2 若(R2)不等于零则转移到LOOP处
INC DPH ;(DPH)+1->DPH (DPH)=31H (R2)=00H (DPL)=10H INC DPH ;(DPH)+1->DPH (DPH)=32H
MOV 20H,#36H ;#36H->(20H) (20H)=36H
SETB 00H ;位地址00H置1 20H.0=1 (20H)=37H
MOV A,20H ;(20H)->A (A)=37H
MOVX @DPTR,A ;(A)->(DPTR) (DPTR)=3210H (3210H)=37H
INC A ;(A)+1->A (A)=38H
INC A ;(A)+1->A (A)=39H
PUSH ACC ;累加器A内容压栈 (SP)=51H
XCH A,R2 ;累加器A的内容与R2内容互换 (A)=00H (R2)=39H POP DPH ;堆栈内容弹到DPH (DPH)=39H
ADD A,#55H ;(A)+#55H->A (A)=55H
PUSH ACC ;累加器A内容压栈
END
(A)= 55H (R2)= 39H (20H)= 37H (DPTR)= 3910H (SP)= 51H
3、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START:MOV R0,#30H ;#30H->R0 (R0)=30H
MOV A,#12H ;#12H->A (A)=12H
SETB C ;(Cy)=1
ADDC A,R0 ;(A)+(R0)+Cy->A (A)=43H
MOV @R0,A ;(A)->(R0) (30H)=43H
第2页共57页
SWAP A ;累加器A高低4位交换 (A)=34H
INC A ;(A)+1->A (A)=35H
MOV DPTR,#2000H ;#2000H->DPTR (DPTR)=2000H
INC DPH ;(DPH)+1->DPH (DPH)=21H
MOV P1,A ;(A)->P1 (P1)=35H
INC A ;(A)+1->A (A)=36H
MOVX @DPTR,A ;(A)->(DPTR) (2100H)=36H
XCH A,R0 ; (A) R0 (A)=30H (R0)=36H
RL A ;累加器A内容循环左移 (A)=60H
PUSH ACC ;累加器A的内容入栈
RL A ;累加器A内容循环左移 (A)=0C0H
POP ACC ;堆栈内容弹出到累加器A (A)=60H
END
(A)= 60H (R0)= 36H (DPTR)= 2100H
(P1)= 35H (30H)= 43H
4、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV SP,#50H ;#50H->SP (SP)=50H
MOV DPTR,#3000H ;#3000H->DPTR (DPTR)=3000H
MOV R0,#20H ;#20H->R0 (R0)=20H
MOV A,#23H ;#23H->A (A)=23H
MOV R2,#0FH ;#0FH->R2 (R2)=0FH
SETB 01H ;置位20H.1 (20H.1)=1
SETB C ;置位Cy (Cy)=1
ADDC A,@R0 ;(A)+((R0))+Cy->A (A)=26H
INC R0 ;(R0)+1->R0 (R0)=21H
MOV @R0,A ;(A)->((R0)) (21H)=26H
LOOP: DJNZ R2, LOOP ;(R2)-1->R2 若R2内容不等于零则转移 SWAP A ;累加器A内容的高低4位交换 (A)=62H PUSH ACC ;累加器A内容入栈
INC DPH ;(DPH)+1->DPH (DPH)=31H
MOVX @DPTR,A ;(A)->(DPTR) (3100H)=62H
第3页共57页
POP B ;堆栈内容弹出到B (B)=62H
RR A ;累加器A内容循环右移 (A)=31H
ADD A,B ;(A)+(B)->A (A)=93H
MOV P1,A ;(A)->P1 (P1)=93H
END
(21H)= 26H (R2)= 00H (A)= 93H (B)= 62H (3100H)= 62H
5、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV DPTR,#1000H ;#1000H->DPTR (DPTR)=1000H
MOV A,#13H ;#13H->A (A)=13H
MOV R0,#20H ;#20H->R0 (R0)=20H
SETB C ;1->Cy (Cy)=1
MOV @R0,A ;(A)->((R0)) (20H)=13H
RLC A ;累加器A的内容带进位循环左移 (A)=27H
XCH A,@R0 ;累加器A的内容与20H单元的内容互换 (A)=13H (20H)=27H PUSH ACC ;累加器A的内容入栈
POP DPL ;堆栈内容弹出到DPL (DPL)=13H
MOVX @DPTR,A ;(A)->(DPTR) (1013H)=13H
DEC A ;(A)-1->A (A)=12H
PUSH DPH ;DPH内容压栈
POP B ;堆栈内容弹出到B (B)=10H
ADD A,B ;(A)+(B)->A (A)=22H
MOV P1,A ;(A)->P1 (P1)=22H
CLR A ;累加器A内容清零
ADD A,B ;(A)+(B)->A (A)=10H
END
(P1)= 22H (B)= 10H (20H)= 27H (DPTR)= 1013H (R0)= 20H
6、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START:MOV SP,#50H ;#50H->SP (SP)=50H
MOV R0,#20H ;#20H->R0 (R0)=20H
第4页共57页
MOV R2,#10H ;#10H->R2 (R2)=10H
MOV A,#24H ;#24H->A (A)=24H
LOOP: MOV @R0,A ;(A)->((R0))
INC R0 ;(R0)+1->R0
DJNZ R2,LOOP ;(R2)-1->R2 若R2内容不等于0则跳转到LOOP处
SETB 00H ;1->位地址为00H的位 (20H.0)=1 (20H)=25H
SETB C ;1->Cy (Cy)=1
ADDC A,#00H ;(A)+00H+(Cy)->A (A)=25H
SWAP A ;累加器A内容高低四位互换 (A)=52H
PUSH ACC ;累加器A内容压栈
POP DPH ;堆栈内容弹出到DPH (DPH)=52H
PUSH ACC ;累加器A内容压栈
POP B ;堆栈内容弹出到B (B)=52H
MOV A,R2 ;(R2)->A (A)=00H
MOV DPL,A ;(A)->DPL (DPL)=00H
MOV A,B ; (B)->A (A)=52H
PUSH ACC ;累加器A内容压栈 (SP)=51H
END
(A)= 52H (R2)= 00H (20H)= 25H (DPTR)= 5200H (SP)= 51H
7、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV DPTR,#2100H ;#2100H->DPTR (DPTR)=2100H
CLR A ;0->A (A)=00H
MOV R1,#30H ;#30H->R1 (R1)=30H
SETB C ;1->Cy (Cy)=1
ADDC A,R1 ;(A)+(R1)+Cy->A (A)=31H
MOV @R1,A ;(A)->((R1)) (30H)=31H
PUSH ACC ;累加器A的内容压栈
POP DPL ;堆栈内容弹出到DPL (DPL)=31H
RR A ;累加器A的内容循环右移 (A)=98H
MOV R0,A ;(A)->R0 (R0)=98H
ORL A,#24H ;(A) or 24H->A (A)=0BCH
MOV P1,A ;(A)->P1 (P1)=0BCH
第5页共57页
SWAP A ;累加器A的内容高低四位交换 (A)=0CBH
MOV DPH,A ;(A)->DPH (DPH)=0CBH
MOV B,#02H ;#02H->B (B)=02H
ADD A,B ;(A)+(B)->A (A)=0CDH
CLR ACC.3 ;0->ACC.3 (A)=0C5H
SWAP A ;累加器A的内容高低四位交换 (A)=5CH
END
(A)= 5CH (R0)= 98H (DPTR)= 0CB31H (P1)= 0BCH (30H)= 31H
8、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV SP,#50H ;#50H->SP (SP)=50H
MOV R3,#10H ;#10H->R3 (R3)=10H
CLR A ;累加器A内容清零 (A)=00H
MOV R0,#20H ;#20H->R0 (R0)=20H
LOOP: MOV @R0,A ;(A)->((R0)) (20H)=00H
INC R0 ;(R0)+1->R0 (20H)=01H
DJNZ R3,LOOP ;(R3)-1->R3 若R3不等于零则跳转到LOOP处
SETB 00H ;1->位地址00H位 (20H.0)=1 (20H)=01H
SETB C ;1->Cy (Cy)=1
SUBB A,#00H ;(A)-00H-Cy->A (A)=0FFH
MOV DPL,A ;(A)->DPL (DPL)=0FFH
PUSH ACC ;累加器A的内容压栈
MOV A,R3 ;(R3)->A (A)=00H
MOV DPH,A ;(A)->DPH (DPH)=00H
POP ACC ;堆栈内容弹出到A (A)=0FFH
MOVX @DPTR,A ;(A)->(DPTR) (00FFH)=0FFH
ANL A,#55H ;(A) and 55H->A (A)=55H
PUSH ACC ;累加器A的内容压栈 (SP)=51H
CLR A ;累加器A内容清零 (A)=00H
END
(A)= 00H (R3)= 00H (20H)= 01H (DPTR)= 00FFH (SP)= 51H
第6页共57页
9、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV R0,#30H ;#30H->R0 (R0)=30H
MOV R1,#20H ; #20H->R1 (R1)=20H
MOV A,R0 ;(R0)->A (A)=30H
ADD A,#37H ;(A)+#36H->A (A)=67H
MOV P1,A ;(A)->P1 (P1)=67H
INC R0 ;(R0)+1->R0 (R0)=31H
INC R1 ;(R1)+1->R0 (R1)=21H
ANL A,R1 ;(A)&(R1)->A (A)=21H
SWAP A ;累加器A的高低4位交换 (A)=12H
PUSH ACC ;累加器A内容压栈
MOV P1,A ;(A)->P1 (P1)=12H
SWAP A ;累加器A的高低4位交换 (A)=21H
POP B ;堆栈内容出栈到B寄存器 (B)=12H
MOV R0,A ;(A)->R0 (R0)=21H
MOV DPTR,#2200H ;#2200H->DPTR (DPTR)=2200H
SETB C ;1->Cy (Cy)=1
ADDC A,B ;(A)+(B)+(Cy)->A (A)=34H
MOVX @DPTR,A ;(A)->(DPTR) (2200H)=34H
END
(R0)= 21H (R1)= 21H (P1)= 12H (B)= 12H (2200H)= 34H
10、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV SP,#50H ;#50H->SP (SP)=50H
MOV R2,#20H ;#20H->R2 (R2)=20H
MOV DPTR,#3000H ;#3000H->DPTR (DPTR)=3000H
CLR A ;0->A (A)=0
LOOP: MOVX @DPTR,A ;(A)->(DPTR)
INC DPTR ;(DPTR)+1->DPTR
DJNZ R2,LOOP;(R2)-1->R2 若(R2)不等于零则转移到LOOP处
INC DPH ;(DPH)+1->DPH (DPH)=31H (R2)=00H (DPL)=20H
第7页共57页
INC DPH ;(DPH)+1->DPH (DPH)=32H
MOV 20H,#38H ;#36H->(20H) (20H)=38H
SETB 01H ;位地址01H置1 20H.1=1 (20H)=3AH
MOV A,20H ;(20H)->A (A)=3AH
MOVX @DPTR,A ;(A)->(DPTR) (DPTR)=3220H (3220H)=3AH
INC A ;(A)+1->A (A)=3BH
INC A ;(A)+1->A (A)=3CH
PUSH ACC ;累加器A内容压栈
XCH A,R2 ;累加器A的内容与R2内容互换 (A)=00H (R2)=3CH POP DPH ;堆栈内容弹到DPH (DPH)=3CH
ADD A,#55H ;(A)+#55H->A (A)=55H
PUSH ACC ;累加器A内容压栈,(SP)=51H
END
(A)= 55H (R2)= 3CH (20H)= 3AH (DPTR)= 3C20H (SP)= 51H
11、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV R0,#20H ;#20H->R0 (R0)=20H
MOV A,#31H ;#31H->A (A)=31H
SETB C ;(Cy)=1
ADDC A,R0 ;(A)+(R0)+Cy->A (A)=52H
MOV @R0,A ;(A)->(R0) (20H)=52H
SWAP A ;累加器A高低4位交换 (A)=25H
DEC A ;(A)-1->A (A)=24H
MOV DPTR,#2000H ;#2000H->DPTR (DPTR)=2000H
INC DPH ;(DPH)+1->DPH (DPH)=21H
DEC DPL ;(DPL)-1->DPL (DPL)=0FFH
MOV P1,A ;(A)->P1 (P1)=24H
INC A ;(A)+1->A (A)=25H
MOVX @DPTR,A ;(A)->(DPTR) (21FFH)=25H
XCH A,R0 ; (A) R0 (A)=20H (R0)=25H
RL A ;累加器A内容循环左移 (A)=40H
PUSH ACC ;累加器A的内容入栈
RL A ;累加器A内容循环左移 (A)=80H
第8页共57页
POP ACC ;堆栈内容弹出到累加器A (A)=40H
END
(A)= 40H (R0)= 25H (DPTR)= 21FFH (P1)= 24H (20H)= 52H
12、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV SP,#50H ;#50H->SP (SP)=50H
MOV DPTR,#2000H ;#3000H->DPTR (DPTR)=2000H
MOV 20H,#06H ;#06H->20H (20H)=06H
MOV R0,#20H ;#20H->R0 (R0)=20H
MOV A,#35H ;#35H->A (A)=35H
MOV R2,#10H ;#10H->R2 (R2)=10H
SETB 00H ;置位20H.0 (20H.0)=1 (20H)=07H
SETB C ;置位Cy (Cy)=1
ADDC A,@R0 ;(A)+((R0))+Cy->A (A)=3DH
INC R0 ;(R0)+1->R0 (R0)=21H
MOV @R0,A ;(A)->((R0)) (21H)=3DH
LOOP: DJNZ R2, LOOP ;(R2)-1->R2 若R2内容不等于零则转移
SWAP A ;累加器A内容的高低4位交换 (A)=0D3H
PUSH ACC ;累加器A内容入栈
INC DPH ;(DPH)+1->DPH (DPH)=21H
MOVX @DPTR,A ;(A)->(DPTR) (2100H)=0D3H
POP B ;堆栈内容弹出到B (B)=0D3H
RR A ;累加器A内容循环右移 (A)=0E9H
ADD A,B ;(A)+(B)->A (A)=0BCH
MOV P1,A ;(A)->P1 (P1)=0BCH
END
(21H)= 3DH (R2)= 00H (A)= 0BCH (B)= 0D3H (2100H)= 0D3H
13、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV DPTR,#2000H ;#2000H->DPTR (DPTR)=2000H
MOV A,#36H ;#36H->A (A)=36H
第9页共57页
MOV R0,#30H ;#30H->R0 (R0)=30H
SETB C ;1->Cy (Cy)=1
MOV @R0,A ;(A)->((R0)) (30H)=36H
RLC A ;累加器A的内容带进位循环左移 (A)=6DH
XCH A,@R0 ;累加器A的内容与20H单元的内容互换 (A)=36H (30H)=6DH PUSH ACC ;累加器A的内容入栈
POP DPL ;堆栈内容弹出到DPL (DPL)=36H
MOVX @DPTR,A ;(A)->(DPTR) (2036H)=36H
DEC A ;(A)-1->A (A)=35H
PUSH DPH ;DPH内容压栈
POP B ;堆栈内容弹出到B (B)=20H
ADD A,B ;(A)+(B)->A (A)=55H
MOV P1,A ;(A)->P1 (P1)=55H
CLR A ;累加器A内容清零
ADD A,B ;(A)+(B)->A (A)=20H
END
(P1)= 55H (B)= 20H (30H)= 6DH (DPTR)= 2036H (R0)= 30H
14、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV SP,#60H ;#60H->SP (SP)=60H
MOV R0,#20H ;#20H->R0 (R0)=20H
MOV R2,#10H ;#10H->R2 (R2)=10H
MOV A,#24H ;#24H->A (A)=24H
LOOP: MOV @R0,A ;(A)->((R0))
INC R0 ;(R0)+1->R0
DJNZ R2,LOOP ;(R2)-1->R2 若R2内容不等于0则跳转到LOOP处
SETB 01H ;1->位地址为01H的位 (20H.1)=1 (20H)=26H
SETB C ;1->Cy (Cy)=1
ADDC A,20H ;(A)+(20H)+(Cy)->A (A)=4BH
SWAP A ;累加器A内容高低四位互换 (A)=0B4H
PUSH ACC ;累加器A内容压栈
POP DPH ;堆栈内容弹出到DPH (DPH)=0B4H
PUSH ACC ;累加器A内容压栈
第10页共57页
POP B ;堆栈内容弹出到B (B)=0B4H
MOV A,R2 ;(R2)->A (A)=00H
MOV DPL,A ;(A)->DPL (DPL)=00H
ADD A,B ;(A)+(B)->A (A)=0B4H
PUSH ACC ;累加器A内容压栈 (SP)=61H
END
(A)= 0B4H (R0)= 30H (20H)= 26H (DPTR)= 0B400H (SP)= 61H
15、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV DPTR,#1100H ;#1100H->DPTR (DPTR)=1100H
CLR A ;0->A (A)=00H
MOV R1,#20H ;#20H->R1 (R1)=20H
SETB C ;1->Cy (Cy)=1
ADDC A,R1 ;(A)+(R1)+Cy->A (A)=21H
MOV @R1,A ;(A)->((R1)) (20H)=21H
INC A ;(A)+1->A (A)=22H
INC A ;(A)+1->A (A)=23H
PUSH ACC ;累加器A的内容压栈
POP DPL ;堆栈内容弹出到DPL (DPL)=23H
RR A ;累加器A的内容循环右移 (A)=91H
MOV R0,A ;(A)->R0 (R0)=91H
ORL A,#24H ;(A) or #24H->A (A)=0B5H
MOV P1,A ;(A)->P1 (P1)=0B5H
SWAP A ;累加器A的内容高低四位交换 (A)=5BH
MOV DPH,A ;(A)->DPH (DPH)=5BH
MOV B,#02H ;#02H->B (B)=02H
ADD A,B ;(A)+(B)->A (A)=5DH
CLR ACC.4 ;0->ACC.4 (A)=4DH
SWAP A ;累加器A的内容高低四位交换 (A)=0D4H
END
(A)= D4H (R0)= 91H (DPTR)= 5B23H (P1)= 0B5H (20H)= 21H
第11页共57页
16、 ORG 0
LJMP START ;跳转到(PC)=0030H处
ORG 30H
START: MOV SP,#60H ;#60H->SP (SP)=60H
MOV R3,#20H ;#20H->R3 (R3)=20H
MOV A,#20H ;#20H->A (A)=20H
MOV R0,#20H ;#20H->R0 (R0)=20H
LOOP: MOV @R0,A ;(A)->((R0))
INC R0 ;(R0)+1->R0
DJNZ R3,LOOP ;(R3)-1->R3 若R3不等于零则跳转到LOOP处
SETB 02H ;1->位地址02H位 (20H.2)=1 (20H)=24H
SETB C ;1->Cy (Cy)=1
SUBB A,20H ;(A)-(20H)-Cy->A (A)=0FBH
MOV DPL,A ;(A)->DPL (DPL)=0FBH
PUSH ACC ;累加器A的内容压栈
MOV A,R3 ;(R3)->A (A)=00H
MOV DPH,A ;(A)->DPH (DPH)=00H
POP ACC ;堆栈内容弹出到A (A)=0FBH
MOVX @DPTR,A ;(A)->(DPTR) (00FBH)=0FBH
ANL A,#55H ;(A) and 55H->A (A)=51H
PUSH ACC ;累加器A的内容压栈 (SP)=61H
SWAP A ;累加器A内容高低4位交换 (A)=15H
END
(A)= 15H (R3)= 00H (20H)= 24H (DPTR)= 00FBH (SP)= 61H
17、O RG 0
MOV R2,#8 ;#8->R2 (R2)=8H
MOV R0,#30H ;#30H->R0 (R0)=30H
CLR A ; #0->A (A)=0
CPL A ; 累加器A的内容取反,(A)=0FFH
LOOP: MOV @R0,A ; (A)-> (R0) (30H)~(37H)=0FFH
INC R0 ; (R0)+1->R0
DJNZ R2,LOOP ; (R2)-1 -> R2 , (R2)≠0则转移到LOOP处
MOV B,R2 ; (R2) ->B (B)=(R2)=0
INC B ; (B)+1 ->B (B)=1
第12页共57页
M OV A,R0 ; (R0) ->A (A)=(R0)=38H
C LR C ; 0 -> Cy Cy=0
ADDC A,B ; (A)+(B)+Cy -> A (A)=39H
MOV R0,A ; (A) ->R0 (R0)=(A)=39H
R LC A ; 累加器A的内容带进位左移,(A)=72H
MOV DPTR,#1234H ; #1234H ->DPTR (DPTR)=1234H
M OVX @DPTR,A ; (A) ->(DPTR) (1234H)=72H
SWAP A ;累加器A的内容高低4位交换,(A)=27H
PUSH ACC ; 累加器内容入栈
POP DPH ; 堆栈内容弹出到DPH (DPH)=27H
E ND
(R0)= 39H (A)= 27H
(33H)= 0FFH (DPTR)= 2734H (1234H)= 72H
评分办法:指令注释占5分,对于程序段注释部分写对的学生可酌情给1-4分;程序段执行结果每空1分,共5分。

18、 ORG 0
MOV SP,#60H ; #60H ->SP (SP)=60H
MOV DPTR,#1000H ; #1000H ->DPTR (DPTR)=1000H
MOV R0,#40H ; #40H ->R0 (R0)=40H
MOV A,#40H ; #40H ->A (A)=40H
MOV R2,#8 ; #8 ->R2 (R2)=08H
LOOP: MOV @R0,A ; (A) ->(R0) (40H)~(47H)=40H
INC R0 ; (R0)+1 ->R0
DJNZ R2,LOOP ; (R2)-1 ->R2 , (R2)≠0则转移到LOOP处
MOV R0,#40H ; #40H ->R0 (R0)=40H
MOV R2,#8 ; #8 ->R2 (R2)=08H
LOOP1: MOV A,@R0 ; ((R0))->A
INC A ; (A)+1 ->A
ANL A,#0FH ; (A) and #0FH ->A
MOVX @DPTR,A ; (A) ->(DPTR) (1000H)~(1007H)=01H
INC R0 ; (R0)+1 ->R0
第13页共57页
INC DPTR ; (DPTR)+1 ->DPTR
DJNZ R2,LOOP1 ; (R2)-1 ->R2 , (R2)≠0;则转移到LOOP1处
PUSH DPL ; DPL内容入栈 (SP)=61H
POP B ; 堆栈内容弹出到B寄存器, (B)=08H, (SP)=60H
PUSH DPH ; DPH内容压栈 (SP)=61H
POP ACC ; 堆栈内容弹出到累加器A ,(A)=10H,(SP)=60H
ADD A,B ; (A)+(B) ->A (A)=18H
PUSH B ;寄存器B内容压栈 (SP)=61H
END
(A)= 18H (B)= 08H
(42H)= 40H (1004H)= 01H (SP)= 61H
评分办法:指令注释占5分,对于程序段注释部分写对的学生可酌情给1-4分;程序段执行结果每空1分,共5分。

19、 ORG 0
MOV R0,#20H ; #20H->R0 (R0)=20H
MOV A,#40H ; #40H->A (A)=40H
SETB C ; 1->Cy Cy=1
ADDC A,R0 ; (A)+(R0)+Cy->A (A)=61H
MOV R2,#8 ; #8->R2 (R2)=08H
LOOP: MOV @R0,A ; (A)->(R0) (20H)~(27H)=61H
INC R0 ; (R0)+1->R0
DJNZ R2,LOOP ; (R2)-1->R2 (R2)≠0 则跳转到LOOP处
MOV P1,R2 ; (R2)->P1 (P1)=0
CLR 00H ; 0->20H.0 (20H)=60H
MOV A,20H ; (20H)->A (A)=60H
PUSH ACC ; 累加器A的内容入栈
POP DPH ; 弹栈到DPH (DPH)=60H
MOV A,25H ; (25H)->A (A)=61H
MOV DPL,A ; (A)->DPL (DPL)=61H
END
(20H)= 60H (22H)= 61H
(DPTR)= 6061H (P1)= 00H (R0)= 28H
评分办法:指令注释占5分,对于程序段注释部分写对的学生可酌情给1-4分;程序段执行结果每空1分,共5分。

第14页共57页
20、 ORG 0
MOV SP,#50H ; #50H->SP (SP)=50H
MOV R0,#20H ; #20H->R0 (R0)=20H
MOV B,R0 ; (R0)->B (B)=20H
MOV A,#30H ; #30H->A (A)=30H
ADD A,B ; (A)+(B)->A (A)=50H
SETB C ; 1->Cy Cy=1
RRC A ; 累加器A的内容带进位循环右移 (A)=0A8H Cy=0
MOV @R0,A ; (A)->(R0) (20H)=0A8H
SETB 00H ; 1->20H.0 (20H)=0A9H
MOV DPTR,#1000H ; #1000H->DPTR (DPTR)=1000H
MOVX @DPTR,A ; (A)->(DPTR) (1000H)=0A8H
INC DPL ; (DPL)+1->DPL (DPL)=01H (DPTR)=1001H
MOV A,@R0 ; ((R0))->A (A)=0A9H
MOVX @DPTR,A ; (A)->(DPTR) (1001H)=0A9H
SWAP A ; 累加器A的内容进行高低四位交换 (A)=9AH
ORL A,#0FH ; (A) or #0FH->A (A)=9FH
PUSH ACC ; 累加器A的内容入栈 (SP)=51H
POP DPL ; 弹栈到DPL (DPL)=9FH (DPTR)=109FH (SP)=50H
PUSH ACC ; 累加器A的内容入栈 (SP)=51H
END
(Cy)= 0 (SP)= 51H
(DPTR)= 109FH (1000H)= 0A8H (1001H)= 0A9H
评分办法:指令注释占5分,对于程序段注释部分写对的学生可酌情给1-4分;程序段执行结果每空1分,共5分。

21、 ORG 0
MOV R0,#30H ; #30H->R0 (R0)=30H
MOV R2,#8 ; #8->R2 (R2)=8
LOOP: MOV A,R2 ; (R2)->A (A)=08H
MOV @R0,A ; (A)->(30H) (30H)~(37H)=08H~01H
INC R0 ; (R0)+1->R0
DJNZ R2,LOOP ; (R2)-1->R2 若(R2)≠0 则; 跳转到LOOP处。

MOV A,30H ; (30H)->A (A)=08H
MOV B,A ; (A)->B (B)=08H
第15页共57页
MOV A,31H ; (31H)->A (A)=07H
ADD A,B ; (A)+(B)->A (A)=0FH
MOV DPTR,#1000H ; #1000H->DPTR (DPTR)=1000H
MOVX @DPTR,A ; (A)->(DPTR) (1000H)=0FH
SWAP A ; 累加器A的内容高低四位交换 (A)=0F0H
DEC DPL ; (DPL)-1->DPL (DPL)=0FFH
MOVX @DPTR,A ; (A)->(DPTR) (10FFH)=0F0H
SETB C ; 1->Cy (Cy)=1
RRC A ; 累加器A的内容带进位循环右移 (A)=0F8H
MOV R0,A ; (A)->R0 (R0)=0F8H
END
(R0)= 0F8H (Cy)= 0
(32H)= 06H (DPTR)= 10FFH (1000H)= 0FH
评分办法:指令注释占5分,对于程序段注释部分写对的学生可酌情给1-4分;程序段执行结果每空1分,共5分。

22、 ORG 0
MOV SP,#60H ; #60H->SP (SP)=60H
MOV R0,#20H ; #20H->R0 (R0)=20H
MOV R2,#8 ; #8->R2 (R2)=08H
MOV A,#0EEH ; #0EEH->A (A)=0EEH
CPL A ; 累加器A的内容取反 (A)=11H
LOOP: MOV @R0,A ; (A)->(R0) (20H)~(27H)=11H
INC R0 ; (R0)+1->R0
DJNZ R2,LOOP ; (R2)-1->R2 若(R2)≠0 则跳转到LOOP处。

MOV A,R0 ; (R0)->A (A)=28H
SETB C ; 1->Cy (Cy)=1
ADDC A,21H ; (A)+(21H)+Cy->A (A)=3AH (Cy)=0
MOV P1,A ; (A)->P1 (P1)=3AH
CLR 00H ; 0->20H.0 (20H)=10H
MOV A,20H ; (20H)->A (A)=10H
SWAP A ; 累加器内容高低四位交换 (A)=01H
PUSH ACC ; 累加器A的内容入栈 (SP)=61H
MOV DPH,#10H ; #10H->DPH (DPH)=10H
POP DPL ; 堆栈内容弹出到DPL (DPL)=01H (DPTR)=1001H (SP)=60H
MOVX @DPTR,A ; (A)->(DPTR) (1001H)=01H
第16页共57页
PUSH ACC ; 累加器A的内容入栈 (SP)=61H
END
(Cy)= 0 (P1)= 3AH
(R2)= 00H (DPTR)= 1001H (SP)= 61H
23、 ORG 0
MOV R0,#20H ; #20H->R0 (R0)=20H
MOV R2,#8 ; #8->R2 (R2)=08H
MOV A,#0F8H ; #0F8H->A (A)=0F8H
ANL A,#0FH ; (A) and #0FH->A (A)=08H
LOOP: MOV @R0,A ; (A)->(R0) (20H)~(27H)=08H
INC R0 ; (R0)+1->R0
DJNZ R2,LOOP ; (R2)-1->R2 若(R2)≠0则跳转到LOOP SETB 00H ; 1->20H.0 (20H)=09H
MOV A,20H ; (20H)->A (A)=09H
SWAP A ;累加器A的内容高低四位交换, (A)=90H
MOV P1,A ; (A)->P1 (P1)=90H
ADD A,21H ; (A)+(21H)->A (A)=98H
MOV DPTR,#1000H ; #1000H->DPTR (DPTR)=1000H
MOVX @DPTR,A ; (A)->(DPTR) (1000H)=98H
ORL A,#0FH ; (A) or #0FH->A (A)=9FH
INC DPTR ; (DPTR)+1->DPTR , (DPTR)=1001H
MOVX @DPTR,A ; (A)->(DPTR) (1001H)=9FH
DEC DPL ; (DPL)-1->DPL (DPL)=00H (DPTR)=1000H DEC DPL ; (DPL)-1->DPL (DPL)=0FFH (DPTR)=10FFH END
(R2)= 00H (P1)= 90H
(DPTR)= 10FFH (1000H)= 98H (1001H)= 9FH
24、 ORG 0
MOV SP,#60H ; #60H->SP (SP)=60H
MOV A,#88H ; #88H->A (A)=88H
CPL A ; 累加器A的内容取反 (A)=77H
ADD A,#1 ; (A)+1->A (A)=78H
第17页共57页
SETB C ; 1->Cy (Cy)=1
RRC A ; 累加器A的内容带进位循环右移 (A)=0BCH
MOV DPTR,#2000H ; #2000H->DPTR (DPTR)=2000H
MOVX @DPTR,A ; (A)->(DPTR) (2000H)=0BCH
MOV 20H,A ; (A)->20H (20H)=0BCH
SETB 00H ; 1->20H.0 (20H)=0BDH
MOV A,20H ; (20H)->A (A)=0BDH
MOV R0,#0F0H ; #0F0H->R0 (R0)=0F0H
ORL A,R0 ; (A) or (R0)->A (A)=0FDH
PUSH ACC ; 累加器A的内容入栈 (SP)=61H
POP DPL ; 堆栈内容弹出到DPL (DPL)=0FDH (SP)=60H
SWAP A ; 累加器A的内容高低四位交换 (A)=0DFH
PUSH ACC ; 累加器A的内容入栈 (SP)=61H
POP DPL ; 堆栈内容弹出到DPL (DPL)=0DFH (DPTR)=20DFH (SP)=60H INC A ; (A)+1->A (A)=0E0H
MOV P1,A ; (A)->P1 (P1)=0E0H
END
(P1)= 0E0H (20H)= 0BDH
(DPTR)= 20DFH (2000H)= 0BCH (SP)= 60H
25、O RG 0
MOV R2,#8 ; #8->R2 , (R2)=08H
M OV R0,#30H ; #30H->R0 , (R0)=30H
MOV A,#0DEH ; #0DEH->A , (A)=0DEH
CPL A ; 累加器A的内容取反,(A)=21H
MOV @R0,A ; (A)->(R0) , (30H)=21H
MOV B,R2 ; (R2)->B , (B)=08H
INC B ; (B)+1->B , (B)=09H
MOV A,R0 ; (R0)->A , (A)=30H
CLR C ; 0->Cy , (Cy)=0
ADDC A,B ; (A)+(B)->A , (A)=39H
MOV R0,A ; (A)->R0 , (R0)=39H
R LC A ; 累加器A的内容带进位循环左移 (A)=72H
M OV DPTR,#1234H ; #1234H->DPTR , (DPTR)=1234H
第18页共57页
M OVX @DPTR,A ; (A)->(DPTR) , (1234H)=72H
SWAP A ; 累加器A的内容高低4位交换 (A)=27H
END
(A)= 27H (B)= 09H
(30H)= 21H (R0)= 39H (1234H)= 72H
26、 ORG 0
MOV SP,#60H ; #60H->SP , (SP)=60H
MOV DPTR,#1000H ; #1000H->DPTR , (DPTR)=1000H
MOV R0,#40H ; #40H->R0 , (R0)=40H
MOV A,#40H ; #40H->A , (A)=40H
MOV R2,#8 ; #8->R2 , (R2)=08H
LOOP: MOV @R0,A ; (A)->(R0)
INC A ; (A)+1->A
INC R0 ; (R0)+1->R0
DJNZ R2,LOOP ; (R2)-1->R2, 若(R2)≠0则转移到LOOP处。

;(40H)~(47H)=40H~47H, (A)=48H
XCH A,41H ; 累加器A的内容与41H单元的内容交换。

(A)=41H , (41H)=48H ANL A,#0FH ; (A) and #0FH->A , (A)=01H
MOVX @DPTR,A ; (A)->(DPTR) , (1000H)=01H
PUSH DPL ; DPL内容压栈,(SP)=61H
POP B ; 堆栈内容弹出到B,(B)=00H , (SP)=60H
PUSH DPH ; DPH内容压栈,(SP)=61H
POP ACC ; 堆栈内容弹出到A,(A)=10H , (SP)=60H
ADD A,B ; (A)+(B)->A , (A)=10H
PUSH B ; 寄存器B的内容压栈,(SP)=61H
END
(A)= 10H (B)= 00H
(42H)= 42H (1000H)= 01H (SP)= 61H
27、 ORG 0
MOV R0,#20H ; #20H->R0 , (R0)=20H
MOV A,#40H ; #40H->A , (A)=40H
SETB C ; 1->Cy , Cy=1
第19页共57页
ADDC A,R0 ; (A)+(R0)+Cy->A , (A)=61H
MOV @R0,A ; (A)->(R0) (20H)=61H
MOV P1,A ; (A)->P1 , (P1)=61H
MOV A,20H ; (20H)->A , (A)=61H
PUSH ACC ; 累加器A的内容入栈
POP DPH ; 堆栈内容弹出到DPH, (DPH)=61H
MOV A,R0 ; (R0)->A , (A)=20H
MOV DPL,A ; (A)->DPL , (DPL)=20H
END
(20H)= 61H Cy= 0
(DPTR)= 6120H (P1)= 61H (R0)= 20H
28、 ORG 0
MOV SP,#70H ; #70H->SP , (SP)=70H
MOV R0,#30H ; #30H->R0 , (R0)=30H
MOV B,R0 ; (R0)->B , (B)=30H
MOV A,#30H ; #30H->A , (A)=30H
ADD A,B ; (A)+(B)->A , (A)=60H
SETB C ; 1->Cy , Cy=1
RRC A ; 累加器A的内容带进位循环右移 (A)=0B0H , Cy=0 MOV @R0,A ; (A)->(R0) , (30H)=0B0H
INC @R0 ; ((R0))+1->(R0) , (30H)=0B1H
MOV DPTR,#1000H ; #1000H->DPTR , (DPTR)=1000H
MOVX @DPTR,A ; (A)->(DPTR) , (1000H)=0B0H
INC DPL ; (DPL)+1->DPL , (DPL)=01H
MOV A,@R0 ; ((R0))->A , (A)=0B1H
MOVX @DPTR,A ; (A)->(DPTR) , (1001H)=0B1H
SWAP A ; 累加器A的内容高低4位交换 (A)=1BH
ORL A,#0FH ; (A) or #0FH->A , (A)=1FH
PUSH ACC ; 累加器A的内容入栈,(SP)=71H
END
(A)= 1FH (SP)= 71H
第20页共57页
Cy= 0 (1000H)= 0B0H (1001H)= 0B1H
29、 ORG 0
MOV R0,#30H ; #30H->R0 , (R0)=30H
MOV R2,#8 ; #8->R2 , (R2)=08H
MOV A,R2 ; (R2)->A , (A)=08H
MOV @R0,A ; (A)->(R0) , (30H)=08H
MOV A,R0 ; (R0)->A , (A)=30H
MOV B,A ; (A)->B , (B)=30H
ADD A,B ; (A)+(B)->A , (A)=60H
MOV DPTR,#1000H ; #1000H->DPTR , (DPTR)=1000H
MOVX @DPTR,A ; (A)->(DPTR) , (1000H)=60H
SWAP A ; 累加器A内容高低四位交换 (A)=06H
DEC DPL ; (DPL)-1->DPL , (DPL)=0FFH (DPTR)=10FFH MOVX @DPTR,A ; (A)->(DPTR) , (10FFH)=06H
SETB C ; 1->Cy , Cy=1
RRC A ; 累加器A内容带进位循环右移 (A)=83H , Cy=0 MOV R0,A ; (A)->R0 , (R0)=83H
END
(R0)= 83H Cy= 0
(30H)= 08H (DPTR)= 10FFH (1000H)= 60H
30、 ORG 0
MOV SP,#60H ; #60H->SP , (SP)=60H
MOV R0,#30H ; #30H->R0 , (R0)=30H
MOV R2,#8 ; #8->R2 , (R2)=08H
MOV A,#0EEH ; #0EEH->A , (A)=0EEH
CPL A ; 累加器A的内容取反,(A)=11H LOOP: MOV @R0,A ; (A)->(R0)
INC R0 ; (R0)+1->R0
INC A ; (A)+1->A
第21页共57页
DJNZ R2,LOOP ; (R2)-1->R2, 若(R2)≠0则跳转
; 执行完后,(R2)=0 , (R0)=38H , (30H)~(37H)=11H~18H MOV A,R0 ; (R0)->A , (A)=38H
MOV P1,A ; (A)->P1 , (P1)=38H
ADD A,#10H ; (A)+#10H->A , (A)=48H
XCH A,R2 ; 累加器A的内容与R2的内容交换
; (A)=00H , (R2)=48H
PUSH ACC ; 累加器A内容压栈,(SP)=61H
MOV DPH,#10H ; #10H->DPH , (DPH)=10H
POP DPL ; 弹栈到DPL , (DPL)=00H , (SP)=60H
MOVX @DPTR,A ; (A)->(DPTR) , (1000H)=00H
PUSH ACC ; 累加器A内容压栈,(SP)=61H
END
(A)= 00H (P1)= 38H
(R2)= 48H (DPTR)= 1000H (SP)= 61H
31、 ORG 0
MOV R0,#20H ; #20H->R0 , (R0)=20H
MOV R2,#8 ; #8->R2 , (R2)=08H
MOV A,#0F9H ; #0F9H->A , (A)=0F9H
ANL A,#0FH ; (A) and #0FH->A , (A)=09H
MOV @R0,A ; (A)->(R0) , (20H)=09H
MOV A,20H ; (20H)->A , (A)=09H
SWAP A ; 累加器A的内容高低4位交换, (A)=90H
MOV P1,A ; (A)->P1 , (P1)=90H
ADD A,R2 ; (A)+(R2)->A , (A)=98H
MOV DPTR,#1100H ; #1100H->DPTR , (DPTR)=1100H
MOVX @DPTR,A ; (A)->(DPTR) , (1100H)=98H
ORL A,#0FH ; (A) or #0FH->A , (A)=9FH
INC DPTR ; (DPTR)+1->DPTR , (DPTR)=1101H
MOVX @DPTR,A ; (A)->(DPTR) , (1101H)=9FH
DEC DPL ; (DPL)-1->DPL , (DPL)=00H
DEC DPL ; (DPL)-1->DPL , (DPL)=0FFH, (DPTR)=11FFH
END
第22页共57页
(20H)= 09H (P1)= 90H
(DPTR)= 11FFH (1100H)= 98H (1101H)= 9FH
32、 ORG 0
MOV SP,#60H ; #60H->SP , (SP)=60H
MOV A,#88H ; #88H->A , (A)=88H
CPL A ; 累加器A的内容取反,(A)=77H
ADD A,#1 ; (A)+#1->A , (A)=78H
SETB C ; 1->Cy , Cy=1
RRC A ; 累加器A的内容带进位循环右移, (A)=0BCH , Cy=0
MOV DPTR,#1200H ; #1200H->DPTR , (DPTR)=1200H
MOVX @DPTR,A ; (A)->(DPTR) , (1200H)=0BCH
MOV R2,#8 ; #8->R2 , (R2)=08H
DJNZ R2,$ ; (R2)-1->R2 , 若(R2)≠0则转移。

该指令执行完时,(R2) =0 ADD A,R2 ; (A)+(R2)->A , (A)=0BCH
ORL A, #0F0H ; (A) or #0F0H->A , (A)=0FCH
PUSH ACC ; 累加器A的内容压栈,(SP)=61H
POP DPL ; 弹栈到DPL,(DPL)=0FCH,(SP)=60H
INC A ; (A)+1->A , (A)=0FDH
MOV P1,A ; (A)->P1 , (P1)=0FDH
END
(P1)= 0FDH (R2)= 00H
(DPTR)= 12FCH (1200H)= 0BCH (SP)= 60H
33、 ORG 0
LJMP START ; 跳转到START处
ORG 30H
START: MOV R0,#30H ; #30H→R0,(R0)=30H
MOV R1,#20H ; #20H→R1,(R1)=20H
第23页共57页
MOV A,R0 ; (R0)→A,(A)=30H
ADD A,#37H ; (A)+#37H→A,(A)=67H
MOV P1,A ; (A)→P1,(P1)=67H
INC R0 ; (R0)+1→R0,(R0)=31H
INC R1 ; (R1)+1→R1,(R1)=21H
XCH A,R1 ; A与R1的内容交换,(A)=21H,(R1)=67H
SWAP A ; 累加器内容高低4位交换,(A)=12H
PUSH ACC ; 累加器内容入栈
MOV P1,A ; (A)→P1,(P1)=12H
SWAP A ; 累加器内容高低4位交换,(A)=21H
MOV R0,A ; (A)→R0,(R0)=21H
MOV DPTR,#2200H ; #2200H→DPTR,(DPTR)=2200H
SETB C ; 1→Cy,(Cy)=1
ADDC A,R1 ; (A)+(R1)+Cy→A,(A)=89H
POP DPL ; 堆栈内容弹出到DPL,(DPTR)=2212H
MOVX @DPTR,A ; (A)→(DPTR),(2212H)=89H
END
(R0)= 21H (R1)= 67H (P1)= 12H (A)= 89H (DPTR)= 2212H
34、 ORG 0
LJMP START ; 跳转到START处
ORG 30H
START: MOV SP,#50H ; #50H→SP,(SP)=50H
MOV R2,#10H ; #10H→R2,(R2)=10H
MOV DPTR,#2000H ; #2000H→DPTR,(DPTR)=2000H
CLR A ; 0→A,(A)=0
LOOP: MOVX @DPTR,A ; (A)→(DPTR)
INC DPTR ; (DPTR)+1→DPTR
DJNZ R2,LOOP ; (R2)-1→R2,(R2)≠0则跳转到LOOP处
INC DPH ; (DPH)+1→DPH
INC DPH ; (DPH)+1→DPH,(DPH)=22H
MOV 20H,#38H ; #38H→20H,(20H)=38H
SETB 02H ; 1→20H.2,(20H)=3CH
第24页共57页
MOV A,20H ; (20H)→A,(A)=3CH
MOVX @DPTR,A ; (A)→(DPTR),(DPTR)=2210H,(2210H)=3CH
INC A ; (A)+1→A,(A)=3DH
INC A ; (A)+1→A,(A)=3EH
PUSH ACC ; 累加器内容入栈,(SP)=51H
ORL A,R2 ; (A)or(R2)→A,(A)=3EH
POP DPH ; 堆栈内容弹出到DPH,(DPH)=3EH,(SP)=50H
ADD A,#67H ; (A)+#67H→A,(A)=0A5H
PUSH ACC ; 累加器内容入栈,(SP)=51H
END
(A)= 0A5H (R2)= 0 (20H)= 3CH (DPTR)= 3E10H (SP)= 51H
35、 ORG 0
LJMP START ; 跳转到START处
ORG 30H
START: MOV DPTR,#2100H ; #2100H→DPTR,(DPTR)=2100H
CLR A ; 0→A,(A)=0
MOV R1,#30H ; #30H→R1,(R1)=30H
SETB C ; 1→Cy,(Cy)=1
ADDC A,R1 ; (A)+(R1)+Cy→A,(A)=31H
MOV @R1,A ; (A)→(R1),(30H)=31H
PUSH ACC ; 累加器内容入栈
POP DPL ; 堆栈弹出到DPL,(DPL)=31H
RLC A ; 累加器内容带进位循环左移,(A)=62H
MOV R0,A ; (A)→R0,(R0)=62H
ANL A,#3CH ; (A)and #3CH→A,(A)=20H
MOV P1,A ; (A)→P1,(P1)=20H
SWAP A ; 累加器内容高低4位交换,(A)=02H
MOV DPH,A ; (A)→DPH,(DPH)=02H
MOV B,#02H ; #02H→B,(B)=02H
ADD A,B ; (A)+(B)→A,(A)=04H
CLR ACC.3 ; 0→ACC.3,(A)=04H
SWAP A ; 累加器内容高低4位交换,(A)=40H
第25页共57页
END
(A)= 40H (R0)= 62H (DPTR)= 0231H (P1)= 20H (30H)= 31H
36、 ORG 0
LJMP START ; 跳转到START处
ORG 30H
START: MOV SP,#50H ; #50H→SP,(SP)=50H
MOV R3,#20H ; #20H→R3,(R3)=20H
CLR A ; 0→A,(A)=0
MOV R0,#20H ; #20H→R0,(R0)=20H
LOOP: MOV @R0,A ; (A)→(R0),此循环执行完(20H)~(3FH)=0~1FH (20H)=00H INC A ; (A)+1→A
INC R0 ; (R0)+1→R0
DJNZ R3,LOOP ; (R3)-1→R3,若(R3)≠0则转移
SETB 07H ; 1→20H.7,(20H)=80H,(A)=20H
SETB C ; 1→Cy,(Cy)=1
SUBB A,#00H ; (A)-#00H-Cy→A,(A)=1FH
MOV DPL,A ; (A)→DPL,(DPL)=1FH
PUSH ACC ; 累加器内容压栈,(SP)=51H
MOV A,R3 ; (R3)→A,(A)=0
MOV DPH,A ; (A)→DPH,(DPH)=0
POP ACC ; 堆栈内容弹出到A,(A)=1FH,(SP)=50H
MOVX @DPTR,A ; (A)→(DPTR),(001FH)=1FH
ORL A,#55H ; (A)or #55H→A,(A)=5FH
PUSH ACC ; 累加器内容压栈,(SP)=51H
XRL A,#0 ; (A)○+ #0 →A,(A)=5FH
END
(A)= 5FH (R3)= 00H (20H)= 80H (DPTR)= 001FH (SP)= 51H
37、 ORG 0
MOV R0,#20H ; R0←#20H , (R0)=20H
第26页共57页。

相关文档
最新文档