西电微机基础原理上机课后复习完整编辑版.doc

收藏

编号:2626530    类型:共享资源    大小:237.16KB    格式:DOC    上传时间:2020-04-25
8
金币
关 键 词:
微机 基础 原理 上机 课后 复习 温习 完整 完全 编辑 编纂
资源描述:
-/ 班级:021113 学号:02111283 姓名:范亚男 指导老师:董玫 上机作业(一) 指令 SRC寻址方式 SRC的地址 AX推算值 AX实际值 MOV AX, CX 寄存器寻址 0005 0005 MOV AX, 500H 立即寻址 0500 0500 MOV AX, TABLE 直接寻址 1541:0004 A5A4 A5A4 MOV AX, ES:[BX] 寄存器间接寻址 1542:0004 C5C4 C5C4 MOV AX, [BX+05H] 寄存器相对寻址 1541:0009 AAA9 AAA9 MOV AX, SS:[BX]+03H 寄存器相对寻址 153F:0007 B8B7 B8B7 MOV AX, TABLE [BX] 寄存器相对寻址 1541:0008 A9A8 A9A8 MOV AX, 07H [BX] 寄存器相对寻址 1541:000B ACAB ACAB MOV AX, [BP] 寄存器间接寻址 153F:0003 B4B3 B4B3 MOV AX, TABLE [BP] 寄存器相对寻址 1541:0007 A8A7 A8A7 MOV AX, 08H [BP] 寄存器相对寻址 153F:000B BCBB BCBB MOV AX, [BP+06H] 寄存器相对寻址 153F:0009 BAB9 BAB9 MOV AX, DS:[BP+03H] 寄存器相对寻址 1541:0006 A7A6 A7A6 MOV AX, [BP]+05H 寄存器相对寻址 153F:0008 B9B8 B9B8 MOV AX, ES: [SI+03H] 寄存器相对寻址 1542:0005 C6C5 C6C5 MOV AX, [DI+06H] 寄存器相对寻址 1541:0007 A8A7 A8A7 MOV AX, [DI]+05H 寄存器相对寻址 1541:0006 A7A6 A7A6 MOV AX, TABLE [SI] 寄存器相对寻址 1541:0006 A7A6 A7A6 MOV AX, [SI] 寄存器间接寻址 1541:0002 A3A2 A3A2 MOV AX, TABLE [DI] 寄存器相对寻址 1541:0005 A6A5 A6A5 MOV AX, [SI]+05H 寄存器相对寻址 1541:0007 A8A7 A8A7 MOV AX, [BX] [DI+01H] 基址变址且相对寻址 1541:0006 A7A6 A7A6 MOV AX, [BX] [SI]+03H 基址变址且相对寻址 1541:0009 AAA9 AAA9 MOV AX, TABLE [BX] [SI] 基址变址且相对寻址 1541:000A ABAA ABAA MOV AX, ES:[BX] [DI] 基址变址寻址 1542:0005 C6C5 C6C5 MOV AX, [BP] [DI+02H] 基址变址且相对寻址 153F:0006 B7B6 B7B6 MOV AX, TABLE [BP] [DI] 基址变址且相对寻址 1541:0008 A9A8 A9A8 MOV AX, ES:[BP] [SI] 基址变址寻址 1542:0005 C6C5 C6C5 MOV AX, [BP] [SI+05H] 基址变址且相对寻址 153F:000A BBBA BBBA MOV AX, 03H [BP] [DI] 基址变址且相对寻址 153F:0007 B8B7 B8B7 MOV AX, [BP] [SI] 基址变址寻址 153F:0005 B6B5 B6B5 MOV AX, [BP+02H] [DI+03H] 基址变址且相对寻址 153F:0009 BAB9 BAB9 MOV AX, TABLE [BP+02H] [DI+03H] 基址变址且相对寻址 1541:000D AEAD AEAD 1. 编写求十进制数12678532与21736543之和的程序,并将和以十进制数的形式送屏幕显示。 STACK SEGMENT STACK STACK DW 100H DUP(?) TOP LABEL WORD STACK ENDS ;堆栈段 DATA SEGMENT ADD1 DD 12678532H ADD2 DD 21736543H SUM DD ? DATA ENDS ;数据段 CODE SEGMENT ;代码段 ASSUME CS:CODE,DS:DATA,SS:STACK START: MOV AX,DATA MOV DS,AX MOV AX,STACK MOV SS,AX LEA SP,TOP LEA SI,ADD1 LEA DI,ADD2 MOV AL,[SI] ADD AL,[DI] DAA MOV BYTE PTR SUM,AL MOV AL,[SI+1] ADC AL,[DI+1] DAA MOV BYTE PTR SUM+1,AL MOV AL,[SI+2] ADC AL,[DI+2] DAA MOV BYTE PTR SUM+2,AL MOV AL,[SI+3] ADC AL,[DI+3] DAA MOV BYTE PTR SUM+3,AL MOV AX,WORD PTR SUM+2 CALL DISPAX MOV AX,WORD PTR SUM CALL DISPAX MOV AH,4CH INT 21H DISPAL PROC NEAR PUSH AX PUSH CX PUSH DX PUSH AX MOV CL,4 SHR AL,CL CALL CHANG MOV AH,02 MOV DL,AL INT 21H POP AX AND AL,0FH CALL CHANG MOV AH,02 MOV DL,AL INT 21H POP DX POP CX POP AX RET DISPAL ENDP CHANG PROC NEAR CMP AL,10 JNGE CHANG1 ADD AL,7 CHANG1: ADD AL,30H RET CHANG ENDP DISPAX PROC NEAR XCHG AL,AH CALL DISPAL XCHG AH,AL CALL DISPAL RET DISPAX ENDP CODE ENDS END START 2. 有一个首地址为A的N字数组,请编程序使该数组中的数按从大到小的次序排列。 STACK SEGMENT STACK DB 256 DUP(?) STACK ENDS DATA SEGMENT DATA1 DW 7800H,6832H,0000H,87H,1275H,0EC34H STRING1 DB input number:,0DH,0AH,$ STRING2 DB The numbers from large to small is:,0DH,0AH,$ DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK START: MOV AX,DATA MOV DS,AX MOV ES,AX MOV AX,STACK MOV SS,AX LEA DX,STRING1 MOV AH,09H INT 21H MOV CX,6 LEA SI,DATA1 L1: MOV AX,[SI] ADD SI,2 CALL DISPAX CALL DISPCR LOOP L1 MOV CX,5 LEA SI,DATA1 ADD SI,10 LP1: PUSH CX PUSH SI LP2: MOV AX,[SI] CMP AX,[SI-2] JBE NOXCHG XCHG AX,[SI-2] MOV [SI],AX NOXCHG: DEC SI DEC SI LOOP LP2 POP SI POP CX LOOP LP1 LEA DX,STRING2 MOV AH,09H INT 21H MOV CX,6 LEA SI,DATA1 L2: MOV AX,[SI] ADD SI,2 CALL DISPAX CALL DISPCR LOOP L2 MOV AH,4CH INT 21H DISPAL PROC PUSH AX PUSH CX PUSH DX PUSH AX MOV CL,4 SHR AL,CL CALL CHANG MOV AH,02H MOV DL,AL INT 21H POP AX AND AX,0FH CALL CHANG MOV AH,02H MOV DL,AL INT 21H POP DX POP CX POP AX RET DISPAL ENDP CHANG PROC CMP AL,10 JNGE CHANG1 ADD AL,7 CHANG1: ADD AL,30H RET CHANG ENDP DISPAX PROC XCHG AL,AH CALL DISPAL XCHG AH,AL CALL DISPAL RET DISPAX ENDP DISPCR PROC PUSH AX PUSH DX MOV AH,2 MOV DL,0AH INT 21H MOV AH,2 MOV DL,0DH INT 21H POP DX POP AX RET DISPCR ENDP CODE ENDS END START 3.编写如下程序,并在机器上调试成功。程序采用菜单式选择,可以接收用户从键盘输入的四个命令(1-4),各命令功能分别为: (1)按下“1”键,完成字符串小写字母变成大写字母。 (2)按下“2”键,完成找最大值 (3)按下“3”键,完成排序 (4)按下“4”键,结束程序运行,返回系统提示符。 DISPL MACRO STR PUSH DX PUSH AX LEA DX,STR MOV AH,09H INT 21H POP AX POP DX ENDM ISCONTINUE MACRO L DISPS 15,10,SMENU MOV AH,08H INT 21H CMP AL,1BH JNE L JMP MAIN ENDM CURSOR MACRO CURX,CURY PUSH AX PUSH BX PUSH DX MOV AH,02H MOV DH,CURX MOV DL,CURY MOV BH,0 INT 10H POP DX POP BX POP AX ENDM DISPS MACRO X,Y,STR PUSH AX PUSH BX PUSH DX MOV AH,02H MOV BH,00H MOV DH,X MOV DL,Y INT 10H LEA DX,STR MOV AH,09H INT 21H POP DX POP BX POP AX ENDM SCROLL MACRO N,ULR,ULC,LRR,LRC,ATT PUSH AX PUSH BX PUSH CX PUSH DX MOV AH,06H MOV AL,N MOV CH,ULR MOV CL,ULC MOV DH,LRR MOV DL,LRC MOV BH,ATT INT 10H POP DX POP CX POP BX POP AX ENDM PREP MACRO T LEA SI,INBUF+1 LEA DI,OUTBUF SCROLL 21,2,0,22,79,0FH DISPS 3,20,T DISPS 6,2,CAPION DISPS 8,2,INCAP MOV AH,0AH INT 21H MOV CH,0 MOV CL,[SI] INC SI ENDM STACK SEGMENT STACK STACK DB 100H DUP(?) TOP LABEL WORD STACK ENDS DATA SEGMENT BASE DW MAIN,LTC,FMV,SORTS,EXIT WELCM DB Welcome to this program!$ MMENUC DB Please input the number!$ MMENU1 DB 1 -Lowercase Letters To Capital Letters$ MMENU2 DB 2 -Find The Maximum figure$ MMENU3 DB 3 -Sort$ MMENU4 DB 4 -Exit!$ SMENU DB Press Any Key To restart,Press "ESC" To Return To Main Menu!$ WROCAP DB WRONG! You have press " " key! Please input a number between 1 and 4!$ CAPION DB Please Input Your Strings and End With "Enter" Key!$ INCAP DB Your Input Is: $ INBUF DB 100 DB ? DB 100 DUP(?) OUTCAP DB My Output Is: $ OUTBUF DB 100 DUP(?) MAXCAP DB The char of max ASCII is: .$ ERRINF DB ERROR! Please check the format you input!$ TDINV DB Invalid time data! Input again!$ NODATCAP DB You have input nothing!$ TIME DB 8 DUP (:),12 DUP ( ) DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK START: MOV AX,DATA MOV DS,AX MOV ES,AX MOV AX,STACK MOV SS,AX LEA SP,TOP LEA DX,INBUF CLC MAIN: SCROLL 0,0,0,24,79,0 SCROLL 25,0,0,24,79,50H SCROLL 21,2,0,22,79,0FH DISPS 8,20,MMENUC DISPS 10,20,MMENU1 DISPS 12,20,MMENU2 DISPS 14,20,MMENU3 DISPS 16,20,MMENU4 ML: CURSOR 19,1DH MOV AH,01H INT 21H CMP AL,31H JL ERROR CMP AL,35H JG ERROR AND AX,00FH LEA BX,BASE SHL AL,1 ADD BX,AX JMP WORD PTR [BX] ; CMP AL,1 ; JE LTC ; CMP AL,2 ; JE FMV ; CMP AL,3 ; JE SORTS ; CMP AL,4 ; JE EXIT ERROR: CMP AL,0DH JE MCR MOV [WROCAP+23],AL ;Other char MOV [WROCAP+24], JMP D MCR: MOV WORD PTR [WROCAP+23],RC D: DISPS 20,5,WROCAP ;Show the wrong information JMP ML LTC: CALL LLTOCL ISCONTINUE LTC FMV: CALL FMAXV ISCONTINUE FMV SORTS: CALL SORT ISCONTINUE SORTS EXIT: SCROLL 0,0,0,24,79,0 MOV AH,4CH INT 21H LLTOCL PROC REFLASHL:PREP MMENU1 CMP CL,0 JE REFLASHL LL1: MOV AL,[SI] CMP AL,a JB MTOB ;NO CHANGE CMP AL,z JA MTOB SUB AL,20H ;Convert MTOB: MOV [DI],AL INC SI INC DI LOOP LL1 MOV BYTE PTR [DI],$ DISPS 10,2,OUTCAP DISPS 10,17,OUTBUF RET LLTOCL ENDP FMAXV PROC PUSH BX REFLASHF:PREP MMENU2 CMP CL,0 JE REFLASHF MOV AL,0 FL1: CMP AL,[SI] JA NEXT MOV AL,[SI] NEXT: INC SI LOOP FL1 MOV [MAXCAP+26],AL DISPS 10,2,MAXCAP POP BX RET FMAXV ENDP SORT PROC PREP MMENU3 DEC CX ADD SI,CX MOV BYTE PTR [SI+1],$ LP1: PUSH CX PUSH SI LP2: MOV AL,[SI] CMP AL,[SI-1] JBE NOXCHG XCHG AL,[SI-1] MOV [SI],AL NOXCHG: DEC SI LOOP LP2 POP SI POP CX LOOP LP1 DISPS 10,2,OUTCAP DISPS 10,17,INBUF[2] RET SORT ENDP BCDASC PROC NEAR PUSH BX CBW MOV BL,10 DIV BL ADD AL,30H MOV TIME[SI],AL INC SI ADD AH,30H MOV TIME[SI],AH INC SI POP BX RET BCDASC ENDP CODE ENDS END START 按下4键
展开阅读全文
提示  淘文阁 - 分享文档赚钱的网站所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:西电微机基础原理上机课后复习完整编辑版.doc
链接地址:https://www.taowenge.com/p-2626530.html
关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

收起
展开