已知(A)=7AH,(R0)=30H,(30H)=A5H,PSW=80H。问执行(单独执行)以下各指令的结果
XCH A,R0; A=30H, R0=7AH
XCH A,30H; A=A5H
XCH A,@R0; A=A5H
XCHD A,@R0; A=75H ;二者低4位互换
SWAP A; A =A7H; A高低4位互换
ADD A, R0; A = AAH, Cy=0, OV=1(a6 a7 =1)
ADD A,30H; A= 1FH, Cy=1, OV=0
ADD A, A,#30H; A= AAH, Cy=0, OV=1;
ADDC A,30H; A= 20H, Cy=1, OV=0; 因为PSW的Cy=1
SUBB A,30H; A= D4H, Cy=1, OV=1; 因为PSW的Cy=1
SUBB A,#30H; A= 49H, Cy=0, OV=0; 因为PSW的Cy=1
已知(A)=83H,(R0)=17H,(17H)=34H。执行以下指令后A=
ANL A,#17H ; 逻辑与 (A)=03H
ORL 17H,A ;逻辑或 (17H)=37H
XRL A,@R0 ; 异或(A)=34H
CPL A ; 取反 (A)= CBH
将内部RAM20H、21H、22H,连续三个单元的内容以此放入
2FH、2DH、2EH单元
MOV R0, #20H
MOV R1, #2FH
LOOP : MOV A, @R0
MOV @R1, A
INC R0
DEC R1
CJNE R0, #23H, LOOP
SJMP $
外部数据RAM在2000H~2100H区域有一个数据块,将他们移动到3000H~3100H区域
解一:
MOV DPTR, #2000H
MOV P2, #30H
MOV R1, #00H
LOOP : MOVX A, @DPTR
MOV X @R1, A
INC DPTR
INC R1
CJNE R1, #00H, LOOP
INC P2
MOV X A, @DPTR
MOVX @R1, A
解二:
MOV DPTR, #2000H
MOV P2, #30H
MOV R1, #00H
LOOP : MOV X A, @DPTR
MOV X @R1, A
INC DPTR
INC R1
CJNE R1, #00H, LOOP
INC P2
MOV A, DPH
CJNE A,#21H,NEXT
NEXT1: MOVX A, @DPTR
MOVX @R1, A
SJMP $
NEXT: INC DPTR
SJMP NEXT1
解三:
MOV DPTR, #2000H
MOV R5, #00H
MOV A, #00H
MOV R1,A
LOOP : MOV A,R1
MOV X A, @A+DPTR
MOV X @R0, A
MOV DPTR, #3000H
MOV A, @R0
MOVX @A+DPTR, A
INC R1
DJNZ R5, LOOP
MOV DPTR, #2100H
MOVX A, @DPTR
MOV DPTR, #3100H
MOVX @DPTR,A
外部数据RAM从2000H开始有100个数据块,将他们移动到2030开始的单元
解一:
MOV DPTR, #2000H MOV R4,#64H
MOV P2, #10H LOOP1: MOVX A, @R1
MOV R1, #00H MOVX @DPTR, A
MOV R4,#64H INC R1
LOOP : MOVX A, @DPTR INC DPTR
MOV X @R1, A DJNZ R4, 64H, LOOP1
INC DPTR
INC R1
DJNZ R4, 64H, LOOP
MOV DPTR, #2030Hunion是什么类型
MOV P2, #10H
MOV R1, #00H
解二:
MOV DPTR, #2000H MOV R3,#64H
MOV P2, #10H DJNZ R3, LOOP
NEXT: MOV R1, #00H SJMP $
MOV R4,#64H
LOOP : MOVX A, @DPTR
MOVX @R1, A
INC DPTR
INC R1
NEXT1: DJNZ R4, LOOP
LOOP1: MOV DPTR, #1000H
MOV P2, #20H
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论