Jorge Luiz Gouveia Sousa Posted August 19 Posted August 19 Olá? Queria saber como copilo o NASM no Windows 11? e como uso o ld do Linux no Windows 11? nasm -f elf64 hello.asm ld -s -o hello hello.o ./hello ; ========================= ; Programa Hello World ; ========================= ; Compilação ; ========================= ; nasm -f elf64 hello.asm ; ld -s -o hello hello.o ; ./hello ; ========================= ; Resultado ; ========================= ; Hello World ; ========================= section .data: msg db 'Hello World', 0xa len equ $ - msg section .text: global _start _start: mov edx, len mov ecx, msg mov ebx, 1 mov eax, 4 int 0x80 ; Saida mov eax, 1 mov ebx, 0 int 0x80 Quote
fredericopissarra Posted August 19 Posted August 19 bits 64 default rel section .rdata hello: db `Hello\r\n` hello_len equ $ - hello section .text extern __imp_GetStdHandle extern __imp_WriteConsoleA extern __imp_ExitProcess global _start _start: sub rsp,32 mov ecx,-11 call [__imp_GetStdHandle] mov rcx,rax lea rdx,[hello] mov r8d,hello_len xor r9,r9 push 0 call [__imp_WriteConsoleA] xor ecx,ecx call [__imp_ExitProcess] ; Nunca chegará aqui! Compilando e executando: $ nasm -fwin64 -o hello.o hello.asm $ ld -s -o hello.exe hello.o -lkernel32 $ ./hello Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.