.DR     Data Reverse


        .DR  [# | / | = | \] expression [,[# | / | = | \] expression [,...]]

See also:

.AS   .AT   .AZ   .DA   .DB   .DL   .DW   .HS   .RF   .TS  


The .DR directive is an alternative tool to enter bytes and words of data in the target code. The data is entered as one or more expressions, separated by commas.
It functions much the same as the .DA directive. The only difference is the order in which the bytes of a 16 bit value are stored.

Boundary Sync:

In Version 3 of the SB-Assembler this directive will not perform a boundary sync.


Every expression following the .DR directive will be evaluated and the lower 16 bit value of the result is stored in the target file. The order in which the bytes of a pair are stored depends on the loaded Cross Overlay. The order is opposite to the order in which the .DA directive would store the bytes of a 16 bit value. Therefore the order also depends on the loaded Cross Overlay.
The default order, when no Cross Overlay is loaded, is highest byte first. This is also known as big endian model.

The .DR directive can also be used to store single bytes in the target file. To store single bytes the expression must be preceded by one of the symbols:

# stores the lowest byte of the 32 bit result (b0..b7)
/ stores the 2nd lowest byte (b8..b15)
= stores the 2nd highest byte (b16..b23)
\ stores the highest byte (b24..b31)

Please note that there is no difference with the .DA directive when it comes to handling single bytes.

Data bytes and words can be mixed together in the same .DR directive. Multiple expressions should be separated by commas.


Be sure to load the appropriate Cross Overlay before using the .DR directive! Otherwise the first data words may be saved in the wrong order (wrong endian model).


0000-09 53 7B 23
0004-61 E1                .DR     #%1001,#@123,#123,#$123,#'a',#"a"
0006-78                   .DR     #$12345678
0007-56                   .DR     /$12345678
0008-34                   .DR     =$12345678
0009-12                   .DR     \$12345678
000A-12 34                .DR     $1234             Notice the byte order
000C-7C                   .DR     #5+$80-%1001
000D-12 34 56             .DR     $1234,#$56        Mixed words and bytes