1、北京理工大学cup与汇编实验五本科实验报告实验名称:子程序与模块化程序设计实验课程名称:课程设计I(cup与汇编)实验实验时间:第10周周二10-13节任课教师:张笈实验地点:10-102实验教师:高平实验类型:原理验证综合设计自主创新学生姓名:学号/班级:组号:学院:信息与电子学院同组搭档:专业:电子科学与技术成绩:1.DATAS SEGMENT BUF1 DBdata,name,time,file,code,path,user,exit,quit,text$;此处输入数据段代码 LENTH EQU $-BUF1 BUF2 DB 6DB?DB 6 DUP(?) BUF3 DBNOT FOUN
2、D$DATAS ENDSSTACKS SEGMENT;此处输入堆栈段代码STACKS ENDSCODES SEGMENTASSUME CS:CODES,DS:DATAS,SS:STACKSNF: MOV DX,OFFSET BUF3MOV AH,9H INT 21H JMP ENNO: ADD SI,7HSBB SI,BXCMP SI,LENTH JAE NFMOV BX,2H JMP LNEXT PROC NEARMOV AL,BUF2BXCMP AL,BUF1SI JNE NOINC BXINC SIRETNEXT ENDPSTART: MOV AX,DATASMOV DS,AXMOV D
3、X,OFFSET BUF2MOV AH,0AH INT 21HMOV BX,2HL: CALL NEXT CALL NEXT CALL NEXT CALL NEXTDEC SIDEC BXSBB SI,3HMOV AL,dMOV BUF1SI,ALINC SIMOV AL,iMOV BUF1SI,ALINC SIMOV AL,sMOV BUF1SI,ALINC SIMOV AL,kMOV BUF1SI,ALMOV DL,0AHMOV AH,2H INT 21HMOV DX,OFFSET BUF1MOV AH,9H INT 21H JMP EN LOOP LEN: MOV AH,4CH INT
4、21HCODES ENDSENDSTART3.DATAS SEGMENT BUF1 DBdata,name,time,file,code,path,user,exit,quit,text$;此处输入数据段代码 LENTH EQU $-BUF1 BUF2 DB 6DB?DB 6 DUP(?) BUF3 DBNOT FOUND$ C DB 0 DATAS ENDSSTACKS SEGMENT;此处输入堆栈段代码STACKS ENDSCODES SEGMENTASSUME CS:CODES,DS:DATAS,SS:STACKSNF: MOV DL,0AHMOV AH,2H INT 21HMOV DX
5、,OFFSET BUF3MOV AH,9H INT 21H JMP ENNO: ADD SI,7HSBB SI,BXCMP SI,LENTH JAE NFMOV BX,2H JMP LNEXT PROC NEARMOV AL,BUF2BXCMP AL,BUF1SI JNE NOINC BXINC SIRETNEXT ENDPSTART: MOV AX,DATASMOV DS,AXMOV DX,OFFSET BUF2MOV AH,0AH INT 21HMOV BX,2HL: CALL NEXT CALL NEXT CALL NEXT CALL NEXTINC SIINC BXSHANCHU:MO
6、V AL,BUF1SIMOV BUF1SI-5,ALCMP SI,32H JE SHUCHUINC SIMOV AL,BUF1SIMOV BUF1SI-5,ALINC SIMOV AL,BUF1SIMOV BUF1SI-5,ALINC SIMOV AL,BUF1SIMOV BUF1SI-5,ALINC SIMOV AL,BUF1SIMOV BUF1SI-5,ALINC SI LOOP SHANCHUSHUCHU:MOV DL,0AHMOV AH,2H INT 21HMOV DX,OFFSET BUF1MOV AH,9H INT 21H JMP EN LOOP LEN: MOV AH,4CH I
7、NT 21HCODES ENDSENDSTART4.DATA SEGMENT BUF DB 5DB?DB 5 DUP(?) MINUS DW 10 STORE DB 6 DUP(0) PRINT DB 10,13 STORE2 DB 5 DUP(0),10,13,$ MINUS2 DW 2 EROR DB 13,10,INPUT ERROR!$DATA ENDSCODE SEGMENTASSUME CS:CODE,ES:DATA,DS:DATA MAIN PROC FARMOV AX,DATAMOV ES,AXMOV DS,AXR: CALL INPUT CALL CHANGE CALL OU
8、TPUT JMP RMOV AX,4C00H INT 21HMAIN ENDPCHANGE PROCMOV AX,WORD PTR BUF+2XCHG AL,AHCMP AH,39H JBE TO5SUB AH,37H JMP TP TO5: SUB AH,30HTP: CMP AL,39H JBE TO1SUB AL,37H JMP TP1TO1: SUB AL,30HTP1: MOV CL,4SHL AH,CLOR AH,ALMOV AL,0PUSH AXMOV AX,WORD PTR BUF+4XCHG AL,AHCMP AH,39HJBE TO3SUB AH,37HJMP TP3TO3
9、 : SUB AH,30HTP3: CMP AL,39HJBE TO4SUB AL,37HJMP TP4TO4: SUB AL,30HTP4: MOV CL,4SHL AH,CLOR AL,AHMOV AH,0POP DXOR AX,DXRETCHANGE ENDPINPUT PROCLEA DX,BUFMOV AH,0AHINT 21HCALL CHECKRETINPUT ENDPOUTPUT PROCMOV CX,5LEA BX,STORE2+4AGAIN4: MOV DX,0DIV MINUSMOV BX,DLOR BYTE PTR BX,30HDEC BXLOOP AGAIN4LEA DX,PRINTMOV AH,9INT 21HRETOUTPUT ENDPERROR PROCLEA DX,ERORMOV AH,9INT 21HMOV AX,4C00HINT 21HERROR ENDPCHECK PROCMOV CL ,BUF+1LEA BX,BUF+2AGAIN3: CMP BYTE PTR BX,41HJB TOCMP BYTE PTR BX,46HJA TOINC BXDEC CLJNZ AGAIN3JMP TO2TO: CALL ERRORTO2: RETCHECK ENDPCODE ENDSEND MAIN
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1