5

Second representation requires at least 6 bits to represent numbers between 0 to 59. But 5 bits are not just enough - 2^5^ = 32, which can only represent from 0 up to 31 seconds.

According to K.N. King:

You may be wondering how it 's possible to store the seconds - a number between 0 and 59 in a field with only 5 bits. Well. DOS cheats: it divides the number of seconds by 2, so the seconds member is actually between 0 and 29.

That really makes no sense?

you are viewing a single comment's thread
view the rest of the comments
[-] Thorry84@feddit.nl 2 points 2 weeks ago

Actually versions of MS-DOS were released for the MSX platform, which had a 8-bit Zilog Z80 CPU.

The number of bits mentioned when referring to processors usually refer to the size of the internal registers. You'll find that it doesn't actually matter how big the internal registers are. This just matters for the number of bits possible to process at the same time. So in order to process more bits, it just takes more steps, but it isn't impossible.

[-] MachineFab812@discuss.tchncs.de 1 points 2 weeks ago

Pretty sure no one here was worried about what was or wasn't possible, just the method that was used in this specific instance.

this post was submitted on 04 Oct 2024
5 points (100.0% liked)

The C Programming Language

632 readers
5 users here now

Everything related to the C programming language.

founded 5 years ago
MODERATORS