It looks to me that MVST is specifically designed to move C strings. That is, a 
sequence of bytes whose end is specified by a 0x00 byte. Looking at the manual, 
MVST can suffer the same problem as the C "strcpy()" function. It can cause 
memory overlays because a maximum length is not specified. TROO seems "nicer" 
in that you can use it to copy bytes until either: (1) a maximum number of 
bytes have been copied or (2) a specific byte value is found in the "translate" 
table. This could make the C "strncpy" function in only a few instructions. Of 
course, the cost is the fact that you need to "translate" the input to the 
output, even if you don't want to translate it. Which must be more expensive 
than simply copying. Makes me wonder why IBM doesn't have an MVST-like 
instruction which has a "maximum length" option. Especially since MVST is a 4 
byte instruction, but only uses 3 of the four bytes. Plenty of room in the 
instruction for another register to contain the maximum length value, or an 
immediate value as the max length (0..255 like for MVC). Also, if not used for 
that, I wonder why the stopping byte is specified in the lowest byte of GPR0 
instead of being encoded in the instruction.

In any case, I just started using TROO in one of my programs. It displays 
strings, replacing "non displayable" characters with "escaped" values. The TROO 
is used to copy the printable bytes. Printable bytes translate to themself. 
"Unprintable" bytes are 0x00 in the table. The TROO copies from the input until 
it detects a 0x00 in the translation table. It then stops, I check the CC and 
process the "unprintable" byte. This is really nice. Before it was pointed out 
to me, I was planning on moving one byte at a time from input to output, 
checking each byte for "unprintableness".


John McKown
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone *
[email protected] * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

Reply via email to