flat assembler
Message board for the users of flat assembler.
Index
> Main > Questions about registers |
Author |
|
JohnFound 05 Jan 2005, 07:18
Well, registers are memory cells. But instead of normal RAM memory, that is external to the CPU, registers are inside CPU. Also, unlike normal memory, where every memory cell (byte) has address (I hope you already know what is address) the registers have no address - they have only name - I mean, as far as the registers are only several, the register can be specified as several bits in the code of the instruction, not as big 32 bit address as an instruction operand - this make instructions smaller and also (because the registers are inside the CPU) the access to them is extreamly fast.
The main purpose of the registers is to be the one of parameters for instructions (this is a little bit simplyfied, but anyway)... As far as the CPU instruction can address only one cell of the memory, the second operand (argument, parameter) for the instruction have to be in one of the registers. Example: Code: add eax, [SomeMemory] ; adds the content of the memory with address SomeMemory to the content of the register "eax", i.e. eax = eax + [SomeMemory] The main registers in x86 32bit CPUs are: 1. eax, ebx, ecx, edx ; these are little bit special. 2. esi, edi, ebp ; so called index registers because of historical reasons - simply normal 32bit registers. 3. esp, eip , flags - special purpose registers. 4. cs, ds, es, ss, fs, gs - segment registers Regards |
|||
05 Jan 2005, 07:18 |
|
Madis731 05 Jan 2005, 09:43
I don't want to bloat you with asnwers and information here, but if you look carefully at google-ads (best way to advertise I think) you can see an x86 emulator there. I downloaded it and had fun too, though, I can see much potential in the beginners field...I just can't recall the address right now
|
|||
05 Jan 2005, 09:43 |
|
vbVeryBeginner 05 Jan 2005, 12:00
one question to add here,
does segment registers still functioning inside 32 bits assembly programming? and how could we use them? |
|||
05 Jan 2005, 12:00 |
|
beppe85 05 Jan 2005, 13:01
@vbVeryBeginner: the x86 architecture imposes some rules about these registers. Intel manuals says the selectors on CS and DS must be always valid(have an entry in GDT) and not null. Others segments cause a fault just when accessed, if they are non valid. But Windows does use some of them: CS for code, DS for data and FS for exception handling.
I have just tested modifying them and I got an external exception. Even if they not, segments selectors are just 16 bits and don't have plenty of instructions to handle them. |
|||
05 Jan 2005, 13:01 |
|
vid 05 Jan 2005, 17:14
segment registers holds so called "selectors" which are pointers into descriptor table. Address of descriptor table is loaded in special registers. Decriptor is structure which holds information about segments. So selector is a pointer on one of descriptor in that table (or index of descriptor in table, i am not sure here). All needed info about segment is in descriptor.
|
|||
05 Jan 2005, 17:14 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.