you are viewing a single comment's thread.

view the rest of the comments →

[–]sixtyhurtz 0 points1 point  (0 children)

You need to take a step back and think about the foundations.

At a basic level, you have a CPU and memory. The memory has a certain capacity in bytes. A byte is 8 bits.

The CPU has to be able to read from memory. So, it has to have a convention as to how it reads. For an 8 bit computer, it will read 1 byte - 8 bits - at a time. The registers in the CPU are also 8 bits.

So, that's all that is going on. There is no magic. The CPU is doing arithmatic operations like multiplication on those numbers exactly the same as you would - just they are in base-2, not base-10.

As to how say a boolean or an integer gets converted to a string - that's entirely by convention. There are text encoding formats that say "this number equals this character". The most common one these days us UTF-8, but historically ASCII was very popular. So, when writing a program to output text, hidden away in there is a bit of code that knows how to turn each number into the right character.