|
-
Jan 20th, 2009, 07:48 AM
#1
Thread Starter
Frenzied Member
What are the symbols if you drag any file into say notepad?
So say you have notepad open and you drag any file into it, you get a bunch of symbolised code? displayed, what exactly it this jumble of symbols, you also usually get some legible higher level code(c++ etc) like you will recognize some API function and the like?
Are these symbols machine code, but the machine code must get turned to binary at some point...why do we need machine code, it is electrity after all, you can only send a pulse of ecel. or you can't.
I thought it was only binary 0 or 1 that is the final data model to work with, in other words electricity is either send or it is not(morse code) building up patterns to produce the image on the screen.
-
Jan 20th, 2009, 08:05 AM
#2
Re: What are the symbols if you drag any file into say notepad?
A binary files contains a bunch of bytes. If you try to open such file in notepad it'll display the character that each byte represents, if any. So if you're not opening a textfile, you'll get all sorts of characters that doesnt really mean anything (in textual form). Thats it basically.
-
Jan 20th, 2009, 10:41 AM
#3
Re: What are the symbols if you drag any file into say notepad?
At the lowest level, you load a set of 32 voltages onto an input, and that triggers a certain output, depending on the chip architecture. The recognized set of input voltages that give well defined results is the instruction set of the chip. Of course, with 32 bits of input, you have about 4 billion different combinations, but the typical instruction set is probably not more than about 1-2 thousand instructions (you can get the instruction set from Intel, which might even still give you the 32 bit byte codes for each instruction). So what do you get if you use any of the other 3 billion plus sets of inputs? Just about anything, or nothing. There was one, notorious, false code on an old DEC system that would re-set the computer, wrecking anything that was operating, or something like that.
Originally, to write a program, you had to write a series of these instructions (though they were not 32 bits at that time) in binary. In some early systems, you entered the program by setting a series of levers to up or down to input a single instruction. That's machine language at it's rawest form, not a bunch of positive and negative voltages in series, but a bunch of positive and negative (or positive and 0) voltages in parallel. There's nothing magical about an 8-bit byte, either, as 9-bit bytes have also been used, and probably other sizes as well. However, an 8-bit byte is particularly convenient, as it can be represented by two digits in hexadecimal (there is no bit size that can be represented well in decimal). Machine language is just the representation of the parallel voltages that make up byte codes in the instruction set. Assembly language quickly replaced true machine language, because few people can accurately enter a string of 1s and 0s, but Assembly is simple, low-level, and difficult to work with, so higher languages were created to package and organize the code. Ultimately, it all goes to Assembly, which maps one to one with machine language, so they are effectively the same thing.
Files may be made up of a string of machine codes, or it could be text, or it could be some combination of the two. Text just means that somebody made up some definition like "This byte means the letter 'A', while this other byte means the letter 'b'", and so forth. When you open something in Notepad, the program doesn't ask whether the file holds bytes that represent machine language or text, it just assumes that you knew what you were doing and interprets the bytes as text, turning each one into it's corresponding letter, which rarely works for anything other than text files. There's a bit more to it than that, as, technically, every byte can be converted into something in ASCII, even if that something is not very valuable, but that's the general pattern.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|