广工自动化微机实验(胶印).docx

上传人:飞**** 文档编号:44024950 上传时间:2022-09-20 格式:DOCX 页数:32 大小:19.28KB
返回 下载 相关 举报
广工自动化微机实验(胶印).docx_第1页
第1页 / 共32页
广工自动化微机实验(胶印).docx_第2页
第2页 / 共32页
点击查看更多>>
资源描述

《广工自动化微机实验(胶印).docx》由会员分享,可在线阅读,更多相关《广工自动化微机实验(胶印).docx(32页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、(大神出品,不保证没错误)实验一:1.1:STACK SEGMENT STACKDW 64 DUP(?)STACK ENDSDATA SEGMENTORG 0500HDATA1 DB 5 DUP(?)ORG 050AHDATA2 DB 5 DUP(?)DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATA,SS:STACKSTART: MOV AX,DATAMOV DS,AXMOV CX,5MOV DI,OFFSET DATA1MOV SI,OFFSET DATA2LAB1: MOV BL,0FFHMOV AL,DICMP AL,3AHJNB OKSUBAL,3

2、0HJC OKMOV BL,ALOK: MOV AL,BLMOV SI,ALINC DIINC SILOOP LAB1MOV AH,4CHINT 21HCODE ENDSEND START1.2:STACK SEGMENT STACKDW 64 DUP(?)STACK ENDSDATA SEGMENTORG 0500HDATA1 DW 78EDHORG 0510HDATA2 DB 5 DUP(?)DATA ENDSCODE SEGMENTASSUME CS:CODE,DS:DATA,SS:STACKSTART: MOV AX,DATAMOV DS,AXLEA SI,DATA1LEA DI,DA

3、TA2+4MOV BX,000AHMOV CX,0005HMOV AX,SIAA0: MOV DX,0000HDIV BXMOV DI,DLDEC DILOOP AA0MOV AH,4CHINT 21HCODE ENDSEND START1.3:STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0500HDATA1 DB 2 DUP(?) ORG 050AHDATA2 DB 4 DUP(?)DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART: MOV AX,DATA MOV DS

4、,AX MOV DI,OFFSET DATA1 MOV SI,OFFSET DATA2 MOV AX,DI MOV CX,0004H MOV BX,1000HA1: MOV DX,0000H DIV BX CMP AL,0AH JAE A3 ADD AL,30HA2: MOV SI,AL INC SI PUSH DX MOV AX,BX MOV BX,0010H MOV DX,0000H DIV BX MOV BX,AX POP DX MOV AX,DX LOOP A1 INT 03H A3: SUB AL,0AH ADD AL,41H JMP A2CODE ENDS END START1.4

5、STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0500HDATA1 DB 8 DUP(?) ORG 0510HDATA2 DB 8 DUP(?)DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART: MOV AX,DATA MOV DS,AX MOV DI,OFFSET DATA1 MOV SI,OFFSET DATA2 MOV CX,0004H MOV BL,0AH MOV AH,00HA1: MOV AL,DI MUL BL INC DI MOV DL,DI ADD AL,

6、DL MOV SI,AL INC DI INC SI LOOP A1 INT 03HCODE ENDS END START 1.5STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0600HDATA1 DB ? ORG 0610HJIEGUO DB ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART:MOV AX,DATA MOV DS,AX LEA SI,DATA1 LEA DI,JIEGUO XOR CH,CH MOV CL,04H MOV DL,0AH MOV DH,04

7、H A1:MOV AL,SI AND AL,0FH MOV BL,AL MOV AL,SI SHR AL,CL MUL DL ADD AL,BL MOV DI,AL INC SI INC DI DEC DH JNZ A2 JMP A3 A2:JMP A1 A3:INT 03HCODE ENDS END START1.6STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0300HDATA1 DB 2 DUP(?) ORG 0308HDATA2 DB 5 DUP(?)DATA ENDSCODE SEGMENT ASSUME CS:

8、CODE,DS:DATASTART: MOV AX,DATA MOV DS,AX MOV DI,OFFSET DATA1 MOV SI,OFFSET DATA2 MOV AX,DI MOV BX,2710H ;十进制数的10000 MOV CX,0005HA1: MOV DX,0000H DIV BX MOV SI,AL INC SI PUSH DX MOV AX,BX MOV BX,0AH MOV DX,0000H DIV BX MOV BX,AX POP DX MOV AX,DX LOOP A1 INT 03HCODE ENDS END START实验二:2.1STACKS SEGMENT

9、DW 64 (?)STACKS ENDSDATAS SEGMENTORG 0700HX DW 0208HY DW 0509HZ DW 0304HORG 0710H Q DW ? DATAS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKSSTART: MOV AX,DATAS MOV DS,AX MOV AX,X ADD AX,Y ;X+Y结果存入AX中 AAA ;BCD码调整 SUB AX,Z ;X+Y-Z结果存入AX AAS ;BCD码调整 MOV Q,AX ;Q存入3710单元 MOV AH,4CH INT 21H CODES EN

10、DS END START2.2STACKS SEGMENTDW 64 DUP(?)STACKS ENDSDATAS SEGMENT ORG 0500HTAB DW 0010H,0020H,0030H,0040H,0050H,0060HORG 0510HJIEGUO DB 2 DUP(?)DATAS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKSSTART: MOV AX,DATAS MOV DS,AX SUB AX,AX MOV CX,06H LEA DI,TABBBB: ADD AX,DI INC DI INC DI DEC CX J

11、NZ BBB MOV BX,06H CWD DIV BX MOV BX,0AH CWD DIV BX LEA SI,JIEGUO MOVSI,AL INC SI MOVSI,DL ;INT 03H MOV AH,4CH INT 21HCODES ENDSEND START2.3STACK SEGMENT STACKDW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0500HDATA1 DB 10H,15H,0FH ORG 0510HJIEGUO DB ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART:MOV AX,

12、DATA MOV DS,AX LEA SI,DATA1 LEA DI,JIEGUO MOV CX,0002H MOV AL,SI A1:INC SI ADD AL,SI LOOP A1 MOV BL,04H MUL BL MOV DL,64H MOV AH,00H DIV DL MOV DI,AL INC DI MOV AL,AH MOV AH,00H MOV DL,0AH DIV DL MOV DI,AL INC DI MOV DI,AH INT 03HCODE ENDS END START2.4DATAS SEGMENT ORG 0550H X DB 65H,67H,87H,19H,32H

13、,54H,76H,98H ;低位在低地址,高位在高地址 Y DB 65H,67H,87H,19H,32H,54H,76H,98H DATAS ENDSSTACKS SEGMENTSTACKS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKSSTART: MOV AX,DATAS MOV DS,AX MOV SI,00H ;变址存于SI MOV CX,04H ;循环次数为4 CLC ;CF位清零BBB:MOV AX,0550HSI ;取被加数4位存于AX中 ADC AX,0558HSI ;被加数4位减去减数4位 MOV 0560HSI,AX

14、 ;结果存入3060H开始的单元 ADD SI,02H ;变址加2 DEC CXJNZ BBB ;DI不为零时继续循环 MOV AH,4CH INT 21HCODES ENDS END START2.5STACKS SEGMENTDW 64 (?)STACKS ENDSDATAS SEGMENTORG 0300HX DW 0608HY DW 0509HZ DW 0306HORG 0310H Q DW ? DATAS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKSSTART: MOV AX,DATAS MOV DS,AX MOV AX,X

15、 SUB AX,Y ;X-Y结果存入AX中 ;AAS ;BCD码调整 ADD AX,Z ;X-Y+Z结果存入AX ;AAA ;BCD码调整 MOV Q,AX ;Q存入3710单元 MOV AH,4CH INT 21H CODES ENDS END START2.6DATAS SEGMENT ORG 0550H X DB 65H,67H,87H,19H,32H,54H,76H,98H ;低位在低地址,高位在高地址 Y DB 77H,39H,32H,48H,95H,28H,43H,56H DATAS ENDSSTACKS SEGMENTSTACKS ENDSCODES SEGMENT ASSUME

16、 CS:CODES,DS:DATAS,SS:STACKSSTART: MOV AX,DATAS MOV DS,AX MOV SI,00H ;变址存于SI MOV CX,04H ;循环次数为4 CLC ;CF位清零BBB:MOV AX,0550HSI ;取被加数4位存于AX中 SBB AX,0558HSI ;被加数4位减去减数4位 MOV 0560HSI,AX ;结果存入0506H开始的单元 ADD SI,02H ;变址加2 DEC CXJNZ BBB ;DI不为零时继续循环 MOV AH,4CH INT 21HCODES ENDS END START实验三:3.1DATAS SEGMENTOR

17、G 0500H ;BUFSIZE DB 9 ;单元数据个数 NUM DB 09h,12H,80H,78H,0C8H,00H,00H,0FEH,99H,34H ORG 0510H RESULT DB 3 DUP(0,0,0)DATAS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATASSTART: MOV AX,DATAS MOV DS,AX MOV DI,OFFSET NUM ;送数据地址到DI LEA BP,RESULT MOV SI,00H MOV CX,di ;循环次数mov ch,00hinc diAGAIN:TEST BYTE PTRDI,80H J

18、Z COUNT ;ZF=1,此数据为非负数,转移 INC BYTE PTRBP+1 ;ZF=0,此数据为负数 JMP DONECOUNT:CMP BYTE PTRDI,01H JNC NEXT INC BYTE PTRBP+2 ;CF=1,此数据为0 JMP DONENEXT: INC BYTE PTRBP ;CF=0,此数据为正数DONE: INC DI LOOP AGAIN MOV AH,4CH INT 21HCODES ENDSEND START3.2STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0200HDAT0

19、DB 3 DUP(?) ORG 0204HDATE0 DW ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART: MOV AX,DATA MOV DS,AX LEA SI,DAT0 LEA DI,DATE0 MOV AL,SI MOV AH,SI+1 MOV BL,SI+2 CMP AL,AH JZ A1 CMP AL,BL JZ A2 MOV DI,SI JMP A4A2:ADD SI,1 MOV DI,SI JMP A4A1:CMP AL,BL JZ A3 ADD SI,2 MOV DI,SI JMP A4A3:MOV DI,0FFFFHA

20、4:MOV AH,4CH INT 21HCODE ENDS END START 3.3DATAS SEGMENT ORG 3700H SCORE DB 64H,61H,5DH,55H,52H,51H,44H,45H,47H,48H,4DH,4FH,3CH,3FH,40H,41H,33H,56H,59H,30H ORG 3720H TOT DB 5 DUP(0,0,0,0,0) DATAS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATASSTART: MOV AX,DATAS MOV DS,AX MOV CX,20 ;循环次数 MOV SI,OFFSET SC

21、ORE ;分数首地址送SIBBB:MOV BP,OFFSET TOT MOV AL,BYTE PTRSI CLC CMP AL,60 JNB S70 ;CF=0,大于60跳转 JMP DONES70: INC BP CMP AL,70 JNB S80 ;CF=0,大于70跳转 JMP DONES80: INC BP CMP AL,80 JNB S90 ;CF=0,大于80跳转 JMP DONES90: INC BP CMP AL,90 JNB S100 ;CF=0,大于90跳转 JMP DONES100: INC BPDONE:INC BYTE PTRBP ;对应分数段人数加1 INC SI

22、LOOP BBB MOV AH,4CH INT 21HCODES ENDSEND START3.4DATAS SEGMENT ORG 0300H LEN DW 0020HNUM (定义20个数,由于太长,Worl里面显示成了几行,换行要在行首加DB)DB 12H,34H,34H,54H,65H,65H,53H,55H,09H,69H,0FCH,65H,0AAH,0FBH,98H,88H, 0C3H,44H,12H,12H,45H,45H,76H,76H,32H,32H,76H,76H,0B7H,86H,21H,09H ORG 0400H MAX DB ? ADDRESS DW ?DATAS E

23、NDSCODES SEGMENT ASSUME CS:CODES,DS:DATASSTART: MOV AX,DATAS MOV DS,AX LEA SI,NUM MOV AL,00H MOV CX,LEN ;循环次数 MOV ADDRESS,0302H CLC BBB: CMP AL,BYTE PTRSI ;讲AL中数据与(SI)中数据比较 JNB NEXT CLC ;CF=1,CF清零,记录数据地址 MOV AL,BYTE PTRSI MOV ADDRESS,SINEXT:INC SI LOOP BBB MOV MAX,AL ;将AL中最大数存入指定地址 MOV AH,4CH INT 21

24、HCODES ENDSEND START3.5STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0300HX DB ? ORG 0305HY DB ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART:MOV AX,DATA MOV DS,AX LEA SI,X LEA DI,Y MOV CX,0003H A1:MOV AL,SI INC SI AND AL,AL JNS A2 MOV BYTE PTRDI,0BH INC DI LOOP A1 JMP EXIT A2:JZ A3

25、 MOV BYTE PTRDI,0AH INC DI LOOP A1 JMP EXIT A3:MOV BYTE PTRDI,00H INC DI LOOP A1 EXIT:INT 03HCODE ENDS END START3.6STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENT ORG 0200HX DB ? ORG 0105HY DB ?DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART:MOV AX,DATA MOV DS,AX LEA SI,X LEA DI,Y MOV CX,00

26、03H A1:MOV AL,SI INC SI CMP AL,0C8H JBE A2 MOV BYTE PTRDI,90H INC DI LOOP A1 JMP EXIT A2:CMP AL,64H JNZ A3 MOV BYTE PTRDI,50H INC DI LOOP A1 JMP EXIT A3:CMP AL,32H JAE A4 MOV BYTE PTRDI,00H INC DI A4:LOOP A1 EXIT:INT 03HCODE ENDS END START实验四:1. 修改实验程序:(1)STACK SEGMENT STACKDW 64 DUP(?)STACK ENDSCOD

27、E SEGMENTASSUME CS:CODE,SS:STACKSTART: MOV BX,03HA0:CMP BX,00HJZ A3PUSH BX ;现场保护MOV CX,09H ;9个字符MOV BL,31HMOV AH,02HA1:MOV DL,BLINT 21HINC BLPUSH CXMOV CX,0FFFFHA2:LOOP A2POP CXDEC CXJNZ A1MOV DL,0DHMOV AH,02HINT 21HMOV DL,0AHMOV AH,02HINT 21HPOP BXDEC BXJMP A0A3:MOV AH,4CHINT 21HCODE ENDS END START

28、(2)STACK SEGMENT STACKDW 64 DUP(?)STACK ENDSCODE SEGMENTASSUME CS:CODE,SS:STACKSTART: MOV BX,04HA0:CMP BX,00HJZ A3PUSH BX ;现场保护MOV CX,001AH ;26个字母MOV BL,41HMOV AH,01HA1:MOV AL,BLINT 10HINC BLDEC CXJNZ A1MOV CX,09H ;9个字符MOV BL,31HMOV AH,01HA2:MOV AL,BLINT 10HINC BLDEC CXJNZ A2MOV DL,0DH ;回车换行MOV AH,0

29、2HINT 21HMOV DL,0AHMOV AH,02HINT 21HPOP BXDEC BXJMP A0A3:INT 03HCODE ENDS END START(3)STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENTDATE1 DB HOW ARE YOU TODAY?DATA ENDSCODE SEGMENT ASSUME CS:CODE,SS:STACKSTART:MOV AX,DATA MOV DS,AXA1: MOV AH,06H LEA BX,DATE1 INT 10H INT 03H CODE ENDS END STA

30、RT(4)STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSDATA SEGMENTDATE1 DB GOOD AFTERNOONDATA ENDSCODE SEGMENT ASSUME CS:CODE,SS:STACKSTART:MOV AX,DATA MOV DS,AX MOV CX,000EH LEA SI,DATE1A1: MOV DL,SI MOV AH,02H INT 21H CALL DELAY INC SI LOOP A1 MOV AH,4CH INT 21HDELAY:PUSH CX PUSH AX MOV CX,2000HA2:MOV AX

31、,0FFFFHA3:DEC AX JNE A3 LOOP A2 POP AX POP CX RET CODE ENDS END START2. 编程练习4.1STACK SEGMENT STACK DW 64 DUP(?)STACK ENDSCODE SEGMENT ASSUME CS:CODE,SS:STACKSTART:MOV AX,5678H+6666H-1234H (注:其余5题把该算式改为相应的即可) MOV BX,AX MOV CL,4H MOV SI,0004HA0: ROL BX,CLMOV AX,BXAND AX,000FHCMP AL,0AHJGE A2ADD AL,30H

32、JMP A3A2:ADD AL,37HA3:MOV AH,02HMOV DL,ALINT 21HDEC SIJNZ A0MOV AH,4CHINT 21H CODE ENDS END START实验五:5.1STACK SEGMENT STACKDW 64 DUP(?)STACK ENDSCODE SEGMENTASSUME CS:CODESTART:MOV AX,0000HMOV DS,AXMOV AX,OFFSET IRQ6MOV SI,0038HMOV SI,AXMOV AX,CSMOV SI,003AHMOV SI,AXMOV AL,11HOUT 20H,ALMOV AL,08HOUT

33、 21H,ALMOV AL,04HOUT 21H,ALMOV AL,01HOUT 21H,ALMOV AL,0BFHOUT 21H,ALMOV CX,000FHA1: CMP CX,0000HJNZ A2MOV AL,80HOUT 21H,ALA2:STIJMP A1IRQ6:MOV AX,0136HINT 10HMOV AX,0120HINT 10HDEC CXMOV AL,20HOUT 20H,ALIRETCODE ENDSEND START5.2STACK SEGMENT STACK DW 64 DUP (?)STACK ENDSDATA SEGMENTTABLE DB 39H,41H,

34、38H,42H,37H,43H DATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATASTART:MOV AX,DATA MOV DS,AX PUSH DS MOV AX,0000H MOV DS,AX MOV AX,OFFSET IRQ6 MOV SI,0038H MOV SI,AX MOV AX,CS MOV SI,003AH MOV SI,AX POP DS MOV AL,11H OUT 20H,AL MOV AL,08H OUT 21H,AL MOV AL,04H OUT 21H,AL MOV AL,01H OUT 21H,AL MOV AL,0BFH OUT 21H,AL MOV CX,000CH

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作报告

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

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