1 / 11

第一次实验的典型问题

第一次实验的典型问题. 常用 DOS 命令用法 :MD,CD, RD,DIR 当前目录问题 文件的扩展名问题 (ASM) 输入错误问题 (0,O; DX,DS) 调试中的数据区映射问题 两种程序结构混用问题. 第二次实验内容:分支程序设计 P29 :例 1.2 P30 :例 1.3 P32 :实验内容 2 P32 :实验内容 3. P32 :实验内容( 3 )代码: DATA SEGMENT STRING1 DB 'ABcdEFGH' STRING2 DB 'ABcDEFGH' RESULT DW (?) DATA ENDS

gisela
Download Presentation

第一次实验的典型问题

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第一次实验的典型问题 • 常用DOS命令用法:MD,CD, RD,DIR • 当前目录问题 • 文件的扩展名问题(ASM) • 输入错误问题(0,O; DX,DS) • 调试中的数据区映射问题 • 两种程序结构混用问题

  2. 第二次实验内容:分支程序设计 P29:例1.2 P30:例1.3 P32:实验内容2 P32:实验内容3

  3. P32:实验内容(3)代码: DATA SEGMENT STRING1 DB 'ABcdEFGH' STRING2 DB 'ABcDEFGH' RESULT DW (?) DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA,ES:DATA START: MOV AX,DATA MOV DS,AX MOV ES,AX

  4. MOV CX,8 LEA SI,STRING1 LEA DI,STRING2 REPZ CMPSB JNZ LAB;遇到了不同字符,ZF为0,转到LAB MOV RESULT,0 JMP EXIT LAB: MOV AX,8 SUB AX,CX MOV RESULT,AX EXIT: MOV AH,4CH INT 21H CODE ENDS END START

  5. 选做题目: 要求从键盘输入2个十进制数,对其求和,将结果在屏幕上显示出来.

  6. ;要求从键盘输入2个十进制数,对其求和,将结果在屏幕上显示出来;要求从键盘输入2个十进制数,对其求和,将结果在屏幕上显示出来 DATA SEGMENT MESS1 DB 'INPUT THE FIRST NUMBER:','$' MESS2 DB 0dh,0ah,'INPUT THE SECOND NUMBER:','$' BUF1 DB 10,0,10 DUP(?) BUF2 DB 10,0,10 DUP(?) BUF3 DB 0dh,0ah,'THE SUM IS:' BUF4 DB 3 DUP(?),'$' DATA ENDS

  7. STACK1 SEGMENT 'STACK' DB 100 DUP(?) STACK1 ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA,SS:STACK1 START PROC FAR PUSH DS MOV AX,0 PUSH AX MOV AX,DATA MOV DS,AX

  8. MOV DX,OFFSET MESS1 MOV AH,9 INT 21H MOV DX,OFFSET BUF1 MOV AH,0AH INT 21H MOV DX,OFFSET MESS2 MOV AH,9 INT 21H

  9. MOV DX,OFFSET BUF2 MOV AH,0AH INT 21H MOV AL,[BUF1+3] AND AL,0FH MOV BL,[BUF2+3] AND BL,0FH ADD AL,BL AAA PUSHF;保存CF OR AL,30H MOV [BUF4+2],AL

  10. MOV AL,[BUF1+2] AND AL,0FH MOV BL,[BUF2+2] AND BL,0FH POPF ADC AL,BL AAA PUSHF OR AL,30H MOV [BUF4+1],AL

  11. MOV AL,'0' POPF ADC AL,0 MOV [BUF4],AL MOV DX,OFFSET BUF3 MOV AH,9 INT 21H RET START ENDP CODE ENDS END START

More Related