将片内30H~40H及片外0010H~0100H清零,然后将片内41H~47H的内容移到片外0041H~0047H,判断
1、若(0041H)<15,则求平方存放到0050H中,并将位00H置1
2、若(0041H)=15,则加15存放到0050H中,并将位01H置1
3、若(0041H)>15,则减15存放到0050H中,并将位02H置1
汇编程序:
ORG 0000H;设置初始地址
MOV R0,#30H;对片内30H~40H清零
MOV R1,#11H
CLR A
CON1:MOV @R0,A
INC R0
DJNZ R1,CON1
MOV DPTR,#0010H;对片外0010H~0100H清零
MOV R1,#0F1H
CLR A
CON2:MOVX @DPTR,A
INC DPTR
DJNZ R1,CON2
MOV R1,#07H;移动内容
MOV R0,#41H
MOV DPTR,#0041H
LOOP:MOV A,@R0
MOVX @DPTR,A
INC R0
INC DPTR
DJNZ R1,LOOP
MOV DPTR,#0041H
MOVX A,@DPTR
CJNE A,#0FH,NEXT1;不相等跳转
ADD A,#0FH;相等情况
MOV DPTR,#0050H
MOVX @DPTR,A
SETB 01H
CLR 00H
CLR 02H
SJMP OUT
NEXT1:JC NEXT2;<跳转
SUBB A,#0FH;>情况
MOV DPTR,#0050H
MOVX @DPTR,A
SETB 02H
CLR 00H
CLR 01H
SJMP OUT
NEXT2:MOV B,A;<情况
MUL AB
MOV DPTR,#0050H
MOVX @DPTR,A
SETB 00H
CLR 01H
CLR 02H
OUT:SJMP $