News:

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

Main Menu

Correction in str$ macro

Started by HSE, December 02, 2021, 01:11:59 AM

Previous topic - Next topic

HSE

Hi all!

Making some test I noted that str$ is calling vc__i64toa instead of vc__ui64toa.

I was reading Vasily if/else macros. Happen that default comparison is unsigned and you have to write for signed:; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    .data

        ugreat sqword -30000
        usmall sqword 15

    .code

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

entry_point proc

    mov r10, usmall
    conout str$(r10),lf
    mov r11, ugreat
    conout str$(r11),lf,lf
     
    mov r10, usmall
    conout sstr$(r10),lf
    mov r11, ugreat
    conout sstr$(r11),lf,lf

    mov r10, usmall
    .if ugreat } r10
        conout "above",lf,lf
    .else
        conout "not above",lf,lf
    .endif

    mov r10, usmall
    .if sqword ptr ugreat } r10
        conout "greater",lf,lf
    .else
        conout "not greater",lf,lf
    .endif

    waitkey

    invoke ExitProcess,0

    ret

entry_point endp

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

    end


After correction:15
18446744073709521616

15
-30000

above

not greater

Press any key to continue...
Equations in Assembly: SmplMath