汇编DEBUG调试
汇编调试程序DEBUG的常用命令和功能,DEBUG环境下调试程序的方法.
带图片的链接:
添加链接描述
两个无符号数相加,将结果数存入指定地址单元。被加数,加数及和存放地址及数据如下:
地址 数据
被加数 2000:0000 9FH
2000:0001 6BH
加数 2000:0002 5CH
2000:0003 42H
- 和 2000:0004
- 2000:0006
-e 2000:0000 9f 6b 5c 42
-a 1000:0
mov ax,[0000H]
mov bx,[0002H]
add ax,bx
mov 2000:[0004],ax
-r cs
1000
-r ip
0
-t -t -t -t
2.两个无符号数相减,将差存入指定地址单元。被减数,减数及差的存放地址及数据如下:
地址 数据
被减数 2000:0100 8C
2000:0101 42
减数 2000:0102 92
2000:0103 5A
差 2000:0104
2000:0105
-e 2000:0100 8c 42 92 5a
-a 1000:0
mov ax,2000:[0100H]
mov bx,2000:[0102]
sub ax,bx
mov 2000:[0104],ax
-r cs
1000
-r ip
0
-t -t -t -t
3.两个无符号数相乘,将积存入指定地址单元。被乘数,乘数及积存放的地址及数据如下:
地址 数据
被乘数 2000:1000 56
2000:1001 2C
乘数 2000:1002 3A
2000:1003 1C
- 积 2000:1004
- 2000:1007
-e 2000:0200 56 2C 3A 1C
-a 1000:0000
mov ax,2000:[1000]
mov bx,2000:[1002]
mul bx
mov 2000:[1004],ax
mov 20000:[1006],dx
-r cs
1000
-r ip
0
-t -t -t -t -t
4.两个无符号数相除,将商及余数存入指定的地址单元。被除数,除数,商及余数存放的地址及数据如下:
地址 数据
被除数 2000:0200 2A
2000:0201 3B
2000:0202 4C
2000:0203 5D
除数 2000:0204 7C
2000:0205 5D
商 2000:0206
2000:0207
余数 2000:0208
2000:0209
-e 2000:0200 2a 3b 4c 5d 7c 5d
-a 1000:0
mov ax,2000:[0200]
mov bx,2000:[0202]
div bx
mov 2000:[0206],ax
mov 2000:[0208],dx
-r cs
1000
-r ip
0
-t -t -t -t -t
屏幕显示计算机提问:
Do you like this book ?
若用户回答N, 计算机回答:
You may go to the next store.
若用户回答Y, 计算机回答:
I think you will buy it.
DATA SEGMENT
SEN1 DB 0DH,0AH,“Do you like this book “,0x3fh,0DH,0AH,””
SEN3 DB 0DH,0AH,“I think you will buy it”,0DH,0AH,""
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:MOV AX,DATA
MOV DS,AX
MOV Ah,2h
MOV BH,0
MOV DH,5
MOV DL,12
INT 10H
BEAGIN: MOV DX,OFFSET SEN1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV AH,09H
CMP AL,'N'
JE NOT
CMP AL,'Y'
JE OK
CMP AL,'Q'
JE END
JMP KEY
OK: MOV DX,OFFSET SEN2
INT 21H
JMP BEAGIN
NOT: MOV DX,OFFSET SEN3
INT 21H
JMP BEAGIN
KEY:MOV DX,OFFSET SEN4
INT 21H
JMP BEAGIN
END: NOP
MOV AH,4CH
INT 21H
CODE ENDS
END START
屏幕显示计算机提问:
Would you like tea or coffee?
用户用键盘输入回答,并显示出来.
DATA SEGMENT
SEN DB 0dh,0ah,“Would you like tea or coffee”,0x3fh,0dh,0ah,""
SEN3 DB 0DH,0AH,"$"
STRING DB 20,0,20 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:MOV AX,DATA
MOV DS,AX
MOV Ah,2h
MOV BH,0
MOV DH,5
MOV DL,12
INT 10H
MOV DX,OFFSET SEN
MOV AH,09H
INT 21H
MOV DX,OFFSET STRING
MOV AH,0AH
INT 21H
MOV CL,STRING+1
XOR CH,CH
ADD DX,CX
MOV BX,DX
MOV BYTE PTR[BX+2],'$'
MOV AH,09H
MOV DX,OFFSET SEN3
INT 21H
MOV DX,OFFSET STRING
ADD DX,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
按宏汇编语言程序的格式,采用INT 21H 0A号功能调用显示一字符串:
‘I hope you work hard
DATA SEGMENT
SEN DB 30,0,30 DUP(0)
QUE DB “Please input a string which would be displayed on the screen:”,0dh,0ah,""
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV AH,9
MOV DX,OFFSET QUE
INT 21H
MOV AH,0AH
MOV DX,OFFSET SEN
INT 21H
MOV CL,SEN+1
MOV CH,0
ADD DX,CX
MOV BX,DX
MOV BYTE PTR[BX+2],"$"
MOV AH,9
LEA DX,QUE1
INT 21H
LEA DX,SEN
ADD DX,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
按宏汇编语言程序程序的格式,采用INT 21H 2号功能调用显示:
‘ I like computer very much
data segment
str db “I like computer very much.”
count EQU $-str
data ends
code segment
assume ds:data, cs:code
start:mov ax, data
mov ds, ax
MOV AH,2
MOV DH,10
MOV DL,20
INT 10H
mov di, offset str
mov cx, count
MOV AH,02H
S:PUSH CX
MOV CX,1
MOV BH,0
MOV AH,9
MOV BL,10100101B
INT 10H
MOV AH,2
mov DL,[DI]
int 21h
INC DI
POP CX
LOOP S
MOV AH,4CH
INT 21H
code ends
end start
上一篇: 下载文件Utils
下一篇: Laravel Debugbar 调试器