• Forum
  • Lounge
  • How do 8-bit systems represent numbers l

 
How do 8-bit systems represent numbers larger than 255?

Take for example any old console or arcade game with it's high scores. I was just wondering what technique it would use to do this. Like, I was guessing they would store values in SRAM and add them together or something when they represent it on whatever display it uses. (Because looking at SRAM ic's, I don't find many with more than an 8-bit wide word)
Last edited on
In the similar way 64-bit systems represent arbitrary precision numbers - they use vectors.
Last edited on
You can hold the less significant 8 bits in one byte and the more significant ones in another one. That way you store a 16 bit number. 8 bit CPU can only do calculations on 8 bit numbers , but it isn't too hard to perform 16 bit calculations one byte at a time the same way we do them one digit at a time in decimal.
Like hamsterman said, they used multiple bytes to represent > 8bit values. Most compilers of the time made this transparent to the developer however.
So, basically, computers can theoretically increase a number indefinitly if given infinite memory?
Yes.
Also infinite precision. There's a supercomputer somewhere that has been continuously computing the value of pi for several years. I think a few years ago there was a bit of a freak-out over it starting to repeat after something like the one billionth digit. ( I actually don't know what the digit was)

EDIT: Correct me if I'm wrong about that, I may very well be pulling a false memory out of my ass.
Last edited on
In terms of native capacity, they generally pair up two 8-bit registers to form a 16-bit register.

They generally also have at least a couple of 16-bit instructions such as add/subtract two 16-bit registers, 16-bit move register to memory and memory to register.

Beyond 16-bits, you have to do it in software. In the old days the compilers would transparently insert some subroutine calls to functions like __add32, __sub32, __mul32, in place of machine instructions.

--Mike
Topic archived. No new replies allowed.