flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 09 Nov 2013, 03:29
Try this:
Code: mov ax,[si+mas] |
|||
![]() |
|
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 |
|||
![]() |
|
revolution 09 Nov 2013, 08:10
How have you defined mas?
|
|||
![]() |
|
Satansoft 09 Nov 2013, 08:18
revolution wrote: How have you defined mas? db, ten elements |
|||
![]() |
|
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] |
|||
![]() |
|
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 |
|||
![]() |
|
revolution 09 Nov 2013, 09:07
Just use si.
Code: mov ax,word[si+mas] |
|||
![]() |
|
Satansoft 09 Nov 2013, 09:12
this is have no effect, look:
|
||||||||||
![]() |
|
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.
|
|||
![]() |
|
Satansoft 09 Nov 2013, 09:32
If Array have 10 symbols, how many positions need to shift to appeal to last element?
|
|||
![]() |
|
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 |
|||
![]() |
|
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 |
|||
![]() |
|
JohnFound 09 Nov 2013, 10:29
Satansoft wrote: Greetings from Ukraine :3 Welcome in the assembly world. ![]() _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 |
|||
![]() |
|
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] |
|||
![]() |
|
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] |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.