*DECK DLDIS USETEXT DLFPDEF USETEXT DEQCOM USETEXT WRDPAIR PROC DLDIS (AWORD,RETRNH,RETRNO,RETRND,RETRNA); BEGIN # *1DC DLDIS * * 1. PROC NAME AUTHOR DATE * DLDIS KRULEVITCH 78/10/10 * * 2. FUNCTIONAL DESCRIPTION * CONVERTS DATA INTO HEX,OCTAL,DISPLAY CODE CHARACTERS AND ASCII * CODE CHARACTERS. * * 3. METHOD USED * A CHARACTER WORD ITEM CONTAINS A DISPLAY CODE CONVERSION TABLE * FOR EACH HEX, OCTAL, AND ASCII CODES. * FOR DISPLAY CODE ZERO BYTES ARE CONVERTED TO BLANKS. * FOR ASCII CODE THE CONVERSION TABLE IS ADJUSTED FOR 63 OR 64 * CHARACTER SET. * THE ASCII CHARACTER IS RETRIEVED FROM AWORD. IF THIS IS THE * SECOND WORD OF A WORD PAIR THE UPPER HEX DIGIT IS IN COMMON IN * ACHAR. IF CT = CT12ASC OR CT12ASZ,THEN THE ASCII CHARACTER * IS RIGHT JUSTIFIED IN 12 BIT BYTES. * THE ASCII CHARACTER IS STORED IN THE OUTPUT WORD. 7 CHARACTERS * AND 1 BLANK ARE STORED IN ODD WORDS. 8 CHARACTERS ARE STORED IN * EVEN WORDS (PAIR=TRUE). LOWER CASE CHARACTERS ARE MAPPED INTO * UPPER CASE CHARACTERS. FOR CT = CT12ASC/CT12ASZ * 5 CHARACTERS ARE STORED WITH BLANK FILL. * * 4. ENTRY CONDITIONS * AWORD - CONTAINS MESSAGE TEXT TO BE CONVERTED * PAIR - FALSE,IF AWORD IS THE FIRST WORD OF ASCII WORD PAIR * ASKICHAR - CONTAINS THE UPPER HEX DIGIT IF PAIR IS TRUE * CT - CT8ASCII, 7.5 CHARACTERS PER WORD (ACT=2) * CT12ASC, 5 ASCII CHARACTERS PER WORD (ACT=3) * CT12ASZ, 5 ASCII CHARACTERS PER WORD,NULL CHARACTER * HAS HIGH BIT SET (ACT=5) * * 5. EXIT CONDITIONS * RETRNH - HEX OUTPUT * RETRNO - OCTAL OUTPUT * RETRND - DISPLAY CODE CHARACTERS * RETRNA - ASCII CODE CHARACTERS * * 6. COMDECKS CALLED AND SYMPL TEXTS USED. * DEQCOM DLFPDEF WRDPAIR * * 7. PROCEDURES/FUNCTIONS CALLED * DLDISO CONVERT OCTAL TO DISPLAY * * 8. DAYFILE/DIAGNOSTIC MESSAGES * NONE * # # INPUT PARAMETERS # ITEM AWORD U; # WORD TO BE CONVERTED # CONTROL PRESET; # OUTPUT PARAMETERS # ITEM RETRNH C(15); # HEXIDECIMAL CONVERSION # ITEM RETRNO C(20); # OCTAL CONVERSION # ITEM RETRND C(10); # DISPLAY CONVERSION # ITEM RETRNA C(8); # ASCII OUTPUT # # EXTERNAL REFERENCES # XREF BEGIN PROC DLDISO; # CONVERTS OCTAL TO DISPLAY CODE # END # LOCAL VARIABLES # DEF HEXL # 4 #; # HEXIDECIMAL DIGIT LENGTH IN BITS # DEF ASCL # 8 #; # ASCII CHARACTER LENGTH # DEF ASCL12 # 12 #; # ASCII CHARACTER IN 12 BIT BYTE # DEF CT12ASZ # 3 #; # CHARACTER TYPE OF ASCII, 5 PER WORD # DEF LCPOS # 52 #; # LAST POSSIBLE FULL ASCII CHARACTER POS # ARRAY MSGTEXT [0:0] S(1); BEGIN ITEM DCWORD C(0,0,10); # DISPLAY CODE CHARACTERS # ITEM TXTWORD I(0,0,WL); # WORD TO BE CONVERTED # END BASED ARRAY IPCSET [0:0] S(1); ITEM CSET B(0,0,1); # 1 IF 64CSET,0 IF 63CSET # # HEXIDECIMAL TO DISPLAY CONVERSION # ITEM HEXC C(16) = "0123456789ABCDEF"; # ASCII TO DISPLAY CONVERSION TABLE # ITEM DC C(64) = " !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_" ; ITEM ASC12BYT B=FALSE; # TRUE IF ACT=CT12ASC/CT12ASZ # ITEM ASKIPOS; # ASCII CHARACTER BIT POSITION # ITEM DCPOS; # DISPLAY CHARACTER POSITION # ITEM HEX; # 4 BIT HEXIDECIMAL DIGIT # ITEM I; # DO LOOP INDUCTION VARIABLE # ITEM J; # DO LOOP INDUCTION VARIABLE # #**********************************************************************# # DLDIS EXECUTION BEGINS HERE # # HEXIDECIMAL TO DISPLAY CONVERSION # FOR I = 0 STEP 1 UNTIL 14 DO BEGIN HEX = B AWORD; C RETRNH = C HEXC; END # OCTAL TO DISPLAY CODE CONVERSION # DLDISO(AWORD,20,RETRNO); # DISPLAY CODE CONVERSION OF ZERO BYTES FOR 64 CHARACTER SET # TXTWORD[0] = AWORD; RETRND = DCWORD[0]; # ASSUME TEXT WORD DISPLAY CODE # FOR I = 0 STEP 1 UNTIL 9 DO BEGIN IF CRETRND EQ 0 THEN # CONVERT ZERO BYTES TO BLANKS # CRETRND = " "; END # ASCII TO DISPLAY CODE CONVERSION # # CHECK INSTALLATION"S CHARACTER SET # P = CSMRLOC; # POSITION AT MACHINE CHARACTERISTIC WORD # IF NOT CSET THEN # 63 CSET # C<5>DC = " "; # % SHOULD YIELD A BLANK # ELSE # 64 CSET # C<26>DC = " "; # : SHOULD YIELD A BLANK # # INITIALIZE BEGINNING WORD-BIT POSITIONS # DCPOS = 0; # DISPLAY CHARACTER WORD POSITION # ASC12BYT = CT EQ CT12ASC OR CT EQ CT12ASZ; IF ASC12BYT # 8 BIT CODE IN 12 BIT BYTES # THEN ASKIPOS = 4; # FIRST TEXT BIT # ELSE # 8 BIT ASCII CODE, 7.5 CHAR PER WORD # ASKIPOS = 0; # FIRST TEXT BIT # FOR J = 1 STEP 1 UNTIL 8 DO # CONVERT ASCII TO DISPLAY # BEGIN # GET ASCII CHARACTER # IF ASKIPOS LQ LCPOS THEN # ASCII CHAR DOES NOT CROSS WORD BOUND # BEGIN IF PAIR AND ASKIPOS EQ 0 THEN BEGIN B<4,4>ACHAR[0] = B<0,4>AWORD; ASKIPOS = 4; # START BIT OF NEXT CHARACTER # END # LAST HALF OF ASCII CHAR # ELSE BEGIN ACHAR[0] = BAWORD; IF ASKIPOS NQ LCPOS THEN # NEXT CHARACTER IN CURRENT WORD # BEGIN IF ASC12BYT THEN ASKIPOS = ASKIPOS + ASCL12; ELSE ASKIPOS = ASKIPOS + ASCL; END ELSE # NEXT CHAR. AT START OF NEXT WORD # ASKIPOS = 0; END END ELSE # ASCII CHAR WILL CROSS WORD BOUNDARY # BEGIN IF NOT PAIR THEN B<0,4>ACHAR[0] = BAWORD; END ACHARPB[0] = 0; # ZERO PARITY BIT. # # CONVERT AND STORE DISPLAY CHARACTER # IF ACHAR[0] LQ X"20" OR (DCPOS EQ 7 AND NOT PAIR) OR (DCPOS GQ 5 AND ASC12BYT) THEN # BLANK OR NO CORRESPONDING DISPLAY CHAR # CDCWORD[0] = " "; # STORE A BLANK # ELSE # GET CORRESPONDING DISPLAY CHAR # BEGIN IF ACHAR[0] GR X"5F" THEN # MAP LOWER CASE INTO UPPER CASE # ACHAR[0] = ACHAR[0] - X"40"; ELSE ACHAR[0] = ACHAR[0] - X"20"; CDCWORD[0] = CDC; # STORE DISPLAY CHAR # END IF J NQ 8 THEN # SET CHAR POS FOR NEXT LOOP ITERATION # IF DCPOS NQ 7 THEN # MORE ROOM LEFT IN CURRENT WORD # DCPOS = DCPOS + 1; ELSE # SET POINTERS FOR NEXT WORD # DCPOS = 0; # FIRST CHARACTER # END PAIR = NOT PAIR; RETRNA = DCWORD[0]; RETURN; END # DLDIS # TERM