News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Future with Masm32 >>> 64 ??? project

Started by Drakasm, January 25, 2013, 03:28:15 AM

Previous topic - Next topic

Drakasm

Hi all.
I wanted to know if there is a development project for Masm32
towards Masm32 - 64.
In fact the architecture of the processors gets more complicated and i have a clear sensation that we missing features.
My question includes if there are existing tutorials about programming in Windows64.

Thanks in advance.

qWord

If you aware of 32 Bit assembly, the step into 64 Bit isn't that hard. In that case, AMD's documentation (Volume 1) is the way to read in. For windows, the calling convection and stack usage has changed (more complicated).
As an Assembler, I would suggest you to use Japheth's jWasm with WinInc.

qWord
MREAL macros - when you need floating point arithmetic while assembling!

Drakasm

Exist's an IDE for jwasm ?
Till now i was using MasmEd - or Radasm .

qWord

MREAL macros - when you need floating point arithmetic while assembling!

Drakasm

Many thanks qWord i :t
I think that there is a lot of homework for me to do.
I've seen only good comments about jwasm and this is encouraging, is always a challenge to integrate another assembler.

Vortex

GoAsm is another good choice for 64-bit programming.

Gunther

Hi  Drakasm,

jWasm has the advantage that it'll work under 64 bit Linux, too.

Gunther
You have to know the facts before you can distort them.

Drakasm

Hi Gunther,Vortex,qWord
Just assembled a small project32 with Jwasm and with a small modification in mmx syntax has worked just fine !!!!!!
Excellent masm syntax compatibility !!!
Only issue with the resource compiler which increased the size of the executable 1Kbyte ?
I've used wrc with an already existing .RES file and combined them with the executable generated by the jwlink.
Previous executable created with the IDE MasmEd was 1Kbyte smaller.

qWord

Quote from: Drakasm on January 26, 2013, 05:49:50 AMOnly issue with the resource compiler which increased the size of the executable 1Kbyte ?
I've used wrc with an already existing .RES file and combined them with the executable generated by the jwlink.
Previous executable created with the IDE MasmEd was 1Kbyte smaller.
maybe has something to do with the section alignment (linker) ... however who cares about ±1KB ;)
MREAL macros - when you need floating point arithmetic while assembling!

Drakasm

Testing some examples and adding some options. >>>

;--- Win32_7 - Shows how to use OPTION DLLIMPORT and cmdline option -Fd.
;---           As a result, no import libraries are needed in the link step.
;---
;--- assemble: JWasm -coff -Fd Win32_7.ASM
;--- link:     JWlink format windows pe f Win32_7.OBJ

    .386
    .MODEL FLAT, stdcall
    option casemap:none

STD_OUTPUT_HANDLE equ -11

   option dllimport:<kernel32>
WriteConsoleA proto :dword, :dword, :dword, :dword, :dword
GetStdHandle  proto :dword
ExitProcess   proto :dword
   option dllimport:<user32>
MessageBoxA   proto :dword, :dword, :dword, :dword
 
option dllimport:<openal32>
alcOpenDevice         proto :dword
alcCreateContext      proto :dword, :dword
alcMakeContextCurrent proto :dword
alcDestroyContext     proto :dword
alcCloseDevice        proto :dword
   option dllimport:<none>
    .CONST

string  db 13,10,"hello, world.",13,10
    db 0

    .CODE

main proc

      LOCAL dwWritten:DWORD
      LOCAL Hxos:DWORD
      LOCAL Contesto:DWORD
     
      invoke alcOpenDevice,0
       mov Hxos,eax
       invoke alcCreateContex,Hxos,0
       mov Contesto,eax
       invoke alcMakeContexCurrent,Contesto
       invoke alcDestroyContex,Contesto
       invoke alcCloseDevice,Hxos
    invoke  GetStdHandle, STD_OUTPUT_HANDLE
    mov     ebx, eax
    invoke  WriteConsoleA, ebx, addr string, sizeof string, addr dwWritten, 0
    invoke  MessageBoxA, 0, addr string, 0, 0
    ret

main endp

;--- entry

start:

    invoke  main
    invoke  ExitProcess, 0

    END start


Keeps giving me error invoke requires prototype for procedure. :(

japheth

Quote from: Drakasm on January 27, 2013, 08:15:07 PM
Keeps giving me error invoke requires prototype for procedure. :(

I'd recommend to buy a pair of glasses - and then to read carefully.

frktons

Quote from: Drakasm on January 27, 2013, 08:15:07 PM

start:

    invoke  main
    invoke  ExitProcess, 0

    END start


Keeps giving me error invoke requires prototype for procedure. :(


Probably a CALL main will suffice.
I don't know JWasm syntax, but this instruction looks strange.

Frank
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

Drakasm

 :biggrin: Finally i have corrected my errors and now my beloved jwasm is not complaining.

QuoteProbably a CALL main will suffice.
I don't know JWasm syntax, but this instruction looks strange.
Thank you frktons for your reply, but the problem was that i didn't supply Jwasm the correct prototypes for
the functions i was calling. :(
OpenAL.dll uses the cdelc  calling convention.



;--- Win32_7 - Shows how to use OPTION DLLIMPORT and cmdline option -Fd.
;---           As a result, no import libraries are needed in the link step.
;---
;--- assemble: JWasm -coff -Fd Win32_7.ASM
;--- link:     JWlink format windows pe f Win32_7.OBJ

    .386
    .MODEL FLAT,stdcall
    option casemap:none

STD_OUTPUT_HANDLE equ -11

   option dllimport:<kernel32>
WriteConsoleA proto :dword, :dword, :dword, :dword, :dword
GetStdHandle  proto :dword
ExitProcess   proto :dword
Beep          proto :dword, :dword
   option dllimport:<user32>
MessageBoxA   proto :dword, :dword, :dword, :dword

option dllimport:<openal32>
alcOpenDevice         proto  c : ptr dword
alcCreateContext      proto  c : ptr dword,: ptr dword
alcMakeContextCurrent proto  c : ptr dword
alcDestroyContext     proto  c : ptr dword
alcCloseDevice        proto  c : ptr dword 
   ;option dllimport:<none>
    .CONST

string  db 13,10,"hello, world.",13,10
    db 0
ProgramTitle db "jwasm",0
Infomation db "Love Jwasm",0
    .CODE

main proc

     LOCAL   dwWritten:dword
LOCAL   aldevice:dword
LOCAL   alcontext:dword
    invoke alcOpenDevice,0
    mov aldevice,eax
    cmp eax,0
jne @F
invoke MessageBoxA,0,ADDR Infomation,ADDR ProgramTitle,0
    @@:
    invoke alcCreateContext,eax,0
    mov alcontext,eax
    invoke alcMakeContextCurrent,eax
    invoke alcDestroyContext,alcontext
    invoke alcCloseDevice,aldevice
    invoke  GetStdHandle, STD_OUTPUT_HANDLE
    mov     ebx, eax
    invoke  WriteConsoleA, ebx, addr string, sizeof string, addr dwWritten, 0
    invoke Beep,5000,1000
    invoke  MessageBoxA, 0, ADDR Infomation, ADDR ProgramTitle, 0
    ret

main endp

;--- entry

start:

    invoke  main
    invoke  ExitProcess, 0

    END start


:icon_eek:
QuoteI'd recommend to buy a pair of glasses - and then to read carefully.
japheth
I don't  wear glasses but with all the information i read probably i'am going to need them.
Jwasm is a fabulous assembler and by no means i was referring to a possible Jwasm problem.
As a matter  of fact the problem is certainly mine "New to assembler".
When i have seen the beautiful possibility jwasm offers to link without the necessity of import libraries...... :greenclp:
but  being hasty is equivalent to making mistakes.
Thank you for your reply and for Jwasm. :t


japheth

Quote from: Drakasm on February 01, 2013, 10:19:06 PM
Thank you for your reply

It was my pleasure.  :P Btw, the glasses-remark was targeted to the missing 't' in several locations of the source that you posted (" invoke alcCreateContex,Hxos,0" ).

Vortex

Hi Japheth,

About the Win32_7.asm example, I tried to insert the equates in the option dllimport section and this worked fine :t

  option dllimport:<kernel32>
WriteConsoleA proto :dword, :dword, :dword, :dword, :dword
GetStdHandle  proto :dword
ExitProcess   proto :dword
   option dllimport:<user32>
MessageBoxA   proto :dword, :dword, :dword, :dword
MessageBox equ <MessageBoxA>
WriteConsole equ <WriteConsoleA>
   option dllimport:<none>
.
.
.
invoke  GetStdHandle, STD_OUTPUT_HANDLE
mov     ebx, eax
invoke  WriteConsole, ebx, addr string, sizeof string, addr dwWritten, 0
invoke  MessageBox, 0, addr string, 0, 0
ret


JWasm assembled the same example with the modifications above and didn't report any error message.