Ciprico Rimfire 3880 Manual De Usuario
User’s Guide
21020285 D
Chapter 8 Details of Usage
Byte and Word Swapping
Page 8 - 3
Byte and Word
Swapping
Swapping
The RF3880 adapter is flexible enough to allow you to request Byte Swapping,
Word Swapping, or both, during transfers of command structures.
Word Swapping, or both, during transfers of command structures.
This section will first give you some examples to explain why the swapping
feature is offered to you, then provide a perspective on implementation with
the RF3880 for both Command Structures used by the RF3880 (which the
adapter can swap) and data (which needs special software if swapping is
necessary).
feature is offered to you, then provide a perspective on implementation with
the RF3880 for both Command Structures used by the RF3880 (which the
adapter can swap) and data (which needs special software if swapping is
necessary).
Need for
Swapping
The memory architecture of your system depends on the type of processor you
are using. There are several major manufacturers that each use different
arrangements of bytes, words, and double-words in memory. The two most
common formats are: Intel and Motorola. Their differences are illustrated in
the example below:
are using. There are several major manufacturers that each use different
arrangements of bytes, words, and double-words in memory. The two most
common formats are: Intel and Motorola. Their differences are illustrated in
the example below:
Example of Memory Differences
If you were to define the following variables in a program:
char byte[] = “test”;
int word[2] = {0x0102, 0x0304};
double dword = 0xAABBCCDD;
int word[2] = {0x0102, 0x0304};
double dword = 0xAABBCCDD;
They would appear this way in memory (beginning at location n) for each
respective format:
respective format:
Essentially the two processors store a string of bytes in the same order.
However, the bytes that make up word and double-word information are stored
in an order opposite to each other:
However, the bytes that make up word and double-word information are stored
in an order opposite to each other:
The RF3880 adapter must correctly access the command structures for either
type of processor.
type of processor.
Throughout this manual, the Parameter and Status Blocks that make up the
command structures are represented double-word wide, in Motorola ordering.
command structures are represented double-word wide, in Motorola ordering.
If you have an Intel processor, you will need to translate these displays to your
format. The following example will help explain this.
format. The following example will help explain this.
variable
Byte # of memory
Intel Order
Motorola Order
byte
n
t
e
s
t
t
e
s
t
word
n + 4
02
01
04
03
01
02
03
04
dword
n + 8
DD
CC
BB
AA
AA
BB
CC
DD
Table 108: Variations in Intel and Motorola Memory
Processor Type
Byte of word or
double-word
Order in memory
Motorola
LSB*
stored in highest memory address
MSB*
stored in lowest memory address
Intel
LSB
stored in lowest memory address
MSB
stored in highest memory address
Table 109: Explanation of Memory Storage Differences