Author Topic: Procedure for testing a reg size.  (Read 1773 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7609
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Procedure for testing a reg size.
« 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: