TAL Programmer's Guide

Simple Variables by Data Type
Using Simple Variables
6–6 096254 Tandem Computers Incorporated
INT Simple Variables An INT simple variable can contain a signed or unsigned 16-bit integer in the range 0
through 65,535 (unsigned) or –32,768 through 32,767 (signed). It can also contain a
character string of up to two characters:
INT a := 5; !Unsigned decimal number
INT b := -%5; !Signed octal number
INT c := %B1001111000010001; !Binary number
INT d := %h2f; !Hexadecimal number
INT e := "AB"; !Character string
You can initialize INT variables with the standard addresses of simple variables,
arrays, or structures. The @ operator fetches the address of the variable:
INT var; !Declare word-addressed VAR
INT var_addr := @var; !Declare VAR_ADDR; initialize
! it with word address of VAR
You can convert a word address to a byte address by using a logical left bit-shift
operation ('<<' 1):
INT var; !Declare word-addressed VAR
STRING .var_ptr := @var '<<' 1;
!Declare VAR_PTR; initialize
! it with converted byte
! address of VAR
You can convert a byte address to a word address by using a logical right bit-shift
operation ('>>' 1):
STRING var; !Declare byte-addressed VAR
INT var_addr := @var '>>' 1; !Declare VAR_ADDR; initialize
! it with converted word
! address of VAR