INT TITLE 'DMMINT (IPCS) VM/370 - RELEASE 6' 00001000 * 00002000 * MODULE NAME: DMMINT 00003000 * 00004000 * 00005000 * FUNCTION: TRANSLATE BINARY DATA TO PRINTABLE FORMAT 00006000 * 00007000 * 00008000 * ATTRIBUTES: REUSABLE 00009000 * NON-REENTRANT 00010000 * 00011000 * 00012000 * ENTRY POINTS: DMMINT 00013000 * 00014000 * 00015000 * ENTRY CONDITIONS: R3 CONTAINS BYTE COUNT, R4 POINTS TO 00016000 * LEFTMOST BYTE OF INPUT STRING. 00017000 * 00018000 * 00019000 * EXIT CONDITIONS: R5 POINTS TO TRANSLATED DATA 00020000 * 00021000 * 00022000 * CALLS TO OTHER ROUTINES: NONE 00023000 * 00024000 * 00025000 * EXTERNAL REFERENCES: NONE 00026000 * 00027000 * 00028000 * TABLES/WORKAREAS: 00029000 * 00030000 * 00031000 * REGISTER USAGE: R15 BASE 00032000 * R14 RETURN 00033000 * R13 CALLER'S SAVEAREA 00034000 * R6 - R9 WORK 00035000 * R5 OUTPUT DATA ADDRESS 00036000 * R4 INPUT DATA ADDRESS 00037000 * R3 INPUT BYTE COUNT 00038000 * 00039000 * 00040000 * NOTES: A 200 BYTE PATCH AREA EXISTS AT LABEL 'PATCH' 00041000 * 00042000 * 00043000 * OPERATION: THE INPUT DATA IS OPERATED ON 1 BYTE AT A TIME 00044000 * PRODUCING 2 OUTPUT BYTES PER 1 INPUT BYTE (2 HEX DIGITS PER 00045000 * BYTE).THE TOTAL OUTPUT RESULT IS THEN TRANSLATED TO EBCDIC. 00046000 * 00047000 * 00048000 * ERROR MESSAGES: NONE 00049000 * 00050000 * 00051000 DMMINT CSECT @VA04250 00052000 STM R14,R12,12(R13) SAVE CALLERS REGS @VA04250 00053000 LR R12,R15 LOAD BASE @VA04250 00054000 USING DMMINT,R12 TEMPORARY ADDRESSABILITY @VA04250 00055000 ST R13,SAVEBACK CALLERS REG PTR @VA04250 00056000 B EYECATCH BRANCH AROUND EYECATCHER @VA04250 00057000 DS 0D @VA04250 00058000 MODNAME DC C'DMMINT ' MODULE NAME @VA04250 00059000 RELLEV DC C'REL4LEV0' RELEASE AND LEVEL @V4075A1 00060000 EYECATCH LA R13,SAVEAREA POINT TO OUR SAVE @VA04250 00061000 *************************************************************** 00062000 * SET UP 00063000 *************************************************************** 00064000 XC RETCODE,RETCODE CLEAR RETURN CODE @VA04250 00065000 XC OUTPUT,OUTPUT SET OUTPUT TO BINARY ZERO @VA04250 00066000 SR R2,R2 CLEAR WORK FOR IC @VA04250 00067000 LR R5,R3 GET LENGTH OF DATA TO BE XLATED @VA04250 00068000 C R5,MAX64 VALID DATA LENGTH? @VA04250 00069000 BNH ZEROCHEK YES @VA04250 00070000 L R5,MAX64 NO, USE MAX ALLOWED (64) @VA04250 00071000 ZEROCHEK LTR R5,R5 TEST FOR ZERO @VA04250 00072000 BNZ CONTINUE NOT ZERO - OK @VA04250 00073000 LA R5,DEFAULT DEFAULT TO 4 @VA04250 00074000 CONTINUE ST R5,INCOUNT SAVE IT @VA04250 00075000 LA R3,OUTPUT POINT TO OUTPUT AREA @VA04250 00076000 LOOP IC R2,0(R4) NEXT INPUT BYTE @VA04250 00077000 SRL R2,4 ISOLATE 1ST 4 BITS (1 HEX DIGIT) @VA04250 00078000 STC R2,0(R3) PUT IT IN OUTPUT @VA04250 00079000 MVN 1(1,R3),0(R4) MOVE SECOND 4 BITS TO NEXT BYTE @VA04250 00080000 LA R3,TWO(R3) UP OUTPUT POINTER 2 BYTES @VA04250 00081000 LA R4,ONE(R4) UP INPUT POINTER 1 BYTE @VA04250 00082000 BCT R5,LOOP SET UP ALL OUTPUT @VA04250 00083000 *************************************************************** 00084000 * THE OUTPUT AREA NOW HAS ALL THE INPUT DATA. 00085000 * E.G. X'1234' ON INPUT NOW IS X'01020304' IN THE OUTPUT AREA 00086000 * WE NEED TO TRANSLATE THIS TO X'F1F2F3F4' AND WE ARE DONE. 00087000 *************************************************************** 00088000 L R5,INCOUNT GET LENGTH OF DATA AGAIN @VA04250 00089000 SLL R5,1 MULTIPLY BY 2 (2 HEX DIGITS/BYTE)@VA04250 00090000 BCTR R5,0 SET UP FOR EXECUTE INSTRUCTION @VA04250 00091000 EX R5,TRNSLATE TRANSLATE THE DATA TO EBCDIC @VA04250 00092000 RETURN L R13,SAVEBACK GET CALLERS SAVE @VA04250 00093000 MVC 16(L'RETCODE,R13),RETCODE PLUG RETURN CODE @VA04250 00094000 LA R2,OUTPUT RETURN RESULTS TO CALLER @VA04250 00095000 ST R2,40(R13) PLUG ADDRESS OF DATA @VA04250 00096000 LM R14,R12,12(R13) RESTORE CALLER'S REGS @VA04250 00097000 BR R14 RETURN TO CALLER @VA04250 00098000 TRNSLATE TR OUTPUT(0),TRTABLE EXECUTED TRANSLATE INSTRCTN @VA04250 00099000 *************************************************************** 00100000 * CONSTANTS SAVEAREAS AND EQUATES 00101000 *************************************************************** 00102000 RETCODE DS F RETURN CODE @VA04250 00103000 * * * * * * * * ------- -------- -------- ------- * 00104000 * * * * * * * * SAVEAREA 00105000 * * * * * * * * ------- -------- -------- ------- * 00106000 SAVEAREA DS 0F THIS PROGRAM'S SAVE AREA @VA04250 00107000 SAVEUSR DS F USER WORD @VA04250 00108000 SAVEFWD DS F FORWARD POINTER @VA04250 00109000 SAVEBACK DS F BACKWARD POINTER @VA04250 00110000 SAVER14 DS F SAVE AREA FOR CALLER'S R14 @VA04250 00111000 SAVER15 DS F SAVE AREA FOR CALLER'S R15 @VA04250 00112000 SAVER0 DS F SAVE AREA FOR CALLER'S R0 @VA04250 00113000 SAVER1 DS F SAVE AREA FOR CALLER'S R1 @VA04250 00114000 SAVER2 DS F SAVE AREA FOR CALLER'S R2 @VA04250 00115000 SAVER3 DS F SAVE AREA FOR CALLER'S R3 @VA04250 00116000 SAVER4 DS F SAVE AREA FOR CALLER'S R4 @VA04250 00117000 SAVER5 DS F SAVE AREA FOR CALLER'S R5 @VA04250 00118000 SAVER6 DS F SAVE AREA FOR CALLER'S R6 @VA04250 00119000 SAVER7 DS F SAVE AREA FOR CALLER'S R7 @VA04250 00120000 SAVER8 DS F SAVE AREA FOR CALLER'S R8 @VA04250 00121000 SAVER9 DS F SAVE AREA FOR CALLER'S R9 @VA04250 00122000 SAVER10 DS F SAVE AREA FOR CALLER'S R10 @VA04250 00123000 SAVER11 DS F SAVE AREA FOR CALLER'S R11 @VA04250 00124000 SAVER12 DS F SAVE AREA FOR CALLER'S R12 @VA04250 00125000 * * * * * * * * ------- -------- -------- ------- * 00126000 MAX64 DC F'64' MAXIMUM VALID TRANSLATION REQUEST@VA04250 00127000 OUTPUT DS CL128 OUTPUT AREA FOR TRANSLATED DATA @VA04250 00128000 INCOUNT DS F STORE FOR INPUT LENGTH @VA04250 00129000 TRTABLE DC C'0123456789ABCDEF' HEX TO CHAR HEX XLATE TABLE @VA04250 00130000 ONE EQU 1 BUMP PTR @VA04250 00131000 TWO EQU 2 BUMP PTR @VA04250 00132000 DEFAULT EQU 4 DEFAULT LENGTH @VA04250 00133000 PATCH DC 50F'0' PATCH AREA @VA04250 00134000 LTORG @VA04250 00135000 REGEQU @VA04250 00136000 END 00137000