flat assembler
Message board for the users of flat assembler.

Index > Main > Questions about registers

Author
Thread Post new topic Reply to topic
Diode



Joined: 04 Jan 2005
Posts: 15
Diode 05 Jan 2005, 04:58
I just started learning assembly (HLA) like Friday or Saturday last week, and just today, started learning Fasm, since somebody on a forum suggested it.

So my question is, what is a register?

All that is in the documentation I have seen says this:

"The parameters for interrupts have to be provided in registers - places in processor which can hold some values."

So my best guess is that they are like variables. But what is the difference?

I have learned alot in half a week so far, and I don't believe all the stuff people say like, assembly is too hard, or you need to be a hacker to learn assembly, or, only hackers use assembly, it's too hard, blah blah blah.

I am determined to learn this. I feel pretty good with what I have learned so far, and I am confident that I finally found one of the best places on the internet that has to do with assembly.

Thanks.

-Diode

_________________
Mac for productivity. Unix for development. Windows for solitaire.
Post 05 Jan 2005, 04:58
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
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
Post 05 Jan 2005, 07:18
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
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 Sad
Post 05 Jan 2005, 09:43
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
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?
Post 05 Jan 2005, 12:00
View user's profile Send private message Visit poster's website Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
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.
Post 05 Jan 2005, 13:01
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
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.
Post 05 Jan 2005, 17:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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.