TASM 中带参数的函数
您能否发布一个使用带有参数的函数的汇编语言示例。一些简单的东西,比如返回两个元素之和的函数。
无法用谷歌搜索任何足够简单的例子。
额外:
.model small
.data
.stack 320h
.code
extrn writer:near
add_numbers PROC
ARG number1:WORD
ARG number2:WORD
MOV ax, number1
MOV bx, number2
ADD ax, bx
CALL writer ; this procedure prints the contents of ax
RET
add_numbers ENDP
.startup
PUSH 1
PUSH 2
CALL add_numbers ; instead of 3 it prints -11602
call writer ; instead of 3 it prints 0
.EXIT
END
Could you please post an example in assembly language that uses functions with parameters. Something simple, like function that returns a sum of two elements.
Couldn't google any example that is simple enough.
ADDED:
.model small
.data
.stack 320h
.code
extrn writer:near
add_numbers PROC
ARG number1:WORD
ARG number2:WORD
MOV ax, number1
MOV bx, number2
ADD ax, bx
CALL writer ; this procedure prints the contents of ax
RET
add_numbers ENDP
.startup
PUSH 1
PUSH 2
CALL add_numbers ; instead of 3 it prints -11602
call writer ; instead of 3 it prints 0
.EXIT
END
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您使用的 TASM 版本。在现代的你可以写这样的东西:
That would depend on the version of TASM you're using. On modern ones you can write something like: