flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Instruction too optimized & lea segment instruction

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 13 Nov 2020, 17:56
1. Instruction too optimized
Code:
jmp  word $+16 ; nasm: E9 0D 00, fasm: EB 0E    


2. maybe ignoring segment override in lea instruction?
Code:
lea ax,[es:di]    

_________________
smaller is better
Post 13 Nov 2020, 17:56
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 13 Nov 2020, 18:02
1. The semantics used by fasm focus on what the instruction does, not how it is encoded. The size override does not reflect the size of immediate field in the instruction, it corresponds to an actual size of the target address:
Code:
jmp word -1     ; EB FD         jumps to 0FFFFh
jmp dword -1    ; 66 EB FA      jumps to 0FFFFFFFFh    


2. Yes, the segment prefixes could be safely ignored there, I guess this never really came up, as you rarely see LEA instruction used this way.
Post 13 Nov 2020, 18:02
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 13 Nov 2020, 18:42
I understand.

Thanks for the quick reply.
Post 13 Nov 2020, 18:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.