flat assembler
Message board for the users of flat assembler.
Index
> Main > problem with using a register as a pointer |
Author |
|
revolution 19 May 2008, 02:06
fatdogs12 wrote:
fatdogs12 wrote:
Code: mov byte[eax],20 |
|||
19 May 2008, 02:06 |
|
asmrox 19 May 2008, 07:59
why dont u u se stack for array?
sub esp,10 mov ebp,esp mov byte [ebp+9],0 |
|||
19 May 2008, 07:59 |
|
edfed 19 May 2008, 09:07
difference with stack and arrays:
stack elements are defined at run time ( but can be defined during compile) arrays elements are defined during compilation ( but can be defined at run time) stack is in global memory but used for a context-save mechanism. memory is global, and is general purpose. the stack frames used in C and hll are what they are: something from an old age. can you set up a stack like a file? open file read file at stack use this stack reliabily between all procedures? there are mechanisms in IA 32 to use stack frames in a lot of ways, but none of them is natural or simple. the simplest is the global memory. |
|||
19 May 2008, 09:07 |
|
vid 19 May 2008, 09:30
Quote: stack is in global memory but used for a context-save mechanism. what do you mean by this? Quote: the stack frames used in C and hll are what they are: something from an old age. not true anymore. new compilers can live finely without stack frames - something quite hard to do in asm Quote: the simplest is the global memory. But not good for everything. It is okay for small hobby projects, but not for real bigger stuff. With "everything as global" you can't use recursion, position-independent code, shared code, multithreading, etc... eventually you will find out the problem with it (ever wondered why there is no shared DLL version of FASM?) |
|||
19 May 2008, 09:30 |
|
edfed 19 May 2008, 09:42
Quote:
i try to mean that stack is a little part of the possibilities of Global memory. it i not hard to code without stack frames. for sure, all "global" is not good, but as global, i assume there are "local" arreas inside the global, like segments, pages and stack frames. see that stack frames are local, but... they are temporary, not permanent, and they are not able to address variables inside an other stack frame. then, using stack for arrays is not a good idea. the global/local addressing is a real problem is OOP, as each object will be charged somewhere in the "Global" memory, and accessed via other objects or code. y=ax²+bx+c is the equation of the memory problem. |
|||
19 May 2008, 09:42 |
|
vid 19 May 2008, 11:09
Quote: i try to mean that stack is a little part of the possibilities of Global memory. Not true. There are some things only globals can (pre initialized values), but there are many things that locals can and globals can't. See list in previous post. |
|||
19 May 2008, 11:09 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.