Note: Please, before you read my post, don't flame me for being a n00b....

Anyways, I am currently trying to learn assembly using the book titled, "The Art of Assembly" and have read up to chapter 5. Now, it has already started to describe the mov instruction and such, but the more i read on, I'm still left with the same question..... What's the point of storing different hex values in registers? .. I mean... Is there a significant purpose for each value? (eg. colour font has its own value in hex, etc, etc.) Or....?
:stupid:

Any help would be GREATLY appreciated... :grin: :grin:
Posted on 2004-06-29 10:22:46 by Malice
It is best you work with registers rather than memory (variables). There is not much opcodes that deal with memory to memory.
Posted on 2004-06-29 10:27:33 by roticv
The purpose of registers is to temporarily store data from memory (gives it a physical logic) to be manipulated in a mathematical/logical way (by instructions) to produce a desired result. Most people think too much on a macroscopic level to readily realize what the collective effects of such microscopic operations can be... which is mainly why compiled programming languages such as C are used. Every part of a computer system relies on the manipulation of data. It is upto you as the programmer to give the ultimate result meaning.
Posted on 2004-06-29 10:36:58 by SpooK
Hi Malice,

Every number is actually binary in the computer, that is a series of 0's and 1's humans use Hex or Decimal to represent those numbers because it is easier for us. The meaning that is applied to the number depends on the context that it is used in. For example if I said "742" you would have no idea what I was referring to but if I put it in context for example "742 Evergreen Terrace" then you know that I am referring to Homer Simpson's street address. It is the same things with the numbers you are referring to, when used in a function that draws colors 0FF0000h means Blue, but when used in another context it can have an entirely different meaning.

The registers are used to move information back and forth from different parts of your computer, but mainly memory. And unlike memory you are allowed a lot more latitude in how you use them, as Roticv said, you cannot move data directly from memory to memory (with a couple of exceptions) but you can move from register to register. This flexibility is very advantageous and in most cases critical for programming. The other thing that registers allow you to do is to perform logic (AND NEG etc...) on data and math as Spook said. Finally registers are *fast* when compared to any other data storage scheme including the fastest memory you can imagine, so assembly language programmers love to use them, the more you do the faster your program runs. But the number of registers are severely limited as it costs big time money to put them in a CPU so you must use them wisely and some like ESI, EDI, EBX, EBP and ESP are expected to be preserved by Windows, that means that Windows expects that if you use them you will always restore the value in them in a Callback type operation.
Posted on 2004-06-29 11:37:56 by donkey
Thx SO much Guyz!! You don't know how much this has helped me!:alright:

Ok.. Now.. 1 more question..

Is there some type of manual I could buy that tells me what values of binary/hex mean in different areas off assembly? (like the colour you just pointed out..). Or... a URL/e-book you could suggest to me?
Posted on 2004-06-29 20:05:01 by Malice
Malice, the matrix has you. We don't read the code directly the numbers are usually abstracted through Equates - we just see blonde, brunette, redhead, etc... :)

The windows.inc file is a good example: there are many equates which have context only for certain API functions. ASCII codes are another example and are fairly useful throughout computers to represent text (41h is 'A'). The numbers are everywhere!

Don't get caught up in the numbers yet - take it as fact that everything is a number.
Posted on 2004-06-29 20:43:31 by bitRAKE

Malice, the matrix has you. We don't read the code directly the numbers are usually abstracted through Equates - we just see blonde, brunette, redhead, etc... :)

The windows.inc file is a good example: there are many equates which have context only for certain API functions. ASCII codes are another example and are fairly useful throughout computers to represent text (41h is 'A'). The numbers are everywhere!

Don't get caught up in the numbers yet - take it as fact that everything is a number.

Classic example: False = 0, True = 1 :grin:
Posted on 2004-06-30 00:48:33 by SpooK

Classic example: False = 0, True = 1 :grin:

FALSE = 0, TRUE = anything that is not FALSE :grin:
Posted on 2004-06-30 01:01:05 by donkey

FALSE = 0, TRUE = anything that is not FALSE :grin:

FALSE != 42 :grin:
Posted on 2004-06-30 03:11:25 by SpooK
For some politicians, true can be equal to 0 and false to 1
Posted on 2004-06-30 04:51:34 by Vortex
Politicians use fuzzy logic ... they are arbitrarily stateful :)
Posted on 2004-06-30 07:44:10 by Homer
For politicians:

\$=TRUE

:) Note false can be equal to true.
Posted on 2004-06-30 07:57:56 by bitRAKE
:alright: thx guyz! (again)... And after doing a little research on these "Eqautes", I found out that even the colour codes you use in webpage coding requires the hex value for the specific colour in order to work... :rolleyes: kool eh? :tongue:
Posted on 2004-06-30 10:23:43 by Malice
everything is based on our stuff :)
Posted on 2004-06-30 11:00:06 by Homer

:alright: thx guyz! (again)... And after doing a little research on these "Eqautes", I found out that even the colour codes you use in webpage coding requires the hex value for the specific colour in order to work... :rolleyes: kool eh? :tongue:

Hi Malice,

The values don't have to be in hex notation, 255 is just as good as 0FFh, hex is just a representation humans use so they don't have to remember long lists of 0's and 1's. In reality the numbers can be Hex, decimal, binary or any other base notation that your compiler is capable of translating but the CPU only works in binary. A number is a number is a number no matter what radix you decide to use, but for programming hex is the easiest to see the interplay of bytes with.
Posted on 2004-06-30 11:22:57 by donkey
It is upto you as the programmer to give the ultimate result meaning.

I think you are the one that give the mean, purpouse the shape; and the programm is the one that show the results.

Every number is a representation. A representation of some that you see neesary. The representations have limits including infinite ... you see is finite ;) lol.

Have a nice day or night.
Posted on 2004-07-11 05:42:32 by rea
The registers are mostly used when we do some algorithm. When we deal with APIs, we usually use only EAX, and it just return some API value, which you will use as a parameter for another API, for example. When you are making an algorithm, you can put them the values you want. Let?s suppose that you use ADD. You put the values in any register:

MOV ESI, 4
MOV EDI, 5
ADD ESI, EDI ; ESI = 9

ESI and EDI could be EAX, EBX, ECX, whatever.

I hope this is what you want to know
Posted on 2004-07-11 10:28:31 by Marginais