The MASM Forum

64 bit assembler => 64 bit assembler. Conceptual Issues => Topic started by: hutch-- on August 07, 2016, 08:20:05 PM

Title: Procedure for testing a reg size.
Post by: hutch-- on August 07, 2016, 08:20:05 PM
This differs from a macro to do this at assembly time, its a tool for runtime evaluation of words and if they are registers the size in bytes is returned in RAX.

This is the calling code but I have not published the macros yet as they are subject to serious testing.

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

    include \masm32\include64\masm64rt.inc

    .code

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

entry_point proc

    .stackspace 8

    print str$(rv(allregs,"r9b")),lf, \
          str$(rv(allregs,"r11w")),lf, \
          str$(rv(allregs,"eax")),lf, \
          str$(rv(allregs,"rdx")),lf, \
          str$(rv(allregs,"st(0)")),lf, \
          str$(rv(allregs,"xmm7")),lf, \
          str$(rv(allregs,"ymm3")),lf

    waitkey

    fn ExitProcess,0

    ret

entry_point endp

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

    include allregs.asm

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

    end


The file allregs.asm is attached in a zip file.