flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 21 Jan 2019, 11:12
Isn't it in principle a similar thing to:
Code: lea esi,[rbx] Or even, going further back in time: Code: lea si,[0FFFFFFFFh] |
|||
![]() |
|
ProMiNick 21 Jan 2019, 11:17
Assembler only translate to existent opcode. Architecture support this opcode - so no error from assembly. It is undocumented feature of x64 extension. not more.
Not undocumented. Wrong documented. |
|||
![]() |
|
revolution 21 Jan 2019, 11:20
Tomasz Grysztar wrote: Isn't it in principle a similar thing to: Maybe force the programmer to apply the conversion manually Code: lea si,[(variable) and 0xffff] |
|||
![]() |
|
Tomasz Grysztar 21 Jan 2019, 12:06
But then this would be a different instruction, and you would have no way of assembling the original one.
In general these kinds of modifications to make assembler "smarter" were usually not well received, at least in case of fasm. On the other hand, I made fasmg's implementation of instruction sets in form of macros exactly to allow this kind of customization for anyone that needs it: Code: macro lea? dest*,src* x86.parse_operand @dest,dest x86.parse_operand @src,src if @src.type = 'mem' & @dest.type = 'reg' if @src.address relativeto 0 &\ ( ( @dest.size = 2 & @src.address > 0FFFFh ) |\ ( @dest.size = 4 & @src.address > 0FFFFFFFFh ) |\ ( @dest.size = 4 & @src.mode = 64 & @src.address > 7FFFFFFFh ) ) err 'address too large to fit in destination register' end if x86.select_operand_prefix @src,@dest.size x86.store_instruction 8Dh,@src,@dest.rm else err 'invalid combination of operands' end if end macro |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.