装配程序未运行

时间:2015-03-10 16:46:10

标签: assembly linker nasm

使用nasm和alink ......

我一直在运行我最近在汇编中编写的程序。他们曾经工作,但现在每次运行时都会出错。这是我的设置......

文件名是“assembly.asm”...

segment .code USE32

    global _main:

_main:    ;main function

mov dx,msg    ;move the address of msg to dx

mov ah,9    ;move the system call number (9=Display string in DOS) to ah

int 21h    ;Call DOS interrupt

mov ah,4ch ;move the system call number (4ch=Terminate with return code)
           ;to ah

int 21h    ;Call DOS interrupt

msg db 'Hello world!', 10, 0 ;Create an entry in memory for 'Hello world!
                             ;string with label 'msg'
                             ;Not sure what the 10 does but it is a null-
                             ;terminated string as referenced by the 0

nasm -fobj assembly.asm (Yeilds no output to bash, just outputs a assembly.obj file.)

alink -c -oPE assembly (Yeilds the following)

C:\Documents and Settings\Admin\Desktop\asm>alink -c -oPE assembly.obj
ALINK v1.6 (C) Copyright 1998-9 Anthony A.J. Williams.
All Rights Reserved

Loading file assembly3.obj
matched Externs
matched ComDefs
Generating PE file assembly.exe
Relocs 0:Warning 32 bit offset in 16 bit field
Warning, no entry point specified

C:\Documents and Settings\Admin\Desktop\asm>

然后,当我运行assembly.exe(或只是汇编...)时,我会看到一个弹出窗口... “assembly.exe遇到了问题,需要关闭。很抱歉给您带来不便。”

可能导致这些错误的原因是什么?我在真实世界的程序中使用ollydbg,其中ollydbg表示程序没有入口点且程序运行得很好,所以它可能是也可能不是。

有什么想法吗?

0 个答案:

没有答案