LSX-blog

Feed Rss

【转载】Debug常用命令集

12.23.2011, 开发, by .

ADebug (原意杀虫子)这里是机器调试工具。

Debug常用命令集

名称 解释 格式
a (Assemble) 逐行汇编 a [address]
c (Compare) 比较两内存块 c range address
d (Dump) 内存16进制显示 d [address]或 d [range]
e (Enter) 修改内存字节 e address [list]
f (fin) 预置一段内存 f range list
g (Go) 执行程序 g [=address][address…]
h (Hexavithmetic) 制算术运算 h value value
i (Input) 从指定端口地址输入 i pataddress
l (Load) 读盘 l [address [driver seetor>
m (Move) 内存块传送 m range address
n (Name) 置文件名  n filespec [filespec…]
o (Output) 从指定端口地址输出 o portadress byte
q (Quit) 结束  q
r (Register) 显示和修改寄存器 r [register name]
s (Search) 查找字节串  s range list
t (Trace) 跟踪执行  t [=address] [value]
u (Unassemble) 反汇编 u [address ]或range
w (Write) 存盘  w [address[driver sector secnum>
? 联机帮助 ?

debug小汇编a命令

debug小汇编a命令是一个很有用的功能,许多的小程序都要他来做。

not 指令(取反运算)寄存器求反

(逻辑运算)存储器求反

and 指令(与运算) (逻辑运算)

寄存器 and 寄存器 寄存器
寄存器 and 存储器 寄存器

存储器 and 寄存器 存储器

立即数 and 存储器 存储器

立即数 and 累加器 累加器

or 指令(或运算)(逻辑运算)

寄存器 or 寄存器 寄存器
寄存器 or 存储器 寄存器

存储器 or 寄存器 存储器

立即数 or 存储器 存储器

立即数 or 累加器 累加器

test 指令(测试) (逻辑运算)

寄存器 test 寄存器
寄存器 test 存储器
寄存器 test 立即数
存储器 test 立即数
累加器 test 立即数

movs 指令(串传送)(字符串操作指令)
单个传送
重复传送

cmps 指令(串比较) (字符串操作指令)
单个比较
重复比较

scas 指令(串扫描)(字符串操作指令)
单个搜索
重复搜索

lods 指令(装入串)
(字符串操作指令)
单个装载
重复装载

stos 指令(保存串) (字符串操作指令)
单个存储
重复存储

add 指令(加法)(算术指令)
adc 指令(带进位加法)
寄存器+寄存器 寄存器
寄存器+存储器 寄存器
存储器+寄存器 存储器
立即数+存储器 存储器
立即数+累加器 累加器

inc 指令(加1)(算术指令)
存储器增量
寄存器增量

sub 指令(减法) (算术指令)
sbb 指令(带借位减法)
寄存器-寄存器 寄存器
寄存器-存储器 寄存器
存储器-寄存器 存储器
立即数-存储器 存储器
立即数-累加器 累加器

dec 指令(减1)(算术指令)
存储器减量
寄存器减量

nec 指令(求反,以0减之)
寄存器求补
存储器求补

Debug实战
1.查看主板的生产日期,版本
D ffff:05
D fe00:0e

2.模拟Rest键功能
A
:100 jmp ffff:0000
:105
g

3.快速格式化软盘
L 100 0 0 * ‘插入一张己格式化软盘
W 100 0 0 * ‘放入一张欲格式化软盘
注:* 分别为:720K e |1.2M id |1.44M 21

4.硬盘格式化两种方法
(1)G=c800:05
(2) A 100
mov ax,0703
mov cx,0001
mov dx,0080
int 13
int 3
g 100
5.加速键盘
A
mov ax,0305
mov bx,0000
int 16
int 20
rcx
10
n fast.com
w
q

7.硬盘DOS引导记录的修复
在软驱中放入一张己格式化软盘
debug
-l 100 2 0 1
-w 100 0 50 1
把软盘放入故障机软驱中
debug
-l 100 0 50 1
-w 100 2 0 1
-q
8.清coms中setup口令
debug
-a
mov bx,0038
mov cx,0000
mov ax,bx
out 70,al
inc cx
cmp cx,0006
jnz 0106
int 20
-rcx
:20
-nclearpassword.com
-w
-q
注:以上适合super与dtk机,对于ast机,因为他的口令放在coms的4ch-51h地址处,
只要将:mov bx,0038 改为: mov
bx,004c即可
9.取消coms的密码(将coms数据清为初始化)
-o 70,10
-o 71,10
-g
-q
10.将硬盘主引导记录保存到文件中

debug
-a
mov ax,0201
mov bx,0200
mov cx,0001
mov dx,0080
mov int 13
int 3
-rcx
:200
-nboot.dat
-w
-q
11.调用中断实现重启计算机(可以成文件)
debug
-a
int 19
int 20
-rcx
:2
-nreset.com
-w
-q

DEBUG主要命令

DEBUG是为汇编语言设计的一种高度工具,它通过单步、设置断点等方式为汇编语言程序员提供了非常有效的调试手段。
一、DEBUG程序的调用
在DOS的提示符下,可键入命令:
C:/DEBUG [D:][PATH][FILENAME[.EXT>[PARM1][PARM2]
其中,文件名是被调试文件的名字。如用户键入文件,则DEBUG将指定的文件装入存储器中,用户可对其进行调试。如果未键入文件名,
则用户可以用当前存储器的内容工作,或者用DEBUG命令N和L把需要的文件装入存储器后再进行调试。命令中的D指定驱动器PATH为路径,
PARM1和PARM2则为运行被调试文件时所需要的命令参数。
在DEBUG程序调入后,将出现提示符,此时就可用DEBUG命令来调试程序。
二、DEBUG的主要命令
1、显示存储单元的命令D(DUMP),格式为:
_D[address]或_D[range]
例如,按指定范围显示存储单元内容的方法为:
-d100 120
18E4:0100 c7 06 04 02 38 01 c7 06-06 02 00 02 c7 06 08 02 G…8.G…..G…
18E$:0110 02 02 bb 04 02 e8 02 00-CD 20 50 51 56 57 8B 37 ..;..h..M PQVW.
7
18E4:0120 8B
其中0100至0120是DEBUG显示的单元内容,左边用十六进制表示每个字节,右边用ASCII字符表示每个字节,·表示不可显示的字符。
这里没有指定段地址,D命令自动显示DS段的内容。如果只指定首地址,则显示从首地址开始的80个字节的内容
。如果完全没有指定地址,则显示上一个D命令显示的最后一个单元后的内容。
2、修改存储单元内容的命令有两种。
·输入命令E(ENTER),有两种格式如下:第一种格式可以用给定的内容表来替代指定范围的存储单元内容。命令格式为:
-E address [list]
例如,-E DS:100 F3’XYZ’8D
其中F3,’X’,’Y’,’Z’和各占一个字节,该命令可以用这五个字节来替代存储单元DS:0100到0104的原先的内容。 第二种格式则是采用逐个单元相继修改的方法。命令格式为:
-E address
例如,-E DS:100
则可能显示为:
18E4:0100 89.-
如果需要把该单元的内容修改为78,则用户可以直接键入78,再按”空格”键可接着显示下一个单元的内容,如下:
18E4:0100 89.78 1B.-
这样,用户可以不断修改相继单元的内容,直到用ENTER键结束该命令为止。
·填写命令F(FILL),其格式为:
-F range list
例如:-F 4BA:0100 5 F3’XYZ’8D
使04BA:0100~0104单元包含指定的五个字节的内容。如果list中的字节数超过指定的范围,则忽略超过的项;如果list的字节数小于指定的范围,则重复使用list填入,直到填满指定的所有单元为止。
3)检查和修改寄存器内容的命令R(register),它有三种格式如下:
·显示CPU内所有寄存器内容和标志位状态,其格式为:
-R

·显示和修改标志位状态,命令格式为:
-RF系统将响应,如:
OV DN EI NG ZR AC PE CY-
此时,如不修改其内容可按ENTER键,否则,可键入欲修改的内容,如:
OV DN EI NG ZR AC PE CY-PONZDINV
即可,可见键入的顺序可以是任意的。
4)运行命令G,其格式为:
-G[=address1][address2[address3…>
其中,地址1指定了运行的起始地址,如不指定则从当前的CS:IP开始运行。后面的地址均为断点地址,当指令执行到断点时,就停止执行并显示当前所有寄存器及标志位的内容,和下一条将要执行的指令。
5)跟踪命令T(Trace),有两种格式:
·逐条指令跟踪
-T [=address]
从指定地址起执行一条指令后停下来,显示所有寄存器内容及标志位的值。如未指定地址则从当前的CS:IP开始执行。
·多条指令跟踪
-T [=address][value]
从指定地址起执行n条指令后停下来,n由value指定。
6)汇编命令A(Assemble),其格式为:
-A[address]
该命令允许键入汇编语言语句,并能把它们汇编成机器代码,相继地存放在从指定地址开始的存储区中。必须注意:DEBUG把键入的数字均看成十六进制数,所以如要键入十进制数,则其后应加以说明,如100D。
7)反汇编命令U(Unassemble)有两种格式。
·从指定地址开始,反汇编32个字节,其格式为:
-U[address]
例如:
-u100
18E4:0100 C70604023801 MOV WORD PTR[0204],0138
18E4:0106 C70606020002 MOV WORD PTR[0206],0200
18E4:010C C70606020202 MOV WORD PTR[0208],0202
18E4:0112 BBO4O2 MOV BX,0204
18E4:0115 E80200 CALL 011A
18E4:0118 CD20 INT 20
18E4:011A 50 PUSH AX
18E4:011B 51 PUSH CX
18E4:011C 56 PUSH SI
18E4:011D 57 PUSH DI
18E4:011E 8B37 MOV SI,[BX]
如果地址被省略,则从上一个U命令的最后一条指令的下一个单元开始显示32个字节。
·对指定范围内的存储单元进行反汇编,格式为:
-U[range]
例如:
-u100 10c
18E4:0100 C70604023801 MOV WORD PTR[0204],0138
18E4:0106 C70606020002 MOV WORD PTR[0206],0200
18E4:010C C70606020202 MOV WORD PTR[0208],0202

-u100 112
18E4:0100 C70604023801 MOV WORD PTR[0204],0138
18E4:0106 C70606020002 MOV WORD PTR[0206],0200
18E4:010C C70606020202 MOV WORD PTR[0208],0202

可见这两种格式是等效的。
8)命名命令N(Name),其格式为:
-N filespecs [filespecs]
命令把两个文件标识符格式化在CS:5CH和CS:6CH的两个文件控制块中,以便在其后用L或W命令把文件装入存盘。filespecs的格式可以是:
[d:][path] filename[.ext]
例如,
-N myprog
-L

可把文件myprog装入存储器。
9)装入命令(Load),有两种功能。
·把磁盘上指定扇区范围的内容装入到存储器从指定地址开始的区域中。其格式为:
-L[address[drive sector sector]
·装入指定文件,其格式为:
-L[address]
此命令装入已在CS:5CH中格式化了文件控制块所指定的文件。如未指定地址,则装入CS:0100开始的存储区中。
10)写命令W(Write),有两种功能。
·把数据写入磁盘的指定扇区。其格式为:
-W address drive sector sector
·把数据写入指定的文件中。其格式为:
-W[address]
此命令把指定的存储区中的数据写入由CS:5CH处的文件控制块所指定的文件中。如未指定地址则数据从CS:0100开始。要写入文件的字节数应先放入BX和CX中。
11)退出DEBUG命令Q(Quit),其格式为:
-Q
它退出DEBUG,返回DOS。本命令并无存盘功能,如需存盘应先使用W命令。

【转载】Debug常用命令集 有 50 条回应

  1. Attractive section of content. I just stumbled upon your website and in accession capital to assert that I
    get actually enjoyed account your blog posts. Anyway I will be subscribing
    to your feeds and even I achievement you access consistently quickly.

    回复
  2. I read this paragraph completely regarding the resemblance of
    most recent and previous technologies, it’s remarkable article.

    回复
  3. Thanks for ones marvelous posting! I definitely enjoyed
    reading it, you may be a great author. I will always bookmark your blog and
    may come back sometime soon. I want to encourage one to
    continue your great posts, have a nice morning!

    回复
  4. Excellent beat ! I wish to apprentice even as you amend your site,
    how could i subscribe for a weblog web site? The account helped me a applicable deal.
    I have been a little bit acquainted of this your broadcast provided vibrant transparent idea

    回复
  5. This post presents clear idea for the new
    people of blogging, that in fact how to do blogging.

    回复
  6. Greetings from Idaho! I’m bored to tears at work so
    I decided to browse your blog on my iphone during lunch
    break. I enjoy the knowledge you provide here and can’t wait to take a look when I get home.
    I’m surprised at how quick your blog loaded on my cell phone
    .. I’m not even using WIFI, just 3G .. Anyhow, amazing site!

    回复
  7. Fastidious response in return of this question with solid arguments
    and telling everything concerning that.

    回复
  8. I am really impressed with your writing skills as well as with the layout on your blog.
    Is this a paid theme or did you modify it yourself?
    Anyway keep up the nice quality writing, it’s rare to
    see a great blog like this one these days.

    回复
  9. I think that what you composed made a ton of sense.
    However, what about this? suppose you were to write a killer headline?
    I mean, I don’t wish to tell you how to run your website, however suppose you added a post title that grabbed people’s attention? I mean 【转载】Debug常用命令集 – LSX-blog is kinda
    vanilla. You might peek at Yahoo’s home page and watch how they write article headlines to grab people interested.
    You might try adding a video or a pic or two to get people interested about everything’ve written. In my opinion, it
    would make your website a little livelier.

    回复
  10. Awesome! Its really amazing article, I have got much clear idea concerning from this paragraph.

    回复
  11. Painter And Decorator Gloucester
    38 Bruton Way
    Gloucester GL1 1DA, United Kingdom
    01452 223268

    回复
  12. Hello, after reading this amazing post i am also delighted to share my familiarity here with friends.|

    回复
  13. I think the admin of this site is truly working hard in support of his
    web site, as here every data is quality based data.

    回复
  14. I know this web site provides quality depending articles
    and extra data, is there any other website which offers these things in quality?

    回复
  15. Thankfulness to my father who informed me concerning this webpage, this weblog is genuinely amazing.

    回复
  16. It’s amazing to pay a quick visit this web site
    and reading the views of all mates concerning this post, while I am
    also eager of getting familiarity.

    回复
  17. Touche. Solid arguments. Keep up the great spirit.

    回复
  18. Usually I don’t read article on blogs, but I would like to say that this write-up
    very forced me to try and do it! Your writing style has been surprised me.

    Thank you, very great article.

    回复
  19. It’s a pity you don’t have a donate button! I’d most certainly donate to this fantastic blog!
    I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to new updates and will share this blog with my
    Facebook group. Talk soon!

    回复
  20. I just couldn’t leave your website before suggesting that I really enjoyed
    the standard info a person supply for your visitors?
    Is going to be back incessantly to check out new posts

    回复
  21. This piece of writing is in fact a nice one it helps
    new internet users, who are wishing for blogging.

    回复
  22. What a stuff of un-ambiguity and preserveness of precious know-how concerning unexpected feelings.

    回复
  23. What’s up to every body, it’s my first visit of this webpage;
    this weblog consists of remarkable and genuinely good information for visitors.

    回复
  24. It’s remarkable in support of me to have a web site,
    which is helpful in support of my know-how. thanks admin

    回复
  25. Every weekend i used to pay a quick visit this web page, for the reason that i want enjoyment, for the
    reason that this this web site conations genuinely good
    funny material too.

    回复
  26. I am really inspired together with your writing talents and also with the structure to your blog.
    Is that this a paid theme or did you modify it your self?
    Anyway stay up the nice quality writing, it is uncommon to look a great blog like this one nowadays..

    回复
  27. Thanks for the marvelous posting! I truly enjoyed reading
    it, you’re a great author. I will make certain to bookmark your blog and will come back later on. I want to
    encourage you continue your great job, have a nice weekend!

    回复
  28. It is appropriate time to make some plans for the long run and
    it is time to be happy. I have read this submit and if
    I could I want to counsel you few interesting
    issues or suggestions. Perhaps you could write next articles referring to this article.

    I want to learn more things about it!

    回复
  29. Very great post. I simply stumbled upon your blog and wished to mention that I’ve truly loved surfing around your weblog posts.

    In any case I’ll be subscribing on your rss feed and I’m hoping you write again soon!

    回复
  30. Pretty nice post. I just stumbled upon your weblog and wished to say that I have
    really enjoyed browsing your blog posts. In any case I will
    be subscribing to your rss feed and I hope you write again very soon!

    回复
  31. Thanks very nice blog!

    回复
  32. Awesome website you have here but I was curious if you knew of any
    message boards that cover the same topics discussed in this article?
    I’d really like to be a part of group where I can get suggestions from other experienced individuals that share the same interest.
    If you have any suggestions, please let me know. Many thanks!

    回复
  33. My coder is trying to persuade me to move to .net from PHP.

    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using WordPress on a number of websites for about a year and am worried about
    switching to another platform. I have heard good things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any help would be really appreciated!

    回复
  34. Great information. Lucky me I came across your website by chance (stumbleupon).
    I have saved as a favorite for later!

    回复
  35. Admiring the time and effort you put into your website and detailed information you offer.
    It’s awesome to come across a blog every once in a while that isn’t the same out of date rehashed material.
    Wonderful read! I’ve saved your site and I’m including your RSS feeds to my Google account.

    回复
  36. Greetings! I’ve been following your web site
    for some time now and finally got the courage to go ahead and give you
    a shout out from Porter Tx! Just wanted to mention keep up the good
    work!

    回复
  37. Hello! I realize this is sort of off-topic however I had to ask.
    Does managing a well-established blog like yours take a lot of work?

    I am brand new to blogging however I do write in my journal every day.
    I’d like to start a blog so I will be able to share my own experience and feelings online.
    Please let me know if you have any kind of suggestions or tips
    for brand new aspiring blog owners. Appreciate it!

    回复
  38. Hi there, I found your site by way of Google whilst looking for a similar matter, your
    site got here up, it appears good. I’ve bookmarked it in my google bookmarks.

    Hello there, simply become alert to your weblog through Google, and located that it is truly informative.
    I’m gonna watch out for brussels. I’ll appreciate if you continue this
    in future. Lots of folks can be benefited out of your writing.
    Cheers!

    回复
  39. online sales of viagra

    回复
  40. online viagra in india

    回复
  41. viagra levitra differenze

    回复
  42. viagraprobeprobe paypal

    回复
  43. cost of viagra 2013

    回复
  44. viagra canada law

    回复
  45. chewing is pill

    fe25 is eye pain

    回复
  46. is prix franc

    05d6 only now female is

    回复
  47. where can i get is in nyc

    9721 is 74

    回复
  48. il is ato

    cff1 priligy and is

    回复
  49. is black cheap india

    10c8 price of is in usa

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注