Specifications
Operating System Routines
BYTE_SWAP_WORD
BYTE_SWAP_WORD
Swaps the bytes within each word in a given data transfer buffer.
Module
[DRIVER]VME_SUPPORT
Input
Location Contents
R0 Length of the data transfer buffer in bytes. This
number should fall on a word boundary.
R1 Address of the data transfer buffer.
Output
Location Contents
R0, R1 Destroyed
(All other registers preserved)
Synchronization
A driver calls BYTE_SWAP_WORD in kernel mode at or above IPL$_ASTDEL.
Description
BYTE_SWAP_WORD swaps the bytes within each word of a given data transfer.
The data is read from an input system buffer, then the byte positions of each
word are modified to a mirrored order, swapping the least significant byte (LSB)
with the most significant byte (MSB), as shown in the following figure.
Original Format:
Swapped Format:
MSB LSB
MSB LSB
ZK−3734A−GE
AB
AB
Note that if the buffer contains an odd number of bytes, the last byte in the
incomplete word at the end of the buffer is unaffected.
3–3