flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
baldr 08 Apr 2013, 22:53
jorom,
Probably because segment register is 16-bit-wide? |
|||
![]() |
|
MazeGen 09 Apr 2013, 09:30
According to Intel manual, such operand combination is allowed: "When the processor executes the instruction with a 32-bit general-purpose register, it assumes that the 16 least-significant bits of the general-purpose register are the destination or source operand."
|
|||
![]() |
|
Tomasz Grysztar 09 Apr 2013, 13:24
When you reverse the direction, there really are two different instructions:
Code: mov ax,cs ; doesn't clear upper bits mov eax,cs ; clears upper bits But when you move into the segment register, there is only one instruction, prefix doesn't matter. In this case fasm requires that you specify the actual data (16-bit register) that is used and no prefix is generated, no matter what mode you use. |
|||
![]() |
|
MazeGen 09 Apr 2013, 13:45
I know this is a very minor issue but fasm behaves inconsistently here. MOV Sreg, gpr16 is actually assembled to MOV Sreg, grp32; MOV Sreg, gpr32 can't be assembled.
(Yes, as for the unmatching operand sizes the manual mentions only MOV Sreg, r/m64 so I assume the MOV Sreg, r/m32 is missing unintentionally) |
|||
![]() |
|
Tomasz Grysztar 09 Apr 2013, 14:17
MazeGen wrote: I know this is a very minor issue but fasm behaves inconsistently here. MOV Sreg, gpr16 is actually assembled to MOV Sreg, grp32; MOV Sreg, gpr32 can't be assembled. |
|||
![]() |
|
MazeGen 09 Apr 2013, 17:50
Intel Instruction Set Reference, A-Z (325383-044US, August 2012) has MOV Sreg, r/m64 instruction, described as "Move lower 16 bits of r/m64 to segment register." The source gpr32 operand is mentioned below in the Description chapter, and IIRC it was always there.
I'm not saying fasm should strictly follow Intel syntax, however, we can't say there is no such instruction as "MOV Sreg, gpr32" when we can find it in the manual ![]() |
|||
![]() |
|
Tomasz Grysztar 09 Apr 2013, 18:10
The main reason why syntax rules for the complete instruction set are documented in fasm's manual is that fasm's syntax does not always follow the rules from Intel or AMD manuals. With later instruction sets I sometimes give up and do not reinvent syntax to clear up the inconsistencies, but with the original 80386 instruction set I did some tweaking. For me there is no "MOV Sreg, gpr32" instruction, because you do not use the 32-bit register there (since, obviously, this data would not fit in destination), you use only 16-bit one, and this is what the instruction syntax should state.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.