• notice
  • Congratulations on the launch of the Sought Tech site

print hello in 64 bit masm

I am a programming novice.
I want to write a program to display hello in 64 bit masm.
I use VS Code with ml64.exe and gcc.
Here is what I wrote:

;; file name: hello.asm
printf proto

.data
    messenge dq "hello", 0

.code
main proc
    sub rsp, 40h
    mov rcx, messenge
    call printf
    add rsp, 40h
    ret
main endp

end

I wrote a script to assemble, link and execute:

@:: file name: run.cmd
@ml64/c hello.asm
@gcc-o hello.exe hello.obj
@del *.obj
@hello.exe

It goes like this:

C:\code\MASM>run.cmd
Microsoft (R) Macro Assembler (x64) Version 14.25.28614.0
Copyright (C) Microsoft Corporation.All rights reserved.

 Assembling: hello.asm

It does not output the hello string.
How can I fix this?

uj5u.com enthusiastic netizens replied:

I only use ml64 hello.asm(without gcc) to build It .

;; file name: hello.asm
printf proto
includelib msvcrt.lib
includelib legacy_stdio_definitions.lib

.data
    messenge db "hello", 13, 0

.code
main proc
    sub rsp, 40h
    mov rcx, offset messenge
    call printf
    add rsp, 40h
    ret
main endp

end

is basically what Michael said.

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+