flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > mov sr,r16 |
Author |
|
NoName_s 08 Feb 2006, 12:24
if comment use32 string my code generate ok. fasm 1.64
|
|||
08 Feb 2006, 12:24 |
|
Tomasz Grysztar 08 Feb 2006, 13:23
Can you post some complete source that shows your problem?
|
|||
08 Feb 2006, 13:23 |
|
shoorick 08 Feb 2006, 13:25
you can not load segment registers with immediate value. only with other registers or via push/pop
=== i was wrong, but here is test:
_________________ UNICODE forever! Last edited by shoorick on 08 Feb 2006, 14:44; edited 1 time in total |
|||||||||||||||||||
08 Feb 2006, 13:25 |
|
shoorick 08 Feb 2006, 14:11
i think shown in debugger window is because debugger treat code as 16-bit while it is 32-bit, thus shows wrong. in real, it is exacltly "mov ax" for 32-bit code, and next command is included into continued immediate because of wrong disassembly
|
|||
08 Feb 2006, 14:11 |
|
Tomasz Grysztar 08 Feb 2006, 14:18
Yes, the problem lies in using the right mode for disassembly. With HIEW or BIEW it's very easy to switch between 16- and 32-bit mode, you should always adjust it accordingly.
|
|||
08 Feb 2006, 14:18 |
|
NoName_s 08 Feb 2006, 19:16
imm = const
rxx = reg sr = segment register this error in this code: Code: use32 ; <--- jump selector:offset mov ax,imm16 mov sg,ax And i found some problem before; fasm generate wrong code on this ~ Code: ;far call call [sr:offset] i don't know now how of sr's not correct try to brute it, one not generated as must add: And one problem. if i not write use32 all r32 assembled as r32, but if i use rep movsd i must write prefix db 67, why? |
|||
08 Feb 2006, 19:16 |
|
Tomasz Grysztar 08 Feb 2006, 19:43
This source:
Code: use32 jmp 0:0 mov ax,4 mov fs,ax Generates the following (disassembly made using HIEW, after switching to 32-bit mode): Code: 00000000: EA000000000000 jmp 00000:000000000 00000007: 66B80400 mov ax,00004 0000000B: 8EE0 mov fs,ax Everything seems to be correct. As for the second one, like in this sample: Code: call far [fs:offset] This the indirect jump, thus the address it jumps to is taken from the memory location, and the FS applies to the address of this location. The selector/segment of the target of jump is stored in the first 16 bits of PWORD at that location. I explain this here, because I'm under impression you're expecting this instruction to work differently than it does. |
|||
08 Feb 2006, 19:43 |
|
NoName_s 09 Feb 2006, 09:21
what about movsd?
|
|||
09 Feb 2006, 09:21 |
|
Tomasz Grysztar 09 Feb 2006, 09:30
See section 2.1.8 of manual for the complete information on the MOVS syntax.
manual wrote: Every string operation instruction has short forms which have no operands and use SI and/or DI when the code type is 16-bit, and ESI and/or EDI when the code type is 32-bit. |
|||
09 Feb 2006, 09:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.