PDA

View Full Version : asm bin equivs



Yarin
11-15-2008, 12:57 PM
I know basic assembly, including that assembly isn't really a language as much as it is a human-readable representation of the binary bytes.

The question is, does anyone know of a reference as to the assembly-binary equivilents?

For example, 0xC5 is RET, and 0x03 is MOV. (I know I'm wrong, but you get the idea.)

I could try to figure it out on my own with FASM and HexEdit, but a nice doc on it would be a lot less painful.

Thantos
11-15-2008, 01:04 PM
You need to get the data sheet for the specific processor and it'll tell you.

Codeplug
11-15-2008, 01:16 PM
http://www.intel.com/products/processor/manuals/index.htm

Op-codes are in the "instruction set reference". You could try out the AMD docs as well.

gg

MeTh0Dz
11-15-2008, 02:32 PM
I know basic assembly, including that assembly isn't really a language as much as it is a human-readable representation of the binary bytes.

The question is, does anyone know of a reference as to the assembly-binary equivilents?

For example, 0xC5 is RET, and 0x03 is MOV. (I know I'm wrong, but you get the idea.)

I could try to figure it out on my own with FASM and HexEdit, but a nice doc on it would be a lot less painful.

Your post is misleading.

You are talking about the hexadecimal representations.

SlyMaelstrom
11-15-2008, 02:52 PM
Your post is misleading.

You are talking about the hexadecimal representations.What's the difference? Do you have trouble converting between bases?

MeTh0Dz
11-15-2008, 02:58 PM
No I don't have trouble. I was simply saying that his post misleading.

And there is obviously a difference, one is base 16 and the other is base 2...

SlyMaelstrom
11-15-2008, 03:04 PM
No I don't have trouble. I was simply saying that his post misleading.

And there is obviously a difference, one is base 16 and the other is base 2...Again... what's the difference? It's the same value regardless of the base it's written in. I'm a bit shocked that you're constructing an Operating System yet this is the first time you've encountered a conversation where one person speaks about binary but chooses to write the values in hexadecimal in order to make the statement more legible. Secondly, the OP mentioned looking up the codes in a hex editor which would do exactly what the OP did... take the machine code and convert it into hexadecimal to compact the data for reading. This is not a new concept.

MeTh0Dz
11-15-2008, 03:15 PM
So you are arguing that his post isn't misleading?

And this isn't the first time that I've seen people misuse, words when describing number bases. I am simply pointing it out.

His statement is ambiguous, I don't see what exactly you are trying to argue.

SlyMaelstrom
11-15-2008, 03:23 PM
So you are arguing that his post isn't misleading?

And this isn't the first time that I've seen people misuse, words when describing number bases. I am simply pointing it out.

His statement is ambiguous, I don't see what exactly you are trying to argue.I feel like I'm talking to a wall here... it's the same value regardless of the base. He could have written it in octal or decimal and it would have made just as much sense as long as he states what base he's writing in. When someone prefixes a value with "0x" it's hexadecimal. That's obvious... so why are you complaining what base he's writing in if the end result is the same value?

Secondly... the two people that posted above you I know for a fact are very good programmers. They had no problem with the post for the same reason the I didn't and the OP didn't... because regardless of base, it's still the same value. Hell... if you even bothered looking at the Intel reference you'd see that they write the op codes in hexadecimal.

MeTh0Dz
11-15-2008, 03:30 PM
Dude, you are not getting my point at all. Did I ever say that the value would be different when you change bases? No.

I simply said that his wording was not explicit.

And I never said I had a problem understand what he said, so don't imply that.

Let me break this down.

He says he wants to know the assembly-binary representation, which to me says he wants to know how to represent MOV in binary which would be, "00100...". Agreed? Because that is the binary representation.

Then he goes on to show a hexadecimal representation of the MOV instruction, and says that he wants a document that would show all of the translations.

That is ambiguous.

Get my point?

Also I've read the Intel manuals so you can stop implying that I don't know what I'm talking about at any time.

SlyMaelstrom
11-15-2008, 03:46 PM
I do believe that your posts imply that you don't know what you're talking about more than mine. Who cares if he asked for Binary representation... if we gave him decimal representation or hexadecimal representation... he would be fine with it because it's the same answer. THE SAME EXACT ANSWER.

It's like Point-Slope form and Slope-Intercept form. It's the same thing written two different ways. The OP wants to go from a three letter assembly code to a machine op code, which have no logical conversion between each other. He doesn't really care what form you give him the op code in... as long as it can be converted to the form of his current needs, he would be satisfied.

Listen... if he was asking for the conversion of a base to another base... and then wrote his example in a completely different base all together, then it would be ambiguous. However, in this case it's going from one value to a complete different type of value that can be written in an infinite number of forms.

MeTh0Dz
11-15-2008, 03:59 PM
Did I ever say that a value can't be represented in an infinite number of bases and you would always get the same value? No.

Please point out a place where it appears I don't know what I am talking about. As I doubt you will find one.

Also, when you EXPLICITY say that you want to see the representation of a value in one base, which was binary. And then you show another reprentation in hexadecimal and say that you want a document on that. That is ambiguous.

I'm not saying he couldn't get the document in any number base and then just do conversions.

But the fact is those comments in themselves are ambigious to exactly what he wants. I don't see how I could be any more clear.

zacs7
11-15-2008, 04:02 PM
That is ambiguous.

Get my point?


Nope. Hex is often used as short-hand binary, there is absolutely 0 ambiguity here. That's like arguing with the computer because it says "blah is stored at address 0xF982FA20". If you explain why it's ambiguous then perhaps maybe, did you think "0x03" could be misinterpreted as binary?

Perhaps you don't understand hex or it's purpose...

MeTh0Dz
11-15-2008, 04:07 PM
Wow.... Neither of you is getting my point.

Also stop questioning whether I understand number bases, it's quite annoying.

I am simply saying that it is ambiguous to request information in one number base and then give an example in another base and say you want it to be like that.

Do you get that?

Also I'm not saying that we don't know what he means, it is just that he wasn't explicit in spelling it out.

zacs7
11-15-2008, 04:11 PM
> Do you get that?
No. It's widely understood that they can be interchangeably used, obviously no-one told you that.

For example, is this ambigious?



0b0101
+ 0x5
-----------


I'd expect 99% if not 100% of programmers/computer scientists to be able to do that...

SlyMaelstrom
11-15-2008, 04:11 PM
I don't see how I could be any more clear.There is nothing unclear about what you're saying... it's just a pointless remark. The fact that he suggested binary representation and then went on to show hexadecimal in his example only shows that he doesn't care what form you give him the answer. You're pointing out something completely irrelevant and trying to claim that it would lead people to giving bad information. The fact is that any which way his point might lead someone to answer... the answer is still going to be correct, just in a different form.

It's been completely apparent since your first post that you're just nitpicking. However, instead of actually nitpicking a genuine flaw, you're just nitpicking a choice of words that ultimately have no relevance to the content of the question asked.

I mean after reading two responses that answered his question correctly... do you honestly believe anyone was mislead by the question?

MeTh0Dz
11-15-2008, 04:13 PM
That's not even CLOSE to the same thing.

A more accurate example is me saying.

"Give me the binary representation of 5".

And you responding with.

"0x5"

As opposed to.

"0b00000101"

I never said anyone was confused, I was just saying for the sake of the OP and furture reference that his post wasn't as explicit as it could have been.

Clear?

SlyMaelstrom
11-15-2008, 04:18 PM
Clear?No, not at all... because that's not what he was asking and that is apparent to everyone including yourself. If he himself used hexadecimal in his own examples, as you so intelligently identified... why do you think he would care what representation the solution is in?

Zacs7 example was spot on... if someone were to ask you to solve:


0x7 + 3It wouldn't matter if you answered 10 or 0xA because the question implies that the form of the solution is allowed to be ambiguous.
I never said anyone was confusedYes, you did... you said "The post is misleading" and then directly reiterated the point two more times. This implies that you believe the question could lead someone to misunderstand the question and lead them to answer the question incorrectly. This is a forum, kid... everything you write is being recorded.

MeTh0Dz
11-15-2008, 04:20 PM
Like I said Zacs7 example doesn't apply. Look at my example if you want to see one that accurately depicts the situation.

Also, if he is using multiple bases you could assume that, or you could just assume that he misworded things. Or you could assume the former and then point out that his wording wasn't explicit.

zacs7
11-15-2008, 04:23 PM
Then perhaps you could have told the OP that "0x03" is not in binary. Which they probably already know... but stop and think what it represents first (and does a good job of doing so!)

In comparison, if there was a question:

"Give me the address of 5 from this memory diagram"
If you answered "0x59" that's perfectly correct, as is 001011001, as is 0o131, so on. You've said before, any number can be respresented in the infinite bases.

MeTh0Dz
11-15-2008, 04:25 PM
Indeed you could use any base you wanted to represent the location.

But did you anywhere in the question ask explicitly for a certain number base? No.

Therefore you are not accurately recreating the situation.

SlyMaelstrom
11-15-2008, 04:25 PM
Also, if he is using multiple bases you could assume that, or you could just assume that he misworded things. Or you could assume the former and then point out that his wording wasn't explicit.Yeah let's assume that a guy who claims knowledge of both assembly and hex editors doesn't know that 0xC5 isn't binary.

I think you've dug this hole deep enough and I believe if Yarin is satisfied with the solution provided by CodePlug then this discussion should be closed.

MeTh0Dz
11-15-2008, 04:26 PM
Dug this hole? Hmm..

Did I ever say that he didn't know anything? I just said his wording was ambiguous.

zacs7
11-15-2008, 04:30 PM
Sigh, abandon ship. Let it sink to the bottom, we'll go party on "hex island".

Sebastiani
11-15-2008, 04:38 PM
Your post is misleading.
You are talking about the hexadecimal representations.


This is just an argument of semantics. In practice, it's common to refer to things such as opcodes as 'binary' - it's not a matter of base representation but of the particular format of the data (ie: raw machine code).

MeTh0Dz
11-15-2008, 04:47 PM
Sure it is an argument of semantics, phrasing, word choice, etc.

I'm not saying that it is a huge deal, but regardless I do have a valid point, which people seem to not be able to grasp.

But continue..

Sebastiani
11-15-2008, 04:59 PM
Again, your point may be *semantically* correct, but it is *practically* moot. Everyone here knows what the OP meant. There is no ambiguity. At any rate, the original question has been answered. Can we move on now, please? ;)

MeTh0Dz
11-15-2008, 05:17 PM
Sure.... But there is inherent semantic ambiguity even by following your statement. But at any rate let's move on. I thnk everyone's thoughts are clear.

sean
11-15-2008, 05:27 PM
Thread closed. If anybody has anything further to contribute to the thread, please PM a mod.

You can probably find a reference in the back of a good assembly book. Mine has all the instructions, but it doesn't talk about everything you need to know for the conversion process. It doesn't mention how operands get coded, etc..

Incidentally, my book is published by IBM, and the appendix is titled "Binary Equivalents" and the op-codes are printed in hexadecimal - the reason being that the point of having the op-codes is accomplished whether you use binary or hexadecimal. The computer uses binary, but the human has an easier time reading hexadecimal for most purposes - and so the terms are used somewhat interchangeably in that particular application.