似乎根本无法输出该汇编程序

问题描述

我刚刚开始学习汇编(

section .data
    message db "Hello World!",10
    
section .text
    global _start

_start:
    mov rax,1
    mov rdi,1
    mov rsi,message
    mov rdx,14
    syscall
    mov rax,60
    mov rdi,0
    syscall

我和其他一些人一起关注this online tutorial,但是我似乎无法弄清楚为什么没有任何输出。它组装并链接没有错误(控制台输入是: nasm -f elf64 hello.asm -o hello.o ,后跟: ld hello.o -o hello 。何时运行,需要一秒钟,然后出现新的提示。)

我在Windows上,这是我可以在网上找到所有可能原因的原因,但找不到解决方案。我尝试过使用 -f win64 ,然后使用 link.exe hello.obj / entry:_start / subsystem:console 我也将subsystem:console替换为subsystem:windows,以防万一。我完全迷失了,所有帮助将不胜感激。谢谢!

P.S。如果是在Windows上出现问题,是否可以在线获取有关Windows nasm的良好指南。 (我尝试过使用masm并使用as,但是一直遇到问题,所以我决定选择nasm)

解决方法

一个简单的解释:在Windows上不能使用( Get-Command Prompt).ScriptBlock "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "; # .Link # https://go.microsoft.com/fwlink/?LinkID=225750 # .ExternalHelp System.Management.Automation.dll-help.xml 。您需要从Windows DLL中导入控制台编写功能,然后syscall导入它们。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...