I've been learning the architecture of computers, from the software to the hardware, and practically everything else that is used by a computer. So ofcourse, I quickly came across "Binary" numbers. I learned how to convert binary, add it, subtract, divide it, convert binary to decimal, and decimal to binary. But my question is... what can I do with this on today's computers??? From just being able to say "I know how to change the letter A, into "01000001", I feel like a pro, haha. But just knowing how to convert text and numbers into binary, and vice versa, isn't enough, I know that. I want to know what I can do with it? Is assembly language, binary? Or something very similiar? Is there some sort of "compilier" that I can send commands to my computer, using binary?
Sorry if my question seems dumb... I'm just still really new to this stuff.
This is not a Windows-specific question. If I was you I'd post it on the C forum where more people will see it.
Oh okay, thank you!
Originally Posted by oogabooga
Well, since you haven't posted in the right place yet, why not answer some questions before mods move this?
> Is assembly language, binary?
Sort of. Assembly instructions get translated directly to machine code (which is a long series of unreadable hex octets), and this gets converted to binary for the CPU/FPU/whatever else to process.
> Is there some sort of "compilier" that I can send commands to my computer, using binary?
Again, sort of. You do this by passing the commands with inline assembly. From there, it's converted down to binary and sent to process. If you want to know what actual binary commands are being sent, here's an (extensive) opcode reference chart: geek64-abc edition | X86 Opcode and Instruction Reference 1.11
And if you want to do this in C, here's how (an example of swapping two ints without xchgq):
int v1 = 1;
int v2 = 3;
asm volatile (
"movq %%rax, %%rcx\n"
"movq %%rbx, %%rax\n"
"movq %%rcx, %%rbx\n"
: "=a" (v1), "=b" (v2)
: "a" (v1), "b" (v2)
Everything in a computer is "binary" at the lowest level, including the machine language instructions, but that's just a consequence of the underlying hardware. Computers would be essentially the same if they were at bottom trinary.
Programmers try to work at a higher level, using decimal most of the time, hexadecimal when necessary, and allowing the computer to translate back and forth to the underlying representation. But sometimes they do work with bits -- see the cprogramming Bitwise Operators tutorial.
And the fact that 'A' is actually the decimal number 65, or the hexadecimal number 0x41, or the octal number 0101, or the binary number 0b01000001 is really rather arbitrary. Since you can always represent it in a programming language (including assembly language) as 'A', it doesn't much matter what its exact "code" is. What does matter is that 'B' > 'A' and so on, which allows you to sort strings of letters, although the fact that 'a' > 'A', or 'A' > '0' is arbitrary.
As for talking to your computer in binary, I think you'd grow tired of that in a very short time! But learning some assembly language is probably a good idea. Here's a couple of sites I found with google.
x86 Assembly - Wikibooks, open books for an open world
The Art of Assembly Language Programming
Thanks guys for the informative information! I really appreciate it! And sorry about not moving this yesterday, I was on the computer for like 5 minutes before I had to go. I'll go post this question where it should!