flat assembler
Message board for the users of flat assembler.
Index
> Main > Register or Memory Operand |
Author |
|
DOS386 04 Sep 2007, 22:09
Quote: have a question, what is the difference After 3 years and 35 posts ? Quote: between a Register and a Memory Operand. Code: mov [0],eax ; memory <- register mov [edi],eax ; memory <- register mov ebx,eax ; register <- register mov eax,0 ; register <- imm ||see also XOR EAX,EAX thread ; mov eax,eax ; NOP ; movl %%eax,%%blah[junk]$$$ ; GAS only ; movntq blah,@!#$# ; Risky, SSE only ; mov eax, dworld ptr edi ; MA$M (+clones) only See also FASM.TXT and 80386 manual. And the problem is ? _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
04 Sep 2007, 22:09 |
|
Hicel 07 Sep 2007, 01:25
Hmm yes, lets call me a "if i'm forced to assembly, i try to figure it out, but end up asking stupid questions" person.. hehe.. sorry.. I was just reading some papers and sometimes get confused because of too much information.. and then i don't know anything.. anyway after you replied it was clear to me again so thank you.
I have another question.. does anyone know how to force the encoding 83 XOR r/m32,imm8 Code: use32 xor [dword 0h], byte 0h ;encodes to: 80h 35h 0h 0h 0h 0h 0h is 80h = 80 XOR r/m8,imm8 but when does it encode to 83? isn't this m32,imm8? i don't understand that. |
|||
07 Sep 2007, 01:25 |
|
Hicel 07 Sep 2007, 02:44
Thank you, I noticed this before I will try to avoid the byte.
but Code: use32 xor [dword 0h], 0h or xor [0h], 0h does not work fasm wants this 'byte' or something else Error: 'operand size not specified' |
|||
07 Sep 2007, 02:44 |
|
LocoDelAssembly 07 Sep 2007, 03:06
yes, you forgot to specify memory operand size, you had just specified that you want the offset encoded as a dword.
Code: xor <type>[{dword|nothing} address], imm xor byte [dword 0], 0 ; Xor the byte at address 0. Offset encoded as dword xor byte [0], 0 ; Xor the byte at address 0. Offset endoded as byte xor dword [$FFFF], 0 ; Xor the dword at address 0xFFFF. Offset endoded as dword (because it doesn't fit in a byte) |
|||
07 Sep 2007, 03:06 |
|
Hicel 07 Sep 2007, 06:57
Thanks! great help! worked just fine maybe i should really read more about the fasm syntax.
|
|||
07 Sep 2007, 06:57 |
|
DOS386 07 Sep 2007, 22:27
.
Note FASM is different from NASM here and auto-defaults to 8-bit encoding of 32-bit operands whenever possible. Use dword to force 32-bit encoding. Code: use32 nop xor dword [dword 0], 0 ; THIS one nop xor dword [dword 0], dword 0 ; 1st dword operand size, 3rd dword for 32-bit encoding nop |
|||
07 Sep 2007, 22:27 |
|
xspeed 09 Sep 2007, 21:41
i guess i will answer this as easy and simple as i can
register=just number or a location of a memory Memory Operand=stuff that you get when you get/put in a register let say: at 407004=11111 mov eax,407004 this virtually mean that eax=407004 mov eax,[eax] now this mean that eax=11111 mov eax,407000 mov dword ptr [eax],10000 this mean that at 407000=10000 407000=10000 407004=11111 mov eax,408000 mov dword ptr[eax],10000 mean absolutely nothing and will generate an error because i have nothing at that memory |
|||
09 Sep 2007, 21:41 |
|
DOS386 09 Sep 2007, 23:40
.
Quote: mov dword ptr [eax],10000 Seems to be TASM Ideal syntax, not FASM ... you are generating confusion Quote:
Quote:
Error when compiling or when running ? "I have nothing at that memory" But YES, in PM faulty memory accesses can run into a GPF or PF _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
09 Sep 2007, 23:40 |
|
xspeed 10 Sep 2007, 15:06
eax=register value (location of a memory)/immediate data value
[eax]=a value at that memory location fasm is not cable of debugging an error, it just complies and check only syntax error, not cpu error. and there is nothing wrong with dword ptr, i love that shit |
|||
10 Sep 2007, 15:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.