News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

the simplest 64bit app won't start

Started by ramguru, June 07, 2009, 08:08:26 PM

Previous topic - Next topic

ramguru

ha-ha actually I was focusing on goasm starting yesterday. Indeed it has the most complete & user friendly 64bit support. Though I have to say documentation could be neater :} .. and lack of examples (just invoke MessageBox), but that's allright..
BTW I've found another bad poasm (x64) feature that was the last drop :}
let's assume we have the following code:

foo proc bla1:QWORD, bla2:QWORD
   LOCAL hamster:QWORD

    ; bla1, bla2 are valid here
    invoke MessageBox,...
    ; bla1, bla2 become invalid here
    mov r10, bla1 ; --> mov r10, rcx
foo endp


It's simple really - poasm doesn't write any parameter to stack .. so they are lost if not preserved manually

drizz

The truth cannot be learned ... it can only be recognized.

ramguru

So this is the actual code:

foo proc bla1:QWORD, bla2:QWORD PARMAREA=4*QWORD
LOCAL hamster:QWORD

mov    rcx, bla1
invoke MessageBox, 0, 0, 0, 0
mov    rcx, bla1

ret
foo endp

And this is it's disassembly

sub_140001028   proc near               ; CODE XREF: start+12
                sub     rsp, 38h
                mov     rcx, rcx
                mov     r9, 0           ; uType
                mov     r8, 0           ; lpCaption
                mov     rdx, 0          ; lpText
                mov     rcx, 0          ; hWnd
                call    MessageBoxA
                mov     rcx, rcx
                add     rsp, 38h
                retn
sub_140001028   endp



It's not like I haven't checked before stating my opinion..

drizz

In ML64 arguments evaluate to stack and in poasm to Registers, so in ML64 you can save them with "mov bla1,rcx"
I don't know if there is an easy way to access param stack area with poasm, it's probably a good idea to ask Pelle about that.
The truth cannot be learned ... it can only be recognized.