回 帖 发 新 帖 刷新版面

主题:一个简单的debug问题。

一个C程序,
#include "stdio.h"
#include "stdlib.h"
int main()
{
    printf("Hello world~!\n");
    //system("pause");
    return 0;
}
生成一个1.exe
C:\debug 1.exe
-u
出现了
push cs
pop ds
mov dx,000e
mov ah,09
int 21
mov ax,4c01
int 21
push sp
db 68
db69
jnb 0033
下面还有很多代码我就不写了。
push cs
pop ds
mov dx,000e
mov ah,09
int 21
mov ax,4c01
int 21
看这段代码就想我用C写的程序,但是mov dx,000e
000E里面放的不是hello world而是放的,
This program cannot be run in DOS mode.
输出的也是
This program cannot be run in DOS mode.
怎么回事啊?
还有就是去掉C语言代码里面的注释。debug的汇编代码好象也是一样。晕哟,搞不懂。
哪位帮忙解释下吧。。debug 反的汇编代码怎么不是我写的C代码的功能输出Hello world呢?

回复列表 (共2个回复)

沙发

因为该程序是运行在WINDOWS下的,因此文件结构是PE结构,这个和DOS下的不同.
注意:DOS和WINDOWS下的控制台是有区别的.

板凳

不是很懂,。有详细点的解释吗?

我来回复

您尚未登录,请登录后再回复。点此登录或注册