TranslatEt Assume a stream of 20 characters comes into location 2100 in ASCII code (extended to eight bits). Translate
to EBCDIC.
Assume:
Reg 12
Reg 15 00 00 20 00 00 00 10 00 Loc 2100-2119 (before) JOliN JONES 257 W. 95
The instruction is: 0 , o. 100 ;) 115 o
Loc 2100-2119 (after) JOHN' JONES 257 where the over bar means the same graphic in EBCDIC.
Condition code: unchanged.
Translate Table 1000 r---- 1015 1----t--4--t---+---t--+--+-+--+--,-' --"""t---+--+'-+----+----t 1016 f---l---+-+----+-.--I-,-,- --, ---, -,-,,' , -"'-, ""'--"-,--, 1032 - _. -_. --+--t---"-+-"-'j-'-- +-- ,- -,- ""'" - , 1048 ,--'- 1064 BI ( + 1080 &
$ * )
- t"""--+- -'j-'-+-"- t----+---t-----jf----c-I--=' ,',' """-
Assume:
Reg 1 (before) Reg 2 (before) Reg 12 Reg 15
Loc 3000-3029 The instruction is: Op Code 00 00 00 00 00 00 00 00 00 00 30 00 00 00 20 00 UNPK PHOUT (9), WORD ( 5 )
0, 0, ---"I:o- 12 --r-1--o ---;),--,-1"""-1 Reg 1 (after) 00 00 30 11 Reg 2 (after) 00 00 00 20 Condition code = 1; scan not completed.
In general, TRANSLATE AND TEST is executed by use
of EXECUTE, which supplies the length specification
from a register. In this way a complete statement scan
can be performed with a single TRANSLATE AND TEST instruction repeated over and over by means of
EXECUTE. This is done by computing the length of the
remaining part of the statement to be scanned in a
general register, and referencing that register in the
Rl field of EXECUTE, whose address references a TRANS­ LATE AND TEST instruction in which L=O, Bl=1, Dl=1
and the B2 and D2 reference the table to be used 'in
the scan.
Translate and Test Table 2015 1096 / -; % 2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ,--- ---- -,-- -,- - -- -- ,-- - r'- f"--- -,--,--" '- 1112
@ ... = 2016 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 I---t----+-+---+---I-"-- -,---" -"-, '-,--, ---/----I----t- -- 1128
abc de 9 hi f---t----t---j---+---I---j---- --" ",,--,1,-- 1144 I---t--_--t_-t- __ --+-_m_-t-n--t_
o
_
t-
P
, q ,',' 1 ",' 1160 u v w x y z I----t---j--t---t---t--/-----' -- ---t-'-+' "-f --- "-,- --,--"" ""
1176
1192 1208 1224
ABC D
G H I I---t----j--I---t---t--t---t----t"-"- ,-,--, ,"- ,,"-- K LMNOP QR ,-- ---- -_. __ . ,""",,-- ----
T U V W X y Z '""""'" 2 3 4 5 6 7 8 9 ,',-,-""- .... _-- ,-,- ,-,--""-"" -,- "" -- '""- -- 1256
Note: If all possible combinations of eight bits (i.e., 256 combinations)
cannot appear in the statement being translated, then a table of less than 256 bytes can be used. Translate and Test
Assume that an Autocoder statement, located on 3000- 3029, is to be scanned for various punctuation marks.
A translate and test table is constructed with zeros in
all positions except where punctuation marks are
assigned.
126 2032 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2048 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- -- 2064 0 0 0 0 0 0 0 0 0 0 0 10 15 20 25 0 -- --- 2080 90 0 0 0 0 0 0 0 0 0 0 30 35 40 45 0 -- -- 2096 80 85 0 0 0 0 0 0 0 0 0 50 55 0 0 0 -- 2112 0 0 0 0 0 0 0 0 0 0 0 60 65 70 75 0 f--- - -_.- --_.
2128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -"-_.-- 1-- --- I----- --,- -- I---- 1---- -- 2144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .. _- ---- 2160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1--- I-- -" r---- --r---- -- ------
2176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- - ,-"-" 2192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- --,- 2208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -,-- -- I-- --, --- r---- - - -"'" '" 2224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 :-:- 2256
Note: If all possible combinations of eight bits (i.e., 256 combinations)
cannot appear in the statement being scanned, then a table less than
256 bytes can be used.
Edit and Edit and Mark
The following examples show the step-by-step editing
of a packed field with a length specification of four
against a pattern 13 bytes long. The following symbols
are used: SYMDOL b
(
)
d
Assume:
MEANING
blank character
significance start character field separator character
digit-select character
Loc 1000-1012 (first operand)
Loc 120-1203 (second operand)
Reg 120 bdd,dd ( .ddbCR 02 57 42 6+ 00 00 10 00 The instruction is: OpCode D. and provides the following:
PATTERN DIGIT S TRIGGER RULE LOCATION 1000-1012 b o leave(l)bdd, dd(. ddbCR d 0 o fill hhd, dd(. ddbCR d 2 1 digit bh2, dd(. ddbCR(2) 1 leave same
1 digit bh2, 5d(. ddbCR d 5
d 7 1 digit bb2, 57 (. ddbCR ( 4 1 digit bh2, 574. ddbCR 1 leave same
d 2 1 digit bb2, 574. 2bdCR d 6+ o digit bb2, 574. 26bCR (3)
b o fill same C o fill bh2, 574, 26bbR
R o fill bb2,574,26bbb
Thus:
Loc 1000-1012 (after) bb2,574.26bCR NOTES 1. This character is saved as the fill character.
2. First nonzero digit sets S trigger to 1.
3. Plus sign in this same byte sets S trigger to zero.
Condition code = 2; result greater than zero.
If the second operand in location 1200-1203 is 00 00 02 6-, the following results are obtained:
Loc 1000-1012 (before) hdd, dd(. ddbCR Loc 1000-1012 (after) bbbbbbb. 26hCR Condition code = 1; result less than zero.
In this case the significance-start character in the
pattern causes the decimal point to be left unchanged.
The minus sign does not reset the S trigger so that
the cn symbol is also preserved.
In the edit examples above, if the initial character
of the pattern was an asterisk, then asterisk-protec­
tion would be achieved.
In the same example, if EDIT AND MARK was used:
Reg 1 (before) 00 12 34 56
Reg 1 (after) 00 00 10 02 Branch On Condition Assume a prior operation has been perfonned which
resulted in setting the condition code in the psw. The
program is to branch if the result of the previous
operation is nonzero.
The BRANCH ON CONDITION with a mask of 0111 == 7 10 in the Ml field becomes a branch-on-nonzero
instruction.
Reg 5 00000100 Reg 12 00040000 The instruction is: Op Code Ml X2 B2 D, Be 7 5 12 100 and causes a branch to location 40,200, provided the condition
code is not zero. Condition code setting is unchanged.
Execute
The ADD instruction at location 350 is to be executed
by means of EXECUTE:
Assume:
Reg 3
Reg 12
Loc 350 The instruction is: Op Code
EX o
X 2
3 00 00 00 10 00 00 03 30 AR 4,6
12
D2 10 The CPU executes the ADD instruction and takes the
next sequential instruction after EXECUTE. The move character instruction MVC at location 1200 is to be executed, and the number of characters to be
moved is computed in register 5.
Assume:
Reg 5 (rightmost 8 bits)
Reg 7
Reg 13
Loc 1200 Length field (8 bits) =
The instruction is: Op Code Rl X 2 EX 5 7 01110000 = 11210 00 00 00 50 00 00 10 50 MVC 0, 15, 100, 12, 1000 00000000 B2
13 100 The rightmost eight bits of R5 arc OR' cd with the
length portion (positions 8-15) of the instruction being
executed, at location 1200 prior to execution of MOVE. However, the actual instruction at location 1200 re-
Appendix A 127
Previous Page Next Page