is there a simple way to check the size of 1 byte using assembly language? im not sure of how i would achieve this or if its possible? not asking for the full code...just tips on how i would achieve this
Posted on 2011-01-28 17:31:29 by dougfunny

%define size_of_byte 1
Posted on 2011-01-28 19:12:51 by SpooK
What SpooK is saying is that assembly is tied to a certain CPU by definition. You program in the CPU's native language. Therefore you always know EXACTLY what kind of CPU you are using, and as a result, you always know EXACTLY what the size of a byte is to that CPU. It's just part of the CPU's specification. And as a result of that, there isn't really a way to check for the size of a byte with most assemblers.
A byte is the smallest data type for a CPU, hence it is always '1'. But what kind of 1?

Aside from that, a byte is generally defined as 8-bits, regardless of CPU architecture. Most data in the world revolves around 8-bit bytes in one way or the other. Simple example being text, which is usually stored in 8-bit bytes (even though technically most of it is ASCII, and ASCII only defines 7-bit characters).

It's not like C for example, where there is no byte datatype defined, although char is most commonly mapped to the CPU's byte type (as the C standard says that the char should be the smallest addressable datatype of the CPU, which is usually a byte). However, a char is not necessarily 8 bits, since some CPUs can only one size of data, eg everything is 32-bits. Accessing 8-bit data with such CPUs can become a tad complicated. But I'm guessing you're just using an x86 CPU, so you don't need to worry about any of that.
Posted on 2011-01-29 04:43:58 by Scali
i can't solve your problem and i can't speak english
Posted on 2011-01-29 05:58:09 by yuyuhongss

The question was loaded.
He asked for the size of a byte, but he didn't specify what he was counting.

How many bytes are there in one byte?
One byte is always 1 bytes, on ANY machine.

How many bits? Yes, that is almost ALWAYS 8 bits, however there are some rare exceptions that use 9, 10 or more bits per byte, but those extra bits have special meaning in those operating systems, and we should still assume we have eight 'storage' bits in every byte.

Posted on 2011-01-29 08:27:41 by Homer
Perhaps he meant the value of a given byte?
Posted on 2011-01-29 11:07:13 by SpooK