单片机编程综合题:编程将片外RAM2000H起始的连续256字节数拷贝到4000h起始的单元中

2024-12-12 07:56:26
推荐回答(2个)
回答1:

ORG 0000H
MOV DPTR,#2000H
MOV R7,#0
LOOP:
MOVX A,@DPTR
PUSH ACC
MOV A,DPH
ADD A,#20H
MOV DPH,A
POP ACC
MOVX @DPTR,A
MOV A,DPH
CLR C
SUBB A,#20H
MOV DPH,A
INC DPTR
DJNZ R7,LOOP
SJMP $
END

回答2:

mov dptr,#2000h
loop:
movx a,@dptr
mov dph,#40h
movx @dptr,a
mov dph,#20h
inc dptr
mov a,dpl
jnz loop

end