News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

My First MASM 64-bit Hello World console

Started by coder, January 10, 2017, 01:29:50 AM

Previous topic - Next topic

Mikl__

include win64a.inc
includelib msvcrt.lib
include msvcrt.inc
.code
WinMain proc
        mov     ecx,offset hello
        call    printf

        xor     ecx,ecx
        call    exit

WinMain endp
hello db 'Hello 64-bit world!',0ah,0
end

jj2007

try MasmBasic:
include \Masm32\MasmBasic\Res\JBasic.inc
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
  Inkey Chr$("Hello World: This code was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format")
EndOfCode


Hello World: This code was assembled with HJWasm32 in 64-bit format

Vortex

Another example :

include HelloX64.inc

.data

msg db 'Hello world!',0

.code

start:

   sub      rsp,4*8+8
   invoke   StdOut,ADDR msg
   invoke   ExitProcess,0

StdOut PROC lpszText:QWORD

LOCAL hOutPut:QWORD
LOCAL bWritten:QWORD
LOCAL sl:QWORD
LOCAL _lpszText:QWORD

    mov     _lpszText,rcx
    invoke  GetStdHandle,STD_OUTPUT_HANDLE
    mov     hOutPut,rax

    invoke  lstrlen,_lpszText
    mov     sl,rax

    invoke  WriteFile,hOutPut,_lpszText,sl,ADDR bWritten,NULL
    mov     rax,bWritten
    ret

StdOut ENDP

END

coder

Thanks for the extra codes guys. The more, the merrier.

hutch--

Here is another one using the MASM64 project I am working on.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

entry_point proc

    conout "Howdy, your new console template here.",lf,lf
    waitkey

    invoke ExitProcess,0

    ret

entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end

coder

Hutch, you are breaking Initiation Ritual for beginners. It should be "Hello World" or something  :lol:

hutch--


coder

Haha. You have no idea how scary that is to asm beginners coming from HLL who are hoping to see something like hello world during the first days.

It's like "hello world or never" thing.