• Please review our updated Terms and Rules here

Yet another pointless arguement?

Terry Yager

Veteran Member
Joined
May 1, 2003
Messages
8,763
Location
Saginaw, MI, USA 48601
OK, a quickie: How many bits are in a byte? Here's another fundament on which it's difficult to get the "authorities" to agree. I was taught that the correct answer to this question is "it depends on the word length". My definition is that a byte is half a word, so that in a 16-bit computer, a byte is 8 bits. When you get into other word lengths, the byte length changes, f'rinstance, in a 12-bit system, like the DEC PDP-11 the byte length should be 6 bits. (Any DEC programmers out there care to confirm this? What is the convention in the DEC world?)
Another definition I have seen is that a byte is enough bits to contain one character, meaning (usually) 8 bits, but ASCII is actually a 7-bit standard. Very confusing...

--T
 
My understanding is that, although they are sometimes used interchangably, Byte, Character and Word are often different beasts.

A byte is always 8 bits.

A character is 7, 8 or 16 bits depending on the context.

A word can be just about anything with 8, 12 and 16 being common bit-lengths but with others existing.

Erik
 
Re: Yet another pointless arguement?

"Terry Yager" wrote:

> OK, a quickie: How many bits are in a byte?

256 isn't it?

> Another definition I have seen is that a byte is enough
> bits to contain one character, meaning (usually) 8 bits,
> but ASCII is actually a 7-bit standard. Very confusing...

Yeah, haven't you ever looked up an ASCII table to find it goes
up to 127 (which is 7 bits). My Amstrad has a 7bit printer port
which means it can only print characters up to 127 (is that
clear?)

Anyone know different?

Cheers,
CP/M User.
 
"Erik" wrote:

> My understanding is that, although they are
> sometimes used interchangably, Byte,
> Character and Word are often different
> beasts.

> A byte is always 8 bits.

Oh okay, I've just listed the number of
combinations to that, that's all! :)

> A character is 7, 8 or 16 bits depending on the
> context.

ASCII is 7 I believe.

Cheers,
CP/M User.
 
I would believe anyone working with 12, 36 or other number of bits* may not use the "byte" term too often, but instead words and half-words. I have also had this discussion elsewhere, but of the active computer users today I would say more than 90% are content with a byte is eight bits (but word length varies). If a byte always is a half word, it means the 8-bit generation has four bit bytes but we always thought they were eight bits. The mentioned 4-bits like 4004 should have two bit bytes, which is less than a nybble (normally four bits on a 8-bit machine).

*) How do you count bits - is it the ALU, the address bus, the data bus, average of all or just a number of the blue? This is another common argument, maybe more common than the number of bits in a byte.
 
carlsson said:
*) How do you count bits - is it the ALU, the address bus, the data bus, average of all or just a number of the blue? This is another common argument, maybe more common than the number of bits in a byte.

I've always counted the word length by the number of bits in the internal registers, or more specifically, the acumulator. The 8080-family has 8-bit registers and even though they are capable of handling 16-bit values (by combining registers), they are still considered 8-bitters.

--T
 
I think a 'byte' has always been eight bits.

As for word length, there have been a lot of variations. Early machines had all sorts of funky word lengths. They also didn't use 'bytes' as machines use them today.

For example, you might have a machine with a 36 bit word, and a memory that only talks in words. To stuff the letter 'A' or a '1' in memory you might only need 6 bits of a word. (Think of 26 letters, 10 numbers, and some punctuation chars - 6 bits covers that fine.) So a single word might hold 6 characters of data.

The awkward thing on old machines was that you might not be able to address a single byte in a word - you'd have to use special instructions to set the particular bits within a word that you needed. String searching would be a pain too - lots of bit manipulation.

Some architectures had 'spare' bits after you packed characters into a word. Those spare bits could be used as flags for things like 'end of string.'

As things progressed in the 50s and 60s people figured out that a byte is a good basic unit of memory, and that being able to address specific bytes is a good thing too - it cuts down on the bit twiddling.

As for the word size of a machine, well, that's typically what the ALU could process in one cycle. So you look at something like the 8086 and it's clearly a 16 bitter. But you look at an 8088 with the hampered bus and you wind up thinking of it as '16/8' instead of pure 16.
 
An extensive google search failed to turn up any support for "my" definition of "byte" (half-a-word). I did p'ticularly like the one (above) that says "more than a bit, but less than a word". I think I'll start using that definition from now on.

--T
 
Then we can start counting how many bits an image is. They say that a picture says more than a thousand words, but not exactly how much more. Given the variations in word length, a picture could be anything from 8008 bits on a Z80 to 72000 bits or more on a PDP (limiting myself at 2000 words per image, as each word already is 36 bits IIRC). :lol:
 
re The definition of a Byte

re The definition of a Byte

As usualwith me, this will be longer than most can tolorate, but It is not so simplea question.
IBM coined the term Byte when they dessigned the System 360 series in the early 1960's. A byte was the basic increment of memory, and could be considered as a quarter-word, which was 32 bits. It also defined the length of a character in the IBM Standard EBCDiC code (Extended Binary Coded DDecimal (for) Information Interchange, or something close to that) which defined 256 characters. It deliberately ignored ASCII (American Standard Code for Informatioin Interchange) which had not yet been selected as the standard for computers purchased by hte US Government. ASCII was only a seven bit code and only defined 128 characters. Notice that both ASCII and EBCDIC ignore the use of an extra bit for parity and the necessity of tacking on a start bit and one or two stop bits for asynchronus communications applications.
In my opinion, the definition of a Byte has nothing much to do with a word oength, unless the word dlengthis 32 bits. Sixteen bits is a half word, but a byte is rarely described as a quarter word. And, one canthink of a Byte being a character length, except that sometimes it doesent, like when an application iswritten that communicates ssome items of data as BCD, 1/2 byte Knibbles! Over the years there have been a half dozen or moe "character codes used , but any resembelence or appearant similarity to the Byte is purely coincidental.

As for DEC, they have used only three alphaneumeric dodes for their basic I/O uses. In the 12-bit and 18-bit computers such as the PDP-1, -4,-7, 09, -15 (18-bit machines) and the PDP-8 series the PDP-5 and a couple other special purpose versions of the PDP-8, (the 12-bit machines) all used 6-bit alphanumeric I/O codes whichdefined 64 characters. I think one can include the PDP-6 here too, bacause it was a 36-bit machine. All of the later machines which include the PDP-11 and all of the VAX machines and I think the PDP-10 too) were all 16-bit or 32-bit machines and used the ASCII codesfor I/O to printers, console printers, and other similar devices

To summarze: A Byte is 8 bits long. It does not relate to any word-length other that as a factor of the physical length of a word or a fraction of a word or a multiple of a word. If it is not a factor of the word length it is not defineable as a Byte.
Ray
 
16bit numbers

16bit numbers

"Terry Yager" wrote:

> I've always counted the word length by the
> number of bits in the internal registers, or
> more specifically, the acumulator. The
> 8080-family has 8-bit registers and even
> though they are capable of handling 16-bit
> values (by combining registers), they are
> still considered 8-bitters.

It's also possible to write equivalent of a 16bit
poke routine on my Z80. The routine I've
written may not be the best, but because you
cannot swap a 16 bit number using register
pairs, doesn't mean it can't be done, it just
takes a bit more code (that's all)!

It's like a "SRL" instruction on an IBM, on the
8086/8088 based computer's you can only
issue this instruction with 1 each time,
however on a 286 upwards you can issue a
higher number with it, for the 8086/8088 it
just means that if you want a compatable
equivalent, you'd need to put more of those
statements together (hence more code)
than the 286 equivalent.

Cheers,
CP/M User.
 
Re: 16bit numbers

Re: 16bit numbers

CP/M User said:
It's also possible to write equivalent of a 16bit
poke routine on my Z80. The routine I've
written may not be the best, but because you
cannot swap a 16 bit number using register
pairs, doesn't mean it can't be done, it just
takes a bit more code (that's all)!

It's like a "SRL" instruction on an IBM, on the
8086/8088 based computer's you can only
issue this instruction with 1 each time,
however on a 286 upwards you can issue a
higher number with it, for the 8086/8088 it
just means that if you want a compatable
equivalent, you'd need to put more of those
statements together (hence more code)
than the 286 equivalent.

Cheers,
CP/M User.

Ok, let's see if I understand how this works. (I'm just guessing.) In order to swap two registers you would set up a "buffer" area in memory, move the contents of the register into the buffer, then from memory into the target register? That kinda makes some sense to me...

--T
 
Re: 16bit numbers

Re: 16bit numbers

"Terry Yager" wrote:

> Ok, let's see if I understand how this works.
> (I'm just guessing.) In order to swap two
> registers you would set up a "buffer" area
> in memory, move the contents of the
> register into the buffer, then from memory
> into the target register? That kinda makes
> some sense to me...

If you were reading data & using that data
for a routine, then yeah, I believe you have
to do it like that.

If you were going to poke a 16bit number
then you could do this:-
Code:
Load Memory address into HL
Load Data into DE
Load contents of E into HL
Increase HL
Load contents of D into HL
Return

Or it could even be BC loading it into HL,
I suppose. I've got some assembly code
if you want to have a look at it, but I've
used it when dealing with BASIC
programs in mind, though it should work
in assembly programming (I just haven't
tested it).

Cheers,
CP/M User.
 
Re: 16bit numbers

Re: 16bit numbers

CP/M User said:
If you were going to poke a 16bit number
then you could do this:-
Code:
Load Memory address into HL
Load Data into DE
Load contents of E into HL
Increase HL
Load contents of D into HL
Return

Code:
lxi h,<address to poke to>
lxi d,<sixteen bit data to poke>
mov h,e
inx h
mov h,d
ret

I've got some assembly code
if you want to have a look at it

Yes, I'd like that, if it's no trouble.

--T
 
Re: 16bit numbers

Re: 16bit numbers

"Terry Yager" wrote:

>> If you were going to poke a 16bit number
>> then you could do this:-
Code:
>> Load Memory address into HL
>> Load Data into DE
>> Load contents of E into HL
>> Increase HL
>> Load contents of D into HL
>> Return

Code:
> lxi h,<address to poke to>
> lxi d,<sixteen bit data to poke>
> mov h,e
> inx h
> mov h,d
> ret

>> I've got some assembly code
>> if you want to have a look at it

> Yes, I'd like that, if it's no trouble.

This is what I've done on my Z80:

Code:
 LD E,(IX+00)
LD D,(IX+01)
LD L,(IX+02)
LD H,(IX+03)
LD (HL),E
INC HL
LD (HL),D
RET

So, if I was calling this (from BASIC)
it would look like this,
'CALL AOR,ATP,V'
AOC = Address of routine (which were've
just written)
ATP = Address to Poke (where to poke our
16bit number)
V = Value (which is our 16bit number!) :)

I don't quite follow your routine you posted
above, is that 8080 code? AFAIK on my Z80
you can only use the HL register pair when
storing the contents of a register into an
address. My little routine seems to work
fairly quickly though (which I'm happy
about).

Cheers,
CP/ M User.
 
Back
Top