Author Topic: Correction in str$ macro  (Read 298 times)

HSE

  • Member
  • *****
  • Posts: 1858
  • AMD 7-32 / i3 10-64
Correction in str$ macro
« on: December 02, 2021, 01:11:59 AM »
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:
Code: [Select]
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    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:
Code: [Select]
15
18446744073709521616

15
-30000

above

not greater

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