News:

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

Main Menu

Recent posts

#1
Miscellaneous Projects / Re: Mersenne Twister: a 623-di...
Last post by zedd151 - Today at 06:54:06 AM
 :thumbsup:

:biggrin:
#2
Miscellaneous Projects / Mersenne Twister: a 623-dimens...
Last post by HSE - Today at 06:42:38 AM
Hi all!

A lot of interest into RNG this days  :thumbsup:

Here a translation from C to Assembly, using Masm64 SDK.

This use Randy Hyde loops macros (in SmplMath) just to make a more nice code :biggrin:

(I presume everybody changed vc__i64toa to vc__ui64toa en str$ macro.)

Regards, HSE.
#3
UASM Assembler Development / Re: Beautiful Lissajous Curve
Last post by TimoVJL - Today at 06:21:48 AM
Nice, good for those making rings
#4
UASM Assembler Development / Re: Beautiful Lissajous Curve
Last post by fearless - October 21, 2024, 08:01:56 PM
Nice. I had the thought that something like that could be used for a visualizer for music for my media player for example.
#5
The Workshop / Re: PRNG conversion from masm3...
Last post by zedd151 - October 21, 2024, 07:22:43 PM
Quote from: sinsi on October 20, 2024, 02:35:02 AMWhy omit the test eax, 80000000h part? Admittedly, I don't understand why it's in the original.  Overflow?
I have been scouring through some papers regarding the original Park-Miller algorithm. Apparently the seed value should be an integer less than or equal to 2147483647  (2^31)-1.   :biggrin:
I have been looking at some other prng algos, but specifically for 64 bit use. The Park-Miller algo is useful, but its not for 64 bit. Anyway I will be experimenting with some new 'magic' numbers from some of the 64 bit algos I have been reading about, attempting to adapt the Park-Miller algo further.   :cool:
#6
UASM Assembler Development / Beautiful Lissajous Curve
Last post by six_L - October 21, 2024, 01:18:01 PM
Hi,All

Core code:
GenerateAlgoCurve proc uses rbx @@pGraphics:QWORD
    LOCAL Fmin:REAL10
    LOCAL Fmax:REAL10
    local aa:REAL10
    local bb:REAL10
    local theta:REAL10
    local x00:REAL4
    local y00:REAL4
    local x11:REAL4
    local y11:REAL4
    local @Pen:QWORD
    local xPhase:REAL10
    local nn:REAL10

    ;Lissajous Curve
    ;x(@)=a.sin(@)
    ;y(@)=b.sin(n.@+0)    n >= 1 ,(3.14/2) >= 0 >= O
    ;n: Multiple of frequency
       
    finit
   
    fld    FP10(1.0)   
    fstp    Fmin
    fld    FP10(2.0)   
    fstp    Fmax
    invoke  randf,addr Fmax,addr Fmin       
    fstp    nn

    fldz
    fstp    Fmin
    fldpi            ; 3.14
    fld    FP10(2.0)
    fdiv            ; 3.14/2
    fstp    Fmax
    invoke  randf,addr Fmax,addr Fmin        ;st0=[@Fmin,@Fmax)
    fstp    xPhase

   
    fldz
    fstp    theta

    fld    FP10(295.11)    ;a=width
    fstp    aa

    fld    FP10(240.07)    ;b=height
    fstp    bb

    invoke    GdipCreatePen1,0FF00FF00H,FP4(0.5),0,addr @Pen    ;FP4(0.5) pen width,
    xor    rbx,rbx
    .repeat
        fld    theta
        fldpi            ; 3.14
        fmul            ; theta*3.14
        fld    FP10(180.0)
        fdiv
        fsin            ; sin(theta*3.14/180)
        fld    aa
        fmul            ; a*sin(theta*3.14/180)
        fstp    x11
       
        fld    theta
        fldpi            ; 3.14
        fmul            ; theta*3.14/180
        fld    FP10(180.0)
        fdiv
        fld    nn
        fmul            ; n*(theta*3.14/180)
        fld    xPhase
        fadd            ; n*(theta*3.14/180)+xPhase
       
        fsin            ; sin(n*(theta*3.14/180)+xPhase)
        fld    bb
        fmul            ; b*sin(n*(theta*3.14/180)+xPhase)
        fstp    y11
       
        ;move to the center
        fld    FP10(420.5)
        fld    x11
        fadd
        fstp    x00
       
        fld    FP10(310.5)
        fld    y11
        fadd
        fstp    y00
       
        invoke    GdipDrawEllipse,@@pGraphics,@Pen,x00,y00,FP4(2.1),FP4(2.1)
       
        fld    FP10(0.908)        ;step of theta
        fld    theta
        fadd
        fstp    theta

        inc    rbx
    .until rbx == 6000
    invoke    GdipDeletePen,@Pen
    ret

GenerateAlgoCurve endp

the attachment is exe and screenshot.

#7
The Workshop / Re: PRNG conversion from masm3...
Last post by zedd151 - October 21, 2024, 12:32:05 PM
Quote from: sinsi on October 20, 2024, 02:35:02 AMJust curious about a few things
 Why change from using ECX to using RSI?
Registers now restored to (almost) original design. Version rand64a.zip in first post.
#8
The Workshop / Re: dwtoa --> qwtoa
Last post by zedd151 - October 21, 2024, 07:15:06 AM
Updated in first post.   :thumbsup:
#9
The Workshop / Re: dwtoa --> qwtoa
Last post by sinsi - October 21, 2024, 06:50:25 AM
Nasty little bug if qwValue=0  :sad:
    test rax,rax
    jnz not_zero
    push "0"
    jmp reverse ;<<<<<<<<<<<<<<<<<<<<
#10
The Campus / Re: 64 bit variables
Last post by NoCforMe - October 21, 2024, 05:56:57 AM
Quote from: zedd151 on October 21, 2024, 03:19:55 AM@C3, nope. Reading that stuff makes my eyes bleed.  :tongue:
I prefer explanations in plain language, from others with experience with such things.  :biggrin:

Check out this page; it shows all the possible permuations of MOV.

Look at the end for all the variations that allow immediate values to be moved: notice that there are 4 sizes, imm8, imm16, imm32 and imm64. The only place that an immediate 64-bit value is allowed is when the destination is a register, not memory. (Keep in mind that r/mXX means "register or memory".)

It's not rocket science.