Author Topic: My First MASM 64-bit Hello World console  (Read 768 times)

Mikl__

  • Member
  • ***
  • Posts: 434
Re: My First MASM 64-bit Hello World console
« Reply #15 on: January 12, 2017, 06:58:13 PM »
Code: [Select]
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

  • Member
  • *****
  • Posts: 6515
  • Assembler is fun ;-)
    • MasmBasic
Re: My First MASM 64-bit Hello World console
« Reply #16 on: January 12, 2017, 09:36:06 PM »
try MasmBasic:
Code: [Select]
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

  • Member
  • *****
  • Posts: 1606
Re: My First MASM 64-bit Hello World console
« Reply #17 on: January 13, 2017, 06:00:21 AM »
Another example :

Code: [Select]
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

  • Regular Member
  • *
  • Posts: 41
Re: My First MASM 64-bit Hello World console
« Reply #18 on: January 20, 2017, 01:52:42 AM »
Thanks for the extra codes guys. The more, the merrier.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4197
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: My First MASM 64-bit Hello World console
« Reply #19 on: January 20, 2017, 01:57:17 AM »
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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

coder

  • Regular Member
  • *
  • Posts: 41
Re: My First MASM 64-bit Hello World console
« Reply #20 on: January 20, 2017, 02:06:03 AM »
Hutch, you are breaking Initiation Ritual for beginners. It should be "Hello World" or something  :lol:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4197
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: My First MASM 64-bit Hello World console
« Reply #21 on: January 20, 2017, 02:07:46 AM »
In my OZ dialect is "Urrrrgh, G'day".  :biggrin:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

coder

  • Regular Member
  • *
  • Posts: 41
Re: My First MASM 64-bit Hello World console
« Reply #22 on: January 20, 2017, 02:13:47 AM »
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.