实验二:循环程序设计2.DA TA SEGMENTx db -78,127,-128,-125,88y db 32,-43,76,95,1S db 5 dup(?)data endsCode segmentAssume cs:code,ds:data Start:mov ax,dataMov ds,axMov cx,5Mov bx,0L1:mov al,x[bx]Add al,y[bx]Inc bxLoop L1MOV AH,4CHINT 21HCODE ENDSEND START3.DA TA SEGMENTY DB 68H,24H,90H,57H,13H HX DB 67H,34H,12H,90H,57H S DB 5 DUP(?)DA TA ENDSCODE SEGMENTASSUME CS:CODE,DS:DA TA START:MOV AX,DATAMOV DS,AXMOV CX,5MOV SI,OFFSET XMOV DI,OFFSET YLP:MOV AL,[SI]MOV AH,[DI]ADC AL,AHDAAMOV S[SI],ALINC SIINC DILOOP LPMOV AH,4CHINT 21HCODE ENDSEND START4.DA TA SEGMENTLIST DB 0,1,2,3,4,5,6,7,8,9COUNT EQU $-LISTDA TA ENDSCODE SEGMENTASSUME CS:CODE,DS:DA TASTART:MOV AX,DATAMOV DS,AXMOV CX,COUNT-1LOOP1:MOV DX,CXMOV BX,0LOOP2:MOV AX,LIST[BX]CMP AX,LIST[BX+1]MOV LIST[BX],AXLOOP3:INC BXLOOP LOOP2MOV CX,DXLOOP LOOP1MOV AX,4CHINT 21HCODE ENDSEND START实验三:子程序调用程序设计DA TA SEGMENTNUM DB 85,77,126,-1,-43,37,-128,11,-19,13 DA TA ENDSADDITION SEGMENTNUM1 DB 10 DUP(?)ADDITION ENDSCODE SEGMENTASSUME CS:CODE,DS:DA TA,ES:ADDITION START:AX,DATAMOV DS,AXMOV AX,ADDITIONMOV ES,AXCALL ORDERCALL COPYMOV AH,4CHINT 21HORDER PROCMOV CX,9LP2:MOV BX,0MOV DX,CXLP1:MOV AL,NUM[BX]CMP AL,NUM[BX+1]JLE NEXTXCHG AL,NUM[BX+1]MOV NUM[BX],ALNEXT:ADD BX,1DEC DXJNZ LP1LOOP LP2RETORDER ENDPCOPY PROCMOV CX,10MOV BX,0LP:MOV AL,NUM[BX]MOV ES:NUM1[BX],ALINC BXLOOP LPRETCOPY ENDPCODE ENDSEND START实验四:DOS功能系统调用1.DA TA SEGMENTDUF DB 10 DUP(?)DA TA ENDSSTACK SEGMENTSA DB 100 DUP(?)TOP LABEL WORDSTACK ENDSCODE SEGMENTASSUME DS:DATA,CS:CODE,SS:STACK START:MOV AX,STACKMOV SS,AXMOV SP,OFFSET TOPPUSH DSSUB AX,AXPUSH AXMOV AX,DATAMOV DS,AXMOV CX,05HS1:MOV AH,1INT 21HPUSH AXLOOP S1MOV DL,0DHMOV AH,02HINT 21HMOV DL,0AHMOV AH,02HINT 21HMOV CX,05HMOV BX,4S2:POP AXMOV DUF[BX],ALDEC BXLOOP S2MOV BX,0MOV CX,05HS3:MOV DL,DUF[BX]INC BXMOV AH,2INT 21HLOOP3INC ALMOV AH,4CHINT 21HCODE ENDSEND START2.DA TA SEGMENTBUFF DB 50DB ‘?’LETTER DB 50 DUP(‘?’)DA TA ENDSCODE SEGMENTASSUME CS:CODE,DS:DA TA START:MOV AX,DATAMOV DS,AXLEA DX,BUFFMOV AH,0AHINT 21HMOV DL,0DHMOV AH,02HMOV DL,OAHMOV AH,02HINT 21HLEA DX,LETTERMOV AH,09HINT 21HMOV AH,4CHINT 21HCODE ENDSEND START第五次实验:接口预备知识DA TA SEGMENTOUTBUF DB’5’,’4’,’3’,’2’,’1’COUNT EQU $-COUNTDA TA ENDSCODE SEGMENTASSUME CS:CODE,DS:DA TA START:MOV AX,DATAMOV DS,AXMOV SI,OFFSET OUTBUF MOV DI,COUNTNEXT:MOV DL,[SI]MOV AH,02HINT 21HCALL DELAYINC SIDEC DIJNZ NEXTMOV AH,4CHINT 21HDELAY PROC NEARPUSH CXMOV BX,299HFOR1:MOV CX,0FFFFH FOR2:LOOP FOR2DEC BXJNZ FOR1POP CXRETDELAY ENDPCODE ENDSEND START第六次实验:简单的输出接口1.CODE SEGMENT ASSUME CS:CODE start:mov di ,2l1:mov al ,02hmov dx,280hout dx,alcall delaymov al ,00hmov dx,280hout dx,alcall delaymov si,3l2:mov al,04hmov dx,280hout dx,alcall delaymov al,00hmov dx,280hout dx,alcall delaydec sijnz l2mov al,08hmov dx,280hout dx,alcall delaymov al ,00hmov dx,280hout dx,alcall delaydec dijnz l1MOV AH,4CHINT 21HDELAY PROC NEAR PUSH CXMOV BX,100HFOR1:MOV CX,0FFFFH FOR2:LOOP FOR2 DEC BXJNZ FOR1POP CXRETDELAY ENDPCODE ENDSEND START2.CODE SEGMENT ASSUME CS:CODE START:MOV CX,2AA:MOV BX,8PUSH CXMOV DX,280HMOV AL,01HBB:OUT DX,ALCALL DELAYMOV DX,280HROl AL,1OUT DX,ALDEC BXJNZ BBPOP CXMOV DX,280Hmov AL,00hOUT DX,ALLOOP AAMOV AH,4CHINT 21HDELAY PROC NEAR PUSH BXPUSH CXMOV BX,299HFOR:MOV CX,0FFFFH FOR1:LOOP FOR1DEC BXJNZ FORPOP CXPOP BXRETDELAY ENDPCODE ENDSEND START第七次实验:简单的输入接口1.data segmentx db'end$'data endscode segmentassume cs:code,ds:data start:mov ax,datamov ds,axmov cx,6mov dl,31hlp: push dxmov dx,280hin al,dxand al,10hmov bl,allp1: in al,dxand al,10hcmp bl,aljz lp1mov dl,0ahmov ah,02hint 21hmov dl,0dhint 21hpop dxint 21hinc dxloop lpmov dl,0ahint 21hmov dl,0dhint 21hmov dx,offset xmov ah,09hint 21hmov ah,4chint 21hcode endsend start2.data segmentx db'end$'data endscode segmentassume cs:code,ds:data start:mov ax,datamov ds,axmov cx,6mov dl,31hlp: push dxmov dx,280hin al,dxpush cxmov cx,2lp1: and al,10hmov bl,allp2: in al,dxand al,10hcmp bl,aljz lp2loop lp1pop cxmov dl,0ahmov ah,02hint 21hmov dl,0dhint 21hpop dxint 21hinc dxloop lpmov dl,0ahint 21hmov dl,0dhint 21hmov dx,offset xmov ah,09hint 21hmov ah,4chint 21hcode endsend start第八次实验:数码管动态显示实验1.CODE SEGMENTASSUME CS:CODE START:MOV CX,03FFHL1: MOV DX,280HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,76H ;HOUT DX,ALMOV DX,282HMOV AL,02HOUT DX,ALCALL DONGMOV DX,282HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,73H;POUT DX,ALMOV DX,280HMOV AL,01HOUT DX,ALCALL DONGLOOP L1MOV DX,280HMOV AL,00HOUT DX,ALMOV AH,4CHINT 21HDONG PROC NEARPUSH CXPUSH BXMOV BX,0100H FOR1: MOV CX,0100H FOR2: LOOP FOR2DEC BXJNZ FOR1POP BXPOP CXRETDONG ENDPCODE ENDSEND START2.CODE SEGMENTASSUME CS:CODE START:MOV CX,01FFHL1: MOV DX,280HMOV AL,00HOUT DX,ALMOV AL,3FH ;0OUT DX,ALMOV DX,282HMOV AL,02HOUT DX,ALCALL DONGMOV DX,282HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,06H;1OUT DX,ALMOV DX,280HMOV AL,01HOUT DX,ALCALL DONGLOOP L1MOV CX,01FFHL2: MOV DX,280HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,5BH ;2OUT DX,ALMOV DX,282HMOV AL,02HOUT DX,ALCALL DONGMOV DX,282HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,4FH;3OUT DX,ALMOV DX,280HMOV AL,01HOUT DX,ALCALL DONGLOOP L2MOV CX,010FHL3: MOV DX,280HMOV AL,00HOUT DX,ALMOV AL,66H ;4OUT DX,ALMOV DX,282HMOV AL,02HOUT DX,ALCALL DONGMOV DX,282HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,6DH;5OUT DX,ALMOV DX,280HMOV AL,01HOUT DX,ALCALL DONGLOOP L3MOV CX,010FHL4: MOV DX,280HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,7DH ;6OUT DX,ALMOV DX,282HMOV AL,02HOUT DX,ALCALL DONGMOV DX,282HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,07H;7OUT DX,ALMOV DX,280HMOV AL,01HOUT DX,ALCALL DONGLOOP L4MOV CX,010FHL5: MOV DX,280HMOV AL,00HMOV DX,290HMOV AL,7FH ;8OUT DX,ALMOV DX,282HMOV AL,02HOUT DX,ALCALL DONGMOV DX,282HMOV AL,00HOUT DX,ALMOV DX,290HMOV AL,6FH;9OUT DX,ALMOV DX,280HMOV AL,01HOUT DX,ALCALL DONGLOOP L5MOV DX,280HMOV AL,00HOUT DX,ALMOV AH,4CHINT 21HDONG PROC NEARPUSH CXPUSH BXMOV BX,0100HFOR1: MOV CX,0100HFOR2: LOOP FOR2DEC BXJNZ FOR1POP BXPOP CXRETDONG ENDPCODE ENDSEND START第九次实验:可编程并行接口8255实验1.code segmentassume cs:codestart:mov dx,283hmov al,90hmov dx,280hin al,dxand al,01hcmp al,01Hmov cx,3mov dx,281hjnz l2l1:mov al,01hout dx,alcall delaymov al,02hout dx,alcall delaymov al,04hout dx,alcall delaymov al,08hout dx,alcall delayloop l1mov al,00hout dx,aljmp l3l2:mov al,0f0hout dx,alcall delaymov al,000hout dx,alcall delayloop l2mov al,00hout dx,all3:mov ah,4chint 21hdelay proc nearPUSH CXPUSH BXMOV BX,0200H FOR3:MOV CX,0FFFFH FOR4:LOOP FOR4DEC BXJNZ FOR3POP BXRETdelay endpcoed endsend start2.CODE SEGMENTASSUME CS:CODESTART:MOV AL,10110100BMOV DX,283HOUT DX,ALL1: MOV DX,282H ;C口端口号,检验C口的pc4是否为高电平,高电平则输入IN AL,DXAND AL,20HJZ L1MOV DX,280H ; A口端口号,读入数据IN AL,DXCALL DELAYMOV DX,281H ; B口端口号,输出至A口OUT DX,ALL2: MOV DX,282HIN AL,DXAND AL,02H ; 判断输出缓冲器是否满,满就等待,不满程序结束JZ L2JMP L3LOOP STARTL3:MOV AL,00MOV DX,280HOUT DX,ALMOV AH,4CHINT 21HDELAY PROC NEARPUSH CXMOV BX,0f00HFOR1:MOV CX,0FFFFHFOR2:LOOP FOR2DEC BXJNZ FOR1POP CXRETDELAY ENDPCODE ENDSEND START实验十:可编程计数器/定时器8253实验1.CODE SEGMENTASSUME CS:CODESTART:mov dx,283hmov al,10hout dx,almov dx,280hmov al,04hout dx,alcall delaymov dx,280hin al,dxmov dl,aladd dl,30hmov ah,2int 21h;jmp startmov ah,4chint 21hdelay proc nearpush cxmov bx,1000hfor1:mov cx,0ffffhfor2:loop for2dec bxjnz for1pop cxretdelay endsend startcode ends2.CODE SEGMENTASSUME CS:CODESTART:mov dx,283hmov al,52hout dx,almov dx,281hmov al,05hout dx,almov ah,4chint 21hend startcode ends实验十一:DATA SEGMENTABC DB'ARE YOU READY?',0DH,0AH,'$'CCC DB'IRQ10 INTERRUPT NOW !',0DH,0AH,'$' DATA ENDSCODE SEGMENTASSUME CS:CODE, DS:DATASTART:MOV AX,CSMOV DS,AXMOV DX,OFFSET ZD10MOV AX,2572HINT 21HCLIIN AL,21HAND AL,0FBHOUT 21H,ALIN AL,0A1HAND AL,0FBHOUT 0A1H,ALSTIMOV CX,20LOOP1: PUSH CXMOV AX,DATAMOV DS,AXLEA DX,ABCMOV AH,9INT 21HCALL DELAYPOP CXLOOP LOOP1MOV DX,21HIN AL,DXOR AL,4OUT 21H,ALMOV DX,0A1HIN AL,DXOR AL,4OUT 0A1H,ALMOV AH,4CHINT 21HZD10 PROC NEAR PUSH AXPUSH BXPUSH CXPUSH DXMOV CX,5AGAIN:PUSH CXLEA DX,CCCMOV AH,9INT 21HCALL DELAYPOP CXLOOP AGAINPOP DXPOP CXPOP BXPOP AXMOV AL,20HOUT 20H,ALMOV AL,20HOUT 0A0H,ALIRETZD10 ENDPDELAY PROC NEAR MOV BX,02FFHFOR1: MOV CX,0FFFFHFOR2: LOOP FOR2DEC BXJNZ FOR1RETDELAY ENDPCODE ENDSEND START2、DATA SEGMENTABC DB'ARE YOU READY?',0DH,0AH,'$' DATA ENDSCODE SEGMENTASSUME CS:CODE, DS:DATASTART: MOV AX,CSMOV DS,AXMOV DX,OFFSET ZD10MOV AX,2572HINT 21HCLIIN AL,21HAND AL,0FBHOUT 21H,ALIN AL,0A1HAND AL,0FBHOUT 0A1H,ALSTIMOV CX,20LOOP1: PUSH CXMOV AX,DATAMOV DS,AXLEA DX,ABCMOV AH,9INT 21HCALL DELAYPOP CXLOOP LOOP1MOV DX,21HIN AL,DXOR AL,4OUT 21H,ALMOV DX,0A1HIN AL,DXOR AL,4OUT 0A1H,ALMOV AH,4CHINT 21HZD10 PROC NEAR PUSH AXPUSH BXPUSH CXPUSH DXMOV CX,3AGAIN: PUSH CXMOV DX,280HMOV AL,0FHOUT DX,ALCALL DELAYMOV DX,280HMOV AL,00HOUT DX,ALCALL DELAYPOP CXLOOP AGAINPOP DXPOP CXPOP BXPOP AXMOV AL,20HOUT 20H,ALMOV AL,20HOUT 0A0H,ALIRETZD10 ENDPDELAY PROC NEAR MOV BX,02FFHFOR1: MOV CX,0FFFFHFOR2: LOOP FOR2DEC BXJNZ FOR1RETDELAY ENDPCODE ENDSEND START。