Jump to content
xisto Community
Sign in to follow this  
Hakkera

Hex Or Binary

Recommended Posts

This my sound like a bit of a noob question, but it has always occured to me. On screen, we get hexadecimal code, but the processor doesnt understand that right? So, if I make a program in Hex, would I have to compile it, I understnad that Hex is shorthand binary, but would I?

Share this post


Link to post
Share on other sites

Lol, we're all noobs sometime. :) You wouldn't have to compile it.You'd just have to find a way to save it in that format, like through a hexadecimal editor,because normally data is saved in bytes (1 byte= 2 hexes = 256 binary bits)

Share this post


Link to post
Share on other sites

This my sound like a bit of a noob question, but it has always occured to me. On screen, we get hexadecimal code, but the processor doesnt understand that right? So, if I make a program in Hex, would I have to compile it, I understnad that Hex is shorthand binary, but would I?

I don't quite understand what you mean by 'Hexadecimal Code'. Can you elaborate? I should be able to answer your question, I've been writing in assembly for 3 years. If your talking about data, such as:

Somedata db 0FFh

Then that will be turned into binary when it compiles. Or if you mean you are writing a program totally in Hex, that will work too. The compiler will convert that into code that the computer can understand.

Also,

(1 byte= 2 hexes = 256 binary bits)

The above is wrong. 1 byte consists of 8 bits, thus making 256 possible characters.

Share this post


Link to post
Share on other sites

The above is wrong. 1 byte consists of 8 bits, thus making 256 possible characters.

Ah! Sorry about that. Heh, you'd think after programming in Z80 assembly for 4 yearsyou'd get that down. :) Anyway, ghostrider's right.

Share this post


Link to post
Share on other sites

This my sound like a bit of a noob question, but it has always occured to me. On screen, we get hexadecimal code, but the processor doesnt understand that right? So, if I make a program in Hex, would I have to compile it, I understnad that Hex is shorthand binary, but would I?

If you are writing whole programs in nothing but hex then you are hardly a noob. One of my programming ambitions is to be able to directly code in binary. The way that I envisage being able to do this is to learn a processor instruction set very thoroughly (e.g. x86asm or better yet risc os asm), then memorize the hex equivalent of each instruction, then become a virtuoso at converting hex to binary on sight and by memory. Eventually one could bash out any program in pure binary from mental calculations alone.Come to think of it, I can already convert hex to bin on sight e.g F is 1111 so now all I have to do is memorize the hex form of assembly instructions. The fun is just about to start. Yippee.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.