Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Hex Or Binary


4 replies to this topic

#1 Hakkera

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 101 posts

Posted 27 September 2006 - 08:57 PM

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?

#2 osknockout

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 399 posts
  • Location:Elysium
  • Interests:quantum mechanics, war, history, epidemiology, virology,mathematics, programming, D&amp;D/NetHack<br />...old skool :)

Posted 27 September 2006 - 09:49 PM

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)

#3 ghostrider

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 398 posts
  • Gender:Male
  • Location:Wisconsin

Posted 27 September 2006 - 10:50 PM

Quote

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,

Quote

(1 byte= 2 hexes = 256 binary bits)

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

#4 osknockout

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 399 posts
  • Location:Elysium
  • Interests:quantum mechanics, war, history, epidemiology, virology,mathematics, programming, D&amp;D/NetHack<br />...old skool :)

Posted 28 September 2006 - 09:47 PM

Quote

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 years
you'd get that down. :) Anyway, ghostrider's right.

#5 Diffusr

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 116 posts

Posted 17 March 2010 - 07:26 PM

View PostHakkera, on Sep 27 2006, 09:57 PM, said:

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.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users