flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Signed value in macro/load |
Author |
|
Tomasz Grysztar 27 Sep 2014, 22:09
You can use this simple macro devised by LocoDelAssembly:
Code: macro def [name, size] { macro signExtend.#name v.out, v.in \{ v.out = v.in or (0 - v.in shr (size - 1)) shl (size - 1) \} } def byte, 8,\ word, 16,\ dword, 32,\ qword, 64 purge def Your sample can be adapted to use it this way: Code: macro call Dst { local ..Str ..Str: call Dst load A1st byte from ..Str if A1st=0xE8 load A2nd dword from (..Str+1) ; How to get signed value of A2nd? signExtend.dword A3rd,A2nd if A3rd<-32768 | A3rd>32767 err end if end if } use32 org 0x0 call $-32 |
|||
27 Sep 2014, 22:09 |
|
l_inc 28 Sep 2014, 01:13
CandyMan
I think, much better idea would be to compare $-localDst (where localDst = Dst) with the bounding values than to load the displacement from the encoded instruction. _________________ Faith is a superposition of knowledge and fallacy |
|||
28 Sep 2014, 01:13 |
|
CandyMan 28 Sep 2014, 09:03
Thanks.
_________________ smaller is better |
|||
28 Sep 2014, 09:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.