flat assembler
Message board for the users of flat assembler.

Index > Main > variables and lebels

Author
Thread Post new topic Reply to topic
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov 03 Dec 2004, 08:11
In my procs, i use very often local or global variable and lebels like i,j,k,l..., but i cannot define like anonymous. I solve the problem as defined it as i1,i2..., but my procs is too much and compiler often return me error message "symbol already defined". Is it possible to define anonymous variables and how?

Thanks in advance
Post 03 Dec 2004, 08:11
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 03 Dec 2004, 12:18
Did you mean:
Code:
data:
Variable_array dd 0,0,0,0,0,0,0,0,0,0 ;10 variables

code:
mov  eax,[Variable_array]
add  ebx,[Variable_array+4] ;notice the DWORD offset
xor  ecx,[Variable_array+8]
shld eax,ebx,cl
mov [Variable_array+36],eax ;the last in line
    
?
But it doesn't have any error checking so +40 already intrudes another var.
Other examples are *local* variables. You can use them twice, but only in their scope:
Code:
Label1:
    .j:
        ;some code...
    .k:
        ;more code
        jmp .j ;This jumps to Label1.j
Label2:
    .j: ;you can use it here again!
        ;some code...
    .k:
        ;...
        jne .k ;This jumps to Label2.k
        jmp Label1.k ;If you REALLY need to get out of this scope Very Happy
    

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 03 Dec 2004, 12:18
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov 03 Dec 2004, 18:32
Thanks Madis731 for quick replay. Smile
But simples solve my problems in part (i know about simple 2).
My job is to united part A, B, C... in one part, where first man write part A, second - part B, .....
But one man wrote:
proc ....,arg1,arg2,..
i dd ?
j dd ?
...
enter
...
Second:
proc ....,arg1,arg2,..
i dd ?
n dd ?
enter
....
And i lost a time to edit working procs... Mad
I told - man "A" to write i1,j1 for him variable, and man "B" to write i2, n2....
But it help me almost but not quite and confuse work my colleagues.
Post 03 Dec 2004, 18:32
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 03 Dec 2004, 21:52
You might want to check out "virtual". I don't know if it solves you problem, but if it doesn't I hope someone else on the board can help.
Post 03 Dec 2004, 21:52
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 04 Dec 2004, 13:51
Use local variables as Madis advice and your men won't have any problems.They could decide freely the names for the variables regardless the other's procedures, even in different files and different computers (everyone can build the project accross the network).
Code:
proc ....,arg1,arg2,..
.i dd ? ; variable is local to the proc scope
.j dd ?
...
enter
...
;Second:
proc ....,arg1,arg2,..
.i dd ?
.n dd ?
enter 
;...
    
Post 04 Dec 2004, 13:51
View user's profile Send private message Yahoo Messenger Reply with quote
Nikolay Petrov



Joined: 22 Apr 2004
Posts: 101
Location: Bulgaria
Nikolay Petrov 04 Dec 2004, 23:07
Problem has decide Smile
Thanks
Post 04 Dec 2004, 23:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.