flat assembler
Message board for the users of flat assembler.
Index
> Main > Questions by index of massive and procedures |
Author |
|
revolution 09 Nov 2013, 03:29
Try this:
Code: mov ax,[si+mas] |
|||
09 Nov 2013, 03:29 |
|
Satansoft 09 Nov 2013, 08:00
I try to write first and last elements to variables, but have some troubles
like this: Quote: error: operand sizes do not match. or this this Quote: error: invalid operand. if use movsx Code: xor eax,eax lea dx, [mas] mov edi, 10 mov esi, 1 movsx ax, [esi+mas] mov [a], ax movsx ax, [edi+mas] mov [b], ax |
|||
09 Nov 2013, 08:00 |
|
revolution 09 Nov 2013, 08:10
How have you defined mas?
|
|||
09 Nov 2013, 08:10 |
|
Satansoft 09 Nov 2013, 08:18
revolution wrote: How have you defined mas? db, ten elements |
|||
09 Nov 2013, 08:18 |
|
RIxRIpt 09 Nov 2013, 08:43
You are trying to mov byte to ax (word)
Code: mov al, [(e)si + mas] Or if you want to get 2 bytes in ax: Code: mov ax, word[(e)si + mas] |
|||
09 Nov 2013, 08:43 |
|
Satansoft 09 Nov 2013, 09:03
Code: mov ax, word[(e)si + mas] Quote: error: invalid address. It's just appel to elements of array, what's wrong the syntax to this o.O |
|||
09 Nov 2013, 09:03 |
|
revolution 09 Nov 2013, 09:07
Just use si.
Code: mov ax,word[si+mas] |
|||
09 Nov 2013, 09:07 |
|
Satansoft 09 Nov 2013, 09:12
this is have no effect, look:
|
||||||||||
09 Nov 2013, 09:12 |
|
revolution 09 Nov 2013, 09:19
If you are using a PE file then you will need to use the 32-bit registers for addressing. Use ESI.
|
|||
09 Nov 2013, 09:19 |
|
Satansoft 09 Nov 2013, 09:32
If Array have 10 symbols, how many positions need to shift to appeal to last element?
|
|||
09 Nov 2013, 09:32 |
|
JohnFound 09 Nov 2013, 09:50
Satansoft wrote: If Array have 10 symbols, how many positions need to shift to appeal to last element? In programming, everything is counted from 0. If you want to read the last word from your 10 bytes array, use: Code: mov esi, mas mov ax, word [esi+8] Code: mov ax, word [mas+8] P.S. BTW, where are you from? Naming an array "масив" talks about some of the slavonic languages. _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 Last edited by JohnFound on 09 Nov 2013, 10:28; edited 1 time in total |
|||
09 Nov 2013, 09:50 |
|
Satansoft 09 Nov 2013, 10:08
Thx to all helpers.
Quote:
Have no Slavonic language, it's an a group of languages. Quote:
Greetings from Ukraine :3 |
|||
09 Nov 2013, 10:08 |
|
JohnFound 09 Nov 2013, 10:29
Satansoft wrote: Greetings from Ukraine :3 Welcome in the assembly world. _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 |
|||
09 Nov 2013, 10:29 |
|
Bargest 09 Nov 2013, 16:44
Do you really want to get WORD from array? It's defined as 'db', so reading by words will give you values as 406h, 609h, 92Bh, etc. I think you should use AL:
Code: mov al, [mas + 9] |
|||
09 Nov 2013, 16:44 |
|
ejamesr 09 Nov 2013, 17:19
Try any of these:
Code: ; When mas is a global variable (as in your example), the following will work mov al, [mas + 9] ;-- OR -- mov edx, mas mov al, [edx+9] ; But when 'mas' is a stack-based variable, you should use 'lea': lea edx, [mas] ; also works when 'mas' is global mov al, [edx + 9] |
|||
09 Nov 2013, 17:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.