MOVTC MOVE TRANSLATED CHARACTERS
Purpose |
to move and translate character string |
Format |
opcode srclen.rw, srcaddr.ab, fill.rb, tbladdr.ab, dstlen.rw, dstaddr.ab |
Operation |
|
Condition codes |
N ß srclen LSS dstlen; Z ß srclen EQL dstlen; V ß 0; C ß srclen LSSU dstlen; |
Exceptions |
None |
Opcodes |
2E MOVTC Move Translated Characters |
Description |
The source string specified by the source length and source address operands is translated and replaces the destination string specified by the destination length and destination address operands. Translation is accomplished by using each byte of the source string as an index into a 256-byte table whose zeros entry address is specified by the table address operand. The byte selected replaces the byte of the destination string. If the destination string is longer than the source string, the highest addressed bytes of the destination string are replaced by the fill operand. If the destination string shorter than the source string, the highest addressed bytes of the source string are not translated and moved. The operation of the instruction is such that overlap of the source and destination strings does not affect the result. It the destination string overlaps the translation table, the destination string is unpredictable. |
Notes |
1 After execution: R0 = number of translated bytes remaining in source string, R0 is non-zero only if source string is longer than destination string. R1 = address of one byte beyond the last byte in Source string that was translated. R2 = 0 R3 = address of the translation table. R4 = 0 R5 = address on one byte beyond the destination string |
Example 1
.text
main: .word 0
movtc $9, myString, $0, TranslateTable, $20, dstString
pushal dstString
calls $1, .puts
pushl $0
calls $1, .exit
.data
myString: .asciz "abcd abcd"
dstString: .space 20
TranslateTable:
.space 32
.byte 32
.space 97-33
.byte 'b, 'c, 'd, 'e