将片内50H~5FH及片外0010H~004FH单元清0;然后将片内30H~3FH的数据移到片外0000H~000FH中;判断:若(30H)≤15,则求其平方存到40H中,并将位00H置1若(30H)=15, 则加15存到40H中,并位01H置1若(30H)≥15, 则减15存到40H中,并位02H置1
源码如下:
<asm>
org 0000h
;;;;50h-5fh clear begin
mov r0,#0fh
mov r1,#50h
clr a
Clear1:
mov @r1, a
inc r1
djnz r0,Clear1
;;;;10h-4fh clear begin
mov r0, #3fh
mov dptr,#10h
clr a
Clear2:
movx @dptr, a
inc dptr
djnz r0, Clear