The BIG ENDIAN
is a constant that values non zero if the rappresentation
of data on the local CPU is in big endian. Endianness is a concept that concerns
the order in which the bytes of a multi-byte number are stored in memory.
Imagine having an integer that spans more than one byte. Endianness determines
whether the most significant byte (the one that represents the highest digit)
is stored first (at the lowest memory address) or last. In this case, the most
significant byte is stored first. It is like reading a book from left to right,
starting with the most important word.
Endianness is a fundamental aspect of computer architecture, as it affects how
data is interpreted and manipulated. Different architectures use different
endianness conventions. For example: Motorola 6809 is BIG ENDIAN
,
MOS 6502 is LITTLE ENDIAN
.
In 8-bit computers, endianness was a crucial consideration, especially when
it came to managing integers across multiple bytes. Since these computers
had limited memory, it was essential to maximize storage space.
With limited memory available, it was essential to use each byte efficiently, and
endianess directly affected arithmetic operations on multi-byte numbers, such as
addition and subtraction. Moreover, when exchanging data between systems with
different endianness, appropriate conversions is needed.
If you are writing code that directly manipulates memory, it is essential to know
the endianness of the system to avoid data interpretation errors. If you are
developing software that needs to run on different platforms, you need to account
for endianness differences and implement data conversion mechanisms, for data
that are not manager by ugBASIC itself.
= BIG ENDIAN
IF BIG ENDIAN THEN PRINT "This CPU is big endian" ENDIF
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
BIG ENDIAN (constant) ↔ BigEnd
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS