flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > xlat bug?

Author
Thread Post new topic Reply to topic
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
xlat in source code -
xlat
error: invalid operand.


xlatb compiles fine.
what operant is invalid? xlat doesnt have operand!
why compiler throw operand error instead of wring instruction?
Post 13 Mar 2010, 14:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Code:
xlat byte[ebx]    
Strangely enough it is in the documentation:
xlat replaces a byte in the AL register with a byte indexed by its value in a translation table addressed by BX or EBX. The operand should be a byte memory addressed by BX or EBX with any segment prefix. This instruction has also a short form xlatb which has no operands and uses the BX or EBX address in the segment selected by DS depending on the current code setting.
Post 13 Mar 2010, 14:16
View user's profile Send private message Visit poster's website Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
chapter 4.1, xlat.
its only 1 instruction, with no operands.
Post 13 Mar 2010, 14:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Are you talking about the Intel manual?
Quote:
D7 XLAT m8 Set AL to memory byte DS:[(E)BX + unsigned AL].
D7 XLATB Set AL to memory byte DS:[(E)BX + unsigned AL].
Did you see the "m8" parameter there?
Post 13 Mar 2010, 14:47
View user's profile Send private message Visit poster's website Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
did you see the D7 instruction?
how it can take and not take arguments at once?
Post 13 Mar 2010, 15:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
a115433: What are you arguing? fasm is following the Intel manual. What would you have it do otherwise?
Post 13 Mar 2010, 15:21
View user's profile Send private message Visit poster's website Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
i just dont understand it.
0xD7 i xlat and xlatb.
why fasm disallow 1 name?

maybe it has something to do with adding 0x67 prefix, i dont know.
what about rex.w prefix?
it can take it in long mode.
what will it do?
rex.w = operand size override. there is no operand, always only 1 byte is transfered!
Post 13 Mar 2010, 15:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
What happens here?
Code:
xlat byte[bx]
xlat byte[ebx]
xlat byte[rbx]    
Post 13 Mar 2010, 15:33
View user's profile Send private message Visit poster's website Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
real mode:
d7
67 d7
error
protected mode:
67 d7
d7
error
long mode:
error
67 d7
d7
Post 13 Mar 2010, 15:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
So the parameter is necessary.
Post 13 Mar 2010, 16:16
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
a115433,

Difference between xlat m8 and xlatb is quite obvious.
Post 13 Mar 2010, 19:59
View user's profile Send private message Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
its the same instruction, i still dont get any diffrence.
Post 13 Mar 2010, 22:06
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
a115433,

One instruction (xlat mnemonic) requires m8 operand, other is operand-less. They can have the same opcode, though.
Post 14 Mar 2010, 00:45
View user's profile Send private message Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
ok, so how does this assembler work?
is it opcode based, or mnemonic based? whats more important?

i mean if they translate mnemonics to instructions, or just give names to certain opcodes to make them easier to use.

i guess its mnemonic base, because 2 names = 1 opcode.

anyway i thinbk xlat suck. no pipeline, 4 clocks, and waste of *bx.
mov is better, you can add displacement to it and sib if you want to. and you can access byte/wrd/dword/qword, as you want.
Post 14 Mar 2010, 12:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Well xlatb is a shortcut for when you don't need a different segment register or a different address size. The real instruction is actually xlat m8 which gives the most flexibility.

Anyhow, you are not forced to use it if you don't like it. Each to their own I guess.
Post 14 Mar 2010, 12:55
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.