gpt4 book ai didi

macos - OSX 64 位上的 NASM 问题

转载 作者:太空宇宙 更新时间:2023-11-04 00:03:29 34 4
gpt4 key购买 nike

<分区>

我正在学习 ASM,但遇到了一个小问题。我不能在“section.data”中“声明”多个字符串。我正在尝试这样的事情:

section .data
string1 db "test1 ", 0;
string2 db "test2 ", 0;
section .text
global _test
extern _puts
_test:
lea rdi, [rel string1]
call _puts
lea rdi, [rel string2]
call _puts
ret

这个函数应该在 STDOUT 上打印“test1 test2”,但它不起作用。结果是:

test2

它只适用于最后存储的字符串!如果有人知道为什么,请告诉我!

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com