如何在ASM中使用主程序?

时间:2016-11-02 18:45:56

标签: assembly procedure irvine32

我是一名正在学习汇编语言基础知识的学生。我遇到了一个问题,即程序将内部过程调用标记为未定义的符号(A2006)。同时调用包含的图书馆工作得很好。

在网上看到这个问题之后,我只看到人们因为忘记在包含文件中使用put而遇到外部调用问题。至于程序本身,我看到人们以两种不同的方式设置它们,并且都给了我未定义的错误。

INCLUDE whatever
.data
.code
main proc
coding
CALL procedurefromwhatever  ;this works just fine
CALL name  ;this is the part that returns the A2006 undefined error
CALL name_proc  ;this doesn't work either
exit
main ENDP
end main

name proc
coding
ret
name ENDP

name_proc:
coding
ret
name ENDP

1 个答案:

答案 0 :(得分:2)

end main行应关闭整个文档,因此将其移至底部(在第二个name ENDP之后),文档在错误的位置关闭,因此这些过程不属于代码段,它们无法识别:

INCLUDE whatever
.data
.code
main proc
coding
CALL procedurefromwhatever  ;this works just fine
CALL name  ;this is the part that returns the A2006 undefined error
CALL name_proc  ;this doesn't work either
exit
main ENDP
;end main                 ◄■■■ WRONG PLACE. MUST BE AT THE BOTTOM.

name proc
coding
ret
name ENDP

name_proc:
coding
ret
name ENDP

end main                 ;◄■■■ RIGHT HERE!!!
相关问题