News:

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

Main Menu

JWASM question.

Started by hutch--, August 17, 2017, 02:30:30 AM

Previous topic - Next topic

hutch--

Since at least some of the guys using UASM used to use Japheth's JWASM, I have a question. Making a simple object module is easy enough to do but I have not succeeded in getting the "-bin" option to work in 64 bit. It works fine in 32 bit so the questions is, is it only for 16 and 32 bit ?

I can get the raw binary output I am after with MASM but its a lot more messing around that what JWASM is capable of doing in 32 bit.

Vortex

A quick test with the -bin option :

option casemap:none
option win64:3

.code

StringLen PROC lpszText:QWORD

    mov     r8,1
    xor     rax,rax
    sub     rax,r8
@@:
    add     rax,r8
    movzx   rdx,BYTE PTR [rcx+rax]
    test    rdx,rdx
    jnz     @b
    ret

StringLen ENDP

END


uasm64.exe -bin StringLen.asm
UASM v2.38, Aug  4 2017, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

StringLen.asm(4) : Error A2096: Model is not declared
StringLen.asm(6) : Error A2082: Must be in segment block
StringLen.asm(8) : Error A2082: Must be in segment block
StringLen.asm(9) : Error A2082: Must be in segment block
StringLen.asm(10) : Error A2082: Must be in segment block
StringLen.asm(11) : Error A2082: Must be in segment block
StringLen.asm(12) : Error A2082: Must be in segment block
StringLen.asm(13) : Error A2082: Must be in segment block
StringLen.asm(14) : Error A2082: Must be in segment block
StringLen.asm(15) : Error A2082: Must be in segment block
StringLen.asm(16) : Error A2082: Must be in segment block
StringLen.asm(18) : Error A2142: Unmatched block nesting: StringLen
StringLen.asm: 20 lines, 1 passes, 15 ms, 0 warnings, 12 errors

nidud

#2
deleted

Vortex

Hi nidud,

Thanks for your help. It works as expected :

\tdm-gcc-32\bin\objdump -M intel -b binary -D -m i386:x86-64 StringLen.BIN

StringLen.BIN:     file format binary

Disassembly of section .data:

00000000 <.data>:
   0:   48 83 ec 08             sub    rsp,0x8
   4:   49 c7 c0 01 00 00 00    mov    r8,0x1
   b:   48 33 c0                xor    rax,rax
   e:   49 2b c0                sub    rax,r8
  11:   49 03 c0                add    rax,r8
  14:   48 0f b6 14 08          movzx  rdx,BYTE PTR [rax+rcx*1]
  19:   48 85 d2                test   rdx,rdx
  1c:   75 f3                   jne    0x11
  1e:   48 83 c4 08             add    rsp,0x8
  22:   c3                      ret

nidud

#4
deleted

hutch--

Thanks nidud,

.x64
.model  flat, fastcall

.code
option casemap:none
option win64:3

Works just fine.

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

NOSTACKFRAME

slen proc

    db 72,139,193,72,131,232,1,72,131,192,1,76,15,182,16,77
    db 133,210,116,39,72,131,192,1,76,15,182,16,77,133,210,116
    db 26,72,131,192,1,76,15,182,16,77,133,210,116,13,72,131
    db 192,1,76,15,182,16,77,133,210,117,204,72,43,193,195

slen endp

STACKFRAME

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

aw27

Quote
option win64:3
asmc
Code: [Select]
   0:   48 89 4c 24 08          mov    QWORD PTR [rsp+0x8],rcx
...
9:   48 83 ec 20             sub    rsp,0x20

Actually UASM does save the register to the parameter  (mov    QWORD PTR [rsp+0x8],rcx) only if the value is used, otherwise not. Also, UASM does not create shadow space (sub    rsp,0x20) if the function is a leaf.

May be you should think about that nidud (if you want want and have time, of course).

No need to thank me for this info, habran.

habran

Cod-Father

hutch--

Japheth's JWASM 2.11s did the job fine, utility is finished and works correctly.

nidud

#9
deleted

aw27

Quote
My (conservative) thinking is then to preserve this predictability and thus limit the extensions to this logic, so the priorities differ and hence also the result.

Very deep thought indeed.  :t