On Wed, Apr 12, 2017 at 8:46 AM, zMan <[email protected]> wrote:

> I'm not clear on the difference between TR and TROO, even after reading the
> PofOp. Anyone got a good explanation?
>

​In defiance of your request for a good explanation, I will write something
[grin]. TR basically can translate 1 to 256 bytes, the length specified in
the instruction itself. So the first difference is that that (maximum)
length for the second operand in TROO is specified in the next higher
register from the "r1" register (source address register). This makes it
easier to use for something like a PL/I "char varying" string. The second
thing is the existence of the "m3" field. If the "m3" field is '...0'b then
GPR0 has a "stop character" value. This allows you to specify a maximal
length in "r1+1" register, but say "oh, if you see _this value_ (specified
in GPR0), then stop prematurely. This is very handy for a x'00' delimited C
language string (e.g. "Translate the next 20 characters, but stop before
then if you see a x'00'). The other instructions: TROT, TRTO, and TRTT also
have this functionality. This is needed in TRTT if you are using it with C
language UTF-16 (wide) encoded characters where the "end of string" is
0x0000 and not just a single 0x00. This is important because many UTF-16
characters (basically the historic "ANSI") are encoded with a leading or
trailing 0x00. E.g. "A" = 0x41 in UTF-8, but is 0x0041 in UTF-16be or
0x4100 in UTF-16le..



​Oh, and I forgot "TRE" (Translate Extended)​


-- 
"Irrigation of the land with seawater desalinated by fusion power is
ancient. It's called 'rain'." -- Michael McClary, in alt.fusion

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to