• Re: Then I tried to create /hello world/ with MASM, you won't believe what happened next!

    From Johann \@johann@myrkraverk.invalid to comp.os.ms-windows.programmer.win32,alt.lang.asm,comp.lang.asm on Fri Aug 21 01:03:41 2026
    From Newsgroup: alt.lang.asm

    On 8/20/2026 7:45 PM, Johann 'Myrkraverk' Oskarsson wrote:
    Dear comp.os.ms-windows.programmer.win32, and alt.lang.asm,

    As the click-bait title says, I tried to create a /hello world/ appli-
    cation with Microsoft's venerable MASM, but it's called ml64 now.-a For
    some weird reason.-a Why couldn't it have just been MASM.EXE?

    Anyway, none of the examples at

    -ahttps://stackoverflow.com/questions/70661294/print-hello-in-64-bit-masm

    and please forgive the long U.R.L., I don't use shorteners anymore; work
    for me.-a It might be something about my eleven Windows, or the fact that
    I'm using Visual Studio of the year of the Lord 2026, and not an earlier edition.

    Is there a kind soul able to show me exactly how to compile, and build a /hello world/ with Microsoft's venerable MASM of the year of the Lord
    2026?

    However, I was able to get the following yasm example to work on Windows eleven. I still don't know how to use MASM, nor yasm on NetBSD.

    Well, my signature is missing, but I think nobody cares. I'm adding comp.lang.asm to the discussion.

    ;;; https://gist.github.com/mcandre/b3664ffbeb4f5764b36a397fafb04f1c

    ;;; yasm -f win64 hello3.asm

    ;;; link hello3.obj kernel32.lib /entry:main /largeaddressaware:no

    section .data
    hello_msg db 'Hello, Usenet!', 0
    hello_len equ $ - hello

    section .text
    global main
    extern ExitProcess, WriteConsoleA, GetStdHandle

    main:
    sub rsp, 28h
    mov rcx, -11
    call GetStdHandle

    ;; write message to the console.
    mov r9, 0
    mov r8, hello_len
    mov rdx, hello_msg
    mov rcx, rax
    call WriteConsoleA

    ;; terminate the process.
    mov rcx, 0
    call ExitProcess

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Johann \@johann@myrkraverk.invalid to comp.os.ms-windows.programmer.win32,alt.lang.asm,comp.lang.asm on Fri Aug 21 07:01:04 2026
    From Newsgroup: alt.lang.asm

    On 8/21/2026 1:03 AM, Johann "Myrkraverk" Oskarsson wrote:
    On 8/20/2026 7:45 PM, Johann 'Myrkraverk' Oskarsson wrote:
    Dear comp.os.ms-windows.programmer.win32, and alt.lang.asm,

    As the click-bait title says, I tried to create a /hello world/ appli-
    cation with Microsoft's venerable MASM, but it's called ml64 now.-a For
    some weird reason.-a Why couldn't it have just been MASM.EXE?

    Anyway, none of the examples at

    -a-ahttps://stackoverflow.com/questions/70661294/print-hello-in-64-bit-masm >>
    and please forgive the long U.R.L., I don't use shorteners anymore; work
    for me.-a It might be something about my eleven Windows, or the fact that
    I'm using Visual Studio of the year of the Lord 2026, and not an earlier
    edition.

    Is there a kind soul able to show me exactly how to compile, and build a
    /hello world/ with Microsoft's venerable MASM of the year of the Lord
    2026?

    However, I was able to get the following yasm example to work on Windows eleven.-a I still don't know how to use MASM, nor yasm on NetBSD.

    Well, my signature is missing, but I think nobody cares.-a I'm adding comp.lang.asm to the discussion.


    Then I got the following to work as well. I'm now ready to lean assem-
    bly on Windows, with C functions! I hope there are no showstoppers on
    the way.

    Please excuse the long lines, and fix them yourself!


    Happy assembly coding on Windows!



    ;;; adapted from https://stackoverflow.com/a/64414459

    ;;; yasm -f win64 hello4.asm

    ;;; link hello4.obj /subsystem:console /entry:main /out:hello4.exe kernel32.lib legacy_stdio_definitions.lib msvcrt.lib /largeaddressaware:no

    section .data
    format db 'Hello, Usenet! From Yasm with printf(), and newline.'
    db 10, 0

    section .text
    global main
    extern printf, ExitProcess, _CRT_INIT

    main: push rbp
    mov rbp, rsp
    sub rsp, 32

    call _CRT_INIT

    lea rcx, [ format ]
    call printf

    xor rcx, rcx ; correct exit code? Seems so.
    call ExitProcess


    --- Synchronet 3.22a-Linux NewsLink 1.2