x86 - Get the size of a variable in assembly language at runtime -


I am trying to get the size of a register (bytes) on the runtime in X86 assembly language, but I do not know that it is still possible in the X86 assembly language, whether it is possible to obtain the size of the register at runtime is? For example, is it possible to obtain the size of a register or variable (like ebx ), and it is possible to transfer it to another register (like eax )?

When I tried to run the command mov bx, sizeof bx , then the MASM codel generated the following error: 1> P4.asm (57): error A2009: syntax error expression .

Yes, just do it

  mov ex, 4; EX = Size in ebaytes bytes   

CPU registers are not flexible in size; they are fixed.

For variables, just use the variable and the difference after your label, something like this:

  Mastring DB "Blah Blah Blah", 10,0 Mistressed Label $ ; Or just "mestringand:" ... mov eax, mastrendend - mystring; Or "Offset Mystring Offset Maestring"    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -