Recent Posts

Pages: 1 [2] 3 4 ... 10
11
The Workshop / Re: Int128 in assembler
« Last post by nidud on Today at 07:46:51 AM »
Yes. I assume an extended mantissa for long double to 96-bit.

Here's one for 128-bit.
Code: [Select]
_mulow proc multiplier:ptr, multiplicand:ptr, highproduct:ptr

    mov r9,rdx

    mov rax,[rcx]
    mov rdx,[rcx+8]
    mov r10,[r9]
    mov r11,[r9+8]
    ;
    ; r11:r10:rdx:rax = rdx:rax * r11:r10
    ;
    .if !rdx && !r11
        mul     r10
        xor     r10,r10
    .else
        push    rsi
        push    rdi
        mul     r10
        mov     rsi,rdx
        mov     rdi,rax
        mov     rax,[rcx+8]
        mul     r11
        mov     r11,rdx
        xchg    r10,rax
        mov     rdx,[rcx+8]
        mul     rdx
        add     rsi,rax
        adc     r10,rdx
        adc     r11,0
        mov     rax,[rcx]
        mov     rdx,[r9+8]
        mul     rdx
        add     rsi,rax
        adc     r10,rdx
        adc     r11,0
        mov     rdx,rsi
        mov     rax,rdi
        pop     rdi
        pop     rsi
    .endif
    mov [rcx],rax
    mov [rcx+8],rdx
    .if r8
        mov [r8],r10
        mov [r8+8],r11
    .endif
    ret

_mulow endp
12
The Colosseum / Re: Russia World Cup - Funny Pics
« Last post by felipe on Today at 07:36:18 AM »
 :P That one was great too!  :lol:
13
The Workshop / Re: Int128 in assembler
« Last post by bigbadbob on Today at 06:57:03 AM »
Let's move further ABI/FASTCALL discussion to http://masm32.com/board/index.php?topic=7222.0

nidud I noticed that this code does not properly multiply the generic case of OWORD multiplied by OWORD.  You said that it was inline so it probably works for a special case.
Quote
These functions are used for the REAL16 (quadmath) implementation so most of them are inline. The mul function goes something like this:

Code: [Select]
        .if !rdx && !r11
            mul     r10
            xor     r10,r10
        .else
            mul     r10
            mov     rbx,rdx
            mov     rdi,rax
            mov     rax,rcx
            mul     r11
            mov     r11,rdx
            xchg    r10,rax
            mov     rdx,rcx
            mul     rdx
            add     rbx,rax
            adc     r10,rdx
            adc     r11,0

There should be 4 multiplies in the else part.
rdx:rax * r11:r10 = rax * r10 (QWORD0 and QWORD1) + rdx * r10 (QWORD1 and QWORD2) + rax * r11 (QWORD1 and QWORD2) + rdx * r11 (QWORD2 and QWORD3)

14
The Campus / FASTCALL calling convention and MACROS
« Last post by bigbadbob on Today at 06:37:07 AM »
I wanted to know which MACROS are doing this?

This is a portion of the source code
Code: [Select]
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

TestMsgBox proc hndl:QWORD,text:QWORD,titl:QWORD,mbstyle:QWORD

    LOCAL myHndl:QWORD
    LOCAL myText:QWORD
    LOCAL myTitle:QWORD
    LOCAL myMBStyle:QWORD

    mov rax, hndl
    mov myHndl, rax
    mov rax, text
    mov myText, rax
    mov rax, titl
    mov myTitle, rax
    mov rax, mbstyle
    mov myMBStyle, rax

    fn MessageBox,myHndl,myText,myTitle,myMBStyle
  ; ----------------------
  ; return value is in RAX
  ; ----------------------
    ret

TestMsgBox endp

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

    end

Listing file:
Code: [Select]
00000051 TestMsgBox proc hndl:QWORD,text:QWORD,titl:QWORD,mbstyle:QWORD

    LOCAL myHndl:QWORD
    LOCAL myText:QWORD
    LOCAL myTitle:QWORD
    LOCAL myMBStyle:QWORD

 00000051  C8 0080 00      1       ??0047 = stackframe_default 
 00000055  48/ 81 EC      1       ??0048 = ??0048 + ??0047           
   00000080
 0000005C  48/ 89 4D 10      1       IF ??004A GT 0             
 00000060  48/ 89 55 18      1       IF ??004A GT 1
 00000064  4C/ 89 45 20      1       IF ??004A GT 2
 00000068  4C/ 89 4D 28      1       IF ??004A GT 3
 0000006C  48/ 8B 45 10     mov rax, hndl
 00000070  48/ 89 45 98     mov myHndl, rax
 00000074  48/ 8B 45 18     mov rax, text
 00000078  48/ 89 45 90     mov myText, rax
 0000007C  48/ 8B 45 20     mov rax, titl
 00000080  48/ 89 45 88     mov myTitle, rax
 00000084  48/ 8B 45 28     mov rax, mbstyle
 00000088  48/ 89 45 80     mov myMBStyle, rax

    fn MessageBox,myHndl,myText,myTitle,myMBStyle
 0000008C  48/ 8B 4D 98      3         ELSEIF svar EQ 8
 00000090  48/ 8B 55 90      3         ELSEIF svar EQ 4
 00000094  4C/ 8B 45 88      3         ELSEIF svar EQ 2
 00000098  4C/ 8B 4D 80      3         ELSEIF svar EQ 1
 0000009C  FF 15 00000000 E  2
  ; ----------------------
  ; return value is in RAX
  ; ----------------------
    ret
 000000A2  C9      1       ENDIF
 000000A3  C3      1

 000000A4 TestMsgBox endp

Disassembly from NDISASM
Code: [Select]
00000451  C8800000          enter 0x80,0x0
00000455  4881EC80000000    sub rsp,0x80
0000045C  48894D10          mov [rbp+0x10],rcx
00000460  48895518          mov [rbp+0x18],rdx
00000464  4C894520          mov [rbp+0x20],r8
00000468  4C894D28          mov [rbp+0x28],r9
0000046C  488B4510          mov rax,[rbp+0x10]
00000470  48894598          mov [rbp-0x68],rax
00000474  488B4518          mov rax,[rbp+0x18]
00000478  48894590          mov [rbp-0x70],rax
0000047C  488B4520          mov rax,[rbp+0x20]
00000480  48894588          mov [rbp-0x78],rax
00000484  488B4528          mov rax,[rbp+0x28]
00000488  48894580          mov [rbp-0x80],rax
0000048C  488B4D98          mov rcx,[rbp-0x68]
00000490  488B5590          mov rdx,[rbp-0x70]
00000494  4C8B4588          mov r8,[rbp-0x78]
00000498  4C8B4D80          mov r9,[rbp-0x80]
0000049C  FF155E0F0000      call qword [rel 0x1400]
000004A2  C9                leave
000004A3  C3                ret

I know that invoke and fn are identical MACROS.
What I noticed in my PROC is that the shadow space is saved right after entry.
Then I added some instructions to copy the parameters to local variables.
Then I called fn which came automatically generated for me.  I just changed the parameters.
I noticed that fn is only writing to the 4 registers.
15
The Colosseum / Re: Russia World Cup - Funny Pics
« Last post by nidud on Today at 06:17:15 AM »
"Donald? It's me, Angela. Please build the wall."

https://twitter.com/TrollFootball/status/1008396315808665601
16
Hi habran  :biggrin:,

No problem, really appreciate Your comment.
Macro definitions (one of the thing's i mess around in macro world), but just for the sake of read and search, which conflicts with fast coding write, almost I do its a copy and paste with the rename.

I'll change my code.
17
GoAsm / conversion of a "C" struct
« Last post by shankle on Today at 05:24:31 AM »
                 6-17-2018

    BITMAPINFO structure
    I need to convert this "C" struct to a GoASm format:
   
       typedef struct tagBITMAPINFO {
         BITMAPINFOHEADER   bmiHeader;
         RGBQUAD            bmiColors[1];   ; only need black & white
       } BITMAPINFO, *pBITMAPINFO;       
      
   Thanks for any help.   
18
Bienvenidos a masm32 forum.

felipe es corecto, necesito comunicacion en ingles aqui. Por que mas "members" ayudar.

I think that was correct.  :P  didn't know a close approximation for "members"  :P

Welcome to the masm32 forum, felipe is correct it is necessary to post in English here so more members might be able to assist you.
19
The Soap Box / Re: Happy birthday Hutch
« Last post by zedd151 on Today at 03:43:30 AM »
Checking in for the celebration.  :eusa_dance:

Happy Birthday hutch--.  And best wishes for a long, healthy and prosperous life.
20
The Soap Box / Re: Happy birthday Hutch
« Last post by felipe on Today at 03:43:05 AM »
Happy birthday! I hope you can rest now for a year at least, after doing the 69 for a whole year... :redface:  :P
Pages: 1 [2] 3 4 ... 10