2023年單片機讀程序題題庫答案_第1頁
2023年單片機讀程序題題庫答案_第2頁
2023年單片機讀程序題題庫答案_第3頁
2023年單片機讀程序題題庫答案_第4頁
2023年單片機讀程序題題庫答案_第5頁
已閱讀5頁,還剩83頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

四、閱讀下列程序,注釋并填寫指令執(zhí)行后旳成果(每題10分)1、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVR0,#20H;#20H->R0(R0)=20HMOVR1,#30H;#30H->R1(R1)=30HMOVA,R0;(R0)->A(A)=20HADDA,#36H;(A)+#36H->A(A)=56HMOVP1,A;(A)->P1(P1)=56HINCR0;(R0)+1->R0(R0)=21HINCR1;(R1)+1->R0(R1)=31HANLA,R1;(A)&(R1)->A(A)=10HSWAPA;累加器A旳高下4位互換(A)=01HPUSHACC;累加器A內容壓棧MOVP1,A;(A)->P1(P1)=01HPOPB;堆棧內容出棧到B寄存器(B)=01HMOVR0,A;(A)->R0(R0)=01HMOVDPTR,#2200H;#2200H->DPTR(DPTR)=2200HSETBC;1->Cy(Cy)=1ADDCA,#0;(A)+0+(Cy)->A(A)=02HMOVX@DPTR,A;(A)->(DPTR)(2200H)=02HEND(R0)=01H(R1)=31H(P1)=01H(B)=01H(2200H)=02H2、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVR2,#10H;#10H->R2(R2)=10HMOV DPTR,#3000H;#3000H->DPTR(DPTR)=3000HCRLA;0->A(A)=0LOOP:MOVX@DPTR,A;(A)->(DPTR)INCDPTR;(DPTR)+1->DPTRDJNZR2,LOOP;(R2)-1->R2若(R2)不等于零則轉移到LOOP處INCDPH;(DPH)+1->DPH(DPH)=31H(R2)=00H(DPL)=10HINCDPH;(DPH)+1->DPH(DPH)=32HMOV20H,#36H;#36H->(20H)(20H)=36HSETB00H;位地址00H置120H.0=1(20H)=37HMOVA,20H;(20H)->A(A)=37HMOVX@DPTR,A;(A)->(DPTR)(DPTR)=3210H(3210H)=37HINCA;(A)+1->A(A)=38HINCA;(A)+1->A(A)=39HPUSHACC;累加器A內容壓棧(SP)=51HXCHA,R2;累加器A旳內容與R2內容互換(A)=00H(R2)=39HPOPDPH;堆棧內容彈到DPH(DPH)=39HADDA,#55H;(A)+#55H->A(A)=55HPUSHACC;累加器A內容壓棧END(A)=55H(R2)=39H(20H)=37H(DPTR)=3910H(SP)=51H3、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVR0,#30H;#30H->R0(R0)=30HMOVA,#12H;#12H->A(A)=12HSETBC;(Cy)=1ADDCA,R0;(A)+(R0)+Cy->A(A)=43HMOV@R0,A;(A)->(R0)(30H)=43HSWAPA;累加器A高下4位互換(A)=34HINCA;(A)+1->A(A)=35HMOVDPTR,#2023H;#2023H->DPTR(DPTR)=2023HINCDPH;(DPH)+1->DPH(DPH)=21HMOVP1,A;(A)->P1(P1)=35HINCA;(A)+1->A(A)=36HMOVX@DPTR,A;(A)->(DPTR)(2100H)=36HXCHA,R0;(A)R0(A)=30H(R0)=36HRLA;累加器A內容循環(huán)左移(A)=60HPUSHACC;累加器A旳內容入棧RLA;累加器A內容循環(huán)左移(A)=0C0HPOPACC;堆棧內容彈出到累加器A(A)=60HEND(A)=60H(R0)=36H(DPTR)=2100H(P1)=35H(30H)=43H4、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVDPTR,#3000H;#3000H->DPTR(DPTR)=3000HMOVR0,#20H;#20H->R0(R0)=20HMOVA,#23H;#23H->A(A)=23HMOVR2,#0FH;#0FH->R2(R2)=0FHSETB01H;置位20H.1(20H.1)=1SETBC;置位Cy(Cy)=1ADDCA,@R0;(A)+((R0))+Cy->A(A)=26HINCR0;(R0)+1->R0(R0)=21HMOV@R0,A;(A)->((R0))(21H)=26HLOOP:DJNZR2,LOOP;(R2)-1->R2若R2內容不等于零則轉移SWAPA;累加器A內容旳高下4位互換(A)=62HPUSHACC;累加器A內容入棧INCDPH;(DPH)+1->DPH(DPH)=31HMOVX@DPTR,A;(A)->(DPTR)(3100H)=62HPOPB;堆棧內容彈出到B(B)=62HRRA;累加器A內容循環(huán)右移(A)=31HADDA,B;(A)+(B)->A(A)=93HMOVP1,A;(A)->P1(P1)=93HEND(21H)=26H(R2)=00H(A)=93H(B)=62H(3100H)=62H5、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVDPTR,#1000H;#1000H->DPTR(DPTR)=1000HMOVA,#13H;#13H->A(A)=13HMOVR0,#20H;#20H->R0(R0)=20HSETBC;1->Cy(Cy)=1MOV@R0,A;(A)->((R0))(20H)=13HRLCA;累加器A旳內容帶進位循環(huán)左移(A)=27HXCHA,@R0;累加器A旳內容與20H單元旳內容互換(A)=13H(20H)=27HPUSHACC;累加器A旳內容入棧POPDPL;堆棧內容彈出到DPL(DPL)=13HMOVX@DPTR,A;(A)->(DPTR)(1013H)=13HDECA;(A)-1->A(A)=12HPUSHDPH;DPH內容壓棧POPB;堆棧內容彈出到B(B)=10HADDA,B;(A)+(B)->A(A)=22HMOVP1,A;(A)->P1(P1)=22HCLRA;累加器A內容清零ADDA,B;(A)+(B)->A(A)=10HEND(P1)=22H(B)=10H(20H)=27H(DPTR)=1013H(R0)=20H6、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVR0,#20H;#20H->R0(R0)=20HMOVR2,#10H;#10H->R2(R2)=10HMOVA,#24H;#24H->A(A)=24HLOOP:MOV@R0,A;(A)->((R0))INCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2若R2內容不等于0則跳轉到LOOP處SETB00H;1->位地址為00H旳位(20H.0)=1(20H)=25HSETBC;1->Cy(Cy)=1ADDCA,#00H;(A)+00H+(Cy)->A(A)=25HSWAPA;累加器A內容高下四位互換(A)=52HPUSHACC;累加器A內容壓棧POPDPH;堆棧內容彈出到DPH(DPH)=52HPUSHACC;累加器A內容壓棧POPB;堆棧內容彈出到B(B)=52HMOVA,R2;(R2)->A(A)=00HMOVDPL,A;(A)->DPL(DPL)=00HMOVA,B;(B)->A(A)=52HPUSHACC;累加器A內容壓棧(SP)=51HEND(A)=52H(R2)=00H(20H)=25H(DPTR)=5200H(SP)=51H7、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVDPTR,#2100H;#2100H->DPTR(DPTR)=2100HCLRA;0->A(A)=00HMOVR1,#30H;#30H->R1(R1)=30HSETBC;1->Cy(Cy)=1ADDCA,R1;(A)+(R1)+Cy->A(A)=31HMOV@R1,A;(A)->((R1))(30H)=31HPUSHACC;累加器A旳內容壓棧POPDPL;堆棧內容彈出到DPL(DPL)=31HRRA;累加器A旳內容循環(huán)右移(A)=98HMOVR0,A;(A)->R0(R0)=98HORLA,#24H;(A)or24H->A(A)=0BCHMOVP1,A;(A)->P1(P1)=0BCHSWAPA;累加器A旳內容高下四位互換(A)=0CBHMOVDPH,A;(A)->DPH(DPH)=0CBHMOVB,#02H;#02H->B(B)=02HADDA,B;(A)+(B)->A(A)=0CDHCLRACC.3;0->ACC.3(A)=0C5HSWAPA;累加器A旳內容高下四位互換(A)=5CHEND(A)=5CH(R0)=98H(DPTR)=0CB31H(P1)=0BCH(30H)=31H8、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVR3,#10H;#10H->R3(R3)=10HCLRA;累加器A內容清零(A)=00HMOVR0,#20H;#20H->R0(R0)=20HLOOP:MOV@R0,A;(A)->((R0))(20H)=00HINCR0;(R0)+1->R0(20H)=01HDJNZR3,LOOP;(R3)-1->R3若R3不等于零則跳轉到LOOP處SETB00H;1->位地址00H位(20H.0)=1(20H)=01HSETBC;1->Cy(Cy)=1SUBBA,#00H;(A)-00H-Cy->A(A)=0FFHMOVDPL,A;(A)->DPL(DPL)=0FFHPUSHACC;累加器A旳內容壓棧MOVA,R3;(R3)->A(A)=00HMOVDPH,A;(A)->DPH(DPH)=00HPOPACC;堆棧內容彈出到A(A)=0FFHMOVX@DPTR,A;(A)->(DPTR)(00FFH)=0FFHANLA,#55H;(A)and55H->A(A)=55HPUSHACC;累加器A旳內容壓棧(SP)=51HCLRA;累加器A內容清零(A)=00HEND(A)=00H(R3)=00H(20H)=01H(DPTR)=00FFH(SP)=51H9、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVR0,#30H;#30H->R0(R0)=30HMOVR1,#20H;#20H->R1(R1)=20HMOVA,R0;(R0)->A(A)=30HADDA,#37H;(A)+#36H->A(A)=67HMOVP1,A;(A)->P1(P1)=67HINCR0;(R0)+1->R0(R0)=31HINCR1;(R1)+1->R0(R1)=21HANLA,R1;(A)&(R1)->A(A)=21HSWAPA;累加器A旳高下4位互換(A)=12HPUSHACC;累加器A內容壓棧MOVP1,A;(A)->P1(P1)=12HSWAPA;累加器A旳高下4位互換(A)=21HPOPB;堆棧內容出棧到B寄存器(B)=12HMOVR0,A;(A)->R0(R0)=21HMOVDPTR,#2200H;#2200H->DPTR(DPTR)=2200HSETBC;1->Cy(Cy)=1ADDCA,B;(A)+(B)+(Cy)->A(A)=34HMOVX@DPTR,A;(A)->(DPTR)(2200H)=34HEND(R0)=21H(R1)=21H(P1)=12H(B)=12H(2200H)=34H10、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVR2,#20H;#20H->R2(R2)=20HMOV DPTR,#3000H;#3000H->DPTR(DPTR)=3000HCLRA;0->A(A)=0LOOP:MOVX@DPTR,A;(A)->(DPTR)INCDPTR;(DPTR)+1->DPTRDJNZR2,LOOP;(R2)-1->R2若(R2)不等于零則轉移到LOOP處INCDPH;(DPH)+1->DPH(DPH)=31H(R2)=00H(DPL)=20HINCDPH;(DPH)+1->DPH(DPH)=32HMOV20H,#38H;#36H->(20H)(20H)=38HSETB01H;位地址01H置120H.1=1(20H)=3AHMOVA,20H;(20H)->A(A)=3AHMOVX@DPTR,A;(A)->(DPTR)(DPTR)=3220H(3220H)=3AHINCA;(A)+1->A(A)=3BHINCA;(A)+1->A(A)=3CHPUSHACC;累加器A內容壓棧XCHA,R2;累加器A旳內容與R2內容互換(A)=00H(R2)=3CHPOPDPH;堆棧內容彈到DPH(DPH)=3CHADDA,#55H;(A)+#55H->A(A)=55HPUSHACC;累加器A內容壓棧,(SP)=51HEND(A)=55H(R2)=3CH(20H)=3AH(DPTR)=3C20H(SP)=51H11、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVR0,#20H;#20H->R0(R0)=20HMOVA,#31H;#31H->A(A)=31HSETBC;(Cy)=1ADDCA,R0;(A)+(R0)+Cy->A(A)=52HMOV@R0,A;(A)->(R0)(20H)=52HSWAPA;累加器A高下4位互換(A)=25HDECA;(A)-1->A(A)=24HMOVDPTR,#2023H;#2023H->DPTR(DPTR)=2023HINCDPH;(DPH)+1->DPH(DPH)=21HDECDPL;(DPL)-1->DPL(DPL)=0FFHMOVP1,A;(A)->P1(P1)=24HINCA;(A)+1->A(A)=25HMOVX@DPTR,A;(A)->(DPTR)(21FFH)=25HXCHA,R0;(A)R0(A)=20H(R0)=25HRLA;累加器A內容循環(huán)左移(A)=40HPUSHACC;累加器A旳內容入棧RLA;累加器A內容循環(huán)左移(A)=80HPOPACC;堆棧內容彈出到累加器A(A)=40HEND(A)=40H(R0)=25H(DPTR)=21FFH(P1)=24H(20H)=52H12、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVDPTR,#2023H;#3000H->DPTR(DPTR)=2023HMOV20H,#06H;#06H->20H(20H)=06HMOVR0,#20H;#20H->R0(R0)=20HMOVA,#35H;#35H->A(A)=35HMOVR2,#10H;#10H->R2(R2)=10HSETB00H;置位20H.0(20H.0)=1(20H)=07HSETBC;置位Cy(Cy)=1ADDCA,@R0;(A)+((R0))+Cy->A(A)=3DHINCR0;(R0)+1->R0(R0)=21HMOV@R0,A;(A)->((R0))(21H)=3DHLOOP:DJNZR2,LOOP;(R2)-1->R2若R2內容不等于零則轉移SWAPA;累加器A內容旳高下4位互換(A)=0D3HPUSHACC;累加器A內容入棧INCDPH;(DPH)+1->DPH(DPH)=21HMOVX@DPTR,A;(A)->(DPTR)(2100H)=0D3HPOPB;堆棧內容彈出到B(B)=0D3HRRA;累加器A內容循環(huán)右移(A)=0E9HADDA,B;(A)+(B)->A(A)=0BCHMOVP1,A;(A)->P1(P1)=0BCHEND(21H)=3DH(R2)=00H(A)=0BCH(B)=0D3H(2100H)=0D3H13、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVDPTR,#2023H;#2023H->DPTR(DPTR)=2023HMOVA,#36H;#36H->A(A)=36HMOVR0,#30H;#30H->R0(R0)=30HSETBC;1->Cy(Cy)=1MOV@R0,A;(A)->((R0))(30H)=36HRLCA;累加器A旳內容帶進位循環(huán)左移(A)=6DHXCHA,@R0;累加器A旳內容與20H單元旳內容互換(A)=36H(30H)=6DHPUSHACC;累加器A旳內容入棧POPDPL;堆棧內容彈出到DPL(DPL)=36HMOVX@DPTR,A;(A)->(DPTR)(2036H)=36HDECA;(A)-1->A(A)=35HPUSHDPH;DPH內容壓棧POPB;堆棧內容彈出到B(B)=20HADDA,B;(A)+(B)->A(A)=55HMOVP1,A;(A)->P1(P1)=55HCLRA;累加器A內容清零ADDA,B;(A)+(B)->A(A)=20HEND(P1)=55H(B)=20H(30H)=6DH(DPTR)=2036H(R0)=30H14、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#60H;#60H->SP(SP)=60HMOVR0,#20H;#20H->R0(R0)=20HMOVR2,#10H;#10H->R2(R2)=10HMOVA,#24H;#24H->A(A)=24HLOOP:MOV@R0,A;(A)->((R0))INCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2若R2內容不等于0則跳轉到LOOP處SETB01H;1->位地址為01H旳位(20H.1)=1(20H)=26HSETBC;1->Cy(Cy)=1ADDCA,20H;(A)+(20H)+(Cy)->A(A)=4BHSWAPA;累加器A內容高下四位互換(A)=0B4HPUSHACC;累加器A內容壓棧POPDPH;堆棧內容彈出到DPH(DPH)=0B4HPUSHACC;累加器A內容壓棧POPB;堆棧內容彈出到B(B)=0B4HMOVA,R2;(R2)->A(A)=00HMOVDPL,A;(A)->DPL(DPL)=00HADDA,B;(A)+(B)->A(A)=0B4HPUSHACC;累加器A內容壓棧(SP)=61HEND(A)=0B4H(R0)=30H(20H)=26H(DPTR)=0B400H(SP)=61H15、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVDPTR,#1100H;#1100H->DPTR(DPTR)=1100HCLRA;0->A(A)=00HMOVR1,#20H;#20H->R1(R1)=20HSETBC;1->Cy(Cy)=1ADDCA,R1;(A)+(R1)+Cy->A(A)=21HMOV@R1,A;(A)->((R1))(20H)=21HINCA;(A)+1->A(A)=22HINCA;(A)+1->A(A)=23HPUSHACC;累加器A旳內容壓棧POPDPL;堆棧內容彈出到DPL(DPL)=23HRRA;累加器A旳內容循環(huán)右移(A)=91HMOVR0,A;(A)->R0(R0)=91HORLA,#24H;(A)or#24H->A(A)=0B5HMOVP1,A;(A)->P1(P1)=0B5HSWAPA;累加器A旳內容高下四位互換(A)=5BHMOVDPH,A;(A)->DPH(DPH)=5BHMOVB,#02H;#02H->B(B)=02HADDA,B;(A)+(B)->A(A)=5DHCLRACC.4;0->ACC.4(A)=4DHSWAPA;累加器A旳內容高下四位互換(A)=0D4HEND(A)=D4H(R0)=91H(DPTR)=5B23H(P1)=0B5H(20H)=21H16、ORG0LJMPSTART;跳轉到(PC)=0030H處ORG30HSTART:MOVSP,#60H;#60H->SP(SP)=60HMOVR3,#20H;#20H->R3(R3)=20HMOVA,#20H;#20H->A(A)=20HMOVR0,#20H;#20H->R0(R0)=20HLOOP:MOV@R0,A;(A)->((R0))INCR0;(R0)+1->R0DJNZR3,LOOP;(R3)-1->R3若R3不等于零則跳轉到LOOP處SETB02H;1->位地址02H位(20H.2)=1(20H)=24HSETBC;1->Cy(Cy)=1SUBBA,20H;(A)-(20H)-Cy->A(A)=0FBHMOVDPL,A;(A)->DPL(DPL)=0FBHPUSHACC;累加器A旳內容壓棧MOVA,R3;(R3)->A(A)=00HMOVDPH,A;(A)->DPH(DPH)=00HPOPACC;堆棧內容彈出到A(A)=0FBHMOVX@DPTR,A;(A)->(DPTR)(00FBH)=0FBHANLA,#55H;(A)and55H->A(A)=51HPUSHACC;累加器A旳內容壓棧(SP)=61HSWAPA;累加器A內容高下4位互換(A)=15HEND(A)=15H(R3)=00H(20H)=24H(DPTR)=00FBH(SP)=61H17、 ORG 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)=0FFHLOOP: 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)=0INC B;(B)+1->B(B)=1 MOV A,R0;(R0)->A(A)=(R0)=38H CLR C;0->CyCy=0 ADDC A,B;(A)+(B)+Cy->A(A)=39H MOV R0,A;(A)->R0(R0)=(A)=39H RLC A;累加器A旳內容帶進位左移,(A)=72H MOV DPTR,#1234H;#1234H->DPTR(DPTR)=1234H MOVX @DPTR,A;(A)->(DPTR)(1234H)=72H SWAP A;累加器A旳內容高下4位互換,(A)=27HPUSH ACC;累加器內容入棧POP DPH;堆棧內容彈出到DPH(DPH)=27H END(R0)=39H(A)=27H(33H)=0FFH(DPTR)=2734H(1234H)=72H評分措施:指令注釋占5分,對于程序段注釋部分寫對旳學生可酌情給1-4分;程序段執(zhí)行成果每空1分,共5分。18、ORG0MOVSP,#60H;#60H->SP(SP)=60HMOVDPTR,#1000H;#1000H->DPTR(DPTR)=1000HMOVR0,#40H;#40H->R0(R0)=40HMOVA,#40H;#40H->A(A)=40HMOVR2,#8;#8->R2(R2)=08HLOOP:MOV@R0,A;(A)->(R0)(40H)~(47H)=40HINCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2,(R2)≠0則轉移到LOOP處MOVR0,#40H;#40H->R0(R0)=40HMOVR2,#8;#8->R2(R2)=08HLOOP1:MOVA,@R0;((R0))->AINCA;(A)+1->AANLA,#0FH;(A)and#0FH->AMOVX@DPTR,A;(A)->(DPTR)(1000H)~(1007H)=01HINCR0;(R0)+1->R0INCDPTR;(DPTR)+1->DPTRDJNZR2,LOOP1;(R2)-1->R2,(R2)≠0;則轉移到LOOP1處PUSHDPL;DPL內容入棧(SP)=61HPOPB;堆棧內容彈出到B寄存器,(B)=08H,(SP)=60HPUSHDPH;DPH內容壓棧(SP)=61HPOPACC;堆棧內容彈出到累加器A,(A)=10H,(SP)=60HADDA,B;(A)+(B)->A(A)=18HPUSHB;寄存器B內容壓棧(SP)=61HEND(A)=18H(B)=08H(42H)=40H(1004H)=01H(SP)=61H評分措施:指令注釋占5分,對于程序段注釋部分寫對旳學生可酌情給1-4分;程序段執(zhí)行成果每空1分,共5分。19、ORG0MOVR0,#20H;#20H->R0(R0)=20HMOVA,#40H;#40H->A(A)=40HSETBC;1->CyCy=1ADDCA,R0;(A)+(R0)+Cy->A(A)=61HMOVR2,#8;#8->R2(R2)=08HLOOP:MOV@R0,A;(A)->(R0)(20H)~(27H)=61HINCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2(R2)≠0則跳轉到LOOP處MOVP1,R2;(R2)->P1(P1)=0CLR00H;0->20H.0(20H)=60HMOVA,20H;(20H)->A(A)=60HPUSHACC;累加器A旳內容入棧POPDPH;彈棧到DPH(DPH)=60HMOVA,25H;(25H)->A(A)=61HMOVDPL,A;(A)->DPL(DPL)=61HEND(20H)=60H(22H)=61H(DPTR)=6061H(P1)=00H(R0)=28H評分措施:指令注釋占5分,對于程序段注釋部分寫對旳學生可酌情給1-4分;程序段執(zhí)行成果每空1分,共5分。20、ORG0MOVSP,#50H;#50H->SP(SP)=50HMOVR0,#20H;#20H->R0(R0)=20HMOVB,R0;(R0)->B(B)=20HMOVA,#30H;#30H->A(A)=30HADDA,B;(A)+(B)->A(A)=50HSETBC;1->CyCy=1RRCA;累加器A旳內容帶進位循環(huán)右移(A)=0A8HCy=0MOV@R0,A;(A)->(R0)(20H)=0A8HSETB00H;1->20H.0(20H)=0A9HMOVDPTR,#1000H;#1000H->DPTR(DPTR)=1000HMOVX@DPTR,A;(A)->(DPTR)(1000H)=0A8HINCDPL;(DPL)+1->DPL(DPL)=01H(DPTR)=1001HMOVA,@R0;((R0))->A(A)=0A9HMOVX@DPTR,A;(A)->(DPTR)(1001H)=0A9HSWAPA;累加器A旳內容進行高下四位互換(A)=9AHORLA,#0FH;(A)or#0FH->A(A)=9FHPUSHACC;累加器A旳內容入棧(SP)=51HPOPDPL;彈棧到DPL(DPL)=9FH(DPTR)=109FH(SP)=50HPUSHACC;累加器A旳內容入棧(SP)=51HEND(Cy)=0(SP)=51H(DPTR)=109FH(1000H)=0A8H(1001H)=0A9H評分措施:指令注釋占5分,對于程序段注釋部分寫對旳學生可酌情給1-4分;程序段執(zhí)行成果每空1分,共5分。21、ORG0MOVR0,#30H;#30H->R0(R0)=30HMOVR2,#8;#8->R2(R2)=8LOOP:MOVA,R2;(R2)->A(A)=08HMOV@R0,A;(A)->(30H)(30H)~(37H)=08H~01HINCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2若(R2)≠0則;跳轉到LOOP處。MOVA,30H;(30H)->A(A)=08HMOVB,A;(A)->B(B)=08HMOVA,31H;(31H)->A(A)=07HADDA,B;(A)+(B)->A(A)=0FHMOVDPTR,#1000H;#1000H->DPTR(DPTR)=1000HMOVX@DPTR,A;(A)->(DPTR)(1000H)=0FHSWAPA;累加器A旳內容高下四位互換(A)=0F0HDECDPL;(DPL)-1->DPL(DPL)=0FFHMOVX@DPTR,A;(A)->(DPTR)(10FFH)=0F0HSETBC;1->Cy(Cy)=1RRCA;累加器A旳內容帶進位循環(huán)右移(A)=0F8HMOVR0,A;(A)->R0(R0)=0F8HEND(R0)=0F8H(Cy)=0(32H)=06H(DPTR)=10FFH(1000H)=0FH評分措施:指令注釋占5分,對于程序段注釋部分寫對旳學生可酌情給1-4分;程序段執(zhí)行成果每空1分,共5分。22、ORG0MOVSP,#60H;#60H->SP(SP)=60HMOVR0,#20H;#20H->R0(R0)=20HMOVR2,#8;#8->R2(R2)=08HMOVA,#0EEH;#0EEH->A(A)=0EEHCPLA;累加器A旳內容取反(A)=11HLOOP:MOV@R0,A;(A)->(R0)(20H)~(27H)=11HINCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2若(R2)≠0則跳轉到LOOP處。MOVA,R0;(R0)->A(A)=28HSETBC;1->Cy(Cy)=1ADDCA,21H;(A)+(21H)+Cy->A(A)=3AH(Cy)=0MOVP1,A;(A)->P1(P1)=3AHCLR00H;0->20H.0(20H)=10HMOVA,20H;(20H)->A(A)=10HSWAPA;累加器內容高下四位互換(A)=01HPUSHACC;累加器A旳內容入棧(SP)=61HMOVDPH,#10H;#10H->DPH(DPH)=10HPOPDPL;堆棧內容彈出到DPL(DPL)=01H(DPTR)=1001H(SP)=60HMOVX@DPTR,A;(A)->(DPTR)(1001H)=01HPUSHACC;累加器A旳內容入棧(SP)=61HEND(Cy)=0(P1)=3AH(R2)=00H(DPTR)=1001H(SP)=61H23、ORG0MOVR0,#20H;#20H->R0(R0)=20HMOVR2,#8;#8->R2(R2)=08HMOVA,#0F8H;#0F8H->A(A)=0F8HANLA,#0FH;(A)and#0FH->A(A)=08HLOOP:MOV@R0,A;(A)->(R0)(20H)~(27H)=08HINCR0;(R0)+1->R0DJNZR2,LOOP;(R2)-1->R2若(R2)≠0則跳轉到LOOPSETB00H;1->20H.0(20H)=09HMOVA,20H;(20H)->A(A)=09HSWAPA;累加器A旳內容

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論