Page 1 of 1

Measuring assembly instruction byte size (code length)

Posted: Fri May 11, 2018 10:09 am
by Trond

Code: Select all

; Measure the code size in bytes of assembly instructions
!@@:
; Instructions here
!mov [v_size], $-@b
Debug size
Example:

Code: Select all

!@@:
!mov rax, 0
!mov [v_size], $-@b
Debug size

!@@:
!xor rax, rax
!mov [v_size], $-@b
Debug size

!@@:
!push 0
!pop  rax
!mov [v_size], $-@b
Debug size

Re: Measuring assembly instruction byte size (code length)

Posted: Tue Dec 25, 2018 8:49 pm
by Olliv
Good stuff. Bypasses Disassembly lib which is more complex to code, and less light than this.

Re: Measuring assembly instruction byte size (code length)

Posted: Tue Dec 25, 2018 9:22 pm
by Mijikai
Olliv wrote:Good stuff. Bypasses Disassembly lib which is more complex to code, and less light than this.
Don't u need to know the size already since u need to know where to put this... ?

Re: Measuring assembly instruction byte size (code length)

Posted: Sat Dec 29, 2018 5:11 am
by Olliv
https://www.purebasic.com/documentation ... embly.html
Mijikai wrote:Don't u need to know the size already since u need to know where to put this... ?
I have no time to need to know where to put this : I was stolen this before. But I stamped a QRCode on this. No problem anymore.