TAL Programmer's Guide Data Alignment Addendum
Table Of Contents

TAL Misalignment Examples
TAL Programmer's Guide Data Alignment Addendum—524967-003
4-5
Invalid Conversion of Odd-Byte String Addresses
Example 4-3. TAL Assignment of String Pointer to int Pointer (Item 1, Item 5)
Change this:
! insert 16-bit length at beginning of long string:
string .ext name;
int .ext words;
@words := @name; ! legal only when name has even address
words := lth; ! misalignment traps here
To this:
! insert 16-bit length at beginning of long string:
string .ext name;
int .ext words;
name[0] := lth '>>' 8;
name[1] := lth;
Example 4-4. TAL Pointer Equation (Item 2, Item 5)
Change this:
! extract 16-bit length from beginning of long string:
string .ext name;
int .ext words = name; ! can use only when name has even address
lth := words; ! misalignment traps here
@name := @name[2];
To this:
! extract 16-bit length from beginning of long string:
string .ext name;
lth := (name[0] '<<' 8) lor name[1];
@name := @name[2];
Example 4-5. TAL Reference Parameters (Item 3)
This code:
proc p(a);
string .ext a;
begin
int .ext b = a; ! @b is equivalenced to a formal parameter @a
z := b;
end;
call p(c); ! actual parameter address @c is assigned to formal @a
Has the same effect as this code:
string .ext a;
int .ext b = a;
@a := @c; ! explicit assignment of @c
z := b;
In either code, undiagnosed odd-byte addressing errors can occur either from the assignment or from using the
equivalenced pointers.